NB-IoT移远BC95调试笔记 02 CoAP协议

来源:互联网 发布:金彩计划软件 编辑:程序博客网 时间:2024/06/06 03:30

前言

用华为方案的NB-IoT难免要进行数据通信,经常会看到各类AT文档中首推的CoAP协议方式。CoAP这几年随着物联网的浪潮也火了起来,和MQTT有并驾齐驱的势头,在一些物联网云平台中都有运用。

这篇笔记不去介绍CoAP,主要对华为方案NB-IoT的CoAP架构和使用,做个记录。

本文作者twowinter,转载请注明作者:http://blog.csdn.net/iotisan/

华为 NB-IoT CoAP总体方案拓扑

华为提供NB-IoT端到端解决方案的支持,提供多种开放能力供合作伙伴快速集成应用。提供海思的NB-IoT芯片,基站网络和Ocean Connect连接管理平台。开发者可以根据芯片/模组开发手册进行终端的开发,基于IoT平台进行APP Server开发。

  • Device:NB-IoT终端(如智能水表、智能气表等)通过空口连接到eNodeB。
  • eNodeB:主要承担空口接入处理和小区管理等相关功能,通过S1-lite接口与IoT核心网进行连接,将非接入层数据转发给高层网元处理。
  • IoT Core:承担与终端非接入层交互的功能,将IoT业务相关数据转发到IoT平台进行处理。
  • IoT Platform:IoT联接管理平台汇聚从各种接入网得到的IoT数据,根据不同类型转发给相应的业务应用进行处理。
  • APP Server:是IoT数据的最终汇聚点,根据客户的需求进行数据处理等操作。

从总体拓扑中可以看到,华为在这里放置了一个CoAP Server,所有使用CoAP的模组,都得先连接到华为这边。

当然,有办法绕过这个限制,那就是不使用模组内置的CoAP相关的AT指令。

自己在UDP基础上做这个协议。

华为 NB-IoT CoAP 相关指令

服务器配置

查看《Quectel_BC95_AT_Commands_Manual》

5.9. AT+NCDP Configure and Query CDP Server SettingsThe command is used to set and query the server IP address and port for the CDP server. It is used whenthere is a HiSilicon CDP or Huawei IoT platform acting as gateway to network server applications. Pleaserefer to Chapter 7 for possible <err> values.

可以看到这个CoAp要实现的话,是使用 海思CDP 或者 华为IoT 平台。

接收数据

方式一,主动查询方式。

5.2. AT+NMGR Get a MessageReceive a message from the CDP server.The command returns the oldest buffered message and deletes from the buffer. If there are no messagesthen no command response will be given. If new message indications (AT+NNMI) are turned on thenreceived messages will not be available via this command.

方式二,被动异步通知方式,从CDP平台上推送数据下来。

5.3. AT+NNMI New Message IndicationsThe command sets or gets new message indications that are sent. New message indications can be sentwhen a downstream message is received by the terminal from the CDP server. Please refer to Chapter 7for possible <err> values.When new message indications and messages are enabled (AT+NNMI=1), all currently bufferedmessages will be returned in the format of “+NNMI:<length>,<data>”. For example:“+NNMI:5,48656C6C6F”.

End


原创粉丝点击