23#ifndef ZEPHYR_INCLUDE_NET_LWM2M_H_
24#define ZEPHYR_INCLUDE_NET_LWM2M_H_
38#define LWM2M_OBJECT_SECURITY_ID 0
39#define LWM2M_OBJECT_SERVER_ID 1
40#define LWM2M_OBJECT_ACCESS_CONTROL_ID 2
41#define LWM2M_OBJECT_DEVICE_ID 3
42#define LWM2M_OBJECT_CONNECTIVITY_MONITORING_ID 4
43#define LWM2M_OBJECT_FIRMWARE_ID 5
44#define LWM2M_OBJECT_LOCATION_ID 6
45#define LWM2M_OBJECT_CONNECTIVITY_STATISTICS_ID 7
55#define IPSO_OBJECT_GENERIC_SENSOR_ID 3300
56#define IPSO_OBJECT_TEMP_SENSOR_ID 3303
57#define IPSO_OBJECT_HUMIDITY_SENSOR_ID 3304
58#define IPSO_OBJECT_LIGHT_CONTROL_ID 3311
59#define IPSO_OBJECT_ACCELEROMETER_ID 3313
60#define IPSO_OBJECT_PRESSURE_ID 3323
61#define IPSO_OBJECT_BUZZER_ID 3338
62#define IPSO_OBJECT_TIMER_ID 3340
63#define IPSO_OBJECT_ONOFF_SWITCH_ID 3342
64#define IPSO_OBJECT_PUSH_BUTTON_ID 3347
91#if defined(CONFIG_LWM2M_DTLS_SUPPORT)
100 int (*load_credentials)(
struct lwm2m_ctx *client_ctx);
161typedef void *(*lwm2m_engine_get_data_cb_t)(
uint16_t obj_inst_id,
195 bool last_block,
size_t total_size);
238#define LWM2M_DEVICE_PWR_SRC_TYPE_DC_POWER 0
239#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_INT 1
240#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_EXT 2
241#define LWM2M_DEVICE_PWR_SRC_TYPE_UNUSED 3
242#define LWM2M_DEVICE_PWR_SRC_TYPE_PWR_OVER_ETH 4
243#define LWM2M_DEVICE_PWR_SRC_TYPE_USB 5
244#define LWM2M_DEVICE_PWR_SRC_TYPE_AC_POWER 6
245#define LWM2M_DEVICE_PWR_SRC_TYPE_SOLAR 7
246#define LWM2M_DEVICE_PWR_SRC_TYPE_MAX 8
253#define LWM2M_DEVICE_ERROR_NONE 0
254#define LWM2M_DEVICE_ERROR_LOW_POWER 1
255#define LWM2M_DEVICE_ERROR_EXT_POWER_SUPPLY_OFF 2
256#define LWM2M_DEVICE_ERROR_GPS_FAILURE 3
257#define LWM2M_DEVICE_ERROR_LOW_SIGNAL_STRENGTH 4
258#define LWM2M_DEVICE_ERROR_OUT_OF_MEMORY 5
259#define LWM2M_DEVICE_ERROR_SMS_FAILURE 6
260#define LWM2M_DEVICE_ERROR_NETWORK_FAILURE 7
261#define LWM2M_DEVICE_ERROR_PERIPHERAL_FAILURE 8
269#define LWM2M_DEVICE_BATTERY_STATUS_NORMAL 0
270#define LWM2M_DEVICE_BATTERY_STATUS_CHARGING 1
271#define LWM2M_DEVICE_BATTERY_STATUS_CHARGE_COMP 2
272#define LWM2M_DEVICE_BATTERY_STATUS_DAMAGED 3
273#define LWM2M_DEVICE_BATTERY_STATUS_LOW 4
274#define LWM2M_DEVICE_BATTERY_STATUS_NOT_INST 5
275#define LWM2M_DEVICE_BATTERY_STATUS_UNKNOWN 6
294#define STATE_DOWNLOADING 1
295#define STATE_DOWNLOADED 2
296#define STATE_UPDATING 3
304#define RESULT_DEFAULT 0
305#define RESULT_SUCCESS 1
306#define RESULT_NO_STORAGE 2
307#define RESULT_OUT_OF_MEM 3
308#define RESULT_CONNECTION_LOST 4
309#define RESULT_INTEGRITY_FAILED 5
310#define RESULT_UNSUP_FW 6
311#define RESULT_INVALID_URI 7
312#define RESULT_UPDATE_FAILED 8
313#define RESULT_UNSUP_PROTO 9
315#if defined(CONFIG_LWM2M_FIRMWARE_UPDATE_OBJ_SUPPORT)
333#if defined(CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT)
371#define LWM2M_FLOAT32_DEC_MAX 1000000
384#define LWM2M_OBJLNK_MAX_ID USHRT_MAX
822#define LWM2M_RES_DATA_READ_ONLY 0
827#define LWM2M_RES_DATA_FLAG_RO BIT(LWM2M_RES_DATA_READ_ONLY)
832#define LWM2M_HAS_RES_FLAG(res, f) ((res->data_flags & f) == f)
959#define LWM2M_RD_CLIENT_FLAG_BOOTSTRAP BIT(0)
CoAP implementation for Zephyr.
void
Definition: eswifi_shell.c:15
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)
Asynchronous callback when data has been set to a resource buffer.
Definition: lwm2m.h:192
int lwm2m_engine_update_service_period(k_work_handler_t service, uint32_t period_ms)
Update the period of a given service.
int lwm2m_engine_get_s32(char *pathstr, int32_t *value)
Get resource (instance) value (s32)
int lwm2m_engine_register_exec_callback(char *pathstr, lwm2m_engine_execute_cb_t cb)
Set resource execute event callback.
int lwm2m_engine_get_res_data(char *pathstr, void **data_ptr, uint16_t *data_len, uint8_t *data_flags)
Get data buffer for a resource.
int lwm2m_engine_set_u64(char *pathstr, uint64_t value)
Set resource (instance) value (u64)
int lwm2m_engine_update_observer_max_period(char *pathstr, uint32_t period_s)
Change an observer's pmax value.
void(* lwm2m_ctx_event_cb_t)(struct lwm2m_ctx *ctx, enum lwm2m_rd_client_event event)
Asynchronous RD client event callback.
Definition: lwm2m.h:967
int lwm2m_engine_get_float32(char *pathstr, float32_value_t *buf)
Get resource (instance) value (32-bit float structure)
int lwm2m_engine_get_s64(char *pathstr, int64_t *value)
Get resource (instance) value (s64)
int lwm2m_engine_get_u16(char *pathstr, uint16_t *value)
Get resource (instance) value (u16)
int lwm2m_engine_get_s16(char *pathstr, int16_t *value)
Get resource (instance) value (s16)
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:161
int lwm2m_engine_set_u16(char *pathstr, uint16_t value)
Set resource (instance) value (u16)
int lwm2m_engine_set_objlnk(char *pathstr, struct lwm2m_objlnk *value)
Set resource (instance) value (ObjLnk)
int lwm2m_engine_set_string(char *pathstr, char *data_ptr)
Set resource (instance) value (string)
int lwm2m_engine_register_delete_callback(uint16_t obj_id, lwm2m_engine_user_cb_t cb)
Set object instance delete event callback.
int lwm2m_engine_create_res_inst(char *pathstr)
Create a resource instance.
int lwm2m_engine_get_u64(char *pathstr, uint64_t *value)
Get resource (instance) value (u64)
int lwm2m_engine_get_objlnk(char *pathstr, struct lwm2m_objlnk *buf)
Get resource (instance) value (ObjLnk)
int lwm2m_engine_set_bool(char *pathstr, bool value)
Set resource (instance) value (bool)
int lwm2m_engine_get_u32(char *pathstr, uint32_t *value)
Get resource (instance) value (u32)
int lwm2m_engine_set_s16(char *pathstr, int16_t value)
Set resource (instance) value (s16)
int lwm2m_engine_set_opaque(char *pathstr, char *data_ptr, uint16_t data_len)
Set resource (instance) value (opaque buffer)
int lwm2m_engine_set_res_data(char *pathstr, void *data_ptr, uint16_t data_len, uint8_t data_flags)
Set data buffer for a resource.
int lwm2m_engine_get_bool(char *pathstr, bool *value)
Get resource (instance) value (bool)
int lwm2m_engine_register_pre_write_callback(char *pathstr, lwm2m_engine_get_data_cb_t cb)
Set resource (instance) pre-write callback.
void lwm2m_acknowledge(struct lwm2m_ctx *client_ctx)
Acknowledge the currently processed request with an empty ACK.
int lwm2m_engine_register_validate_callback(char *pathstr, lwm2m_engine_set_data_cb_t cb)
Set resource (instance) validation callback.
int lwm2m_engine_start(struct lwm2m_ctx *client_ctx)
Start the LwM2M engine.
int lwm2m_engine_register_create_callback(uint16_t obj_id, lwm2m_engine_user_cb_t cb)
Set object instance create event callback.
int lwm2m_engine_set_s64(char *pathstr, int64_t value)
Set resource (instance) value (s64)
int lwm2m_engine_set_u8(char *pathstr, uint8_t value)
Set resource (instance) value (u8)
int lwm2m_engine_delete_obj_inst(char *pathstr)
Delete an LwM2M object instance.
void lwm2m_rd_client_update(void)
Trigger a Registration Update of the LwM2M RD Client.
int lwm2m_engine_get_s8(char *pathstr, int8_t *value)
Get resource (instance) value (s8)
void lwm2m_rd_client_stop(struct lwm2m_ctx *client_ctx, lwm2m_ctx_event_cb_t event_cb)
Stop the LwM2M RD (De-register) Client.
int lwm2m_engine_register_post_write_callback(char *pathstr, lwm2m_engine_set_data_cb_t cb)
Set resource (instance) post-write callback.
int lwm2m_engine_get_string(char *pathstr, void *str, uint16_t strlen)
Get resource (instance) value (string)
int(* lwm2m_engine_user_cb_t)(uint16_t obj_inst_id)
Asynchronous event notification callback.
Definition: lwm2m.h:213
int lwm2m_device_add_err(uint8_t error_code)
Register a new error code with LwM2M Device object.
int lwm2m_engine_create_obj_inst(char *pathstr)
Create an LwM2M object instance.
struct float32_value float32_value_t
32-bit variant of the LwM2M float structure
int lwm2m_engine_set_u32(char *pathstr, uint32_t value)
Set resource (instance) value (u32)
int lwm2m_engine_set_s32(char *pathstr, int32_t value)
Set resource (instance) value (s32)
void lwm2m_rd_client_start(struct lwm2m_ctx *client_ctx, const char *ep_name, uint32_t flags, lwm2m_ctx_event_cb_t event_cb)
Start the LwM2M RD (Registration / Discovery) Client.
int lwm2m_engine_register_read_callback(char *pathstr, lwm2m_engine_get_data_cb_t cb)
Set resource (instance) read callback.
lwm2m_rd_client_event
LwM2M RD client events.
Definition: lwm2m.h:937
int lwm2m_engine_set_float32(char *pathstr, float32_value_t *value)
Set resource (instance) value (32-bit float structure)
int lwm2m_engine_get_u8(char *pathstr, uint8_t *value)
Get resource (instance) value (u8)
int lwm2m_engine_set_s8(char *pathstr, int8_t value)
Set resource (instance) value (s8)
void(* lwm2m_socket_fault_cb_t)(int error)
Definition: lwm2m.h:67
int lwm2m_engine_update_observer_min_period(char *pathstr, uint32_t period_s)
Change an observer's pmin value.
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:231
void(* lwm2m_notify_timeout_cb_t)(void)
Definition: lwm2m.h:68
int lwm2m_engine_get_opaque(char *pathstr, void *buf, uint16_t buflen)
Get resource (instance) value (opaque buffer)
int lwm2m_engine_delete_res_inst(char *pathstr)
Delete a resource instance.
@ LWM2M_RD_CLIENT_EVENT_REG_UPDATE_FAILURE
Definition: lwm2m.h:944
@ LWM2M_RD_CLIENT_EVENT_DEREGISTER_FAILURE
Definition: lwm2m.h:946
@ LWM2M_RD_CLIENT_EVENT_QUEUE_MODE_RX_OFF
Definition: lwm2m.h:948
@ LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_TRANSFER_COMPLETE
Definition: lwm2m.h:941
@ LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE
Definition: lwm2m.h:943
@ LWM2M_RD_CLIENT_EVENT_REG_UPDATE_COMPLETE
Definition: lwm2m.h:945
@ LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE
Definition: lwm2m.h:939
@ LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_COMPLETE
Definition: lwm2m.h:940
@ LWM2M_RD_CLIENT_EVENT_DISCONNECT
Definition: lwm2m.h:947
@ LWM2M_RD_CLIENT_EVENT_NONE
Definition: lwm2m.h:938
@ LWM2M_RD_CLIENT_EVENT_REGISTRATION_FAILURE
Definition: lwm2m.h:942
@ LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR
Definition: lwm2m.h:949
void(* k_work_handler_t)(struct k_work *work)
The signature for a work item handler function.
Definition: kernel.h:3031
flags
Definition: http_parser.h:131
struct _slist sys_slist_t
Definition: slist.h:40
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__INT32_TYPE__ int32_t
Definition: stdint.h:44
__UINT64_TYPE__ uint64_t
Definition: stdint.h:61
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
__INT64_TYPE__ int64_t
Definition: stdint.h:45
__INT8_TYPE__ int8_t
Definition: stdint.h:42
__INT16_TYPE__ int16_t
Definition: stdint.h:43
size_t strlen(const char *s)
Represents the current state of a block-wise transaction.
Definition: coap.h:552
Represents a request awaiting for an acknowledgment (ACK).
Definition: coap.h:265
Represents the handler for the reply of a request, it is also used when observing resources.
Definition: coap.h:279
32-bit variant of the LwM2M float structure
Definition: lwm2m.h:376
int32_t val2
Definition: lwm2m.h:378
int32_t val1
Definition: lwm2m.h:377
LwM2M context structure to maintain information for a single LwM2M connection.
Definition: lwm2m.h:74
struct coap_reply replies[CONFIG_LWM2M_ENGINE_MAX_REPLIES]
Definition: lwm2m.h:80
lwm2m_socket_fault_cb_t fault_cb
Definition: lwm2m.h:127
sys_slist_t observer
Definition: lwm2m.h:82
lwm2m_notify_timeout_cb_t notify_timeout_cb
Definition: lwm2m.h:132
struct sockaddr remote_addr
Definition: lwm2m.h:76
uint8_t validate_buf[CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE]
Definition: lwm2m.h:138
struct coap_pending pendings[CONFIG_LWM2M_ENGINE_MAX_PENDING]
Definition: lwm2m.h:79
int srv_obj_inst
Definition: lwm2m.h:113
void * processed_req
Definition: lwm2m.h:89
bool bootstrap_mode
Definition: lwm2m.h:119
int sec_obj_inst
Definition: lwm2m.h:110
bool use_dtls
Definition: lwm2m.h:107
sys_slist_t pending_sends
Definition: lwm2m.h:81
int sock_fd
Definition: lwm2m.h:122
LWM2M ObjLnk resource type structure.
Definition: lwm2m.h:389
uint16_t obj_id
Definition: lwm2m.h:390
uint16_t obj_inst
Definition: lwm2m.h:391
static fdata_t data[2]
Definition: test_fifo_contexts.c:15