novatel.c File Reference


Detailed Description

GNSS core 'c' function library: decoding/encoding NovAtel data.

Author:
Glenn D. MacGougan (GDM)
Date:
2007-11-29
Since:
2006-08-04
REFERENCES

"LICENSE INFORMATION"
Copyright (c) 2007, refer to 'author' doxygen tags
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file novatel.c.

#include <stdio.h>
#include "novatel.h"
#include "gps.h"
#include "constants.h"

Go to the source code of this file.

Functions

BOOL NOVATELOEM4_FindNextMessageInFile (FILE *fid, unsigned char *message, const unsigned maxMessageLength, BOOL *wasEndOfFileReached, BOOL *wasMessageFound, unsigned *filePosition, unsigned short *messageLength, unsigned short *messageID, unsigned *numberBadCRC)
 Find the next NovAtel OEM4 message in an open file.
BOOL NOVATELOEM4_DecodeBinaryMessageHeader (const unsigned char *message, const unsigned short messageLength, NOVATELOEM4_structBinaryHeader *header)
 Decode a Novatel OEM4 binary message header given a complete binary message.
BOOL NOVATELOEM4_DecodeRANGECMPB (const unsigned char *message, const unsigned short messageLength, NOVATELOEM4_structBinaryHeader *header, NOVATELOEM4_structObservation *obsArray, const unsigned char maxNrObs, unsigned *nrObs)
 Decode a NovAtel OEM4 RANGEBCMPB message.
BOOL NOVATELOEM4_DecodeRANGEB (const unsigned char *message, const unsigned short messageLength, NOVATELOEM4_structBinaryHeader *header, NOVATELOEM4_structObservation *obsArray, const unsigned char maxNrObs, unsigned *nrObs)
 Decode a NovAtel OEM4 RANGEB message.
BOOL NOVATELOEM4_DecodeTrackingStatus (const unsigned rawTrackingStatus, NOVATELOEM4_structTrackingStatus *trackingStatus)
 Decode the raw 32 bit value that contains tracking status information.
BOOL NOVATELOEM4_DecodeRAWEPHEMB (const unsigned char *message, const unsigned short messageLength, NOVATELOEM4_structBinaryHeader *header, unsigned *prn, unsigned *reference_week, unsigned *reference_time, unsigned *tow, unsigned short *iodc, unsigned char *iode, unsigned *toe, unsigned *toc, unsigned short *week, unsigned char *health, unsigned char *alert_flag, unsigned char *anti_spoof, unsigned char *code_on_L2, unsigned char *ura, unsigned char *L2_P_data_flag, unsigned char *fit_interval_flag, unsigned short *age_of_data_offset, double *tgd, double *af2, double *af1, double *af0, double *m0, double *delta_n, double *ecc, double *sqrta, double *omega0, double *i0, double *w, double *omegadot, double *idot, double *cuc, double *cus, double *crc, double *crs, double *cic, double *cis)
 Decode a NovAtel OEM4 RAWEPHEMB message.


Function Documentation

BOOL NOVATELOEM4_DecodeBinaryMessageHeader ( const unsigned char *  message,
const unsigned short  messageLength,
NOVATELOEM4_structBinaryHeader header 
)

Decode a Novatel OEM4 binary message header given a complete binary message.

Author:
Glenn D. MacGougan (GDM)
Date:
2007-11-29
Since:
2006-11-10
Returns:
TRUE(1) if successful, FALSE(0) otherwise.
Parameters:
message  The message buffer containing a complete NOVATEL OEM4 binary message (input).
messageLength  The length of the entire message (input).
header  A pointer to a NovAtel OEM4 header information struct (output).

Definition at line 368 of file novatel.c.

BOOL NOVATELOEM4_DecodeRANGEB ( const unsigned char *  message,
const unsigned short  messageLength,
NOVATELOEM4_structBinaryHeader header,
NOVATELOEM4_structObservation obsArray,
const unsigned char  maxNrObs,
unsigned *  nrObs 
)

