Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
LwM2M high-level API

LwM2M high-level API. More...

Data Structures

struct  lwm2m_ctx
 LwM2M context structure to maintain information for a single LwM2M connection. More...
 
struct  float32_value
 32-bit variant of the LwM2M float structure More...
 
struct  lwm2m_objlnk
 LWM2M ObjLnk resource type structure. More...
 

Macros

#define LWM2M_OBJECT_SECURITY_ID   0
 LwM2M Objects managed by OMA for LwM2M tech specification. Objects in this range have IDs from 0 to 1023. For more information refer to Technical Specification OMA-TS-LightweightM2M-V1_0_2-20180209-A. More...
 
#define LWM2M_OBJECT_SERVER_ID   1
 
#define LWM2M_OBJECT_ACCESS_CONTROL_ID   2
 
#define LWM2M_OBJECT_DEVICE_ID   3
 
#define LWM2M_OBJECT_CONNECTIVITY_MONITORING_ID   4
 
#define LWM2M_OBJECT_FIRMWARE_ID   5
 
#define LWM2M_OBJECT_LOCATION_ID   6
 
#define LWM2M_OBJECT_CONNECTIVITY_STATISTICS_ID   7
 
#define IPSO_OBJECT_GENERIC_SENSOR_ID   3300
 LwM2M Objects produced by 3rd party Standards Development Organizations. Objects in this range have IDs from 2048 to 10240 Refer to the OMA LightweightM2M (LwM2M) Object and Resource Registry: http://www.openmobilealliance.org/wp/OMNA/LwM2M/LwM2MRegistry.html. More...
 
#define IPSO_OBJECT_TEMP_SENSOR_ID   3303
 
#define IPSO_OBJECT_HUMIDITY_SENSOR_ID   3304
 
#define IPSO_OBJECT_LIGHT_CONTROL_ID   3311
 
#define IPSO_OBJECT_ACCELEROMETER_ID   3313
 
#define IPSO_OBJECT_PRESSURE_ID   3323
 
#define IPSO_OBJECT_BUZZER_ID   3338
 
#define IPSO_OBJECT_TIMER_ID   3340
 
#define IPSO_OBJECT_ONOFF_SWITCH_ID   3342
 
#define IPSO_OBJECT_PUSH_BUTTON_ID   3347
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_DC_POWER   0
 Power source types used for the "Available Power Sources" resource of the LwM2M Device object. More...
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_INT   1
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_EXT   2
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_UNUSED   3
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_PWR_OVER_ETH   4
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_USB   5
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_AC_POWER   6
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_SOLAR   7
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_MAX   8
 
#define LWM2M_DEVICE_ERROR_NONE   0
 Error codes used for the "Error Code" resource of the LwM2M Device object. An LwM2M client can register one of the following error codes via the lwm2m_device_add_err() function. More...
 
#define LWM2M_DEVICE_ERROR_LOW_POWER   1
 
#define LWM2M_DEVICE_ERROR_EXT_POWER_SUPPLY_OFF   2
 
#define LWM2M_DEVICE_ERROR_GPS_FAILURE   3
 
#define LWM2M_DEVICE_ERROR_LOW_SIGNAL_STRENGTH   4
 
#define LWM2M_DEVICE_ERROR_OUT_OF_MEMORY   5
 
#define LWM2M_DEVICE_ERROR_SMS_FAILURE   6
 
#define LWM2M_DEVICE_ERROR_NETWORK_FAILURE   7
 
#define LWM2M_DEVICE_ERROR_PERIPHERAL_FAILURE   8
 
#define LWM2M_DEVICE_BATTERY_STATUS_NORMAL   0
 Battery status codes used for the "Battery Status" resource (3/0/20) of the LwM2M Device object. As the battery status changes, an LwM2M client can set one of the following codes via: lwm2m_engine_set_u8("3/0/20", [battery status]) More...
 
#define LWM2M_DEVICE_BATTERY_STATUS_CHARGING   1
 
#define LWM2M_DEVICE_BATTERY_STATUS_CHARGE_COMP   2
 
#define LWM2M_DEVICE_BATTERY_STATUS_DAMAGED   3
 
#define LWM2M_DEVICE_BATTERY_STATUS_LOW   4
 
#define LWM2M_DEVICE_BATTERY_STATUS_NOT_INST   5
 
#define LWM2M_DEVICE_BATTERY_STATUS_UNKNOWN   6
 
#define STATE_IDLE   0
 LWM2M Firmware Update object states. More...
 
#define STATE_DOWNLOADING   1
 
#define STATE_DOWNLOADED   2
 
#define STATE_UPDATING   3
 
#define RESULT_DEFAULT   0
 LWM2M Firmware Update object result codes. More...
 
#define RESULT_SUCCESS   1
 
#define RESULT_NO_STORAGE   2
 
#define RESULT_OUT_OF_MEM   3
 
#define RESULT_CONNECTION_LOST   4
 
#define RESULT_INTEGRITY_FAILED   5
 
#define RESULT_UNSUP_FW   6
 
#define RESULT_INVALID_URI   7
 
#define RESULT_UPDATE_FAILED   8
 
#define RESULT_UNSUP_PROTO   9
 
#define LWM2M_FLOAT32_DEC_MAX   1000000
 Data structure used to represent the LwM2M float type: val1 is the whole number portion of the decimal val2 is the decimal portion *1000000 for 32bit, *1000000000 for 64bit Example: 123.456 == val1: 123, val2:456000 Example: 123.000456 = val1: 123, val2:456. More...
 
#define LWM2M_OBJLNK_MAX_ID   USHRT_MAX
 Maximum value for ObjLnk resource fields. More...
 
#define LWM2M_RES_DATA_READ_ONLY   0
 Resource read-only value bit. More...
 
