nRF5 SDK for Mesh v5.0.0
Data Structures | Macros | Typedefs | Functions
Light LC (Lightness Control) Setup Server model interface

This model extends Light LC server, Light Lightness server, Generic Level server, Generic PowerOnOff Setup server, Generic PowerOnOff server, Generic OnOff server, and Generic Default Transition Time server. More...

Data Structures

struct  light_lc_setup_server_state_cbs_t
 Transaction callbacks for the Light LC states. More...
 
struct  light_lc_server_settings_t
 User provided settings and callbacks for the non-setup server model instance. More...
 
struct  light_lc_server_t
 
struct  light_lc_setup_server_callbacks_t
 Light LC setup server callback list. More...
 
struct  light_lc_setup_server_state_t
 Internal structure to hold state and timing information. More...
 
struct  light_lc_setup_server_settings_t
 User provided settings and callbacks for the model instance. More...
 
struct  light_lc_transition_info_t
 The Light OnOff message is the only one that has transition and delay, though we need to keep information about the initial and target lightness level so we can calculate what to set it to in the meantime. More...
 
struct  light_lc_setup_server_t
 

Macros

#define LIGHT_LC_SERVER_MODEL_ID   0x130F
 Server model ID.
 
#define LIGHT_LC_SETUP_SERVER_MODEL_ID   0x1310
 Setup server model ID.
 

Typedefs

typedef void(* light_lc_persist_state_set_cb_t) (const light_lc_setup_server_t *p_s_server, const light_lc_state_t lc_state, const void *p_set_value)
 Callback type for storing data to the persistent memory after Set messages affecting the persistent states are received. More...
 
typedef void(* light_lc_persist_state_get_cb_t) (const light_lc_setup_server_t *p_s_server, const light_lc_state_t lc_state, void *p_get_value)
 Callback type for getting data from the persistent memory after Get messages are received. More...
 
typedef void(* light_lc_actual_set_cb_t) (const light_lc_setup_server_t *p_s_server, uint16_t actual_lightness)
 Callback type for setting the actual lightness. More...
 
typedef void(* light_lc_actual_get_cb_t) (const light_lc_setup_server_t *p_s_server, uint16_t *p_actual_lightness)
 Callback type for getting the actual lightness. More...
 

Functions

uint32_t light_lc_server_mode_status_publish (const light_lc_server_t *p_server, const light_lc_mode_status_params_t *p_params)
 Publishes unsolicited Status message. More...
 
uint32_t light_lc_server_occ_mode_status_publish (light_lc_server_t *p_server, const light_lc_occupancy_mode_status_params_t *p_params)
 Publishes unsolicited Status message. More...
 
uint32_t light_lc_server_light_onoff_status_publish (light_lc_server_t *p_server, const light_lc_light_onoff_status_params_t *p_params)
 Publishes unsolicited Status message. More...
 
uint32_t light_lc_setup_server_init (light_lc_setup_server_t *p_s_server, uint8_t element_index)
 Initializes Light LC Setup server. More...
 
uint32_t light_lc_setup_server_property_status_publish (const light_lc_setup_server_t *p_s_server, const light_lc_property_status_params_t *p_params)
 Publishes unsolicited Status message. More...
 
uint32_t light_lc_setup_server_ponoff_binding_setup (light_lc_setup_server_t *p_s_server, uint8_t onpowerup, bool *p_lc_control)
 Function to do the OnPowerup binding. More...
 

Detailed Description

This model extends Light LC server, Light Lightness server, Generic Level server, Generic PowerOnOff Setup server, Generic PowerOnOff server, Generic OnOff server, and Generic Default Transition Time server.

Therefore, this model generates events for messages received by its parent model.

Typedef Documentation

◆ light_lc_persist_state_set_cb_t

typedef void(* light_lc_persist_state_set_cb_t) (const light_lc_setup_server_t *p_s_server, const light_lc_state_t lc_state, const void *p_set_value)

Callback type for storing data to the persistent memory after Set messages affecting the persistent states are received.

Mid app will call the appropriate function to set flash memory.

Parameters
[in]p_s_serverPointer to the model structure.
[in]lc_stateState to be set into persistent memory
[in]set_valueValue to set into persistent memory

Definition at line 85 of file light_lc_setup_server.h.

◆ light_lc_persist_state_get_cb_t

typedef void(* light_lc_persist_state_get_cb_t) (const light_lc_setup_server_t *p_s_server, const light_lc_state_t lc_state, void *p_get_value)

Callback type for getting data from the persistent memory after Get messages are received.

Mid app will call the appropriate function to get flash memory

Parameters
[in]p_s_serverPointer to the model structure.
[in]lc_stateState to be set into persistent memory.
[out]p_get_valueReturn value from persistent memory

Definition at line 98 of file light_lc_setup_server.h.

◆ light_lc_actual_set_cb_t

typedef void(* light_lc_actual_set_cb_t) (const light_lc_setup_server_t *p_s_server, uint16_t actual_lightness)

Callback type for setting the actual lightness.

Mid app will call the top app (main.c) to set the actual lightness.

Parameters
[in]p_s_serverPointer to the model structure.
[in]actual_lightnessLightness level to set

Definition at line 110 of file light_lc_setup_server.h.

◆ light_lc_actual_get_cb_t

