-
大小: 15KB文件类型: .rar金币: 2下载: 0 次发布日期: 2021-06-05
- 语言: Java
- 标签: android4.2 gps hal
资源简介
android 下处理gps数据的hal层代码,带Android.mk 文件,只处理gps数据,不处理北斗的数据。(源码来自网络)
调试中解决的问题:
1、使用gps test工具测试,能搜索到卫星且也能够定位,但是已使用的卫星个数一直为零。(北斗数据覆盖了gps数据导致)
2、信号为零的卫星也显示。(修改代码逻辑,将信号大于零才加入卫星列表)
3、只有定到位置后才显示卫星。(修改代码只要有卫星有信号,就上报android系统)

代码片段和文件信息
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License Version 2.0 (the “License“);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing software
* distributed under the License is distributed on an “AS IS“ BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define LOG_TAG “GPS“
#define GPS_DEBUG 0
#if GPS_DEBUG
#define D(...) LOGD(__VA_ARGS__)
#else
#define D(...) ((void)0)
#endif
typedef struct {
const char* p;
const char* end;
} Token;
#define MAX_NMEA_TOKENS 21
typedef struct {
int count;
Token tokens[ MAX_NMEA_TOKENS ];
} NmeaTokenizer;
GpsStatus g_status;
static int
nmea_tokenizer_init( NmeaTokenizer* t const char* p const char* end )
{
int count = 0;
char* q;
// the initial ‘$‘ is optional
if (p < end && p[0] == ‘$‘)
p += 1;
// remove trailing newline
if (end > p && end[-1] == ‘\n‘) {
end -= 1;
if (end > p && end[-1] == ‘\r‘)
end -= 1;
}
// get rid of checksum at the end of the sentecne
if (end >= p+3 && end[-3] == ‘*‘) {
end -= 3;
}
while (p < end) {
const char* q = p;
q = memchr(p ‘‘ end-p);
if (q == NULL){
q = end;
}
if (q >= p) {
if (count < MAX_NMEA_TOKENS) {
t->tokens[count].p = p;
t->tokens[count].end = q;
count += 1;
}
}
if (q < end){
q += 1;
}
p = q;
}
t->count = count;
return count;
}
static Token
nmea_tokenizer_get( NmeaTokenizer* t int index )
{
Token tok;
static const char* dummy = ““;
if (index < 0 || index >= t->count) {
tok.p = tok.end = dummy;
} else {
tok = t->tokens[index];
}
return tok;
}
static int
str2int( const char* p const char* end )
{
int result = 0;
int len = end - p;
for ( ; len > 0; len-- p++ )
{
int c;
if (p >= end)
goto Fail;
c = *p - ‘0‘;
if ((unsigned)c >= 10)
goto Fail;
result = result*10 + c;
}
return result;
Fail:
return -1;
}
static double
str2float( const char* p const char* end )
{
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 13652 2014-03-12 15:54 gps_hal\gps.default.so
文件 30735 2014-03-12 15:54 gps_hal\gps.c
文件 1045 2014-03-12 09:53 gps_hal\Android.mk
目录 0 2014-03-12 15:54 gps_hal
----------- --------- ---------- ----- ----
45432 4
相关资源
- Android百度地图画运动轨迹和GPS定位
- android 收音机 FM 驱动 hal层 框架层以及
- 开源代码GPS跟踪系统
- Android LocationManager 获取经纬度和卫星
- Android GPS+指南针源码
- Android5.1 Gps Hal
- android GPS架构之GPS的开启与关闭
- Android读取GPS数据demo
- Android GPS定位
- Android项目GPS实时定位位置共享源码
- android简单实现输入经纬度获取地理位
- Android根据GPS位置获得天气的程序
- 科沃兹自启动GPS支持热插拔无service,
- android程序的自动更新 和 基于GPS定位
- 打开摄像头并在预览画面上显示传感
- Android根据GPS获取经纬度和海拔
- android6.0 GPS 使用demo包括动态权限申
- JS方式获取数据库坐标数据并动态显示
- Android GPS定位获取经纬度
- MockGPS_20181031_v1.9.3.1.apk
- Java Coding Problems - Improve your Java Progr
- android 一键锁屏,android4.2测试通过
- android 获取GPS
- marshalsec-0.0.3-SNAPSHOT-all.jar
- GPS定位: Android 手机端,C#电脑端;G
- android获取GPS经纬度,并根据经纬度获
- 交通部809协议JAVA实现的接收车辆GPS数
- GPS通过蓝牙推送位置到APP显示
- GPS坐标WGS84和中国大地坐标CGCS2000互转
- 管系统仿真与GPSSJAVA
评论
共有 条评论