gps.h File Reference
#include <stdint.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include <pthread.h>
#include <sys/socket.h>
#include <stdbool.h>
#include <hardware/hardware.h>

Go to the source code of this file.

Data Structures

struct  GpsLocation
 
struct  GpsStatus
 
struct  GpsSvInfo
 
struct  GpsSvStatus
 
struct  AGpsRefLocationCellID
 
struct  AGpsRefLocationMac
 
struct  AGpsRefLocation
 
struct  GpsCallbacks
 
struct  GpsInterface
 
struct  GpsXtraCallbacks
 
struct  GpsXtraInterface
 
struct  GpsDebugInterface
 
struct  AGpsStatus_v1
 
struct  AGpsStatus_v2
 
struct  AGpsStatus_v3
 
struct  AGpsCallbacks
 
struct  AGpsInterface_v1
 
struct  AGpsInterface_v2
 
struct  DerEncodedCertificate
 
struct  Sha1CertificateFingerprint
 
struct  SuplCertificateInterface
 
struct  GpsNiNotification
 
struct  GpsNiCallbacks
 
struct  GpsNiInterface
 
struct  gps_device_t
 
struct  AGpsRilCallbacks
 
struct  AGpsRilInterface
 
struct  GpsGeofenceCallbacks
 
struct  GpsGeofencingInterface
 
struct  GpsClock
 
struct  GpsMeasurement
 
struct  GpsData
 
struct  GpsMeasurementCallbacks
 
struct  GpsMeasurementInterface
 
struct  GpsNavigationMessage
 
struct  GpsNavigationMessageCallbacks
 
struct  GpsNavigationMessageInterface
 
struct  GnssConfigurationInterface
 

Macros

#define GPS_HARDWARE_MODULE_ID   "gps"
 
#define GPS_MAX_SVS   32
 
#define GPS_MAX_MEASUREMENT   32
 
#define GPS_POSITION_MODE_STANDALONE   0
 
#define GPS_POSITION_MODE_MS_BASED   1
 
#define GPS_POSITION_MODE_MS_ASSISTED   2
 
#define GPS_POSITION_RECURRENCE_PERIODIC   0
 
#define GPS_POSITION_RECURRENCE_SINGLE   1
 
#define GPS_STATUS_NONE   0
 
#define GPS_STATUS_SESSION_BEGIN   1
 
#define GPS_STATUS_SESSION_END   2
 
#define GPS_STATUS_ENGINE_ON   3
 
#define GPS_STATUS_ENGINE_OFF   4
 
#define GPS_LOCATION_HAS_LAT_LONG   0x0001
 
#define GPS_LOCATION_HAS_ALTITUDE   0x0002
 
#define GPS_LOCATION_HAS_SPEED   0x0004
 
#define GPS_LOCATION_HAS_BEARING   0x0008
 
#define GPS_LOCATION_HAS_ACCURACY   0x0010
 
#define GPS_CAPABILITY_SCHEDULING   0x0000001
 
#define GPS_CAPABILITY_MSB   0x0000002
 
#define GPS_CAPABILITY_MSA   0x0000004
 
#define GPS_CAPABILITY_SINGLE_SHOT   0x0000008
 
#define GPS_CAPABILITY_ON_DEMAND_TIME   0x0000010
 
#define GPS_CAPABILITY_GEOFENCING   0x0000020
 
#define GPS_CAPABILITY_MEASUREMENTS   0x0000040
 
#define GPS_CAPABILITY_NAV_MESSAGES   0x0000080
 
#define GPS_DELETE_EPHEMERIS   0x0001
 
#define GPS_DELETE_ALMANAC   0x0002
 
#define GPS_DELETE_POSITION   0x0004
 
#define GPS_DELETE_TIME   0x0008
 
#define GPS_DELETE_IONO   0x0010
 
#define GPS_DELETE_UTC   0x0020
 
#define GPS_DELETE_HEALTH   0x0040
 
#define GPS_DELETE_SVDIR   0x0080
 
#define GPS_DELETE_SVSTEER   0x0100
 
#define GPS_DELETE_SADATA   0x0200
 
#define GPS_DELETE_RTI   0x0400
 
#define GPS_DELETE_CELLDB_INFO   0x8000
 
#define GPS_DELETE_ALL   0xFFFF
 
#define AGPS_TYPE_SUPL   1
 
#define AGPS_TYPE_C2K   2
 
#define AGPS_SETID_TYPE_NONE   0
 
#define AGPS_SETID_TYPE_IMSI   1
 
#define AGPS_SETID_TYPE_MSISDN   2
 
#define APN_IP_INVALID   0
 
#define APN_IP_IPV4   1
 
#define APN_IP_IPV6   2
 
#define APN_IP_IPV4V6   3
 
#define GPS_NI_SHORT_STRING_MAXLEN   256
 
#define GPS_NI_LONG_STRING_MAXLEN   2048
 
#define GPS_NI_TYPE_VOICE   1
 
#define GPS_NI_TYPE_UMTS_SUPL   2
 
#define GPS_NI_TYPE_UMTS_CTRL_PLANE   3
 
#define GPS_NI_NEED_NOTIFY   0x0001
 
#define GPS_NI_NEED_VERIFY   0x0002
 
#define GPS_NI_PRIVACY_OVERRIDE   0x0004
 
#define GPS_NI_RESPONSE_ACCEPT   1
 
#define GPS_NI_RESPONSE_DENY   2
 
#define GPS_NI_RESPONSE_NORESP   3
 
#define GPS_ENC_NONE   0
 
#define GPS_ENC_SUPL_GSM_DEFAULT   1
 
#define GPS_ENC_SUPL_UTF8   2
 
#define GPS_ENC_SUPL_UCS2   3
 
#define GPS_ENC_UNKNOWN   -1
 
#define GPS_REQUEST_AGPS_DATA_CONN   1
 
#define GPS_RELEASE_AGPS_DATA_CONN   2
 
#define GPS_AGPS_DATA_CONNECTED   3
 
#define GPS_AGPS_DATA_CONN_DONE   4
 
#define GPS_AGPS_DATA_CONN_FAILED   5
 
#define AGPS_REF_LOCATION_TYPE_GSM_CELLID   1
 
#define AGPS_REF_LOCATION_TYPE_UMTS_CELLID   2
 
