1. 安卓源码gps代码

定义一个结构体</strong>
431typedef struct {
432    /** set to sizeof(GpsLocation) */
433    size_t          size;
434    /** Contains GpsLocationFlags bits. */
435    uint16_t        flags;
436    /** Represents latitude in degrees. */
437    double          latitude;
438    /** Represents longitude in degrees. */
439    double          longitude;
440    /** Represents altitude in meters above the WGS 84 reference
441     * ellipsoid. */
442    double          altitude;
443    /** Represents speed in meters per second. */
444    float           speed;
445    /** Represents heading in degrees. */
446    float           bearing;
447    /** Represents expected accuracy in meters. */
448    float           accuracy;
449    /** Timestamp for the location fix. */
450    GpsUtcTime      timestamp;
451}<strong> GpsLocation</strong>;
452
函数验证仿造
<span style="background-color: rgb(255, 255, 0);">typedef struct{   //定义一个结构体
    int age;
    int num;
}GpsLocation;</span>

</pre><pre code_snippet_id="1744873" snippet_file_name="blog_20160704_5_7527996" name="code" class="cpp" style="background-color: rgb(255, 255, 255);"><strong>二 ,定义回调函数</strong>
/** Callback with location information.
527 *  Can only be called from a thread created by create_thread_cb.
528 */

529typedef void (* gps_location_callback)(GpsLocation
530
531/** Callback with status information.
532 *  Can only be called from a thread created by create_thread_cb.
533 */
534typedef void (* gps_status_callback)(GpsStatus* status);</span>


 
 
三,call back的结构体函数
 
typedef struct {
	  gps_location_callback location_cb; //定义函数指针变量
}GpsCallbacks;
 
/** GPS callback structure. */
569typedef struct {
570    /** set to sizeof(GpsCallbacks) */
571    size_t      size;
572    gps_location_callback location_cb;
573    gps_status_callback status_cb;
574    gps_sv_status_callback sv_status_cb;
575    gps_nmea_callback nmea_cb;
576    gps_set_capabilities set_capabilities_cb;
577    gps_acquire_wakelock acquire_wakelock_cb;
578    gps_release_wakelock release_wakelock_cb;
579    gps_create_thread create_thread_cb;
580    gps_request_utc_time request_utc_time_cb;
581} GpsCallbacks;


 
 

                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值