Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
LwM2M high-level API

Modules

 LwM2M path helper macros
 

Data Structures

struct  lwm2m_obj_path
 LwM2M object path structure. More...
 
struct  lwm2m_ctx
 LwM2M context structure to maintain information for a single LwM2M connection. More...
 
struct  lwm2m_time_series_elem
 LwM2M Time series data structure. More...
 
struct  lwm2m_objlnk
 LWM2M Objlnk resource type structure. More...
 
struct  lwm2m_res_item
 LwM2M resource item structure. More...
 

Macros

#define LWM2M_OBJLNK_MAX_ID   USHRT_MAX
 Maximum value for Objlnk resource fields.
 
#define LWM2M_RES_DATA_READ_ONLY   0
 Resource read-only value bit.
 
#define LWM2M_RES_DATA_FLAG_RO   BIT(LWM2M_RES_DATA_READ_ONLY)
 Resource read-only flag.
 
#define LWM2M_HAS_RES_FLAG(res, f)   ((res->data_flags & f) == f)
 Read resource flags helper macro.
 
#define LWM2M_RD_CLIENT_FLAG_BOOTSTRAP   BIT(0)
 Run bootstrap procedure in current session.
 
#define LWM2M_MAX_PATH_STR_SIZE   sizeof("/65535/65535/65535/65535")
 LwM2M path maximum length.
 

Typedefs

typedef void(* lwm2m_socket_fault_cb_t) (int error)
 Callback function called when a socket error is encountered.
 
typedef void(* lwm2m_observe_cb_t) (enum lwm2m_observe_event event, struct lwm2m_obj_path *path, void *user_data)
 Observe callback indicating observer adds and deletes, and notification ACKs and timeouts.
 
typedef void(* lwm2m_ctx_event_cb_t) (struct lwm2m_ctx *ctx, enum lwm2m_rd_client_event event)
 Asynchronous RD client event callback.
 
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.
 
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, size_t offset)
 Asynchronous callback when data has been set to a resource buffer.
 
typedef int(* lwm2m_engine_user_cb_t) (uint16_t obj_inst_id)
 Asynchronous event notification callback.
 
typedef int(* lwm2m_engine_execute_cb_t) (uint16_t obj_inst_id, uint8_t *args, uint16_t args_len)
 Asynchronous execute notification callback.
 
typedef void(* lwm2m_send_cb_t) (enum lwm2m_send_status status)
 Callback returning send status.
 

Enumerations

enum  lwm2m_observe_event { LWM2M_OBSERVE_EVENT_OBSERVER_ADDED , LWM2M_OBSERVE_EVENT_OBSERVER_REMOVED , LWM2M_OBSERVE_EVENT_NOTIFY_ACK , LWM2M_OBSERVE_EVENT_NOTIFY_TIMEOUT }
 Observe callback events. More...
 
enum  lwm2m_socket_states { LWM2M_SOCKET_STATE_ONGOING , LWM2M_SOCKET_STATE_ONE_RESPONSE , LWM2M_SOCKET_STATE_LAST , LWM2M_SOCKET_STATE_NO_DATA }
 Different traffic states of the LwM2M socket. More...
 
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_TIMEOUT , 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_ENGINE_SUSPENDED ,
  LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR , LWM2M_RD_CLIENT_EVENT_REG_UPDATE , LWM2M_RD_CLIENT_EVENT_DEREGISTER , LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED
}
 LwM2M RD client events. More...
 
enum  lwm2m_send_status { LWM2M_SEND_STATUS_SUCCESS , LWM2M_SEND_STATUS_FAILURE , LWM2M_SEND_STATUS_TIMEOUT }
 LwM2M send status. More...
 
enum  lwm2m_security_mode_e {
  LWM2M_SECURITY_PSK = 0 , LWM2M_SECURITY_RAW_PK = 1 , LWM2M_SECURITY_CERT = 2 , LWM2M_SECURITY_NOSEC = 3 ,
  LWM2M_SECURITY_CERT_EST = 4
}
 Security modes as defined in LwM2M Security object. More...
 

Functions

int lwm2m_device_add_err (uint8_t error_code)
 Register a new error code with LwM2M Device object.
 
void lwm2m_firmware_set_write_cb (lwm2m_engine_set_data_cb_t cb)
 Set data callback for firmware block transfer.
 
lwm2m_engine_set_data_cb_t lwm2m_firmware_get_write_cb (void)
 Get the data callback for firmware block transfer writes.
 
void lwm2m_firmware_set_write_cb_inst (uint16_t obj_inst_id, lwm2m_engine_set_data_cb_t cb)
 Set data callback for firmware block transfer.
 
lwm2m_engine_set_data_cb_t lwm2m_firmware_get_write_cb_inst (uint16_t obj_inst_id)
 Get the data callback for firmware block transfer writes.
 
void lwm2m_firmware_set_cancel_cb (lwm2m_engine_user_cb_t cb)
 Set callback for firmware update cancel.
 
lwm2m_engine_user_cb_t lwm2m_firmware_get_cancel_cb (void)
 Get a callback for firmware update cancel.
 
void lwm2m_firmware_set_cancel_cb_inst (uint16_t obj_inst_id, lwm2m_engine_user_cb_t cb)
 Set data callback for firmware update cancel.
 
lwm2m_engine_user_cb_t lwm2m_firmware_get_cancel_cb_inst (uint16_t obj_inst_id)
 Get the callback for firmware update cancel.
 
void lwm2m_firmware_set_update_cb (lwm2m_engine_execute_cb_t cb)
 Set data callback to handle firmware update execute events.
 
lwm2m_engine_execute_cb_t lwm2m_firmware_get_update_cb (void)
 Get the event callback for firmware update execute events.
 
void lwm2m_firmware_set_update_cb_inst (uint16_t obj_inst_id, lwm2m_engine_execute_cb_t cb)
 Set data callback to handle firmware update execute events.
 
lwm2m_engine_execute_cb_t lwm2m_firmware_get_update_cb_inst (uint16_t obj_inst_id)
 Get the event callback for firmware update execute events.
 
int lwm2m_swmgmt_set_activate_cb (uint16_t obj_inst_id, lwm2m_engine_execute_cb_t cb)
 Set callback to handle software activation requests.
 
int lwm2m_swmgmt_set_deactivate_cb (uint16_t obj_inst_id, lwm2m_engine_execute_cb_t cb)
 Set callback to handle software deactivation requests.
 
int lwm2m_swmgmt_set_install_package_cb (uint16_t obj_inst_id, lwm2m_engine_execute_cb_t cb)
 Set callback to handle software install requests.
 
int lwm2m_swmgmt_set_delete_package_cb (uint16_t obj_inst_id, lwm2m_engine_execute_cb_t cb)
 Set callback to handle software uninstall requests.
 
int lwm2m_swmgmt_set_read_package_version_cb (uint16_t obj_inst_id, lwm2m_engine_get_data_cb_t cb)
 Set callback to read software package.
 
int lwm2m_swmgmt_set_write_package_cb (uint16_t obj_inst_id, lwm2m_engine_set_data_cb_t cb)
 Set data callback for software management block transfer.
 
int lwm2m_swmgmt_install_completed (uint16_t obj_inst_id, int error_code)
 Function to be called when a Software Management object instance completed the Install operation.
 
void lwm2m_event_log_set_read_log_data_cb (lwm2m_engine_get_data_cb_t cb)
 Set callback to read log data.
 
int lwm2m_update_observer_min_period (struct lwm2m_ctx *client_ctx, const struct lwm2m_obj_path *path, uint32_t period_s)
 Change an observer's pmin value.
 
int lwm2m_update_observer_max_period (struct lwm2m_ctx *client_ctx, const struct lwm2m_obj_path *path, uint32_t period_s)
 Change an observer's pmax value.
 
int lwm2m_create_object_inst (const struct lwm2m_obj_path *path)
 Create an LwM2M object instance.
 
int lwm2m_delete_object_inst (const struct lwm2m_obj_path *path)
 Delete an LwM2M object instance.
 
void lwm2m_registry_lock (void)
 Locks the registry for this thread.
 
void lwm2m_registry_unlock (void)
 Unlocks the registry previously locked by lwm2m_registry_lock().
 
int lwm2m_set_opaque (const struct lwm2m_obj_path *path, const char *data_ptr, uint16_t data_len)
 Set resource (instance) value (opaque buffer)
 
int lwm2m_set_string (const struct lwm2m_obj_path *path, const char *data_ptr)
 Set resource (instance) value (string)
 
int lwm2m_set_u8 (const struct lwm2m_obj_path *path, uint8_t value)
 Set resource (instance) value (u8)
 
int lwm2m_set_u16 (const struct lwm2m_obj_path *path, uint16_t value)
 Set resource (instance) value (u16)
 
int lwm2m_set_u32 (const struct lwm2m_obj_path *path, uint32_t value)
 Set resource (instance) value (u32)
 
int lwm2m_set_u64 (const struct lwm2m_obj_path *path, uint64_t value)
 Set resource (instance) value (u64)
 
int lwm2m_set_s8 (const struct lwm2m_obj_path *path, int8_t value)
 Set resource (instance) value (s8)
 
int lwm2m_set_s16 (const struct lwm2m_obj_path *path, int16_t value)
 Set resource (instance) value (s16)
 
int lwm2m_set_s32 (const struct lwm2m_obj_path *path, int32_t value)
 Set resource (instance) value (s32)
 