#define AGPS_REG_LOCATION_TYPE_MAC   3
 
#define AGPS_RIL_NETWORK_TYPE_MOBILE   0
 
#define AGPS_RIL_NETWORK_TYPE_WIFI   1
 
#define AGPS_RIL_NETWORK_TYPE_MOBILE_MMS   2
 
#define AGPS_RIL_NETWORK_TYPE_MOBILE_SUPL   3
 
#define AGPS_RIL_NETWORK_TTYPE_MOBILE_DUN   4
 
#define AGPS_RIL_NETWORK_TTYPE_MOBILE_HIPRI   5
 
#define AGPS_RIL_NETWORK_TTYPE_WIMAX   6
 
#define GPS_CLOCK_HAS_LEAP_SECOND   (1<<0)
 
#define GPS_CLOCK_HAS_TIME_UNCERTAINTY   (1<<1)
 
#define GPS_CLOCK_HAS_FULL_BIAS   (1<<2)
 
#define GPS_CLOCK_HAS_BIAS   (1<<3)
 
#define GPS_CLOCK_HAS_BIAS_UNCERTAINTY   (1<<4)
 
#define GPS_CLOCK_HAS_DRIFT   (1<<5)
 
#define GPS_CLOCK_HAS_DRIFT_UNCERTAINTY   (1<<6)
 
#define GPS_CLOCK_TYPE_UNKNOWN   0
 
#define GPS_CLOCK_TYPE_LOCAL_HW_TIME   1
 
#define GPS_CLOCK_TYPE_GPS_TIME   2
 
#define GPS_MEASUREMENT_HAS_SNR   (1<<0)
 
#define GPS_MEASUREMENT_HAS_ELEVATION   (1<<1)
 
#define GPS_MEASUREMENT_HAS_ELEVATION_UNCERTAINTY   (1<<2)
 
#define GPS_MEASUREMENT_HAS_AZIMUTH   (1<<3)
 
#define GPS_MEASUREMENT_HAS_AZIMUTH_UNCERTAINTY   (1<<4)
 
#define GPS_MEASUREMENT_HAS_PSEUDORANGE   (1<<5)
 
#define GPS_MEASUREMENT_HAS_PSEUDORANGE_UNCERTAINTY   (1<<6)
 
#define GPS_MEASUREMENT_HAS_CODE_PHASE   (1<<7)
 
#define GPS_MEASUREMENT_HAS_CODE_PHASE_UNCERTAINTY   (1<<8)
 
#define GPS_MEASUREMENT_HAS_CARRIER_FREQUENCY   (1<<9)
 
#define GPS_MEASUREMENT_HAS_CARRIER_CYCLES   (1<<10)
 
#define GPS_MEASUREMENT_HAS_CARRIER_PHASE   (1<<11)
 
#define GPS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY   (1<<12)
 
#define GPS_MEASUREMENT_HAS_BIT_NUMBER   (1<<13)
 
#define GPS_MEASUREMENT_HAS_TIME_FROM_LAST_BIT   (1<<14)
 
#define GPS_MEASUREMENT_HAS_DOPPLER_SHIFT   (1<<15)
 
#define GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY   (1<<16)
 
#define GPS_MEASUREMENT_HAS_USED_IN_FIX   (1<<17)
 
#define GPS_LOSS_OF_LOCK_UNKNOWN   0
 
#define GPS_LOSS_OF_LOCK_OK   1
 
#define GPS_LOSS_OF_LOCK_CYCLE_SLIP   2
 
#define GPS_MULTIPATH_INDICATOR_UNKNOWN   0
 
#define GPS_MULTIPATH_INDICATOR_DETECTED   1
 
#define GPS_MULTIPATH_INDICATOR_NOT_USED   2
 
#define GPS_MEASUREMENT_STATE_UNKNOWN   0
 
#define GPS_MEASUREMENT_STATE_CODE_LOCK   (1<<0)
 
#define GPS_MEASUREMENT_STATE_BIT_SYNC   (1<<1)
 
#define GPS_MEASUREMENT_STATE_SUBFRAME_SYNC   (1<<2)
 
#define GPS_MEASUREMENT_STATE_TOW_DECODED   (1<<3)
 
#define GPS_ADR_STATE_UNKNOWN   0
 
#define GPS_ADR_STATE_VALID   (1<<0)
 
#define GPS_ADR_STATE_RESET   (1<<1)
 
#define GPS_ADR_STATE_CYCLE_SLIP   (1<<2)
 
#define GPS_NAVIGATION_MESSAGE_TYPE_UNKNOWN   0
 
#define GPS_NAVIGATION_MESSAGE_TYPE_L1CA   1
 
#define GPS_NAVIGATION_MESSAGE_TYPE_L2CNAV   2
 
#define GPS_NAVIGATION_MESSAGE_TYPE_L5CNAV   3
 
#define GPS_NAVIGATION_MESSAGE_TYPE_CNAV2   4
 
#define GPS_XTRA_INTERFACE   "gps-xtra"
 
#define GPS_DEBUG_INTERFACE   "gps-debug"
 
#define AGPS_INTERFACE   "agps"
 
#define SUPL_CERTIFICATE_INTERFACE   "supl-certificate"
 
#define GPS_NI_INTERFACE   "gps-ni"
 
#define AGPS_RIL_INTERFACE   "agps_ril"
 
#define GPS_GEOFENCING_INTERFACE   "gps_geofencing"
 
#define GPS_MEASUREMENT_INTERFACE   "gps_measurement"
 
#define GPS_NAVIGATION_MESSAGE_INTERFACE   "gps_navigation_message"
 
#define GNSS_CONFIGURATION_INTERFACE   "gnss_configuration"
 
#define AGPS_CERTIFICATE_OPERATION_SUCCESS   0
 
#define AGPS_CERTIFICATE_ERROR_GENERIC   -100
 
#define AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES   -101
 
#define AGPS_RIL_REQUEST_SETID_IMSI   (1<<0L)
 
#define AGPS_RIL_REQUEST_SETID_MSISDN   (1<<1L)
 
#define AGPS_RIL_REQUEST_REFLOC_CELLID   (1<<0L)
 
#define AGPS_RIL_REQUEST_REFLOC_MAC   (1<<1L)
 
