nRF5 SDK for Mesh v5.0.0
Data Structures | Macros | Functions
Light LC Setup Server behaviour

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...
 

Detailed Description

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.

Warning
To comply with the Bluetooth Mesh Model Specification (MshMDLv1.0.1) test cases, the application must adhere to the requirements defined in the following sections: Bluetooth Mesh Model Specification (MshMDLv1.0.1) section 6.2 (Lighting control) and section 6.5 (Lighting control models).

These requirements are documented at appropriate places in the module source code.

Macro Definition Documentation

◆ APP_LIGHT_LC_SETUP_SERVER_DEF

#define APP_LIGHT_LC_SETUP_SERVER_DEF (   _name,
  _force_segmented,
  _mic_size 
)
Value:
APP_TIMER_DEF(_name ## _fsm_timer); \
APP_TIMER_DEF(_name ## _light_pi_timer); \
APP_TIMER_DEF(_name ## _sensor_delay_timer); \
static app_light_lc_setup_server_t _name = \
{ \
.light_lc_setup_srv.settings.force_segmented = _force_segmented, \
.light_lc_setup_srv.settings.transmic_size = _mic_size, \
.light_lc_setup_srv.fsm_timer.p_timer_id = &_name ## _fsm_timer, \
.light_lc_setup_srv.light_pi_timer.p_timer_id = &_name ## _light_pi_timer, \
.light_lc_setup_srv.sensor_delay_timer.p_timer_id = &_name ## _sensor_delay_timer, \
};

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.

Parameters
[in]_nameName of the app_light_lc_setup_server_t instance.
[in]_force_segmentedIf the Light LC Setup Server shall use force segmentation of messages.
[in]_mic_sizeMIC size to be used by the Light LC Setup Server.

Definition at line 87 of file app_light_lc.h.

Function Documentation

◆ app_light_lc_model_init()

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.

Parameters
[in]p_appPointer to [app_light_lc_setup_server_t](__app_light_lc_setup_server_t) context.
[in]element_indexElement index on which this server will be instantiated.
[in]p_app_llPointer to [app_light_lightness_setup_server_t](__app_light_lightness_setup_server_t) context.
Return values
NRF_SUCCESSIf initialization is successful
NRF_ERROR_NULLNULL pointer is supplied to the function
NRF_ERROR_RESOURCESNo more instances can be created. In that case, increase value of LIGHT_LC_SETUP_SERVER_INSTANCES_MAX.
NRF_ERROR_INVALID_PARAMIf the application timer module has not been initialized.
NRF_ERROR_INVALID_STATEIf the application timer is running.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_FORBIDDENDevice has been provisioned and changes to model subscription list are not allowed.
NRF_ERROR_NOT_FOUNDAccess handle invalid.

◆ app_light_lc_ponoff_binding()

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.

Parameters
[in]p_appPointer to [app_light_lc_setup_server_t](__app_light_lc_setup_server_t) context.
[out]p_lc_controlReturns true if Light LC is controlling the system, false if it is not in control.
Return values
NRF_SUCCESSBindings are setup successfully
NRF_ERROR_NULLIf NULL pointer is provided as input context
NRF_ERROR_INVALID_PARAMInvalid parameter(s) supplied, or specified timeout is too short.
NRF_ERROR_INVALID_STATEInvalid state to perform operation.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_NOT_FOUNDAccess handle invalid.

◆ app_light_lc_scene_context_set()

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.

Note
Available only if SCENE_SETUP_SERVER_INSTANCES_MAX is equal or larger than 1.
Parameters
[in]p_appPointer to [app_light_lc_setup_server_t](__app_light_lc_setup_server_t) context.
[in]p_app_scenePointer to scene behavioral moduel context.
Return values
NRF_SUCCESSValue is restored successfully
NRF_ERROR_NULLIf NULL pointer is provided as input context

Documentation feedback | Developer Zone | Subscribe | Updated