code style
This commit is contained in:
+26
-15
@@ -59,7 +59,8 @@ BaseLoop::BaseLoop()
|
|||||||
if (pollInterval <= 0) {
|
if (pollInterval <= 0) {
|
||||||
m_pollActive = false;
|
m_pollActive = false;
|
||||||
pollInterval = 0;
|
pollInterval = 0;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
m_pollActive = true;
|
m_pollActive = true;
|
||||||
|
|
||||||
// create Port
|
// create Port
|
||||||
@@ -142,7 +143,7 @@ void BaseLoop::start()
|
|||||||
L.log(bas, event, "<<< %s", result.c_str());
|
L.log(bas, event, "<<< %s", result.c_str());
|
||||||
|
|
||||||
// send result to client
|
// send result to client
|
||||||
result += '\n';
|
result += "\n\n";
|
||||||
message->setResult(result);
|
message->setResult(result);
|
||||||
message->sendSignal();
|
message->sendSignal();
|
||||||
|
|
||||||
@@ -177,7 +178,8 @@ string BaseLoop::decodeMessage(const string& data)
|
|||||||
escaped = false;
|
escaped = false;
|
||||||
}
|
}
|
||||||
token = previous + " " + token;
|
token = previous + " " + token;
|
||||||
} else if (token.length() == 0) // allow multiple space chars for a single delimiter
|
}
|
||||||
|
else if (token.length() == 0) // allow multiple space chars for a single delimiter
|
||||||
continue;
|
continue;
|
||||||
else if (token[0] == '"') {
|
else if (token[0] == '"') {
|
||||||
token = token.substr(1);
|
token = token.substr(1);
|
||||||
@@ -206,9 +208,11 @@ string BaseLoop::decodeMessage(const string& data)
|
|||||||
while (args.size() > argPos && args[argPos][0] == '-') {
|
while (args.size() > argPos && args[argPos][0] == '-') {
|
||||||
if (args[argPos] == "-f") {
|
if (args[argPos] == "-f") {
|
||||||
maxAge = 0;
|
maxAge = 0;
|
||||||
} else if (args[argPos] == "-v") {
|
}
|
||||||
|
else if (args[argPos] == "-v") {
|
||||||
verbose = true;
|
verbose = true;
|
||||||
} else if (args[argPos] == "-m") {
|
}
|
||||||
|
else if (args[argPos] == "-m") {
|
||||||
argPos++;
|
argPos++;
|
||||||
if (args.size() > argPos) {
|
if (args.size() > argPos) {
|
||||||
result_t result;
|
result_t result;
|
||||||
@@ -222,7 +226,8 @@ string BaseLoop::decodeMessage(const string& data)
|
|||||||
argPos = 0; // print usage
|
argPos = 0; // print usage
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
argPos = 0; // print usage
|
argPos = 0; // print usage
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -290,9 +295,11 @@ string BaseLoop::decodeMessage(const string& data)
|
|||||||
L.log(bas, error, "read: %s", getResultCode(ret));
|
L.log(bas, error, "read: %s", getResultCode(ret));
|
||||||
result << getResultCode(ret);
|
result << getResultCode(ret);
|
||||||
}
|
}
|
||||||
} else if (updateMessage != NULL) {
|
}
|
||||||
|
else if (updateMessage != NULL) {
|
||||||
result << "no data stored";
|
result << "no data stored";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
result << "message not defined";
|
result << "message not defined";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -379,7 +386,8 @@ string BaseLoop::decodeMessage(const string& data)
|
|||||||
result << getResultCode(ret);
|
result << getResultCode(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
result << "message not defined";
|
result << "message not defined";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -390,22 +398,25 @@ string BaseLoop::decodeMessage(const string& data)
|
|||||||
if (args[argPos] == "-v")
|
if (args[argPos] == "-v")
|
||||||
verbose = true;
|
verbose = true;
|
||||||
else if (args[argPos] == "-r") {
|
else if (args[argPos] == "-r") {
|
||||||
if (first)
|
if (first == true)
|
||||||
first = false;
|
first = false;
|
||||||
withRead = true;
|
withRead = true;
|
||||||
} else if (args[argPos] == "-w") {
|
}
|
||||||
if (first) {
|
else if (args[argPos] == "-w") {
|
||||||
|
if (first == true) {
|
||||||
first = false;
|
first = false;
|
||||||
withRead = false;
|
withRead = false;
|
||||||
}
|
}
|
||||||
withWrite = true;
|
withWrite = true;
|
||||||
} else if (args[argPos] == "-p") {
|
}
|
||||||
if (first) {
|
else if (args[argPos] == "-p") {
|
||||||
|
if (first == true) {
|
||||||
first = false;
|
first = false;
|
||||||
withRead = false;
|
withRead = false;
|
||||||
}
|
}
|
||||||
withPassive = true;
|
withPassive = true;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
argPos = 0; // print usage
|
argPos = 0; // print usage
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -412,7 +412,8 @@ result_t BusHandler::handleSymbol()
|
|||||||
if (isMaster(m_currentRequest->m_master[1]) == true) {
|
if (isMaster(m_currentRequest->m_master[1]) == true) {
|
||||||
return setState(bs_sendSyn, RESULT_OK);
|
return setState(bs_sendSyn, RESULT_OK);
|
||||||
}
|
}
|
||||||
} else if (isMaster(m_command[1]) == true) {
|
}
|
||||||
|
else if (isMaster(m_command[1]) == true) {
|
||||||
receiveCompleted();
|
receiveCompleted();
|
||||||
return setState(bs_skip, RESULT_OK);
|
return setState(bs_skip, RESULT_OK);
|
||||||
}
|
}
|
||||||
@@ -591,7 +592,8 @@ result_t BusHandler::setState(BusState state, result_t result, bool firstRepetit
|
|||||||
m_currentRequest->m_busLostRetries++;
|
m_currentRequest->m_busLostRetries++;
|
||||||
m_nextRequests.add(m_currentRequest); // repeat
|
m_nextRequests.add(m_currentRequest); // repeat
|
||||||
m_currentRequest = NULL;
|
m_currentRequest = NULL;
|
||||||
} else if (state == bs_sendSyn || (result != RESULT_OK && firstRepetition == false)) {
|
}
|
||||||
|
else if (state == bs_sendSyn || (result != RESULT_OK && firstRepetition == false)) {
|
||||||
LOG(bus, debug, "notify request: %s", getResultCode(result));
|
LOG(bus, debug, "notify request: %s", getResultCode(result));
|
||||||
unsigned char dstAddress = m_currentRequest->m_master[1];
|
unsigned char dstAddress = m_currentRequest->m_master[1];
|
||||||
if (result == RESULT_OK && isValidAddress(dstAddress, false) == true)
|
if (result == RESULT_OK && isValidAddress(dstAddress, false) == true)
|
||||||
@@ -655,7 +657,8 @@ void BusHandler::receiveCompleted()
|
|||||||
else if (master == true) {
|
else if (master == true) {
|
||||||
LOG(upd, trace, "update MM cmd: %s", m_command.getDataStr().c_str());
|
LOG(upd, trace, "update MM cmd: %s", m_command.getDataStr().c_str());
|
||||||
m_seenAddresses[dstAddress] = true;
|
m_seenAddresses[dstAddress] = true;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
LOG(upd, trace, "update MS cmd: %s / %s", m_command.getDataStr().c_str(), m_response.getDataStr().c_str());
|
LOG(upd, trace, "update MS cmd: %s / %s", m_command.getDataStr().c_str(), m_response.getDataStr().c_str());
|
||||||
m_seenAddresses[dstAddress] = true;
|
m_seenAddresses[dstAddress] = true;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -186,7 +186,8 @@ static result_t readConfigFiles(const string path, const string extension, DataF
|
|||||||
if (result != RESULT_OK)
|
if (result != RESULT_OK)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} else if (d->d_type == DT_REG || d->d_type == DT_LNK) {
|
}
|
||||||
|
else if (d->d_type == DT_REG || d->d_type == DT_LNK) {
|
||||||
string fn = d->d_name;
|
string fn = d->d_name;
|
||||||
|
|
||||||
if (fn.find(extension, (fn.length() - extension.length())) != string::npos
|
if (fn.find(extension, (fn.length() - extension.length())) != string::npos
|
||||||
@@ -270,7 +271,8 @@ int main(int argc, char* argv[])
|
|||||||
L += new LogConsole(calcAreaMask(A.getOptVal<const char*>("logareas")),
|
L += new LogConsole(calcAreaMask(A.getOptVal<const char*>("logareas")),
|
||||||
calcLevel(A.getOptVal<const char*>("loglevel")),
|
calcLevel(A.getOptVal<const char*>("loglevel")),
|
||||||
"logconsole");
|
"logconsole");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// make me daemon
|
// make me daemon
|
||||||
D.run("/var/run/ebusd.pid");
|
D.run("/var/run/ebusd.pid");
|
||||||
L += new LogFile(calcAreaMask(A.getOptVal<const char*>("logareas")),
|
L += new LogFile(calcAreaMask(A.getOptVal<const char*>("logareas")),
|
||||||
|
|||||||
@@ -127,11 +127,11 @@ void printErrorPos(vector<string>::iterator begin, const vector<string>::iterato
|
|||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (begin < pos) {
|
if (begin < pos)
|
||||||
cnt += 1+(*begin).length()+1;
|
cnt += 1+(*begin).length()+1;
|
||||||
} else if (begin == pos) {
|
else if (begin == pos)
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
|
||||||
string item = *begin++;
|
string item = *begin++;
|
||||||
cout << TEXT_SEPARATOR << item << TEXT_SEPARATOR;
|
cout << TEXT_SEPARATOR << item << TEXT_SEPARATOR;
|
||||||
}
|
}
|
||||||
@@ -647,7 +647,8 @@ result_t StringDataField::writeSymbols(istringstream& input,
|
|||||||
value -= 2000;
|
value -= 2000;
|
||||||
else if (value > 99)
|
else if (value > 99)
|
||||||
return RESULT_ERR_OUT_OF_RANGE; // invalid year
|
return RESULT_ERR_OUT_OF_RANGE; // invalid year
|
||||||
} else if (value < 1 || (i == 0 && value > 31) || (i == 1 && value > 12))
|
}
|
||||||
|
else if (value < 1 || (i == 0 && value > 31) || (i == 1 && value > 12))
|
||||||
return RESULT_ERR_OUT_OF_RANGE; // invalid date part
|
return RESULT_ERR_OUT_OF_RANGE; // invalid date part
|
||||||
break;
|
break;
|
||||||
case bt_tim:
|
case bt_tim:
|
||||||
@@ -898,7 +899,7 @@ result_t NumberDataField::readSymbols(SymbolString& input,
|
|||||||
}
|
}
|
||||||
signedValue = (int) value; // negative signed value
|
signedValue = (int) value; // negative signed value
|
||||||
}
|
}
|
||||||
else if (negative) // negative signed value
|
else if (negative == true) // negative signed value
|
||||||
signedValue = (int) value - (1 << m_bitCount);
|
signedValue = (int) value - (1 << m_bitCount);
|
||||||
else
|
else
|
||||||
signedValue = (int) value;
|
signedValue = (int) value;
|
||||||
@@ -907,7 +908,8 @@ result_t NumberDataField::readSymbols(SymbolString& input,
|
|||||||
if ((m_dataType.flags & (FIX|BCD)) == (FIX|BCD))
|
if ((m_dataType.flags & (FIX|BCD)) == (FIX|BCD))
|
||||||
output << setw(m_length * 2) << setfill('0');
|
output << setw(m_length * 2) << setfill('0');
|
||||||
output << static_cast<int>(signedValue) << setw(0);
|
output << static_cast<int>(signedValue) << setw(0);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
output << setprecision(m_precision)
|
output << setprecision(m_precision)
|
||||||
<< fixed << static_cast<float>(signedValue / (float) m_divisor);
|
<< fixed << static_cast<float>(signedValue / (float) m_divisor);
|
||||||
|
|
||||||
|
|||||||
@@ -109,12 +109,15 @@ result_t Message::create(vector<string>::iterator& it, const vector<string>::ite
|
|||||||
if (last >= '0' && last <= '9') { // poll priority (=active get)
|
if (last >= '0' && last <= '9') { // poll priority (=active get)
|
||||||
pollPriority = last - '0';
|
pollPriority = last - '0';
|
||||||
defaultName = string(str).substr(0, len - 1); // cut off priority digit
|
defaultName = string(str).substr(0, len - 1); // cut off priority digit
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
defaultName = str;
|
defaultName = str;
|
||||||
} else if (strncasecmp(str, "W", 1) == 0) { // active set
|
}
|
||||||
|
else if (strncasecmp(str, "W", 1) == 0) { // active set
|
||||||
isSet = true;
|
isSet = true;
|
||||||
defaultName = str;
|
defaultName = str;
|
||||||
} else { // any other: passive set/get
|
}
|
||||||
|
else { // any other: passive set/get
|
||||||
isPassive = true;
|
isPassive = true;
|
||||||
isSet = strcasecmp(str+len-1, "W") == 0; // if type ends with "w" it is treated as passive set
|
isSet = strcasecmp(str+len-1, "W") == 0; // if type ends with "w" it is treated as passive set
|
||||||
defaultName = str;
|
defaultName = str;
|
||||||
@@ -178,11 +181,11 @@ result_t Message::create(vector<string>::iterator& it, const vector<string>::ite
|
|||||||
for (int pos=0, useDefaults=1; pos<2; pos++) { // message id (PBSB, optional master data)
|
for (int pos=0, useDefaults=1; pos<2; pos++) { // message id (PBSB, optional master data)
|
||||||
string token = *it++;
|
string token = *it++;
|
||||||
if (useDefaults == 1) {
|
if (useDefaults == 1) {
|
||||||
if (pos == 0 && token.size() > 0) {
|
if (pos == 0 && token.size() > 0)
|
||||||
useDefaults = 0;
|
useDefaults = 0;
|
||||||
} else {
|
else
|
||||||
token = getDefault("", defaults, defaultPos).append(token);
|
token = getDefault("", defaults, defaultPos).append(token);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
istringstream input(token);
|
istringstream input(token);
|
||||||
if (it == end)
|
if (it == end)
|
||||||
@@ -257,7 +260,8 @@ result_t Message::prepareMaster(const unsigned char srcAddress, SymbolString& ma
|
|||||||
if (m_dstAddress == SYN)
|
if (m_dstAddress == SYN)
|
||||||
return RESULT_ERR_INVALID_ADDR;
|
return RESULT_ERR_INVALID_ADDR;
|
||||||
result = master.push_back(m_dstAddress, false, false);
|
result = master.push_back(m_dstAddress, false, false);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
result = master.push_back(dstAddress, false, false);
|
result = master.push_back(dstAddress, false, false);
|
||||||
if (result != RESULT_OK)
|
if (result != RESULT_OK)
|
||||||
return result;
|
return result;
|
||||||
@@ -473,10 +477,12 @@ deque<Message*> MessageMap::findAll(const string& clazz, const string& name, con
|
|||||||
if (message->isPassive() == true) {
|
if (message->isPassive() == true) {
|
||||||
if (withPassive == false)
|
if (withPassive == false)
|
||||||
continue;
|
continue;
|
||||||
} else if (message->isSet() == true) {
|
}
|
||||||
|
else if (message->isSet() == true) {
|
||||||
if (withWrite == false)
|
if (withWrite == false)
|
||||||
continue;
|
continue;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (withRead == false)
|
if (withRead == false)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,7 +199,8 @@ result_t DeviceNetwork::openDevice(const string deviceName, const bool noDeviceC
|
|||||||
return RESULT_ERR_NOTFOUND;
|
return RESULT_ERR_NOTFOUND;
|
||||||
|
|
||||||
memcpy(&sock.sin_addr, he->h_addr_list[0], he->h_length);
|
memcpy(&sock.sin_addr, he->h_addr_list[0], he->h_length);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ret = inet_aton(host, &sock.sin_addr);
|
ret = inet_aton(host, &sock.sin_addr);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
return RESULT_ERR_NOTFOUND;
|
return RESULT_ERR_NOTFOUND;
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ result_t SymbolString::push_back(const unsigned char value, const bool isEscaped
|
|||||||
if (isEscaped == false && value == ESC) {
|
if (isEscaped == false && value == ESC) {
|
||||||
m_data.push_back(ESC);
|
m_data.push_back(ESC);
|
||||||
m_data.push_back(0x00);
|
m_data.push_back(0x00);
|
||||||
if (updateCRC) {
|
if (updateCRC == true) {
|
||||||
addCRC(ESC);
|
addCRC(ESC);
|
||||||
addCRC(0x00);
|
addCRC(0x00);
|
||||||
}
|
}
|
||||||
@@ -124,14 +124,14 @@ result_t SymbolString::push_back(const unsigned char value, const bool isEscaped
|
|||||||
else if (isEscaped == false && value == SYN) {
|
else if (isEscaped == false && value == SYN) {
|
||||||
m_data.push_back(ESC);
|
m_data.push_back(ESC);
|
||||||
m_data.push_back(0x01);
|
m_data.push_back(0x01);
|
||||||
if (updateCRC) {
|
if (updateCRC == true) {
|
||||||
addCRC(ESC);
|
addCRC(ESC);
|
||||||
addCRC(0x01);
|
addCRC(0x01);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_data.push_back(value);
|
m_data.push_back(value);
|
||||||
if (updateCRC)
|
if (updateCRC == true)
|
||||||
addCRC(value);
|
addCRC(value);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ result_t SymbolString::push_back(const unsigned char value, const bool isEscaped
|
|||||||
if (m_unescapeState != 1)
|
if (m_unescapeState != 1)
|
||||||
return RESULT_ERR_ESC; // invalid unescape state
|
return RESULT_ERR_ESC; // invalid unescape state
|
||||||
m_data.push_back(value);
|
m_data.push_back(value);
|
||||||
if (updateCRC) {
|
if (updateCRC == true) {
|
||||||
if (value == ESC) {
|
if (value == ESC) {
|
||||||
addCRC(ESC);
|
addCRC(ESC);
|
||||||
addCRC(0x00);
|
addCRC(0x00);
|
||||||
@@ -157,7 +157,7 @@ result_t SymbolString::push_back(const unsigned char value, const bool isEscaped
|
|||||||
return RESULT_OK;
|
return RESULT_OK;
|
||||||
}
|
}
|
||||||
else if (m_unescapeState != 1) {
|
else if (m_unescapeState != 1) {
|
||||||
if (updateCRC)
|
if (updateCRC == true)
|
||||||
addCRC(value);
|
addCRC(value);
|
||||||
|
|
||||||
if (value == 0x00) {
|
if (value == 0x00) {
|
||||||
@@ -173,13 +173,13 @@ result_t SymbolString::push_back(const unsigned char value, const bool isEscaped
|
|||||||
return RESULT_ERR_ESC; // invalid escape sequence
|
return RESULT_ERR_ESC; // invalid escape sequence
|
||||||
}
|
}
|
||||||
else if (value == ESC) {
|
else if (value == ESC) {
|
||||||
if (updateCRC)
|
if (updateCRC == true)
|
||||||
addCRC(value);
|
addCRC(value);
|
||||||
|
|
||||||
m_unescapeState = 2;
|
m_unescapeState = 2;
|
||||||
return RESULT_IN_ESC;
|
return RESULT_IN_ESC;
|
||||||
}
|
}
|
||||||
if (updateCRC)
|
if (updateCRC == true)
|
||||||
addCRC(value);
|
addCRC(value);
|
||||||
|
|
||||||
m_data.push_back(value);
|
m_data.push_back(value);
|
||||||
|
|||||||
@@ -100,7 +100,8 @@ int main()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cout << "\"" << check[2] << "\": find OK" << endl;
|
cout << "\"" << check[2] << "\": find OK" << endl;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
vector<string>::iterator it = entries.begin();
|
vector<string>::iterator it = entries.begin();
|
||||||
result = Message::create(it, entries.end(), NULL, templates, deleteMessage);
|
result = Message::create(it, entries.end(), NULL, templates, deleteMessage);
|
||||||
if (failedCreate == true) {
|
if (failedCreate == true) {
|
||||||
@@ -162,7 +163,8 @@ int main()
|
|||||||
|
|
||||||
bool match = inputStr == output.str();
|
bool match = inputStr == output.str();
|
||||||
verify(false, "decode", check[2] + "/" + check[3], match, inputStr, output.str());
|
verify(false, "decode", check[2] + "/" + check[3], match, inputStr, output.str());
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
result = message->prepareMaster(0xff, writeMstr, input);
|
result = message->prepareMaster(0xff, writeMstr, input);
|
||||||
if (failedPrepare == true) {
|
if (failedPrepare == true) {
|
||||||
if (result == RESULT_OK)
|
if (result == RESULT_OK)
|
||||||
|
|||||||
@@ -90,7 +90,8 @@ bool Appl::parseArgs(int argc, char* argv[])
|
|||||||
lastOption = true;
|
lastOption = true;
|
||||||
|
|
||||||
// find option with short format '-'
|
// find option with short format '-'
|
||||||
} else if (_argv[i].rfind("-") == 0 && _argv[i].size() > 1) {
|
}
|
||||||
|
else if (_argv[i].rfind("-") == 0 && _argv[i].size() > 1) {
|
||||||
|
|
||||||
// walk through all characters
|
// walk through all characters
|
||||||
for (size_t j = 1; j < _argv[i].size(); j++) {
|
for (size_t j = 1; j < _argv[i].size(); j++) {
|
||||||
@@ -110,7 +111,8 @@ bool Appl::parseArgs(int argc, char* argv[])
|
|||||||
lastOption = true;
|
lastOption = true;
|
||||||
|
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// break loop with command
|
// break loop with command
|
||||||
if (lastOption == false && strlen(m_withCommand) != 0)
|
if (lastOption == false && strlen(m_withCommand) != 0)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -58,7 +58,8 @@ TCPSocket* TCPClient::connect(const string& server, const int& port)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
memcpy(&address.sin_addr, he->h_addr_list[0], he->h_length);
|
memcpy(&address.sin_addr, he->h_addr_list[0], he->h_length);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ret = inet_aton(server.c_str(), &address.sin_addr);
|
ret = inet_aton(server.c_str(), &address.sin_addr);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -86,7 +86,8 @@ public:
|
|||||||
else if (m_queue.size() > 0) {
|
else if (m_queue.size() > 0) {
|
||||||
item = m_queue.front();
|
item = m_queue.front();
|
||||||
m_queue.pop_front();
|
m_queue.pop_front();
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
item = NULL;
|
item = NULL;
|
||||||
|
|
||||||
pthread_mutex_unlock(&m_mutex);
|
pthread_mutex_unlock(&m_mutex);
|
||||||
|
|||||||
@@ -95,7 +95,8 @@ int main(int argc, char* argv[])
|
|||||||
port.close();
|
port.close();
|
||||||
if(port.isOpen() == false)
|
if(port.isOpen() == false)
|
||||||
cout << "closePort successful." << endl;
|
cout << "closePort successful." << endl;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
cout << "error opening device " << A.getOptVal<const char*>("device") << endl;
|
cout << "error opening device " << A.getOptVal<const char*>("device") << endl;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user