#define GPS_GEOFENCE_ENTERED   (1<<0L)
 
#define GPS_GEOFENCE_EXITED   (1<<1L)
 
#define GPS_GEOFENCE_UNCERTAIN   (1<<2L)
 
#define GPS_GEOFENCE_UNAVAILABLE   (1<<0L)
 
#define GPS_GEOFENCE_AVAILABLE   (1<<1L)
 
#define GPS_GEOFENCE_OPERATION_SUCCESS   0
 
#define GPS_GEOFENCE_ERROR_TOO_MANY_GEOFENCES   -100
 
#define GPS_GEOFENCE_ERROR_ID_EXISTS   -101
 
#define GPS_GEOFENCE_ERROR_ID_UNKNOWN   -102
 
#define GPS_GEOFENCE_ERROR_INVALID_TRANSITION   -103
 
#define GPS_GEOFENCE_ERROR_GENERIC   -149
 
#define GPS_MEASUREMENT_OPERATION_SUCCESS   0
 
#define GPS_MEASUREMENT_ERROR_ALREADY_INIT   -100
 
#define GPS_MEASUREMENT_ERROR_GENERIC   -101
 
#define GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS   0
 
#define GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT   -100
 
#define GPS_NAVIGATION_MESSAGE_ERROR_GENERIC   -101
 

Typedefs

typedef int64_t GpsUtcTime
 
typedef uint32_t GpsPositionMode
 
typedef uint32_t GpsPositionRecurrence
 
typedef uint16_t GpsStatusValue
 
typedef uint16_t GpsLocationFlags
 
typedef uint16_t GpsAidingData
 
typedef uint16_t AGpsType
 
typedef uint16_t AGpsSetIDType
 
typedef uint16_t ApnIpType
 
typedef uint32_t GpsNiType
 
typedef uint32_t GpsNiNotifyFlags
 
typedef int GpsUserResponseType
 
typedef int GpsNiEncodingType
 
typedef uint16_t AGpsStatusValue
 
typedef uint16_t GpsClockFlags
 
typedef uint8_t GpsClockType
 
typedef uint32_t GpsMeasurementFlags
 
typedef uint8_t GpsLossOfLock
 
typedef uint8_t GpsMultipathIndicator
 
typedef uint16_t GpsMeasurementState
 
typedef uint16_t GpsAccumulatedDeltaRangeState
 
typedef uint8_t GpsNavigationMessageType
 
typedef void(* gps_location_callback )(GpsLocation *location)
 
typedef void(* gps_status_callback )(GpsStatus *status)
 
typedef void(* gps_sv_status_callback )(GpsSvStatus *sv_info)
 
typedef void(* gps_nmea_callback )(GpsUtcTime timestamp, const char *nmea, int length)
 
typedef void(* gps_set_capabilities )(uint32_t capabilities)
 
typedef void(* gps_acquire_wakelock )()
 
typedef void(* gps_release_wakelock )()
 
typedef void(* gps_request_utc_time )()
 
typedef pthread_t(* gps_create_thread )(const char *name, void(*start)(void *), void *arg)
 
typedef void(* gps_xtra_download_request )()
 
typedef AGpsStatus_v3 AGpsStatus
 
typedef void(* agps_status_callback )(AGpsStatus *status)
 
typedef AGpsInterface_v2 AGpsInterface
 
typedef void(* gps_ni_notify_callback )(GpsNiNotification *notification)
 
typedef void(* agps_ril_request_set_id )(uint32_t flags)
 
typedef void(* agps_ril_request_ref_loc )(uint32_t flags)
 
typedef void(* gps_geofence_transition_callback )(int32_t geofence_id, GpsLocation *location, int32_t transition, GpsUtcTime timestamp)
 
typedef void(* gps_geofence_status_callback )(int32_t status, GpsLocation *last_location)
 
typedef void(* gps_geofence_add_callback )(int32_t geofence_id, int32_t status)
 
typedef void(* gps_geofence_remove_callback )(int32_t geofence_id, int32_t status)
 
typedef void(* gps_geofence_pause_callback )(int32_t geofence_id, int32_t status)
 
typedef void(* gps_geofence_resume_callback )(int32_t geofence_id, int32_t status)
 
typedef void(* gps_measurement_callback )(GpsData *data)
 
typedef void(* gps_navigation_message_callback )(GpsNavigationMessage *message)
 

Macro Definition Documentation

#define AGPS_CERTIFICATE_ERROR_GENERIC   -100

Definition at line 773 of file gps.h.

#define AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES   -101

Definition at line 774 of file gps.h.

#define AGPS_CERTIFICATE_OPERATION_SUCCESS   0

Error codes associated with certificate operations

Definition at line 772 of file gps.h.

#define AGPS_INTERFACE   "agps"

Name for the AGPS interface.

Definition at line 367 of file gps.h.

#define AGPS_REF_LOCATION_TYPE_GSM_CELLID   1

Definition at line 210 of file gps.h.

#define AGPS_REF_LOCATION_TYPE_UMTS_CELLID   2

Definition at line 211 of file gps.h.

#define AGPS_REG_LOCATION_TYPE_MAC   3

Definition at line 212 of file gps.h.

#define AGPS_RIL_INTERFACE   "agps_ril"

Name for the AGPS-RIL interface.

Definition at line 382 of file gps.h.

#define AGPS_RIL_NETWORK_TTYPE_MOBILE_DUN   4

Definition at line 219 of file gps.h.

#define AGPS_RIL_NETWORK_TTYPE_MOBILE_HIPRI   5

Definition at line 220 of file gps.h.

#define AGPS_RIL_NETWORK_TTYPE_WIMAX   6

Definition at line 221 of file gps.h.

#define AGPS_RIL_NETWORK_TYPE_MOBILE   0

Network types for update_network_state "type" parameter

Definition at line 215 of file gps.h.

#define AGPS_RIL_NETWORK_TYPE_MOBILE_MMS   2

Definition at line 217 of file gps.h.

#define AGPS_RIL_NETWORK_TYPE_MOBILE_SUPL   3

Definition at line 218 of file gps.h.

#define AGPS_RIL_NETWORK_TYPE_WIFI   1

Definition at line 216 of file gps.h.