int lwm2m_set_s64 (const struct lwm2m_obj_path *path, int64_t value)
 Set resource (instance) value (s64)
 
int lwm2m_set_bool (const struct lwm2m_obj_path *path, bool value)
 Set resource (instance) value (bool)
 
int lwm2m_set_f64 (const struct lwm2m_obj_path *path, const double value)
 Set resource (instance) value (double)
 
int lwm2m_set_objlnk (const struct lwm2m_obj_path *path, const struct lwm2m_objlnk *value)
 Set resource (instance) value (Objlnk)
 
int lwm2m_set_time (const struct lwm2m_obj_path *path, time_t value)
 Set resource (instance) value (Time)
 
int lwm2m_set_bulk (const struct lwm2m_res_item res_list[], size_t res_list_size)
 Set multiple resource (instance) values.
 
int lwm2m_get_opaque (const struct lwm2m_obj_path *path, void *buf, uint16_t buflen)
 Get resource (instance) value (opaque buffer)
 
int lwm2m_get_string (const struct lwm2m_obj_path *path, void *str, uint16_t buflen)
 Get resource (instance) value (string)
 
int lwm2m_get_u8 (const struct lwm2m_obj_path *path, uint8_t *value)
 Get resource (instance) value (u8)
 
int lwm2m_get_u16 (const struct lwm2m_obj_path *path, uint16_t *value)
 Get resource (instance) value (u16)
 
int lwm2m_get_u32 (const struct lwm2m_obj_path *path, uint32_t *value)
 Get resource (instance) value (u32)
 
int lwm2m_get_u64 (const struct lwm2m_obj_path *path, uint64_t *value)
 Get resource (instance) value (u64)
 
int lwm2m_get_s8 (const struct lwm2m_obj_path *path, int8_t *value)
 Get resource (instance) value (s8)
 
int lwm2m_get_s16 (const struct lwm2m_obj_path *path, int16_t *value)
 Get resource (instance) value (s16)
 
int lwm2m_get_s32 (const struct lwm2m_obj_path *path, int32_t *value)
 Get resource (instance) value (s32)
 
int lwm2m_get_s64 (const struct lwm2m_obj_path *path, int64_t *value)
 Get resource (instance) value (s64)
 
int lwm2m_get_bool (const struct lwm2m_obj_path *path, bool *value)
 Get resource (instance) value (bool)
 
int lwm2m_get_f64 (const struct lwm2m_obj_path *path, double *value)
 Get resource (instance) value (double)
 
int lwm2m_get_objlnk (const struct lwm2m_obj_path *path, struct lwm2m_objlnk *buf)
 Get resource (instance) value (Objlnk)
 
int lwm2m_get_time (const struct lwm2m_obj_path *path, time_t *buf)
 Get resource (instance) value (Time)
 
int lwm2m_register_read_callback (const struct lwm2m_obj_path *path, lwm2m_engine_get_data_cb_t cb)
 Set resource (instance) read callback.
 
int lwm2m_register_pre_write_callback (const struct lwm2m_obj_path *path, lwm2m_engine_get_data_cb_t cb)
 Set resource (instance) pre-write callback.
 
int lwm2m_register_validate_callback (const struct lwm2m_obj_path *path, lwm2m_engine_set_data_cb_t cb)
 Set resource (instance) validation callback.
 
int lwm2m_register_post_write_callback (const struct lwm2m_obj_path *path, lwm2m_engine_set_data_cb_t cb)
 Set resource (instance) post-write callback.
 
int lwm2m_register_exec_callback (const struct lwm2m_obj_path *path, lwm2m_engine_execute_cb_t cb)
 Set resource execute event callback.
 
int lwm2m_register_create_callback (uint16_t obj_id, lwm2m_engine_user_cb_t cb)
 Set object instance create event callback.
 
int lwm2m_register_delete_callback (uint16_t obj_id, lwm2m_engine_user_cb_t cb)
 Set object instance delete event callback.
 
int lwm2m_set_res_buf (const struct lwm2m_obj_path *path, void *buffer_ptr, uint16_t buffer_len, uint16_t data_len, uint8_t data_flags)
 Set data buffer for a resource.
 
int lwm2m_set_res_data_len (const struct lwm2m_obj_path *path, uint16_t data_len)
 Update data size for a resource.
 
int lwm2m_get_res_buf (const struct lwm2m_obj_path *path, void **buffer_ptr, uint16_t *buffer_len, uint16_t *data_len, uint8_t *data_flags)
 Get data buffer for a resource.
 
int lwm2m_create_res_inst (const struct lwm2m_obj_path *path)
 Create a resource instance.
 
int lwm2m_delete_res_inst (const struct lwm2m_obj_path *path)
 Delete a resource instance.
 
int lwm2m_update_device_service_period (uint32_t period_ms)
 Update the period of the device service.
 
bool lwm2m_path_is_observed (const struct lwm2m_obj_path *path)
 Check whether a path is observed.
 
int lwm2m_engine_stop (struct lwm2m_ctx *client_ctx)
 Stop the LwM2M engine.
 
int lwm2m_engine_start (struct lwm2m_ctx *client_ctx)
 Start the LwM2M engine.
 
void lwm2m_acknowledge (struct lwm2m_ctx *client_ctx)
 Acknowledge the currently processed request with an empty ACK.
 
int lwm2m_rd_client_start (struct lwm2m_ctx *client_ctx, const char *ep_name, uint32_t flags, lwm2m_ctx_event_cb_t event_cb, lwm2m_observe_cb_t observe_cb)
 Start the LwM2M RD (Registration / Discovery) Client.
 
int lwm2m_rd_client_stop (struct lwm2m_ctx *client_ctx, lwm2m_ctx_event_cb_t event_cb, bool deregister)
 Stop the LwM2M RD (De-register) Client.
 
int lwm2m_engine_pause (void)
 Suspend the LwM2M engine Thread.
 
int lwm2m_engine_resume (void)
 Resume the LwM2M engine thread.
 
void lwm2m_rd_client_update (void)
 Trigger a Registration Update of the LwM2M RD Client.
 
char * lwm2m_path_log_buf (char *buf, struct lwm2m_obj_path *path)
 Helper function to print path objects' contents to log.
 
int lwm2m_send_cb (struct lwm2m_ctx *ctx, const struct lwm2m_obj_path path_list[], uint8_t path_list_size, lwm2m_send_cb_t reply_cb)
  
 
struct lwm2m_ctxlwm2m_rd_client_ctx (void)
  
 
int lwm2m_enable_cache (const struct lwm2m_obj_path *path, struct lwm2m_time_series_elem *data_cache, size_t cache_len)
  
 
int lwm2m_security_mode (struct lwm2m_ctx *ctx)
 Read security mode from selected security object instance.
 
int lwm2m_set_default_sockopt (struct lwm2m_ctx *ctx)
 Set default socket options for DTLS connections.
 

LwM2M Objects managed by OMA for LwM2M tech specification.

Objects in this range have IDs from 0 to 1023.

#define LWM2M_OBJECT_SECURITY_ID   0
 Security object.
 
#define LWM2M_OBJECT_SERVER_ID   1
 Server object.
 
#define LWM2M_OBJECT_ACCESS_CONTROL_ID   2
 Access Control object.
 
#define LWM2M_OBJECT_DEVICE_ID   3
 Device object.
 
#define LWM2M_OBJECT_CONNECTIVITY_MONITORING_ID   4
 Connectivity Monitoring object.
 
#define LWM2M_OBJECT_FIRMWARE_ID   5
 Firmware object.
 
#define LWM2M_OBJECT_LOCATION_ID   6
 Location object.
 
#define LWM2M_OBJECT_CONNECTIVITY_STATISTICS_ID   7
 Connectivity Statistics object.
 
#define LWM2M_OBJECT_SOFTWARE_MANAGEMENT_ID   9
 Software Management object.
 
#define LWM2M_OBJECT_PORTFOLIO_ID   16
 Portfolio object.
 
#define LWM2M_OBJECT_BINARYAPPDATACONTAINER_ID   19
 Binary App Data Container object.
 
#define LWM2M_OBJECT_EVENT_LOG_ID   20
 Event Log object.
 
#define LWM2M_OBJECT_OSCORE_ID   21
 OSCORE object.
 
#define LWM2M_OBJECT_GATEWAY_ID   25
 Gateway object.
 

LwM2M Objects produced by 3rd party Standards Development

Organizations.

Refer to the OMA LightweightM2M (LwM2M) Object and Resource Registry: http://www.openmobilealliance.org/wp/OMNA/LwM2M/LwM2MRegistry.html

#define IPSO_OBJECT_GENERIC_SENSOR_ID   3300
 IPSO Generic Sensor object.
 
#define IPSO_OBJECT_TEMP_SENSOR_ID   3303
 IPSO Temperature Sensor object.
 
#define IPSO_OBJECT_HUMIDITY_SENSOR_ID   3304
 IPSO Humidity Sensor object.
 
#define IPSO_OBJECT_LIGHT_CONTROL_ID   3311
 IPSO Light Control object.
 
#define IPSO_OBJECT_ACCELEROMETER_ID   3313
 IPSO Accelerometer object.
 
#define IPSO_OBJECT_VOLTAGE_SENSOR_ID   3316
 IPSO Voltage Sensor object.
 
