Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
lwm2m.h File Reference

LwM2M high-level API. More...

#include <time.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/mutex.h>
#include <zephyr/net/coap.h>
#include <zephyr/net/lwm2m_path.h>

Go to the source code of this file.

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_EVENT_REG_UPDATE_FAILURE    LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT __DEPRECATED_MACRO
 Define for old event name keeping backward compatibility.
 
#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.
 
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_engine_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_engine_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.
 

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_engine_update_observer_min_period (struct lwm2m_ctx *client_ctx, const char *pathstr, uint32_t period_s)
 Change an observer's pmin value.
 
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_engine_update_observer_max_period (struct lwm2m_ctx *client_ctx, const char *pathstr, uint32_t period_s)
 Change an observer's pmax 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_engine_create_obj_inst (const char *pathstr)
 Create an LwM2M object instance.
 
int lwm2m_create_object_inst (const struct lwm2m_obj_path *path)
 Create an LwM2M object instance.
 
int lwm2m_engine_delete_obj_inst (const char *pathstr)
 Delete 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_engine_set_opaque (const char *pathstr, const char *data_ptr, uint16_t data_len)
 Set resource (instance) value (opaque buffer)
 
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_engine_set_string (const char *pathstr, const char *data_ptr)
 Set resource (instance) value (string)
 
int lwm2m_set_string (const struct lwm2m_obj_path *path, const char *data_ptr)
 Set resource (instance) value (string)
 
int lwm2m_engine_set_u8 (const char *pathstr, uint8_t value)
 Set resource (instance) value (u8)
 
int lwm2m_set_u8 (const struct lwm2m_obj_path *path, uint8_t value)
 Set resource (instance) value (u8)
 
int lwm2m_engine_set_u16 (const char *pathstr, uint16_t value)
 Set resource (instance) value (u16)
 
int lwm2m_set_u16 (const struct lwm2m_obj_path *path, uint16_t value)
 Set resource (instance) value (u16)
 
int lwm2m_engine_set_u32 (const char *pathstr, uint32_t value)
 Set resource (instance) value (u32)
 
int lwm2m_set_u32 (const struct lwm2m_obj_path *path, uint32_t value)
 Set resource (instance) value (u32)
 
int lwm2m_engine_set_u64 (const char *pathstr, uint64_t value)
 Set resource (instance) value (u64)
 
int lwm2m_set_u64 (const struct lwm2m_obj_path *path, uint64_t value)
 Set resource (instance) value (u64)
 
int lwm2m_engine_set_s8 (const char *pathstr, int8_t value)
 Set resource (instance) value (s8)
 
int lwm2m_set_s8 (const struct lwm2m_obj_path *path, int8_t value)
 Set resource (instance) value (s8)
 
int lwm2m_engine_set_s16 (const char *pathstr, int16_t value)
 Set resource (instance) value (s16)
 
int lwm2m_set_s16 (const struct lwm2m_obj_path *path, int16_t value)
 Set resource (instance) value (s16)
 
int lwm2m_engine_set_s32 (const char *pathstr, int32_t value)
 Set resource (instance) value (s32)
 
int lwm2m_set_s32 (const struct lwm2m_obj_path *path, int32_t value)
 Set resource (instance) value (s32)
 
int lwm2m_engine_set_s64 (const char *pathstr, int64_t value)
 Set resource (instance) value (s64)
 
int lwm2m_set_s64 (const struct lwm2m_obj_path *path, int64_t value)
 Set resource (instance) value (s64)
 
int lwm2m_engine_set_bool (const char *pathstr, bool value)
 Set resource (instance) value (bool)
 
int lwm2m_set_bool (const struct lwm2m_obj_path *path, bool value)
 Set resource (instance) value (bool)
 
int lwm2m_engine_set_float (const char *pathstr, const double *value)
 Set resource (instance) value (double)
 
int lwm2m_set_f64 (const struct lwm2m_obj_path *path, const double value)
 Set resource (instance) value (double)
 
int lwm2m_engine_set_objlnk (const char *pathstr, const struct lwm2m_objlnk *value)
 Set resource (instance) value (Objlnk)
 
int lwm2m_set_objlnk (const struct lwm2m_obj_path *path, const struct lwm2m_objlnk *value)
 Set resource (instance) value (Objlnk)
 
int lwm2m_engine_set_time (const char *pathstr, time_t value)
 Set resource (instance) value (Time)
 
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_engine_get_opaque (const char *pathstr, void *buf, uint16_t buflen)
 Get resource (instance) value (opaque buffer)
 
int lwm2m_get_opaque (const struct lwm2m_obj_path *path, void *buf, uint16_t buflen)
 Get resource (instance) value (opaque buffer)
 
int lwm2m_engine_get_string (const char *pathstr, void *str, uint16_t buflen)
 Get resource (instance) value (string)
 
int lwm2m_get_string (const struct lwm2m_obj_path *path, void *str, uint16_t buflen)
 Get resource (instance) value (string)
 
int lwm2m_engine_get_u8 (const char *pathstr, uint8_t *value)
 Get resource (instance) value (u8)
 
int lwm2m_get_u8 (const struct lwm2m_obj_path *path, uint8_t *value)
 Get resource (instance) value (u8)
 
int lwm2m_engine_get_u16 (const char *pathstr, uint16_t *value)
 Get resource (instance) value (u16)
 
