Skip to content

File syn_lwm2m_task.h

FileList > proto > syn_lwm2m_task.h

Go to the source code of this file

Autonomous OMA LwM2M Client Supervisor Task & Engine. More...

  • #include "syntropic/common/syn_defs.h"
  • #include "syntropic/net/syn_coap.h"
  • #include "syntropic/proto/syn_lwm2m.h"
  • #include "syntropic/pt/syn_pt.h"
  • #include "syntropic/sched/syn_sched.h"

Classes

Type Name
struct SYN_LwM2M_Task
LwM2M Supervisor Task Context.
struct SYN_LwM2M_TaskConfig
Configuration parameters for LwM2M Client Supervisor Task.

Public Types

Type Name
typedef void(* SYN_LwM2M_FactoryResetCb
Callback for Device Object 3 Factory Reset command (Res 5).
typedef void(* SYN_LwM2M_FwUpdateCb
Callback for Firmware Update Object 5 Update command (Res 2).
typedef void(* SYN_LwM2M_RebootCb
Callback for Device Object 3 Reboot command (Res 4).
typedef void(* SYN_LwM2M_StateChangeCb
Callback on client registration state transition.

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.

Detailed Description

Implements an event-driven cooperative client task for OMA LwM2M v1.1/v1.2: * Autonomous Server Registration, 80% Lifetime Renewal, and Deregistration. * Transport management over UDP or DTLS 1.3 (via SYN_CoapsClient). * Downlink CoAP Request Dispatch (Read, Write, Execute, Discover). * RFC 7641 Observe & Notify scheduler matching periodic pmax & value triggers. * Standard Device Object (Obj 3) reboot/reset and Firmware Update (Obj 5) dispatch.

Public Types Documentation

typedef SYN_LwM2M_FactoryResetCb

Callback for Device Object 3 Factory Reset command (Res 5).

typedef void(* SYN_LwM2M_FactoryResetCb) (void *user_data);

Parameters:

  • user_data User-defined context pointer.

typedef SYN_LwM2M_FwUpdateCb

Callback for Firmware Update Object 5 Update command (Res 2).

typedef void(* SYN_LwM2M_FwUpdateCb) (const char *package_uri, void *user_data);

Parameters:

  • package_uri Download URI / package identifier.
  • user_data User-defined context pointer.

typedef SYN_LwM2M_RebootCb

Callback for Device Object 3 Reboot command (Res 4).

typedef void(* SYN_LwM2M_RebootCb) (void *user_data);

Parameters:

  • user_data User-defined context pointer.

typedef SYN_LwM2M_StateChangeCb

Callback on client registration state transition.

typedef void(* SYN_LwM2M_StateChangeCb) (SYN_LwM2M_ClientState old_state, SYN_LwM2M_ClientState new_state, void *user_data);

Parameters:

  • old_state Previous registration state.
  • new_state New registration state.
  • user_data User-defined context pointer.

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.



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