File syn_lwm2m.h¶
FileList > proto > syn_lwm2m.h
Go to the source code of this file
Zero-Heap OMA Lightweight M2M (LwM2M v1.1/v1.2) Core Client Engine. More...
#include "syntropic/common/syn_defs.h"#include "syntropic/net/syn_coap.h"
Classes¶
| Type | Name |
|---|---|
| struct | SYN_LwM2M_Client LwM2M Client Context. |
| struct | SYN_LwM2M_DeviceContext Device Object (Object ID 3) state and context. |
| struct | SYN_LwM2M_FirmwareContext Firmware Update Object (Object ID 5) context. |
| struct | SYN_LwM2M_Object LwM2M Object Definition. |
| struct | SYN_LwM2M_Observation Active resource or instance observation (RFC 7641). |
| struct | SYN_LwM2M_ResourceDesc Resource descriptor defining ID, permissions, and type. |
| struct | SYN_LwM2M_SensorContext Generic Sensor / Temperature Object (Object ID 3303) context. |
| struct | SYN_LwM2M_TLV Decoded / to-be-encoded LwM2M TLV item. |
| struct | SYN_LwM2M_Value LwM2M Generic Value Container. |
Public Types¶
| Type | Name |
|---|---|
| enum | SYN_LwM2M_ClientState LwM2M client registration states. |
| typedef SYN_Status(* | SYN_LwM2M_ExecCb Execute callback: executes an executable resource with optional arguments. |
| enum | SYN_LwM2M_FirmwareResult Firmware Update Object (Object ID 5) update results. |
| enum | SYN_LwM2M_FirmwareState Firmware Update Object (Object ID 5) states per OMA LwM2M spec. |
| typedef SYN_Status(* | SYN_LwM2M_ReadCb Read callback: retrieves current resource value. |
| enum | SYN_LwM2M_TLV_Type LwM2M TLV Type identifier (Bits 7-6 of TLV header byte). |
| enum | SYN_LwM2M_ValType LwM2M primitive resource value types. |
| typedef SYN_Status(* | SYN_LwM2M_WriteCb Write callback: writes new resource value. |
Public Functions¶
| Type | Name |
|---|---|
| size_t | syn_lwm2m_build_deregister_request (const SYN_LwM2M_Client * client, uint16_t msg_id, const uint8_t * token, uint8_t token_len, SYN_CoapMsg * req, SYN_CoapOption * req_opts, size_t max_req_opts, size_t * req_opt_cnt) Build a CoAP Deregistration DELETE request ( /rd/<location> ). |
| size_t | syn_lwm2m_build_notify (SYN_LwM2M_Client * client, uint16_t obj_id, uint16_t inst_id, int32_t res_id, uint16_t msg_id, SYN_CoapMsg * resp, SYN_CoapOption * resp_opts, size_t max_resp_opts, size_t * resp_opt_cnt, uint8_t * resp_buf, size_t resp_buf_sz) Build a CoAP Notification response for an active observation. |
| size_t | syn_lwm2m_build_register_request (const SYN_LwM2M_Client * client, uint16_t msg_id, const uint8_t * token, uint8_t token_len, SYN_CoapMsg * req, SYN_CoapOption * req_opts, size_t max_req_opts, size_t * req_opt_cnt, uint8_t * payload_buf, size_t payload_buf_sz) Build a CoAP Registration POST request ( /rd?ep=...<=... ). |
| size_t | syn_lwm2m_build_update_request (const SYN_LwM2M_Client * client, uint16_t msg_id, const uint8_t * token, uint8_t token_len, uint32_t lifetime_s, SYN_CoapMsg * req, SYN_CoapOption * req_opts, size_t max_req_opts, size_t * req_opt_cnt, uint8_t * payload_buf, size_t payload_buf_sz) Build a CoAP Registration Update POST request ( /rd/<location> ). |
| bool | syn_lwm2m_client_init (SYN_LwM2M_Client * client, const char * endpoint_name, uint32_t lifetime_s, SYN_Transport * transport) Initialize a zero-heap LwM2M client context. |
| size_t | syn_lwm2m_generate_link_format (const SYN_LwM2M_Client * client, char * buf, size_t max_len) Generate CoRE Link Format string listing all registered object instances. |
| bool | syn_lwm2m_handle_register_response (SYN_LwM2M_Client * client, const SYN_CoapMsg * resp, const SYN_CoapOption * resp_opts, size_t resp_opt_cnt) Handle server response to Registration request (parses Location-Path). |
| SYN_LwM2M_Object | syn_lwm2m_make_device_object (SYN_LwM2M_DeviceContext * ctx) Create an Object 3 (Device) descriptor bound to ctx . |
| SYN_LwM2M_Object | syn_lwm2m_make_firmware_object (SYN_LwM2M_FirmwareContext * ctx) Create an Object 5 (Firmware Update) descriptor bound to ctx . |
| SYN_LwM2M_Object | syn_lwm2m_make_temperature_object (SYN_LwM2M_SensorContext * ctx) Create an Object 3303 (Temperature Sensor) descriptor bound to ctx . |
| bool | syn_lwm2m_observe_add (SYN_LwM2M_Client * client, uint16_t obj_id, uint16_t inst_id, int32_t res_id, const uint8_t * token, uint8_t token_len, uint32_t pmin, uint32_t pmax) Add or update an observation for an object instance or resource. |
| bool | syn_lwm2m_observe_remove (SYN_LwM2M_Client * client, const uint8_t * token, uint8_t token_len) Remove an active observation by matching token. |
| SYN_Status | syn_lwm2m_process_request (SYN_LwM2M_Client * client, const SYN_CoapMsg * req, const SYN_CoapOption * req_opts, size_t req_opt_cnt, SYN_CoapMsg * resp, SYN_CoapOption * resp_opts, size_t max_resp_opts, size_t * resp_opt_cnt, uint8_t * resp_buf, size_t resp_buf_sz) Dispatch and process an incoming CoAP request against registered LwM2M objects. |
| bool | syn_lwm2m_register_object (SYN_LwM2M_Client * client, const SYN_LwM2M_Object * obj) Register an object definition into the client object registry. |
| bool | syn_lwm2m_tlv_decode (const uint8_t * buf, size_t buf_len, SYN_LwM2M_TLV * tlv, size_t * consumed) Decode a single TLV item from a byte stream. |
| bool | syn_lwm2m_tlv_decode_bool (const SYN_LwM2M_TLV * tlv, bool * out_val) Decode a boolean from TLV value bytes. |
| bool | syn_lwm2m_tlv_decode_float (const SYN_LwM2M_TLV * tlv, double * out_val) Decode a float/double from TLV value bytes. |
| bool | syn_lwm2m_tlv_decode_int (const SYN_LwM2M_TLV * tlv, int64_t * out_val) Decode a signed integer from TLV value bytes. |
| bool | syn_lwm2m_tlv_decode_string (const SYN_LwM2M_TLV * tlv, char * out_str, size_t max_len) Decode a string from TLV value bytes into a null-terminated buffer. |
| bool | syn_lwm2m_tlv_decode_value (const SYN_LwM2M_TLV * tlv, SYN_LwM2M_ValType expected_type, SYN_LwM2M_Value * out_val) Decode a TLV into a typed SYN_LwM2M_Value container. |
| size_t | syn_lwm2m_tlv_encode (const SYN_LwM2M_TLV * tlv, uint8_t * buf, size_t max_len) Encode a raw TLV header and value into a buffer. |
| size_t | syn_lwm2m_tlv_encode_bool (uint16_t res_id, bool val, uint8_t * buf, size_t max_len) Encode a boolean resource as TLV (1-byte int 0 or 1). |
| size_t | syn_lwm2m_tlv_encode_float (uint16_t res_id, double val, uint8_t * buf, size_t max_len) Encode a float/double resource as TLV (Float32 or Float64). |
| size_t | syn_lwm2m_tlv_encode_instance (uint16_t inst_id, const uint8_t * tlv_payload, size_t payload_len, uint8_t * buf, size_t max_len) Wrap nested resource TLVs inside an Object Instance TLV header. |
| size_t | syn_lwm2m_tlv_encode_int (uint16_t res_id, int64_t val, uint8_t * buf, size_t max_len) Encode a 64-bit integer resource as TLV. |
| size_t | syn_lwm2m_tlv_encode_opaque (uint16_t res_id, const uint8_t * data, size_t len, uint8_t * buf, size_t max_len) Encode opaque binary data resource as TLV. |
| size_t | syn_lwm2m_tlv_encode_string (uint16_t res_id, const char * str, uint8_t * buf, size_t max_len) Encode a string resource as TLV. |
| size_t | syn_lwm2m_tlv_encode_value (uint16_t res_id, const SYN_LwM2M_Value * val, uint8_t * buf, size_t max_len) Encode a generic SYN_LwM2M_Value as TLV. |
Macros¶
Detailed Description¶
Implements the OMA LwM2M client specification over CoAP/CoAPS, supporting: * Data formats: Plain Text, Opaque, TLV (Type-Length-Value Content-Format 11542), SenML CBOR (Content-Format 112). * Standard Object & Resource tree routing (/object/instance/resource). * Registration, Registration Update, and Deregistration workflows. * Device Management: Read, Write, Execute, Discover, Observe & Notify (RFC 7641). * Standard Objects: Device (Obj 3), Firmware Update (Obj 5), IPSO Temperature (Obj 3303).
Public Types Documentation¶
enum SYN_LwM2M_ClientState¶
LwM2M client registration states.
enum SYN_LwM2M_ClientState {
SYN_LWM2M_STATE_DEREGISTERED = 0,
SYN_LWM2M_STATE_REGISTERING,
SYN_LWM2M_STATE_REGISTERED,
SYN_LWM2M_STATE_UPDATING
};
typedef SYN_LwM2M_ExecCb¶
Execute callback: executes an executable resource with optional arguments.
typedef SYN_Status(* SYN_LwM2M_ExecCb) (uint16_t instance_id, uint16_t resource_id, const uint8_t *args, size_t args_len, void *user_ctx);
enum SYN_LwM2M_FirmwareResult¶
Firmware Update Object (Object ID 5) update results.
enum SYN_LwM2M_FirmwareResult {
SYN_LWM2M_FW_RESULT_DEFAULT = 0,
SYN_LWM2M_FW_RESULT_SUCCESS,
SYN_LWM2M_FW_RESULT_NO_FLASH,
SYN_LWM2M_FW_RESULT_OUT_OF_RAM,
SYN_LWM2M_FW_RESULT_CONN_LOST,
SYN_LWM2M_FW_RESULT_INTEGRITY_FAIL,
SYN_LWM2M_FW_RESULT_BAD_PKG_TYPE,
SYN_LWM2M_FW_RESULT_INVALID_URI
};
enum SYN_LwM2M_FirmwareState¶
Firmware Update Object (Object ID 5) states per OMA LwM2M spec.
enum SYN_LwM2M_FirmwareState {
SYN_LWM2M_FW_STATE_IDLE = 0,
SYN_LWM2M_FW_STATE_DOWNLOADING,
SYN_LWM2M_FW_STATE_DOWNLOADED,
SYN_LWM2M_FW_STATE_UPDATING
};
typedef SYN_LwM2M_ReadCb¶
Read callback: retrieves current resource value.
typedef SYN_Status(* SYN_LwM2M_ReadCb) (uint16_t instance_id, uint16_t resource_id, SYN_LwM2M_Value *out_val, void *user_ctx);
enum SYN_LwM2M_TLV_Type¶
LwM2M TLV Type identifier (Bits 7-6 of TLV header byte).
enum SYN_LwM2M_TLV_Type {
SYN_LWM2M_TLV_OBJECT_INSTANCE = 0x00U,
SYN_LWM2M_TLV_RESOURCE_INSTANCE = 0x40U,
SYN_LWM2M_TLV_MULTIPLE_RESOURCE = 0x80U,
SYN_LWM2M_TLV_RESOURCE = 0xC0U
};
enum SYN_LwM2M_ValType¶
LwM2M primitive resource value types.
enum SYN_LwM2M_ValType {
SYN_LWM2M_TYPE_NONE = 0,
SYN_LWM2M_TYPE_STRING,
SYN_LWM2M_TYPE_INT,
SYN_LWM2M_TYPE_FLOAT,
SYN_LWM2M_TYPE_BOOL,
SYN_LWM2M_TYPE_OPAQUE,
SYN_LWM2M_TYPE_TIME,
SYN_LWM2M_TYPE_OBJLNK
};
typedef SYN_LwM2M_WriteCb¶
Write callback: writes new resource value.
typedef SYN_Status(* SYN_LwM2M_WriteCb) (uint16_t instance_id, uint16_t resource_id, const SYN_LwM2M_Value *in_val, void *user_ctx);
Public Functions Documentation¶
function syn_lwm2m_build_deregister_request¶
Build a CoAP Deregistration DELETE request ( /rd/<location> ).
size_t syn_lwm2m_build_deregister_request (
const SYN_LwM2M_Client * client,
uint16_t msg_id,
const uint8_t * token,
uint8_t token_len,
SYN_CoapMsg * req,
SYN_CoapOption * req_opts,
size_t max_req_opts,
size_t * req_opt_cnt
)
Parameters:
clientLwM2M client context.msg_idCoAP message ID.tokenCoAP token bytes.token_lenLength of CoAP token.req[out] Populated CoAP request header.req_opts[out] Populated CoAP options array.max_req_optsCapacity of options array.req_opt_cnt[out] Number of populated options.
Returns:
0 on success.
function syn_lwm2m_build_notify¶
Build a CoAP Notification response for an active observation.
size_t syn_lwm2m_build_notify (
SYN_LwM2M_Client * client,
uint16_t obj_id,
uint16_t inst_id,
int32_t res_id,
uint16_t msg_id,
SYN_CoapMsg * resp,
SYN_CoapOption * resp_opts,
size_t max_resp_opts,
size_t * resp_opt_cnt,
uint8_t * resp_buf,
size_t resp_buf_sz
)
Parameters:
clientLwM2M client context.obj_idObject ID.inst_idInstance ID.res_idResource ID (-1 for entire instance).msg_idCoAP message ID.resp[out] Populated CoAP notification response header.resp_opts[out] Output response options array.max_resp_optsCapacity of response options array.resp_opt_cnt[out] Number of populated response options.resp_buf[out] Buffer for notification payload.resp_buf_szCapacity of notification buffer.
Returns:
Length of encoded payload in bytes, or 0 on error.
function syn_lwm2m_build_register_request¶
Build a CoAP Registration POST request ( /rd?ep=...<=... ).
size_t syn_lwm2m_build_register_request (
const SYN_LwM2M_Client * client,
uint16_t msg_id,
const uint8_t * token,
uint8_t token_len,
SYN_CoapMsg * req,
SYN_CoapOption * req_opts,
size_t max_req_opts,
size_t * req_opt_cnt,
uint8_t * payload_buf,
size_t payload_buf_sz
)
Parameters:
clientLwM2M client context.msg_idCoAP message ID.tokenCoAP token bytes.token_lenLength of CoAP token.req[out] Populated CoAP request header.req_opts[out] Populated CoAP options array.max_req_optsCapacity of options array.req_opt_cnt[out] Number of populated options.payload_buf[out] Buffer for link format payload.payload_buf_szCapacity of payload buffer.
Returns:
Length of serialized payload in bytes, or 0 on error.
function syn_lwm2m_build_update_request¶
Build a CoAP Registration Update POST request ( /rd/<location> ).
size_t syn_lwm2m_build_update_request (
const SYN_LwM2M_Client * client,
uint16_t msg_id,
const uint8_t * token,
uint8_t token_len,
uint32_t lifetime_s,
SYN_CoapMsg * req,
SYN_CoapOption * req_opts,
size_t max_req_opts,
size_t * req_opt_cnt,
uint8_t * payload_buf,
size_t payload_buf_sz
)
Parameters:
clientLwM2M client context.msg_idCoAP message ID.tokenCoAP token bytes.token_lenLength of CoAP token.lifetime_sUpdated registration lifetime in seconds (0 to keep current).req[out] Populated CoAP request header.req_opts[out] Populated CoAP options array.max_req_optsCapacity of options array.req_opt_cnt[out] Number of populated options.payload_buf[out] Optional buffer for updated link format.payload_buf_szCapacity of payload buffer.
Returns:
Length of payload in bytes (0 if lifetime update only).
function syn_lwm2m_client_init¶
Initialize a zero-heap LwM2M client context.
bool syn_lwm2m_client_init (
SYN_LwM2M_Client * client,
const char * endpoint_name,
uint32_t lifetime_s,
SYN_Transport * transport
)
Parameters:
clientClient context to initialize.endpoint_nameClient endpoint name (e.g. "urn:imei:862415039201923").lifetime_sRegistration lifetime in seconds (e.g. 300).transportUnderlying datagram transport.
Returns:
true on success, false on invalid parameters.
function syn_lwm2m_generate_link_format¶
Generate CoRE Link Format string listing all registered object instances.
size_t syn_lwm2m_generate_link_format (
const SYN_LwM2M_Client * client,
char * buf,
size_t max_len
)
Example output: </1/0>, </3/0>, </5/0>, </3303/0>
Parameters:
clientLwM2M client context.buf[out] Buffer to receive link format string.max_lenCapacity of link format buffer.
Returns:
Number of characters written (excluding null terminator), or 0 on overflow.
function syn_lwm2m_handle_register_response¶
Handle server response to Registration request (parses Location-Path).
bool syn_lwm2m_handle_register_response (
SYN_LwM2M_Client * client,
const SYN_CoapMsg * resp,
const SYN_CoapOption * resp_opts,
size_t resp_opt_cnt
)
Parameters:
clientLwM2M client context.respReceived CoAP response.resp_optsReceived response options.resp_opt_cntNumber of response options.
Returns:
true if registration succeeded (2.01 Created), false otherwise.
function syn_lwm2m_make_device_object¶
Create an Object 3 (Device) descriptor bound to ctx .
Parameters:
ctxDevice object context state.
Returns:
Initialized LwM2M object descriptor.
function syn_lwm2m_make_firmware_object¶
Create an Object 5 (Firmware Update) descriptor bound to ctx .
Parameters:
ctxFirmware update object context state.
Returns:
Initialized LwM2M object descriptor.
function syn_lwm2m_make_temperature_object¶
Create an Object 3303 (Temperature Sensor) descriptor bound to ctx .
Parameters:
ctxTemperature sensor object context state.
Returns:
Initialized LwM2M object descriptor.
function syn_lwm2m_observe_add¶
Add or update an observation for an object instance or resource.
bool syn_lwm2m_observe_add (
SYN_LwM2M_Client * client,
uint16_t obj_id,
uint16_t inst_id,
int32_t res_id,
const uint8_t * token,
uint8_t token_len,
uint32_t pmin,
uint32_t pmax
)
Parameters:
clientLwM2M client context.obj_idObject ID.inst_idInstance ID.res_idResource ID (-1 for entire instance).tokenCoAP observation token.token_lenLength of token.pminMinimum period in seconds (0 = immediate).pmaxMaximum period in seconds (0 = none).
Returns:
true on success, false if table full.
function syn_lwm2m_observe_remove¶
Remove an active observation by matching token.
bool syn_lwm2m_observe_remove (
SYN_LwM2M_Client * client,
const uint8_t * token,
uint8_t token_len
)
Parameters:
clientLwM2M client context.tokenCoAP token bytes.token_lenLength of token.
Returns:
true if an entry was found and removed, false otherwise.
function syn_lwm2m_process_request¶
Dispatch and process an incoming CoAP request against registered LwM2M objects.
SYN_Status syn_lwm2m_process_request (
SYN_LwM2M_Client * client,
const SYN_CoapMsg * req,
const SYN_CoapOption * req_opts,
size_t req_opt_cnt,
SYN_CoapMsg * resp,
SYN_CoapOption * resp_opts,
size_t max_resp_opts,
size_t * resp_opt_cnt,
uint8_t * resp_buf,
size_t resp_buf_sz
)
Handles GET (Read / Discover), PUT/POST (Write), POST (Execute), DELETE.
Parameters:
clientLwM2M client context.reqIncoming CoAP request.req_optsRequest options (Uri-Path, Content-Format, Observe, etc.).req_opt_cntNumber of request options.resp[out] Prepared CoAP response.resp_opts[out] Output response options array.max_resp_optsCapacity of response options array.resp_opt_cnt[out] Number of populated response options.resp_buf[out] Buffer for response payload.resp_buf_szCapacity of response buffer.
Returns:
SYN_OK on successful request handling, error code otherwise.
function syn_lwm2m_register_object¶
Register an object definition into the client object registry.
Parameters:
clientLwM2M client context.objObject definition descriptor.
Returns:
true on success, false if registry is full or invalid parameters.
function syn_lwm2m_tlv_decode¶
Decode a single TLV item from a byte stream.
bool syn_lwm2m_tlv_decode (
const uint8_t * buf,
size_t buf_len,
SYN_LwM2M_TLV * tlv,
size_t * consumed
)
Parameters:
bufInput buffer.buf_lenAvailable bytes in buffer.tlv[out] Decoded TLV header and value pointer.consumed[out] Total bytes consumed for this TLV.
Returns:
true on success, false on format/length error.
function syn_lwm2m_tlv_decode_bool¶
Decode a boolean from TLV value bytes.
Parameters:
tlvDecoded TLV descriptor.out_val[out] Decoded boolean.
Returns:
true on success, false on length error or null parameters.
function syn_lwm2m_tlv_decode_float¶
Decode a float/double from TLV value bytes.
Parameters:
tlvDecoded TLV descriptor.out_val[out] Decoded double.
Returns:
true on success, false on length error or null parameters.
function syn_lwm2m_tlv_decode_int¶
Decode a signed integer from TLV value bytes.
Parameters:
tlvDecoded TLV descriptor.out_val[out] Decoded 64-bit integer.
Returns:
true on success, false on length error or null parameters.
function syn_lwm2m_tlv_decode_string¶
Decode a string from TLV value bytes into a null-terminated buffer.
Parameters:
tlvDecoded TLV descriptor.out_str[out] Target buffer for string.max_lenCapacity of target buffer.
Returns:
true on success, false on overflow or null parameters.
function syn_lwm2m_tlv_decode_value¶
Decode a TLV into a typed SYN_LwM2M_Value container.
bool syn_lwm2m_tlv_decode_value (
const SYN_LwM2M_TLV * tlv,
SYN_LwM2M_ValType expected_type,
SYN_LwM2M_Value * out_val
)
Parameters:
tlvDecoded TLV descriptor.expected_typeExpected value type.out_val[out] Decoded value container.
Returns:
true on success, false on decoding failure.
function syn_lwm2m_tlv_encode¶
Encode a raw TLV header and value into a buffer.
Parameters:
tlvTLV item to encode.buf[out] Target buffer.max_lenCapacity of target buffer.
Returns:
Number of bytes written, or 0 on buffer overflow.
function syn_lwm2m_tlv_encode_bool¶
Encode a boolean resource as TLV (1-byte int 0 or 1).
Parameters:
res_idResource ID.valBoolean value.buf[out] Target buffer.max_lenCapacity of target buffer.
Returns:
Number of bytes written, or 0 on overflow.
function syn_lwm2m_tlv_encode_float¶
Encode a float/double resource as TLV (Float32 or Float64).
Parameters:
res_idResource ID.valFloating-point value.buf[out] Target buffer.max_lenCapacity of target buffer.
Returns:
Number of bytes written, or 0 on overflow.
function syn_lwm2m_tlv_encode_instance¶
Wrap nested resource TLVs inside an Object Instance TLV header.
size_t syn_lwm2m_tlv_encode_instance (
uint16_t inst_id,
const uint8_t * tlv_payload,
size_t payload_len,
uint8_t * buf,
size_t max_len
)
Parameters:
inst_idObject instance ID.tlv_payloadSerialized resource TLVs buffer.payload_lenLength of resource TLVs.buf[out] Target buffer.max_lenCapacity of target buffer.
Returns:
Number of bytes written, or 0 on overflow.
function syn_lwm2m_tlv_encode_int¶
Encode a 64-bit integer resource as TLV.
Parameters:
res_idResource ID.valInteger value to encode.buf[out] Target buffer.max_lenCapacity of target buffer.
Returns:
Number of bytes written, or 0 on overflow.
function syn_lwm2m_tlv_encode_opaque¶
Encode opaque binary data resource as TLV.
size_t syn_lwm2m_tlv_encode_opaque (
uint16_t res_id,
const uint8_t * data,
size_t len,
uint8_t * buf,
size_t max_len
)
Parameters:
res_idResource ID.dataBinary buffer.lenLength of binary data.buf[out] Target buffer.max_lenCapacity of target buffer.
Returns:
Number of bytes written, or 0 on overflow.
function syn_lwm2m_tlv_encode_string¶
Encode a string resource as TLV.
size_t syn_lwm2m_tlv_encode_string (
uint16_t res_id,
const char * str,
uint8_t * buf,
size_t max_len
)
Parameters:
res_idResource ID.strNull-terminated string.buf[out] Target buffer.max_lenCapacity of target buffer.
Returns:
Number of bytes written, or 0 on overflow.
function syn_lwm2m_tlv_encode_value¶
Encode a generic SYN_LwM2M_Value as TLV.
size_t syn_lwm2m_tlv_encode_value (
uint16_t res_id,
const SYN_LwM2M_Value * val,
uint8_t * buf,
size_t max_len
)
Parameters:
res_idResource ID.valTyped resource value container.buf[out] Target buffer.max_lenCapacity of target buffer.
Returns:
Number of bytes written, or 0 on overflow.
Macro Definition Documentation¶
define SYN_LWM2M_FORMAT_CBOR¶
application/vnd.oma.lwm2m+cbor
define SYN_LWM2M_FORMAT_JSON¶
application/vnd.oma.lwm2m+json
define SYN_LWM2M_FORMAT_LINK_FORMAT¶
application/link-format
define SYN_LWM2M_FORMAT_OPAQUE¶
application/octet-stream
define SYN_LWM2M_FORMAT_SENML_CBOR¶
application/senml+cbor
define SYN_LWM2M_FORMAT_TEXT¶
text/plain
define SYN_LWM2M_FORMAT_TLV¶
application/vnd.oma.lwm2m+tlv
define SYN_LWM2M_MAX_OBJECTS¶
Maximum registered objects per client
define SYN_LWM2M_MAX_OBSERVERS¶
Maximum active resource observations
define SYN_LWM2M_MAX_URI_PATH_LEN¶
Max URI path buffer size
define SYN_LWM2M_OBJ_ACCESS_CONTROL¶
Access Control Object
define SYN_LWM2M_OBJ_ACTUATION¶
IPSO Actuation / Switch
define SYN_LWM2M_OBJ_CONNECTIVITY_MONITORING¶
Connectivity Monitoring
define SYN_LWM2M_OBJ_CONNECTIVITY_STATS¶
Connectivity Statistics
define SYN_LWM2M_OBJ_DEVICE¶
Device Object
define SYN_LWM2M_OBJ_FIRMWARE_UPDATE¶
Firmware Update Object
define SYN_LWM2M_OBJ_GENERIC_SENSOR¶
IPSO Generic Sensor
define SYN_LWM2M_OBJ_HUMIDITY¶
IPSO Humidity Sensor
define SYN_LWM2M_OBJ_LOCATION¶
Location Object
define SYN_LWM2M_OBJ_SECURITY¶
LwM2M Security Object
define SYN_LWM2M_OBJ_SERVER¶
LwM2M Server Object
define SYN_LWM2M_OBJ_TEMPERATURE¶
IPSO Temperature Sensor
define SYN_LWM2M_OP_E¶
Execute operation allowed
define SYN_LWM2M_OP_NONE¶
No access permitted
define SYN_LWM2M_OP_R¶
Read operation allowed
define SYN_LWM2M_OP_RW¶
Read/Write allowed
define SYN_LWM2M_OP_W¶
Write operation allowed
The documentation for this class was generated from the following file src/syntropic/proto/syn_lwm2m.h