XDK API  3.6.0
Documentation
Data Structures | Macros | Typedefs | Enumerations | Functions
Serval_Lwm2m.h File Reference

Interface to experimental lightweight M2M support.This module provides the interface to the implementation of the lightweight M2M protocol specified by the Open Mobile Alliance for machine to machine communication. More...

#include <Serval_Policy.h>
#include <Serval_Defines.h>
#include <Serval_Types.h>
#include <Serval_Ip.h>
#include <Serval_Msg.h>
#include <Serval_Coap.h>
#include <Serval_Security.h>
#include <Serval_Url.h>
#include <Serval_CoapServer.h>
+ Include dependency graph for Serval_Lwm2m.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  Lwm2m_URI_Path_S
 
struct  Lwm2mBootstrapServer_S
 
struct  Lwm2mDevice_S
 
struct  Lwm2mObjectInstance_S
 
struct  Lwm2mResource_S
 
struct  Lwm2mSecurityInfo_S
 
struct  Lwm2mServer_S
 

Macros

#define LWM2M_ACCESS_CONTROL_OWNER   0x3F
 
#define LWM2M_BOOL(boolean)   {.b = boolean}, (uint8_t) LWM2M_RESOURCE_BOOL
 
#define LWM2M_BOOTSTRAP_TIMEOUT   COAP_ACK_TIMEOUT
 
#define LWM2M_CONFIRM_NOTIFY   0x20
 
#define LWM2M_CREATE_ALLOWED   0x10
 
#define LWM2M_DELETE_ALLOWED   0x08
 
#define LWM2M_DYNAMIC(dyn)   {.dynamic = dyn}, (uint8_t) LWM2M_RESOURCE_DYNAMIC
 
#define LWM2M_DYNAMIC_ARRAY(dyn)   {.dynamic = dyn}, (uint8_t) LWM2M_RESOURCE_DYNAMIC_ARRAY
 
#define LWM2M_DYNAMIC_BULK(dyn)   {.dynamic = dyn}, (uint8_t) LWM2M_RESOURCE_DYNAMIC_BULK | LWM2M_READ_ONLY
 
#define LWM2M_EXECUTE_ALLOWED   0x04
 
#define LWM2M_FLOAT(floating)   {.f = floating}, (uint8_t) LWM2M_RESOURCE_FLOAT
 
#define LWM2M_FULL_ACCESS   0x1F
 
#define LWM2M_FUNCTION(function)   {.func = function}, (uint8_t) LWM2M_RESOURCE_FUNCTION | LWM2M_NOT_WRITABLE | LWM2M_NOT_READABLE
 
#define LWM2M_INACTIVE_INSTANCE   0xFFFE
 
#define LWM2M_INACTIVE_RESOURCE_INSTANCE   0xFFFE
 
#define LWM2M_INTEGER(integer)   {.i = integer}, (uint8_t) LWM2M_RESOURCE_INTEGER
 
#define LWM2M_INVISIBLE_INSTANCE   0xFFFF
 
#define LWM2M_IP_ADDRESS_MAX_LENGTH   30
 
#define LWM2M_MAX_NUMBER_SERVERS   4
 
#define LWM2M_NOT_READABLE   0x40
 
#define LWM2M_NOT_WRITABLE   0x80
 
#define LWM2M_OBJECT_INSTANCE_COUNT(objectInstances)   sizeof(objectInstances) / sizeof(Lwm2mObjectInstance_T)
 
#define LWM2M_QUEUE_MODE_TIMEOUT   COAP_ACK_TIMEOUT
 
#define LWM2M_READ_ALLOWED   0x01
 
#define LWM2M_READ_ONLY   LWM2M_NOT_WRITABLE
 
#define LWM2M_REJECT_ANONYMOUS_DTLS_SERVERS   0
 
#define LWM2M_RESOURCE_AFFIX_MASK   0xE0
 
#define LWM2M_RESOURCE_TYPE_MASK   0x0F
 
#define LWM2M_RESOURCES(resources)   &resources, sizeof(resources)/sizeof(Lwm2mResource_T)
 
#define LWM2M_SINGLE_INSTANCE   0
 
#define LWM2M_SINGLE_RESOURCE_INSTANCE   0xFFFF
 
#define LWM2M_STRING_RO(string)   {.s = string}, (uint8_t) LWM2M_RESOURCE_STRING | LWM2M_READ_ONLY
 
#define LWM2M_TIME(time)   {.i = time}, (uint8_t) LWM2M_RESOURCE_TIME
 
#define LWM2M_WRITE_ALLOWED   0x02
 
#define LWM2M_WRITE_ONLY   LWM2M_NOT_READABLE
 
#define SERVAL_LWM2M_SECURITY_INFO_MAX_LENGTH   30
 

Typedefs

typedef void(* Lwm2m_ApplicationCallback_T )(Lwm2m_Event_Type_T eventType, Lwm2m_URI_Path_T *path, retcode_t status)
 Callback function triggered after an event occurred in the stack that need to be notified to the application. This callback function is used for registration for example or resources changes. More...
 
typedef enum Lwm2m_Binding_E Lwm2m_Binding_T
 
typedef retcode_t(* Lwm2m_Dynamic_Resource_T )(Lwm2mSerializer_T *serializer_ptr, Lwm2mParser_T *parser_ptr)
 
typedef enum Lwm2m_Event_Type_E Lwm2m_Event_Type_T
 
typedef enum
Lwm2m_Notification_Resumption_e 
Lwm2m_Notification_Resumption_t
 