#define IPSO_OBJECT_CURRENT_SENSOR_ID   3317
 IPSO Current Sensor object.
 
#define IPSO_OBJECT_PRESSURE_ID   3323
 IPSO Pressure Sensor object.
 
#define IPSO_OBJECT_BUZZER_ID   3338
 IPSO Buzzer object.
 
#define IPSO_OBJECT_TIMER_ID   3340
 IPSO Timer object.
 
#define IPSO_OBJECT_ONOFF_SWITCH_ID   3342
 IPSO On/Off Switch object.
 
#define IPSO_OBJECT_PUSH_BUTTON_ID   3347
 IPSO Push Button object.
 
#define UCIFI_OBJECT_BATTERY_ID   3411
 uCIFI Battery object
 
#define IPSO_OBJECT_FILLING_LEVEL_SENSOR_ID   3435
 IPSO Filling Level Sensor object.
 

Power source types used for the "Available Power Sources" resource of

the LwM2M Device object (3/0/6).

#define LWM2M_DEVICE_PWR_SRC_TYPE_DC_POWER   0
 DC power.
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_INT   1
 Internal battery.
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_EXT   2
 External battery.
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_FUEL_CELL   3
 Fuel cell.
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_PWR_OVER_ETH   4
 Power over Ethernet.
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_USB   5
 USB.
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_AC_POWER   6
 AC (mains) power.
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_SOLAR   7
 Solar.
 
#define LWM2M_DEVICE_PWR_SRC_TYPE_MAX   8
 Max value for Available Power Source type.
 

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.

#define LWM2M_DEVICE_ERROR_NONE   0
 No error.
 
#define LWM2M_DEVICE_ERROR_LOW_POWER   1
 Low battery power.
 
#define LWM2M_DEVICE_ERROR_EXT_POWER_SUPPLY_OFF   2
 External power supply off.
 
#define LWM2M_DEVICE_ERROR_GPS_FAILURE   3
 GPS module failure.
 
#define LWM2M_DEVICE_ERROR_LOW_SIGNAL_STRENGTH   4
 Low received signal strength.
 
#define LWM2M_DEVICE_ERROR_OUT_OF_MEMORY   5
 Out of memory.
 
#define LWM2M_DEVICE_ERROR_SMS_FAILURE   6
 SMS failure.
 
#define LWM2M_DEVICE_ERROR_NETWORK_FAILURE   7
 IP Connectivity failure.
 
#define LWM2M_DEVICE_ERROR_PERIPHERAL_FAILURE   8
 Peripheral malfunction.
 

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_set_u8("3/0/20", [battery status])

#define LWM2M_DEVICE_BATTERY_STATUS_NORMAL   0
 The battery is operating normally and not on power.
 
#define LWM2M_DEVICE_BATTERY_STATUS_CHARGING   1
 The battery is currently charging.
 
#define LWM2M_DEVICE_BATTERY_STATUS_CHARGE_COMP   2
 The battery is fully charged and the charger is still connected.
 
#define LWM2M_DEVICE_BATTERY_STATUS_DAMAGED   3
 The battery has some problem.
 
#define LWM2M_DEVICE_BATTERY_STATUS_LOW   4
 The battery is low on charge.
 
#define LWM2M_DEVICE_BATTERY_STATUS_NOT_INST   5
 The battery is not installed.
 
#define LWM2M_DEVICE_BATTERY_STATUS_UNKNOWN   6
 The battery information is not available.
 

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).

#define STATE_IDLE   0
 Idle.
 
#define STATE_DOWNLOADING   1
 Downloading.
 
#define STATE_DOWNLOADED   2
 Downloaded.
 
#define STATE_UPDATING   3
 Updating.
 

LWM2M Firmware Update object result codes

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

#define RESULT_DEFAULT   0
 Initial value.
 
#define RESULT_SUCCESS   1
 Firmware updated successfully.
 
#define RESULT_NO_STORAGE   2
 Not enough flash memory for the new firmware package.
 
#define RESULT_OUT_OF_MEM   3
 Out of RAM during downloading process.
 
#define RESULT_CONNECTION_LOST   4
 Connection lost during downloading process.
 
#define RESULT_INTEGRITY_FAILED   5
 Integrity check failure for new downloaded package.
 
#define RESULT_UNSUP_FW   6
 Unsupported package type.
 
#define RESULT_INVALID_URI   7
 Invalid URI.
 
#define RESULT_UPDATE_FAILED   8
 Firmware update failed.
 
#define RESULT_UNSUP_PROTO   9
 Unsupported protocol.
 

Detailed Description

Since
1.9
Version
0.8.0

Macro Definition Documentation

◆ IPSO_OBJECT_ACCELEROMETER_ID

#define IPSO_OBJECT_ACCELEROMETER_ID   3313

#include <zephyr/net/lwm2m.h>

IPSO Accelerometer object.

◆ IPSO_OBJECT_BUZZER_ID

#define IPSO_OBJECT_BUZZER_ID   3338

#include <zephyr/net/lwm2m.h>

IPSO Buzzer object.

◆ IPSO_OBJECT_CURRENT_SENSOR_ID

#define IPSO_OBJECT_CURRENT_SENSOR_ID   3317

#include <zephyr/net/lwm2m.h>

IPSO Current Sensor object.

◆ IPSO_OBJECT_FILLING_LEVEL_SENSOR_ID

#define IPSO_OBJECT_FILLING_LEVEL_SENSOR_ID   3435

#include <zephyr/net/lwm2m.h>

IPSO Filling Level Sensor object.

◆ IPSO_OBJECT_GENERIC_SENSOR_ID

#define IPSO_OBJECT_GENERIC_SENSOR_ID   3300

#include <zephyr/net/lwm2m.h>

IPSO Generic Sensor object.

◆ IPSO_OBJECT_HUMIDITY_SENSOR_ID

#define IPSO_OBJECT_HUMIDITY_SENSOR_ID   3304

#include <zephyr/net/lwm2m.h>

IPSO Humidity Sensor object.

◆ IPSO_OBJECT_LIGHT_CONTROL_ID

#define IPSO_OBJECT_LIGHT_CONTROL_ID   3311

#include <zephyr/net/lwm2m.h>

IPSO Light Control object.

◆ IPSO_OBJECT_ONOFF_SWITCH_ID

#define IPSO_OBJECT_ONOFF_SWITCH_ID   3342

#include <zephyr/net/lwm2m.h>

IPSO On/Off Switch object.

◆ IPSO_OBJECT_PRESSURE_ID

#define IPSO_OBJECT_PRESSURE_ID   3323

#include <zephyr/net/lwm2m.h>

IPSO Pressure Sensor object.

◆ IPSO_OBJECT_PUSH_BUTTON_ID

#define IPSO_OBJECT_PUSH_BUTTON_ID   3347

#include <zephyr/net/lwm2m.h>

IPSO Push Button object.

◆ IPSO_OBJECT_TEMP_SENSOR_ID

#define IPSO_OBJECT_TEMP_SENSOR_ID   3303

#include <zephyr/net/lwm2m.h>

IPSO Temperature Sensor object.

◆ IPSO_OBJECT_TIMER_ID

#define IPSO_OBJECT_TIMER_ID   3340

#include <zephyr/net/lwm2m.h>

IPSO Timer object.

◆ IPSO_OBJECT_VOLTAGE_SENSOR_ID

#define IPSO_OBJECT_VOLTAGE_SENSOR_ID   3316

#include <zephyr/net/lwm2m.h>

IPSO Voltage Sensor object.

◆ LWM2M_DEVICE_BATTERY_STATUS_CHARGE_COMP

#define LWM2M_DEVICE_BATTERY_STATUS_CHARGE_COMP   2

#include <zephyr/net/lwm2m.h>

The battery is fully charged and the charger is still connected.

◆ LWM2M_DEVICE_BATTERY_STATUS_CHARGING

#define LWM2M_DEVICE_BATTERY_STATUS_CHARGING   1

#include <zephyr/net/lwm2m.h>

The battery is currently charging.

◆ LWM2M_DEVICE_BATTERY_STATUS_DAMAGED

#define LWM2M_DEVICE_BATTERY_STATUS_DAMAGED   3

#include <zephyr/net/lwm2m.h>

The battery has some problem.

◆ LWM2M_DEVICE_BATTERY_STATUS_LOW

#define LWM2M_DEVICE_BATTERY_STATUS_LOW   4

#include <zephyr/net/lwm2m.h>

The battery is low on charge.

◆ LWM2M_DEVICE_BATTERY_STATUS_NORMAL

#define LWM2M_DEVICE_BATTERY_STATUS_NORMAL   0

#include <zephyr/net/lwm2m.h>

The battery is operating normally and not on power.

◆ LWM2M_DEVICE_BATTERY_STATUS_NOT_INST

#define LWM2M_DEVICE_BATTERY_STATUS_NOT_INST   5

#include <zephyr/net/lwm2m.h>

The battery is not installed.

◆ LWM2M_DEVICE_BATTERY_STATUS_UNKNOWN

#define LWM2M_DEVICE_BATTERY_STATUS_UNKNOWN   6

#include <zephyr/net/lwm2m.h>

The battery information is not available.

◆ LWM2M_DEVICE_ERROR_EXT_POWER_SUPPLY_OFF

#define LWM2M_DEVICE_ERROR_EXT_POWER_SUPPLY_OFF   2

#include <zephyr/net/lwm2m.h>

