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

Functions

int main (int argc, char **argv)
 
int filterPkts (Logger *plog)
 
bool synchOSPmsg (FILE *inFile)
 
int readOSPmsg (FILE *inFile)
 

Detailed Description

Contains the command line program to extract from a binary file containing SiRF receiver message packets their payload data, and store them into an OSP binary file.

Usage:

PacketToOSP.exe {options} [PacketsFilename]

Options are:

Copyright 2016 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/2016 |First release V1.1 |2/2018 |Reviewed to run on Linux

Function Documentation

int filterPkts ( Logger plog)

filterPkts read receiver message packets from the input file, verify them and extract payload data binary which are written into the binary OSP file.

Parameters
ploga pointer to a logger object
Returns
0 if no error occurred when reading or writting, the related error code otherwise

6.1- Opens the messages binary input file;

6.2- Creates the output binary file

6.3- Reads packets from the input stream until end of file happen

int main ( int  argc,
char **  argv 
)

main gets the command line arguments, set parameters accordingly and converts data.

From the input data file containing receiver message packets, the command extracts message packets, verifies them, and writes the payload data of the correct ones to the OSP binary file. See SiRF IV ICD for details on receiver messages.

The binary OSP output files containt 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.

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 the input file
  • (3) error has occurred when creating the binary output OSP file
  • (4) error has occurred when reading packet data
  • (5) error has occurred when writing data message data

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- Setups the default values for operators in the command line

4- Parses arguments in the command line extracting options and operators

5- Sets logging level stated in option

6- Filter input binary receiver packets generating output OSP messages

int readOSPmsg ( FILE *  inFile)

readOSPmsg reads a OSP message from the input file and put ist payload data into a buffer.

Parameters
inFilethe input binary FILE containing OSP packets
Returns
the exit status according to the following values and meaning:
  • (0) when a correct formatted OSP message has been received;
  • (1) if the message has incorrect checksum;
  • (2) if error occurred when reading payload or not enought bytes were received
  • (3) if the payload length read is out of margin (>MAXBUFFERSIZE)
  • (4) if unable to read the two bytes of the OSP payload length
bool synchOSPmsg ( FILE *  inFile)

synchroOSPmsg skips bytes from input until start of OSP message is reached. Note that start of OSP message is preceded by the sequence of the two bytes START1 (A0) START2 (A2)

Parameters
inFilethe input binary FILE containing OSP packets
Returns
true if the sequence START1 START2 has been detected, false when EOF has been reached