23.06.2014 - PICodeParser, PICodeInfo, PIConnection, new binary "pip_cmg"
This commit is contained in:
22
piserial.cpp
22
piserial.cpp
@@ -344,7 +344,7 @@ PIByteArray PISerial::readData(int size, double timeout_ms) {
|
||||
|
||||
|
||||
bool PISerial::openDevice() {
|
||||
piCout << "ser open" << path();
|
||||
//piCout << "ser open" << path();
|
||||
if (path().isEmpty()) return false;
|
||||
#ifdef WINDOWS
|
||||
DWORD ds = 0, sm = 0;
|
||||
@@ -519,6 +519,19 @@ bool PISerial::configureDevice(const void * e_main, const void * e_parent) {
|
||||
}
|
||||
|
||||
|
||||
PIString PISerial::constructFullPath() const {
|
||||
PIString ret(fullPathPrefix() + "://");
|
||||
ret << path() << ":" << int(inSpeed()) << ":" << dataBitsCount();
|
||||
if (parameters()[ParityControl]) {
|
||||
if (parameters()[ParityOdd]) ret << ":O";
|
||||
else ret << ":E";
|
||||
} else ret << ":N";
|
||||
if (parameters()[TwoStopBits]) ret << ":2";
|
||||
else ret << ":1";
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void PISerial::configureFromFullPath(const PIString & full_path) {
|
||||
PIStringList pl = full_path.split(":");
|
||||
for (int i = 0; i < pl.size_s(); ++i) {
|
||||
@@ -553,9 +566,10 @@ PIStringList PISerial::availableDevices(bool test) {
|
||||
HKEY key = 0;
|
||||
RegOpenKey(HKEY_LOCAL_MACHINE, (LPCTSTR)"HARDWARE\\DEVICEMAP\\SERIALCOMM", &key);
|
||||
if (key != 0) {
|
||||
char name[256], data[1024];
|
||||
DWORD name_len = 256, data_len = 1024, type = 0, index = 0;
|
||||
while (RegEnumValue(key, index, (LPTSTR)name, &name_len, NULL, &type, (uchar * )data, &data_len) == ERROR_SUCCESS) {
|
||||
char name[1024], data[1024];
|
||||
DWORD name_len = 1024, data_len = 1024, type = 0, index = 0;
|
||||
LONG ret;
|
||||
while ((ret = RegEnumValue(key, index, (LPTSTR)name, &name_len, NULL, &type, (uchar * )data, &data_len)) != ERROR_NO_MORE_ITEMS) {
|
||||
dl << PIString(data);
|
||||
index++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user