Zephyr Project API 3.7.0
A Scalable Open Source RTOS
|
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. | |
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_ctx * | lwm2m_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. | |
#define IPSO_OBJECT_ACCELEROMETER_ID 3313 |
#include <include/zephyr/net/lwm2m.h>
IPSO Accelerometer object.
#define IPSO_OBJECT_BUZZER_ID 3338 |
#include <include/zephyr/net/lwm2m.h>
IPSO Buzzer object.
#define IPSO_OBJECT_CURRENT_SENSOR_ID 3317 |
#include <include/zephyr/net/lwm2m.h>
IPSO Current Sensor object.
#define IPSO_OBJECT_FILLING_LEVEL_SENSOR_ID 3435 |
#include <include/zephyr/net/lwm2m.h>
IPSO Filling Level Sensor object.
#define IPSO_OBJECT_GENERIC_SENSOR_ID 3300 |
#include <include/zephyr/net/lwm2m.h>
IPSO Generic Sensor object.
#define IPSO_OBJECT_HUMIDITY_SENSOR_ID 3304 |
#include <include/zephyr/net/lwm2m.h>
IPSO Humidity Sensor object.
#define IPSO_OBJECT_LIGHT_CONTROL_ID 3311 |
#include <include/zephyr/net/lwm2m.h>
IPSO Light Control object.
#define IPSO_OBJECT_ONOFF_SWITCH_ID 3342 |
#include <include/zephyr/net/lwm2m.h>
IPSO On/Off Switch object.
#define IPSO_OBJECT_PRESSURE_ID 3323 |
#include <include/zephyr/net/lwm2m.h>
IPSO Pressure Sensor object.
#define IPSO_OBJECT_PUSH_BUTTON_ID 3347 |
#include <include/zephyr/net/lwm2m.h>
IPSO Push Button object.
#define IPSO_OBJECT_TEMP_SENSOR_ID 3303 |
#include <include/zephyr/net/lwm2m.h>
IPSO Temperature Sensor object.
#define IPSO_OBJECT_TIMER_ID 3340 |
#include <include/zephyr/net/lwm2m.h>
IPSO Timer object.
#define IPSO_OBJECT_VOLTAGE_SENSOR_ID 3316 |
#include <include/zephyr/net/lwm2m.h>
IPSO Voltage Sensor object.
#define LWM2M_DEVICE_BATTERY_STATUS_CHARGE_COMP 2 |
#include <include/zephyr/net/lwm2m.h>
The battery is fully charged and the charger is still connected.
#define LWM2M_DEVICE_BATTERY_STATUS_CHARGING 1 |
#include <include/zephyr/net/lwm2m.h>
The battery is currently charging.
#define LWM2M_DEVICE_BATTERY_STATUS_DAMAGED 3 |
#include <include/zephyr/net/lwm2m.h>
The battery has some problem.
#define LWM2M_DEVICE_BATTERY_STATUS_LOW 4 |
#include <include/zephyr/net/lwm2m.h>
The battery is low on charge.
#define LWM2M_DEVICE_BATTERY_STATUS_NORMAL 0 |
#include <include/zephyr/net/lwm2m.h>
The battery is operating normally and not on power.
#define LWM2M_DEVICE_BATTERY_STATUS_NOT_INST 5 |
#include <include/zephyr/net/lwm2m.h>
The battery is not installed.
#define LWM2M_DEVICE_BATTERY_STATUS_UNKNOWN 6 |
#include <include/zephyr/net/lwm2m.h>
The battery information is not available.
#define LWM2M_DEVICE_ERROR_EXT_POWER_SUPPLY_OFF 2 |
#include <include/zephyr/net/lwm2m.h>
External power supply off.
#define LWM2M_DEVICE_ERROR_GPS_FAILURE 3 |
#include <include/zephyr/net/lwm2m.h>
GPS module failure.
#define LWM2M_DEVICE_ERROR_LOW_POWER 1 |
#include <include/zephyr/net/lwm2m.h>
Low battery power.
#define LWM2M_DEVICE_ERROR_LOW_SIGNAL_STRENGTH 4 |
#include <include/zephyr/net/lwm2m.h>
Low received signal strength.
#define LWM2M_DEVICE_ERROR_NETWORK_FAILURE 7 |
#include <include/zephyr/net/lwm2m.h>
IP Connectivity failure.
#define LWM2M_DEVICE_ERROR_NONE 0 |
#include <include/zephyr/net/lwm2m.h>
No error.
#define LWM2M_DEVICE_ERROR_OUT_OF_MEMORY 5 |
#include <include/zephyr/net/lwm2m.h>
Out of memory.
#define LWM2M_DEVICE_ERROR_PERIPHERAL_FAILURE 8 |
#include <include/zephyr/net/lwm2m.h>
Peripheral malfunction.
#define LWM2M_DEVICE_ERROR_SMS_FAILURE 6 |
#include <include/zephyr/net/lwm2m.h>
SMS failure.
#define LWM2M_DEVICE_PWR_SRC_TYPE_AC_POWER 6 |
#include <include/zephyr/net/lwm2m.h>
AC (mains) power.
#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_EXT 2 |
#include <include/zephyr/net/lwm2m.h>
External battery.
#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_INT 1 |
#include <include/zephyr/net/lwm2m.h>
Internal battery.
#define LWM2M_DEVICE_PWR_SRC_TYPE_DC_POWER 0 |
#include <include/zephyr/net/lwm2m.h>
DC power.
#define LWM2M_DEVICE_PWR_SRC_TYPE_FUEL_CELL 3 |
#include <include/zephyr/net/lwm2m.h>
Fuel cell.
#define LWM2M_DEVICE_PWR_SRC_TYPE_MAX 8 |
#include <include/zephyr/net/lwm2m.h>
Max value for Available Power Source type.
#define LWM2M_DEVICE_PWR_SRC_TYPE_PWR_OVER_ETH 4 |
#include <include/zephyr/net/lwm2m.h>
Power over Ethernet.
#define LWM2M_DEVICE_PWR_SRC_TYPE_SOLAR 7 |
#include <include/zephyr/net/lwm2m.h>
Solar.
#define LWM2M_DEVICE_PWR_SRC_TYPE_USB 5 |
#include <include/zephyr/net/lwm2m.h>
USB.
#include <include/zephyr/net/lwm2m.h>
Read resource flags helper macro.
#define LWM2M_MAX_PATH_STR_SIZE sizeof("/65535/65535/65535/65535") |
#include <include/zephyr/net/lwm2m.h>
LwM2M path maximum length.
#define LWM2M_OBJECT_ACCESS_CONTROL_ID 2 |
#include <include/zephyr/net/lwm2m.h>
Access Control object.
#define LWM2M_OBJECT_BINARYAPPDATACONTAINER_ID 19 |
#include <include/zephyr/net/lwm2m.h>
Binary App Data Container object.
#define LWM2M_OBJECT_CONNECTIVITY_MONITORING_ID 4 |
#include <include/zephyr/net/lwm2m.h>
Connectivity Monitoring object.
#define LWM2M_OBJECT_CONNECTIVITY_STATISTICS_ID 7 |
#include <include/zephyr/net/lwm2m.h>
Connectivity Statistics object.
#define LWM2M_OBJECT_DEVICE_ID 3 |
#include <include/zephyr/net/lwm2m.h>
Device object.
#define LWM2M_OBJECT_EVENT_LOG_ID 20 |
#include <include/zephyr/net/lwm2m.h>
Event Log object.
#define LWM2M_OBJECT_FIRMWARE_ID 5 |
#include <include/zephyr/net/lwm2m.h>
Firmware object.
#define LWM2M_OBJECT_GATEWAY_ID 25 |
#include <include/zephyr/net/lwm2m.h>
Gateway object.
#define LWM2M_OBJECT_LOCATION_ID 6 |
#include <include/zephyr/net/lwm2m.h>
Location object.
#define LWM2M_OBJECT_OSCORE_ID 21 |
#include <include/zephyr/net/lwm2m.h>
OSCORE object.
#define LWM2M_OBJECT_PORTFOLIO_ID 16 |
#include <include/zephyr/net/lwm2m.h>
Portfolio object.
#define LWM2M_OBJECT_SECURITY_ID 0 |
#include <include/zephyr/net/lwm2m.h>
Security object.
#define LWM2M_OBJECT_SERVER_ID 1 |
#include <include/zephyr/net/lwm2m.h>
Server object.
#define LWM2M_OBJECT_SOFTWARE_MANAGEMENT_ID 9 |
#include <include/zephyr/net/lwm2m.h>
Software Management object.
#define LWM2M_OBJLNK_MAX_ID USHRT_MAX |
#include <include/zephyr/net/lwm2m.h>
Maximum value for Objlnk resource fields.
#define LWM2M_RD_CLIENT_FLAG_BOOTSTRAP BIT(0) |
#include <include/zephyr/net/lwm2m.h>
Run bootstrap procedure in current session.
#define LWM2M_RES_DATA_FLAG_RO BIT(LWM2M_RES_DATA_READ_ONLY) |
#include <include/zephyr/net/lwm2m.h>
Resource read-only flag.
#define LWM2M_RES_DATA_READ_ONLY 0 |
#include <include/zephyr/net/lwm2m.h>
Resource read-only value bit.
#define RESULT_CONNECTION_LOST 4 |
#include <include/zephyr/net/lwm2m.h>
Connection lost during downloading process.
#define RESULT_DEFAULT 0 |
#include <include/zephyr/net/lwm2m.h>
Initial value.
#define RESULT_INTEGRITY_FAILED 5 |
#include <include/zephyr/net/lwm2m.h>
Integrity check failure for new downloaded package.
#define RESULT_INVALID_URI 7 |
#include <include/zephyr/net/lwm2m.h>
Invalid URI.
#define RESULT_NO_STORAGE 2 |
#include <include/zephyr/net/lwm2m.h>
Not enough flash memory for the new firmware package.
#define RESULT_OUT_OF_MEM 3 |
#include <include/zephyr/net/lwm2m.h>
Out of RAM during downloading process.
#define RESULT_SUCCESS 1 |
#include <include/zephyr/net/lwm2m.h>
Firmware updated successfully.
#define RESULT_UNSUP_FW 6 |
#include <include/zephyr/net/lwm2m.h>
Unsupported package type.
#define RESULT_UNSUP_PROTO 9 |
#include <include/zephyr/net/lwm2m.h>
Unsupported protocol.
#define RESULT_UPDATE_FAILED 8 |
#include <include/zephyr/net/lwm2m.h>
Firmware update failed.
#define STATE_DOWNLOADED 2 |
#define STATE_DOWNLOADING 1 |
#define STATE_IDLE 0 |
#define STATE_UPDATING 3 |
#define UCIFI_OBJECT_BATTERY_ID 3411 |
#include <include/zephyr/net/lwm2m.h>
uCIFI Battery object
typedef void(* lwm2m_ctx_event_cb_t) (struct lwm2m_ctx *ctx, enum lwm2m_rd_client_event event) |
#include <include/zephyr/net/lwm2m.h>
Asynchronous RD client event callback.
[in] | ctx | LwM2M context generating the event |
[in] | event | LwM2M RD client event code |
#include <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()
[in] | obj_inst_id | Object instance ID generating the callback. |
[in] | args | Pointer to execute arguments payload. (This can be NULL if no arguments are provided) |
[in] | args_len | Length of argument payload in bytes. |
typedef void *(* lwm2m_engine_get_data_cb_t) (uint16_t obj_inst_id, uint16_t res_id, uint16_t res_inst_id, size_t *data_len) |
#include <include/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()
[in] | obj_inst_id | Object instance ID generating the callback. |
[in] | res_id | Resource ID generating the callback. |
[in] | res_inst_id | Resource instance ID generating the callback (typically 0 for non-multi instance resources). |
[out] | data_len | Length of the data buffer. |
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 <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()
[in] | obj_inst_id | Object instance ID generating the callback. |
[in] | res_id | Resource ID generating the callback. |
[in] | res_inst_id | Resource instance ID generating the callback (typically 0 for non-multi instance resources). |
[in] | data | Pointer to data. |
[in] | data_len | Length of the data. |
[in] | last_block | Flag used during block transfer to indicate the last block of data. For non-block transfers this is always false. |
[in] | total_size | Expected total size of data for a block transfer. For non-block transfers this is 0. |
[in] | offset | Offset of the data block. For non-block transfers this is always 0. |
typedef int(* lwm2m_engine_user_cb_t) (uint16_t obj_inst_id) |
#include <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()
[in] | obj_inst_id | Object instance ID generating the callback. |
typedef void(* lwm2m_observe_cb_t) (enum lwm2m_observe_event event, struct lwm2m_obj_path *path, void *user_data) |
#include <include/zephyr/net/lwm2m.h>
Observe callback indicating observer adds and deletes, and notification ACKs and timeouts.
[in] | event | Observer add/delete or notification ack/timeout |
[in] | path | LwM2M path |
[in] | user_data | Pointer 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 |
#include <include/zephyr/net/lwm2m.h>
Callback returning send status.
typedef void(* lwm2m_socket_fault_cb_t) (int error) |
#include <include/zephyr/net/lwm2m.h>
Callback function called when a socket error is encountered.
error | Error code |
enum lwm2m_observe_event |
#include <include/zephyr/net/lwm2m.h>
Observe callback events.
#include <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()
#include <include/zephyr/net/lwm2m.h>
Security modes as defined in LwM2M Security object.
enum lwm2m_send_status |
#include <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. |
enum lwm2m_socket_states |
#include <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.
void lwm2m_acknowledge | ( | struct lwm2m_ctx * | client_ctx | ) |
#include <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.
[in] | client_ctx | LwM2M context |
int lwm2m_create_object_inst | ( | const struct lwm2m_obj_path * | path | ) |
#include <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));
[in] | path | LwM2M path as a struct |
int lwm2m_create_res_inst | ( | const struct lwm2m_obj_path * | path | ) |
#include <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));
[in] | path | LwM2M path as a struct |
int lwm2m_delete_object_inst | ( | const struct lwm2m_obj_path * | path | ) |
#include <include/zephyr/net/lwm2m.h>
Delete an LwM2M object instance.
LwM2M clients use this function to delete LwM2M objects.
[in] | path | LwM2M path as a struct |
int lwm2m_delete_res_inst | ( | const struct lwm2m_obj_path * | path | ) |
#include <include/zephyr/net/lwm2m.h>
Delete a resource instance.
Use this function to remove an existing resource instance
[in] | path | LwM2M path as a struct |
int lwm2m_device_add_err | ( | uint8_t | error_code | ) |
#include <include/zephyr/net/lwm2m.h>
Register a new error code with LwM2M Device object.
[in] | error_code | New error code. |
int lwm2m_enable_cache | ( | const struct lwm2m_obj_path * | path, |
struct lwm2m_time_series_elem * | data_cache, | ||
size_t | cache_len | ||
) |
#include <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
path | LwM2M path to resource as a struct |
data_cache | Pointer to Data cache array |
cache_len | number of cached entries |
int lwm2m_engine_pause | ( | void | ) |
#include <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.
int lwm2m_engine_resume | ( | void | ) |
#include <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.
int lwm2m_engine_start | ( | struct lwm2m_ctx * | client_ctx | ) |
#include <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.
[in] | client_ctx | LwM2M context |
int lwm2m_engine_stop | ( | struct lwm2m_ctx * | client_ctx | ) |
#include <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.
[in] | client_ctx | LwM2M context |
void lwm2m_event_log_set_read_log_data_cb | ( | lwm2m_engine_get_data_cb_t | cb | ) |
#include <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.
[in] | cb | A callback function for handling the read event. |
lwm2m_engine_user_cb_t lwm2m_firmware_get_cancel_cb | ( | void | ) |
#include <include/zephyr/net/lwm2m.h>
Get a callback for firmware update cancel.
lwm2m_engine_user_cb_t lwm2m_firmware_get_cancel_cb_inst | ( | uint16_t | obj_inst_id | ) |
#include <include/zephyr/net/lwm2m.h>
Get the callback for firmware update cancel.
[in] | obj_inst_id | Object instance ID |
lwm2m_engine_execute_cb_t lwm2m_firmware_get_update_cb | ( | void | ) |
#include <include/zephyr/net/lwm2m.h>
Get the event callback for firmware update execute events.
lwm2m_engine_execute_cb_t lwm2m_firmware_get_update_cb_inst | ( | uint16_t | obj_inst_id | ) |
#include <include/zephyr/net/lwm2m.h>
Get the event callback for firmware update execute events.
[in] | obj_inst_id | Object instance ID |
lwm2m_engine_set_data_cb_t lwm2m_firmware_get_write_cb | ( | void | ) |
#include <include/zephyr/net/lwm2m.h>
Get the data callback for firmware block transfer writes.
lwm2m_engine_set_data_cb_t lwm2m_firmware_get_write_cb_inst | ( | uint16_t | obj_inst_id | ) |
#include <include/zephyr/net/lwm2m.h>
Get the data callback for firmware block transfer writes.
[in] | obj_inst_id | Object instance ID |
void lwm2m_firmware_set_cancel_cb | ( | lwm2m_engine_user_cb_t | cb | ) |
#include <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.
[in] | cb | A callback function perform actions on firmware update cancel. |
void lwm2m_firmware_set_cancel_cb_inst | ( | uint16_t | obj_inst_id, |
lwm2m_engine_user_cb_t | cb | ||
) |
#include <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.
[in] | obj_inst_id | Object instance ID |
[in] | cb | A callback function perform actions on firmware update cancel. |
void lwm2m_firmware_set_update_cb | ( | lwm2m_engine_execute_cb_t | cb | ) |
#include <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.
[in] | cb | A callback function to receive the execute event. |
void lwm2m_firmware_set_update_cb_inst | ( | uint16_t | obj_inst_id, |
lwm2m_engine_execute_cb_t | cb | ||
) |
#include <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.
[in] | obj_inst_id | Object instance ID |
[in] | cb | A callback function to receive the execute event. |
void lwm2m_firmware_set_write_cb | ( | lwm2m_engine_set_data_cb_t | cb | ) |
#include <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.
[in] | cb | A callback function to receive the block transfer data |
void lwm2m_firmware_set_write_cb_inst | ( | uint16_t | obj_inst_id, |
lwm2m_engine_set_data_cb_t | cb | ||
) |
#include <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.
[in] | obj_inst_id | Object instance ID |
[in] | cb | A callback function to receive the block transfer data |
int lwm2m_get_bool | ( | const struct lwm2m_obj_path * | path, |
bool * | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Get resource (instance) value (bool)
[in] | path | LwM2M path as a struct |
[out] | value | bool buffer to copy data into |
int lwm2m_get_f64 | ( | const struct lwm2m_obj_path * | path, |
double * | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Get resource (instance) value (double)
[in] | path | LwM2M path as a struct |
[out] | value | double buffer to copy data into |
int lwm2m_get_objlnk | ( | const struct lwm2m_obj_path * | path, |
struct lwm2m_objlnk * | buf | ||
) |
#include <include/zephyr/net/lwm2m.h>
Get resource (instance) value (Objlnk)
[in] | path | LwM2M path as a struct |
[out] | buf | lwm2m_objlnk buffer to copy data into |
int lwm2m_get_opaque | ( | const struct lwm2m_obj_path * | path, |
void * | buf, | ||
uint16_t | buflen | ||
) |
#include <include/zephyr/net/lwm2m.h>
Get resource (instance) value (opaque buffer)
[in] | path | LwM2M path as a struct |
[out] | buf | Data buffer to copy data into |
[in] | buflen | Length of buffer |
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 <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.
[in] | path | LwM2M path as a struct |
[out] | buffer_ptr | Data buffer pointer |
[out] | buffer_len | Length of buffer |
[out] | data_len | Length of existing data in the buffer |
[out] | data_flags | Data buffer flags (such as read-only, etc) |
int lwm2m_get_s16 | ( | const struct lwm2m_obj_path * | path, |
int16_t * | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Get resource (instance) value (s16)
[in] | path | LwM2M path as a struct |
[out] | value | s16 buffer to copy data into |
int lwm2m_get_s32 | ( | const struct lwm2m_obj_path * | path, |
int32_t * | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Get resource (instance) value (s32)
[in] | path | LwM2M path as a struct |
[out] | value | s32 buffer to copy data into |
int lwm2m_get_s64 | ( | const struct lwm2m_obj_path * | path, |
int64_t * | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Get resource (instance) value (s64)
[in] | path | LwM2M path as a struct |
[out] | value | s64 buffer to copy data into |
int lwm2m_get_s8 | ( | const struct lwm2m_obj_path * | path, |
int8_t * | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Get resource (instance) value (s8)
[in] | path | LwM2M path as a struct |
[out] | value | s8 buffer to copy data into |
int lwm2m_get_string | ( | const struct lwm2m_obj_path * | path, |
void * | str, | ||
uint16_t | buflen | ||
) |
#include <include/zephyr/net/lwm2m.h>
Get resource (instance) value (string)
[in] | path | LwM2M path as a struct |
[out] | str | String buffer to copy data into |
[in] | buflen | Length of buffer |
int lwm2m_get_time | ( | const struct lwm2m_obj_path * | path, |
time_t * | buf | ||
) |
#include <include/zephyr/net/lwm2m.h>
Get resource (instance) value (Time)
[in] | path | LwM2M path as a struct |
[out] | buf | time_t pointer to copy data |
int lwm2m_get_u16 | ( | const struct lwm2m_obj_path * | path, |
uint16_t * | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Get resource (instance) value (u16)
[in] | path | LwM2M path as a struct |
[out] | value | u16 buffer to copy data into |
int lwm2m_get_u32 | ( | const struct lwm2m_obj_path * | path, |
uint32_t * | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Get resource (instance) value (u32)
[in] | path | LwM2M path as a struct |
[out] | value | u32 buffer to copy data into |
int lwm2m_get_u64 | ( | const struct lwm2m_obj_path * | path, |
uint64_t * | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Get resource (instance) value (u64)
[in] | path | LwM2M path as a struct |
[out] | value | u64 buffer to copy data into |
int lwm2m_get_u8 | ( | const struct lwm2m_obj_path * | path, |
uint8_t * | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Get resource (instance) value (u8)
[in] | path | LwM2M path as a struct |
[out] | value | u8 buffer to copy data into |
bool lwm2m_path_is_observed | ( | const struct lwm2m_obj_path * | path | ) |
#include <include/zephyr/net/lwm2m.h>
Check whether a path is observed.
[in] | path | LwM2M path as a struct to check |
char * lwm2m_path_log_buf | ( | char * | buf, |
struct lwm2m_obj_path * | path | ||
) |
#include <include/zephyr/net/lwm2m.h>
Helper function to print path objects' contents to log.
[in] | buf | The buffer to use for formatting the string |
[in] | path | The path to stringify |
struct lwm2m_ctx * lwm2m_rd_client_ctx | ( | void | ) |
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 <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.
[in] | client_ctx | LwM2M context |
[in] | ep_name | Registered endpoint name |
[in] | flags | Flags used to configure current LwM2M session. |
[in] | event_cb | Client event callback function |
[in] | observe_cb | Observe callback function called when an observer was added or deleted, and when a notification was acked or has timed out |
int lwm2m_rd_client_stop | ( | struct lwm2m_ctx * | client_ctx, |
lwm2m_ctx_event_cb_t | event_cb, | ||
bool | deregister | ||
) |
#include <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.
[in] | client_ctx | LwM2M context |
[in] | event_cb | Client event callback function |
[in] | deregister | True to deregister the client if registered. False to force close the connection. |
void lwm2m_rd_client_update | ( | void | ) |
#include <include/zephyr/net/lwm2m.h>
Trigger a Registration Update of the LwM2M RD Client.
int lwm2m_register_create_callback | ( | uint16_t | obj_id, |
lwm2m_engine_user_cb_t | cb | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set object instance create event callback.
This event is triggered when an object instance is created.
[in] | obj_id | LwM2M object id |
[in] | cb | Create object instance callback |
int lwm2m_register_delete_callback | ( | uint16_t | obj_id, |
lwm2m_engine_user_cb_t | cb | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set object instance delete event callback.
This event is triggered when an object instance is deleted.
[in] | obj_id | LwM2M object id |
[in] | cb | Delete object instance callback |
int lwm2m_register_exec_callback | ( | const struct lwm2m_obj_path * | path, |
lwm2m_engine_execute_cb_t | cb | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set resource execute event callback.
This event is triggered when the execute method of a resource is enabled.
[in] | path | LwM2M path as a struct |
[in] | cb | Execute resource callback |
int lwm2m_register_post_write_callback | ( | const struct lwm2m_obj_path * | path, |
lwm2m_engine_set_data_cb_t | cb | ||
) |
#include <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.
[in] | path | LwM2M path as a struct |
[in] | cb | Post-write resource callback |
int lwm2m_register_pre_write_callback | ( | const struct lwm2m_obj_path * | path, |
lwm2m_engine_get_data_cb_t | cb | ||
) |
#include <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.
[in] | path | LwM2M path as a struct |
[in] | cb | Pre-write resource callback |
int lwm2m_register_read_callback | ( | const struct lwm2m_obj_path * | path, |
lwm2m_engine_get_data_cb_t | cb | ||
) |
#include <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.
[in] | path | LwM2M path as a struct |
[in] | cb | Read resource callback |
int lwm2m_register_validate_callback | ( | const struct lwm2m_obj_path * | path, |
lwm2m_engine_set_data_cb_t | cb | ||
) |
#include <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).
CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE
is large enough to store each of the validated resources (individually).[in] | path | LwM2M path as a struct |
[in] | cb | Validate resource data callback |
void lwm2m_registry_lock | ( | void | ) |
#include <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.
void lwm2m_registry_unlock | ( | void | ) |
#include <include/zephyr/net/lwm2m.h>
Unlocks the registry previously locked by lwm2m_registry_lock().
int lwm2m_security_mode | ( | struct lwm2m_ctx * | ctx | ) |
#include <include/zephyr/net/lwm2m.h>
Read security mode from selected security object instance.
This data is valid only if RD client is running.
ctx | Pointer to client context. |
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 <include/zephyr/net/lwm2m.h>
LwM2M SEND operation to given path list asynchronously with confirmation callback
ctx | LwM2M context |
path_list | LwM2M path struct list |
path_list_size | Length of path list. Max size is CONFIG_LWM2M_COMPOSITE_PATH_LIST_SIZE |
reply_cb | Callback triggered with confirmation state or NULL if not used |
int lwm2m_set_bool | ( | const struct lwm2m_obj_path * | path, |
bool | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set resource (instance) value (bool)
[in] | path | LwM2M path as a struct |
[in] | value | bool value |
int lwm2m_set_bulk | ( | const struct lwm2m_res_item | res_list[], |
size_t | res_list_size | ||
) |
#include <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.
[in] | res_list | LwM2M resource item list |
[in] | res_list_size | Length of resource list |
int lwm2m_set_default_sockopt | ( | struct lwm2m_ctx * | ctx | ) |
#include <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.
ctx | Client context |
int lwm2m_set_f64 | ( | const struct lwm2m_obj_path * | path, |
const double | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set resource (instance) value (double)
[in] | path | LwM2M path as a struct |
[in] | value | double value |
int lwm2m_set_objlnk | ( | const struct lwm2m_obj_path * | path, |
const struct lwm2m_objlnk * | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set resource (instance) value (Objlnk)
[in] | path | LwM2M path as a struct |
[in] | value | pointer to the lwm2m_objlnk structure |
int lwm2m_set_opaque | ( | const struct lwm2m_obj_path * | path, |
const char * | data_ptr, | ||
uint16_t | data_len | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set resource (instance) value (opaque buffer)
[in] | path | LwM2M path as a struct |
[in] | data_ptr | Data buffer |
[in] | data_len | Length of buffer |
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 <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.
[in] | path | LwM2M path as a struct |
[in] | buffer_ptr | Data buffer pointer |
[in] | buffer_len | Length of buffer |
[in] | data_len | Length of existing data in the buffer |
[in] | data_flags | Data buffer flags (such as read-only, etc) |
int lwm2m_set_res_data_len | ( | const struct lwm2m_obj_path * | path, |
uint16_t | data_len | ||
) |
#include <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().
[in] | path | LwM2M path as a struct |
[in] | data_len | Length of data |
int lwm2m_set_s16 | ( | const struct lwm2m_obj_path * | path, |
int16_t | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set resource (instance) value (s16)
[in] | path | LwM2M path as a struct |
[in] | value | s16 value |
int lwm2m_set_s32 | ( | const struct lwm2m_obj_path * | path, |
int32_t | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set resource (instance) value (s32)
[in] | path | LwM2M path as a struct |
[in] | value | s32 value |
int lwm2m_set_s64 | ( | const struct lwm2m_obj_path * | path, |
int64_t | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set resource (instance) value (s64)
[in] | path | LwM2M path as a struct |
[in] | value | s64 value |
int lwm2m_set_s8 | ( | const struct lwm2m_obj_path * | path, |
int8_t | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set resource (instance) value (s8)
[in] | path | LwM2M path as a struct |
[in] | value | s8 value |
int lwm2m_set_string | ( | const struct lwm2m_obj_path * | path, |
const char * | data_ptr | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set resource (instance) value (string)
[in] | path | LwM2M path as a struct |
[in] | data_ptr | NULL terminated char buffer |
int lwm2m_set_time | ( | const struct lwm2m_obj_path * | path, |
time_t | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set resource (instance) value (Time)
[in] | path | LwM2M path as a struct |
[in] | value | Epoch timestamp |
int lwm2m_set_u16 | ( | const struct lwm2m_obj_path * | path, |
uint16_t | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set resource (instance) value (u16)
[in] | path | LwM2M path as a struct |
[in] | value | u16 value |
int lwm2m_set_u32 | ( | const struct lwm2m_obj_path * | path, |
uint32_t | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set resource (instance) value (u32)
[in] | path | LwM2M path as a struct |
[in] | value | u32 value |
int lwm2m_set_u64 | ( | const struct lwm2m_obj_path * | path, |
uint64_t | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set resource (instance) value (u64)
[in] | path | LwM2M path as a struct |
[in] | value | u64 value |
int lwm2m_set_u8 | ( | const struct lwm2m_obj_path * | path, |
uint8_t | value | ||
) |
#include <include/zephyr/net/lwm2m.h>
Set resource (instance) value (u8)
[in] | path | LwM2M path as a struct |
[in] | value | u8 value |
int lwm2m_swmgmt_install_completed | ( | uint16_t | obj_inst_id, |
int | error_code | ||
) |
#include <include/zephyr/net/lwm2m.h>
Function to be called when a Software Management object instance completed the Install operation.
[in] | obj_inst_id | The Software Management object instance |
[in] | error_code | The result code of the operation. Zero on success otherwise it should be a negative integer. |
return 0 on success, otherwise a negative integer.
int lwm2m_swmgmt_set_activate_cb | ( | uint16_t | obj_inst_id, |
lwm2m_engine_execute_cb_t | cb | ||
) |
#include <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.
[in] | obj_inst_id | The instance number to set the callback for. |
[in] | cb | A callback function to receive the execute event. |
int lwm2m_swmgmt_set_deactivate_cb | ( | uint16_t | obj_inst_id, |
lwm2m_engine_execute_cb_t | cb | ||
) |
#include <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.
[in] | obj_inst_id | The instance number to set the callback for. |
[in] | cb | A callback function to receive the execute event. |
int lwm2m_swmgmt_set_delete_package_cb | ( | uint16_t | obj_inst_id, |
lwm2m_engine_execute_cb_t | cb | ||
) |
#include <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.
[in] | obj_inst_id | The instance number to set the callback for. |
[in] | cb | A callback function for handling the execute event. |
int lwm2m_swmgmt_set_install_package_cb | ( | uint16_t | obj_inst_id, |
lwm2m_engine_execute_cb_t | cb | ||
) |
#include <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.
[in] | obj_inst_id | The instance number to set the callback for. |
[in] | cb | A callback function to receive the execute event. |
int lwm2m_swmgmt_set_read_package_version_cb | ( | uint16_t | obj_inst_id, |
lwm2m_engine_get_data_cb_t | cb | ||
) |
#include <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.
[in] | obj_inst_id | The instance number to set the callback for. |
[in] | cb | A callback function for handling the read event. |
int lwm2m_swmgmt_set_write_package_cb | ( | uint16_t | obj_inst_id, |
lwm2m_engine_set_data_cb_t | cb | ||
) |
#include <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.
[in] | obj_inst_id | The instance number to set the callback for. |
[in] | cb | A callback function for handling the block write event. |
int lwm2m_update_device_service_period | ( | uint32_t | period_ms | ) |
#include <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.
[in] | period_ms | New period for the device service (in milliseconds) |
int lwm2m_update_observer_max_period | ( | struct lwm2m_ctx * | client_ctx, |
const struct lwm2m_obj_path * | path, | ||
uint32_t | period_s | ||
) |
#include <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);
[in] | client_ctx | LwM2M context |
[in] | path | LwM2M path as a struct |
[in] | period_s | Value of pmax to be given (in seconds). |
int lwm2m_update_observer_min_period | ( | struct lwm2m_ctx * | client_ctx, |
const struct lwm2m_obj_path * | path, | ||
uint32_t | period_s | ||
) |
#include <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);
[in] | client_ctx | LwM2M context |
[in] | path | LwM2M path as a struct |
[in] | period_s | Value of pmin to be given (in seconds). |