Decode a NovAtel OEM4 RANGEB message.

Given a message buffer with a complete NovAtel OEM4 RANGEB binary message, and a user provided array of observation structs, this function will decode the binary message into the user provided array.

Author:
Glenn D. MacGougan (GDM)
Date:
2007-11-29
Since:
2006-11-10
Returns:
TRUE(1) if successful, FALSE(0) otherwise.
Parameters:
message  The message buffer containing a complete RANGEB message (input).
messageLength  The length of the entire message (input).
header  A pointer to a NovAtel OEM4 header information struct (output).
obsArray  A pointer to a user provided array of struct_NOVATELOEM4_RANGE (output).
maxNrObs  The maximum number of elements in the array provided (input).
nrObs  The number of valid elements set in the array (output).

Definition at line 626 of file novatel.c.

BOOL NOVATELOEM4_DecodeRANGECMPB ( const unsigned char *  message,
const unsigned short  messageLength,
NOVATELOEM4_structBinaryHeader header,
NOVATELOEM4_structObservation obsArray,
const unsigned char  maxNrObs,
unsigned *  nrObs 
)

Decode a NovAtel OEM4 RANGEBCMPB message.

Given a message buffer with a complete NovAtel OEM4 RANGECMPB binary message, and a user provided array of observation structs, this function will decode the compressed binary message into the user provided array.

Author:
Ossama Al-Fanek (OA-F)
Date:
March 17, 2007
Remarks:
Reviewed by GDM, March 17, 2007.
Returns:
TRUE(1) if successful, FALSE(0) otherwise.
Parameters:
message  The message buffer containing a complete RANGEB message (input).
messageLength  The length of the entire message (input).
header  A pointer to a NovAtel OEM4 header information struct (output).
obsArray  A pointer to a user provided array of struct_NOVATELOEM4_RANGE (output).
maxNrObs  The maximum number of elements in the array provided (input).
nrObs  The number of valid elements set in the array (output).

Definition at line 434 of file novatel.c.

BOOL NOVATELOEM4_DecodeRAWEPHEMB ( const unsigned char *  message,
const unsigned short  messageLength,
NOVATELOEM4_structBinaryHeader header,
unsigned *  prn,
unsigned *  reference_week,
unsigned *  reference_time,
unsigned *  tow,
unsigned short *  iodc,
unsigned char *  iode,
unsigned *  toe,
unsigned *  toc,
unsigned short *  week,
unsigned char *  health,
unsigned char *  alert_flag,
unsigned char *  anti_spoof,
unsigned char *  code_on_L2,
unsigned char *  ura,
unsigned char *  L2_P_data_flag,
unsigned char *  fit_interval_flag,
unsigned short *  age_of_data_offset,
double *  tgd,
double *  af2,
double *  af1,
double *  af0,
double *  m0,
double *  delta_n,
double *  ecc,
double *  sqrta,
double *  omega0,
double *  i0,
double *  w,
double *  omegadot,
double *  idot,
double *  cuc,
double *  cus,
double *  crc,
double *  crs,
double *  cic,
double *  cis 
)

Decode a NovAtel OEM4 RAWEPHEMB message.

Given a message buffer with a complete NovAtel OEM4 RAWEPHEMB binary message, this function will decode the content into useable ephemeris information.