External power supply off.

◆ LWM2M_DEVICE_ERROR_GPS_FAILURE

#define LWM2M_DEVICE_ERROR_GPS_FAILURE   3

#include <zephyr/net/lwm2m.h>

GPS module failure.

◆ LWM2M_DEVICE_ERROR_LOW_POWER

#define LWM2M_DEVICE_ERROR_LOW_POWER   1

#include <zephyr/net/lwm2m.h>

Low battery power.

◆ LWM2M_DEVICE_ERROR_LOW_SIGNAL_STRENGTH

#define LWM2M_DEVICE_ERROR_LOW_SIGNAL_STRENGTH   4

#include <zephyr/net/lwm2m.h>

Low received signal strength.

◆ LWM2M_DEVICE_ERROR_NETWORK_FAILURE

#define LWM2M_DEVICE_ERROR_NETWORK_FAILURE   7

#include <zephyr/net/lwm2m.h>

IP Connectivity failure.

◆ LWM2M_DEVICE_ERROR_NONE

#define LWM2M_DEVICE_ERROR_NONE   0

#include <zephyr/net/lwm2m.h>

No error.

◆ LWM2M_DEVICE_ERROR_OUT_OF_MEMORY

#define LWM2M_DEVICE_ERROR_OUT_OF_MEMORY   5

#include <zephyr/net/lwm2m.h>

Out of memory.

◆ LWM2M_DEVICE_ERROR_PERIPHERAL_FAILURE

#define LWM2M_DEVICE_ERROR_PERIPHERAL_FAILURE   8

#include <zephyr/net/lwm2m.h>

Peripheral malfunction.

◆ LWM2M_DEVICE_ERROR_SMS_FAILURE

#define LWM2M_DEVICE_ERROR_SMS_FAILURE   6

#include <zephyr/net/lwm2m.h>

SMS failure.

◆ LWM2M_DEVICE_PWR_SRC_TYPE_AC_POWER

#define LWM2M_DEVICE_PWR_SRC_TYPE_AC_POWER   6

#include <zephyr/net/lwm2m.h>

AC (mains) power.

◆ LWM2M_DEVICE_PWR_SRC_TYPE_BAT_EXT

#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_EXT   2

#include <zephyr/net/lwm2m.h>

External battery.

◆ LWM2M_DEVICE_PWR_SRC_TYPE_BAT_INT

#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_INT   1

#include <zephyr/net/lwm2m.h>

Internal battery.

◆ LWM2M_DEVICE_PWR_SRC_TYPE_DC_POWER

#define LWM2M_DEVICE_PWR_SRC_TYPE_DC_POWER   0

#include <zephyr/net/lwm2m.h>

DC power.

◆ LWM2M_DEVICE_PWR_SRC_TYPE_FUEL_CELL

#define LWM2M_DEVICE_PWR_SRC_TYPE_FUEL_CELL   3

#include <zephyr/net/lwm2m.h>

Fuel cell.

◆ LWM2M_DEVICE_PWR_SRC_TYPE_MAX

#define LWM2M_DEVICE_PWR_SRC_TYPE_MAX   8

#include <zephyr/net/lwm2m.h>

Max value for Available Power Source type.

◆ LWM2M_DEVICE_PWR_SRC_TYPE_PWR_OVER_ETH

#define LWM2M_DEVICE_PWR_SRC_TYPE_PWR_OVER_ETH   4

#include <zephyr/net/lwm2m.h>

Power over Ethernet.

◆ LWM2M_DEVICE_PWR_SRC_TYPE_SOLAR

#define LWM2M_DEVICE_PWR_SRC_TYPE_SOLAR   7

#include <zephyr/net/lwm2m.h>

Solar.

◆ LWM2M_DEVICE_PWR_SRC_TYPE_USB

#define LWM2M_DEVICE_PWR_SRC_TYPE_USB   5

#include <zephyr/net/lwm2m.h>

USB.

◆ LWM2M_HAS_RES_FLAG

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

#include <zephyr/net/lwm2m.h>

Read resource flags helper macro.

◆ LWM2M_MAX_PATH_STR_SIZE

#define LWM2M_MAX_PATH_STR_SIZE   sizeof("/65535/65535/65535/65535")

#include <zephyr/net/lwm2m.h>

LwM2M path maximum length.

◆ LWM2M_OBJECT_ACCESS_CONTROL_ID

#define LWM2M_OBJECT_ACCESS_CONTROL_ID   2

#include <zephyr/net/lwm2m.h>

Access Control object.

◆ LWM2M_OBJECT_BINARYAPPDATACONTAINER_ID

#define LWM2M_OBJECT_BINARYAPPDATACONTAINER_ID   19

#include <zephyr/net/lwm2m.h>

Binary App Data Container object.

◆ LWM2M_OBJECT_CONNECTIVITY_MONITORING_ID

#define LWM2M_OBJECT_CONNECTIVITY_MONITORING_ID   4

#include <zephyr/net/lwm2m.h>

Connectivity Monitoring object.

◆ LWM2M_OBJECT_CONNECTIVITY_STATISTICS_ID

#define LWM2M_OBJECT_CONNECTIVITY_STATISTICS_ID   7

#include <zephyr/net/lwm2m.h>

Connectivity Statistics object.

◆ LWM2M_OBJECT_DEVICE_ID

#define LWM2M_OBJECT_DEVICE_ID   3

#include <zephyr/net/lwm2m.h>

Device object.

◆ LWM2M_OBJECT_EVENT_LOG_ID

#define LWM2M_OBJECT_EVENT_LOG_ID   20

#include <zephyr/net/lwm2m.h>

Event Log object.

◆ LWM2M_OBJECT_FIRMWARE_ID

#define LWM2M_OBJECT_FIRMWARE_ID   5

#include <zephyr/net/lwm2m.h>

Firmware object.

◆ LWM2M_OBJECT_GATEWAY_ID

#define LWM2M_OBJECT_GATEWAY_ID   25

#include <zephyr/net/lwm2m.h>

Gateway object.

◆ LWM2M_OBJECT_LOCATION_ID

#define LWM2M_OBJECT_LOCATION_ID   6

#include <zephyr/net/lwm2m.h>

Location object.

◆ LWM2M_OBJECT_OSCORE_ID

#define LWM2M_OBJECT_OSCORE_ID   21

#include <zephyr/net/lwm2m.h>

OSCORE object.

◆ LWM2M_OBJECT_PORTFOLIO_ID

#define LWM2M_OBJECT_PORTFOLIO_ID   16

#include <zephyr/net/lwm2m.h>

Portfolio object.

◆ LWM2M_OBJECT_SECURITY_ID

#define LWM2M_OBJECT_SECURITY_ID   0

#include <zephyr/net/lwm2m.h>

Security object.

◆ LWM2M_OBJECT_SERVER_ID

#define LWM2M_OBJECT_SERVER_ID   1

#include <zephyr/net/lwm2m.h>

Server object.

◆ LWM2M_OBJECT_SOFTWARE_MANAGEMENT_ID

#define LWM2M_OBJECT_SOFTWARE_MANAGEMENT_ID   9

#include <zephyr/net/lwm2m.h>

Software Management object.

◆ LWM2M_OBJLNK_MAX_ID

#define LWM2M_OBJLNK_MAX_ID   USHRT_MAX

#include <zephyr/net/lwm2m.h>

Maximum value for Objlnk resource fields.

◆ LWM2M_RD_CLIENT_FLAG_BOOTSTRAP

#define LWM2M_RD_CLIENT_FLAG_BOOTSTRAP   BIT(0)

#include <zephyr/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 <zephyr/net/lwm2m.h>

Resource read-only flag.

◆ LWM2M_RES_DATA_READ_ONLY

#define LWM2M_RES_DATA_READ_ONLY   0

#include <zephyr/net/lwm2m.h>

Resource read-only value bit.

◆ RESULT_CONNECTION_LOST

#define RESULT_CONNECTION_LOST   4

#include <zephyr/net/lwm2m.h>

Connection lost during downloading process.

◆ RESULT_DEFAULT

#define RESULT_DEFAULT   0

#include <zephyr/net/lwm2m.h>

Initial value.

◆ RESULT_INTEGRITY_FAILED

#define RESULT_INTEGRITY_FAILED   5

#include <zephyr/net/lwm2m.h>

Integrity check failure for new downloaded package.

◆ RESULT_INVALID_URI

#define RESULT_INVALID_URI   7

#include <zephyr/net/lwm2m.h>

Invalid URI.

◆ RESULT_NO_STORAGE

#define RESULT_NO_STORAGE   2

#include <zephyr/net/lwm2m.h>

Not enough flash memory for the new firmware package.

◆ RESULT_OUT_OF_MEM

#define RESULT_OUT_OF_MEM   3

#include <zephyr/net/lwm2m.h>

Out of RAM during downloading process.

◆ RESULT_SUCCESS

#define RESULT_SUCCESS   1

#include <zephyr/net/lwm2m.h>

Firmware updated successfully.

◆ RESULT_UNSUP_FW

#define RESULT_UNSUP_FW   6

#include <zephyr/net/lwm2m.h>

Unsupported package type.

◆ RESULT_UNSUP_PROTO

#define RESULT_UNSUP_PROTO   9

#include <zephyr/net/lwm2m.h>

Unsupported protocol.

◆ RESULT_UPDATE_FAILED

#define RESULT_UPDATE_FAILED   8

