glhal/unix/src/glgps_hal_init.c File Reference

Unix HAL sample code: init and basic config structure. More...

#include "glgps_hal.h"
#include "glgps_hal_unix.h"
#include "glgps_event_helper.h"
#include <time.h>
#include <sys/times.h>
#include <sys/types.h>
#include <poll.h>
#include <stdlib.h>
#include <unistd.h>
Include dependency graph for glgps_hal_init.c:

Functions

GpsHalGpsHalCreateHal ()
 Creates HAL layer In this function the application can perform any needed initialization of the HAL.
void GpsHalDestroy (GpsHal *pHal)
 Destroys HAL; in this function the application can clean up the HAL as needed.
void GpsHalInit (GpsHal *pHal)
 Initialises HAL before it would be used very first time.
short GpsHalOpen (GpsHal *pHal)
 Opens GPS HAL.
void GpsHalClose (GpsHal *pHal)
 Closes GPS HAL This is where serial port is closed, TCXO power turned off, ASIC turned off.
void GpsHalCloseLog (GpsHal *pHal)
 The session has ended the log file can be closed.
void GpsHalSetCfgValue (GpsHal *pHal, const char *pcAttrName, const char *pcValue)
 Sets the value of the parameter not recognized by the GLCT config parser.
int GpsHalWaitForEvent (GpsHal *pHal, GPSCTRL_EVENT *pEvent, int iTimeouMs)
 Sleep in this function until event is received.

Detailed Description

Unix HAL sample code: init and basic config structure.


Function Documentation

void GpsHalClose ( GpsHal pHal)

Closes GPS HAL This is where serial port is closed, TCXO power turned off, ASIC turned off.

Parameters:
pHalHandle to HAL instance retrieved through prior call to GpsHalCreateHal().
Precondition:
pHal != NULL
GpsHal* GpsHalCreateHal ( void  )

Creates HAL layer In this function the application can perform any needed initialization of the HAL.

Returns:
valid pointer to GpsHalConfig structure, NULL in case of failure.
Remarks:
It is important to realize that the the Glct expects to be able to write hal configuration information to the address pointed to by the return value before GpsHalInit() is being called. After that, it does not attempt to interpret or change the content of memory being pointed at anymore, but blindly passes it back to the HAL implementation.
void GpsHalDestroy ( GpsHal pHal)

Destroys HAL; in this function the application can clean up the HAL as needed.

Parameters:
pHalHandle to HAL instance retrieved through prior call to GpsHalCreateHal().
Precondition:
pHal != NULL
void GpsHalInit ( GpsHal pHal)

Initialises HAL before it would be used very first time.

Prepares HAL to be opened.

short GpsHalOpen ( GpsHal pHal)

Opens GPS HAL.

This is where serial port is opened, TCXO power turned on, ASIC turned on.

Parameters:
pHalHandle to HAL instance retrieved through prior call to GpsHalCreateHal().
Return values:
0if success, non-zero otherwise
Precondition:
pHal != NULL
void GpsHalSetCfgValue ( GpsHal pHal,
const char *  pcAttrName,
const char *  pcValue 
)

Sets the value of the parameter not recognized by the GLCT config parser.

Or if you are defining a config parameter spans out of the ARP module, define it here instead of ARP's config parser callback function.

int GpsHalWaitForEvent ( GpsHal pHal,
GPSCTRL_EVENT pEvent,
int  iTimeoutMs 
)

Sleep in this function until event is received.

Efficiently wait for an event from either the serial port, the network connection, command strings for the GPS control software, whatever else you might need to wait on.

Parameters:
pHalHandle to HAL instance retrieved through prior call to GpsHalCreateHal().
pEventTODO: comment pEvent
iTimeoutMsTODO: comment iTimeoutMs
Returns:
0 in all cases.
Remarks:
Return value is currently unused. Consider different values reserved for future and consider 0 to be reserved for meaning success.
Precondition:
pHal != NULL, pEvent != NULL
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines