Main Page   Interface   Data Structures   File List   Data Fields   Globals  

GPS.h File Reference

Balloon Flight GPS utilities, Interface. More...

#include <time.h>

Data Structures

struct  _GPS_irep
 An integer binary representation of the GPS data. More...

struct  _GPS_latitude
 Holds a latitude reading. More...

struct  _GPS_longitude
 Holds a longitude reading. More...

struct  _GPS_pm_mbf
 Symbolic layout of a GPS Position Message in Motorola Binary Format. More...


Defines

#define GPS_K_PM_MBF_SIZE   (sizeof (GPS_pm_mbf))
 The size, in bytes of a GPS record.


Typedefs

typedef enum _GPS_status GPS_status
 Typedef for the enum _GPS_status.

typedef _GPS_pm_mbf GPS_pm_mbf
 Typedef for the struct _GPS_pm_mbf.

typedef _GPS_latitude GPS_latitude
 Typedef for struct GPS_latitude. More...

typedef _GPS_longitude GPS_longitude
 Typedef for struct _GPS_longitude. More...

typedef enum _GPS_fix_mode GPS_fix_mode
 Typedef for enum _GPS_fix_mode. More...

typedef enum _GPS_fix_type GPS_fix_type
 Typedef for enum _GPS_fix_type. More...

typedef _GPS_irep GPS_irep
 Typedef for struct _GPS_irep. More...


Enumerations

enum  _GPS_status {
  GPS_C_STATUS_ERR_CHECKSUM = -5,
  GPS_C_STATUS_ERR_POSTAMBLE = -4,
  GPS_C_STATUS_ERR_PREAMBLE = -3,
  GPS_C_STATUS_ERR_TOO_SHORT = -2,
  GPS_C_STATUS_ERR_IO = -1,
  GPS_C_STATUS_OKAY = 0
}
 The status codes returned by the GPS facility. More...

enum  _GPS_fix_mode {
  GPS_K_FIX_MODE_AUTONOMOUS = 0,
  GPS_K_FIX_TYPE_DIFFERENTIAL = 1
}
 The fix modes. More...

enum  _GPS_fix_type {
  GPS_K_FIX_TYPE_NONE = 0,
  GPS_K_FIX_TYPE_1D = 1,
  GPS_K_FIX_TYPE_2D = 2,
  GPS_K_FIX_TYPE_PROPOGATE = 3
}
 The fix types. More...


Functions

int GPS_open (const char *dev_name)
 Opens a file descriptor to the GPS device. More...

int GPS_init (int fd)
 Initializes the GPS device. More...

int GPS_rate_set (int fd, int rate)
 Sets the update frequency. More...

int GPS_read (int fd, unsigned char buf[GPS_K_PM_MBF_SIZE])
 Reads the GPS message. More...

GPS_status GPS_verify (const unsigned char buf[GPS_K_PM_MBF_SIZE])
 Performs rudimentary checks on the GPS record. More...

int GPS_checksum_verify (const unsigned char buf[GPS_K_PM_MBF_SIZE])
 Verifies the checksum for the GPS record. More...

time_t GPS_utc_get (const unsigned char buf[GPS_K_PM_MBF_SIZE])
 Converts a position message in Motorola Binary Format to a UTC time. The precision is seconds. More...


Detailed Description

Balloon Flight GPS utilities, Interface.

Author:
JJRussell - russell@slac.stanford.edu

Typedef Documentation

GPS_fix_mode
 

Typedef for enum _GPS_fix_mode.

These enumerate the various fix modes.

GPS_fix_type
 

Typedef for enum _GPS_fix_type.

These enumerate the various fix types.

GPS_irep
 

Typedef for struct _GPS_irep.

This structue is designed to hold all the information present in a GPS ASCII record without without losing any accuracy and without using any floating point representations. Care is taken to 4-byte align the quantities.

GPS_latitude
 

Typedef for struct GPS_latitude.

