File syn_lwm2m.c¶
FileList > proto > syn_lwm2m.c
Go to the source code of this file
Zero-Heap OMA Lightweight M2M (LwM2M v1.1/v1.2) Core Client Engine.
#include "syn_lwm2m.h"#include "syntropic/port/syn_port_system.h"#include "syntropic/util/syn_assert.h"#include <stdio.h>#include <stdlib.h>#include <string.h>
Public Static Attributes¶
| Type | Name |
|---|---|
| const SYN_LwM2M_ResourceDesc | s_device_resources = /* multi line expression */Resource definitions for OMA LwM2M Device Object (Obj 3). |
| const SYN_LwM2M_ResourceDesc | s_fw_resources = /* multi line expression */Resource definitions for OMA LwM2M Firmware Update Object (Obj 5). |
| const uint16_t | s_single_inst = {0U}Default single instance list (Instance 0). |
| const SYN_LwM2M_ResourceDesc | s_temp_resources = /* multi line expression */Resource definitions for IPSO Temperature Sensor Object (Obj 3303). |
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. |
Public Static Functions¶
| Type | Name |
|---|---|
| SYN_Status | device_exec_cb (uint16_t instance_id, uint16_t resource_id, const uint8_t * args, size_t args_len, void * user_ctx) Execute callback for Device Object (Obj 3). |
| SYN_Status | device_read_cb (uint16_t instance_id, uint16_t resource_id, SYN_LwM2M_Value * out_val, void * user_ctx) Read callback for Device Object (Obj 3). |
| SYN_Status | device_write_cb (uint16_t instance_id, uint16_t resource_id, const SYN_LwM2M_Value * in_val, void * user_ctx) Write callback for Device Object (Obj 3). |
| const SYN_LwM2M_Object * | find_object (const SYN_LwM2M_Client * client, uint16_t obj_id) Search client object registry for object matching ID. |
| const SYN_LwM2M_ResourceDesc * | find_resource (const SYN_LwM2M_Object * obj, uint16_t res_id) Find resource descriptor matching resource ID within an object. |
| SYN_Status | fw_exec_cb (uint16_t instance_id, uint16_t resource_id, const uint8_t * args, size_t args_len, void * user_ctx) Execute callback for Firmware Update Object (Obj 5). |
| SYN_Status | fw_read_cb (uint16_t instance_id, uint16_t resource_id, SYN_LwM2M_Value * out_val, void * user_ctx) Read callback for Firmware Update Object (Obj 5). |
| SYN_Status | fw_write_cb (uint16_t instance_id, uint16_t resource_id, const SYN_LwM2M_Value * in_val, void * user_ctx) Write callback for Firmware Update Object (Obj 5). |
| SYN_Status | temp_read_cb (uint16_t instance_id, uint16_t resource_id, SYN_LwM2M_Value * out_val, void * user_ctx) Read callback for IPSO Temperature Sensor Object (Obj 3303). |
| bool | validate_instance (const SYN_LwM2M_Object * obj, uint16_t inst_id) Validate that an object instance ID exists in the object definition. |
Public Static Attributes Documentation¶
variable s_device_resources¶
Resource definitions for OMA LwM2M Device Object (Obj 3).
variable s_fw_resources¶
Resource definitions for OMA LwM2M Firmware Update Object (Obj 5).
variable s_single_inst¶
Default single instance list (Instance 0).
variable s_temp_resources¶
Resource definitions for IPSO Temperature Sensor Object (Obj 3303).
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.
Public Static Functions Documentation¶
function device_exec_cb¶
Execute callback for Device Object (Obj 3).
static SYN_Status device_exec_cb (
uint16_t instance_id,
uint16_t resource_id,
const uint8_t * args,
size_t args_len,
void * user_ctx
)
Parameters:
instance_idInstance ID.resource_idResource ID.argsExecute arguments.args_lenArguments length.user_ctxDevice context pointer.
Returns:
SYN_OK on success, SYN_ERROR on unsupported resource or NULL pointers.
function device_read_cb¶
Read callback for Device Object (Obj 3).
static SYN_Status device_read_cb (
uint16_t instance_id,
uint16_t resource_id,
SYN_LwM2M_Value * out_val,
void * user_ctx
)
Parameters:
instance_idInstance ID.resource_idResource ID.out_val[out] Value container.user_ctxDevice context pointer.
Returns:
SYN_OK on success, SYN_ERROR on unknown resource or NULL pointers.
function device_write_cb¶
Write callback for Device Object (Obj 3).
static SYN_Status device_write_cb (
uint16_t instance_id,
uint16_t resource_id,
const SYN_LwM2M_Value * in_val,
void * user_ctx
)
Parameters:
instance_idInstance ID.resource_idResource ID.in_valInput value.user_ctxDevice context pointer.
Returns:
SYN_OK on success, SYN_ERROR on unknown resource or NULL pointers.
function find_object¶
Search client object registry for object matching ID.
Parameters:
clientLwM2M client context.obj_idObject ID.
Returns:
Pointer to object descriptor if found, NULL otherwise.
function find_resource¶
Find resource descriptor matching resource ID within an object.
static const SYN_LwM2M_ResourceDesc * find_resource (
const SYN_LwM2M_Object * obj,
uint16_t res_id
)
Parameters:
objObject descriptor.res_idResource ID.
Returns:
Pointer to resource descriptor if found, NULL otherwise.
function fw_exec_cb¶
Execute callback for Firmware Update Object (Obj 5).
static SYN_Status fw_exec_cb (
uint16_t instance_id,
uint16_t resource_id,
const uint8_t * args,
size_t args_len,
void * user_ctx
)
Parameters:
instance_idInstance ID.resource_idResource ID.argsExecute arguments.args_lenArguments length.user_ctxFirmware context pointer.
Returns:
SYN_OK on success, SYN_ERROR on unsupported resource or NULL pointers.
function fw_read_cb¶
Read callback for Firmware Update Object (Obj 5).
static SYN_Status fw_read_cb (
uint16_t instance_id,
uint16_t resource_id,
SYN_LwM2M_Value * out_val,
void * user_ctx
)
Parameters:
instance_idInstance ID.resource_idResource ID.out_val[out] Value container.user_ctxFirmware context pointer.
Returns:
SYN_OK on success, SYN_ERROR on unknown resource or NULL pointers.
function fw_write_cb¶
Write callback for Firmware Update Object (Obj 5).
static SYN_Status fw_write_cb (
uint16_t instance_id,
uint16_t resource_id,
const SYN_LwM2M_Value * in_val,
void * user_ctx
)
Parameters:
instance_idInstance ID.resource_idResource ID.in_valInput value.user_ctxFirmware context pointer.
Returns:
SYN_OK on success, SYN_ERROR on unknown resource or NULL pointers.
function temp_read_cb¶
Read callback for IPSO Temperature Sensor Object (Obj 3303).
static SYN_Status temp_read_cb (
uint16_t instance_id,
uint16_t resource_id,
SYN_LwM2M_Value * out_val,
void * user_ctx
)
Parameters:
instance_idInstance ID.resource_idResource ID.out_val[out] Value container.user_ctxSensor context pointer.
Returns:
SYN_OK on success, SYN_ERROR on unknown resource or NULL pointers.
function validate_instance¶
Validate that an object instance ID exists in the object definition.
Parameters:
objObject descriptor.inst_idInstance ID.
Returns:
true if instance exists, false otherwise.
The documentation for this class was generated from the following file src/syntropic/proto/syn_lwm2m.c