Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
lwm2m.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Linaro Limited
3 * Copyright (c) 2017-2019 Foundries.io
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
27#ifndef ZEPHYR_INCLUDE_NET_LWM2M_H_
28#define ZEPHYR_INCLUDE_NET_LWM2M_H_
29
30#include <time.h>
31#include <zephyr/kernel.h>
32#include <zephyr/sys/mutex.h>
33#include <zephyr/net/coap.h>
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
46/* clang-format off */
47#define LWM2M_OBJECT_SECURITY_ID 0
48#define LWM2M_OBJECT_SERVER_ID 1
49#define LWM2M_OBJECT_ACCESS_CONTROL_ID 2
50#define LWM2M_OBJECT_DEVICE_ID 3
51#define LWM2M_OBJECT_CONNECTIVITY_MONITORING_ID 4
52#define LWM2M_OBJECT_FIRMWARE_ID 5
53#define LWM2M_OBJECT_LOCATION_ID 6
54#define LWM2M_OBJECT_CONNECTIVITY_STATISTICS_ID 7
55#define LWM2M_OBJECT_SOFTWARE_MANAGEMENT_ID 9
56#define LWM2M_OBJECT_PORTFOLIO_ID 16
57#define LWM2M_OBJECT_BINARYAPPDATACONTAINER_ID 19
58#define LWM2M_OBJECT_EVENT_LOG_ID 20
59#define LWM2M_OBJECT_OSCORE_ID 21
60#define LWM2M_OBJECT_GATEWAY_ID 25
61/* clang-format on */
62
73/* clang-format off */
74#define IPSO_OBJECT_GENERIC_SENSOR_ID 3300
75#define IPSO_OBJECT_TEMP_SENSOR_ID 3303
76#define IPSO_OBJECT_HUMIDITY_SENSOR_ID 3304
77#define IPSO_OBJECT_LIGHT_CONTROL_ID 3311
78#define IPSO_OBJECT_ACCELEROMETER_ID 3313
79#define IPSO_OBJECT_VOLTAGE_SENSOR_ID 3316
80#define IPSO_OBJECT_CURRENT_SENSOR_ID 3317
81#define IPSO_OBJECT_PRESSURE_ID 3323
82#define IPSO_OBJECT_BUZZER_ID 3338
83#define IPSO_OBJECT_TIMER_ID 3340
84#define IPSO_OBJECT_ONOFF_SWITCH_ID 3342
85#define IPSO_OBJECT_PUSH_BUTTON_ID 3347
86#define UCIFI_OBJECT_BATTERY_ID 3411
87#define IPSO_OBJECT_FILLING_LEVEL_SENSOR_ID 3435
88/* clang-format on */
89
97typedef void (*lwm2m_socket_fault_cb_t)(int error);
98
107
117
128typedef void (*lwm2m_observe_cb_t)(enum lwm2m_observe_event event, struct lwm2m_obj_path *path,
129 void *user_data);
130
131
132struct lwm2m_ctx;
133
174
175
182typedef void (*lwm2m_ctx_event_cb_t)(struct lwm2m_ctx *ctx,
183 enum lwm2m_rd_client_event event);
184
185typedef int (*lwm2m_set_sockopt_cb_t)(struct lwm2m_ctx *client_ctx);
186
202
207struct lwm2m_ctx {
210
214 struct coap_pending pendings[CONFIG_LWM2M_ENGINE_MAX_PENDING + 1];
215 struct coap_reply replies[CONFIG_LWM2M_ENGINE_MAX_REPLIES + 1];
216 sys_slist_t pending_sends;
217#if defined(CONFIG_LWM2M_QUEUE_MODE_ENABLED)
218 sys_slist_t queued_messages;
219#endif
220 sys_slist_t observer;
221 struct k_mutex lock;
230
231#if defined(CONFIG_LWM2M_DTLS_SUPPORT) || defined(__DOXYGEN__)
242
250
255 int (*load_credentials)(struct lwm2m_ctx *client_ctx);
257#endif
264
271
277
278#if defined(CONFIG_LWM2M_QUEUE_MODE_ENABLED) || defined(__DOXYGEN__)
284#endif
287
290
295
298
303
308
311
316 uint8_t validate_buf[CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE];
317
325};
326
334 union {
336 uint8_t u8;
337 uint16_t u16;
338 uint32_t u32;
339 uint64_t u64;
340 int8_t i8;
341 int16_t i16;
342 int32_t i32;
343 int64_t i64;
344 time_t time;
345 double f;
346 bool b;
348 };
349};
350
370typedef void *(*lwm2m_engine_get_data_cb_t)(uint16_t obj_inst_id,
371 uint16_t res_id,
372 uint16_t res_inst_id,
373 size_t *data_len);
374
406typedef int (*lwm2m_engine_set_data_cb_t)(uint16_t obj_inst_id,
407 uint16_t res_id, uint16_t res_inst_id,
408 uint8_t *data, uint16_t data_len,
409 bool last_block, size_t total_size, size_t offset);
410
427typedef int (*lwm2m_engine_user_cb_t)(uint16_t obj_inst_id);
428
445typedef int (*lwm2m_engine_execute_cb_t)(uint16_t obj_inst_id,
446 uint8_t *args, uint16_t args_len);
447
453#define LWM2M_DEVICE_PWR_SRC_TYPE_DC_POWER 0
454#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_INT 1
455#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_EXT 2
456#define LWM2M_DEVICE_PWR_SRC_TYPE_FUEL_CELL 3
457#define LWM2M_DEVICE_PWR_SRC_TYPE_PWR_OVER_ETH 4
458#define LWM2M_DEVICE_PWR_SRC_TYPE_USB 5
459#define LWM2M_DEVICE_PWR_SRC_TYPE_AC_POWER 6
460#define LWM2M_DEVICE_PWR_SRC_TYPE_SOLAR 7
461#define LWM2M_DEVICE_PWR_SRC_TYPE_MAX 8
471#define LWM2M_DEVICE_ERROR_NONE 0
472#define LWM2M_DEVICE_ERROR_LOW_POWER 1
473#define LWM2M_DEVICE_ERROR_EXT_POWER_SUPPLY_OFF 2
474#define LWM2M_DEVICE_ERROR_GPS_FAILURE 3
475#define LWM2M_DEVICE_ERROR_LOW_SIGNAL_STRENGTH 4
476#define LWM2M_DEVICE_ERROR_OUT_OF_MEMORY 5
477#define LWM2M_DEVICE_ERROR_SMS_FAILURE 6
478#define LWM2M_DEVICE_ERROR_NETWORK_FAILURE 7
479#define LWM2M_DEVICE_ERROR_PERIPHERAL_FAILURE 8
490#define LWM2M_DEVICE_BATTERY_STATUS_NORMAL 0
493#define LWM2M_DEVICE_BATTERY_STATUS_CHARGING 1
494#define LWM2M_DEVICE_BATTERY_STATUS_CHARGE_COMP 2
497#define LWM2M_DEVICE_BATTERY_STATUS_DAMAGED 3
498#define LWM2M_DEVICE_BATTERY_STATUS_LOW 4
499#define LWM2M_DEVICE_BATTERY_STATUS_NOT_INST 5
500#define LWM2M_DEVICE_BATTERY_STATUS_UNKNOWN 6
512
513
525#define STATE_IDLE 0
529#define STATE_DOWNLOADING 1
533#define STATE_DOWNLOADED 2
537#define STATE_UPDATING 3
538
549#define RESULT_DEFAULT 0
550#define RESULT_SUCCESS 1
551#define RESULT_NO_STORAGE 2
552#define RESULT_OUT_OF_MEM 3
553#define RESULT_CONNECTION_LOST 4
554#define RESULT_INTEGRITY_FAILED 5
555#define RESULT_UNSUP_FW 6
556#define RESULT_INVALID_URI 7
557#define RESULT_UPDATE_FAILED 8
558#define RESULT_UNSUP_PROTO 9
562#if defined(CONFIG_LWM2M_FIRMWARE_UPDATE_OBJ_SUPPORT) || defined(__DOXYGEN__)
572
579
590
598
608
615
626
634
644
651
662
670#endif
671
672#if defined(CONFIG_LWM2M_SWMGMT_OBJ_SUPPORT) || defined(__DOXYGEN__)
673
686
699
712
725
738
751
762int lwm2m_swmgmt_install_completed(uint16_t obj_inst_id, int error_code);
763
764#endif
765
766#if defined(CONFIG_LWM2M_EVENT_LOG_OBJ_SUPPORT) || defined(__DOXYGEN__)
767
777
778#endif
779
783#define LWM2M_OBJLNK_MAX_ID USHRT_MAX
784
792
808 const struct lwm2m_obj_path *path, uint32_t period_s);
809
825 const struct lwm2m_obj_path *path, uint32_t period_s);
826
839
850
859
865
875int lwm2m_set_opaque(const struct lwm2m_obj_path *path, const char *data_ptr, uint16_t data_len);
876
885int lwm2m_set_string(const struct lwm2m_obj_path *path, const char *data_ptr);
886
895int lwm2m_set_u8(const struct lwm2m_obj_path *path, uint8_t value);
896
905int lwm2m_set_u16(const struct lwm2m_obj_path *path, uint16_t value);
906
915int lwm2m_set_u32(const struct lwm2m_obj_path *path, uint32_t value);
916
925int lwm2m_set_s8(const struct lwm2m_obj_path *path, int8_t value);
926
935int lwm2m_set_s16(const struct lwm2m_obj_path *path, int16_t value);
936
945int lwm2m_set_s32(const struct lwm2m_obj_path *path, int32_t value);
946
955int lwm2m_set_s64(const struct lwm2m_obj_path *path, int64_t value);
956
965int lwm2m_set_bool(const struct lwm2m_obj_path *path, bool value);
966
975int lwm2m_set_f64(const struct lwm2m_obj_path *path, const double value);
976
985int lwm2m_set_objlnk(const struct lwm2m_obj_path *path, const struct lwm2m_objlnk *value);
986
995int lwm2m_set_time(const struct lwm2m_obj_path *path, time_t value);
996
1028
1041int lwm2m_set_bulk(const struct lwm2m_res_item res_list[], size_t res_list_size);
1042
1052int lwm2m_get_opaque(const struct lwm2m_obj_path *path, void *buf, uint16_t buflen);
1053
1063int lwm2m_get_string(const struct lwm2m_obj_path *path, void *str, uint16_t buflen);
1064
1073int lwm2m_get_u8(const struct lwm2m_obj_path *path, uint8_t *value);
1074
1083int lwm2m_get_u16(const struct lwm2m_obj_path *path, uint16_t *value);
1084
1093int lwm2m_get_u32(const struct lwm2m_obj_path *path, uint32_t *value);
1094
1103int lwm2m_get_s8(const struct lwm2m_obj_path *path, int8_t *value);
1104
1113int lwm2m_get_s16(const struct lwm2m_obj_path *path, int16_t *value);
1114
1123int lwm2m_get_s32(const struct lwm2m_obj_path *path, int32_t *value);
1124
1133int lwm2m_get_s64(const struct lwm2m_obj_path *path, int64_t *value);
1134
1143int lwm2m_get_bool(const struct lwm2m_obj_path *path, bool *value);
1144
1153int lwm2m_get_f64(const struct lwm2m_obj_path *path, double *value);
1154
1163int lwm2m_get_objlnk(const struct lwm2m_obj_path *path, struct lwm2m_objlnk *buf);
1164
1173int lwm2m_get_time(const struct lwm2m_obj_path *path, time_t *buf);
1174
1194
1209
1232
1249
1261
1274
1287
1291#define LWM2M_RES_DATA_READ_ONLY 0
1292
1296#define LWM2M_RES_DATA_FLAG_RO BIT(LWM2M_RES_DATA_READ_ONLY)
1297
1301#define LWM2M_HAS_RES_FLAG(res, f) ((res->data_flags & f) == f)
1302
1317int lwm2m_set_res_buf(const struct lwm2m_obj_path *path, void *buffer_ptr, uint16_t buffer_len,
1318 uint16_t data_len, uint8_t data_flags);
1319
1330int lwm2m_set_res_data_len(const struct lwm2m_obj_path *path, uint16_t data_len);
1331
1351int lwm2m_get_res_buf(const struct lwm2m_obj_path *path, void **buffer_ptr, uint16_t *buffer_len,
1352 uint16_t *data_len, uint8_t *data_flags);
1353
1366
1377
1389
1402
1414int lwm2m_engine_stop(struct lwm2m_ctx *client_ctx);
1415
1427int lwm2m_engine_start(struct lwm2m_ctx *client_ctx);
1428
1440void lwm2m_acknowledge(struct lwm2m_ctx *client_ctx);
1441
1442/*
1443 * LwM2M RD client flags, used to configure LwM2M session.
1444 */
1445
1449#define LWM2M_RD_CLIENT_FLAG_BOOTSTRAP BIT(0)
1450
1472int lwm2m_rd_client_start(struct lwm2m_ctx *client_ctx, const char *ep_name,
1474 lwm2m_observe_cb_t observe_cb);
1475
1491int lwm2m_rd_client_stop(struct lwm2m_ctx *client_ctx,
1492 lwm2m_ctx_event_cb_t event_cb, bool deregister);
1493
1504
1516
1521
1525#define LWM2M_MAX_PATH_STR_SIZE sizeof("/65535/65535/65535/65535")
1526
1535char *lwm2m_path_log_buf(char *buf, struct lwm2m_obj_path *path);
1536
1548
1553typedef void (*lwm2m_send_cb_t)(enum lwm2m_send_status status);
1554
1566int lwm2m_send_cb(struct lwm2m_ctx *ctx, const struct lwm2m_obj_path path_list[],
1567 uint8_t path_list_size, lwm2m_send_cb_t reply_cb);
1568
1576
1590int lwm2m_enable_cache(const struct lwm2m_obj_path *path, struct lwm2m_time_series_elem *data_cache,
1591 size_t cache_len);
1592
1603
1613
1625
1636
1637#ifdef __cplusplus
1638}
1639#endif
1640
1641#endif /* ZEPHYR_INCLUDE_NET_LWM2M_H_ */
_TIME_T_ time_t
Definition _timespec.h:14
CoAP implementation for Zephyr.
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)
 