#include <zephyr/net/lwm2m.h>

Firmware update failed.

◆ STATE_DOWNLOADED

#define STATE_DOWNLOADED   2

#include <zephyr/net/lwm2m.h>

Downloaded.

The whole data sequence has been downloaded.

◆ STATE_DOWNLOADING

#define STATE_DOWNLOADING   1

#include <zephyr/net/lwm2m.h>

Downloading.

The data sequence is being downloaded.

◆ STATE_IDLE

#define STATE_IDLE   0

#include <zephyr/net/lwm2m.h>

Idle.

Before downloading or after successful updating.

◆ STATE_UPDATING

#define STATE_UPDATING   3

#include <zephyr/net/lwm2m.h>

Updating.

The device is being updated.

◆ UCIFI_OBJECT_BATTERY_ID

#define UCIFI_OBJECT_BATTERY_ID   3411

#include <zephyr/net/lwm2m.h>

uCIFI Battery object

Typedef Documentation

◆ lwm2m_ctx_event_cb_t

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

#include <zephyr/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 <zephyr/net/lwm2m.h>

Asynchronous execute notification callback.

Resource executes trigger a callback of this type.

Register a function of this type via: lwm2m_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 <zephyr/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_register_read_callback() lwm2m_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, size_t offset)

#include <zephyr/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.

On a block-wise transfers the handler is called multiple times with the data blocks and increasing offset. The last block has the last_block flag set to true. Beginning of the block transfer has the offset set to 0.

A function of this type can be registered via: lwm2m_register_validate_callback() lwm2m_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.
[in]offsetOffset of the data block. For non-block transfers this is always 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 <zephyr/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_register_create_callback() lwm2m_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_observe_cb_t

typedef void(* lwm2m_observe_cb_t) (enum lwm2m_observe_event event, struct lwm2m_obj_path *path, void *user_data)

#include <zephyr/net/lwm2m.h>

Observe callback indicating observer adds and deletes, and notification ACKs and timeouts.

Parameters
[in]eventObserver add/delete or notification ack/timeout
[in]pathLwM2M path
[in]user_dataPointer to user_data buffer, as provided in send_traceable_notification(). Used to determine for which data the ACKed/timed out notification was.

◆ lwm2m_send_cb_t

lwm2m_send_cb_t

#include <zephyr/net/lwm2m.h>

Callback returning send status.

◆ lwm2m_socket_fault_cb_t

typedef void(* lwm2m_socket_fault_cb_t) (int error)

#include <zephyr/net/lwm2m.h>

Callback function called when a socket error is encountered.

Parameters
errorError code

Enumeration Type Documentation

◆ lwm2m_observe_event

#include <zephyr/net/lwm2m.h>

Observe callback events.

Enumerator
LWM2M_OBSERVE_EVENT_OBSERVER_ADDED 

Observer added.

LWM2M_OBSERVE_EVENT_OBSERVER_REMOVED 

Observer removed.

LWM2M_OBSERVE_EVENT_NOTIFY_ACK 

Notification ACKed.

LWM2M_OBSERVE_EVENT_NOTIFY_TIMEOUT 

Notification timed out.

◆ lwm2m_rd_client_event

#include <zephyr/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 

Invalid event.

LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE 

Bootstrap registration failure.

LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_COMPLETE 

Bootstrap registration complete.

LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_TRANSFER_COMPLETE 

Bootstrap transfer complete.

LWM2M_RD_CLIENT_EVENT_REGISTRATION_FAILURE 

Registration failure.

LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE 

Registration complete.

LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT 

Registration timeout.

LWM2M_RD_CLIENT_EVENT_REG_UPDATE_COMPLETE 

Registration update complete.

LWM2M_RD_CLIENT_EVENT_DEREGISTER_FAILURE 

De-registration failure.

LWM2M_RD_CLIENT_EVENT_DISCONNECT 

Disconnected.

LWM2M_RD_CLIENT_EVENT_QUEUE_MODE_RX_OFF 

Queue mode RX off.

LWM2M_RD_CLIENT_EVENT_ENGINE_SUSPENDED 

Engine suspended.

LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR 

Network error.

LWM2M_RD_CLIENT_EVENT_REG_UPDATE 

Registration update.

LWM2M_RD_CLIENT_EVENT_DEREGISTER 

De-register.

LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED 

Server disabled.

◆ lwm2m_security_mode_e

#include <zephyr/net/lwm2m.h>

Security modes as defined in LwM2M Security object.

Enumerator
LWM2M_SECURITY_PSK 

Pre-Shared Key mode.

LWM2M_SECURITY_RAW_PK 

Raw Public Key mode.

LWM2M_SECURITY_CERT 

Certificate mode.

LWM2M_SECURITY_NOSEC 

NoSec mode.

LWM2M_SECURITY_CERT_EST 

Certificate mode with EST.

◆ lwm2m_send_status

#include <zephyr/net/lwm2m.h>

LwM2M send status.

LwM2M send status are generated back to the lwm2m_send_cb_t function in lwm2m_send_cb()

Enumerator
LWM2M_SEND_STATUS_SUCCESS 

Succeed.

LWM2M_SEND_STATUS_FAILURE 

Failure.

LWM2M_SEND_STATUS_TIMEOUT 

Timeout.

◆ lwm2m_socket_states

#include <zephyr/net/lwm2m.h>

Different traffic states of the LwM2M socket.

This information can be used to give hints for the network interface that can decide what kind of power management should be used.

These hints are given from CoAP layer messages, so usage of DTLS might affect the actual number of expected datagrams.

Enumerator
LWM2M_SOCKET_STATE_ONGOING 

Ongoing traffic is expected.

LWM2M_SOCKET_STATE_ONE_RESPONSE 

One response is expected for the next message.

LWM2M_SOCKET_STATE_LAST 

Next message is the last one.

LWM2M_SOCKET_STATE_NO_DATA 

No more data is expected.

Function Documentation

◆ lwm2m_acknowledge()

void lwm2m_acknowledge ( struct lwm2m_ctx client_ctx)

#include <zephyr/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_create_object_inst()

int lwm2m_create_object_inst ( const struct lwm2m_obj_path path)

#include <zephyr/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_create_obj_inst(&LWM2M_OBJ(3303, 0));

Parameters
[in]pathLwM2M path as a struct
Returns
0 for success or negative in case of error.

◆ lwm2m_create_res_inst()

int lwm2m_create_res_inst ( const struct lwm2m_obj_path path)

#include <zephyr/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_create_res_inst(&LWM2M_OBJ(3, 0, 6, 0));

Parameters
[in]pathLwM2M path as a struct
Returns
0 for success or negative in case of error.

◆ lwm2m_delete_object_inst()

int lwm2m_delete_object_inst ( const struct lwm2m_obj_path path)

#include <zephyr/net/lwm2m.h>

Delete an LwM2M object instance.

LwM2M clients use this function to delete LwM2M objects.

Parameters
[in]pathLwM2M path as a struct
Returns
0 for success or negative in case of error.

◆ lwm2m_delete_res_inst()

int lwm2m_delete_res_inst ( const struct lwm2m_obj_path path)

#include <zephyr/net/lwm2m.h>

Delete a resource instance.

Use this function to remove an existing resource instance

Parameters
[in]pathLwM2M path as a struct
Returns
0 for success or negative in case of error.

◆ lwm2m_device_add_err()

int lwm2m_device_add_err ( uint8_t  error_code)

#include <zephyr/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_enable_cache()

int lwm2m_enable_cache ( const struct lwm2m_obj_path path,
struct lwm2m_time_series_elem data_cache,
size_t  cache_len 
)

#include <zephyr/net/lwm2m.h>

 

 Enable data cache for a resource.

Application may enable caching of resource data by allocating buffer for LwM2M engine to use. Buffer must be size of struct lwm2m_time_series_elem times cache_len

Parameters
pathLwM2M path to resource as a struct
data_cachePointer to Data cache array
cache_lennumber of cached entries

 

Returns
0 for success or negative in case of error.

◆ lwm2m_engine_pause()

int lwm2m_engine_pause ( void  )

#include <zephyr/net/lwm2m.h>

Suspend the LwM2M engine Thread.

Suspend LwM2M engine. Use case could be when network connection is down. LwM2M Engine indicate before it suspend by LWM2M_RD_CLIENT_EVENT_ENGINE_SUSPENDED event.

Returns
0 for success or negative in case of error.

◆ lwm2m_engine_resume()

int lwm2m_engine_resume ( void  )

#include <zephyr/net/lwm2m.h>

Resume the LwM2M engine thread.

Resume suspended LwM2M engine. After successful resume call engine will do full registration or registration update based on suspended time. Event's LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE or LWM2M_RD_CLIENT_EVENT_REG_UPDATE_COMPLETE indicate that client is connected to server.

Returns
0 for success or negative in case of error.

◆ lwm2m_engine_start()

int lwm2m_engine_start ( struct lwm2m_ctx client_ctx)

#include <zephyr/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_stop()

int lwm2m_engine_stop ( struct lwm2m_ctx client_ctx)

#include <zephyr/net/lwm2m.h>

Stop the LwM2M engine.

LwM2M clients normally do not need to call this function as it is called within lwm2m_rd_client. 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_event_log_set_read_log_data_cb()

void lwm2m_event_log_set_read_log_data_cb ( lwm2m_engine_get_data_cb_t  cb)

