Chapter 2 Installation and Use of LWM2M Client
This chapter contains a description of various issues related to installation, setup, and usage of the LWM2M Client component.
Product Distribution
Azure RTOS LWM2M Client can be obtained from our public source code repository atĀ https://github.com/azure-rtos/netxduo/tree/master/addons/lwm2m. The package includes three source files, one include files, as follows.
nx_lwm2m_client.h Header file for the LWM2M Client
nx_lwm2m_client.c C Source files for LWM2M Client
demo_netx_lwm2m_client.c C Source file for LWM2M Client Demo
LWM2M Client Installation
The LWM2M Client is part of NetX Duo. Therefore, after cloning NetX Duo from the GitHub repository, LWM2M client source can be found at netxduo/addons/lwm2m.
Using LWM2M_Client
Using LWM2M Client is straightforward. Basically, the application code must include nx_lwm2m_client.h after it includes tx_api.h and nx_api.h, in order to use ThreadX and NetX. Once nx_lwm2m_client.h is included, the application code is then able to make the LWM2M Client function calls specified later in this guide. The application must also import the nx_lwm2m_client*.* files into the NetX library.
Configuration Options
There are several configuration options when building the LWM2M Client library and the application using the LWM2M Client. The configuration options can be defined in the application source, on the command line, unless otherwise specified.
| ConfigurationĀ Option | Description |
|---|---|
| NX_LWM2M_CLIENT_MTU | Specifies the maximum size of a CoAP message, including IP and UDP headers. The default value is 1280. |
| NX_LWM2M_CLIENT_SOCKET_TOS | Type of service required for the LwM2M UDP. By default, this value is defined as NX_IP_NORMAL to indicate normal IP packet service. |
| NX_LWM2M_CLIENT_SOCKET_TTL | Specifies the number of routers this packet can pass before it is discarded. The default value is set to 0x80. |
| NX_LWM2M_CLIENT_SOCKET_QUEUE_MAX | Specifies the number of maximum depths of receive queue. The default value is set to 4. |
| NX_LWM2M_CLIENT_MAX_COAP_URI_PATH | Specifies the number of maximum lengths of the CoAP Uri-Path option. The default value is set to 32. |
| NX_LWM2M_CLIENT_MAX_DEVICE_ERRORS | Specifies the maximum number of error codes stored by the Device Object. The default value is 8. |
| NX_LWM2M_CLIENT_MAX_SECURITY_INSTANCES | Specifies the maximum number of Security Object Instances. The default value is 2 for supporting a Bootstrap Server and a standard Server. |
| NX_LWM2M_CLIENT_MAX_SERVER_INSTANCES | Specifies the maximum number of Server Object Instances. The default value is 1 for supporting a single standard Server. |
| NX_LWM2M_CLIENT_MAX_ACCESS_CONTROL_INSTANCES | Specifies the maximum number of Access Control Instances. The default value is 0, which disables access control. If the application supports more than one LWM2M Server, the maximum number of Access Control Instances must be set to the maximum number of Object Instances that the LWM2M Client will support, as one Access Control Instance must be created for each Object Instance (except for the Security Object Instances). |
| NX_LWM2M_CLIENT_MAX_ACCESS_CONTROL_ACLS | Specifies the maximum number of ACL resources per Access Control Instance. The default value is 4. |
| NX_LWM2M_CLIENT_MAX_NOTIFICATIONS | Specifies the maximum number of notifications that the LWM2M Client will support. A LWM2M Server can set notifications on Objects, Object Instances, and Resources. The default value is 8. |
| NX_LWM2M_CLIENT_MAX_RESOURCES | Specifies the maximum number of Resources per Object. The default value is 32. |
| NX_LWM2M_CLIENT_MAX_MULTIPLE_RESOURCES | Specifies the maximum number of Resources instances for multiple resource. The default value is 8. |
| NX_LWM2M_CLIENT_BOOTSTRAP_IDLE_TIMER | Specifies the maximum time to wait for bootstrap server requests when the bootstrap session is initiated before aborting the session. The default value is 60 seconds. |
| NX_LWM2M_CLIENT_DTLS_START_TIMEOUT | Specifies the maximum time to wait for DTLS handshake completion. The default value is 30 seconds. |
| NX_LWM2M_CLIENT_DTLS_END_TIMEOUT | Specifies the maximum time to wait for DTLS shutdown completion. The default value is 5 seconds. |
| NX_LWM2M_CLIENT_SECURITY_MAX_SERVER_URI | Specifies the maximum length of a server URI, including terminating null character. The default value is 128. |
| NX_LWM2M_CLIENT_SECURITY_MAX_PUBLIC_KEY_OR_IDENTITY | Specifies the maximum length of the public key or identity for DTLS. The default value is 128. |
| NX_LWM2M_CLIENT_SECURITY_MAX_SERVER_PUBLIC_KEY | Specifies the maximum length of the server public key for DTLS. The default value is 128. |
| NX_LWM2M_CLIENT_SECURITY_MAX_SECRET_KEY | Specifies the maximum length of the secret key for DTLS. The default value is 128. |
| NX_LWM2M_CLIENT_HOLD_OFF | Specifies the number of seconds to wait before initiating bootstrap. The default value is 1 second. |
| NX_LWM2M_CLIENT_LIFE_TIME | Specifies the number of seconds for the registration lifetime. The default value is 600 seconds. |