NB-IoT-based protocol analysis of LWM2M

LWM2M M2M protocol is lightweight protocol developed by the OMA, mainly for things based on narrowband cellular (Narrow Band Internet of Things, NB -IoT) scenario networking applications, low power consumption and wide coverage focused on (LPWA) Things (IoT) market, it is an emerging technology in the widely used worldwide. It has wide coverage, connect multiple, low-rate, low cost, low power consumption, excellent architectural features.
OneNET mobile platform is the platform for communication with the UE based on the NB-IOT and the CoAP LWM2M protocol, wherein the protocol is LWM2M application layer protocol, a transport layer protocol of the CoAP.
1, LWM2M logical interface protocol logic entity
(1) LwM2M defines three logical entities:
LWM2M Server: access unit, internet server interface;
LWM2M Client: client, the server and execute the command execution result report;
on Bootstrap Server: boot machine, is responsible for configuring LWM2M client.
(2) There are four logical interface between three logical entities:
on Bootstrap: Clinet on Bootstrap Server configured through this interface - for example, the URL address LWM2M server;
Device the Discovery and Registration: registered client to the server and the server notifies the client supported capabilities;
Device Management and Service Enablement: LWM2M Server sends commands to the Client and are subject to respond;.
information Reporting: LWM2M Client to report their information resources, such as temperature sensors.
The relationship between these three logical entities and interfaces four logical follows:

Here Insert Picture Description

2, LWM2M stack
Lightweight M2M protocol stack structure as shown below:
Here Insert Picture Description
2.1 LWM2M Objects
of each object (object) corresponding to a particular functional entity client. LWM2M standard specification defines Objects, such as:
URN: OMA: lwm2m: OMA: 2; (LWM2M Object Server, where '2' as object ID).
urn: oma: lwm2m: oma: 3; (LWM2M Access Control Object, where '3' as object ID).
In addition LWM2M defined object, IPSO organization also defines some common sensor object, such as:
URN: OMA: lwm2m: EXT: 3311; (IPSO Light Control ,, where '3311' is object ID).
Each object can have multiple resource, each resource on behalf of an object or function attributes. Such as the object ID of the resource portion 3311 of the sensor is described as follows:
Here Insert Picture Description
2.2 LWM2M Protocol
LWM2M Protocol defines some logical operation, such as Read, Write, Execute, Create and Delete operations. Through these logical operations, to achieve data exchange with the terminal apparatus internet cloud.
3, based on LWM2M protocol access mobile OneNet instances
in which we use AM20E module Beijing Things miracle access OneNET platform. Before access, users need to complete the platform side OneNET registration and product creation.
3.1 Product Creation

  1. After completing the user registration and log into the Developer Center for product creation.
    Here Insert Picture Description
  2. When the product is created, according to the contents of the page, fill in your product information.
    Here Insert Picture Description
    3. Once the product is created, add a device, which, IMEI number and SIM card IMSI number AM20E module, use serial debugging tools, namely AT + CGSN instructions and commands available through AT + CIMI, and filled in.
    Here Insert Picture Description
    4. After the product created and added equipment is complete, equipment, bar equipment gray offline in the device management interface to see added.

Here Insert Picture Description
5. In the module side access procedure, when the side of the platform module receives the registration result returned + MIPLEVENT: 0,6, to complete the registration. The device will display a green bar to indicate the line status.
Here Insert Picture Description
3.2 OneNET internet access module process
module completes the initialization process after successful registration and network access platform OneNET flowchart as shown below.

Here Insert Picture Description
Internet access module OneNET flowchart above, it is explained that:
the data interaction process, internet READ / WRITE / EXECUTE / PARAMETER operation request, the module reports resource value, and means to update registration information, regardless of the order of these three steps Therefore it is not numbered in order.
Dashed arrows in FIG OneNET platform returns a response to the result + MIPLEVENT module side. Return Value + MIPLEVENT see the description of the AT command set.
3.3 Reference Example
1. The module initializes
the AT
+ PBREADY

AT // AT normal response
OK

CSQ + AT
+ CSQ: CSQ normal 20, 99 detect the OK //

+ CEREG AT?
+ CEREG: 0, 1 // module registered the OK normal network

2. OneNET internet access module, complete the registration
AT + XIIC = 1 OK // Get IP Address

+ XIIC AT?
+ XIIC: 1,100.103.238.182 // query IP address is successfully acquired
OK

AT + MIPLVER? // Query Fundamentals Communication Suite version 2.2.0
the OK