#include <zephyr/net/lwm2m.h>

Set callback to read log data.

The callback will be executed when the LWM2M read operation gets called on the corresponding object.

Parameters
[in]cbA callback function for handling the read event.

◆ lwm2m_firmware_get_cancel_cb()

lwm2m_engine_user_cb_t lwm2m_firmware_get_cancel_cb ( void  )

#include <zephyr/net/lwm2m.h>

Get a callback for firmware update cancel.

Returns
A registered callback function perform actions on firmware update cancel.

◆ lwm2m_firmware_get_cancel_cb_inst()

lwm2m_engine_user_cb_t lwm2m_firmware_get_cancel_cb_inst ( uint16_t  obj_inst_id)

#include <zephyr/net/lwm2m.h>

Get the callback for firmware update cancel.

Parameters
[in]obj_inst_idObject instance ID
Returns
A registered callback function perform actions on firmware update cancel.

◆ lwm2m_firmware_get_update_cb()

lwm2m_engine_execute_cb_t lwm2m_firmware_get_update_cb ( void  )

#include <zephyr/net/lwm2m.h>

Get the event callback for firmware update execute events.

Returns
A registered callback function to receive the execute event.

◆ lwm2m_firmware_get_update_cb_inst()

lwm2m_engine_execute_cb_t lwm2m_firmware_get_update_cb_inst ( uint16_t  obj_inst_id)

#include <zephyr/net/lwm2m.h>

Get the event callback for firmware update execute events.

Parameters
[in]obj_inst_idObject instance ID
Returns
A registered callback function to receive the execute event.

◆ lwm2m_firmware_get_write_cb()

lwm2m_engine_set_data_cb_t lwm2m_firmware_get_write_cb ( void  )

#include <zephyr/net/lwm2m.h>

Get the data callback for firmware block transfer writes.

Returns
A registered callback function to receive the block transfer data

◆ lwm2m_firmware_get_write_cb_inst()

lwm2m_engine_set_data_cb_t lwm2m_firmware_get_write_cb_inst ( uint16_t  obj_inst_id)

#include <zephyr/net/lwm2m.h>

Get the data callback for firmware block transfer writes.

Parameters
[in]obj_inst_idObject instance ID
Returns
A registered callback function to receive the block transfer data

◆ lwm2m_firmware_set_cancel_cb()

void lwm2m_firmware_set_cancel_cb ( lwm2m_engine_user_cb_t  cb)

#include <zephyr/net/lwm2m.h>

Set callback for firmware update cancel.

LwM2M clients use this function to register a callback to perform actions on firmware update cancel.

Parameters
[in]cbA callback function perform actions on firmware update cancel.

◆ lwm2m_firmware_set_cancel_cb_inst()

void lwm2m_firmware_set_cancel_cb_inst ( uint16_t  obj_inst_id,
lwm2m_engine_user_cb_t  cb 
)

#include <zephyr/net/lwm2m.h>

Set data callback for firmware update cancel.

LwM2M clients use this function to register a callback to perform actions on firmware update cancel.

Parameters
[in]obj_inst_idObject instance ID
[in]cbA callback function perform actions on firmware update cancel.

◆ lwm2m_firmware_set_update_cb()

void lwm2m_firmware_set_update_cb ( lwm2m_engine_execute_cb_t  cb)

#include <zephyr/net/lwm2m.h>

Set data callback to handle firmware update execute events.

LwM2M clients use this function to register a callback for receiving the update resource "execute" operation on the LwM2M Firmware Update object.

Parameters
[in]cbA callback function to receive the execute event.

◆ lwm2m_firmware_set_update_cb_inst()

void lwm2m_firmware_set_update_cb_inst ( uint16_t  obj_inst_id,
lwm2m_engine_execute_cb_t  cb 
)

#include <zephyr/net/lwm2m.h>

Set data callback to handle firmware update execute events.

LwM2M clients use this function to register a callback for receiving the update resource "execute" operation on the LwM2M Firmware Update object.

Parameters
[in]obj_inst_idObject instance ID
[in]cbA callback function to receive the execute event.

◆ lwm2m_firmware_set_write_cb()

void lwm2m_firmware_set_write_cb ( lwm2m_engine_set_data_cb_t  cb)

#include <zephyr/net/lwm2m.h>

Set data callback for firmware block transfer.

LwM2M clients use this function to register a callback for receiving the block transfer data when performing a firmware update.

Parameters
[in]cbA callback function to receive the block transfer data

◆ lwm2m_firmware_set_write_cb_inst()

void lwm2m_firmware_set_write_cb_inst ( uint16_t  obj_inst_id,
lwm2m_engine_set_data_cb_t  cb 
)

#include <zephyr/net/lwm2m.h>

Set data callback for firmware block transfer.

LwM2M clients use this function to register a callback for receiving the block transfer data when performing a firmware update.

Parameters
[in]obj_inst_idObject instance ID
[in]cbA callback function to receive the block transfer data

◆ lwm2m_get_bool()

int lwm2m_get_bool ( const struct lwm2m_obj_path path,
bool value 
)

#include <zephyr/net/lwm2m.h>

Get resource (instance) value (bool)

Parameters
[in]pathLwM2M path as a struct
[out]valuebool buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_get_f64()

int lwm2m_get_f64 ( const struct lwm2m_obj_path path,
double *  value 
)

#include <zephyr/net/lwm2m.h>

Get resource (instance) value (double)

Parameters
[in]pathLwM2M path as a struct
[out]valuedouble buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_get_objlnk()

int lwm2m_get_objlnk ( const struct lwm2m_obj_path path,
struct lwm2m_objlnk buf 
)

#include <zephyr/net/lwm2m.h>

Get resource (instance) value (Objlnk)

Parameters
[in]pathLwM2M path as a struct
[out]buflwm2m_objlnk buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_get_opaque()

int lwm2m_get_opaque ( const struct lwm2m_obj_path path,
void *  buf,
uint16_t  buflen 
)

#include <zephyr/net/lwm2m.h>

Get resource (instance) value (opaque buffer)

Parameters
[in]pathLwM2M path as a struct
[out]bufData buffer to copy data into
[in]buflenLength of buffer
Returns
0 for success or negative in case of error.

◆ lwm2m_get_res_buf()

int lwm2m_get_res_buf ( const struct lwm2m_obj_path path,
void **  buffer_ptr,
uint16_t buffer_len,
uint16_t data_len,
uint8_t data_flags 
)

#include <zephyr/net/lwm2m.h>

Get data buffer for a resource.

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

If you directly write into the buffer, you must use lwm2m_set_res_data_len() function to update the new size of the written data.

All parameters, except for the pathstr, can be NULL if you don't want to read those values.

Parameters
[in]pathLwM2M path as a struct
[out]buffer_ptrData buffer pointer
[out]buffer_lenLength of buffer
[out]data_lenLength of existing data in the buffer
[out]data_flagsData buffer flags (such as read-only, etc)
Returns
0 for success or negative in case of error.

◆ lwm2m_get_s16()

int lwm2m_get_s16 ( const struct lwm2m_obj_path path,
int16_t value 
)

#include <zephyr/net/lwm2m.h>

Get resource (instance) value (s16)

Parameters
[in]pathLwM2M path as a struct
[out]values16 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_get_s32()

int lwm2m_get_s32 ( const struct lwm2m_obj_path path,
int32_t value 
)

#include <zephyr/net/lwm2m.h>

Get resource (instance) value (s32)

Parameters
[in]pathLwM2M path as a struct
[out]values32 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_get_s64()

int lwm2m_get_s64 ( const struct lwm2m_obj_path path,
int64_t value 
)

#include <zephyr/net/lwm2m.h>

Get resource (instance) value (s64)

Parameters
[in]pathLwM2M path as a struct
[out]values64 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_get_s8()

int lwm2m_get_s8 ( const struct lwm2m_obj_path path,
int8_t value 
)

#include <zephyr/net/lwm2m.h>

Get resource (instance) value (s8)

Parameters
[in]pathLwM2M path as a struct
[out]values8 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_get_string()

int lwm2m_get_string ( const struct lwm2m_obj_path path,
void *  str,
uint16_t  buflen 
)

#include <zephyr/net/lwm2m.h>

Get resource (instance) value (string)

Parameters
[in]pathLwM2M path as a struct
[out]strString buffer to copy data into
[in]buflenLength of buffer
Returns
0 for success or negative in case of error.

◆ lwm2m_get_time()

int lwm2m_get_time ( const struct lwm2m_obj_path path,
time_t buf 
)

#include <zephyr/net/lwm2m.h>

Get resource (instance) value (Time)

Parameters
[in]pathLwM2M path as a struct
[out]buftime_t pointer to copy data
Returns
0 for success or negative in case of error.

◆ lwm2m_get_u16()

int lwm2m_get_u16 ( const struct lwm2m_obj_path path,
uint16_t value 
)

#include <zephyr/net/lwm2m.h>

Get resource (instance) value (u16)

Parameters
[in]pathLwM2M path as a struct
[out]valueu16 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_get_u32()

int lwm2m_get_u32 ( const struct lwm2m_obj_path path,
uint32_t value 
)

#include <zephyr/net/lwm2m.h>

Get resource (instance) value (u32)

Parameters
[in]pathLwM2M path as a struct
[out]valueu32 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_get_u64()

