/** Represents the standard GPS interface. */
typedef struct {
/** set to sizeof(GpsInterface) */
size_t size;
/*Opens the interface and provides the callback routines 初始化callbacks 为JNI传下来的
在此会使用callbacks中的create_thread_cb 来创建一个线程处理函数一直循环,等待任务处理*/
int (*init)( GpsCallbacks* callbacks );
/** Starts navigating. */
int (*start)( void );
/** Stops navigating. */
int (*stop)( void );
/** Closes the interface. */
void (*cleanup)( void );
/** Injects the current time. 填入时间*/
int (*inject_time)(GpsUtcTime time, int64_t timeReference,
int uncertainty);
/** Injects current location from another location provider 填入位置*/
int (*inject_location)(double latitude, double longitude, float accuracy);
/*删除全部or部分辅助数据 在性能测试时候使用*/
void (*delete_aiding_data)(GpsAidingData flags);
/*设置定位模式 与GPS工作模式等等*/
int (*set_position_mode)(GpsPositionMode mode, GpsPositionRecurrence recurrence,
uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time);
/*自行添加的 接口 AGpsInterface接口通过次函数获得*/
const void* (*get_extension)(const char* name);
} GpsInterface;
/** Callback with AGPS status information.
* Can only be called from a thread created by create_thread_cb.
*/
typedef void (* agps_status_callback)(AGpsStatus* status);
/** Callback structure for the AGPS interface. */
typedef struct {
agps_status_callback status_cb;
gps_create_thread create_thread_cb;
} AGpsCallbacks;
AGpsInterface
/** Extended interface for AGPS support. */
typedef struct {
/** set to sizeof(AGpsInterface) */
size_t size;
/**
* Opens the AGPS interface and provides the callback routines
* to the implemenation of this interface.
*/
void (*init)( AGpsCallbacks* callbacks );
/**
* Notifies that a data connection is available and sets
* the name of the APN to be used for SUPL.
*/
int (*data_conn_open)( const char* apn );
/**
* Notifies that the AGPS data connection has been closed.
*/
int (*data_conn_closed)();
/**
* Notifies that a data connection is not available for AGPS.
*/
int (*data_conn_failed)();
/**
* Sets the hostname and port for the AGPS server.
*/
int (*set_server)( AGpsType type, const char* hostname, int port );
} AGpsInterface
struct gps_device_t
定义描述gps设备类型