Zephyr Project API 3.7.0
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
42/* clang-format off */
43#define LWM2M_OBJECT_SECURITY_ID 0
44#define LWM2M_OBJECT_SERVER_ID 1
45#define LWM2M_OBJECT_ACCESS_CONTROL_ID 2
46#define LWM2M_OBJECT_DEVICE_ID 3
47#define LWM2M_OBJECT_CONNECTIVITY_MONITORING_ID 4
48#define LWM2M_OBJECT_FIRMWARE_ID 5
49#define LWM2M_OBJECT_LOCATION_ID 6
50#define LWM2M_OBJECT_CONNECTIVITY_STATISTICS_ID 7
51#define LWM2M_OBJECT_SOFTWARE_MANAGEMENT_ID 9
52#define LWM2M_OBJECT_PORTFOLIO_ID 16
53#define LWM2M_OBJECT_BINARYAPPDATACONTAINER_ID 19
54#define LWM2M_OBJECT_EVENT_LOG_ID 20
55#define LWM2M_OBJECT_OSCORE_ID 21
56#define LWM2M_OBJECT_GATEWAY_ID 25
57/* clang-format on */
58
69/* clang-format off */
70#define IPSO_OBJECT_GENERIC_SENSOR_ID 3300
71#define IPSO_OBJECT_TEMP_SENSOR_ID 3303
72#define IPSO_OBJECT_HUMIDITY_SENSOR_ID 3304
73#define IPSO_OBJECT_LIGHT_CONTROL_ID 3311
74#define IPSO_OBJECT_ACCELEROMETER_ID 3313
75#define IPSO_OBJECT_VOLTAGE_SENSOR_ID 3316
76#define IPSO_OBJECT_CURRENT_SENSOR_ID 3317
77#define IPSO_OBJECT_PRESSURE_ID 3323
78#define IPSO_OBJECT_BUZZER_ID 3338
79#define IPSO_OBJECT_TIMER_ID 3340
80#define IPSO_OBJECT_ONOFF_SWITCH_ID 3342
81#define IPSO_OBJECT_PUSH_BUTTON_ID 3347
82#define UCIFI_OBJECT_BATTERY_ID 3411
83#define IPSO_OBJECT_FILLING_LEVEL_SENSOR_ID 3435
84/* clang-format on */
85
93typedef void (*lwm2m_socket_fault_cb_t)(int error);
94
103
113
124typedef void (*lwm2m_observe_cb_t)(enum lwm2m_observe_event event, struct lwm2m_obj_path *path,
125 void *user_data);
126
127
128struct lwm2m_ctx;
136typedef void (*lwm2m_ctx_event_cb_t)(struct lwm2m_ctx *ctx,
137 enum lwm2m_rd_client_event event);
138
139
155
160struct lwm2m_ctx {
163
167 struct coap_pending pendings[CONFIG_LWM2M_ENGINE_MAX_PENDING + 1];
168 struct coap_reply replies[CONFIG_LWM2M_ENGINE_MAX_REPLIES + 1];
169 sys_slist_t pending_sends;
170#if defined(CONFIG_LWM2M_QUEUE_MODE_ENABLED)
171 sys_slist_t queued_messages;
172#endif
173 sys_slist_t observer;
182
183#if defined(CONFIG_LWM2M_DTLS_SUPPORT) || defined(__DOXYGEN__)
194
204
209 int (*load_credentials)(struct lwm2m_ctx *client_ctx);
211#endif
217 int (*set_socketoptions)(struct lwm2m_ctx *client_ctx);
218
225
231
232#if defined(CONFIG_LWM2M_QUEUE_MODE_ENABLED) || defined(__DOXYGEN__)
238#endif
241
244
249
252
257
262
265
270 uint8_t validate_buf[CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE];
271
279};
280
288 union {
290 uint8_t u8;
291 uint16_t u16;
292 uint32_t u32;
293 uint64_t u64;
294 int8_t i8;
295 int16_t i16;
296 int32_t i32;
297 int64_t i64;
298 time_t time;
299 double f;
300 bool b;
302 };
303};
304
324typedef void *(*lwm2m_engine_get_data_cb_t)(uint16_t obj_inst_id,
325 uint16_t res_id,
326 uint16_t res_inst_id,
327 size_t *data_len);
328
360typedef int (*lwm2m_engine_set_data_cb_t)(uint16_t obj_inst_id,
361 uint16_t res_id, uint16_t res_inst_id,
362 uint8_t *data, uint16_t data_len,
363 bool last_block, size_t total_size, size_t offset);
364
381typedef int (*lwm2m_engine_user_cb_t)(uint16_t obj_inst_id);
382
399typedef int (*lwm2m_engine_execute_cb_t)(uint16_t obj_inst_id,
400 uint8_t *args, uint16_t args_len);
401
407#define LWM2M_DEVICE_PWR_SRC_TYPE_DC_POWER 0
408#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_INT 1
409#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_EXT 2
410#define LWM2M_DEVICE_PWR_SRC_TYPE_FUEL_CELL 3
411#define LWM2M_DEVICE_PWR_SRC_TYPE_PWR_OVER_ETH 4
412#define LWM2M_DEVICE_PWR_SRC_TYPE_USB 5
413#define LWM2M_DEVICE_PWR_SRC_TYPE_AC_POWER 6
414#define LWM2M_DEVICE_PWR_SRC_TYPE_SOLAR 7
415#define LWM2M_DEVICE_PWR_SRC_TYPE_MAX 8
425#define LWM2M_DEVICE_ERROR_NONE 0
426#define LWM2M_DEVICE_ERROR_LOW_POWER 1
427#define LWM2M_DEVICE_ERROR_EXT_POWER_SUPPLY_OFF 2
428#define LWM2M_DEVICE_ERROR_GPS_FAILURE 3
429#define LWM2M_DEVICE_ERROR_LOW_SIGNAL_STRENGTH 4
430#define LWM2M_DEVICE_ERROR_OUT_OF_MEMORY 5
431#define LWM2M_DEVICE_ERROR_SMS_FAILURE 6
432#define LWM2M_DEVICE_ERROR_NETWORK_FAILURE 7
433#define LWM2M_DEVICE_ERROR_PERIPHERAL_FAILURE 8
444#define LWM2M_DEVICE_BATTERY_STATUS_NORMAL 0
447#define LWM2M_DEVICE_BATTERY_STATUS_CHARGING 1
448#define LWM2M_DEVICE_BATTERY_STATUS_CHARGE_COMP 2
451#define LWM2M_DEVICE_BATTERY_STATUS_DAMAGED 3
452#define LWM2M_DEVICE_BATTERY_STATUS_LOW 4
453#define LWM2M_DEVICE_BATTERY_STATUS_NOT_INST 5
454#define LWM2M_DEVICE_BATTERY_STATUS_UNKNOWN 6
466
467
479#define STATE_IDLE 0
483#define STATE_DOWNLOADING 1
487#define STATE_DOWNLOADED 2
491#define STATE_UPDATING 3
492
503#define RESULT_DEFAULT 0
504#define RESULT_SUCCESS 1
505#define RESULT_NO_STORAGE 2
506#define RESULT_OUT_OF_MEM 3
507#define RESULT_CONNECTION_LOST 4
508#define RESULT_INTEGRITY_FAILED 5
509#define RESULT_UNSUP_FW 6
510#define RESULT_INVALID_URI 7
511#define RESULT_UPDATE_FAILED 8
512#define RESULT_UNSUP_PROTO 9
516#if defined(CONFIG_LWM2M_FIRMWARE_UPDATE_OBJ_SUPPORT) || defined(__DOXYGEN__)
526
533
544
552
562
569
580
588
598
605
616
624#endif
625
626#if defined(CONFIG_LWM2M_SWMGMT_OBJ_SUPPORT) || defined(__DOXYGEN__)
627
640
653
666
679
692
705
716int lwm2m_swmgmt_install_completed(uint16_t obj_inst_id, int error_code);
717
718#endif
719
720#if defined(CONFIG_LWM2M_EVENT_LOG_OBJ_SUPPORT) || defined(__DOXYGEN__)
721
731
732#endif
733
737#define LWM2M_OBJLNK_MAX_ID USHRT_MAX
738
746
762 const struct lwm2m_obj_path *path, uint32_t period_s);
763
779 const struct lwm2m_obj_path *path, uint32_t period_s);
780
793
804
813
819
829int lwm2m_set_opaque(const struct lwm2m_obj_path *path, const char *data_ptr, uint16_t data_len);
830
839int lwm2m_set_string(const struct lwm2m_obj_path *path, const char *data_ptr);
840
849int lwm2m_set_u8(const struct lwm2m_obj_path *path, uint8_t value);
850
859int lwm2m_set_u16(const struct lwm2m_obj_path *path, uint16_t value);
860
869int lwm2m_set_u32(const struct lwm2m_obj_path *path, uint32_t value);
870
883__deprecated
884int lwm2m_set_u64(const struct lwm2m_obj_path *path, uint64_t value);
885
894int lwm2m_set_s8(const struct lwm2m_obj_path *path, int8_t value);
895
904int lwm2m_set_s16(const struct lwm2m_obj_path *path, int16_t value);
905
914int lwm2m_set_s32(const struct lwm2m_obj_path *path, int32_t value);
915
924int lwm2m_set_s64(const struct lwm2m_obj_path *path, int64_t value);
925
934int lwm2m_set_bool(const struct lwm2m_obj_path *path, bool value);
935
944int lwm2m_set_f64(const struct lwm2m_obj_path *path, const double value);
945
954int lwm2m_set_objlnk(const struct lwm2m_obj_path *path, const struct lwm2m_objlnk *value);
955
964int lwm2m_set_time(const struct lwm2m_obj_path *path, time_t value);
965
997
1010int lwm2m_set_bulk(const struct lwm2m_res_item res_list[], size_t res_list_size);
1011
1021int lwm2m_get_opaque(const struct lwm2m_obj_path *path, void *buf, uint16_t buflen);
1022
1032int lwm2m_get_string(const struct lwm2m_obj_path *path, void *str, uint16_t buflen);
1033
1042int lwm2m_get_u8(const struct lwm2m_obj_path *path, uint8_t *value);
1043
1052int lwm2m_get_u16(const struct lwm2m_obj_path *path, uint16_t *value);
1053
1062int lwm2m_get_u32(const struct lwm2m_obj_path *path, uint32_t *value);
1063
1076__deprecated
1077int lwm2m_get_u64(const struct lwm2m_obj_path *path, uint64_t *value);
1078
1087int lwm2m_get_s8(const struct lwm2m_obj_path *path, int8_t *value);
1088
1097int lwm2m_get_s16(const struct lwm2m_obj_path *path, int16_t *value);
1098
1107int lwm2m_get_s32(const struct lwm2m_obj_path *path, int32_t *value);
1108
1117int lwm2m_get_s64(const struct lwm2m_obj_path *path, int64_t *value);
1118
1127int lwm2m_get_bool(const struct lwm2m_obj_path *path, bool *value);
1128
1137int lwm2m_get_f64(const struct lwm2m_obj_path *path, double *value);
1138
1147int lwm2m_get_objlnk(const struct lwm2m_obj_path *path, struct lwm2m_objlnk *buf);
1148
1157int lwm2m_get_time(const struct lwm2m_obj_path *path, time_t *buf);
1158
1178
1193
1216
1233
1245
1258
1271
1275#define LWM2M_RES_DATA_READ_ONLY 0
1276
1280#define LWM2M_RES_DATA_FLAG_RO BIT(LWM2M_RES_DATA_READ_ONLY)
1281
1285#define LWM2M_HAS_RES_FLAG(res, f) ((res->data_flags & f) == f)
1286
1301int lwm2m_set_res_buf(const struct lwm2m_obj_path *path, void *buffer_ptr, uint16_t buffer_len,
1302 uint16_t data_len, uint8_t data_flags);
1303
1314int lwm2m_set_res_data_len(const struct lwm2m_obj_path *path, uint16_t data_len);
1315
1335int lwm2m_get_res_buf(const struct lwm2m_obj_path *path, void **buffer_ptr, uint16_t *buffer_len,
1336 uint16_t *data_len, uint8_t *data_flags);
1337
1350
1361
1373
1386
1398int lwm2m_engine_stop(struct lwm2m_ctx *client_ctx);
1399
1411int lwm2m_engine_start(struct lwm2m_ctx *client_ctx);
1412
1424void lwm2m_acknowledge(struct lwm2m_ctx *client_ctx);
1425
1466
1467/*
1468 * LwM2M RD client flags, used to configure LwM2M session.
1469 */
1470
1474#define LWM2M_RD_CLIENT_FLAG_BOOTSTRAP BIT(0)
1475
1497int lwm2m_rd_client_start(struct lwm2m_ctx *client_ctx, const char *ep_name,
1499 lwm2m_observe_cb_t observe_cb);
1500
1516int lwm2m_rd_client_stop(struct lwm2m_ctx *client_ctx,
1517 lwm2m_ctx_event_cb_t event_cb, bool deregister);
1518
1529
1541
1546
1550#define LWM2M_MAX_PATH_STR_SIZE sizeof("/65535/65535/65535/65535")
1551
1560char *lwm2m_path_log_buf(char *buf, struct lwm2m_obj_path *path);
1561
1573
1578typedef void (*lwm2m_send_cb_t)(enum lwm2m_send_status status);
1579
1591int lwm2m_send_cb(struct lwm2m_ctx *ctx, const struct lwm2m_obj_path path_list[],
1592 uint8_t path_list_size, lwm2m_send_cb_t reply_cb);
1593
1601
1615int lwm2m_enable_cache(const struct lwm2m_obj_path *path, struct lwm2m_time_series_elem *data_cache,
1616 size_t cache_len);
1617
1628
1638
1650
1651#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:1621
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:1568
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:136
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:360
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:324
void lwm2m_firmware_set_update_cb(lwm2m_engine_execute_cb_t cb)
Set data callback to handle firmware update execute events.
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:149
int lwm2m_swmgmt_set_deactivate_cb(uint16_t obj_inst_id, lwm2m_engine_execute_cb_t cb)
Set callback to handle software deactivation requests.
void(* lwm2m_send_cb_t)(enum lwm2m_send_status status)
Callback returning send status.
Definition lwm2m.h:1578
int lwm2m_get_u64(const struct lwm2m_obj_path *path, uint64_t *value)
Get resource (instance) value (u64)
struct lwm2m_ctx * lwm2m_rd_client_ctx(void)
&#160;
int lwm2m_set_u64(const struct lwm2m_obj_path *path, uint64_t value)
Set resource (instance) value (u64)
void lwm2m_acknowledge(struct lwm2m_ctx *client_ctx)
Acknowledge the currently processed request with an empty ACK.
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:381
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:107
lwm2m_rd_client_event
LwM2M RD client events.
Definition lwm2m.h:1432
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:124
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:93
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:399
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_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:1622
@ LWM2M_SECURITY_RAW_PK
Raw Public Key mode.
Definition lwm2m.h:1623
@ LWM2M_SECURITY_CERT
Certificate mode.
Definition lwm2m.h:1624
@ LWM2M_SECURITY_CERT_EST
Certificate mode with EST.
Definition lwm2m.h:1626
@ LWM2M_SECURITY_NOSEC
NoSec mode.
Definition lwm2m.h:1625
@ LWM2M_SEND_STATUS_SUCCESS
Succeed.
Definition lwm2m.h:1569
@ LWM2M_SEND_STATUS_FAILURE
Failure.
Definition lwm2m.h:1570
@ LWM2M_SEND_STATUS_TIMEOUT
Timeout.
Definition lwm2m.h:1571
@ LWM2M_SOCKET_STATE_NO_DATA
No more data is expected.
Definition lwm2m.h:153
@ LWM2M_SOCKET_STATE_ONE_RESPONSE
One response is expected for the next message.
Definition lwm2m.h:151
@ LWM2M_SOCKET_STATE_ONGOING
Ongoing traffic is expected.
Definition lwm2m.h:150
@ LWM2M_SOCKET_STATE_LAST
Next message is the last one.
Definition lwm2m.h:152
@ LWM2M_OBSERVE_EVENT_OBSERVER_ADDED
Observer added.
Definition lwm2m.h:108
@ LWM2M_OBSERVE_EVENT_NOTIFY_TIMEOUT
Notification timed out.
Definition lwm2m.h:111
@ LWM2M_OBSERVE_EVENT_NOTIFY_ACK
Notification ACKed.
Definition lwm2m.h:110
@ LWM2M_OBSERVE_EVENT_OBSERVER_REMOVED
Observer removed.
Definition lwm2m.h:109
@ LWM2M_RD_CLIENT_EVENT_DEREGISTER_FAILURE
De-registration failure.
Definition lwm2m.h:1450
@ LWM2M_RD_CLIENT_EVENT_QUEUE_MODE_RX_OFF
Queue mode RX off.
Definition lwm2m.h:1454
@ LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_TRANSFER_COMPLETE
Bootstrap transfer complete.
Definition lwm2m.h:1440
@ LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED
Server disabled.
Definition lwm2m.h:1464
@ LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE
Registration complete.
Definition lwm2m.h:1444
@ LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT
Registration timeout.
Definition lwm2m.h:1446
@ LWM2M_RD_CLIENT_EVENT_REG_UPDATE_COMPLETE
Registration update complete.
Definition lwm2m.h:1448
@ LWM2M_RD_CLIENT_EVENT_DEREGISTER
De-register.
Definition lwm2m.h:1462
@ LWM2M_RD_CLIENT_EVENT_REG_UPDATE
Registration update.
Definition lwm2m.h:1460
@ LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE
Bootstrap registration failure.
Definition lwm2m.h:1436
@ LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_COMPLETE
Bootstrap registration complete.
Definition lwm2m.h:1438
@ LWM2M_RD_CLIENT_EVENT_DISCONNECT
Disconnected.
Definition lwm2m.h:1452
@ LWM2M_RD_CLIENT_EVENT_NONE
Invalid event.
Definition lwm2m.h:1434
@ LWM2M_RD_CLIENT_EVENT_REGISTRATION_FAILURE
Registration failure.
Definition lwm2m.h:1442
@ LWM2M_RD_CLIENT_EVENT_ENGINE_SUSPENDED
Engine suspended.
Definition lwm2m.h:1456
@ LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR
Network error.
Definition lwm2m.h:1458
struct _slist sys_slist_t
Single-linked list structure.
Definition slist.h:49
Public kernel APIs.
struct k_futex f
Definition kobject.c:1327
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:352
Represents the handler for the reply of a request, it is also used when observing resources.
Definition coap.h:367
LwM2M context structure to maintain information for a single LwM2M connection.
Definition lwm2m.h:160
lwm2m_socket_fault_cb_t fault_cb
Socket fault callback.
Definition lwm2m.h:256
char * desthostname
Destination hostname.
Definition lwm2m.h:199
bool hostname_verify
Flag to indicate if hostname verification is enabled.
Definition lwm2m.h:203
lwm2m_observe_cb_t observe_cb
Callback for new or cancelled observations, and acknowledged or timed out notifications.
Definition lwm2m.h:261
struct sockaddr remote_addr
Destination address storage.
Definition lwm2m.h:162
uint8_t validate_buf[CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE]
Validation buffer.
Definition lwm2m.h:270
int(* load_credentials)(struct lwm2m_ctx *client_ctx)
Custom load_credentials function.
Definition lwm2m.h:209
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:193
int(* set_socketoptions)(struct lwm2m_ctx *client_ctx)
Custom socket options.
Definition lwm2m.h:217
int srv_obj_inst
Current index of Server Object used in this context.
Definition lwm2m.h:243
void * processed_req
A pointer to currently processed request, for internal LwM2M engine use.
Definition lwm2m.h:181
bool bootstrap_mode
Flag to enable BOOTSTRAP interface.
Definition lwm2m.h:248
lwm2m_ctx_event_cb_t event_cb
Callback for client events.
Definition lwm2m.h:264
int sec_obj_inst
Current index of Security Object used for server credentials.
Definition lwm2m.h:240
bool buffer_client_messages
Flag to indicate that the client is buffering Notifications and Send messages.
Definition lwm2m.h:237
void(* set_socket_state)(int fd, enum lwm2m_socket_states state)
Callback to indicate transmission states.
Definition lwm2m.h:278
bool use_dtls
Flag to indicate if context should use DTLS.
Definition lwm2m.h:224
int sock_fd
Socket File Descriptor.
Definition lwm2m.h:251
uint16_t desthostnamelen
Destination hostname length.
Definition lwm2m.h:201
bool connection_suspended
Flag to indicate that the socket connection is suspended.
Definition lwm2m.h:230
LwM2M object path structure.
Definition lwm2m.h:96
uint16_t obj_inst_id
Object instance ID.
Definition lwm2m.h:98
uint16_t res_inst_id
Resource instance ID.
Definition lwm2m.h:100
uint8_t level
Path level (0-4).
Definition lwm2m.h:101
uint16_t res_id
Resource ID.
Definition lwm2m.h:99
uint16_t obj_id
Object ID.
Definition lwm2m.h:97
LWM2M Objlnk resource type structure.
Definition lwm2m.h:742
uint16_t obj_id
Object ID.
Definition lwm2m.h:743
uint16_t obj_inst
Object instance ID.
Definition lwm2m.h:744
LwM2M resource item structure.
Definition lwm2m.h:989
uint16_t size
Size of the value.
Definition lwm2m.h:995
void * value
Pointer to resource value.
Definition lwm2m.h:993
struct lwm2m_obj_path * path
Pointer to LwM2M path as a struct.
Definition lwm2m.h:991
LwM2M Time series data structure.
Definition lwm2m.h:284
time_t t
Cached data Unix timestamp.
Definition lwm2m.h:286
Generic sockaddr struct.
Definition net_ip.h:385
static fdata_t data[2]
Definition test_fifo_contexts.c:15
static const intptr_t user_data[5]
Definition main.c:588