Add noreset and noraw options
This commit is contained in:
13
main.cpp
13
main.cpp
@@ -125,6 +125,8 @@ int main(int argc, char* argv[])
|
||||
("temperature", "get and print temprature")
|
||||
("humidity", "get and print humidity")
|
||||
("pressure", "get and print pressure")
|
||||
("noraw", "do not set raw mode")
|
||||
("noreset", "do not set zero on lines DTR a RST")
|
||||
;
|
||||
|
||||
try {
|
||||
@@ -150,14 +152,21 @@ int main(int argc, char* argv[])
|
||||
BOOST_LOG_TRIVIAL(debug) << "Starting Program on " << port ;
|
||||
TimeoutSerial serial(port,speed);
|
||||
serial.setTimeout(posix_time::seconds(5));
|
||||
if (! vm.count("noreset")) {
|
||||
serial.setDTR(false);
|
||||
serial.setRTS(false);
|
||||
}
|
||||
if (! vm.count("noraw")) {
|
||||
serial.setRAW();
|
||||
}
|
||||
|
||||
boost::this_thread::sleep(posix_time::milliseconds(5000));
|
||||
|
||||
if (! vm.count("noreset")) {
|
||||
line = serial.readStringUntil("\n");
|
||||
trim(line);
|
||||
BOOST_LOG_TRIVIAL(debug) << line;
|
||||
}
|
||||
|
||||
if (vm.count("measure") || vm.count("temperature") || vm.count("pressure") || vm.count("humidity")) {
|
||||
serial.writeString("measure\r\n");
|
||||
@@ -219,8 +228,8 @@ int main(int argc, char* argv[])
|
||||
|
||||
serial.writeString("rb\r\n");
|
||||
boost::this_thread::sleep(posix_time::milliseconds(100));
|
||||
serial.readChar(1);
|
||||
serial.readChar(1);
|
||||
//serial.readChar(1);
|
||||
//serial.readChar(1);
|
||||
|
||||
modem.setSerialPort(&serial);
|
||||
modem.setFilePath(path);
|
||||
|
||||
Reference in New Issue
Block a user