typedef void(* light_lc_actual_get_cb_t) (const light_lc_setup_server_t *p_s_server, uint16_t *p_actual_lightness)

Callback type for getting the actual lightness.

Mid app will call the top app (main.c) to get the actual lightness.

Parameters
[in]p_s_serverPointer to the model structure.
[in]p_actual_lightnessLightness level to get.

Definition at line 121 of file light_lc_setup_server.h.

Function Documentation

◆ light_lc_server_mode_status_publish()

uint32_t light_lc_server_mode_status_publish ( const light_lc_server_t *  p_server,
const light_lc_mode_status_params_t p_params 
)

Publishes unsolicited Status message.

This API can be used to send unsolicited messages to report updated state value as a result of local action.

Parameters
[in]p_serverStatus server context pointer.
[in]p_paramsMessage parameters.
Return values
NRF_SUCCESSIf the message is published successfully.
NRF_ERROR_NULLIf NULL pointer given to function.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_INVALID_LENGTHInvalid data length(s) supplied.
NRF_ERROR_NOT_FOUNDAccess handle invalid.
NRF_ERROR_INVALID_PARAMInvalid parameter(s) supplied.
NRF_ERROR_INVALID_ADDRInvalid pointer supplied.

◆ light_lc_server_occ_mode_status_publish()

uint32_t light_lc_server_occ_mode_status_publish ( light_lc_server_t *  p_server,
const light_lc_occupancy_mode_status_params_t p_params 
)

Publishes unsolicited Status message.

This API can be used to send unsolicited messages to report updated state value as a result of local action.

Parameters
[in]p_serverStatus server context pointer.
[in]p_paramsMessage parameters.
Return values
NRF_SUCCESSIf the message is published successfully.
NRF_ERROR_NULLIf NULL pointer given to function.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_INVALID_LENGTHInvalid data length(s) supplied.
NRF_ERROR_NOT_FOUNDAccess handle invalid.
NRF_ERROR_INVALID_PARAMInvalid parameter(s) supplied.
NRF_ERROR_INVALID_ADDRInvalid pointer supplied.

◆ light_lc_server_light_onoff_status_publish()

uint32_t light_lc_server_light_onoff_status_publish ( light_lc_server_t *  p_server,
const light_lc_light_onoff_status_params_t p_params 
)

Publishes unsolicited Status message.

This API can be used to send unsolicited messages to report updated state value as a result of local action.

Parameters
[in]p_serverStatus server context pointer.
[in]p_paramsMessage parameters.
Return values
NRF_SUCCESSIf the message is published successfully.
NRF_ERROR_NULLIf NULL pointer given to function.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_INVALID_LENGTHInvalid data length(s) supplied.
NRF_ERROR_NOT_FOUNDAccess handle invalid.
NRF_ERROR_INVALID_PARAMInvalid parameter(s) supplied.
NRF_ERROR_INVALID_ADDRInvalid pointer supplied.

◆ light_lc_setup_server_init()

uint32_t light_lc_setup_server_init ( light_lc_setup_server_t *  p_s_server,
uint8_t  element_index 
)

Initializes Light LC Setup server.

Note
The server handles the model allocation and adding.
Parameters
[in]p_s_serverLight LC Setup Server context pointer.
[in]element_indexElement index to add the model to.
Return values
NRF_SUCCESSIf the model is initialized successfully.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_INVALID_PARAMInvalid parameter(s) supplied.
NRF_ERROR_INVALID_STATEInvalid state to perform operation.
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.
NRF_ERROR_RESOURCESNo more Light LC Setup server instance can be allocated. Increase LIGHT_LC_SETUP_SERVER_INSTANCES_MAX.

◆ light_lc_setup_server_property_status_publish()

uint32_t light_lc_setup_server_property_status_publish ( const light_lc_setup_server_t *  p_s_server,
const light_lc_property_status_params_t p_params 
)

Publishes unsolicited Status message.

This API can be used to send unsolicited messages to report updated state value as a result of local action.

Parameters
[in]p_s_serverStatus server context pointer.
[in]p_paramsMessage parameters.
Return values
NRF_SUCCESSIf the message is published successfully.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_INVALID_ADDRInvalid pointer supplied.
NRF_ERROR_INVALID_STATEInvalid state to perform operation.
NRF_ERROR_NOT_FOUNDAccess handle invalid.
NRF_ERROR_INVALID_LENGTHAttempted to send message larger than LIGHT_LC_PROPERTY_BUF_SIZE.

◆ light_lc_setup_server_ponoff_binding_setup()

uint32_t light_lc_setup_server_ponoff_binding_setup ( light_lc_setup_server_t *  p_s_server,
uint8_t  onpowerup,
bool *  p_lc_control 
)

Function to do the OnPowerup binding.

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 is specified for the mesh stack (see mesh_stack_init() API).

Parameters
[in]p_s_serverStatus server context pointer.
[in]onpowerupSaved value of onpowerup (read from flash)
[out]p_lc_controlReturns false if the LC server is not controlling the light, or true if the LC server is controlling the light.
Return values
NRF_SUCCESSIf the binding is setup successfully.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_INVALID_PARAMInvalid parameter(s) supplied.
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.

Documentation feedback | Developer Zone | Subscribe | Updated