Author:
Glenn D. MacGougan (GDM)
Date:
2007-11-29
Since:
2006-11-10
Returns:
TRUE(1) if successful, FALSE(0) otherwise.
Parameters:
message  The message buffer containing a complete RANGEB message (input).
messageLength  The length of the entire message (input).
header  A pointer to a NovAtel OEM4 header information struct (output).
prn  The satellite PRN number.
reference_week  The reference GPS week (0-1024+) [weeks].
reference_time  The reference GPS time of week (0-604800) [s].
tow  The time of week in subframe1, the time of the leading bit edge of subframe 2 [s]
iodc  10 bit issue of data (clock), 8 LSB bits will match the iode []
iode  8 bit issue of data (ephemeris) []
toe  reference time ephemeris (0-604800) [s]
toc  reference time (clock) (0-604800) [s]
week  10 bit gps week 0-1023 (user must account for week rollover ) [week]
health  6 bit health parameter, 0 if healthy, unhealth othersize [0=healthy]
alert_flag  1 = URA may be worse than indicated [0,1]
anti_spoof  anti-spoof flag from 0=off, 1=on [0,1]
code_on_L2  0=reserved, 1=P code on L2, 2=C/A on L2 [0,1,2]
ura  User Range Accuracy lookup code, 0 is excellent, 15 is use at own risk [0-15], see p. 83 GPSICD200C
L2_P_data_flag  flag indicating if P is on L2 1=true [0,1]
fit_interval_flag  fit interval flag (four hour interval or longer) 0=4 fours, 1=greater [0,1]
age_of_data_offset  age of data offset [s]
tgd  group delay [s]
af2  polynomial clock correction coefficient (rate of clock drift) [s/s^2]
af1  polynomial clock correction coefficient (clock drift) [s/s]
af0  polynomial clock correction coefficient (clock bias) [s]
m0  mean anomaly at reference time [rad]
delta_n  mean motion difference from computed value [rad/s]
ecc  eccentricity []
sqrta  square root of the semi-major axis [m^(1/2)]
omega0  longitude of ascending node of orbit plane at weekly epoch [rad]
i0  inclination angle at reference time [rad]
w  argument of perigee [rad]
omegadot  rate of right ascension [rad/s]
idot  rate of inclination angle [rad/s]
cuc  amplitude of the cosine harmonic correction term to the argument of latitude [rad]
cus  amplitude of the sine harmonic correction term to the argument of latitude [rad]
crc  amplitude of the cosine harmonic correction term to the orbit radius [m]
crs  amplitude of the sine harmonic correction term to the orbit radius [m]
cic  amplitude of the cosine harmonic correction term to the angle of inclination [rad]
cis  amplitude of the sine harmonic correction term to the angle of inclination [rad]

Definition at line 795 of file novatel.c.

BOOL NOVATELOEM4_DecodeTrackingStatus ( const unsigned  rawTrackingStatus,
NOVATELOEM4_structTrackingStatus trackingStatus 
)

Decode the raw 32 bit value that contains tracking status information.

Author:
Glenn D. MacGougan (GDM)
Date:
2007-11-29
Since:
2006-11-10
Returns:
TRUE(1) if successful, FALSE(0) otherwise.
Parameters:
rawTrackingStatus  The raw 32 bit tracking status value.
trackingStatus  The decoded tracking status information.

Definition at line 740 of file novatel.c.

BOOL NOVATELOEM4_FindNextMessageInFile ( FILE *  fid,
unsigned char *  message,
const unsigned  maxMessageLength,
BOOL *  wasEndOfFileReached,
BOOL *  wasMessageFound,
unsigned *  filePosition,
unsigned short *  messageLength,
unsigned short *  messageID,
unsigned *  numberBadCRC 
)

Find the next NovAtel OEM4 message in an open file.

Search a file (FILE*), that is already open, for the next NovAtel OEM4 message. The user must provide a message buffer with an associated maximum length (8192 bytes recommended ).

Author:
Glenn D. MacGougan (GDM)
Date:
2007-11-29
Since:
2006-11-09
Returns:
TRUE(1) if successful, FALSE(0) otherwise.
Parameters:
fid  A file pointer to an open file (input).
message  A message buffer in which to place the message found (input/output).
maxMessageLength  The maximum size of the message buffer (input).
wasEndOfFileReached  Has the end of the file been reached (output).
wasMessageFound  Was a valid message found (output).
filePosition  The file position for the start of the message found (output).
messageLength  The length of the entire message found and stored in the message buffer (output).
messageID  The message ID of the message found.
numberBadCRC  The number of bad crc values found. (crc fails or mistaken messages).

Definition at line 152 of file novatel.c.