#define LWM2M_RES_DATA_FLAG_RO   BIT(LWM2M_RES_DATA_READ_ONLY)
 Resource read-only flag. More...
 
#define LWM2M_HAS_RES_FLAG(res, f)   ((res->data_flags & f) == f)
 Read resource flags helper macro. More...
 
#define LWM2M_RD_CLIENT_FLAG_BOOTSTRAP   BIT(0)
 Run bootstrap procedure in current session. More...
 

Typedefs

typedef void(* lwm2m_socket_fault_cb_t) (int error)
 
typedef void(* lwm2m_notify_timeout_cb_t) (void)
 
typedef void *(* lwm2m_engine_get_data_cb_t) (uint16_t obj_inst_id, uint16_t res_id, uint16_t res_inst_id, size_t *data_len)
 Asynchronous callback to get a resource buffer and length. More...
 
typedef int(* lwm2m_engine_set_data_cb_t) (uint16_t obj_inst_id, uint16_t res_id, uint16_t res_inst_id, uint8_t *data, uint16_t data_len, bool last_block, size_t total_size)
 Asynchronous callback when data has been set to a resource buffer. More...
 
typedef int(* lwm2m_engine_user_cb_t) (uint16_t obj_inst_id)
 Asynchronous event notification callback. More...
 
typedef int(* lwm2m_engine_execute_cb_t) (uint16_t obj_inst_id, uint8_t *args, uint16_t args_len)
 Asynchronous execute notification callback. More...
 
typedef struct float32_value float32_value_t
 32-bit variant of the LwM2M float structure More...
 
typedef void(* lwm2m_ctx_event_cb_t) (struct lwm2m_ctx *ctx, enum lwm2m_rd_client_event event)
 Asynchronous RD client event callback. More...
 

Enumerations

enum  lwm2m_rd_client_event {
  LWM2M_RD_CLIENT_EVENT_NONE , LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE , LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_COMPLETE , LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_TRANSFER_COMPLETE ,
  LWM2M_RD_CLIENT_EVENT_REGISTRATION_FAILURE , LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE , LWM2M_RD_CLIENT_EVENT_REG_UPDATE_FAILURE , LWM2M_RD_CLIENT_EVENT_REG_UPDATE_COMPLETE ,
  LWM2M_RD_CLIENT_EVENT_DEREGISTER_FAILURE , LWM2M_RD_CLIENT_EVENT_DISCONNECT , LWM2M_RD_CLIENT_EVENT_QUEUE_MODE_RX_OFF , LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR
}
 LwM2M RD client events. More...
 

Functions

int lwm2m_device_add_err (uint8_t error_code)
 Register a new error code with LwM2M Device object. More...
 
int lwm2m_engine_update_observer_min_period (char *pathstr, uint32_t period_s)
 Change an observer's pmin value. More...
 
int lwm2m_engine_update_observer_max_period (char *pathstr, uint32_t period_s)
 Change an observer's pmax value. More...
 
int lwm2m_engine_create_obj_inst (char *pathstr)
 Create an LwM2M object instance. More...
 
int lwm2m_engine_delete_obj_inst (char *pathstr)
 Delete an LwM2M object instance. More...
 
int lwm2m_engine_set_opaque (char *pathstr, char *data_ptr, uint16_t data_len)
 Set resource (instance) value (opaque buffer) More...
 
int lwm2m_engine_set_string (char *pathstr, char *data_ptr)
 Set resource (instance) value (string) More...
 
int lwm2m_engine_set_u8 (char *pathstr, uint8_t value)
 Set resource (instance) value (u8) More...
 
int lwm2m_engine_set_u16 (char *pathstr, uint16_t value)
 Set resource (instance) value (u16) More...
 
int lwm2m_engine_set_u32 (char *pathstr, uint32_t value)
 Set resource (instance) value (u32) More...
 
int lwm2m_engine_set_u64 (char *pathstr, uint64_t value)
 Set resource (instance) value (u64) More...
 
int lwm2m_engine_set_s8 (char *pathstr, int8_t value)
 Set resource (instance) value (s8) More...
 
int lwm2m_engine_set_s16 (char *pathstr, int16_t value)
 Set resource (instance) value (s16) More...
 
int lwm2m_engine_set_s32 (char *pathstr, int32_t value)
 Set resource (instance) value (s32) More...
 
int lwm2m_engine_set_s64 (char *pathstr, int64_t value)
 Set resource (instance) value (s64) More...
 
int lwm2m_engine_set_bool (char *pathstr, bool value)
 Set resource (instance) value (bool) More...
 
int lwm2m_engine_set_float32 (char *pathstr, float32_value_t *value)
 Set resource (instance) value (32-bit float structure) More...
 
int lwm2m_engine_set_objlnk (char *pathstr, struct lwm2m_objlnk *value)
 Set resource (instance) value (ObjLnk) More...
 
int lwm2m_engine_get_opaque (char *pathstr, void *buf, uint16_t buflen)
 Get resource (instance) value (opaque buffer) More...
 
int lwm2m_engine_get_string (char *pathstr, void *str, uint16_t strlen)
 Get resource (instance) value (string) More...
 
int lwm2m_engine_get_u8 (char *pathstr, uint8_t *value)
 Get resource (instance) value (u8) More...
 
int lwm2m_engine_get_u16 (char *pathstr, uint16_t *value)
 Get resource (instance) value (u16) More...
 
int lwm2m_engine_get_u32 (char *pathstr, uint32_t *value)
 Get resource (instance) value (u32) More...
 
int lwm2m_engine_get_u64 (char *pathstr, uint64_t *value)
 Get resource (instance) value (u64) More...
 
int lwm2m_engine_get_s8 (char *pathstr, int8_t *value)
 Get resource (instance) value (s8) More...
 
int lwm2m_engine_get_s16 (char *pathstr, int16_t *value)
 Get resource (instance) value (s16) More...
 