int lwm2m_get_u64 ( const struct lwm2m_obj_path path,
uint64_t value 
)

#include <zephyr/net/lwm2m.h>

Get resource (instance) value (u64)

Deprecated:
Unsigned 64bit value type does not exits. This is internally handled as a int64_t. Use lwm2m_get_s64() instead.
Parameters
[in]pathLwM2M path as a struct
[out]valueu64 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_get_u8()

int lwm2m_get_u8 ( const struct lwm2m_obj_path path,
uint8_t value 
)

#include <zephyr/net/lwm2m.h>

Get resource (instance) value (u8)

Parameters
[in]pathLwM2M path as a struct
[out]valueu8 buffer to copy data into
Returns
0 for success or negative in case of error.

◆ lwm2m_path_is_observed()

bool lwm2m_path_is_observed ( const struct lwm2m_obj_path path)

#include <zephyr/net/lwm2m.h>

Check whether a path is observed.

Parameters
[in]pathLwM2M path as a struct to check
Returns
true when there exists an observation of the same level or lower as the given path, false if it doesn't or path is not a valid LwM2M-path. E.g. true if path refers to a resource and the parent object has an observation, false for the inverse.

◆ lwm2m_path_log_buf()

char * lwm2m_path_log_buf ( char *  buf,
struct lwm2m_obj_path path 
)

#include <zephyr/net/lwm2m.h>

Helper function to print path objects' contents to log.

Parameters
[in]bufThe buffer to use for formatting the string
[in]pathThe path to stringify
Returns
Resulting formatted path string

◆ lwm2m_rd_client_ctx()

struct lwm2m_ctx * lwm2m_rd_client_ctx ( void  )

#include <zephyr/net/lwm2m.h>

 

 Returns LwM2M client context

Returns
ctx LwM2M context

◆ lwm2m_rd_client_start()

int lwm2m_rd_client_start ( struct lwm2m_ctx client_ctx,
const char *  ep_name,
uint32_t  flags,
lwm2m_ctx_event_cb_t  event_cb,
lwm2m_observe_cb_t  observe_cb 
)

#include <zephyr/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 "Client Registration Interface" of 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
[in]observe_cbObserve callback function called when an observer was added or deleted, and when a notification was acked or has timed out
Returns
0 for success, -EINPROGRESS when client is already running or negative error codes in case of failure.

◆ lwm2m_rd_client_stop()

int lwm2m_rd_client_stop ( struct lwm2m_ctx client_ctx,
lwm2m_ctx_event_cb_t  event_cb,
bool  deregister 
)

#include <zephyr/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 "Client Registration Interface" of the LwM2M Technical Specification.

Parameters
[in]client_ctxLwM2M context
[in]event_cbClient event callback function
[in]deregisterTrue to deregister the client if registered. False to force close the connection.
Returns
0 for success or negative in case of error.

◆ lwm2m_rd_client_update()

void lwm2m_rd_client_update ( void  )

#include <zephyr/net/lwm2m.h>

Trigger a Registration Update of the LwM2M RD Client.

◆ lwm2m_register_create_callback()

int lwm2m_register_create_callback ( uint16_t  obj_id,
lwm2m_engine_user_cb_t  cb 
)

#include <zephyr/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_register_delete_callback()

int lwm2m_register_delete_callback ( uint16_t  obj_id,
lwm2m_engine_user_cb_t  cb 
)

#include <zephyr/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_register_exec_callback()

int lwm2m_register_exec_callback ( const struct lwm2m_obj_path path,
lwm2m_engine_execute_cb_t  cb 
)

#include <zephyr/net/lwm2m.h>

Set resource execute event callback.

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

Parameters
[in]pathLwM2M path as a struct
[in]cbExecute resource callback
Returns
0 for success or negative in case of error.

◆ lwm2m_register_post_write_callback()

int lwm2m_register_post_write_callback ( const struct lwm2m_obj_path path,
lwm2m_engine_set_data_cb_t  cb 
)

#include <zephyr/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]pathLwM2M path as a struct
[in]cbPost-write resource callback
Returns
0 for success or negative in case of error.

◆ lwm2m_register_pre_write_callback()

int lwm2m_register_pre_write_callback ( const struct lwm2m_obj_path path,
lwm2m_engine_get_data_cb_t  cb 
)

#include <zephyr/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]pathLwM2M path as a struct
[in]cbPre-write resource callback
Returns
0 for success or negative in case of error.

◆ lwm2m_register_read_callback()

int lwm2m_register_read_callback ( const struct lwm2m_obj_path path,
lwm2m_engine_get_data_cb_t  cb 
)

#include <zephyr/net/lwm2m.h>

Set resource (instance) read callback.

LwM2M clients can use this to set the callback function for resource reads when data handling in the LwM2M engine needs to be bypassed. For example reading back opaque binary data from external storage.

This callback should not generally be used for any data that might be observed as engine does not have any knowledge of data changes.

When separate buffer for data should be used, use lwm2m_set_res_buf() instead to set the storage.

Parameters
[in]pathLwM2M path as a struct
[in]cbRead resource callback
Returns
0 for success or negative in case of error.

◆ lwm2m_register_validate_callback()

int lwm2m_register_validate_callback ( const struct lwm2m_obj_path path,
lwm2m_engine_set_data_cb_t  cb 
)

#include <zephyr/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]pathLwM2M path as a struct
[in]cbValidate resource data callback
Returns
0 for success or negative in case of error.

◆ lwm2m_registry_lock()

void lwm2m_registry_lock ( void  )

#include <zephyr/net/lwm2m.h>

Locks the registry for this thread.

Use this function before writing to multiple resources. This halts the lwm2m main thread until all the write-operations are finished.

◆ lwm2m_registry_unlock()

void lwm2m_registry_unlock ( void  )

#include <zephyr/net/lwm2m.h>

Unlocks the registry previously locked by lwm2m_registry_lock().

◆ lwm2m_security_mode()

int lwm2m_security_mode ( struct lwm2m_ctx ctx)

#include <zephyr/net/lwm2m.h>

Read security mode from selected security object instance.

This data is valid only if RD client is running.

Parameters
ctxPointer to client context.
Returns
int Positive values are lwm2m_security_mode_e, negative error codes otherwise.

◆ lwm2m_send_cb()

int lwm2m_send_cb ( struct lwm2m_ctx ctx,
const struct lwm2m_obj_path  path_list[],
uint8_t  path_list_size,
lwm2m_send_cb_t  reply_cb 
)

#include <zephyr/net/lwm2m.h>

 

 LwM2M SEND operation to given path list asynchronously with confirmation callback

Parameters
ctxLwM2M context
path_listLwM2M path struct list
path_list_sizeLength of path list. Max size is CONFIG_LWM2M_COMPOSITE_PATH_LIST_SIZE
reply_cbCallback triggered with confirmation state or NULL if not used

 

Returns
0 for success or negative in case of error.

◆ lwm2m_set_bool()

int lwm2m_set_bool ( const struct lwm2m_obj_path path,
bool  value 
)

#include <zephyr/net/lwm2m.h>

Set resource (instance) value (bool)

Parameters
[in]pathLwM2M path as a struct
[in]valuebool value
Returns
0 for success or negative in case of error.

◆ lwm2m_set_bulk()

int lwm2m_set_bulk ( const struct lwm2m_res_item  res_list[],
size_t  res_list_size 
)

#include <zephyr/net/lwm2m.h>

Set multiple resource (instance) values.

NOTE: Value type must match the target resource as this function does not do any type conversion. See struct lwm2m_res_item for list of resource types.

Parameters
[in]res_listLwM2M resource item list
[in]res_list_sizeLength of resource list
Returns
0 for success or negative in case of error.

◆ lwm2m_set_default_sockopt()

int lwm2m_set_default_sockopt ( struct lwm2m_ctx ctx)

#include <zephyr/net/lwm2m.h>

Set default socket options for DTLS connections.

The engine calls this when lwm2m_ctx::set_socketoptions is not overwritten. You can call this from the overwritten callback to set extra options after or before defaults.

Parameters
ctxClient context
Returns
0 for success or negative in case of error.

◆ lwm2m_set_f64()

int lwm2m_set_f64 ( const struct lwm2m_obj_path path,
const double  value 
)

#include <zephyr/net/lwm2m.h>

Set resource (instance) value (double)

Parameters
[in]pathLwM2M path as a struct
[in]valuedouble value
Returns
0 for success or negative in case of error.

◆ lwm2m_set_objlnk()

int lwm2m_set_objlnk ( const struct lwm2m_obj_path path,
const struct lwm2m_objlnk value 
)

#include <zephyr/net/lwm2m.h>

Set resource (instance) value (Objlnk)

Parameters
[in]pathLwM2M path as a struct
[in]valuepointer to the lwm2m_objlnk structure
Returns
0 for success or negative in case of error.

◆ lwm2m_set_opaque()

int lwm2m_set_opaque ( const struct lwm2m_obj_path path,
const char *  data_ptr,
uint16_t  data_len 
)

#include <zephyr/net/lwm2m.h>

Set resource (instance) value (opaque buffer)

Parameters
[in]pathLwM2M path as a struct
[in]data_ptrData buffer
[in]data_lenLength of buffer
Returns
0 for success or negative in case of error.

◆ lwm2m_set_res_buf()

int lwm2m_set_res_buf ( const struct lwm2m_obj_path path,
void *  buffer_ptr,
uint16_t  buffer_len,
uint16_t  data_len,
uint8_t  data_flags 
)

