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.
Functions
RXtoOSP.cpp File Reference
#include "ArgParser.h"
#include "Logger.h"
#include "Utilities.h"
#include "SerialTxRx.h"
#include <stdio.h>

Functions

int acquireBin (SerialTxRx, FILE *, int, int, int, Logger *)
 
int main (int argc, char **argv)
 

Detailed Description

Contains the command line program to capture OSP message data from a SiRF IV receiver and stores them in a OSP binary file.

Usage:

OSPDataLogger.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 V2.0 |2/2016 |Improve logging |Add commands for SiRFV V2.1 |2/2018 |Reviewed to run on Linux

Function Documentation

int acquireBin ( SerialTxRx  port,
FILE *  outFile,
int  maxMsgs,
int  maxEpochs,
int  patience,
Logger plog 
)

acquireBin acquires binary OSP messages from the receiver and record them in the binary OSP file. Data are read from the receiver and written to the OSP file until:

  • the maximum number of messages is reached, or
  • the maximum number of epoch is reached, or
  • an unrecoverable error happens reading data from receiver
  • a write error happens
Parameters
portthe SerialTxRx object used to communicate with the receiver
outFilethe binary output file to record the messages received from receiver
maxMsgsthe maximum number of messages to be recorded
maxEpochsthe maximum number of epochs to be recorded
patiencethe maximum number of erroneous contiguous bytes to read before returning a read error
plogthe pinter to the Logger
Returns
a read status according to the following values and meaning:
  • (0) no errors have been detected
  • (6) error has occurred when writing data read from receiver
  • (7) error reading data from receiver: patience exahusted or EOF

The acquireBin process sequence follows:

1- Sets counters

2- Reads messages from the input stream until counts exhausted or unrecoverable error happen

  • Log message read using format OSP<MID,length> Result
  • Update counters and write message to OSP file
int main ( int  argc,
char **  argv 
)

main gets the command line arguments, set parameters accordingly and triggers the data acquisition from the receiver. The SiRFIV GPS receiver shall be connected to a serial port and ready to receive and send messages. To be ready for this command, the receiver and computer shall be synchronized at the same baud rate, and the receiver sending / accepting OSP messages.

This command sends messages to the receiver to state the data flow with the messages and rates needed to generate OSP files that could be used for the further extraction of data used in RINEX and RTK files.

From the input receiver data stream, the command extracts the messages requested, verifies then, and writes the correct ones to the OSP binary file. See SiRF IV ICD for details on receiver messages.

The binary OSP output files contain messages where head, check and tail have been removed, that is, the data for each message consists of the two bytes of the payload length and the payload bytes.

The SynchroRX command line provided in this project can be used to check and set the receiver state: baud rate, accept/send OSP or NMEA messages, etc. Other utilities provided by receiver manufacturers exist that could perform this synchro task.

Parameters
argcthe number of arguments passed from the command line
argvthe array of arguments passed from the command line
Returns
the exit status according to the following values and meaning:
  • (0) no errors have been detected
  • (1) an error has been detected in arguments
  • (2) error when opening and setting the communication port
  • (3) the receiver is not sending OSP messages
  • (4) error has occurred when setting receiver
  • (5) error has occurred when creating the binary output OSP file
  • (6) error has occurred when writing data read from receiver

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- Computes observation interval and number of epochs to read from data given in options

6- Defines and sets up the SerialTxRx object to be used for communication with the receiver

7- Verifies that receiver mode is OSP

8- Sends OSP commands to the communication port to perform receiver setup

8- Creates the output binary file

9- Calls acquireBin to acquire and record data form receiver