int lwm2m_engine_get_s32 (char *pathstr, int32_t *value)
 Get resource (instance) value (s32) More...
 
int lwm2m_engine_get_s64 (char *pathstr, int64_t *value)
 Get resource (instance) value (s64) More...
 
int lwm2m_engine_get_bool (char *pathstr, bool *value)
 Get resource (instance) value (bool) More...
 
int lwm2m_engine_get_float32 (char *pathstr, float32_value_t *buf)
 Get resource (instance) value (32-bit float structure) More...
 
int lwm2m_engine_get_objlnk (char *pathstr, struct lwm2m_objlnk *buf)
 Get resource (instance) value (ObjLnk) More...
 
int lwm2m_engine_register_read_callback (char *pathstr, lwm2m_engine_get_data_cb_t cb)
 Set resource (instance) read callback. More...
 
int lwm2m_engine_register_pre_write_callback (char *pathstr, lwm2m_engine_get_data_cb_t cb)
 Set resource (instance) pre-write callback. More...
 
int lwm2m_engine_register_validate_callback (char *pathstr, lwm2m_engine_set_data_cb_t cb)
 Set resource (instance) validation callback. More...
 
int lwm2m_engine_register_post_write_callback (char *pathstr, lwm2m_engine_set_data_cb_t cb)
 Set resource (instance) post-write callback. More...
 
int lwm2m_engine_register_exec_callback (char *pathstr, lwm2m_engine_execute_cb_t cb)
 Set resource execute event callback. More...
 
int lwm2m_engine_register_create_callback (uint16_t obj_id, lwm2m_engine_user_cb_t cb)
 Set object instance create event callback. More...
 
int lwm2m_engine_register_delete_callback (uint16_t obj_id, lwm2m_engine_user_cb_t cb)
 Set object instance delete event callback. More...
 
int lwm2m_engine_set_res_data (char *pathstr, void *data_ptr, uint16_t data_len, uint8_t data_flags)
 Set data buffer for a resource. More...
 
int lwm2m_engine_get_res_data (char *pathstr, void **data_ptr, uint16_t *data_len, uint8_t *data_flags)
 Get data buffer for a resource. More...
 
int lwm2m_engine_create_res_inst (char *pathstr)
 Create a resource instance. More...
 
int lwm2m_engine_delete_res_inst (char *pathstr)
 Delete a resource instance. More...
 
int lwm2m_engine_update_service_period (k_work_handler_t service, uint32_t period_ms)
 Update the period of a given service. More...
 
int lwm2m_engine_start (struct lwm2m_ctx *client_ctx)
 Start the LwM2M engine. More...
 
void lwm2m_acknowledge (struct lwm2m_ctx *client_ctx)
 Acknowledge the currently processed request with an empty ACK. More...
 
void lwm2m_rd_client_start (struct lwm2m_ctx *client_ctx, const char *ep_name, uint32_t flags, lwm2m_ctx_event_cb_t event_cb)
 Start the LwM2M RD (Registration / Discovery) Client. More...
 
void lwm2m_rd_client_stop (struct lwm2m_ctx *client_ctx, lwm2m_ctx_event_cb_t event_cb)
 Stop the LwM2M RD (De-register) Client. More...
 
void lwm2m_rd_client_update (void)
 Trigger a Registration Update of the LwM2M RD Client. More...
 

Detailed Description

LwM2M high-level API.

LwM2M high-level interface is defined in this header.

Note
The implementation assumes UDP module is enabled.
LwM2M 1.0.x is currently the only supported version.

Macro Definition Documentation

◆ IPSO_OBJECT_ACCELEROMETER_ID

#define IPSO_OBJECT_ACCELEROMETER_ID   3313

#include <include/net/lwm2m.h>

◆ IPSO_OBJECT_BUZZER_ID

#define IPSO_OBJECT_BUZZER_ID   3338

#include <include/net/lwm2m.h>

◆ IPSO_OBJECT_GENERIC_SENSOR_ID

#define IPSO_OBJECT_GENERIC_SENSOR_ID   3300

#include <include/net/lwm2m.h>

LwM2M Objects produced by 3rd party Standards Development Organizations. Objects in this range have IDs from 2048 to 10240 Refer to the OMA LightweightM2M (LwM2M) Object and Resource Registry: http://www.openmobilealliance.org/wp/OMNA/LwM2M/LwM2MRegistry.html.

◆ IPSO_OBJECT_HUMIDITY_SENSOR_ID

#define IPSO_OBJECT_HUMIDITY_SENSOR_ID   3304

#include <include/net/lwm2m.h>

◆ IPSO_OBJECT_LIGHT_CONTROL_ID

#define IPSO_OBJECT_LIGHT_CONTROL_ID   3311

#include <include/net/lwm2m.h>

◆ IPSO_OBJECT_ONOFF_SWITCH_ID

#define IPSO_OBJECT_ONOFF_SWITCH_ID   3342

#include <include/net/lwm2m.h>

◆ IPSO_OBJECT_PRESSURE_ID

#define IPSO_OBJECT_PRESSURE_ID   3323

#include <include/net/lwm2m.h>

◆ IPSO_OBJECT_PUSH_BUTTON_ID

#define IPSO_OBJECT_PUSH_BUTTON_ID   3347

#include <include/net/lwm2m.h>

◆ IPSO_OBJECT_TEMP_SENSOR_ID

#define IPSO_OBJECT_TEMP_SENSOR_ID   3303

#include <include/net/lwm2m.h>

◆ IPSO_OBJECT_TIMER_ID

#define IPSO_OBJECT_TIMER_ID   3340

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_BATTERY_STATUS_CHARGE_COMP

#define LWM2M_DEVICE_BATTERY_STATUS_CHARGE_COMP   2

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_BATTERY_STATUS_CHARGING

