cbcons.c File Reference

Console application for retrieving GPS positions from a serial port. More...

#include "cbgps.h"
#include "cbgpx.h"
#include <stdio.h>
#include <math.h>
#include <string.h>

Data Structures

struct  _gpsctx
 Context structure for the gps callback. More...

Defines

#define MAXBUF   127

Functions

static void _cbsicb (const char *aText, CBSERINFO aType, void *aCtx)
 Callback function retrieving serial port info. Prints information about available ports, baudrates, databits, stopbits etc. to stdout.
static void _gpscb (double anUTC, double anNLat, double anELon, double anAlt, double aUTME, double aUTMN, void *aCtx)
 Callback function for handling retrieved GPS coordinates.
static void _portinfo (const char *aProgName)
 Prints usage info incl. information about available serial ports.
static void _process (const char *aPort, const char *aBaud, const char *databits, const char *aParity, const char *stopbits)
 Makes the whole job.
int main (int argc, char **argv)
 The main function of the console application.


Detailed Description

Console application for retrieving GPS positions from a serial port.


Define Documentation

#define MAXBUF   127


Function Documentation

static void _cbsicb ( const char *  aText,
CBSERINFO  aType,
void *  aCtx 
) [static]

Callback function retrieving serial port info. Prints information about available ports, baudrates, databits, stopbits etc. to stdout.

Parameters:
aText the retrieved information text, eg. port name, name of the available baudrate, number of databits, stopbits or the name of the parity.
aType the type of the information in aText.
aCtx ignored.
See also:
cbserinfo()

static void _gpscb ( double  anUTC,
double  anNLat,
double  anELon,
double  anAlt,
double  aUTME,
double  aUTMN,
void *  aCtx 
) [static]

Callback function for handling retrieved GPS coordinates.

Prints the retrieved coordinates to stdout.

Parameters:
anUTC the UTC time,
anNLat the latitude, positive for North, negative for South.
anELon the longitude, positive for East, negative for West.
anAlt the altitude in meters.
aUTME the UTM easting in kilometers.
aUTMN the UTM northing in kilometers.
aCtx casted tp struct _gpsctx. Used in order to decide, if the coordinates changed signoficantly enough to show them.

static void _portinfo ( const char *  aProgName  )  [static]

Prints usage info incl. information about available serial ports.

Parameters:
aProgName name of this program, usually argv[0].

static void _process ( const char *  aPort,
const char *  aBaud,
const char *  databits,
const char *  aParity,
const char *  stopbits 
) [static]

Makes the whole job.

Starts reading gps and prints coordinates coming in the callback function.

Parameters:
aPort the name of the serial port
aBaud the baud rate
databits number of databits
aParity the parity
stopbits number of stopbits

int main ( int  argc,
char **  argv 
)

The main function of the console application.

Call cbcons without parameters for the usage info.

Parameters:
argc number of command line parameters
argv command line parameters, at least 5 required: port, baud, databits, parity, stopbits.


Generated on Thu Feb 12 11:09:26 2009 for cb by  doxygen 1.4.7