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
GP2toOSP.cpp File Reference
#include <string.h>
#include <time.h>
#include "ArgParser.h"
#include "Logger.h"

Functions

int main (int argc, char *argv[])
 

Detailed Description

Contains the command line program to generate an OSP file with SiRF IV receiver messages from a GP2 debug file obtained from Android devices, like the smartphone Samsung Galaxy S2.

Usage:

GP2toOSP.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/2016 |Reviewed to run on Linux

Function Documentation

int main ( int  argc,
char *  argv[] 
)

main gets the command line arguments, set parameters accordingly and translates data from the input GP2 file format to the output OSP file. Input data are contained in a SCLog.gp2 debug file generated by Android OS when the option DEBUGGING_FILES=1 is set in the sirfgps.conf file of some devices, like the Samsung Galaxy S2 smartphone.

Each line in the GP2 file has a format as per the following example:

29/10/2014 20:31:08.942 (0) A0 A2 00 12 33 06 00 00 00 00 00 00 00 19 00 00 00 00 00 00 64 E1 01 97 B0 B3

Where:

  • Time tag: 29/10/2014 20:31:08.942
  • Unknown: (0)
  • Head: A0 A2
  • Payload length: 00 12
  • Payload: 33 06 00 00 00 00 00 00 00 19 00 00 00 00 00 00 64 E1
  • Checksum: 01 97
  • Tail: B0 B3 Note that in above format, data from "head" to "tail" is an OSP messages with values written in hexadecimal. A detailed definition of OSP messages can be found in the document "SiRFstarIV� One Socket Protocol Interface Control Document Issue 9" from CSR Inc.

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.

Input data are processed according to the following criteria:

  • Lines with incorrect message format are skipped. To be correct, a message shall start with A0A2, end with B0B3, its length shall match the number of bytes in the payload, and the computed payload checksum shall be equal to provided checksum.
  • Lines with time tag outside the time interval of validity are skipped. By default this interval is [01/01/2014 00:00:00 , 31/12/2020 23:59:59]. A different time interval can be defined using the related command options.
  • Lines containing messages with MID not in the list of "wanted MIDs" are skipped. By default this list includes the MID values used to generate RINEX files (2,6,7,56,8,11,12,15,28,50,64,75). A different list can be defined using the related command options. Possibility exists to not filter messages (ALL MID wanted).
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 when creating output file

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- Sets the list of wanted messages

6- Sets start and end time of the time interval for messages wanted

7- Opens the SP2 input file

8- Creates the OSP binary output file

9- Extracts/verifies/filters line by line messages from the SP2 file and translate/write them into OSP format