当前位置:文档之家› 北斗手持机开发接口(北斗模块_2015.0421)

北斗手持机开发接口(北斗模块_2015.0421)

北斗手持机函数接口说明1北斗1代接口机制说明北斗短信接口主要是采用android的广播机制。

2北斗1代接口适用版本。

3北斗1代接口函数说明3.1发送北斗信息android.intent.action.beidou.msg.sendBundle数据:number :String 类型北斗报文发送的目的卡号msgcontent :byte[]类型,信息内容。

type : int 类型: 编码方式0 混发1 汉字2 代码bitLen:int类型:报文有效数据位数(bit总数)备注:1.北斗4.0协议规范中规定,北斗报文长度以bit计算。

“传输方式”为代码且“电文内容”不满整字节,传输时在电文最后补“0”2.在“代码方式”发送和解码北斗报文时,需要注意实际有效的bit位数是否是满字节不是满字节。

示例代码:由于示例代码较长,请查考app源代码中case R.id.btn_send事件响应处理函数3.2接受北斗信息android.intent.action.beidou.msg.receivedBundle数据:number :String 类型报文发送方号码msgcontent :byte[]类型,信息内容。

msgtype::int 类型编码方式:0 混发1 汉字2 代码crcFlag :int 类型校验位0 :报文校验正确1 :报文校验错误bitLen : 北斗报文中实际传输有效bit数北斗报文解析步骤:确定报文校验是否正确,再根据实际有效的数据长度bitLen 在msgContent中获取报文内容。

3.3请求读取北斗卡信息参数:无示例代码:private LocationManager mlocation;mlocation.sendExtraCommand(LocationManager.GPS_PROVIDER,"request_bd_info", null);备注:详细见app工程中的源码的处理3.4请求获取北斗IC卡号android.intent.action.beidou.msg.number.request备注:此功能暂时未做3.5接受北斗IC 号接收广播:android.intent.action.beidou.msg.number.receivedBundle数据ic_number : String 类型示例代码:bundle = intent.getExtras();String number = bundle.getString("ic_number");tempStr = "北斗号:" + number;txt_sim_num_info.setText(tempStr);3.6短报文发送状态接受广播:android.intent.action.beidou.feedbackinfo.received";Bundle数据:FeedBackTag :String类型FKXX中返回的数据指令执行结果代码(标准4.0协议的返回)FeedBackExtraInfo: String类型FKXX中附加信息详细使用方式见:示例app源码中ACTION_MSG_BD_FKXX_RECEIVED事件的处理源码3.7北斗模块信息接受系统广播:.receivedBundle数据:service_frequency :服务频度communication_level :北斗卫星的通信等级number 北斗模块IC号码module_state :导航模块硬件信息1仅有GPS2 仅有北斗4 双模service_number :北斗服务中心号码version :北斗模块版本号3.8北斗功率请求.request_bd_power参数: 无示例代码:Intent powIntent = new Intent(ACTION_MSG_BD_POWER_INFO_REQUEST); sendBroadcast(powIntent);3.9北斗功率接收接受系统广播:android.intent.action.beidou.powerinfo.receivedBundle数据:m_p0 int类型,波束1 功率值m_p1 int类型波束2 功率值m_p2 int类型波束3功率值m_p3 int类型波束4 功率值m_p4 int类型波束5 功率值m_p5 int类型波束6 功率值3.10允许发送短信:允许发送消息:命令bd_msg_enableBundle bundle = new Bundle();bundle.putBoolean("op", enable);mlocation.sendExtraCommand(LocationManager.GPS_PROVIDER, "bd_msg_enable", bundle);获取允许发送北斗信息的接口:boolean msgEnable = Settings.System.getInt(getContentResolver(),BD_MSG_ENABLE, 1) > 03.11设置服务中心号码:命令:set_service_numberBundle bundleSet = new Bundle();bundleSet.putString("set_service_number", edt_service_num.getText().toString())mlocation.sendExtraCommand(LocationManager.GPS_PROVIDER, "set_service_number", bundleSet);上述的接口的例子可见TestBDReceiver 例子3.12定位申请(DWSQ)3.12.1申请发送广播:android.intent.action.beidou.msg.dwsq.requestBundle参数:freq Int类型定位频度示例代码:Intent dwIntent = new Intent(ACTION_MSG_BD_DWSQ_REQUEST); //申请一个IntentBundle dwBundle = new Bundle(); //申请bundledwBundle.putInt("DWSQ_FREQ", freq); //设置定位频度0 单次定位。