This structure is designed to hold all the information present in a GPS latitude reading without using any accuracy (for instance by translating minutes to decimal fractions of a degree) or using a floating point representation.

GPS_longitude
 

Typedef for struct _GPS_longitude.

This structure is designed to hold all the information present in a GPS longitude reading without losing any accuracy (for instance by translating minutes to decimal fractions of a degree) or using a floating point representation.


Enumeration Type Documentation

enum _GPS_fix_mode
 

The fix modes.

Enumeration values:
GPS_K_FIX_MODE_AUTONOMOUS  GPS fix mode = Autonomous
GPS_K_FIX_TYPE_DIFFERENTIAL  GPS fix mode = Differential

enum _GPS_fix_type
 

The fix types.

Enumeration values:
GPS_K_FIX_TYPE_NONE  GPS fix type = NONE
GPS_K_FIX_TYPE_1D  GPS fix type = 1D
GPS_K_FIX_TYPE_2D  GPS fix type = 2D
GPS_K_FIX_TYPE_PROPOGATE  GPS fix type = Propogate mode

enum _GPS_status
 

The status codes returned by the GPS facility.

Enumeration values:
GPS_C_STATUS_ERR_CHECKSUM  Checksum error
GPS_C_STATUS_ERR_POSTAMBLE  Error in the postamble
GPS_C_STATUS_ERR_PREAMBLE  Error in the preamble
GPS_C_STATUS_ERR_TOO_SHORT  Not enough bytes to read
GPS_C_STATUS_ERR_IO  Read/Write error
GPS_C_STATUS_OKAY  Everything is okay


Function Documentation

int GPS_checksum_verify const unsigned char    buf[GPS_K_PM_MBF_SIZE]
 

Verifies the checksum for the GPS record.

Parameters:
buf  The buffer containing the GPS record to verify.
Returns:
Status, 0 if else non-zero

int GPS_init int    fd
 

Initializes the GPS device.

Parameters:
fd  A previously opened file descriptor to the GPS device
Returns:
Status, 0 if okay, -1 if error.

int GPS_open const char *    dev_name
 

Opens a file descriptor to the GPS device.

Parameters:
dev_name  The name of the GPS device. If given as NULL, defaults to "/tyCo/1".
Returns:
The file descriptor.
Separating the open from the initialization allows for some testing.

int GPS_rate_set int    fd,
int    rate
 

Sets the update frequency.

Parameters:
fd  A previously opened file descriptor to the GPS device
rate  The update rate, in seconds (between 0-255).
Returns:
Status, 0 if okay, -1 if error.

int GPS_read int    fd,
unsigned char    buf[GPS_K_PM_MBF_SIZE]
 

Reads the GPS message.

Parameters:
fd  The file descriptor to read.
buf  The buffer to receive the ASCII message.
Returns:
>= 0 The number of attempts (after the initial attempt) until successfully read 96 bytes ending in CR/LF. -1 if have an IO error. -2 an insufficient number of bytes where read before encountering LF. The length of
This routine should only be used for the most rudimentary testing. Reading the GPS message correctly requires some method of synchronizing to the message arrival. This synchronization is outside the scope of these routines. Once one is synchronized, all that is needed is a simple read (fd, buf, 96) call.

time_t GPS_utc_get const unsigned char    buf[GPS_K_PM_MBF_SIZE]
 

Converts a position message in Motorola Binary Format to a UTC time. The precision is seconds.

Parameters:
buf  The GPS time/position message.
Returns:
The UTC time in seconds after 1970

GPS_status GPS_verify const unsigned char    buf[GPS_K_PM_MBF_SIZE]
 

Performs rudimentary checks on the GPS record.

Parameters:
buf  The buffer containing the GPS record to verify.
Return values:
GPS_C_STATUS_OKAY 
GPS_C_STATUS_ERR_PREAMBLE 
GPS_C_STATUS_ERR_POSTAMBLE 
GPS_C_STATUS_ERR_CHECKSUM 


Generated on Fri Mar 1 16:56:56 2002 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001