c++ - Libserial read serial port -
i using libserial
library interact modem using c++. c++ code sends @ command:
my_serial_stream << "at+csq" << '\r' ;
the modem responds response, either error
or ok
,
the c++ code read response:
while( serial_port.rdbuf()->in_avail() > 0 ) { char next_byte; serial_port.get(next_byte); std::cerr << std::hex << (int)next_byte << " "; } std::cerr << std::endl;
i handle response such if response ok
, modem sends command , if response error
, modem resends first command.
Comments
Post a Comment