int lwm2m_get_f64(const struct lwm2m_obj_path *path, double *value)
Get 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_engine_stop(struct lwm2m_ctx *client_ctx)
Stop the LwM2M engine.
int lwm2m_get_u32(const struct lwm2m_obj_path *path, uint32_t *value)
Get resource (instance) value (u32)
int lwm2m_set_res_data_len(const struct lwm2m_obj_path *path, uint16_t data_len)
Update data size for a resource.
bool lwm2m_path_is_observed(const struct lwm2m_obj_path *path)
Check whether a path is observed.
lwm2m_security_mode_e
Security modes as defined in LwM2M Security object.
Definition lwm2m.h:1596
int lwm2m_get_s8(const struct lwm2m_obj_path *path, int8_t *value)
Get resource (instance) value (s8)
int lwm2m_engine_resume(void)
Resume the LwM2M engine thread.
int lwm2m_set_s64(const struct lwm2m_obj_path *path, int64_t value)
Set resource (instance) value (s64)
int lwm2m_engine_pause(void)
Suspend the LwM2M engine Thread.
int lwm2m_set_u8(const struct lwm2m_obj_path *path, uint8_t value)
Set resource (instance) value (u8)
int lwm2m_get_u16(const struct lwm2m_obj_path *path, uint16_t *value)
Get resource (instance) value (u16)
lwm2m_engine_execute_cb_t lwm2m_firmware_get_update_cb(void)
Get the event callback for firmware update execute events.
int lwm2m_set_u16(const struct lwm2m_obj_path *path, uint16_t value)
Set resource (instance) value (u16)
lwm2m_send_status
LwM2M send status.
Definition lwm2m.h:1543
int lwm2m_get_string(const struct lwm2m_obj_path *path, void *str, uint16_t buflen)
Get resource (instance) value (string)
int lwm2m_get_s16(const struct lwm2m_obj_path *path, int16_t *value)
Get resource (instance) value (s16)
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_register_exec_callback(const struct lwm2m_obj_path *path, lwm2m_engine_execute_cb_t cb)
Set resource execute event callback.
int lwm2m_get_time(const struct lwm2m_obj_path *path, time_t *buf)
Get resource (instance) value (Time)
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.
int lwm2m_set_s32(const struct lwm2m_obj_path *path, int32_t value)
Set resource (instance) value (s32)
int lwm2m_set_f64(const struct lwm2m_obj_path *path, const double value)
Set resource (instance) value (double)
int lwm2m_register_create_callback(uint16_t obj_id, lwm2m_engine_user_cb_t cb)
Set object instance create event callback.
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_set_s8(const struct lwm2m_obj_path *path, int8_t value)
Set resource (instance) value (s8)
void(* lwm2m_ctx_event_cb_t)(struct lwm2m_ctx *ctx, enum lwm2m_rd_client_event event)
Asynchronous RD client event callback.
Definition lwm2m.h:182
void lwm2m_firmware_set_cancel_cb(lwm2m_engine_user_cb_t cb)
Set callback for firmware update cancel.
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.
Definition lwm2m.h:406
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_set_bulk(const struct lwm2m_res_item res_list[], size_t res_list_size)
Set multiple resource (instance) values.
lwm2m_engine_set_data_cb_t lwm2m_firmware_get_write_cb(void)
Get the data callback for firmware block transfer writes.
int lwm2m_get_objlnk(const struct lwm2m_obj_path *path, struct lwm2m_objlnk *buf)
Get resource (instance) value (Objlnk)
int lwm2m_create_object_inst(const struct lwm2m_obj_path *path)
Create an LwM2M object instance.
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_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_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.
Definition lwm2m.h:370
void lwm2m_firmware_set_update_cb(lwm2m_engine_execute_cb_t cb)
Set data callback to handle firmware update execute events.
void lwm2m_pull_context_set_sockopt_callback(lwm2m_set_sockopt_cb_t set_sockopt_cb)
Set the lwm2m_ctx::set_socketoptions callback for the pull context's client.
void lwm2m_firmware_set_write_cb(lwm2m_engine_set_data_cb_t cb)
Set data callback for firmware block transfer.
int lwm2m_enable_cache(const struct lwm2m_obj_path *path, struct lwm2m_time_series_elem *data_cache, size_t cache_len)
 
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_security_mode(struct lwm2m_ctx *ctx)
Read security mode from selected security object instance.
lwm2m_engine_user_cb_t lwm2m_firmware_get_cancel_cb_inst(uint16_t obj_inst_id)
Get the callback for firmware update cancel.
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_set_time(const struct lwm2m_obj_path *path, time_t value)
Set resource (instance) value (Time)
int lwm2m_set_string(const struct lwm2m_obj_path *path, const char *data_ptr)
Set resource (instance) value (string)
lwm2m_socket_states
Different traffic states of the LwM2M socket.
Definition lwm2m.h:196
int lwm2m_swmgmt_set_deactivate_cb(uint16_t obj_inst_id, lwm2m_engine_execute_cb_t cb)
Set callback to handle software deactivation requests.
struct lwm2m_ctx * lwm2m_rd_client_ctx(void)
&#160;
void lwm2m_acknowledge(struct lwm2m_ctx *client_ctx)
Acknowledge the currently processed request with an empty ACK.
int(* lwm2m_set_sockopt_cb_t)(struct lwm2m_ctx *client_ctx)
Definition lwm2m.h:185
int lwm2m_register_delete_callback(uint16_t obj_id, lwm2m_engine_user_cb_t cb)
Set object instance delete event callback.
int lwm2m_set_u32(const struct lwm2m_obj_path *path, uint32_t value)
Set resource (instance) value (u32)
void lwm2m_event_log_set_read_log_data_cb(lwm2m_engine_get_data_cb_t cb)
Set callback to read log data.
lwm2m_engine_user_cb_t lwm2m_firmware_get_cancel_cb(void)
Get a callback for firmware update cancel.
int lwm2m_set_default_sockopt(struct lwm2m_ctx *ctx)
Set default socket options for DTLS connections.
char * lwm2m_path_log_buf(char *buf, struct lwm2m_obj_path *path)
Helper function to print path objects' contents to log.
int lwm2m_get_s32(const struct lwm2m_obj_path *path, int32_t *value)
Get resource (instance) value (s32)
void lwm2m_registry_lock(void)
Locks the registry for this thread.
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_set_bool(const struct lwm2m_obj_path *path, bool value)
Set resource (instance) value (bool)
int lwm2m_engine_start(struct lwm2m_ctx *client_ctx)
Start the LwM2M engine.
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.
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_get_s64(const struct lwm2m_obj_path *path, int64_t *value)
Get resource (instance) value (s64)
void lwm2m_registry_unlock(void)
Unlocks the registry previously locked by lwm2m_registry_lock().
int lwm2m_update_device_service_period(uint32_t period_ms)
Update the period of the device service.
void lwm2m_rd_client_update(void)
Trigger a Registration Update of the LwM2M RD Client.
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_engine_user_cb_t)(uint16_t obj_inst_id)
Asynchronous event notification callback.
Definition lwm2m.h:427
int lwm2m_device_add_err(uint8_t error_code)
Register a new error code with LwM2M Device object.
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_swmgmt_set_activate_cb(uint16_t obj_inst_id, lwm2m_engine_execute_cb_t cb)
Set callback to handle software activation requests.
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.
int lwm2m_get_u8(const struct lwm2m_obj_path *path, uint8_t *value)
Get resource (instance) value (u8)
int lwm2m_create_res_inst(const struct lwm2m_obj_path *path)
Create a resource instance.
lwm2m_observe_event
Observe callback events.
Definition lwm2m.h:111
lwm2m_rd_client_event
LwM2M RD client events.
Definition lwm2m.h:140
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_delete_res_inst(const struct lwm2m_obj_path *path)
Delete a resource instance.
int lwm2m_set_s16(const struct lwm2m_obj_path *path, int16_t value)
Set resource (instance) value (s16)
int lwm2m_register_validate_callback(const struct lwm2m_obj_path *path, lwm2m_engine_set_data_cb_t cb)
Set resource (instance) validation callback.
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_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.
Definition lwm2m.h:128
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_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_get_opaque(const struct lwm2m_obj_path *path, void *buf, uint16_t buflen)
Get resource (instance) value (opaque buffer)
void(* lwm2m_socket_fault_cb_t)(int error)
Callback function called when a socket error is encountered.
Definition lwm2m.h:97
int(* lwm2m_engine_execute_cb_t)(uint16_t obj_inst_id, uint8_t *args, uint16_t args_len)
Asynchronous execute notification callback.
Definition lwm2m.h:445
int lwm2m_register_read_callback(const struct lwm2m_obj_path *path, lwm2m_engine_get_data_cb_t cb)
Set resource (instance) read callback.
void(* lwm2m_send_cb_t)(enum lwm2m_send_status status)
Callback returning send status.
Definition lwm2m.h:1553
int lwm2m_delete_object_inst(const struct lwm2m_obj_path *path)
Delete an LwM2M object instance.
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_get_bool(const struct lwm2m_obj_path *path, bool *value)
Get resource (instance) value (bool)
@ LWM2M_SECURITY_PSK
Pre-Shared Key mode.
Definition lwm2m.h:1597
@ LWM2M_SECURITY_RAW_PK
Raw Public Key mode.
Definition lwm2m.h:1598
@ LWM2M_SECURITY_CERT
Certificate mode.
Definition lwm2m.h:1599
@ LWM2M_SECURITY_CERT_EST
Certificate mode with EST.
Definition lwm2m.h:1601
@ LWM2M_SECURITY_NOSEC
NoSec mode.
Definition lwm2m.h:1600
@ LWM2M_SEND_STATUS_SUCCESS
Succeed.
Definition lwm2m.h:1544
@ LWM2M_SEND_STATUS_FAILURE
Failure.
Definition lwm2m.h:1545
@ LWM2M_SEND_STATUS_TIMEOUT
Timeout.
Definition lwm2m.h:1546
@ LWM2M_SOCKET_STATE_NO_DATA
No more data is expected.
Definition lwm2m.h:200
@ LWM2M_SOCKET_STATE_ONE_RESPONSE
One response is expected for the next message.
Definition lwm2m.h:198
@ LWM2M_SOCKET_STATE_ONGOING
Ongoing traffic is expected.
Definition lwm2m.h:197
@ LWM2M_SOCKET_STATE_LAST
Next message is the last one.
Definition lwm2m.h:199
@ LWM2M_OBSERVE_EVENT_OBSERVER_ADDED
Observer added.
Definition lwm2m.h:112
@ LWM2M_OBSERVE_EVENT_NOTIFY_TIMEOUT
Notification timed out.
Definition lwm2m.h:115
@ LWM2M_OBSERVE_EVENT_NOTIFY_ACK
Notification ACKed.
Definition lwm2m.h:114
@ LWM2M_OBSERVE_EVENT_OBSERVER_REMOVED
Observer removed.
Definition lwm2m.h:113
@ LWM2M_RD_CLIENT_EVENT_DEREGISTER_FAILURE
De-registration failure.
Definition lwm2m.h:158
@ LWM2M_RD_CLIENT_EVENT_QUEUE_MODE_RX_OFF
Queue mode RX off.
Definition lwm2m.h:162
@ LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_TRANSFER_COMPLETE
Bootstrap transfer complete.
Definition lwm2m.h:148
@ LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED
Server disabled.
Definition lwm2m.h:172
@ LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE
Registration complete.
Definition lwm2m.h:152
@ LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT
Registration timeout.
Definition lwm2m.h:154
@ LWM2M_RD_CLIENT_EVENT_REG_UPDATE_COMPLETE
Registration update complete.
Definition lwm2m.h:156
@ LWM2M_RD_CLIENT_EVENT_DEREGISTER
De-register.
Definition lwm2m.h:170
@ LWM2M_RD_CLIENT_EVENT_REG_UPDATE
Registration update.
Definition lwm2m.h:168
@ LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE
Bootstrap registration failure.
Definition lwm2m.h:144
@ LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_COMPLETE
Bootstrap registration complete.
Definition lwm2m.h:146
@ LWM2M_RD_CLIENT_EVENT_DISCONNECT
Disconnected.
Definition lwm2m.h:160
@ LWM2M_RD_CLIENT_EVENT_NONE
Invalid event.
Definition lwm2m.h:142
@ LWM2M_RD_CLIENT_EVENT_REGISTRATION_FAILURE
Registration failure.
Definition lwm2m.h:150
@ LWM2M_RD_CLIENT_EVENT_ENGINE_SUSPENDED
Engine suspended.
Definition lwm2m.h:164
@ LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR
Network error.
Definition lwm2m.h:166
struct _slist sys_slist_t
Single-linked list structure.
Definition slist.h:49
Public kernel APIs.
time_t time(time_t *tloc)
flags
Definition parser.h:96
state
Definition parser_state.h:29
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__INT32_TYPE__ int32_t
Definition stdint.h:74
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
__INT64_TYPE__ int64_t
Definition stdint.h:75
__INT8_TYPE__ int8_t
Definition stdint.h:72
__INT16_TYPE__ int16_t
Definition stdint.h:73
Represents a request awaiting for an acknowledgment (ACK).
Definition coap.h:376
Represents the handler for the reply of a request, it is also used when observing resources.
Definition coap.h:391
Mutex Structure.
Definition kernel.h:3004
LwM2M context structure to maintain information for a single LwM2M connection.
Definition lwm2m.h:207
lwm2m_socket_fault_cb_t fault_cb
Socket fault callback.
Definition lwm2m.h:302
char * desthostname
Destination hostname.
Definition lwm2m.h:247
lwm2m_observe_cb_t observe_cb
Callback for new or cancelled observations, and acknowledged or timed out notifications.
Definition lwm2m.h:307
struct sockaddr remote_addr
Destination address storage.
Definition lwm2m.h:209
uint8_t validate_buf[CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE]
Validation buffer.
Definition lwm2m.h:316
int(* load_credentials)(struct lwm2m_ctx *client_ctx)
Custom load_credentials function.
Definition lwm2m.h:255
int tls_tag
TLS tag is set by client as a reference used when the LwM2M engine calls tls_credential_(add|delete)
Definition lwm2m.h:241
int srv_obj_inst
Current index of Server Object used in this context.
Definition lwm2m.h:289
lwm2m_set_sockopt_cb_t set_socketoptions
Custom socket options.
Definition lwm2m.h:263
void * processed_req
A pointer to currently processed request, for internal LwM2M engine use.
Definition lwm2m.h:229
bool bootstrap_mode
Flag to enable BOOTSTRAP interface.
Definition lwm2m.h:294
lwm2m_ctx_event_cb_t event_cb
Callback for client events.
Definition lwm2m.h:310
int sec_obj_inst
Current index of Security Object used for server credentials.
Definition lwm2m.h:286
bool buffer_client_messages
Flag to indicate that the client is buffering Notifications and Send messages.
Definition lwm2m.h:283
void(* set_socket_state)(int fd, enum lwm2m_socket_states state)
Callback to indicate transmission states.
Definition lwm2m.h:324
bool use_dtls
Flag to indicate if context should use DTLS.
Definition lwm2m.h:270
int sock_fd
Socket File Descriptor.
Definition lwm2m.h:297
uint16_t desthostnamelen
Destination hostname length.
Definition lwm2m.h:249
bool connection_suspended
Flag to indicate that the socket connection is suspended.
Definition lwm2m.h:276
LwM2M object path structure.
Definition lwm2m.h:100
uint16_t obj_inst_id
Object instance ID.
Definition lwm2m.h:102
uint16_t res_inst_id
Resource instance ID.
Definition lwm2m.h:104
uint8_t level
Path level (0-4).
Definition lwm2m.h:105
uint16_t res_id
Resource ID.
Definition lwm2m.h:103
uint16_t obj_id
Object ID.
Definition lwm2m.h:101
LWM2M Objlnk resource type structure.
Definition lwm2m.h:788
uint16_t obj_id
Object ID.
Definition lwm2m.h:789
uint16_t obj_inst
Object instance ID.
Definition lwm2m.h:790
LwM2M resource item structure.
Definition lwm2m.h:1020
uint16_t size
Size of the value.
Definition lwm2m.h:1026
void * value
Pointer to resource value.
Definition lwm2m.h:1024
struct lwm2m_obj_path * path
Pointer to LwM2M path as a struct.
Definition lwm2m.h:1022
LwM2M Time series data structure.
Definition lwm2m.h:330
time_t t
Cached data Unix timestamp.
Definition lwm2m.h:332
Generic sockaddr struct.
Definition net_ip.h:408