#define AGPS_RIL_REQUEST_REFLOC_CELLID   (1<<0L)

Definition at line 944 of file gps.h.

#define AGPS_RIL_REQUEST_REFLOC_MAC   (1<<1L)

Definition at line 945 of file gps.h.

#define AGPS_RIL_REQUEST_SETID_IMSI   (1<<0L)

Definition at line 941 of file gps.h.

#define AGPS_RIL_REQUEST_SETID_MSISDN   (1<<1L)

Definition at line 942 of file gps.h.

#define AGPS_SETID_TYPE_IMSI   1

Definition at line 144 of file gps.h.

#define AGPS_SETID_TYPE_MSISDN   2

Definition at line 145 of file gps.h.

#define AGPS_SETID_TYPE_NONE   0

Definition at line 143 of file gps.h.

#define AGPS_TYPE_C2K   2

Definition at line 140 of file gps.h.

#define AGPS_TYPE_SUPL   1

Definition at line 139 of file gps.h.

#define APN_IP_INVALID   0

Definition at line 148 of file gps.h.

#define APN_IP_IPV4   1

Definition at line 149 of file gps.h.

#define APN_IP_IPV4V6   3

Definition at line 151 of file gps.h.

#define APN_IP_IPV6   2

Definition at line 150 of file gps.h.

#define GNSS_CONFIGURATION_INTERFACE   "gnss_configuration"

Name of the GNSS/GPS configuration interface.

Definition at line 402 of file gps.h.

#define GPS_ADR_STATE_CYCLE_SLIP   (1<<2)

Definition at line 336 of file gps.h.

#define GPS_ADR_STATE_RESET   (1<<1)

Definition at line 335 of file gps.h.

#define GPS_ADR_STATE_UNKNOWN   0

Definition at line 333 of file gps.h.

#define GPS_ADR_STATE_VALID   (1<<0)

Definition at line 334 of file gps.h.

#define GPS_AGPS_DATA_CONN_DONE   4

AGPS data connection completed

Definition at line 206 of file gps.h.

#define GPS_AGPS_DATA_CONN_FAILED   5

AGPS data connection failed

Definition at line 208 of file gps.h.

#define GPS_AGPS_DATA_CONNECTED   3

AGPS data connection initiated

Definition at line 204 of file gps.h.

#define GPS_CAPABILITY_GEOFENCING   0x0000020

GPS supports Geofencing

Definition at line 112 of file gps.h.

#define GPS_CAPABILITY_MEASUREMENTS   0x0000040

GPS supports Measurements

Definition at line 114 of file gps.h.

#define GPS_CAPABILITY_MSA   0x0000004

GPS supports MS-Assisted AGPS mode

Definition at line 106 of file gps.h.

#define GPS_CAPABILITY_MSB   0x0000002

GPS supports MS-Based AGPS mode

Definition at line 104 of file gps.h.

#define GPS_CAPABILITY_NAV_MESSAGES   0x0000080

GPS supports Navigation Messages

Definition at line 116 of file gps.h.

#define GPS_CAPABILITY_ON_DEMAND_TIME   0x0000010

GPS supports on demand time injection

Definition at line 110 of file gps.h.

#define GPS_CAPABILITY_SCHEDULING   0x0000001

Flags for the gps_set_capabilities callback. GPS HAL schedules fixes for GPS_POSITION_RECURRENCE_PERIODIC mode. If this is not set, then the framework will use 1000ms for min_interval and will start and call start() and stop() to schedule the GPS.

Definition at line 102 of file gps.h.

#define GPS_CAPABILITY_SINGLE_SHOT   0x0000008

GPS supports single-shot fixes

Definition at line 108 of file gps.h.

#define GPS_CLOCK_HAS_BIAS   (1<<3)

A valid 'bias' is stored in the data structure.

Definition at line 234 of file gps.h.

#define GPS_CLOCK_HAS_BIAS_UNCERTAINTY   (1<<4)

A valid 'bias uncertainty' is stored in the data structure.

Definition at line 236 of file gps.h.

#define GPS_CLOCK_HAS_DRIFT   (1<<5)

A valid 'drift' is stored in the data structure.

Definition at line 238 of file gps.h.

#define GPS_CLOCK_HAS_DRIFT_UNCERTAINTY   (1<<6)

A valid 'drift uncertainty' is stored in the data structure.

Definition at line 240 of file gps.h.

#define GPS_CLOCK_HAS_FULL_BIAS   (1<<2)

A valid 'full bias' is stored in the data structure.

Definition at line 232 of file gps.h.

#define GPS_CLOCK_HAS_LEAP_SECOND   (1<<0)

A valid 'leap second' is stored in the data structure.

Definition at line 228 of file gps.h.

#define GPS_CLOCK_HAS_TIME_UNCERTAINTY   (1<<1)

A valid 'time uncertainty' is stored in the data structure.

Definition at line 230 of file gps.h.

#define GPS_CLOCK_TYPE_GPS_TIME   2

The source of the time value reported by GPS clock is the GPS time derived from satellites (epoch = Jan 6, 1980)

Definition at line 254 of file gps.h.

#define GPS_CLOCK_TYPE_LOCAL_HW_TIME   1

The source of the time value reported by GPS clock is the local hardware clock.

Definition at line 249 of file gps.h.

#define GPS_CLOCK_TYPE_UNKNOWN   0

The type is not available ot it is unknown.

Definition at line 247 of file gps.h.

#define GPS_DEBUG_INTERFACE   "gps-debug"

Name for the GPS DEBUG interface.

Definition at line 362 of file gps.h.

#define GPS_DELETE_ALL   0xFFFF

Definition at line 135 of file gps.h.

#define GPS_DELETE_ALMANAC   0x0002

Definition at line 124 of file gps.h.

#define GPS_DELETE_CELLDB_INFO   0x8000

Definition at line 134 of file gps.h.

#define GPS_DELETE_EPHEMERIS   0x0001

Definition at line 123 of file gps.h.

#define GPS_DELETE_HEALTH   0x0040

Definition at line 129 of file gps.h.

#define GPS_DELETE_IONO   0x0010

Definition at line 127 of file gps.h.

#define GPS_DELETE_POSITION   0x0004

Definition at line 125 of file gps.h.

#define GPS_DELETE_RTI   0x0400