#define LWM2M_DEVICE_BATTERY_STATUS_CHARGING   1

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_BATTERY_STATUS_DAMAGED

#define LWM2M_DEVICE_BATTERY_STATUS_DAMAGED   3

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_BATTERY_STATUS_LOW

#define LWM2M_DEVICE_BATTERY_STATUS_LOW   4

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_BATTERY_STATUS_NORMAL

#define LWM2M_DEVICE_BATTERY_STATUS_NORMAL   0

#include <include/net/lwm2m.h>

Battery status codes used for the "Battery Status" resource (3/0/20) of the LwM2M Device object. As the battery status changes, an LwM2M client can set one of the following codes via: lwm2m_engine_set_u8("3/0/20", [battery status])

◆ LWM2M_DEVICE_BATTERY_STATUS_NOT_INST

#define LWM2M_DEVICE_BATTERY_STATUS_NOT_INST   5

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_BATTERY_STATUS_UNKNOWN

#define LWM2M_DEVICE_BATTERY_STATUS_UNKNOWN   6

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_ERROR_EXT_POWER_SUPPLY_OFF

#define LWM2M_DEVICE_ERROR_EXT_POWER_SUPPLY_OFF   2

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_ERROR_GPS_FAILURE

#define LWM2M_DEVICE_ERROR_GPS_FAILURE   3

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_ERROR_LOW_POWER

#define LWM2M_DEVICE_ERROR_LOW_POWER   1

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_ERROR_LOW_SIGNAL_STRENGTH

#define LWM2M_DEVICE_ERROR_LOW_SIGNAL_STRENGTH   4

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_ERROR_NETWORK_FAILURE

#define LWM2M_DEVICE_ERROR_NETWORK_FAILURE   7

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_ERROR_NONE

#define LWM2M_DEVICE_ERROR_NONE   0

#include <include/net/lwm2m.h>

Error codes used for the "Error Code" resource of the LwM2M Device object. An LwM2M client can register one of the following error codes via the lwm2m_device_add_err() function.

◆ LWM2M_DEVICE_ERROR_OUT_OF_MEMORY

#define LWM2M_DEVICE_ERROR_OUT_OF_MEMORY   5

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_ERROR_PERIPHERAL_FAILURE

#define LWM2M_DEVICE_ERROR_PERIPHERAL_FAILURE   8

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_ERROR_SMS_FAILURE

#define LWM2M_DEVICE_ERROR_SMS_FAILURE   6

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_PWR_SRC_TYPE_AC_POWER

#define LWM2M_DEVICE_PWR_SRC_TYPE_AC_POWER   6

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_PWR_SRC_TYPE_BAT_EXT

#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_EXT   2

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_PWR_SRC_TYPE_BAT_INT

#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_INT   1

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_PWR_SRC_TYPE_DC_POWER

#define LWM2M_DEVICE_PWR_SRC_TYPE_DC_POWER   0

#include <include/net/lwm2m.h>

Power source types used for the "Available Power Sources" resource of the LwM2M Device object.

◆ LWM2M_DEVICE_PWR_SRC_TYPE_MAX

#define LWM2M_DEVICE_PWR_SRC_TYPE_MAX   8

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_PWR_SRC_TYPE_PWR_OVER_ETH

#define LWM2M_DEVICE_PWR_SRC_TYPE_PWR_OVER_ETH   4

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_PWR_SRC_TYPE_SOLAR

#define LWM2M_DEVICE_PWR_SRC_TYPE_SOLAR   7

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_PWR_SRC_TYPE_UNUSED

#define LWM2M_DEVICE_PWR_SRC_TYPE_UNUSED   3

#include <include/net/lwm2m.h>

◆ LWM2M_DEVICE_PWR_SRC_TYPE_USB

#define LWM2M_DEVICE_PWR_SRC_TYPE_USB   5

#include <include/net/lwm2m.h>

◆ LWM2M_FLOAT32_DEC_MAX

#define LWM2M_FLOAT32_DEC_MAX   1000000

#include <include/net/lwm2m.h>

Data structure used to represent the LwM2M float type: val1 is the whole number portion of the decimal val2 is the decimal portion *1000000 for 32bit, *1000000000 for 64bit Example: 123.456 == val1: 123, val2:456000 Example: 123.000456 = val1: 123, val2:456.

Maximum precision value for 32-bit LwM2M float val2

◆ LWM2M_HAS_RES_FLAG

#define LWM2M_HAS_RES_FLAG (   res,
  f 
)    ((res->data_flags & f) == f)

#include <include/net/lwm2m.h>

Read resource flags helper macro.

◆ LWM2M_OBJECT_ACCESS_CONTROL_ID

#define LWM2M_OBJECT_ACCESS_CONTROL_ID   2

#include <include/net/lwm2m.h>

◆ LWM2M_OBJECT_CONNECTIVITY_MONITORING_ID

#define LWM2M_OBJECT_CONNECTIVITY_MONITORING_ID   4

#include <include/net/lwm2m.h>

◆ LWM2M_OBJECT_CONNECTIVITY_STATISTICS_ID

#define LWM2M_OBJECT_CONNECTIVITY_STATISTICS_ID   7

#include <include/net/lwm2m.h>

◆ LWM2M_OBJECT_DEVICE_ID

#define LWM2M_OBJECT_DEVICE_ID   3

#include <include/net/lwm2m.h>

◆ LWM2M_OBJECT_FIRMWARE_ID

#define LWM2M_OBJECT_FIRMWARE_ID   5

#include <include/net/lwm2m.h>

◆ LWM2M_OBJECT_LOCATION_ID

#define LWM2M_OBJECT_LOCATION_ID   6

#include <include/net/lwm2m.h>

◆ LWM2M_OBJECT_SECURITY_ID

#define LWM2M_OBJECT_SECURITY_ID   0

#include <include/net/lwm2m.h>