typedef retcode_t(* Lwm2m_Resource_Function_T )(Lwm2mSerializer_T *serializer_ptr, Lwm2mParser_T *parser_ptr)
 
typedef enum Lwm2m_Resource_Type_E Lwm2m_Resource_Type_T
 
typedef struct Lwm2m_URI_Path_S Lwm2m_URI_Path_T
 
typedef struct
Lwm2mBootstrapServer_S 
Lwm2mBootstrapServer_T
 
typedef struct Lwm2mDevice_S Lwm2mDevice_T
 
typedef struct
Lwm2mObjectInstance_S 
Lwm2mObjectInstance_T
 
typedef struct Lwm2mParser_S Lwm2mParser_T
 
typedef struct Lwm2mResource_S Lwm2mResource_T
 
typedef struct Lwm2mSecurityInfo_S Lwm2mSecurityInfo_T
 
typedef struct Lwm2mSerializer_S Lwm2mSerializer_T
 
typedef struct Lwm2mServer_S Lwm2mServer_T
 

Enumerations

enum  Lwm2m_Binding_E
 
enum  Lwm2m_Event_Type_E
 
enum  Lwm2m_Notification_Resumption_e
 
enum  Lwm2m_Resource_Type_E
 

Functions

Lwm2mServer_TLwm2m_getServer (uint8_t serverIndex)
 Get a reference to a particular server. The application can then set and access to the server informations. More...
 
retcode_t Lwm2m_initialize (Lwm2mDevice_T *device)
 Initialize the Lightweight M2M module for a device described by device. More...
 
void Lwm2m_setNumberOfServers (uint8_t numberOfServers)
 Sets the number of instanciated servers. This function should be called after the application set servers informations to tell the stack about the number of instanciated servers. More...
 
retcode_t Lwm2m_start (Ip_Port_T port, Lwm2m_ApplicationCallback_T applicationCallback)
 Start the Lightweight M2M module. More...
 
Lwm2mBootstrapServer_TLwm2mBootstrap_getBootstrapServer (void)
 Gets a reference to the bootstrap server. The application can then set the bootstrap informations. More...
 
retcode_t Lwm2mBootstrap_request (void)
 Request Bootstrap to a bootstrap server for the LwM2M device. More...
 
retcode_t Lwm2mParser_convertStringToInt (const char *string, const uint32_t length, int32_t *value)
 Converts a parsed string to an integer. Use this function when obtaining string data from the parser that you want to convert to at integer value. More...
 
retcode_t Lwm2mParser_getBool (Lwm2mParser_T *parser_ptr, bool *value)
 Parses a bool from an incoming lwm2m message. The function takes care to handle TLV decoding if necessary. More...
 
retcode_t Lwm2mParser_getFloat (Lwm2mParser_T *parser_ptr, float *value)
 Parses a float from an incoming lwm2m message. The function takes care to handle TLV decoding if necessary. More...
 
retcode_t Lwm2mParser_getInt (Lwm2mParser_T *parser_ptr, int32_t *value)
 Parses an integer from an incoming lwm2m message. The function takes care to handle TLV decoding if necessary. More...
 
retcode_t Lwm2mParser_getOpaque (Lwm2mParser_T *parser_ptr, const uint8_t **value, uint32_t *length)
 Parses opaque data from an incoming lwm2m message. The function takes care to handle TLV decoding if necessary. More...
 
retcode_t Lwm2mParser_getResourceInstanceId (Lwm2mParser_T *parser_ptr, uint16_t *id)
 This is used to get the resource instance Id from the Tlv header before parsing the corresponding resource instance. More...
 
retcode_t Lwm2mParser_getString (Lwm2mParser_T *parser_ptr, StringDescr_T *strDescr)
 Parses a string from an incoming lwm2m message. The function takes care to handle TLV decoding if necessary. More...
 
retcode_t Lwm2mParser_getTime (Lwm2mParser_T *parser_ptr, int32_t *value)
 Parses a timestamp from an incoming lwm2m message. The function takes care to handle TLV decoding if necessary. More...
 
retcode_t Lwm2mParser_parseNextResourceInstance (Lwm2mParser_T *parser_ptr)
 This is used to parse the next resource instance. This function get the next resource instance in the tlv encoded payload to be able to parsing using Lwm2mParser_get functions. More...
 
retcode_t Lwm2mParser_startParsingResourceArray (Lwm2mParser_T *parser_ptr)
 This is used to start the parsing of a resource array. This function prepares the parser_ptr to parse resource arrays. More...
 
retcode_t Lwm2mRegistration_closeSecureConn (uint8_t serverIndex)
 close and disconnect an existing secure COAP connection. More...
 
retcode_t Lwm2mRegistration_deRegister (uint8_t serverIndex)
 Perform a deregistration of an LwM2M device with an LwM2M server. More...
 
retcode_t Lwm2mRegistration_deRegisterFromAllServers (void)
 Perform a deregistration of an LwM2M device with all the LwM2M servers. More...
 
retcode_t Lwm2mRegistration_register (uint8_t serverIndex)
 Register a LwM2M device with an LwM2M server. More...
 
retcode_t Lwm2mRegistration_registerToAllServers (void)
 Register a LwM2M device with all the LwM2M servers. More...
 
retcode_t Lwm2mRegistration_update (uint8_t serverIndex)
 Perform a registration update of an LwM2M device with an LwM2M server. More...
 
retcode_t Lwm2mRegistration_updateToAllServers (void)
 Perform a registration update of an LwM2M device with all the LwM2M servers. More...
 