Definition at line 133 of file gps.h.

#define GPS_DELETE_SADATA   0x0200

Definition at line 132 of file gps.h.

#define GPS_DELETE_SVDIR   0x0080

Definition at line 130 of file gps.h.

#define GPS_DELETE_SVSTEER   0x0100

Definition at line 131 of file gps.h.

#define GPS_DELETE_TIME   0x0008

Definition at line 126 of file gps.h.

#define GPS_DELETE_UTC   0x0020

Definition at line 128 of file gps.h.

#define GPS_ENC_NONE   0

Definition at line 191 of file gps.h.

#define GPS_ENC_SUPL_GSM_DEFAULT   1

Definition at line 192 of file gps.h.

#define GPS_ENC_SUPL_UCS2   3

Definition at line 194 of file gps.h.

#define GPS_ENC_SUPL_UTF8   2

Definition at line 193 of file gps.h.

#define GPS_ENC_UNKNOWN   -1

Definition at line 195 of file gps.h.

#define GPS_GEOFENCE_AVAILABLE   (1<<1L)

Definition at line 1071 of file gps.h.

#define GPS_GEOFENCE_ENTERED   (1<<0L)

GPS Geofence. There are 3 states associated with a Geofence: Inside, Outside, Unknown. There are 3 transitions: ENTERED, EXITED, UNCERTAIN.

An example state diagram with confidence level: 95% and Unknown time limit set as 30 secs is shown below. (confidence level and Unknown time limit are explained latter)


| Unknown (30 secs) | """""""""""""""""""""""""""" ^ | | ^ UNCERTAIN| |ENTERED EXITED| |UNCERTAIN | v v | ________ EXITED _________ | Inside | --------—> | Outside | | | <--------— | | """""""" ENTERED """""""""

Inside state: We are 95% confident that the user is inside the geofence. Outside state: We are 95% confident that the user is outside the geofence Unknown state: Rest of the time.

The Unknown state is better explained with an example:

                       __________
                      |         c|
                      |  ___     |    _______
                      |  |a|     |   |   b   |
                      |  """     |    """""""
                      |          |
                       """"""""""

In the diagram above, "a" and "b" are 2 geofences and "c" is the accuracy circle reported by the GPS subsystem. Now with regard to "b", the system is confident that the user is outside. But with regard to "a" is not confident whether it is inside or outside the geofence. If the accuracy remains the same for a sufficient period of time, the UNCERTAIN transition would be triggered with the state set to Unknown. If the accuracy improves later, an appropriate transition should be triggered. This "sufficient period of time" is defined by the parameter in the add_geofence_area API. In other words, Unknown state can be interpreted as a state in which the GPS subsystem isn't confident enough that the user is either inside or outside the Geofence. It moves to Unknown state only after the expiry of the timeout.

The geofence callback needs to be triggered for the ENTERED and EXITED transitions, when the GPS system is confident that the user has entered (Inside state) or exited (Outside state) the Geofence. An implementation which uses a value of 95% as the confidence is recommended. The callback should be triggered only for the transitions requested by the add_geofence_area call.

Even though the diagram and explanation talks about states and transitions, the callee is only interested in the transistions. The states are mentioned here for illustrative purposes.

Startup Scenario: When the device boots up, if an application adds geofences, and then we get an accurate GPS location fix, it needs to trigger the appropriate (ENTERED or EXITED) transition for every Geofence it knows about. By default, all the Geofences will be in the Unknown state.

When the GPS system is unavailable, gps_geofence_status_callback should be called to inform the upper layers of the same. Similarly, when it becomes available the callback should be called. This is a global state while the UNKNOWN transition described above is per geofence.

An important aspect to note is that users of this API (framework), will use other subsystems like wifi, sensors, cell to handle Unknown case and hopefully provide a definitive state transition to the third party application. GPS Geofence will just be a signal indicating what the GPS subsystem knows about the Geofence.

Definition at line 1066 of file gps.h.

#define GPS_GEOFENCE_ERROR_GENERIC   -149

Definition at line 1078 of file gps.h.

#define GPS_GEOFENCE_ERROR_ID_EXISTS   -101

Definition at line 1075 of file gps.h.

#define GPS_GEOFENCE_ERROR_ID_UNKNOWN   -102

Definition at line 1076 of file gps.h.

#define GPS_GEOFENCE_ERROR_INVALID_TRANSITION   -103

Definition at line 1077 of file gps.h.

#define GPS_GEOFENCE_ERROR_TOO_MANY_GEOFENCES   -100

Definition at line 1074 of file gps.h.

#define GPS_GEOFENCE_EXITED   (1<<1L)

Definition at line 1067 of file gps.h.

#define GPS_GEOFENCE_OPERATION_SUCCESS   0

Definition at line 1073 of file gps.h.

#define GPS_GEOFENCE_UNAVAILABLE   (1<<0L)

Definition at line 1070 of file gps.h.

#define GPS_GEOFENCE_UNCERTAIN   (1<<2L)

Definition at line 1068 of file gps.h.

#define GPS_GEOFENCING_INTERFACE   "gps_geofencing"

Name for the GPS_Geofencing interface.

Definition at line 387 of file gps.h.

#define GPS_HARDWARE_MODULE_ID   "gps"

The id of this module

Definition at line 34 of file gps.h.

#define GPS_LOCATION_HAS_ACCURACY   0x0010

GpsLocation has valid accuracy.

Definition at line 94 of file gps.h.

#define GPS_LOCATION_HAS_ALTITUDE   0x0002

GpsLocation has valid altitude.

Definition at line 88 of file gps.h.

#define GPS_LOCATION_HAS_BEARING   0x0008

GpsLocation has valid bearing.

Definition at line 92 of file gps.h.

#define GPS_LOCATION_HAS_LAT_LONG   0x0001

GpsLocation has valid latitude and longitude.

Definition at line 86 of file gps.h.

#define GPS_LOCATION_HAS_SPEED   0x0004

GpsLocation has valid speed.

Definition at line 90 of file gps.h.

#define GPS_LOSS_OF_LOCK_CYCLE_SLIP   2

Loss of lock between previous and current observation: cycle slip possible.

Definition at line 306 of file gps.h.

#define GPS_LOSS_OF_LOCK_OK   1

The measurement does not present any indication of loss of lock.