LwM2M Objects managed by OMA for LwM2M tech specification. Objects in this range have IDs from 0 to 1023. For more information refer to Technical Specification OMA-TS-LightweightM2M-V1_0_2-20180209-A.

◆ LWM2M_OBJECT_SERVER_ID

#define LWM2M_OBJECT_SERVER_ID   1

#include <include/net/lwm2m.h>

◆ LWM2M_OBJLNK_MAX_ID

#define LWM2M_OBJLNK_MAX_ID   USHRT_MAX

#include <include/net/lwm2m.h>

Maximum value for ObjLnk resource fields.

◆ LWM2M_RD_CLIENT_FLAG_BOOTSTRAP

#define LWM2M_RD_CLIENT_FLAG_BOOTSTRAP   BIT(0)

#include <include/net/lwm2m.h>

Run bootstrap procedure in current session.

◆ LWM2M_RES_DATA_FLAG_RO

#define LWM2M_RES_DATA_FLAG_RO   BIT(LWM2M_RES_DATA_READ_ONLY)

#include <include/net/lwm2m.h>

Resource read-only flag.

◆ LWM2M_RES_DATA_READ_ONLY

#define LWM2M_RES_DATA_READ_ONLY   0

#include <include/net/lwm2m.h>

Resource read-only value bit.

◆ RESULT_CONNECTION_LOST

#define RESULT_CONNECTION_LOST   4

#include <include/net/lwm2m.h>

◆ RESULT_DEFAULT

#define RESULT_DEFAULT   0

#include <include/net/lwm2m.h>

LWM2M Firmware Update object result codes.

After processing a firmware update, the client sets the result via one of the following codes via lwm2m_engine_set_u8("5/0/5", [result code])

◆ RESULT_INTEGRITY_FAILED

#define RESULT_INTEGRITY_FAILED   5

#include <include/net/lwm2m.h>

◆ RESULT_INVALID_URI

#define RESULT_INVALID_URI   7

#include <include/net/lwm2m.h>

◆ RESULT_NO_STORAGE

#define RESULT_NO_STORAGE   2

#include <include/net/lwm2m.h>

◆ RESULT_OUT_OF_MEM

#define RESULT_OUT_OF_MEM   3

#include <include/net/lwm2m.h>

◆ RESULT_SUCCESS

#define RESULT_SUCCESS   1

#include <include/net/lwm2m.h>

◆ RESULT_UNSUP_FW

#define RESULT_UNSUP_FW   6

#include <include/net/lwm2m.h>

◆ RESULT_UNSUP_PROTO

#define RESULT_UNSUP_PROTO   9

#include <include/net/lwm2m.h>

◆ RESULT_UPDATE_FAILED

#define RESULT_UPDATE_FAILED   8

#include <include/net/lwm2m.h>

◆ STATE_DOWNLOADED

#define STATE_DOWNLOADED   2

#include <include/net/lwm2m.h>

◆ STATE_DOWNLOADING

#define STATE_DOWNLOADING   1

#include <include/net/lwm2m.h>

◆ STATE_IDLE

#define STATE_IDLE   0

#include <include/net/lwm2m.h>

LWM2M Firmware Update object states.

An LwM2M client or the LwM2M Firmware Update object use the following codes to represent the LwM2M Firmware Update state (5/0/3).

◆ STATE_UPDATING

#define STATE_UPDATING   3

#include <include/net/lwm2m.h>

Typedef Documentation

◆ float32_value_t

#include <include/net/lwm2m.h>

32-bit variant of the LwM2M float structure

◆ lwm2m_ctx_event_cb_t

typedef void(* lwm2m_ctx_event_cb_t) (struct lwm2m_ctx *ctx, enum lwm2m_rd_client_event event)

#include <include/net/lwm2m.h>

Asynchronous RD client event callback.

Parameters
[in]ctxLwM2M context generating the event
[in]eventLwM2M RD client event code

◆ lwm2m_engine_execute_cb_t

typedef int(* lwm2m_engine_execute_cb_t) (uint16_t obj_inst_id, uint8_t *args, uint16_t args_len)

#include <include/net/lwm2m.h>

Asynchronous execute notification callback.

Resource executes trigger a callback of this type.

Register a function of this type via: lwm2m_engine_register_exec_callback()

Parameters
[in]obj_inst_idObject instance ID generating the callback.
[in]argsPointer to execute arguments payload. (This can be NULL if no arguments are provided)
[in]args_lenLength of argument payload in bytes.
Returns
Callback returns a negative error code (errno.h) indicating reason of failure or 0 for success.

◆ lwm2m_engine_get_data_cb_t

typedef void *(* lwm2m_engine_get_data_cb_t) (uint16_t obj_inst_id, uint16_t res_id, uint16_t res_inst_id, size_t *data_len)

#include <include/net/lwm2m.h>

Asynchronous callback to get a resource buffer and length.

Prior to accessing the data buffer of a resource, the engine can use this callback to get the buffer pointer and length instead of using the resource's data buffer.

The client or LwM2M objects can register a function of this type via: lwm2m_engine_register_read_callback() lwm2m_engine_register_pre_write_callback()

Parameters
[in]obj_inst_idObject instance ID generating the callback.
[in]res_idResource ID generating the callback.
[in]res_inst_idResource instance ID generating the callback (typically 0 for non-multi instance resources).
[out]data_lenLength of the data buffer.
Returns
Callback returns a pointer to the data buffer or NULL for failure.

◆ lwm2m_engine_set_data_cb_t

typedef int(* lwm2m_engine_set_data_cb_t) (uint16_t obj_inst_id, uint16_t res_id, uint16_t res_inst_id, uint8_t *data, uint16_t data_len, bool last_block, size_t total_size)

#include <include/net/lwm2m.h>

Asynchronous callback when data has been set to a resource buffer.