retcode_t Lwm2mReporting_multipleResourcesChanged (Lwm2m_URI_Path_T *objectInstanceUripath, uint8_t count,...)
 Notify the stack that a resource has changed. This will cause the stack to notify any pending observers about the changed resource. More...
 
retcode_t Lwm2mReporting_resourceChanged (Lwm2m_URI_Path_T *uripath)
 Notify the stack that a resource has changed. This will cause the stack to notify any pending observers about the changed resource. More...
 
void Lwm2mReporting_resumeNotifications (uint8_t serverIndex, Lwm2m_Notification_Resumption_t mode)
 Resume sending notifications to a server. More...
 
void Lwm2mReporting_suspendNotifications (uint8_t serverIndex)
 Suspend sending of notifications to the given server. More...
 
retcode_t Lwm2mSecurity_defaultCallback (SecurityToken_T token, SecurityData_T *tokenData)
 Callback that can be provided to Security_setCallback to take over security token handling. More...
 
static void Lwm2mSerializer_checkIfDone (Lwm2mSerializer_T *serializer_ptr, uint32_t availableSize)
 Check if resource is serialized completely and set the more flag if required. More...
 
retcode_t Lwm2mSerializer_endSerializingResourceArray (Lwm2mSerializer_T *serializer_ptr)
 This is used to end the parsing of a resource array. The function takes care of ending the array by writing the length of the array. More...
 
uint32_t Lwm2mSerializer_getBlockOffset (Lwm2mSerializer_T *serializer_ptr)
 Get the offset of the current block to be serialized. More...
 
uint16_t Lwm2mSerializer_getBlockSize (Lwm2mSerializer_T *serializer_ptr)
 Get the size of the current block to be serialized. More...
 
static uint16_t Lwm2mSerializer_getSerializableSize (Lwm2mSerializer_T *serializer_ptr, uint32_t availableSize)
 Get the chunk size of the resource that is to be serialized. More...
 
uint8_t Lwm2mSerializer_getServerIndex (Lwm2mSerializer_T *serializer_ptr)
 Get the server index from which the LWM2M request came from. More...
 
void Lwm2mSerializer_haveMoreData (Lwm2mSerializer_T *serializer_ptr)
 Indicate that more data needs to be transmitted for the resource to be fully serialized. More...
 
retcode_t Lwm2mSerializer_serializeBool (Lwm2mSerializer_T *serializer_ptr, bool value)
 Serializes a boolean to an outgoing lwm2m message. The function takes care to handle TLV encoding if necessary. More...
 
retcode_t Lwm2mSerializer_serializeFloat (Lwm2mSerializer_T *serializer_ptr, float value)
 Serializes an integer to an outgoing lwm2m message. The function takes care to handle TLV encoding if necessary. More...
 
retcode_t Lwm2mSerializer_serializeInt (Lwm2mSerializer_T *serializer_ptr, int32_t value)
 Serializes an integer to an outgoing lwm2m message. The function takes care to handle TLV encoding if necessary. More...
 
retcode_t Lwm2mSerializer_serializeOpaque (Lwm2mSerializer_T *serializer_ptr, uint8_t *value, uint32_t length)
 Serializes an opaque data pointer to an outgoing lwm2m message. The function takes care to handle TLV encoding if necessary. More...
 
static retcode_t Lwm2mSerializer_serializeOpaqueBulk (Lwm2mSerializer_T *serializer_ptr, uint8_t *data, uint32_t availableSize)
 Serialize a chunk of an opaque resource. More...
 
retcode_t Lwm2mSerializer_serializeString (Lwm2mSerializer_T *serializer_ptr, StringDescr_T *strDescr)
 Serializes a string to an outgoing lwm2m message. The function takes care to handle TLV encoding if necessary. More...
 
retcode_t Lwm2mSerializer_serializeTime (Lwm2mSerializer_T *serializer_ptr, uint32_t value)
 Serializes a timestamp (integer) to an outgoing lwm2m message. The function takes care to handle TLV encoding if necessary. More...
 
retcode_t Lwm2mSerializer_setResourceInstanceId (Lwm2mSerializer_T *serializer_ptr, uint16_t instanceId)
 This is used to set the resource instance Id before serializing the corresponding resource instance. More...
 
retcode_t Lwm2mSerializer_startSerializingResourceArray (Lwm2mSerializer_T *serializer_ptr)
 This is used to start the serialization of a resource array. This function prepares the serializer_ptr to serialize resource arrays. More...
 

Detailed Description

Warning
Please note that the specification of the lightweight M2M protocol has not been finalized, yet. Therefore, the current implementation should be treated as a technology preview and it is subject to change as required to meet the specification. This may include changes to this API!
Since
1.4

Macro Definition Documentation

#define LWM2M_ACCESS_CONTROL_OWNER   0x3F

macro used to determine the owner of the access control object

#define LWM2M_BOOL (   boolean)    {.b = boolean}, (uint8_t) LWM2M_RESOURCE_BOOL

Helper macro to initialize a bool resource

#define LWM2M_BOOTSTRAP_TIMEOUT   COAP_ACK_TIMEOUT

BOOTSTRAP_TIMEOUT in seconds (default value 2)

#define LWM2M_CONFIRM_NOTIFY   0x20

Mark the resource to be delivered via confirmable messages

