Chapter 2 - Installation and use of Azure RTOS NetX LWM2M
This chapter contains a description of various issues related to installation, setup, and usage of the Azure RTOS NetX LWM2M component.
Product Distribution
NetX LWM2M is available at https://github.com/azure-rtos/netx. The package includes three source files, one include files, and a PDF file that contains this document, as follows:
nx_lwm2m_client.h: Header file for the NetX LWM2M Client
nx_lwm2m_*.c/h: C/H Source files for NetX LWM2M
demo_netx_lwm2m_client.c: C Source file for NetX LWM2M Client Demo
NetX_LWM2M_User_Guide.pdf: PDF description of NetX LWM2M product
NetX LWM2M Installation
In order to use NetX LWM2M, the entire distribution mentioned previously should be copied to the same directory where NetX is installed. For example, if NetX is installed in the directory "\threadx\arm7\green" then the nx_lwm2m*.* files should be copied into this directory.
Using NetX LWM2M
Using NetX LWM2M is easy. 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 NetX LWM2M function calls specified later in this guide. The application must also import the nx_lwm2m*.* 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.
NX_LWM2M_CLIENT_DISABLE_ERROR_CHECKING
Defined, removes the basic LWM2M Client error checking API and improves performance. API return codes not affected by disabling error checking are listed in bold typeface in the API definition.
NX_LWM2M_CLIENT_DISABLE_FLOAT
Defined, removes the support of floating point numbers values. When disabled the LWM2M Client cannot support Resources with Float data type.
NX_LWM2M_CLIENT_DISABLE_FLOAT64
Defined, removes the support of 64-bit floating point numbers values. The LWM2M Client can still receive TLV messages containing 64-bit floating numbers, but the values are converted to 32-bit floating point for processing.
NX_LWM2M_CLIENT_PRIORITY
Specifies the priority of the LWM2M Client thread. By default, this value is defined as 16 to specify priority 16.
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_SERVER_URI
Specifies the maximum length of a server URI, including terminating nil character. The default value is 128.
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_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.