After changing the data of a resource buffer, the LwM2M engine can make use of this callback to pass the data back to the client or LwM2M objects.

A function of this type can be registered via: lwm2m_engine_register_validate_callback() lwm2m_engine_register_post_write_callback()

Parameters
[in]obj_inst_idObject instance ID generating the callback.
[in]res_idResource ID generating the callback.
[in]res_inst_idResource instance ID generating the callback (typically 0 for non-multi instance resources).
[in]dataPointer to data.
[in]data_lenLength of the data.
[in]last_blockFlag used during block transfer to indicate the last block of data. For non-block transfers this is always false.
[in]total_sizeExpected total size of data for a block transfer. For non-block transfers this is 0.
Returns
Callback returns a negative error code (errno.h) indicating reason of failure or 0 for success.

◆ lwm2m_engine_user_cb_t

typedef int(* lwm2m_engine_user_cb_t) (uint16_t obj_inst_id)

#include <include/net/lwm2m.h>

Asynchronous event notification callback.

Various object instance and resource-based events in the LwM2M engine can trigger a callback of this function type: object instance create, and object instance delete.

Register a function of this type via: lwm2m_engine_register_create_callback() lwm2m_engine_register_delete_callback()

Parameters
[in]obj_inst_idObject instance ID generating the callback.
Returns
Callback returns a negative error code (errno.h) indicating reason of failure or 0 for success.

◆ lwm2m_notify_timeout_cb_t

typedef void(* lwm2m_notify_timeout_cb_t) (void)

#include <include/net/lwm2m.h>

◆ lwm2m_socket_fault_cb_t

typedef void(* lwm2m_socket_fault_cb_t) (int error)

#include <include/net/lwm2m.h>

Enumeration Type Documentation

◆ lwm2m_rd_client_event

#include <include/net/lwm2m.h>

LwM2M RD client events.

LwM2M client events are passed back to the event_cb function in lwm2m_rd_client_start()

Enumerator
LWM2M_RD_CLIENT_EVENT_NONE 
LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE 
LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_COMPLETE 
LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_TRANSFER_COMPLETE 
LWM2M_RD_CLIENT_EVENT_REGISTRATION_FAILURE 
LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE 
LWM2M_RD_CLIENT_EVENT_REG_UPDATE_FAILURE 
LWM2M_RD_CLIENT_EVENT_REG_UPDATE_COMPLETE 
LWM2M_RD_CLIENT_EVENT_DEREGISTER_FAILURE 
LWM2M_RD_CLIENT_EVENT_DISCONNECT 
LWM2M_RD_CLIENT_EVENT_QUEUE_MODE_RX_OFF 
LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR 

Function Documentation

◆ lwm2m_acknowledge()

void lwm2m_acknowledge ( struct lwm2m_ctx client_ctx)

#include <include/net/lwm2m.h>

Acknowledge the currently processed request with an empty ACK.

LwM2M engine by default sends piggybacked responses for requests. This function allows to send an empty ACK for a request earlier (from the application callback). The LwM2M engine will then send the actual response as a separate CON message after all callbacks are executed.

Parameters
[in]client_ctxLwM2M context

◆ lwm2m_device_add_err()

int lwm2m_device_add_err ( uint8_t  error_code)

#include <include/net/lwm2m.h>

Register a new error code with LwM2M Device object.

Parameters
[in]error_codeNew error code.
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_create_obj_inst()

int lwm2m_engine_create_obj_inst ( char *  pathstr)

#include <include/net/lwm2m.h>

Create an LwM2M object instance.

LwM2M clients use this function to create non-default LwM2M objects: Example to create first temperature sensor object: lwm2m_engine_create_obj_inst("3303/0");

Parameters
[in]pathstrLwM2M path string "obj/obj-inst"
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_create_res_inst()

int lwm2m_engine_create_res_inst ( char *  pathstr)

#include <include/net/lwm2m.h>

Create a resource instance.

LwM2M clients use this function to create multi-resource instances: Example to create 0 instance of device available power sources: lwm2m_engine_create_res_inst("3/0/6/0");

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res/res-inst"
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_delete_obj_inst()

int lwm2m_engine_delete_obj_inst ( char *  pathstr)

#include <include/net/lwm2m.h>

Delete an LwM2M object instance.

LwM2M clients use this function to delete LwM2M objects.

Parameters
[in]pathstrLwM2M path string "obj/obj-inst"
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_delete_res_inst()

int lwm2m_engine_delete_res_inst ( char *  pathstr)

#include <include/net/lwm2m.h>

Delete a resource instance.

Use this function to remove an existing resource instance

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res/res-inst"
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_get_bool()

int lwm2m_engine_get_bool ( char *  pathstr,
bool value 
)

#include <include/net/lwm2m.h>

Get resource (instance) value (bool)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[out]valuebool buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_get_float32()

int lwm2m_engine_get_float32 ( char *  pathstr,
float32_value_t buf 
)

#include <include/net/lwm2m.h>

Get resource (instance) value (32-bit float structure)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[out]buf32-bit float buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_get_objlnk()

int lwm2m_engine_get_objlnk ( char *  pathstr,
struct lwm2m_objlnk buf 
)

#include <include/net/lwm2m.h>

Get resource (instance) value (ObjLnk)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[out]buflwm2m_objlnk buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_get_opaque()

int lwm2m_engine_get_opaque ( char *  pathstr,
void buf,
uint16_t  buflen 
)

#include <include/net/lwm2m.h>

Get resource (instance) value (opaque buffer)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[out]bufData buffer to copy data into
[in]buflenLength of buffer
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_get_res_data()

int lwm2m_engine_get_res_data ( char *  pathstr,
void **  data_ptr,
uint16_t data_len,
uint8_t data_flags 
)

#include <include/net/lwm2m.h>

Get data buffer for a resource.