Definition at line 304 of file gps.h.

#define GPS_LOSS_OF_LOCK_UNKNOWN   0

The indicator is not available or it is unknown.

Definition at line 302 of file gps.h.

#define GPS_MAX_MEASUREMENT   32

Maximum number of Measurements in gps_measurement_callback().

Definition at line 44 of file gps.h.

#define GPS_MAX_SVS   32

Maximum number of SVs for gps_sv_status_callback().

Definition at line 41 of file gps.h.

#define GPS_MEASUREMENT_ERROR_ALREADY_INIT   -100

Definition at line 1632 of file gps.h.

#define GPS_MEASUREMENT_ERROR_GENERIC   -101

Definition at line 1633 of file gps.h.

#define GPS_MEASUREMENT_HAS_AZIMUTH   (1<<3)

A valid 'azimuth' is stored in the data structure.

Definition at line 267 of file gps.h.

#define GPS_MEASUREMENT_HAS_AZIMUTH_UNCERTAINTY   (1<<4)

A valid 'azimuth uncertainty' is stored in the data structure.

Definition at line 269 of file gps.h.

#define GPS_MEASUREMENT_HAS_BIT_NUMBER   (1<<13)

A valid 'bit number' is stored in the data structure.

Definition at line 287 of file gps.h.

#define GPS_MEASUREMENT_HAS_CARRIER_CYCLES   (1<<10)

A valid 'carrier cycles' is stored in the data structure.

Definition at line 281 of file gps.h.

#define GPS_MEASUREMENT_HAS_CARRIER_FREQUENCY   (1<<9)

A valid 'carrier frequency' is stored in the data structure.

Definition at line 279 of file gps.h.

#define GPS_MEASUREMENT_HAS_CARRIER_PHASE   (1<<11)

A valid 'carrier phase' is stored in the data structure.

Definition at line 283 of file gps.h.

#define GPS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY   (1<<12)

A valid 'carrier phase uncertainty' is stored in the data structure.

Definition at line 285 of file gps.h.

#define GPS_MEASUREMENT_HAS_CODE_PHASE   (1<<7)

A valid 'code phase' is stored in the data structure.

Definition at line 275 of file gps.h.

#define GPS_MEASUREMENT_HAS_CODE_PHASE_UNCERTAINTY   (1<<8)

A valid 'code phase uncertainty' is stored in the data structure.

Definition at line 277 of file gps.h.

#define GPS_MEASUREMENT_HAS_DOPPLER_SHIFT   (1<<15)

A valid 'doppler shift' is stored in the data structure.

Definition at line 291 of file gps.h.

#define GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY   (1<<16)

A valid 'doppler shift uncertainty' is stored in the data structure.

Definition at line 293 of file gps.h.

#define GPS_MEASUREMENT_HAS_ELEVATION   (1<<1)

A valid 'elevation' is stored in the data structure.

Definition at line 263 of file gps.h.

#define GPS_MEASUREMENT_HAS_ELEVATION_UNCERTAINTY   (1<<2)

A valid 'elevation uncertainty' is stored in the data structure.

Definition at line 265 of file gps.h.

#define GPS_MEASUREMENT_HAS_PSEUDORANGE   (1<<5)

A valid 'pseudorange' is stored in the data structure.

Definition at line 271 of file gps.h.

#define GPS_MEASUREMENT_HAS_PSEUDORANGE_UNCERTAINTY   (1<<6)

A valid 'pseudorange uncertainty' is stored in the data structure.

Definition at line 273 of file gps.h.

#define GPS_MEASUREMENT_HAS_SNR   (1<<0)

A valid 'snr' is stored in the data structure.

Definition at line 261 of file gps.h.

#define GPS_MEASUREMENT_HAS_TIME_FROM_LAST_BIT   (1<<14)

A valid 'time from last bit' is stored in the data structure.

Definition at line 289 of file gps.h.

#define GPS_MEASUREMENT_HAS_USED_IN_FIX   (1<<17)

A valid 'used in fix' flag is stored in the data structure.

Definition at line 295 of file gps.h.

#define GPS_MEASUREMENT_INTERFACE   "gps_measurement"

Name of the GPS Measurements interface.

Definition at line 392 of file gps.h.

#define GPS_MEASUREMENT_OPERATION_SUCCESS   0

Definition at line 1631 of file gps.h.

#define GPS_MEASUREMENT_STATE_BIT_SYNC   (1<<1)

Definition at line 325 of file gps.h.

#define GPS_MEASUREMENT_STATE_CODE_LOCK   (1<<0)

Definition at line 324 of file gps.h.

#define GPS_MEASUREMENT_STATE_SUBFRAME_SYNC   (1<<2)

Definition at line 326 of file gps.h.

#define GPS_MEASUREMENT_STATE_TOW_DECODED   (1<<3)

Definition at line 327 of file gps.h.

#define GPS_MEASUREMENT_STATE_UNKNOWN   0

Definition at line 323 of file gps.h.

#define GPS_MULTIPATH_INDICATOR_DETECTED   1

The measurement has been indicated to use multipath.

Definition at line 315 of file gps.h.

#define GPS_MULTIPATH_INDICATOR_NOT_USED   2

The measurement has been indicated Not to use multipath.

Definition at line 317 of file gps.h.

#define GPS_MULTIPATH_INDICATOR_UNKNOWN   0

The indicator is not available or unknown.

Definition at line 313 of file gps.h.

#define GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT   -100

Definition at line 1734 of file gps.h.

#define GPS_NAVIGATION_MESSAGE_ERROR_GENERIC   -101

Definition at line 1735 of file gps.h.

#define GPS_NAVIGATION_MESSAGE_INTERFACE   "gps_navigation_message"

Name of the GPS navigation message interface.

Definition at line 397 of file gps.h.

#define GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS   0

Definition at line 1733 of file gps.h.

#define GPS_NAVIGATION_MESSAGE_TYPE_CNAV2   4

CNAV-2 message contained in the structure.

Definition at line 351 of file gps.h.

#define GPS_NAVIGATION_MESSAGE_TYPE_L1CA   1

L1 C/A message contained in the structure.

Definition at line 345 of file gps.h.

#define GPS_NAVIGATION_MESSAGE_TYPE_L2CNAV   2

