Skip to content

File syn_lwm2m_task.c

FileList > proto > syn_lwm2m_task.c

Go to the source code of this file

Autonomous OMA LwM2M Client Supervisor Task & Engine Implementation.

  • #include "../port/syn_port_system.h"
  • #include "../util/syn_assert.h"
  • #include "syn_lwm2m_task.h"
  • #include <stdio.h>
  • #include <string.h>

Public Functions

Type Name
SYN_Status syn_lwm2m_task_deregister (SYN_LwM2M_Task * task)
Request a graceful LwM2M Deregistration.
SYN_Status syn_lwm2m_task_init (SYN_LwM2M_Task * task, const SYN_LwM2M_TaskConfig * cfg)
Initialize the LwM2M Supervisor Task context.
SYN_Status syn_lwm2m_task_notify_changed (SYN_LwM2M_Task * task, uint16_t obj_id, uint16_t inst_id, int32_t res_id)
Mark an object instance or resource as modified to evaluate observe notifications.
SYN_PT_Status syn_lwm2m_task_pt (SYN_PT * pt, SYN_Task * task)
Protothread task entry function for scheduler integration ( syn_sched ).
SYN_Status syn_lwm2m_task_step (SYN_LwM2M_Task * task, uint32_t now_ms)
Advance the LwM2M Supervisor state machine by one step / tick.
SYN_Status syn_lwm2m_task_trigger_update (SYN_LwM2M_Task * task)
Trigger an immediate LwM2M Registration Update.

Public Static Functions

Type Name
void syn_lwm2m_task_check_object_hooks (SYN_LwM2M_Task * task)
Check registered objects for pending command flags (reboot, reset, fw update).
void syn_lwm2m_task_eval_observations (SYN_LwM2M_Task * task, uint32_t now_ms)
Evaluate active observations against resource changes and pmax intervals.
void syn_lwm2m_task_set_state (SYN_LwM2M_Task * task, SYN_LwM2M_ClientState new_state)
Update client state and fire state change callback if transition occurs.

Macros

Type Name
define SYN_LWM2M_COAP_SERIALIZE_BUF_SZ 512U
define SYN_LWM2M_DEFAULT_RETRY_BACKOFF_MS 5000U
define SYN_LWM2M_RESP_PAYLOAD_BUF_SZ 256U

Public Functions Documentation

function syn_lwm2m_task_deregister

Request a graceful LwM2M Deregistration.

SYN_Status syn_lwm2m_task_deregister (
    SYN_LwM2M_Task * task
) 

Parameters:

  • task Task instance.

Returns:

SYN_OK on success, SYN_INVALID_PARAM if task is NULL.


function syn_lwm2m_task_init

Initialize the LwM2M Supervisor Task context.

SYN_Status syn_lwm2m_task_init (
    SYN_LwM2M_Task * task,
    const SYN_LwM2M_TaskConfig * cfg
) 

Parameters:

  • task Task instance to initialize.
  • cfg Task configuration parameters.

Returns:

SYN_OK on success, SYN_INVALID_PARAM on NULL or invalid arguments.


function syn_lwm2m_task_notify_changed

Mark an object instance or resource as modified to evaluate observe notifications.

SYN_Status syn_lwm2m_task_notify_changed (
    SYN_LwM2M_Task * task,
    uint16_t obj_id,
    uint16_t inst_id,
    int32_t res_id
) 

Parameters:

  • task Task instance.
  • obj_id Object ID that changed.
  • inst_id Instance ID that changed.
  • res_id Resource ID that changed (-1 for entire instance).

Returns:

SYN_OK on success, SYN_INVALID_PARAM if task is NULL.


function syn_lwm2m_task_pt

Protothread task entry function for scheduler integration ( syn_sched ).

SYN_PT_Status syn_lwm2m_task_pt (
    SYN_PT * pt,
    SYN_Task * task
) 

Parameters:

  • pt Protothread continuation structure.
  • task Generic scheduler task descriptor containing SYN_LwM2M_Task in user_data.

Returns:

SYN_PT_Status continuation status.


function syn_lwm2m_task_step

Advance the LwM2M Supervisor state machine by one step / tick.

SYN_Status syn_lwm2m_task_step (
    SYN_LwM2M_Task * task,
    uint32_t now_ms
) 

Handles DTLS handshake progress, registration renewal timers, receiving incoming CoAP requests, dispatching responses, evaluating observation rules, and firing notifications.

Parameters:

  • task Task instance.
  • now_ms Current system timestamp in milliseconds.

Returns:

SYN_OK on normal operation, error code on fatal condition.


function syn_lwm2m_task_trigger_update

Trigger an immediate LwM2M Registration Update.

SYN_Status syn_lwm2m_task_trigger_update (
    SYN_LwM2M_Task * task
) 

Parameters:

  • task Task instance.

Returns:

SYN_OK on success, SYN_INVALID_PARAM if task is NULL.


Public Static Functions Documentation

function syn_lwm2m_task_check_object_hooks

Check registered objects for pending command flags (reboot, reset, fw update).

static void syn_lwm2m_task_check_object_hooks (
    SYN_LwM2M_Task * task
) 

Parameters:

  • task LwM2M supervisor task instance.

function syn_lwm2m_task_eval_observations

Evaluate active observations against resource changes and pmax intervals.

static void syn_lwm2m_task_eval_observations (
    SYN_LwM2M_Task * task,
    uint32_t now_ms
) 

Parameters:

  • task LwM2M supervisor task instance.
  • now_ms Current system timestamp in milliseconds.

function syn_lwm2m_task_set_state

Update client state and fire state change callback if transition occurs.

static void syn_lwm2m_task_set_state (
    SYN_LwM2M_Task * task,
    SYN_LwM2M_ClientState new_state
) 

Parameters:

  • task LwM2M supervisor task instance.
  • new_state Target client registration state.

Macro Definition Documentation

define SYN_LWM2M_COAP_SERIALIZE_BUF_SZ

#define SYN_LWM2M_COAP_SERIALIZE_BUF_SZ `512U`

Scratch buffer size for serialization


define SYN_LWM2M_DEFAULT_RETRY_BACKOFF_MS

#define SYN_LWM2M_DEFAULT_RETRY_BACKOFF_MS `5000U`

Default network retry backoff (ms)


define SYN_LWM2M_RESP_PAYLOAD_BUF_SZ

#define SYN_LWM2M_RESP_PAYLOAD_BUF_SZ `256U`

Response payload scratch size



The documentation for this class was generated from the following file src/syntropic/proto/syn_lwm2m_task.c