The GLCT Application Programming Interface (API) is provided to allow applications to interact with the GLCT to request and receive positioning response, query and load assistance data, and perform other tasks. The APIs must be called from task executing GpsRun(). For this reason, API calls are normally made by an Application Request Processor called by the GLCT in response to an event received from an application via GpsHalWaitForEvent().
The GLCT provides an opportunity for an application to register the ARP for processing a custom event. When the GLCT initializes it calls the function GpsHalRegisterCustomEvent(). The application populates a structure of type GlcReqMgrHandler containing information about the ARP. This structure has the following fields:
The GLCT will call the function GpsHalRegisterCustomEvent() repeatedly until the structure is left unmodified which indicates to the GLCT that all ARPs have been registered.
To make a positioning request the application must first create a structure describing the request by calling either GlctReqCreateDefault() or GlctReqCreateWithParms(). The difference between these calls is that one uses the default request parameters while the other allows parameters to be customized. There are several types of requests supported, defined by the enumerated type GlctRequestType. The most common requests are for a single shot GPS position, or periodic GPS positions.
To start the request, the application calls GlctReqStart() and to stop the request GlctReqStop() is used. Three simultaneous requests can be created and are arbitrated by the GLCT. All pending requests can be stopped by calling GlctReqStopAll().
The application receives results by including the address of a callback functions into the request. There are callback specific requests and callbacks that are specified for all requests. See GlctReqCallBacks for details.
The following call flow shows an example of the request and callback sequence for a periodic request of type GLGPS_REQ_PERIODIC. The application request processor (ARP) is providing functions to call to receive positioning results for a customer provided output routine.
A set of APIs are provided to load assistance data to the GLCT. These include GlctSetReferenceTime() to load time; GlctSetReferenceLocation() to load position, and GlctSetSetEphemeris() to load ephemeris. For a complete set of these APIs see glct_api_ext.h.
ARPs can determine the assistance data existing in the GLCT by starting a request of type GLGPS_REQ_QUERY_RQD_ASST_DATA. The required assistance data is communicated to the ARP via the callback of type GlctReqOnAsstStatus.
To exit the GLCT an application request processor calls GlctExit().
To abort the GLCT, call GlctAbort(). This stops all requests and exits quickly, avoiding synchronization with the GPS hardware.