- 浏览: 359982 次
- 性别:
- 来自: 福州
文章分类
最新评论
-
loveskey:
找了好久,可算是找到了。感谢
dx.jar dx.bat -
zhaoyi168:
可以把工程的代码发给我吗?
ZJLN1982@yahoo.co ...
Athrun Demo -
ergodic09:
請問樓主 我目前在porting AR6003但是無法自己產生 ...
009-Android平台开发-WIFI function porting-WIFI功能移植 -
iedj99fei:
...
androi中xliff:g
转载时请注明出处和作者
文章出处:http://danielwood.cublog.cn
作者:Daniel Wood
----------------------------------------------------------
看Android的GPS模块有两个月了吧,终于可以写点东西出来。首先来看看GPS模块的代码结构:
Framework:
1.frameworks/base/location/java/android/location
这里主要是用来被App调用的,API包是android.location。
2.frameworks/base/location/java/com/android/internal/location
这个目录是Framework对Location服务的内部实现。
3.framework\services\java\com\android\server
这个目录只有一个文件
|-- LocationManagerService.java
是Location服务对内部实现的一种封装。
JNI:
frameworks/base/core/jni/android_location_GpsLocationProvider.cpp
JNI层只有一个文件,起到承上启下的作用。上层承接Framework,下层调用HAL层具体硬件抽象实现。
HAL:Hardware Abstract Layer 硬件抽象层
hardware\libhardware_legacy\gps
hardware\libhardware_legacy\include\hardware_legacy\gps.h
HAL层相当于一个linux应用程序接口,通过open,close等操作,操作硬件设备。Android的源代码只实现了模拟器的gps接口,具体在文件gps_qemu.c中。在2.2版本中提供了对QCOM公司的gps的实现,在以下目录:
\hardware\qcom
下面介绍几个重要的数据结构:
1. GpsInterface接口是gps模块中最重要的数据结构,它是底层驱动实现的接口,如果要porting到自己的板子上,就需要实现这些接口。该接口的定义在gps.h中,模拟器实现在gps_qemu.c中。
/** Represents the standard GPS interface. */
typedef struct {
/**
* Opens the interface and provides the callback routines
* to the implemenation of this interface.
*/
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
* (typically cell ID).
* latitude and longitude are measured in degrees
* expected accuracy is measured in meters
*/
int (*inject_location)(double latitude, double longitude, float accuracy);
/**
* Specifies that the next call to start will not use the
* information defined in the flags. GPS_DELETE_ALL is passed for
* a cold start.
*/
void (*delete_aiding_data)(GpsAidingData flags);
/**
* fix_frequency represents the time between fixes in seconds.
* Set fix_frequency to zero for a single-shot fix.
*/
int (*set_position_mode)(GpsPositionMode mode, int fix_frequency);
/** Get a pointer to extension information. */
const void* (*get_extension)(const char* name);
} GpsInterface;
2. GpsCallbacks回调函数
这个是回调函数结构体,定义也在gps.h中。它们的实现是在android_location_GpsLocationProvider.cpp中,google已经实现了,我们不需要做任何动作。
/** GPS callback structure. */
typedef struct {
gps_location_callback location_cb;
gps_status_callback status_cb;
gps_sv_status_callback sv_status_cb;
gps_nmea_callback nmea_cb;
} GpsCallbacks;
/** Callback with location information. */
typedef void (* gps_location_callback)(GpsLocation* location);
/** Callback with status information. */
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. */
typedef void (* gps_nmea_callback)(GpsUtcTime timestamp, const char* nmea, int length);
3. GpsLocation
表示Locatin数据信息,底层驱动获得Location的raw信息,通常是nmea码,然后通过解析就得到了location信息。
/** Represents a location. */
typedef struct {
/** 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;
文章出处:http://danielwood.cublog.cn
作者:Daniel Wood
----------------------------------------------------------
看Android的GPS模块有两个月了吧,终于可以写点东西出来。首先来看看GPS模块的代码结构:
Framework:
1.frameworks/base/location/java/android/location
这里主要是用来被App调用的,API包是android.location。
2.frameworks/base/location/java/com/android/internal/location
这个目录是Framework对Location服务的内部实现。
3.framework\services\java\com\android\server
这个目录只有一个文件
|-- LocationManagerService.java
是Location服务对内部实现的一种封装。
JNI:
frameworks/base/core/jni/android_location_GpsLocationProvider.cpp
JNI层只有一个文件,起到承上启下的作用。上层承接Framework,下层调用HAL层具体硬件抽象实现。
HAL:Hardware Abstract Layer 硬件抽象层
hardware\libhardware_legacy\gps
hardware\libhardware_legacy\include\hardware_legacy\gps.h
HAL层相当于一个linux应用程序接口,通过open,close等操作,操作硬件设备。Android的源代码只实现了模拟器的gps接口,具体在文件gps_qemu.c中。在2.2版本中提供了对QCOM公司的gps的实现,在以下目录:
\hardware\qcom
下面介绍几个重要的数据结构:
1. GpsInterface接口是gps模块中最重要的数据结构,它是底层驱动实现的接口,如果要porting到自己的板子上,就需要实现这些接口。该接口的定义在gps.h中,模拟器实现在gps_qemu.c中。
/** Represents the standard GPS interface. */
typedef struct {
/**
* Opens the interface and provides the callback routines
* to the implemenation of this interface.
*/
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
* (typically cell ID).
* latitude and longitude are measured in degrees
* expected accuracy is measured in meters
*/
int (*inject_location)(double latitude, double longitude, float accuracy);
/**
* Specifies that the next call to start will not use the
* information defined in the flags. GPS_DELETE_ALL is passed for
* a cold start.
*/
void (*delete_aiding_data)(GpsAidingData flags);
/**
* fix_frequency represents the time between fixes in seconds.
* Set fix_frequency to zero for a single-shot fix.
*/
int (*set_position_mode)(GpsPositionMode mode, int fix_frequency);
/** Get a pointer to extension information. */
const void* (*get_extension)(const char* name);
} GpsInterface;
2. GpsCallbacks回调函数
这个是回调函数结构体,定义也在gps.h中。它们的实现是在android_location_GpsLocationProvider.cpp中,google已经实现了,我们不需要做任何动作。
/** GPS callback structure. */
typedef struct {
gps_location_callback location_cb;
gps_status_callback status_cb;
gps_sv_status_callback sv_status_cb;
gps_nmea_callback nmea_cb;
} GpsCallbacks;
/** Callback with location information. */
typedef void (* gps_location_callback)(GpsLocation* location);
/** Callback with status information. */
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. */
typedef void (* gps_nmea_callback)(GpsUtcTime timestamp, const char* nmea, int length);
3. GpsLocation
表示Locatin数据信息,底层驱动获得Location的raw信息,通常是nmea码,然后通过解析就得到了location信息。
/** Represents a location. */
typedef struct {
/** 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;
发表评论
-
eclipse中安装插件地址
2014-03-07 15:08 727http://subclipse.tigris.org/up ... -
ubuntu13下载android源码
2014-02-27 18:23 604一、注意repo的正确地址 repo:curl " ... -
用例无法运行,报如下错:Exception during suite construction
2014-02-26 15:47 1200一 前提 1、 测试工程中的所有参数已配置好,如ins ... -
dx.jar dx.bat
2013-06-17 19:33 2198Android SDK中dx.jar, dx.bat文件的备份 ... -
Please ensure that adb is correctly located..... 问题
2013-04-16 09:44 936解决方法: 方法一、查毒杀毒,也许了病毒占用了adb ... -
PC端通过adb与设备端通信
2013-03-28 09:36 1462adb 全称Android Debug Bri ... -
Unable to execute dex: Multiple dex files define Lorg/taptwo/android/widget/Circ
2013-02-21 15:07 2549问题:[2013-02-21 15:01:02 - Dex ... -
android viewTree and decorView
2013-01-30 13:55 1673Android ViewTree and DecorView ... -
No active compatible AVD's or devices found. Relaunch this configuration after c
2013-01-29 10:56 8732问题:No active compatible AVD's ... -
代码对比工具
2013-01-24 15:33 616windows: http://www.scooterso ... -
android最新源码下载
2013-01-23 09:57 1026源码下载:https://source.android.co ... -
Run MonkeyTalk Scripts via Ant in Windows
2012-12-18 20:24 1238Run MonkeyTalk Scripts via ... -
Android中cpu,memory,Battery的计算
2012-11-20 19:59 65731 Memory的分配(RAM而非ROM) 网址: •ht ... -
http://code.taobao.org/p/TMTS/src/
2012-10-12 17:38 1005http://code.taobao.org/p/TMTS/s ... -
string.xml文件中的特殊符号转换符
2012-09-24 09:09 741strings.xml文件中需要对特殊符号(如%,'等)进行转 ... -
web server 中设置wifi代理
2012-09-24 09:07 871DefaultHttpClient httpClient = ... -
Android开发一些常见问题
2012-09-24 09:06 7211:当追踪问题时,代码中实在找不出问题所以,代码的逻辑完全正确 ... -
将log信息写入sdcard
2012-07-05 17:14 841File mFile; private void write ... -
string.xml文件中的特殊符号转换符
2012-06-19 19:39 1000strings.xml文件中需要对特殊符号(如%,'等)进行转 ... -
关于popupWindow的dismiss
2012-06-17 16:13 8546View contentView = LayoutInflat ...
相关推荐
AndroidGPS架构分析.pdf
androidGPS架构分析推荐.pdf
androidGPS架构分析借鉴.pdf
GPS模块的代码结构;Framework/JNI/HAL
Android_GPS架构分析 android GPS的启动过程,以及剖析GPS应用程序如何调用函数来驱动底层硬件,最后分析几个重要的结构体。
详细讲解 Android GPS模块 对于AndroidGPS开发有用
android GPS架构之GPS的开启与关闭
主要讲述framework 到jni 再到hal层的流程,让你对gps有进一步的理解!
以android2.2为基础,阐述GPS的数据流程及重要代码剖析,希望对大家有帮助。
Android_GPS架构分析,在源码的基础上详细分析
详细的描述了Android GPS的驱动文档,和GPS的驱动架构
Android GPS HAL driver porting 笔记,详细的描述了Android GPS 硬件抽象层的基本架构
TI GPS在android4.2中的架构
特征,系统架构及应用程序构建、开发都作了比较详细的分析;最后,结 合GPS定位相关理论与算法,设计并实现了基于Android平台的地块测量 系统。 本系统实现的功能主要包括地块边界测量点的定位、测量点的更新、 定位...
段,Android 图像处理篇,Android_CTS测试研,GoogleMaps基础开发教程,Android_GPS架构分析,android_JNI编程_一些技 巧,android_jni操作指南,Android_NDK开发实例,Android_RIL层剖析(官方翻译),Android2.2+API+中文...
段,Android 图像处理篇,Android_CTS测试研,GoogleMaps基础开发教程,Android_GPS架构分析,android_JNI编程_一些技 巧,android_jni操作指南,Android_NDK开发实例,Android_RIL层剖析(官方翻译),Android2.2+API+中文...
这份资料,绝对不可多得,下了就知道 Bluetooth, FM, GPS Solution with Shared Transport ...8. Appendix 1: Shared Transport in Android 25 8.1. Execution of UIM 25 8.2. Bluetooth On/Off 25