gps.h文件中定义了GPS底层相关的结构体和接口。
目录:hardware/libhardware/include/hardware/gps.h
1. 相关宏定义
- 定位模式定义:GpsPositionMode
GPS定位模式分为:独立定位,MSB,MSA,其中独立定位表示只使用GPS芯片进行定位,MSB和MSA是AGPS定位的两种模式
<pre name="code" class="cpp">/** Requested operational mode for GPS operation. */
typedef uint32_t GpsPositionMode;
// IMPORTANT: Note that the following values must match
// constants in GpsLocationProvider.java.
/** Mode for running GPS standalone (no assistance). */
#define GPS_POSITION_MODE_STANDALONE 0
/** AGPS MS-Based mode. */
#define GPS_POSITION_MODE_MS_BASED 1
/** AGPS MS-Assisted mode. */
#define GPS_POSITION_MODE_MS_ASSISTED 2
- GPS工作模式定义:GpsPositionRecurrence
GPS工作模式分为周期定位和单次定位
<pre name="code" class="cpp">/** Requested recurrence mode for GPS operation. */
typedef uint32_t GpsPositionRecurrence;
// IMPORTANT: Note that the following values must match
// constants in GpsLocationProvider.java.
/** Receive GPS fixes on a recurring basis at a specified period. 周期性定位*/
#define GPS_POSITION_RECURRENCE_PERIODIC 0
/** Request a single shot GPS fix. 单次定位*/
#define GPS_POSITION_RECURRENCE_SINGLE 1
- GPS工作状态:GpsStatusValue
GPS工作状态分为:未知,正在定位,停止定位,启动未定义,未启动。
<pre name="code" class="cpp">/** GPS status event values. */
typedef uint16_t GpsStatusValue;
// IMPORTANT: Note that the following values must match
// constants in GpsLocationProvider.java.
/** GPS status unknown. */
#define GPS_STATUS_NONE 0
/** GPS has begun navigating. */
#define GPS_STATUS_SESSION_BEGIN 1
/** GPS has stopped navigating. */
#define GPS_STATUS_SESSION_END 2
/** GPS has powered on but is not navigating. */
#define GPS_STATUS_ENGINE_ON 3
/** GPS is powered off. */
#define GPS_STATUS_ENGINE_OFF 4
- Location信息标志位
表明位置信息中哪些信息是可获得的
<pre name="code" class="cpp">/** Flags to indicate which values are valid in a GpsLocation. */
typedef uint16_t GpsLocationFlags;
// IMPORTANT: Note that the following values must match
// constants in GpsLocationProvider.java.
/** GpsLocation has valid latitude and longitude. */
#define GPS_LOCATION_HAS_LAT_LONG 0x0001
/** GpsLocation has valid altitude. */
#define GPS_LOCATION_HAS_ALTITUDE 0x0002
/** GpsLocation has valid speed. */
#define GPS_LOCATION_HAS_SPEED 0x0004
/** GpsLocation has valid bearing. */
#define GPS_LOCATION_HAS_BEARING 0x0008
/** GpsLocation has valid accuracy. */
#define GPS_LOCATION_HAS_ACCURACY 0x0010
- gps_set_capabilities 回调标志位
表示GPS芯片可以处理的能力
<pre name="code" class="cpp">/** Flags for the gps_set_capabilities callback. */
/** GPS HAL schedules fixes