ebusctl: some error messages added.
This commit is contained in:
+1
-1
@@ -94,7 +94,7 @@ int CYCData::findData(const std::string& data) const
|
||||
if (data.length() < 10)
|
||||
return -3;
|
||||
|
||||
// preapre string for searching command
|
||||
// prepare string for searching command
|
||||
std::string search(data.substr(2, 8 + strtol(data.substr(8,2).c_str(), NULL, 16) * 2));
|
||||
|
||||
std::size_t index;
|
||||
|
||||
+22
-14
@@ -185,29 +185,34 @@ int main(int argc, char* argv[])
|
||||
Port port(dev, true);
|
||||
|
||||
port.open();
|
||||
if(port.isOpen() == true)
|
||||
if(port.isOpen() == true) {
|
||||
std::cout << "openPort successful." << std::endl;
|
||||
|
||||
std::fstream file(A.getParam<const char*>("p_file"), std::ios::in | std::ios::binary);
|
||||
std::fstream file(A.getParam<const char*>("p_file"), std::ios::in | std::ios::binary);
|
||||
|
||||
if(file.is_open() == true) {
|
||||
if(file.is_open() == true) {
|
||||
|
||||
while (file.eof() == false) {
|
||||
unsigned char byte = file.get();
|
||||
std::cout << std::hex << std::setw(2) << std::setfill('0')
|
||||
<< static_cast<unsigned>(byte) << std::endl;
|
||||
while (file.eof() == false) {
|
||||
unsigned char byte = file.get();
|
||||
std::cout << std::hex << std::setw(2) << std::setfill('0')
|
||||
<< static_cast<unsigned>(byte) << std::endl;
|
||||
|
||||
port.send(&byte, 1);
|
||||
usleep(A.getParam<long>("p_time"));
|
||||
port.send(&byte, 1);
|
||||
usleep(A.getParam<long>("p_time"));
|
||||
}
|
||||
|
||||
file.close();
|
||||
} else {
|
||||
std::cout << "error opening file " << A.getParam<const char*>("p_file") << std::endl;
|
||||
}
|
||||
|
||||
file.close();
|
||||
port.close();
|
||||
if(port.isOpen() == false)
|
||||
std::cout << "closePort successful." << std::endl;
|
||||
} else {
|
||||
std::cout << "error opening device " << A.getParam<const char*>("p_device") << std::endl;
|
||||
}
|
||||
|
||||
port.close();
|
||||
if(port.isOpen() == false)
|
||||
std::cout << "closePort successful." << std::endl;
|
||||
|
||||
} else {
|
||||
|
||||
TCPClient* client = new TCPClient();
|
||||
@@ -280,6 +285,9 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
delete socket;
|
||||
} else {
|
||||
std::cout << "error connecting to " << A.getParam<const char*>("p_server")
|
||||
<< ":" << A.getParam<int>("p_port") << std::endl;
|
||||
}
|
||||
|
||||
delete client;
|
||||
|
||||
Reference in New Issue
Block a user