#define LWM2M_CREATE_ALLOWED   0x10
#define LWM2M_DELETE_ALLOWED   0x08
#define LWM2M_DYNAMIC (   dyn)    {.dynamic = dyn}, (uint8_t) LWM2M_RESOURCE_DYNAMIC

Helper macro to initialize a dynamic resource

#define LWM2M_DYNAMIC_ARRAY (   dyn)    {.dynamic = dyn}, (uint8_t) LWM2M_RESOURCE_DYNAMIC_ARRAY

Helper macro to initialize a dynamic resource as an array

#define LWM2M_DYNAMIC_BULK (   dyn)    {.dynamic = dyn}, (uint8_t) LWM2M_RESOURCE_DYNAMIC_BULK | LWM2M_READ_ONLY

Helper macro to initialize a bulk resource

#define LWM2M_EXECUTE_ALLOWED   0x04
#define LWM2M_FLOAT (   floating)    {.f = floating}, (uint8_t) LWM2M_RESOURCE_FLOAT

Helper macro to initialize a floating point resource

#define LWM2M_FULL_ACCESS   0x1F
#define LWM2M_FUNCTION (   function)    {.func = function}, (uint8_t) LWM2M_RESOURCE_FUNCTION | LWM2M_NOT_WRITABLE | LWM2M_NOT_READABLE

Helper macro to initialize a function resource

#define LWM2M_INACTIVE_INSTANCE   0xFFFE

Used to define an object instance as inactive / not allocated

#define LWM2M_INACTIVE_RESOURCE_INSTANCE   0xFFFE

Used to define a non instanced multiple resource

#define LWM2M_INTEGER (   integer)    {.i = integer}, (uint8_t) LWM2M_RESOURCE_INTEGER

Helper macro to initialize an integer resource

#define LWM2M_INVISIBLE_INSTANCE   0xFFFF