根据北斗卡设置,60分钟卡,freq请设置大于60dwIntent.putExtras(dwBundle); //广播参数sendBroadcast(dwIntent); //启动定位申请3.12.2定位信息接收(DWXX)事件: android.intent.action.beidou.msg.dwxx.receivedBundle参数:m_Type byte 类型m_byHeightData short 类型高程值m_byHeightSymbol byte 类型高程符号位: 0 为正非零为负m_byHour int 类型时间信息:小时m_byMinute int 类型时间信息:分钟m_bySecond1 int 类型时间信息:秒m_byLonDegree int 类型经度信息:度m_byLonMinute int 类型经度信息:分m_byLonSecond1 int 类型经度信息:秒m_byLonSecond2 int 类型经度信息:小秒m_byLatDegree int 类型纬度信息: 度m_byLatMinute int 类型纬度信息: 分m_byLatSecond1 int 类型纬度信息: 秒m_byLatSecond2 int 类型纬度信息: 小秒示例代码: 由于示例代码较长,请参考app源码中ACTION_MSG_BD_DWXX_RECEIVED.equals(action)事件处理的源代码3.13”北斗报文”中”获取坐标信息”使用"android.intent.action.beidou.msg.dwxx.received示例代码:hort m_byHeightData = bundle.getShort("m_byHeightData");byte m_byHeightSymbol = bundle.getByte("m_byHeightSymbol");int time_hour = (int)bundle.getByte("m_byHour");int time_minute = bundle.getByte("m_byMinute");int time_second = bundle.getByte("m_bySecond1");int time_minsecond = bundle.getByte("m_bySecond2");int lonDegree = bundle.getByte("m_byLonDegree");int lonMinute = bundle.getByte("m_byLonMinute");int lonSecond = bundle.getByte("m_byLonSecond1");int lonminSecond = bundle.getByte("m_byLonSecond2");int latDegree = bundle.getByte("m_byLatDegree");int latMinute = bundle.getByte("m_byLatMinute");int latSecond = bundle.getByte("m_byLatSecond1");int latminSecond = bundle.getByte("m_byLatSecond2");3.14管信注入(ZBZR)请求:android.intent.action.beidou.msg.gxzr.request参数:GXZR_Content 类型String 管信注入的管理信息示例代码:byte[] content = "abcdefghabcdefghabcdefghabcdefgh".getBytes();Bundle gxbundle = new Bundle();gxbundle.putByteArray("GXZR_Content", content);Intent gxIntent = new Intent(ACTION_MSG_BD_GXZR_REQUEST);gxIntent.putExtras(gxbundle);sendBroadcast(gxIntent);3.15管信读取(GXDQ)请求:android.intent.action.beidou.msg.gxdq.request参数:无示例代码:Intent gxdqIntent = new Intent(ACTION_MSG_BD_GXDQ_REQUEST);sendBroadcast(gxdqIntent);3.16管理信息(GLXX)事件:android.intent.action.beidou.msg.glxxInfo.received参数: GLXXInfo 类型String 管理信息示例代码:Bundle bundleglxx = intent.getExtras();byte[] glxxInfo = bundleglxx.getByteArray("GLXXInfo");3.17坐标转换(ZBZH)请求:android.intent.action.beidou.msg.zbzh.request参数: ZBZH_Longitude 类型String 经度数据ZBZH_Lat 类型String 纬度数据ZBZH_Heigth 类型String 高程值ZBZH_HeigthAnomaly 类型String 高程异常值ZBZH_ChangeMode 类型String 坐标转换方式ZBZH_ChangeMode 取值: 0x01 表示将大地坐标转换为空间直角坐标,0x02 表示将大地坐标转换为高斯平面直角坐标,0x03 表示将大地坐标转换为麦卡托平面直角坐标示例代码:byte[] Longitude = "12345678".getBytes(); // Longitude[0] 对应经度数据中的”度”。

相关主题