/* Callback with location information. 告知上层位置信息*/
typedef void (* gps_location_callback)(GpsLocation* location);
/** Callback with status information.GPS状态信息回调*/
typedef void (* gps_status_callback)(GpsStatus* status);
/** Callback with SV status information.卫星状态信息回调 */
typedef void (* gps_sv_status_callback)(GpsSvStatus* sv_info);
/** Callback for reporting NMEA sentences. 向上层传递NEMA数据*/
typedef void (* gps_nmea_callback)(GpsUtcTime timestamp, const char* nmea, int length);
/** Callback to inform framework of the GPS engine's capabilities.告知上层次GPS能实现那些功能 */
typedef void (* gps_set_capabilities)(uint32_t capabilities);
/** Callback utility for acquiring the GPS wakelock.gps上锁 让gps功能不会被suspend*/
typedef void (* gps_acquire_wakelock)();
/** Callback utility for releasing the GPS wakelock. 释放锁*/
typedef void (* gps_release_wakelock)();
/** Callback for creating a thread that can call into the Java framework code.thread create
在次线程处理函数中通常会由一个无限的循环,去等待上层的请求,并应答*/
typedef pthread_t (* gps_create_thread)(const char* name, void (*start)(void *), void* arg);
4、接口结构体
typedef struct {
/** set to sizeof(GpsCallbacks) */
size_t size;
gps_location_callback location_cb;
gps_status_callback status_cb;
gps_sv_status_callback sv_status_cb;
gps_nmea_callback nmea_cb;
gps_set_capabilities set_capabilities_cb;
gps_acquire_wakelock acquire_wakelock_cb;
gps_release_wakelock release_wakelock_cb;
gps_create_thread create_thread_cb;
} GpsCallbacks;
就是以上函数指针组成的结构体,是一组回调函数,函数的实现在JNI层是Android实现好了得,无需做(太大的)修改
GpsInterface
Android GPS 最主要的数据结构,我们最主要的移植工作就是实现其中的函数