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.
Public Member Functions | List of all members
OSPMessage Class Reference

#include <OSPMessage.h>

Public Member Functions

 OSPMessage (void)
 
 ~OSPMessage (void)
 
bool fill (FILE *)
 
int get ()
 
int getInt ()
 
unsigned int getUInt ()
 
short int getShort ()
 
short unsigned int getUShort ()
 
float getFloat ()
 
double getDouble ()
 
int getInt3 ()
 
bool skipBytes (int n)
 
unsigned int payloadLen ()
 

Detailed Description

OSPMessage class provides resources to perform data acquisition from OSP message payload. Note that a payload is a part of the OSP message described in the SiRF ICD.

The class allows a cursor based, buffered acquisition process from the OSP file and include methods to get values for basic data types at the current position of the cursor from the byte stream in the payload.

Methods are defined to:

Constructor & Destructor Documentation

OSPMessage::OSPMessage ( void  )

Constructs and empty OSPMessage object.

OSPMessage::~OSPMessage ( void  )

Destructs OSPmessage objects.

Member Function Documentation

bool OSPMessage::fill ( FILE *  file)

fill fills a OSPMessage object buffer with data extracted from next message in the OSP binary file. First the length of next payload message is read, and then the payload bytes are read into the buffer. The buffer cursor for further extractions from the buffer is set to 0.

For a message to be correctly read:

  • payload length shall be correctly read and its value shall be less than the maximum payload size (as defined in the OSP ICD)
  • payload bytes shall be correctly read
Parameters
filethe pointer to the OSP binary FILE containing messages
Returns
true when a message was correctly read, false otherwise (read error or end of file found)
int OSPMessage::get ( )

get gets the byte value in the payload at current cursor position. The cursor is incremented by one after getting the byte.

Returns
the byte value at cursor
Exceptions
theinteger value 1 when it is intended to get data after the end of payload
double OSPMessage::getDouble ( )

getDouble gets eight bytes starting at cursor which are interpreted as a 64 bits floating number. Double numbers are stored in the payload with bytes in the following order: 3, 2, 1, 0, 4, 5, 6, 7. The cursor is incremented by eight

Returns
the float value of the eight bytes starting at cursor
Exceptions
theinteger value 7 when it is intended to get data after the end of payload
float OSPMessage::getFloat ( )

getFloat gets four bytes starting at cursor which are interpreted as a 32 bits floating number. Floating numbers are stored in the payload with bytes in reverse order. The cursor is incremented by four

Returns
the float value of the four bytes starting at cursor
Exceptions
theinteger value 6 when it is intended to get data after the end of payload
int OSPMessage::getInt ( )

getInt gets four bytes starting at cursor which are interpreted as a 32 bits integer. Integers are stored in the payload with the most significant byte first. The cursor is incremented by four

Returns
the integer value of the four bytes starting at cursor
Exceptions
theinteger value 2 when it is intended to get data after the end of payload
int OSPMessage::getInt3 ( )

getInt3 gets three bytes starting at cursor which are interpreted as a 24 bits signed integer. Integers are stored in the payload with the most significant byte first. The cursor is incremented by three

Returns
the integer value of the four bytes starting at cursor
Exceptions
theinteger value 8 when it is intended to get data after the end of payload
short OSPMessage::getShort ( )

getShort gets two bytes starting at cursor which are interpreted as a 16 bits integer. Integers are stored in the payload with the most significant byte first. The cursor is incremented by four

Returns
the short integer value of the two bytes starting at cursor
Exceptions
theinteger value 4 when it is intended to get data after the end of payload
unsigned int OSPMessage::getUInt ( )

getUInt method gets four bytes starting at cursor which are interpreted as a 32 bits unsigned integer. Integers are stored in the payload with the most significant byte first. The cursor is incremented by four

Returns
the unsigned integer value of the four bytes starting at cursor
Exceptions
theinteger value 3 when it is intended to get data after the end of payload
unsigned short OSPMessage::getUShort ( )

getUShort gets from payload two bytes starting at cursor which are interpreted as a 16 bits unsigned integer. Integers are stored in the payload with the most significant byte first. The cursor is incremented by four

Returns
the unsigned short integer value of the two bytes starting at cursor
Exceptions
theinteger value 5 when it is intended to get data after the end of payload
unsigned int OSPMessage::payloadLen ( )

payloadLen provides the length of the current payload

Returns
the payload length of the message in buffer
bool OSPMessage::skipBytes ( int  n)

skipBytes skips the number of bytes stated in the argument from the payload buffer. It increments the payload cursor to allow next data extraction of values after bytes skipped.

Parameters
nthe number of bytes to skip, or increment to apply to the buffer cursor
Returns
true if the cursor remains inside current payload (cursor < payloadLength)

The documentation for this class was generated from the following files: