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 "ArgParser.h"
#include "Logger.h"
#include "Utilities.h"
#include "SerialTxRx.h"
#include <thread>
#include <chrono>
#include <stdio.h>
Functions | |
int | main (int argc, char **argv) |
Contains the command line program to synchronize receiver and computer to allow reception of GNSS receiver data. The current implementation of is program synchronizes the computer serial port and its connected SiRF IV receiver.
Usage:
SynchroRX.exe {options}
Options are:
Copyright 2015 Francisco Cancillo
This file is part of the RXtoRINEX tool.
RXtoRINEX is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. RXtoRINEX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. A copy of the GNU General Public License can be found at http://www.gnu.org/licenses/.
Ver. |Date |Reason for change ---—+----—+---------------— V1.0 |2/2015 |First release V1.1 |2/2016 |Minor improvements for logging messages V1.2 |2/2018 |Adapted to new SerialTxRx I/F to set and get port parameters |Reviewed to run on Linux
int main | ( | int | argc, |
char ** | argv | ||
) |
main sets the communication between computer and receiver at the speed and mode requested.
The receiver state is defined by the following:
The computer data acquisition process state is defined by:
To allow communication between GPS receiver and computer, states of both elements shall be synchronized according to the needs stated. To synchronize computer and receiver their current states shall be known, and changed if different.
To know the receiver state is necessary to communicate with it, setting first the computer port at the same speed, stop bits and parity that the receiver. This will allow receiving and analyzing the data being generated by the receiver to know the protocol it is using.
As receiver state may be not known initially, it would be necessary to scan at different speeds data being received to identify the protocol.
To allow synchronization it is assumed the following for the receiver:
After synchronization, bit rates will be set to 9600 bps when exchanging NMEA data or to 57600 bps when exchanging OSP messages..
argc | the number of arguments passed from the command line |
argv | array with argument values passed |
The main process sequence follows:
1- Defines and sets the error logger object
2- Setups the valid options in the command line. They will be used by the argument/option parser
3- Parses arguments in the command line extracting options and operators
4- Sets logging level stated in option
5- Gets from option the protocol mode to be used
6 - Checks current computer baud rate
6 - Discover initial receiver mode and baud rate, first look for "most likely" ones:
9- When failed to discover receiver mode at usual baud rates, iterate over all baud rates setting computer port speed and sending NMEA and OSP commands to set its mode to OSP at 57600 bps. Then checks if the current receiver mode has changed to OSP.
10- If the current receiver mode is OSP, but it is wanted to be NMEA, sends a OSP command to change it, and sets computer com speed at NMEAbRate. Then checks if new mode has changed to NMEA.
11- If the current receiver mode is NMEA, but it is wanted to be OSP, sends a NMEA command to change it, and sets computer com speed at OSPbRate Then checks if new mode has changed to OSP.
12- Verify if the resulting current mode is the wanted one, and returns value accordingly