+ MIPLCREATE AT
+ MIPLCREATE: 0 // create the basic communications package succeeds, the return is 0,0 Communication Suite is the foundation of identity, a subsequent need to use AT commands to it
OK

+ = 0,3303,2 MIPLADDOBJ the AT, ". 11", 6,1
// add objects 3303,2 instance, six attributes. Where the object Objectid3303 subject to the naming convention, please refer to the link:
http://www.openmobilealliance.org/wp/OMNA/LwM2M/LwM2MRegistry.html,
the OK

The OK = 0,3600 + MIPLOPEN the AT
// registration request module
+ MIPLEVENT: 0,1 // OneNET internet return results BOOTSTRAP_START
+ MIPLEVENT: 0,2 // return result oneNet internet BOOTSTRAP_SUCCESS
+ MIPLEVENT: // 0,4 oneNet internet return results CONNECT_SUCCESS
+ MIPLEVENT: 0,6 // return result oneNet internet REG_SUCCESS
// side module receives the return value indicates successful registration request, this time, the device can see the refresh oneNet green internet online.

Here Insert Picture Description
3. Module request and response OneNET internet Observer Discover request, complete subscription.
Here Insert Picture Description
+ MIPLOBSERVE: 0,87667,1,3303,0, -1 // OneNET internet objects / instances Observe request
AT + MIPLOBSERVERSP = 0,87667,1 // Observe request response module, which must correspond msgid = 87667 oneNet request internet Observe message issued msgid
the OK
+ MIPLEVENT: 0,21 // Observe module request success response
+ MIPLDISCOVER: 0,153204,3303 // oneNET internet objects Discover request
+ MIPLDISCOVER: 0,153204,3303
the aT + = 0,153204 MIPLDISCOVERRSP , 1,34, "5700; 5701; 5601; 5602; 5603; 5604; 5605" the OK
// Discover response to the request module, which must correspond OneNET msgid = 153204 Discover internet request message issued msgid. Response module
created when a request Discover 7 resources, each with a semi-colon ";" are separated, wherein the resource Resourceid 5700; 5701; 5601; 5602 ; 5603; 5604; 5605
subject to IPSO specification defines, please refer to the link:
HTTP: //www.openmobilealliance.org/wp/OMNA/LwM2M/LwM2MRegistry.html,
+ MIPLEVENT: 0,21
// returns the platform Discover result of the request to the module to complete the subscription. At this point the OneNET platforms can view the list of resources corresponding information object 3303.

4. The data exchange module and the internet OneNET
Here Insert Picture Description
+ MIPLREAD: 0,21459,3303,0,5700
// internet requests specified resource (referred to herein Resourceid 5700) a request to READ
AT + MIPLREADRSP = 0,21459,1,3303,0, 5700,4,5,20.22,0,0
// internet module READ request response, which must correspond OneNET msgid = 21459 internet READ request message issued msgid, 4 represents float data type. The resource module is returned to the value of 20.22 OneNET platform side.
The OK
+ MIPLEVENT: 0,21
// internet requests specified resource (referred to herein Resourceid 5605) of the EXECUTE
+ MIPLEXECUTE: 0,11671,3303,0,5605,5, "RESET
the AT + MIPLEXECUTERSP = 0,11671,2 / module execution of eXECUTE is requesting
the OK
+ MIPLEVENT: 0,21 // internet module receives the returned response result
the AT + = 0,77861,3303,0,5700,4,4,23.5,0,0 MIPLNOTIFY the OK
// module to a platform side reporting resource specified value, where the value of type float 810.56 reported to resourceid 5700, which must correspond msgid = 129584
front OneNET internet Observer request message issued msgid.
+ MIPLEVENT: 0,26
// module receives a response result returned platform, reported successful resource values, click the "Actions" button details, see report data stream resource values.
// platform module receives the response results returned, refreshed OneNET platform, you can see examples 0, the value of the resource attribute 5700 is updated to 20.2199999.
Here Insert Picture Description

AT + MIPLUPDATE = 0,3600,1 // module update registration information
+ MIPLEVENT: 0,11 // platform module receives a response result returned successfully update registration information

Here Insert Picture Description
5. Delete the object module

AT+MIPLDELOBJ=0,3303 OK

6. cancellation request module

AT+MIPLCLOSE=0 OK
+MIPLEVENT:0,15

7. Delete basic communications suite

AT+MIPLDELETE=0 OK

Published 45 original articles · won praise 1 · views 8282

Guess you like

Origin blog.csdn.net/AmazIOT/article/details/104756093