Use this function to get the data buffer information for the specified LwM2M resource.

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[out]data_ptrData buffer pointer
[out]data_lenLength of buffer
[out]data_flagsData buffer flags (such as read-only, etc)
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_get_s16()

int lwm2m_engine_get_s16 ( char *  pathstr,
int16_t value 
)

#include <include/net/lwm2m.h>

Get resource (instance) value (s16)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[out]values16 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_get_s32()

int lwm2m_engine_get_s32 ( char *  pathstr,
int32_t value 
)

#include <include/net/lwm2m.h>

Get resource (instance) value (s32)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[out]values32 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_get_s64()

int lwm2m_engine_get_s64 ( char *  pathstr,
int64_t value 
)

#include <include/net/lwm2m.h>

Get resource (instance) value (s64)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[out]values64 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_get_s8()

int lwm2m_engine_get_s8 ( char *  pathstr,
int8_t value 
)

#include <include/net/lwm2m.h>

Get resource (instance) value (s8)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[out]values8 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_get_string()

int lwm2m_engine_get_string ( char *  pathstr,
void str,
uint16_t  strlen 
)

#include <include/net/lwm2m.h>

Get resource (instance) value (string)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[out]strString buffer to copy data into
[in]strlenLength of buffer
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_get_u16()

int lwm2m_engine_get_u16 ( char *  pathstr,
uint16_t value 
)

#include <include/net/lwm2m.h>

Get resource (instance) value (u16)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[out]valueu16 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_get_u32()

int lwm2m_engine_get_u32 ( char *  pathstr,
uint32_t value 
)

#include <include/net/lwm2m.h>

Get resource (instance) value (u32)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[out]valueu32 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_get_u64()

int lwm2m_engine_get_u64 ( char *  pathstr,
uint64_t value 
)

#include <include/net/lwm2m.h>

Get resource (instance) value (u64)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[out]valueu64 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_get_u8()

int lwm2m_engine_get_u8 ( char *  pathstr,
uint8_t value 
)

#include <include/net/lwm2m.h>

Get resource (instance) value (u8)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[out]valueu8 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_register_create_callback()

int lwm2m_engine_register_create_callback ( uint16_t  obj_id,
lwm2m_engine_user_cb_t  cb 
)

#include <include/net/lwm2m.h>

Set object instance create event callback.

This event is triggered when an object instance is created.

Parameters
[in]obj_idLwM2M object id
[in]cbCreate object instance callback
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_register_delete_callback()

int lwm2m_engine_register_delete_callback ( uint16_t  obj_id,
lwm2m_engine_user_cb_t  cb 
)

#include <include/net/lwm2m.h>

Set object instance delete event callback.

This event is triggered when an object instance is deleted.

Parameters
[in]obj_idLwM2M object id
[in]cbDelete object instance callback
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_register_exec_callback()

int lwm2m_engine_register_exec_callback ( char *  pathstr,
lwm2m_engine_execute_cb_t  cb 
)

#include <include/net/lwm2m.h>

Set resource execute event callback.

This event is triggered when the execute method of a resource is enabled.

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res"
[in]cbExecute resource callback
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_register_post_write_callback()

int lwm2m_engine_register_post_write_callback ( char *  pathstr,
lwm2m_engine_set_data_cb_t  cb 
)

#include <include/net/lwm2m.h>

Set resource (instance) post-write callback.

This callback is triggered after setting the value of a resource to the resource data buffer.

It allows an LwM2M client or object to post-process the value of a resource or trigger other related resource calculations.

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]cbPost-write resource callback
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_register_pre_write_callback()

int lwm2m_engine_register_pre_write_callback ( char *  pathstr,
lwm2m_engine_get_data_cb_t  cb 
)

#include <include/net/lwm2m.h>

Set resource (instance) pre-write callback.

This callback is triggered before setting the value of a resource. It can pass a special data buffer to the engine so that the actual resource value can be calculated later, etc.

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]cbPre-write resource callback
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_register_read_callback()

int lwm2m_engine_register_read_callback ( char *  pathstr,
lwm2m_engine_get_data_cb_t  cb 
)

#include <include/net/lwm2m.h>

Set resource (instance) read callback.

LwM2M clients can use this to set the callback function for resource reads.

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]cbRead resource callback
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_register_validate_callback()

int lwm2m_engine_register_validate_callback ( char *  pathstr,
lwm2m_engine_set_data_cb_t  cb 
)

#include <include/net/lwm2m.h>

Set resource (instance) validation callback.

This callback is triggered before setting the value of a resource to the resource data buffer.

The callback allows an LwM2M client or object to validate the data before writing and notify an error if the data should be discarded for any reason (by returning a negative error code).

Note
All resources that have a validation callback registered are initially decoded into a temporary validation buffer. Make sure that CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE is large enough to store each of the validated resources (individually).
Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]cbValidate resource data callback
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_set_bool()

int lwm2m_engine_set_bool ( char *  pathstr,
bool  value 
)

#include <include/net/lwm2m.h>

Set resource (instance) value (bool)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]valuebool value
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_set_float32()

int lwm2m_engine_set_float32 ( char *  pathstr,
float32_value_t value 
)

#include <include/net/lwm2m.h>

Set resource (instance) value (32-bit float structure)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]value32-bit float value
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_set_objlnk()

int lwm2m_engine_set_objlnk ( char *  pathstr,
struct lwm2m_objlnk value 
)

#include <include/net/lwm2m.h>

Set resource (instance) value (ObjLnk)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]valuepointer to the lwm2m_objlnk structure
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_set_opaque()

int lwm2m_engine_set_opaque ( char *  pathstr,
char *  data_ptr,
uint16_t  data_len 
)

#include <include/net/lwm2m.h>

Set resource (instance) value (opaque buffer)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]data_ptrData buffer
[in]data_lenLength of buffer
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_set_res_data()