L2-CNAV message contained in the structure.

Definition at line 347 of file gps.h.

#define GPS_NAVIGATION_MESSAGE_TYPE_L5CNAV   3

L5-CNAV message contained in the structure.

Definition at line 349 of file gps.h.

#define GPS_NAVIGATION_MESSAGE_TYPE_UNKNOWN   0

The message type is unknown.

Definition at line 343 of file gps.h.

#define GPS_NI_INTERFACE   "gps-ni"

Name for NI interface

Definition at line 377 of file gps.h.

#define GPS_NI_LONG_STRING_MAXLEN   2048

Definition at line 157 of file gps.h.

#define GPS_NI_NEED_NOTIFY   0x0001

NI requires notification

Definition at line 172 of file gps.h.

#define GPS_NI_NEED_VERIFY   0x0002

NI requires verification

Definition at line 174 of file gps.h.

#define GPS_NI_PRIVACY_OVERRIDE   0x0004

NI requires privacy override, no notification/minimal trace

Definition at line 176 of file gps.h.

#define GPS_NI_RESPONSE_ACCEPT   1

Definition at line 183 of file gps.h.

#define GPS_NI_RESPONSE_DENY   2

Definition at line 184 of file gps.h.

#define GPS_NI_RESPONSE_NORESP   3

Definition at line 185 of file gps.h.

#define GPS_NI_SHORT_STRING_MAXLEN   256

String length constants

Definition at line 156 of file gps.h.

#define GPS_NI_TYPE_UMTS_CTRL_PLANE   3

Definition at line 165 of file gps.h.

#define GPS_NI_TYPE_UMTS_SUPL   2

Definition at line 164 of file gps.h.

#define GPS_NI_TYPE_VOICE   1

Definition at line 163 of file gps.h.

#define GPS_POSITION_MODE_MS_ASSISTED   2

AGPS MS-Assisted mode.

Definition at line 55 of file gps.h.

#define GPS_POSITION_MODE_MS_BASED   1

AGPS MS-Based mode.

Definition at line 53 of file gps.h.

#define GPS_POSITION_MODE_STANDALONE   0

Mode for running GPS standalone (no assistance).

Definition at line 51 of file gps.h.

#define GPS_POSITION_RECURRENCE_PERIODIC   0

Receive GPS fixes on a recurring basis at a specified period.

Definition at line 62 of file gps.h.

#define GPS_POSITION_RECURRENCE_SINGLE   1

Request a single shot GPS fix.

Definition at line 64 of file gps.h.

#define GPS_RELEASE_AGPS_DATA_CONN   2

GPS releases the AGPS data connection.

Definition at line 202 of file gps.h.

#define GPS_REQUEST_AGPS_DATA_CONN   1

GPS requests data connection for AGPS.

Definition at line 200 of file gps.h.

#define GPS_STATUS_ENGINE_OFF   4

GPS is powered off.

Definition at line 79 of file gps.h.

#define GPS_STATUS_ENGINE_ON   3

GPS has powered on but is not navigating.

Definition at line 77 of file gps.h.

#define GPS_STATUS_NONE   0

GPS status unknown.

Definition at line 71 of file gps.h.

#define GPS_STATUS_SESSION_BEGIN   1

GPS has begun navigating.

Definition at line 73 of file gps.h.

#define GPS_STATUS_SESSION_END   2

GPS has stopped navigating.

Definition at line 75 of file gps.h.

#define GPS_XTRA_INTERFACE   "gps-xtra"

Name for the GPS XTRA interface.

Definition at line 357 of file gps.h.

#define SUPL_CERTIFICATE_INTERFACE   "supl-certificate"

Name of the Supl Certificate interface.

Definition at line 372 of file gps.h.

Typedef Documentation

typedef void(* agps_ril_request_ref_loc)(uint32_t flags)

Definition at line 948 of file gps.h.

typedef void(* agps_ril_request_set_id)(uint32_t flags)

Definition at line 947 of file gps.h.

typedef void(* agps_status_callback)(AGpsStatus *status)

Callback with AGPS status information. Can only be called from a thread created by create_thread_cb.

Definition at line 690 of file gps.h.

Definition at line 769 of file gps.h.

typedef uint16_t AGpsSetIDType

Definition at line 142 of file gps.h.

Definition at line 685 of file gps.h.

typedef uint16_t AGpsStatusValue

AGPS status event values.

Definition at line 198 of file gps.h.

typedef uint16_t AGpsType

AGPS type

Definition at line 138 of file gps.h.

typedef uint16_t ApnIpType

Definition at line 147 of file gps.h.

typedef void(* gps_acquire_wakelock)()

Callback utility for acquiring the GPS wakelock. This can be used to prevent the CPU from suspending while handling GPS events.

Definition at line 530 of file gps.h.

typedef pthread_t(* gps_create_thread)(const char *name, void(*start)(void *), void *arg)

Callback for creating a thread that can call into the Java framework code. This must be used to create any threads that report events up to the framework.

Definition at line 541 of file gps.h.

typedef void(* gps_geofence_add_callback)(int32_t geofence_id, int32_t status)

The callback associated with the add_geofence call.

Parameter: geofence_id - Id of the geofence. status - GPS_GEOFENCE_OPERATION_SUCCESS GPS_GEOFENCE_ERROR_TOO_MANY_GEOFENCES - geofence limit has been reached. GPS_GEOFENCE_ERROR_ID_EXISTS - geofence with id already exists GPS_GEOFENCE_ERROR_INVALID_TRANSITION - the monitorTransition contains an invalid transition GPS_GEOFENCE_ERROR_GENERIC - for other errors.

Definition at line 1124 of file gps.h.

typedef void(* gps_geofence_pause_callback)(int32_t geofence_id, int32_t status)

The callback associated with the pause_geofence call.

Parameter: geofence_id - Id of the geofence. status - GPS_GEOFENCE_OPERATION_SUCCESS GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id GPS_GEOFENCE_ERROR_INVALID_TRANSITION - when monitor_transitions is invalid GPS_GEOFENCE_ERROR_GENERIC for others.

Definition at line 1149 of file gps.h.

typedef void(* gps_geofence_remove_callback)(int32_t geofence_id, int32_t status)

The callback associated with the remove_geofence call.