Used to define an object instance as invisible (it won't be considered for discovery) This is mainly useful for testing

#define LWM2M_IP_ADDRESS_MAX_LENGTH   30

Maximum length of the name that the device registers with Maximum length of the address of a (bootstrap) server (coap(s)://xxx.xxx.xxx.xxx:xxxxx)

#define LWM2M_MAX_NUMBER_SERVERS   4

Maximum number of servers supported by LwM2M

#define LWM2M_NOT_READABLE   0x40

Mark the resource type as not readable

#define LWM2M_NOT_WRITABLE   0x80

Mark the resource type as not writable

#define LWM2M_OBJECT_INSTANCE_COUNT (   objectInstances)    sizeof(objectInstances) / sizeof(Lwm2mObjectInstance_T)

Helper macro to set the count of objects in the Lwm2m device

#define LWM2M_QUEUE_MODE_TIMEOUT   COAP_ACK_TIMEOUT

QUEUE_MODE_TIMEOUT in seconds (default value 2)

#define LWM2M_READ_ALLOWED   0x01

Macros used to set the access right for servers. Read access means right for Read, Observe, Write Attributes and Discover

#define LWM2M_READ_ONLY   LWM2M_NOT_WRITABLE

Convenience value, same as not writable

#define LWM2M_REJECT_ANONYMOUS_DTLS_SERVERS   0

Enable to reject any server that does not provide a DTLS Server hint. Only applicable with DTLS enabled and when using LWm2mSecurity_callback as the security callback

#define LWM2M_RESOURCE_AFFIX_MASK   0xE0

Mask for the bits that contain affixes

#define LWM2M_RESOURCE_TYPE_MASK   0x0F

Mask for the bits that contain the raw type

#define LWM2M_RESOURCES (   resources)    &resources, sizeof(resources)/sizeof(Lwm2mResource_T)

Helper macro to set the count of resources in an Lwm2m object

#define LWM2M_SINGLE_INSTANCE   0

Macro to point out the semantic difference between a non-multiple object and the instance 0

#define LWM2M_SINGLE_RESOURCE_INSTANCE   0xFFFF

Used to define a resource as single

#define LWM2M_STRING_RO (   string)    {.s = string}, (uint8_t) LWM2M_RESOURCE_STRING | LWM2M_READ_ONLY

Helper macro to initialize a string resource

#define LWM2M_TIME (   time)    {.i = time}, (uint8_t) LWM2M_RESOURCE_TIME

Helper macro to initialize a time resource

#define LWM2M_WRITE_ALLOWED   0x02
#define LWM2M_WRITE_ONLY   LWM2M_NOT_READABLE

Convenience value, same as not readable

#define SERVAL_LWM2M_SECURITY_INFO_MAX_LENGTH   30

Macro used to set a maximum for the security informations such as identity length or PSK length

Typedef Documentation

typedef void(* Lwm2m_ApplicationCallback_T)(Lwm2m_Event_Type_T eventType, Lwm2m_URI_Path_T *path, retcode_t status)
Parameters
[in]eventtype to specify which event we are notifying the application about (registration success or resources changed)
[in]structurecontaining the uri path of the target
[in]statuswill tell the application about the kind of error that occurred

Type definition for the lightweight M2M communication binding.

See also
Lwm2m_Binding_E
typedef retcode_t(* Lwm2m_Dynamic_Resource_T)(Lwm2mSerializer_T *serializer_ptr, Lwm2mParser_T *parser_ptr)

Type definition for the event type.

See also
Lwm2m_Event_Type_E
typedef retcode_t(* Lwm2m_Resource_Function_T)(Lwm2mSerializer_T *serializer_ptr, Lwm2mParser_T *parser_ptr)

Type definition for the resource type.

See also
Lwm2m_Resource_Type_E

Type definition for the uri path.

See also
Lwm2m_URI_Path_S
typedef struct Lwm2mDevice_S Lwm2mDevice_T

Type definition for the lightweight M2M device.

See also
Lwm2mDevice_S

Type definition for the lightweight M2M object.

See also
Lwm2mObject_S
typedef struct Lwm2mParser_S Lwm2mParser_T

Opaque type to use for message parsing. Used only to pass into the parsing API

typedef struct Lwm2mSerializer_S Lwm2mSerializer_T

Opaque type to use for message serialization. Used only to pass into the serialization API

typedef struct Lwm2mServer_S Lwm2mServer_T

Enumeration Type Documentation

Enumeration of different communication modes available to the lwm2m device See section 5.2.1.1 "Behavior with Current Transport Binding and Mode" of the Lightweight M2M technical specification.

Enumerator
LWM2M_BINDING_UNDEFINED 
LWM2M_BINDING_QUEUED 
UDP 

The device is reachable via UDP (default)

SMS 

The device is reachable via SMS

UDP_QUEUED 

The device is reachable via UDP only after having sent an update to the server

SMS_QUEUED 

The device is reachable via SMS only after having sent an update to the server

UDP_AND_SMS 

The device is reachable via either UDP or SMS

UDP_QUEUED_AND_SMS 

The device is reachable via either UDP after having sent an update or via SMS

Enumeration of event types that the Lwm2m could notify the application about.

Enumerator
LWM2M_EVENT_TYPE_BOOTSTRAP 

Bootstrapping

LWM2M_EVENT_TYPE_REGISTRATION 

Registration

LWM2M_EVENT_TYPE_REGISTRATION_UPDATE 

Registration update

LWM2M_EVENT_TYPE_DEREGISTRATION 

Deregistration

LWM2M_EVENT_TYPE_WRITE 

Write operation executed

LWM2M_EVENT_TYPE_OBJECT_CREATED 

Create operation executed

LWM2M_EVENT_TYPE_OBJECT_DELETED 

Delete operation executed

LWM2M_EVENT_TYPE_NEW_OBSERVER 

Observe operation executed

LWM2M_EVENT_TYPE_NOTIFICATION 

Notification operation executed

LWM2M_EVENT_TYPE_OBSERVATION_CANCELED 

Cancel observation executed

LWM2M_EVENT_TYPE_NEW_SERVER_ADDED 

Cancel observation executed

Enumerator
LWM2M_DROP_NOTIFICATIONS 
LWM2M_SEND_NOTIFICATIONS 

Enumeration of resource types. Note that read-only refers to the access from the network, not internal access to the resources.

The affixes LWM2M_READ_ONLY and LWM2M_WRITE_ONLY can be combined with the helper macros for resource initialization, like this:

Enumerator
LWM2M_RESOURCE_STRING 

Resource is a (read-only) String. Use 'dynamic' for strings writable by the server

LWM2M_RESOURCE_INTEGER 

Resource is an Integer

LWM2M_RESOURCE_FLOAT 

Resource is a floating point number

LWM2M_RESOURCE_BOOL 

Resource is a boolean

LWM2M_RESOURCE_TIME 

Resource is a time value

LWM2M_RESOURCE_DYNAMIC 

Resource is dynamic, i.e. serialized with a callback

LWM2M_RESOURCE_DYNAMIC_ARRAY 

Resource is dynamic array, i.e. serialized with a callback

LWM2M_RESOURCE_FUNCTION 

Resource is a function that can be executed

LWM2M_RESOURCE_DYNAMIC_BULK 

Resource that contains a large data that requires blockwise transfer

Function Documentation

Lwm2mServer_T* Lwm2m_getServer ( uint8_t  serverIndex)
Parameters
[in]serverIndexthe index of the server in the array of servers
Returns
Lwm2mServer: pointer to the LwM2M server of serverIndex-
retcode_t Lwm2m_initialize ( Lwm2mDevice_T device)
Parameters
[in]devicestructure containing the information about the device
[in]bootstrapServerstructure containing information about the bootstrap server (in case of factory bootstrap the bootstrapServer argument must be NULL)
[in]serversstructure containing information about the servers (in case of client initiate bootstrap the servers should be NULL)

Initializes the LwM2M module. Device is a pointer to an initialized structure which contains the relevant information about the device.

void Lwm2m_setNumberOfServers ( uint8_t  numberOfServers)
Parameters
[in]numberOfServersnumber of active servers (this MUST be less than maximum number of servers)
retcode_t Lwm2m_start ( Ip_Port_T  port,
Lwm2m_ApplicationCallback_T  applicationCallback 
)
Deprecated:

Starts the LwM2M service. Depending on the value of the secure flag in the Lwm2mDevice, this is equivalent to Lwm2m_startService(SERVAL_SCHEME_COAP, ...) or Lwm2m_startService(SERVAL_SCHEME_COAPS, ...) for the secure flag being false and true, respectively.

Parameters
[in]portThe coap server port, i.e. the local port used by this device
[in]applicationCallback,acallback used to tell the application about events (like write, registration, bootstrapping)

Starts a CoAP server on the given port.

Lwm2mBootstrapServer_T* Lwm2mBootstrap_getBootstrapServer ( void  )
Returns
Lwm2mBootstrapServer: pointer to the LwM2M bootstrap server.
retcode_t Lwm2mBootstrap_request ( void  )

Note: This is preliminary API

Returns
RC_OK on success
retcode_t Lwm2mParser_convertStringToInt ( const char *  string,
const uint32_t  length,
int32_t *  value 
)

It rejects white space or any other non-digit characters.

The key difference to existing standard functions is that the string provided by the parser is not terminated by '\0'! In memory, the string data is followed by the remaining payload in order to prevent copying the string data. Thus, the following TLV header may resemble an ASCII digit (e.g. object instance with 16-bit ID and 16-bit length will encode to 0x30 == '0')

Parameters
[in]stringthe string data obtained from Lwm2mParser_getString()
[in]lengththe length of the string data obtained from Lwm2mParser_getString()
[out]valuethe converted string value
Returns
RC_OK on success RC_LWM2M_PARSING_ERROR if the string could not be converted
retcode_t Lwm2mParser_getBool ( Lwm2mParser_T parser_ptr,
bool *  value 
)
Parameters
[in]parser_ptrPointer to the parser structure (typically obtained in the callback)
[out]valueof the bool that was parsed
Returns
RC_OK on success RC_LWM2M_PARSING_ERROR if the data could not be parsed properly

+ Here is the caller graph for this function:

retcode_t Lwm2mParser_getFloat ( Lwm2mParser_T parser_ptr,
float *  value 
)
Parameters
[in]parser_ptrPointer to the parser structure (typically obtained in the callback)
[out]valueof the float that was parsed
Returns
RC_OK on success RC_LWM2M_PARSING_ERROR if the data could not be parsed properly
retcode_t Lwm2mParser_getInt ( Lwm2mParser_T parser_ptr,
int32_t *  value 
)
Parameters
[in]parser_ptrPointer to the parser structure (typically obtained in the callback)
[out]valueof the integer that was parsed
Returns
RC_OK on success RC_LWM2M_PARSING_ERROR if the data could not be parsed properly

+ Here is the caller graph for this function:

retcode_t Lwm2mParser_getOpaque ( Lwm2mParser_T parser_ptr,
const uint8_t **  value,
uint32_t *  length 
)
Parameters
[in]parser_ptrPointer to the parser structure (typically obtained in the callback)
[out]valuethe data that was parsed
[out]lengththe length of the data that was parsed
Returns
RC_OK on success RC_LWM2M_PARSING_ERROR if the data could not be parsed properly
retcode_t Lwm2mParser_getResourceInstanceId ( Lwm2mParser_T parser_ptr,
uint16_t *  id 
)
Parameters
[in]parser_ptrPointer to the parser structure (typically obtained in the callback)
Returns
RC_OK on success RC_LWM2M_SERIALIZATION_ERROR if the next element is not a resource instance
retcode_t Lwm2mParser_getString ( Lwm2mParser_T parser_ptr,
StringDescr_T strDescr 
)

Note that the string is not guaranteed to be terminated by '\0'. In case of TLV encoded payload, it is followed by the remaining payload of the message.

Parameters
[in]parser_ptrPointer to the parser structure (typically obtained in the callback)
[out]strDescriptorcontains the the string that was parsed
Returns
RC_OK on success RC_LWM2M_PARSING_ERROR if the data could not be parsed properly

+ Here is the caller graph for this function:

retcode_t Lwm2mParser_getTime ( Lwm2mParser_T parser_ptr,
int32_t *  value 
)
Parameters
[in]parser_ptrPointer to the parser structure (typically obtained in the callback)
[out]valueof the timestamp that was parsed
Returns
RC_OK on success RC_LWM2M_PARSING_ERROR if the data could not be parsed properly

+ Here is the caller graph for this function:

retcode_t Lwm2mParser_parseNextResourceInstance ( Lwm2mParser_T parser_ptr)

Function to get the next resource instance in the tlv encoded payload

Parameters
[in]parser_ptrPointer to the parser structure (typically obtained in the callback)
Returns
RC_OK on success RC_LWM2M_PARSER_END if we reached the end of the resource array
retcode_t Lwm2mParser_startParsingResourceArray ( Lwm2mParser_T parser_ptr)
Parameters
[in]parser_ptrPointer to the parser structure (typically obtained in the callback)
Returns
RC_OK on success RC_LWM2M_PARSING_ERROR if the data is not a resource array
retcode_t Lwm2mRegistration_closeSecureConn ( uint8_t  serverIndex)

Note: This is preliminary API

Parameters
[in]serverIndexthe index of the server(in the array of server) to close the secure connection
Returns
RC_OK on success (or if connection is not secure),
RC_COAP_SECURE_CONNECTION_ERROR on failure.
retcode_t Lwm2mRegistration_deRegister ( uint8_t  serverIndex)

A successful registration with Lwm2m_register MUST have been performed.

Note: This is preliminary API

Parameters
[in]serverIndexthe index of the server(in the array of server) to deregister from
Returns
RC_OK on success
retcode_t Lwm2mRegistration_deRegisterFromAllServers ( void  )

A successful registration with Lwm2m_register MUST have been performed.

Note: This is preliminary API

Returns
RC_OK on success
retcode_t Lwm2mRegistration_register ( uint8_t  serverIndex)

Note: This is preliminary API

Parameters
[in]serverIndexthe index of the server(in the array of server) to register to
Returns
RC_OK on success
retcode_t Lwm2mRegistration_registerToAllServers ( void  )

Note: This is preliminary API

Returns
RC_OK on success
retcode_t Lwm2mRegistration_update ( uint8_t  serverIndex)

A successful registration with Lwm2m_register MUST have been performed.

Note: This is preliminary API

Parameters
[in]serverIndexthe index of the server(in the array of server) to update to
Returns
RC_OK on success
retcode_t Lwm2mRegistration_updateToAllServers ( void  )

A successful registration with Lwm2m_register MUST have been performed.

Note: This is preliminary API

Returns
RC_OK on success
retcode_t Lwm2mReporting_multipleResourcesChanged ( Lwm2m_URI_Path_T objectInstanceUripath,
uint8_t  count,
  ... 
)
Parameters
[in]uripathThe uripath of the object instance that has changed
[in]countThe number of resources of the object instance that have changed
[in]resourceIndexThe indexes of the resources that have changed
Returns
RC_OK on success

+ Here is the caller graph for this function:

retcode_t Lwm2mReporting_resourceChanged ( Lwm2m_URI_Path_T uripath)
Parameters
[in]uripathThe uripath of the resource that has changed
Returns
RC_OK on success

+ Here is the caller graph for this function:

void Lwm2mReporting_resumeNotifications ( uint8_t  serverIndex,
Lwm2m_Notification_Resumption_t  mode 
)

Resume transmitting notifications resulting from Lwm2mReporting_resourceChanged or Lwm2mReporting_multipleResourcesChanged. This function is only required, if the server has been suspended before by a call to Lwm2mReporting_suspendNotifications.

Parameters
[in]serverIndexthe index of the server in the array of servers
[in]modethe way that changed observations are handled LWM2M_DROP_NOTIFICATIONS will cause changed observations to be silently ignored. Only future calls to Lwm2m_resourceChanged will trigger notifications. LWM2M_SEND_NOTIFICATIONS will cause a single notification to be triggered for changed resources. Thus, the observer will be notified about the new state of the resource, but not necessarily of all state changes.
Returns
RC_OK on success
void Lwm2mReporting_suspendNotifications ( uint8_t  serverIndex)

Any notification resulting Lwm2mReporting_resourceChanged or Lwm2mReporting_multipleResourcesChanged will not be sent to the given server. The notification will silently be dropped.

Parameters
[in]serverIndexthe index of the server in the array of servers
Returns
RC_OK on success
retcode_t Lwm2mSecurity_defaultCallback ( SecurityToken_T  token,
SecurityData_T tokenData 
)

Lwm2m provides a notion of servers and the associated keying information for these servers. If the application has no special needs, this function can be provided to Security_setCallback in order to let the Lwm2m module perform security token management.

Parameters
[in]tokenthe security token to be provided
in/out]tokenData additional data about the token to be provided and memory to provide it

return RC_OK on success, see SecurityCallback_T for a description of return codes.

static void Lwm2mSerializer_checkIfDone ( Lwm2mSerializer_T serializer_ptr,
uint32_t  availableSize 
)
inlinestatic

NOTE: This is experimental API and subject to change!

Resources marked as LWM2M_RESOURCE_DYNAMIC_BULK support blockwise transfer. In such a resource, this function can be used to check if the resource is transferred completely and, if required, mark the transfer with the flag indicating that more data can be transmitted.

Parameters
[in]serializer_ptrPointer to the serializer that is used to extract the server details
[in]availableSizeThe total size of the resource available for serialization
Since
1.8

+ Here is the call graph for this function:

retcode_t Lwm2mSerializer_endSerializingResourceArray ( Lwm2mSerializer_T serializer_ptr)
Parameters
[in]serializer_ptrPointer to the serializer structure (typically obtained in the callback)
Returns
RC_OK on success RC_LWM2M_SERIALIZATION_ERROR if this is called without calling first

+ Here is the caller graph for this function:

uint32_t Lwm2mSerializer_getBlockOffset ( Lwm2mSerializer_T serializer_ptr)

NOTE: This is experimental API and subject to change!

Resources marked as LWM2M_RESOURCE_DYNAMIC_BULK support blockwise transfer. In such a resource, this function can be used to obtain the offset of data to be written. For other resources, the returned value will always be 0.

Parameters
[in]serializer_ptrPointer to the serializer that is used to extract the server details
Returns
offset in bytes of the block that was requested.
Since
1.8

+ Here is the caller graph for this function:

uint16_t Lwm2mSerializer_getBlockSize ( Lwm2mSerializer_T serializer_ptr)

NOTE: This is experimental API and subject to change!

Resources marked as LWM2M_RESOURCE_DYNAMIC_BULK support blockwise transfer. In such a resource, this function can be used to obtain the size of the data block to be written. For other resources, the returned value is undefined.

Parameters
[in]serializer_ptrPointer to the serializer that is used to extract the server details
Returns
size in bytes of the block that was requested.
Since
1.8

+ Here is the caller graph for this function:

static uint16_t Lwm2mSerializer_getSerializableSize ( Lwm2mSerializer_T serializer_ptr,
uint32_t  availableSize 
)
inlinestatic

NOTE: This is experimental API and subject to change!

Resources marked as LWM2M_RESOURCE_DYNAMIC_BULK support blockwise transfer. In such a resource, this function can be used to obtain the size of the data block to be written, including the correct value for the last block. Thus, if the available length of the resource is larger than the block size, the block size is returned. Otherwise, the residual size is returned. For resources that are not of type LWM2M_RESOURCE_DYNAMIC_BULK, the returned value is undefined.

Parameters
[in]serializer_ptrPointer to the serializer that is used to extract the server details
[in]availableSizeThe total size of the resource available for serialization
Returns
size to be serialized in bytes, 0 if no bytes need to be serialized.
Since
1.8

+ Here is the call graph for this function:

uint8_t Lwm2mSerializer_getServerIndex ( Lwm2mSerializer_T serializer_ptr)
Parameters
[in]serializer_ptrPointer to the serializer that is used to extract the server details
Returns
server index The index of the server(0 to LWM2M_MAX_NUMBER_SERVERS -1, as it is stored in an array) SERVER_INDEX_NOT_FOUND - if the server index could not be found
void Lwm2mSerializer_haveMoreData ( Lwm2mSerializer_T serializer_ptr)

NOTE: This is experimental API and subject to change!

Resources marked as LWM2M_RESOURCE_DYNAMIC_BULK support blockwise transfer. In such a resource, this function can be used to indicate that the resource is larger than what has been serialized, i.e. further blocks are required to be transmitted.

Parameters
[in]serializer_ptr- Pointer to the serializer that is used to extract the server details
Since
1.8

+ Here is the caller graph for this function:

retcode_t Lwm2mSerializer_serializeBool ( Lwm2mSerializer_T serializer_ptr,
bool  value 
)
Parameters
[in]serializer_ptrPointer to the serializer structure (typically obtained in the callback)
[in]valuethe bool to be serialized
Returns
RC_OK on success RC_LWM2M_ENTITY_TOO_LARGE if the length is to large to be serialized RC_LWM2M_SERIALIZATION_ERROR if the data could not be serialized

+ Here is the caller graph for this function:

retcode_t Lwm2mSerializer_serializeFloat ( Lwm2mSerializer_T serializer_ptr,
float  value 
)
Parameters
[in]serializer_ptrPointer to the serializer structure (typically obtained in the callback)
[in]valuethe float to be serialized
Returns
RC_OK on success RC_LWM2M_ENTITY_TOO_LARGE if the length is to large to be serialized RC_LWM2M_SERIALIZATION_ERROR if the data could not be serialized
retcode_t Lwm2mSerializer_serializeInt ( Lwm2mSerializer_T serializer_ptr,
int32_t  value 
)
Parameters
[in]serializer_ptrPointer to the serializer structure (typically obtained in the callback)
[in]valueof the integer to be serialized
Returns
RC_OK on success RC_LWM2M_ENTITY_TOO_LARGE if the length is to large to be serialized RC_LWM2M_SERIALIZATION_ERROR if the data could not be serialized

+ Here is the caller graph for this function:

retcode_t Lwm2mSerializer_serializeOpaque ( Lwm2mSerializer_T serializer_ptr,
uint8_t *  value,
uint32_t  length 
)
Parameters
[in]serializer_ptrPointer to the serializer structure (typically obtained in the callback)
[in]valuethe data to be serialized
[in]lengththe length of the value
Returns
RC_OK on success RC_LWM2M_ENTITY_TOO_LARGE if the length is to large to be serialized RC_LWM2M_SERIALIZATION_ERROR if the data could not be serialized

+ Here is the caller graph for this function:

static retcode_t Lwm2mSerializer_serializeOpaqueBulk ( Lwm2mSerializer_T serializer_ptr,
uint8_t *  data,
uint32_t  availableSize 
)
inlinestatic

NOTE: This is experimental API and subject to change!

Resources marked as LWM2M_RESOURCE_DYNAMIC_BULK support blockwise transfer. In such a resource, this function can be used as a convenience function in order to serialize the corret chunk of a larger memory location. No other function should be called after this one.

Parameters
[in]serializer_ptrPointer to the serializer that is used to extract the server details
[in]dataPointer to the memory of the opaque chunk
[in]availableSizeThe total size of the resource available for serialization
Returns
RC_OK if serialization suceeded, an error otherwise
Since
1.8

+ Here is the call graph for this function:

retcode_t Lwm2mSerializer_serializeString ( Lwm2mSerializer_T serializer_ptr,
StringDescr_T strDescr 
)
Parameters
[in]serializer_ptrPointer to the serializer structure (typically obtained in the callback)
[in]strDescra descriptor for the string to be serialized
Returns
RC_OK on success RC_LWM2M_ENTITY_TOO_LARGE if the length is to large to be serialized RC_LWM2M_SERIALIZATION_ERROR if the data could not be serialized

+ Here is the caller graph for this function:

retcode_t Lwm2mSerializer_serializeTime ( Lwm2mSerializer_T serializer_ptr,
uint32_t  value 
)
Parameters
[in]serializer_ptrPointer to the serializer structure (typically obtained in the callback)
[in]valuethe time value to be serialized
Returns
RC_OK on success RC_LWM2M_ENTITY_TOO_LARGE if the length is to large to be serialized RC_LWM2M_SERIALIZATION_ERROR if the data could not be serialized

+ Here is the caller graph for this function:

retcode_t Lwm2mSerializer_setResourceInstanceId ( Lwm2mSerializer_T serializer_ptr,
uint16_t  instanceId 
)
Parameters
[in]serializer_ptrPointer to the serializer structure (typically obtained in the callback)
Returns
RC_OK on success RC_LWM2M_SERIALIZATION_ERROR if this is called without calling first

+ Here is the caller graph for this function:

retcode_t Lwm2mSerializer_startSerializingResourceArray ( Lwm2mSerializer_T serializer_ptr)
Parameters
[in]serializer_ptrPointer to the serializer structure (typically obtained in the callback)
Returns
RC_OK on success RC_LWM2M_SERIALIZATION_ERROR if this is used without tlv enabled

+ Here is the caller graph for this function:


All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:46 by doxygen 1.8.8