资源预览内容
第1页 / 共10页
第2页 / 共10页
第3页 / 共10页
第4页 / 共10页
第5页 / 共10页
第6页 / 共10页
第7页 / 共10页
第8页 / 共10页
第9页 / 共10页
第10页 / 共10页
亲,该文档总共10页全部预览完了,如果喜欢就下载吧!
资源描述
北斗手持机函数接口说明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北斗模块信息接受系统广播:android.intent.action.beidou.msg.bd.info.receivedBundle 数据:service_frequency :服务频度communication_level :北斗卫星的通信等级number 北斗模块 IC 号码module_state : 导航模块硬件信息1 仅有 GPS2 仅有北斗4 双模service_number : 北斗服务中心号码version : 北斗模块版本号3.8北斗功率请求android.intent.action.beidou.msg.bd.info.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_number Bundle 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.inte
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号