|
RXtoRINEX
V2.1
RXtoRINEX provides tools to collect data from GPS / GNSS receivers in mobile devices, convert them to RINEX or RTK formats, and process RINEX files.
|
#include <SerialTxRx.h>
Public Member Functions | |
| SerialTxRx (void) | |
| ~SerialTxRx (void) | |
| void | openPort (string portName) |
| void | setPortParams (int baudRate, int timeout=1) |
| void | getPortParams (int &baudRate, int &timeout, bool &rawMode) |
| int | readOSPmsg (int patience=MAXBUFFERSIZE *2) |
| int | readNMEAmsg (int patience=MAXBUFFERSIZE) |
| void | writeOSPcmd (int mid, string cmdArgs, int base=16) |
| void | writeNMEAcmd (int mid, string cmdArgs) |
| void | closePort () |
| void | sleepTime (int ms) |
Public Attributes | |
| unsigned char | paylenBuff [2] |
| a 2 bytes buffer for the payload length bytes | |
| unsigned char | payBuff [MAXBUFFERSIZE] |
| message payload data buffer of MAXBUFFERSIZE bytes | |
| unsigned int | payloadLen |
| the current payload length, for convenience | |
SerialTxRx class defines a data and method to manage the serial comm port where a receiver is connected, and allows sending and receiving messages through it. A program using SerialTxRx would perform the following steps after declaring an object of this class:
| SerialTxRx::SerialTxRx | ( | void | ) |
Constructs an empty SerialTxRx object, without setting comms port parameters.
| SerialTxRx::~SerialTxRx | ( | void | ) |
Destructs SerialTxRx objects.
| void SerialTxRx::closePort | ( | ) |
closePort closes the currently open serial port.
| void SerialTxRx::getPortParams | ( | int & | baudRate, |
| int & | timeout, | ||
| bool & | rawMode | ||
| ) |
getPortParams gets current port parameters: baud rate, byte size and parity.
| baudRate | a variable to place the value of the baud rate |
| timeout | a variable to place the value of the timeout limit when reading input |
| mode | a variable to place a true value if raw mode (non canonical) is used, or false otherwise |
| error | string with the message explaining it |
| void SerialTxRx::openPort | ( | string | portName | ) |
openPort opens the serial port portName to allow reception of messages or sending commands to a SiRF receiver.
| portName | the name of the port to be opened |
| error | message when the port cannot be open, explaining the reason |
| int SerialTxRx::readNMEAmsg | ( | int | patience = MAXBUFFERSIZE | ) |
readNMEAmsg reads a NMEA message from the serial port.
| patience | the maximum number of skipped chars or unsuccessful reads before returning |
| int SerialTxRx::readOSPmsg | ( | int | patience = MAXBUFFERSIZE*2 | ) |
readOSPmsg reads a OSP message from the serial port.
| patience | is the maximum number of bytes to skip or unsuccessful reads from the serial port before returning error |
| void SerialTxRx::setPortParams | ( | int | baudRate, |
| int | timeout = 1 |
||
| ) |
setPortParams sets port baud rate. Other relevant port parameters are set to the following values:
| baudRate | the value of the baud rate to be set |
| timeout | the limit for a timer in tenths of a second to wait for input data |
| error | string with the message explaining it |
| void SerialTxRx::sleepTime | ( | int | ms | ) |
sleepTime stops the process for the milliseconds stated Here it is implemented a version for Windows
| void SerialTxRx::writeNMEAcmd | ( | int | mid, |
| string | cmdArgs | ||
| ) |
writeNMEAcmd builds a NMEA message command and sends it to receiver through to the serial port.
| mid | the identification of the command to be generated in the form $PSRF<mid>, ... |
| cmdArgs | the message parameters: a comma separated list of arguments |
| error | string message explaining it |
| void SerialTxRx::writeOSPcmd | ( | int | mid, |
| string | cmdArgs, | ||
| int | base = 16 |
||
| ) |
writeOSPcmd builds a OSP message command and sends it to receiver through the serial port.
| mid | the message identification of the OSP command to be generated |
| cmdArgs | the rest of message payload, as a whitespace-separated sequence of bytes |
| base | the base used to write the parameters (16, 10, ...) |
| error | string when message cannot be send |
1.8.9.1