int lwm2m_engine_set_res_data ( char *  pathstr,
void data_ptr,
uint16_t  data_len,
uint8_t  data_flags 
)

#include <include/net/lwm2m.h>

Set data buffer for a resource.

Use this function to set the data buffer and flags for the specified LwM2M resource.

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]data_ptrData buffer pointer
[in]data_lenLength of buffer
[in]data_flagsData buffer flags (such as read-only, etc)
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_set_s16()

int lwm2m_engine_set_s16 ( char *  pathstr,
int16_t  value 
)

#include <include/net/lwm2m.h>

Set resource (instance) value (s16)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]values16 value
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_set_s32()

int lwm2m_engine_set_s32 ( char *  pathstr,
int32_t  value 
)

#include <include/net/lwm2m.h>

Set resource (instance) value (s32)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]values32 value
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_set_s64()

int lwm2m_engine_set_s64 ( char *  pathstr,
int64_t  value 
)

#include <include/net/lwm2m.h>

Set resource (instance) value (s64)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]values64 value
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_set_s8()

int lwm2m_engine_set_s8 ( char *  pathstr,
int8_t  value 
)

#include <include/net/lwm2m.h>

Set resource (instance) value (s8)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]values8 value
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_set_string()

int lwm2m_engine_set_string ( char *  pathstr,
char *  data_ptr 
)

#include <include/net/lwm2m.h>

Set resource (instance) value (string)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]data_ptrNULL terminated char buffer
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_set_u16()

int lwm2m_engine_set_u16 ( char *  pathstr,
uint16_t  value 
)

#include <include/net/lwm2m.h>

Set resource (instance) value (u16)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]valueu16 value
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_set_u32()

int lwm2m_engine_set_u32 ( char *  pathstr,
uint32_t  value 
)

#include <include/net/lwm2m.h>

Set resource (instance) value (u32)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]valueu32 value
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_set_u64()

int lwm2m_engine_set_u64 ( char *  pathstr,
uint64_t  value 
)

#include <include/net/lwm2m.h>

Set resource (instance) value (u64)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]valueu64 value
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_set_u8()

int lwm2m_engine_set_u8 ( char *  pathstr,
uint8_t  value 
)

#include <include/net/lwm2m.h>

Set resource (instance) value (u8)

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res(/res-inst)"
[in]valueu8 value
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_start()

int lwm2m_engine_start ( struct lwm2m_ctx client_ctx)

#include <include/net/lwm2m.h>

Start the LwM2M engine.

LwM2M clients normally do not need to call this function as it is called by lwm2m_rd_client_start(). However, if the client does not use the RD client implementation, it will need to be called manually.

Parameters
[in]client_ctxLwM2M context
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_update_observer_max_period()

int lwm2m_engine_update_observer_max_period ( char *  pathstr,
uint32_t  period_s 
)

#include <include/net/lwm2m.h>

Change an observer's pmax value.

LwM2M clients use this function to modify the pmax attribute for an observation being made. Example to update the pmax of a temperature sensor value being observed: lwm2m_engine_update_observer_max_period("3303/0/5700",5);

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res"
[in]period_sValue of pmax to be given (in seconds).
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_update_observer_min_period()

int lwm2m_engine_update_observer_min_period ( char *  pathstr,
uint32_t  period_s 
)

#include <include/net/lwm2m.h>

Change an observer's pmin value.

LwM2M clients use this function to modify the pmin attribute for an observation being made. Example to update the pmin of a temperature sensor value being observed: lwm2m_engine_update_observer_min_period("3303/0/5700",5);

Parameters
[in]pathstrLwM2M path string "obj/obj-inst/res"
[in]period_sValue of pmin to be given (in seconds).
Returns
0 for success or negative in case of error.

◆ lwm2m_engine_update_service_period()

int lwm2m_engine_update_service_period ( k_work_handler_t  service,
uint32_t  period_ms 
)

#include <include/net/lwm2m.h>

Update the period of a given service.

Allow the period modification on an existing service created with lwm2m_engine_add_service(). Example to frequency at which a periodic_service changes it's values : lwm2m_engine_update_service(device_periodic_service,5*MSEC_PER_SEC);

Parameters
[in]serviceHandler of the periodic_service
[in]period_msNew period for the periodic_service (in milliseconds)
Returns
0 for success or negative in case of error.

◆ lwm2m_rd_client_start()

void lwm2m_rd_client_start ( struct lwm2m_ctx client_ctx,
const char *  ep_name,
uint32_t  flags,
lwm2m_ctx_event_cb_t  event_cb 
)

#include <include/net/lwm2m.h>

Start the LwM2M RD (Registration / Discovery) Client.

The RD client sits just above the LwM2M engine and performs the necessary actions to implement the "Registration interface". For more information see Section 5.3 "Client Registration Interface" of the LwM2M Technical Specification.

NOTE: lwm2m_engine_start() is called automatically by this function.

Parameters
[in]client_ctxLwM2M context
[in]ep_nameRegistered endpoint name
[in]flagsFlags used to configure current LwM2M session.
[in]event_cbClient event callback function

◆ lwm2m_rd_client_stop()

void lwm2m_rd_client_stop ( struct lwm2m_ctx client_ctx,
lwm2m_ctx_event_cb_t  event_cb 
)

#include <include/net/lwm2m.h>

Stop the LwM2M RD (De-register) Client.

The RD client sits just above the LwM2M engine and performs the necessary actions to implement the "Registration interface". For more information see Section 5.3 "Client Registration Interface" of the LwM2M Technical Specification.

Parameters
[in]client_ctxLwM2M context
[in]event_cbClient event callback function

◆ lwm2m_rd_client_update()

void lwm2m_rd_client_update ( void  )

#include <include/net/lwm2m.h>

Trigger a Registration Update of the LwM2M RD Client.