Android系统Gps分析
1,GPS架构:
2,GPS分析: 2.1头文件:
头文件定义在头文件定义在:hardware/libhardware/include/hardware/gps.h,定义了GPS底层相关
的结构体和接口:
1,GpsLocation:GPS位置信息结构体,包含经度,纬度,高度,速度,方位角等.
typedef struct {
/** set to sizeof(GpsLocation) */
size_t size;
/** Contains GpsLocationFlags bits. */
uint16_t flags;
/** Represents latitude in degrees. */
double latitude;
/** Represents longitude in degrees. */
double longitude;
/** Represents altitude in meters above the WGS 84 reference
* ellipsoid. */
double altitude;
/** Represents speed in meters per second. */
float speed;
/** Represents heading in degrees. */
float bearing;
/** Represents expected accuracy in meters. */
float accuracy;
/** Timestamp for the location fix. */
GpsUtcTime timestamp;
} GpsLocation;
2,GpsStatus:GPS状态包括5种状态,分别为未知,正在定位,停止定位,启动未定义,未启动。 typedef struct {
/** set to sizeof(GpsStatus) */
size_t size;
GpsStatusValue status;
} GpsStatus;
3,GpsSvInfo:GPS卫星信息,包含卫星编号,信号强度,卫星仰望角,方位角等。 typedef struct {
/** set to sizeof(GpsSvInfo) */
size_t size;
/** Pseudo-random number for the SV. */
int prn;
/** Signal to noise ratio. */
float snr;
/** Elevation of SV in degrees. */
float elevation;
/** Azimuth of SV in degrees. */
float azimuth;
} GpsSvInfo;
4,GpsSvStatus:GPS卫星状态,包含可见卫星数和信息,星历时间,年历时间等。 typedef struct {
/** set to sizeof(GpsSvStatus) */
size_t size;
/** Number of SVs currently visible. */
int num_svs;
/** Contains an array of SV information. */
GpsSvInfo sv_list[GPS_MAX_SVS];
/** Represents a bit mask indicating which SVs
* have ephemeris data.
*/
uint32_t ephemeris_mask;
/** Represents a bit mask indicating which SVs
* have almanac data.
*/
uint32_t almanac_mask;
/**
* Represents a bit mask indicating which SVs
* were used for computing the most recent position fix.
*/
uint32_t used_in_fix_mask;
} GpsSvStatus;
5,GpsCallbacks:
/** Callback with location information.
* Can only be called from a thread created by create_thread_cb. */
typedef void (* gps_location_callback)(GpsLocation* location); //向上层传递GPS位置信息
相关推荐: