5.5 KiB
bdxt_sdk v1.2
介绍
Android SDK 本SDK支持蓝牙连接H10、H11、H20、C20,差分支持设备自带网络差分,同时也支持手机的网络差分。
安装教程
- 程序目录新建libs文件夹,将文件 rtklib_v1.0.1.aar libqxwz_release_v1.8.0.aar 拷贝至目录下
- 增加 import com.mijia.rtk.LocationListener; import com.mijia.rtk.handevice; import com.mijia.rtk.ConfigDeviceInfoListener; import com.mijia.rtk.ntripService;
- 调用接口参考demo code
使用说明
-
连接设备 handevice.connect(adrress); handevice.disconnect(); handevice.getConnectState();
-
设备cors设置 handevice.getAccount(); handevice.setAccount(String ip,String port,String user,String password,String source);
-
手机网络cors设置 handevice.setPhoneAccount(String ip,String port,String user,String password,String source);
-
回调
//和定位有关的回调函数 handevice.setLocationListener(new LocationListener() { @Override public void onLocationChanged() { //位置(经纬度)发生了变化 } @Override[README.md](..%2Fbdxt_sdk%2Fbdxt%2FREADME.md) public void onRead(@NonNull String msg) { //读到新的数据 } @Override public void onReceiveSatellite(List<SatelliteInfo> list) { /* 卫星的信息更新 SatelliteInfo satType 卫星类型 1:GP 2:GL 3:GA 4:BD 6:GI signalid 卫星频点 prn 卫星编号 elev 高度角,度 azi 方位角,度 snr 信噪比,00-99dB,不跟踪时为空 */ } @Override public void onBluetoothConnStatusChange(int state) { /*蓝牙的状态发生了变化 state 0:初始状态,没有连接 1:正在连接 2:成功连接 */ } });//和配置相关的回调函数 handevice.setConfigListener(new ConfigDeviceInfoListener() { @Override//获取设备内部的cors配置参数的回调 public void onGetCorsParaSuccess(@NonNull String ip, @NonNull String port, @NonNull String user, @NonNull String password, @NonNull String source) { Log.d(TAG, "ip:"+ip+",port:"+port+",user:"+user+",password:"+password+",source:"+source); } @Override //配置设备内部的cors账号的回调 public void onSetCorsParaAck(int state){ /*state: 1 CORS设置成功 0 CORS设置失败 * */ } @Override //手机网络cors的设置回调函数 public void onSetPhoneCorsParaAck(int state){ /* state: 0 手机网络连接CORS成功 1 手机网络失败:用户名、密码、挂载点 错误,验证未通过 2 手机网络失败:IP、PORT 错误,socket连接不到对方 3 手机网络失败:其他异常,比如手机无sim卡等 * */ Log.d("onSetPhoneCorsParaAck", "onSetPhoneCorsParaAck:"+state); } });-
定制化需求: 蓝牙信号强度和距离接口
A.函数名称 int handevice.getRssi(); 手机连接H11后,调用此接口,返回一个int值,表示蓝牙的信号强度,单位为dB. 如: 距离1米:-15dB
距离2米:-29dB A.函数名称 double handevice.getDistance(); 手机连接H11后,调用此接口,返回一个double值,距离,单位为米. 因为环境等原因,可能不准,只供参考,也可以自行修改A_Value、n_Value常量取重新计算 参考代码如下: public static double getDistance(){ /* A和n的值,需要根据实际环境进行检测得出 https://www.cnblogs.com/b-ben/p/11113000.html / double A_Value=15;/A - 发射端和接收端相隔1米时的信号强度/ double n_Value=2.5;/ n - 环境衰减因子*/ double power = (Math.abs(getRssi())-A_Value)/(10*n_Value); return Math.pow(10,power); } -
接口说明
-
Demo程序截图
参与贡献
- Fork 本仓库
- 新建 Feat_xxx 分支
- 提交代码
- 新建 Pull Request
特技
- 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
- Gitee 官方博客 blog.gitee.com
- 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
- GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
- Gitee 官方提供的使用手册 https://gitee.com/help
- Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/