int lwm2m_get_u16 (const struct lwm2m_obj_path *path, uint16_t *value)
 Get resource (instance) value (u16)
 
int lwm2m_engine_get_u32 (const char *pathstr, uint32_t *value)
 Get resource (instance) value (u32)
 
int lwm2m_get_u32 (const struct lwm2m_obj_path *path, uint32_t *value)
 Get resource (instance) value (u32)
 
int lwm2m_engine_get_u64 (const char *pathstr, uint64_t *value)
 Get resource (instance) value (u64)
 
int lwm2m_get_u64 (const struct lwm2m_obj_path *path, uint64_t *value)
 Get resource (instance) value (u64)
 
int lwm2m_engine_get_s8 (const char *pathstr, int8_t *value)
 Get resource (instance) value (s8)
 
int lwm2m_get_s8 (const struct lwm2m_obj_path *path, int8_t *value)
 Get resource (instance) value (s8)
 
int lwm2m_engine_get_s16 (const char *pathstr, int16_t *value)
 Get resource (instance) value (s16)
 
int lwm2m_get_s16 (const struct lwm2m_obj_path *path, int16_t *value)
 Get resource (instance) value (s16)
 
int lwm2m_engine_get_s32 (const char *pathstr, int32_t *value)
 Get resource (instance) value (s32)
 
int lwm2m_get_s32 (const struct lwm2m_obj_path *path, int32_t *value)
 Get resource (instance) value (s32)
 
int lwm2m_engine_get_s64 (const char *pathstr, int64_t *value)
 Get resource (instance) value (s64)
 
int lwm2m_get_s64 (const struct lwm2m_obj_path *path, int64_t *value)
 Get resource (instance) value (s64)
 
int lwm2m_engine_get_bool (const char *pathstr, bool *value)
 Get resource (instance) value (bool)
 
int lwm2m_get_bool (const struct lwm2m_obj_path *path, bool *value)
 Get resource (instance) value (bool)
 
int lwm2m_engine_get_float (const char *pathstr, double *buf)
 Get resource (instance) value (double)
 
int lwm2m_get_f64 (const struct lwm2m_obj_path *path, double *value)
 Get resource (instance) value (double)
 
int lwm2m_engine_get_objlnk (const char *pathstr, struct lwm2m_objlnk *buf)
 Get resource (instance) value (Objlnk)
 
int lwm2m_get_objlnk (const struct lwm2m_obj_path *path, struct lwm2m_objlnk *buf)
 Get resource (instance) value (Objlnk)
 
int lwm2m_engine_get_time (const char *pathstr, time_t *buf)
 Get resource (instance) value (Time)
 
int lwm2m_get_time (const struct lwm2m_obj_path *path, time_t *buf)
 Get resource (instance) value (Time)
 
int lwm2m_engine_register_read_callback (const char *pathstr, lwm2m_engine_get_data_cb_t cb)
 Set resource (instance) read callback.
 
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_engine_register_pre_write_callback (const char *pathstr, lwm2m_engine_get_data_cb_t cb)
 Set resource (instance) pre-write 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_engine_register_validate_callback (const char *pathstr, lwm2m_engine_set_data_cb_t cb)
 Set resource (instance) validation 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_engine_register_post_write_callback (const char *pathstr, lwm2m_engine_set_data_cb_t cb)
 Set resource (instance) post-write 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_engine_register_exec_callback (const char *pathstr, lwm2m_engine_execute_cb_t cb)
 Set resource execute event 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_engine_register_create_callback (uint16_t obj_id, lwm2m_engine_user_cb_t cb)
 Set object instance create 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_engine_register_delete_callback (uint16_t obj_id, lwm2m_engine_user_cb_t cb)
 Set object instance delete 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_engine_set_res_buf (const char *pathstr, 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_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_engine_set_res_data (const char *pathstr, void *data_ptr, uint16_t data_len, uint8_t data_flags)
 Set data buffer for a resource.
 
int lwm2m_engine_set_res_data_len (const char *pathstr, uint16_t data_len)
 Update data size 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_engine_get_res_buf (const char *pathstr, void **buffer_ptr, uint16_t *buffer_len, uint16_t *data_len, uint8_t *data_flags)
 Get data buffer 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_engine_get_res_data (const char *pathstr, void **data_ptr, uint16_t *data_len, uint8_t *data_flags)
 Get data buffer for a resource.
 
int lwm2m_engine_create_res_inst (const char *pathstr)
 Create a resource instance.
 
int lwm2m_create_res_inst (const struct lwm2m_obj_path *path)
 Create a resource instance.
 
int lwm2m_engine_delete_res_inst (const char *pathstr)
 Delete 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_engine_path_is_observed (const char *pathstr)
 Check whether a path is observed.
 
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_engine_send (struct lwm2m_ctx *ctx, char const *path_list[], uint8_t path_list_size, bool confirmation_request)
  
 
int lwm2m_send (struct lwm2m_ctx *ctx, const struct lwm2m_obj_path path_list[], uint8_t path_list_size, bool confirmation_request)
  
 
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_engine_enable_cache (char const *resource_path, struct lwm2m_time_series_elem *data_cache, size_t cache_len)
  
 
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.
 

Detailed Description

LwM2M high-level API.

LwM2M path helper macros.

LwM2M high-level interface is defined in this header.

Note
The implementation assumes UDP module is enabled.
For more information refer to Technical Specification OMA-TS-LightweightM2M_Core-V1_1_1-20190617-A