#include <zephyr/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]pathLwM2M path as a struct
[in]buffer_ptrData buffer pointer
[in]buffer_lenLength of buffer
[in]data_lenLength of existing data in the buffer
[in]data_flagsData buffer flags (such as read-only, etc)
Returns
0 for success or negative in case of error.

◆ lwm2m_set_res_data_len()

int lwm2m_set_res_data_len ( const struct lwm2m_obj_path path,
uint16_t  data_len 
)

#include <zephyr/net/lwm2m.h>

Update data size for a resource.

Use this function to set the new size of data in the buffer if you write to a buffer received by lwm2m_get_res_buf().

Parameters
[in]pathLwM2M path as a struct
[in]data_lenLength of data
Returns
0 for success or negative in case of error.

◆ lwm2m_set_s16()

int lwm2m_set_s16 ( const struct lwm2m_obj_path path,
int16_t  value 
)

#include <zephyr/net/lwm2m.h>

Set resource (instance) value (s16)

Parameters
[in]pathLwM2M path as a struct
[in]values16 value
Returns
0 for success or negative in case of error.

◆ lwm2m_set_s32()

int lwm2m_set_s32 ( const struct lwm2m_obj_path path,
int32_t  value 
)

#include <zephyr/net/lwm2m.h>

Set resource (instance) value (s32)

Parameters
[in]pathLwM2M path as a struct
[in]values32 value
Returns
0 for success or negative in case of error.

◆ lwm2m_set_s64()

int lwm2m_set_s64 ( const struct lwm2m_obj_path path,
int64_t  value 
)

#include <zephyr/net/lwm2m.h>

Set resource (instance) value (s64)

Parameters
[in]pathLwM2M path as a struct
[in]values64 value
Returns
0 for success or negative in case of error.

◆ lwm2m_set_s8()

int lwm2m_set_s8 ( const struct lwm2m_obj_path path,
int8_t  value 
)

#include <zephyr/net/lwm2m.h>

Set resource (instance) value (s8)

Parameters
[in]pathLwM2M path as a struct
[in]values8 value
Returns
0 for success or negative in case of error.

◆ lwm2m_set_string()

int lwm2m_set_string ( const struct lwm2m_obj_path path,
const char *  data_ptr 
)

#include <zephyr/net/lwm2m.h>

Set resource (instance) value (string)

Parameters
[in]pathLwM2M path as a struct
[in]data_ptrNULL terminated char buffer
Returns
0 for success or negative in case of error.

◆ lwm2m_set_time()

int lwm2m_set_time ( const struct lwm2m_obj_path path,
time_t  value 
)

#include <zephyr/net/lwm2m.h>

Set resource (instance) value (Time)

Parameters
[in]pathLwM2M path as a struct
[in]valueEpoch timestamp
Returns
0 for success or negative in case of error.

◆ lwm2m_set_u16()

int lwm2m_set_u16 ( const struct lwm2m_obj_path path,
uint16_t  value 
)

#include <zephyr/net/lwm2m.h>

Set resource (instance) value (u16)

Parameters
[in]pathLwM2M path as a struct
[in]valueu16 value
Returns
0 for success or negative in case of error.

◆ lwm2m_set_u32()

int lwm2m_set_u32 ( const struct lwm2m_obj_path path,
uint32_t  value 
)

#include <zephyr/net/lwm2m.h>

Set resource (instance) value (u32)

Parameters
[in]pathLwM2M path as a struct
[in]valueu32 value
Returns
0 for success or negative in case of error.

◆ lwm2m_set_u64()

int lwm2m_set_u64 ( const struct lwm2m_obj_path path,
uint64_t  value 
)

#include <zephyr/net/lwm2m.h>

Set resource (instance) value (u64)

Deprecated:
Unsigned 64bit value type does not exits. This is internally handled as a int64_t. Use lwm2m_set_s64() instead.
Parameters
[in]pathLwM2M path as a struct
[in]valueu64 value
Returns
0 for success or negative in case of error.

◆ lwm2m_set_u8()

int lwm2m_set_u8 ( const struct lwm2m_obj_path path,
uint8_t  value 
)

#include <zephyr/net/lwm2m.h>

Set resource (instance) value (u8)

Parameters
[in]pathLwM2M path as a struct
[in]valueu8 value
Returns
0 for success or negative in case of error.

◆ lwm2m_swmgmt_install_completed()

int lwm2m_swmgmt_install_completed ( uint16_t  obj_inst_id,
int  error_code 
)

#include <zephyr/net/lwm2m.h>

Function to be called when a Software Management object instance completed the Install operation.

Parameters
[in]obj_inst_idThe Software Management object instance
[in]error_codeThe result code of the operation. Zero on success otherwise it should be a negative integer.

return 0 on success, otherwise a negative integer.

◆ lwm2m_swmgmt_set_activate_cb()

int lwm2m_swmgmt_set_activate_cb ( uint16_t  obj_inst_id,
lwm2m_engine_execute_cb_t  cb 
)

#include <zephyr/net/lwm2m.h>

Set callback to handle software activation requests.

The callback will be executed when the LWM2M execute operation gets called on the corresponding object's Activate resource instance.

Parameters
[in]obj_inst_idThe instance number to set the callback for.
[in]cbA callback function to receive the execute event.
Returns
0 on success, otherwise a negative integer.

◆ lwm2m_swmgmt_set_deactivate_cb()

int lwm2m_swmgmt_set_deactivate_cb ( uint16_t  obj_inst_id,
lwm2m_engine_execute_cb_t  cb 
)

#include <zephyr/net/lwm2m.h>

Set callback to handle software deactivation requests.

The callback will be executed when the LWM2M execute operation gets called on the corresponding object's Deactivate resource instance.

Parameters
[in]obj_inst_idThe instance number to set the callback for.
[in]cbA callback function to receive the execute event.
Returns
0 on success, otherwise a negative integer.

◆ lwm2m_swmgmt_set_delete_package_cb()

int lwm2m_swmgmt_set_delete_package_cb ( uint16_t  obj_inst_id,
lwm2m_engine_execute_cb_t  cb 
)

#include <zephyr/net/lwm2m.h>

Set callback to handle software uninstall requests.

The callback will be executed when the LWM2M execute operation gets called on the corresponding object's Uninstall resource instance.

Parameters
[in]obj_inst_idThe instance number to set the callback for.
[in]cbA callback function for handling the execute event.
Returns
0 on success, otherwise a negative integer.

◆ lwm2m_swmgmt_set_install_package_cb()

int lwm2m_swmgmt_set_install_package_cb ( uint16_t  obj_inst_id,
lwm2m_engine_execute_cb_t  cb 
)

#include <zephyr/net/lwm2m.h>

Set callback to handle software install requests.

The callback will be executed when the LWM2M execute operation gets called on the corresponding object's Install resource instance.

Parameters
[in]obj_inst_idThe instance number to set the callback for.
[in]cbA callback function to receive the execute event.
Returns
0 on success, otherwise a negative integer.

◆ lwm2m_swmgmt_set_read_package_version_cb()

int lwm2m_swmgmt_set_read_package_version_cb ( uint16_t  obj_inst_id,
lwm2m_engine_get_data_cb_t  cb 
)

#include <zephyr/net/lwm2m.h>

Set callback to read software package.

The callback will be executed when the LWM2M read operation gets called on the corresponding object.

Parameters
[in]obj_inst_idThe instance number to set the callback for.
[in]cbA callback function for handling the read event.
Returns
0 on success, otherwise a negative integer.

◆ lwm2m_swmgmt_set_write_package_cb()

int lwm2m_swmgmt_set_write_package_cb ( uint16_t  obj_inst_id,
lwm2m_engine_set_data_cb_t  cb 
)

#include <zephyr/net/lwm2m.h>

Set data callback for software management block transfer.

The callback will be executed when the LWM2M block write operation gets called on the corresponding object's resource instance.

Parameters
[in]obj_inst_idThe instance number to set the callback for.
[in]cbA callback function for handling the block write event.
Returns
0 on success, otherwise a negative integer.

◆ lwm2m_update_device_service_period()

int lwm2m_update_device_service_period ( uint32_t  period_ms)

#include <zephyr/net/lwm2m.h>

Update the period of the device service.

Change the duration of the periodic device service that notifies the current time.

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

◆ lwm2m_update_observer_max_period()

int lwm2m_update_observer_max_period ( struct lwm2m_ctx client_ctx,
const struct lwm2m_obj_path path,
uint32_t  period_s 
)

#include <zephyr/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__update_observer_max_period(client_ctx, &LWM2M_OBJ(3303, 0, 5700), 5);

Parameters
[in]client_ctxLwM2M context
[in]pathLwM2M path as a struct
[in]period_sValue of pmax to be given (in seconds).
Returns
0 for success or negative in case of error.

◆ lwm2m_update_observer_min_period()

int lwm2m_update_observer_min_period ( struct lwm2m_ctx client_ctx,
const struct lwm2m_obj_path path,
uint32_t  period_s 
)

#include <zephyr/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_update_observer_min_period(client_ctx, &LWM2M_OBJ(3303, 0, 5700), 5);

Parameters
[in]client_ctxLwM2M context
[in]pathLwM2M path as a struct
[in]period_sValue of pmin to be given (in seconds).
Returns
0 for success or negative in case of error.