a minimal LwM2M client which performe the following operations:
Client registration
fromRegister
interfaceDiscover
fromDev Mang & Serv Enab
interfaceRead
fromDev Mang & Serv Enab
interfaceSend
fromInformation Reporting
interface
npm install
npm test
npx tsx src/index.ts
- Create a device in coiote using No-Sec security mode
- Update value of
deviceName
with the name of the device just created in Coiote. deviceName - Runs execution command
After the execution is initialized, the device send a register operation to the
LwM2M server and wait for the response. If the server accept the registratrion
request, the client open a socket connection to hear about Discover and Read
operation. After that, the device wait 10 seconds and onces the time is expired,
the device trigger a send operation to update the value of resource /3/0/0
.
This action is executed by the LwM2M client, in this case this device.
- host:
eu.iot.avsystem.cloud
- port:
5683
- method:
POST
- pathname:
/rd
- query:
ep=xxxx<=xxxx&lwm2m=xxxx&b=xxxx
, where:ep
is the name of the devicelt
is the lifetime of the opening conenctionlwm2m
is the version of the protocol suported by the deviceb
stands for biding mode
- payload:
</>;ct=110,112,11543;hb,<1/0>, <3/0>
, where:ct
stands for content type110
is the id of SenML JSON112
is the id of SenML CBOR11543
is the id of LwM2M JSON
If request is successful, it returns a port number.
This action is triggered by the server, in this case Coiote, and the client should listen from the port returned in the Client Registration operation in order to receive the request.
This action is triggered by the server, in this case Coiote, and the client should listen from the port returned in the Client Registration operation in order to receive the request.
- port: the one returned in Client Registration operation from Register interface
- content-format: 'application/vnd.oma.lwm2m+json'
- payload:
{ bn: '/3/0/', e: [ { n: '0/0', sv: 'Nordic' }, { n: '0/1', sv: '00010' }, { n: '0/2', sv: '00000',}, // .... ] }
This action is executed by the LwM2M client, in this case this device.
- host:
eu.iot.avsystem.cloud
- port:
5683
- method:
POST
- pathname:
/dp
- content-format:
application/senml+cbor
&application/senml+json
- payload:
// for application/senml+cbor'
81 a2 00 66 2f 33 2f 30 2f 30 03 6f 6e 65 77 4d 61 6e 75 66 61 63 74 75 72 65 72
// { 0: '/3/0/0', 3: 'newManufacturer' }
or
// for application/senml+json
[{ 'n': '/3/0/0', 'vs': newManufacturer }]
- Code: send.ts
- Documentation: Information Reporting Interface , Send Operation, pag 61