OpenThread_app
Loading...
Searching...
No Matches

CoAP URI definitions for the light device. More...

Functions

otapp_coap_uri_tad_light_uri_getList (void)
 Get the static list of CoAP URIs exposed by the light device.
uint8_t ad_light_uri_getListSize (void)
 Get the number of URIs provided by the light device.
void ad_light_uri_init (ot_app_devDrv_t *devDrv)
 Initialize light URIs and connect them to the driver API.

Detailed Description

CoAP URI definitions for the light device.

This module defines the CoAP resources that expose the light device functionality to the network. Typical endpoints:

  • light/state – on/off control (boolean or 0/1 value)
  • light/brightness – dimming level (0..255)
  • light/color – RGB color (packed value or 3‑byte payload)

For each URI the module configures:

  • Path string and CoAP method (GET/PUT/POST as needed),
  • Handler callback function,
  • Optional observe capability for state change notifications.

The URI table is registered in the OpenThread Application Framework via the driver callbacks configured in ad_light_init().

Version
0.1
Date
13-11-2025
Author
Jan Łukaszewicz (plhar.nosp@m.eo@g.nosp@m.mail..nosp@m.com)

Function Documentation

◆ ad_light_uri_getList()

otapp_coap_uri_t * ad_light_uri_getList ( void )

Get the static list of CoAP URIs exposed by the light device.

The returned pointer refers to a statically allocated array of otapp_coap_uri_t structures. The array describes all URIs handled by this device, including their handlers and observe settings.

Returns
Pointer to the first element of the URI list.
Note
The lifetime of the returned array is the entire runtime of the application; it must not be freed or modified by the caller.

◆ ad_light_uri_getListSize()

uint8_t ad_light_uri_getListSize ( void )

Get the number of URIs provided by the light device.

This value must match the size of the array returned by ad_light_uri_getList() and is used by the framework to iterate over the URI table.

Returns
Number of URIs in the list.

◆ ad_light_uri_init()

void ad_light_uri_init ( ot_app_devDrv_t * devDrv)

Initialize light URIs and connect them to the driver API.

This function should be called during device initialization (from ad_light_init()). It:

  • Fills the static URI table with paths, methods and handler callbacks.
  • Optionally configures observe support for stateful resources such as light/state or light/brightness.
  • Stores a pointer to the driver instance devDrv for use inside URI handlers when sending responses or notifications.
Parameters
devDrvPointer to the OpenThread application driver instance. Must be a valid pointer returned by ot_app_drv_getInstance().
Note
After calling this function, the application should assign drv->uriGetList_clb and drv->uriGetListSize to ad_light_uri_getList and ad_light_uri_getListSize respectively (this is done inside ad_light_init()).