Application Light LC Setup Server behavioral structures, functions, and callbacks. More...
Data Structures | |
struct | app_light_lc_setup_server_t |
Application level structure holding the LC Setup server model context. More... | |
Macros | |
#define | APP_LIGHT_LC_SETUP_SERVER_DEF(_name, _force_segmented, _mic_size) |
Macro to create application level app_light_lc_setup_server_t context. More... | |
Functions | |
uint32_t | app_light_lc_model_init (app_light_lc_setup_server_t *p_app, uint8_t element_index, app_light_lightness_setup_server_t *p_app_ll) |
Initializes the behavioral module for the Light LC Setup Server model. More... | |
uint32_t | app_light_lc_ponoff_binding (app_light_lc_setup_server_t *p_app, bool *p_lc_control) |
Informs the model that the system is ready to have the powerup onoff bindings. More... | |
uint32_t | app_light_lc_scene_context_set (app_light_lc_setup_server_t *p_app, app_scene_setup_server_t *p_app_scene) |
Sets the scene context. More... | |
Application Light LC Setup Server behavioral structures, functions, and callbacks.
This module implements the behavioral requirements of the Light LC Setup Server model.
The application should use the set callback provided by this module to set the hardware state. The hardware state could be changed by reflecting the value provided by the set callback on the GPIO or by sending this value to the connected lighting peripheral using some other interface (e.g. serial interface). Similarly, the application should use the get callback provided by this module to read the hardware state.
This module triggers the set callback only when it determines that it is time to inform the user application. It is possible that the client can send multiple overlapping set commands. In such case any transition in progress will be abandoned and fresh transition will be started if required.
These requirements are documented at appropriate places in the module source code.
#define APP_LIGHT_LC_SETUP_SERVER_DEF | ( | _name, | |
_force_segmented, | |||
_mic_size | |||
) |
Macro to create application level app_light_lc_setup_server_t context.
Individual timer instances are created for each model instance. An app light lightness structure needs to be created separately for each model instance.
[in] | _name | Name of the app_light_lc_setup_server_t instance. |
[in] | _force_segmented | If the Light LC Setup Server shall use force segmentation of messages. |
[in] | _mic_size | MIC size to be used by the Light LC Setup Server. |
Definition at line 87 of file app_light_lc.h.
uint32_t app_light_lc_model_init | ( | app_light_lc_setup_server_t * | p_app, |
uint8_t | element_index, | ||
app_light_lightness_setup_server_t * | p_app_ll | ||
) |
Initializes the behavioral module for the Light LC Setup Server model.
[in] | p_app | Pointer to [app_light_lc_setup_server_t](__app_light_lc_setup_server_t) context. |
[in] | element_index | Element index on which this server will be instantiated. |
[in] | p_app_ll | Pointer to [app_light_lightness_setup_server_t](__app_light_lightness_setup_server_t) context. |
NRF_SUCCESS | If initialization is successful |
NRF_ERROR_NULL | NULL pointer is supplied to the function |
NRF_ERROR_RESOURCES | No more instances can be created. In that case, increase value of LIGHT_LC_SETUP_SERVER_INSTANCES_MAX. |
NRF_ERROR_INVALID_PARAM | If the application timer module has not been initialized. |
NRF_ERROR_INVALID_STATE | If the application timer is running. |
NRF_ERROR_NO_MEM | No memory available to send the message at this point. |
NRF_ERROR_FORBIDDEN | Device has been provisioned and changes to model subscription list are not allowed. |
NRF_ERROR_NOT_FOUND | Access handle invalid. |
uint32_t app_light_lc_ponoff_binding | ( | app_light_lc_setup_server_t * | p_app, |
bool * | p_lc_control | ||
) |
Informs the model that the system is ready to have the powerup onoff bindings.
This is called by main.c when the mesh is initialized and stable. Note that this function must be called from the same IRQ level that mesh_init() is set at.
[in] | p_app | Pointer to [app_light_lc_setup_server_t](__app_light_lc_setup_server_t) context. |
[out] | p_lc_control | Returns true if Light LC is controlling the system, false if it is not in control. |
NRF_SUCCESS | Bindings are setup successfully |
NRF_ERROR_NULL | If NULL pointer is provided as input context |
NRF_ERROR_INVALID_PARAM | Invalid parameter(s) supplied, or specified timeout is too short. |
NRF_ERROR_INVALID_STATE | Invalid state to perform operation. |
NRF_ERROR_NO_MEM | No memory available to send the message at this point. |
NRF_ERROR_NOT_FOUND | Access handle invalid. |
uint32_t app_light_lc_scene_context_set | ( | app_light_lc_setup_server_t * | p_app, |
app_scene_setup_server_t * | p_app_scene | ||
) |
Sets the scene context.
This is needed for app light lc to inform app scene when the state change occurs.
[in] | p_app | Pointer to [app_light_lc_setup_server_t](__app_light_lc_setup_server_t) context. |
[in] | p_app_scene | Pointer to scene behavioral moduel context. |
NRF_SUCCESS | Value is restored successfully |
NRF_ERROR_NULL | If NULL pointer is provided as input context |