Parameter: geofence_id - Id of the geofence. status - GPS_GEOFENCE_OPERATION_SUCCESS GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id GPS_GEOFENCE_ERROR_GENERIC for others.

Definition at line 1135 of file gps.h.

typedef void(* gps_geofence_resume_callback)(int32_t geofence_id, int32_t status)

The callback associated with the resume_geofence call.

Parameter: geofence_id - Id of the geofence. status - GPS_GEOFENCE_OPERATION_SUCCESS GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id GPS_GEOFENCE_ERROR_GENERIC for others.

Definition at line 1160 of file gps.h.

typedef void(* gps_geofence_status_callback)(int32_t status, GpsLocation *last_location)

The callback associated with the availability of the GPS system for geofencing monitoring. If the GPS system determines that it cannot monitor geofences because of lack of reliability or unavailability of the GPS signals, it will call this callback with GPS_GEOFENCE_UNAVAILABLE parameter.

Parameters: status - GPS_GEOFENCE_UNAVAILABLE or GPS_GEOFENCE_AVAILABLE. last_location - Last known location.

Definition at line 1110 of file gps.h.

typedef void(* gps_geofence_transition_callback)(int32_t geofence_id, GpsLocation *location, int32_t transition, GpsUtcTime timestamp)

The callback associated with the geofence. Parameters: geofence_id - The id associated with the add_geofence_area. location - The current GPS location. transition - Can be one of GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED, GPS_GEOFENCE_UNCERTAIN. timestamp - Timestamp when the transition was detected.

The callback should only be called when the caller is interested in that particular transition. For instance, if the caller is interested only in ENTERED transition, then the callback should NOT be called with the EXITED transition.

IMPORTANT: If a transition is triggered resulting in this callback, the GPS subsystem will wake up the application processor, if its in suspend state.

Definition at line 1097 of file gps.h.

typedef void(* gps_location_callback)(GpsLocation *location)

Callback with location information. Can only be called from a thread created by create_thread_cb.

Definition at line 504 of file gps.h.

typedef void(* gps_measurement_callback)(GpsData *data)

The callback for to report measurements from the HAL.

Parameters: data - A data structure containing the measurements.

Definition at line 1623 of file gps.h.

typedef void(* gps_navigation_message_callback)(GpsNavigationMessage *message)

The callback to report an available fragment of a GPS navigation messages from the HAL.

Parameters: message - The GPS navigation submessage/subframe representation.

Definition at line 1725 of file gps.h.

typedef void(* gps_ni_notify_callback)(GpsNiNotification *notification)

Callback with NI notification. Can only be called from a thread created by create_thread_cb.

Definition at line 903 of file gps.h.

typedef void(* gps_nmea_callback)(GpsUtcTime timestamp, const char *nmea, int length)

Callback for reporting NMEA sentences. Can only be called from a thread created by create_thread_cb.

Definition at line 520 of file gps.h.

typedef void(* gps_release_wakelock)()

Callback utility for releasing the GPS wakelock.

Definition at line 533 of file gps.h.

typedef void(* gps_request_utc_time)()

Callback for requesting NTP time

Definition at line 536 of file gps.h.

typedef void(* gps_set_capabilities)(uint32_t capabilities)

Callback to inform framework of the GPS engine's capabilities. Capability parameter is a bit field of GPS_CAPABILITY_* flags.

Definition at line 525 of file gps.h.

typedef void(* gps_status_callback)(GpsStatus *status)

Callback with status information. Can only be called from a thread created by create_thread_cb.

Definition at line 509 of file gps.h.

typedef void(* gps_sv_status_callback)(GpsSvStatus *sv_info)

Callback with SV status information. Can only be called from a thread created by create_thread_cb.

Definition at line 515 of file gps.h.

typedef void(* gps_xtra_download_request)()

Callback to request the client to download XTRA data. The client should download XTRA data and inject it by calling inject_xtra_data(). Can only be called from a thread created by create_thread_cb.

Definition at line 612 of file gps.h.

Flags indicating the Accumulated Delta Range's states.

Definition at line 332 of file gps.h.

typedef uint16_t GpsAidingData

Flags used to specify which aiding data to delete when calling delete_aiding_data().

Definition at line 120 of file gps.h.

typedef uint16_t GpsClockFlags

Flags to indicate what fields in GpsClock are valid.

Definition at line 226 of file gps.h.

typedef uint8_t GpsClockType

Enumeration of the available values for the GPS Clock type.

Definition at line 245 of file gps.h.

typedef uint16_t GpsLocationFlags

Flags to indicate which values are valid in a GpsLocation.

Definition at line 82 of file gps.h.

typedef uint8_t GpsLossOfLock

Enumeration of the available values for the GPS Measurement's loss of lock.

Definition at line 300 of file gps.h.

typedef uint32_t GpsMeasurementFlags

Flags to indicate what fields in GpsMeasurement are valid.

Definition at line 259 of file gps.h.

typedef uint16_t GpsMeasurementState

Flags indicating the GPS measurement state.

Definition at line 322 of file gps.h.

typedef uint8_t GpsMultipathIndicator

Enumeration of available values for the GPS Measurement's multipath indicator.

Definition at line 311 of file gps.h.

typedef uint8_t GpsNavigationMessageType

Enumeration of available values to indicate the available GPS Natigation message types.

Definition at line 341 of file gps.h.

typedef int GpsNiEncodingType

NI data encoding scheme

Definition at line 190 of file gps.h.

typedef uint32_t GpsNiNotifyFlags

GpsNiNotifyFlags constants

Definition at line 170 of file gps.h.

typedef uint32_t GpsNiType

GpsNiType constants

Definition at line 162 of file gps.h.

typedef uint32_t GpsPositionMode

Requested operational mode for GPS operation.

Definition at line 47 of file gps.h.

typedef uint32_t GpsPositionRecurrence

Requested recurrence mode for GPS operation.

Definition at line 58 of file gps.h.

typedef uint16_t GpsStatusValue

GPS status event values.

Definition at line 67 of file gps.h.

typedef int GpsUserResponseType

GPS NI responses, used to define the response in NI structures

Definition at line 182 of file gps.h.

typedef int64_t GpsUtcTime

Milliseconds since January 1, 1970

Definition at line 38 of file gps.h.