nRF5 SDK for Mesh v4.1.0
Data Structures | Macros | Typedefs | Functions
Light Lightness Setup Server model interface

This model extends 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_lightness_setup_server_state_cbs_t
 Transaction callbacks for the Light Lightness states. More...
 
struct  light_lightness_server_settings_t
 User provided settings and callbacks for the model instance. More...
 
struct  light_lightness_server_t
 
struct  light_lightness_setup_server_callbacks_t
 Light Lightness server callback list. More...
 
struct  light_lightness_setup_server_settings_t
 User provided settings and callbacks for the model instance. More...
 
struct  light_lightness_state_t
 
struct  light_lightness_setup_server_t
 

Macros

#define LIGHT_LIGHTNESS_SERVER_MODEL_ID   0x1300
 Server model ID.
 
#define LIGHT_LIGHTNESS_SETUP_SERVER_MODEL_ID   0x1301
 Setup server model ID.
 

Typedefs

typedef void(* light_lightness_state_set_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_lightness_set_params_t *p_in, const model_transition_t *p_in_transition, light_lightness_status_params_t *p_out)
 Callback type for Light Lightness Set/Set Unacknowledged message. More...
 
typedef void(* light_lightness_state_get_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, light_lightness_status_params_t *p_out)
 Callback type for Light Lightness Get message. More...
 
typedef void(* light_lightness_state_last_get_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, light_lightness_last_status_params_t *p_out)
 Callback type for Light Lightness Last Get message. More...
 
typedef void(* light_lightness_state_default_set_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_lightness_default_set_params_t *p_in, light_lightness_default_status_params_t *p_out)
 Callback type for Light Lightness Default Set/Set Unacknowledged message. More...
 
typedef void(* light_lightness_state_default_get_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, light_lightness_default_status_params_t *p_out)
 Callback type for Light Lightness Default Get message. More...
 
typedef void(* light_lightness_state_range_set_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_lightness_range_set_params_t *p_in, light_lightness_range_status_params_t *p_out)
 Callback type for Light Lightness Range Set/Set Unacknowledged message. More...
 
typedef void(* light_lightness_state_range_get_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, light_lightness_range_status_params_t *p_out)
 Callback type for Light Lightness Range Get message. More...
 
typedef void(* light_lightness_state_delta_set_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_lightness_delta_set_params_t *p_in, const model_transition_t *p_in_transition, light_lightness_status_params_t *p_out)
 Callback type for Light Lightness delta Set/Set Unacknowledged "message". More...
 
typedef void(* light_lightness_state_move_set_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_lightness_move_set_params_t *p_in, const model_transition_t *p_in_transition, light_lightness_status_params_t *p_out)
 Callback type for Light Lightness move Set/Set Unacknowledged "message". More...
 

Functions

uint32_t light_lightness_server_status_publish (const light_lightness_server_t *p_server, const light_lightness_status_params_t *p_params)
 Publishes unsolicited Status message. More...
 
uint32_t light_lightness_server_linear_status_publish (light_lightness_server_t *p_server, const light_lightness_linear_status_params_t *p_params)
 Publishes unsolicited Status message. More...
 
uint32_t light_lightness_server_last_status_publish (light_lightness_server_t *p_server, const light_lightness_last_status_params_t *p_params)
 Publishes unsolicited Status message. More...
 
uint32_t light_lightness_server_default_status_publish (const light_lightness_server_t *p_server, const light_lightness_default_status_params_t *p_params)
 Publishes unsolicited Status message. More...
 
uint32_t light_lightness_server_range_status_publish (const light_lightness_server_t *p_server, const light_lightness_range_status_params_t *p_params)
 Publishes unsolicited Status message. More...
 
uint32_t light_lightness_setup_server_init (light_lightness_setup_server_t *p_server, uint8_t element_index)
 Initializes Light Lightness Setup server. More...
 
uint32_t light_lightness_ponoff_binding_setup (light_lightness_setup_server_t *p_s_server, light_lightness_saved_values_t *p_saved_values)
 Function to do the OnPowerup binding. More...
 

Detailed Description

This model extends 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_lightness_state_set_cb_t

typedef void(* light_lightness_state_set_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_lightness_set_params_t *p_in, const model_transition_t *p_in_transition, light_lightness_status_params_t *p_out)

Callback type for Light Lightness Set/Set Unacknowledged message.

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[in]p_inPointer to the input parameters for the user application.
[in]p_in_transitionPointer to transition parameters, if present in the incoming message, otherwise set to null.
[out]p_outPointer to store the output parameters from the user application. If null, indicates that it is UNACKNOWLEDGED message and no output params are required.

Definition at line 86 of file light_lightness_setup_server.h.

◆ light_lightness_state_get_cb_t

typedef void(* light_lightness_state_get_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, light_lightness_status_params_t *p_out)

Callback type for Light Lightness Get message.

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[out]p_outPointer to store the output parameters from the user application.

Definition at line 99 of file light_lightness_setup_server.h.

◆ light_lightness_state_last_get_cb_t

typedef void(* light_lightness_state_last_get_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, light_lightness_last_status_params_t *p_out)

Callback type for Light Lightness Last Get message.

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[out]p_outPointer to store the output parameters from the user application.

Definition at line 110 of file light_lightness_setup_server.h.

◆ light_lightness_state_default_set_cb_t

typedef void(* light_lightness_state_default_set_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_lightness_default_set_params_t *p_in, light_lightness_default_status_params_t *p_out)

Callback type for Light Lightness Default Set/Set Unacknowledged message.

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[in]p_inPointer to the input parameters for the user application.
[out]p_outPointer to store the output parameters from the user application. If null, indicates that it is UNACKNOWLEDGED message and no output params are required.

Definition at line 124 of file light_lightness_setup_server.h.

◆ light_lightness_state_default_get_cb_t

typedef void(* light_lightness_state_default_get_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, light_lightness_default_status_params_t *p_out)

Callback type for Light Lightness Default Get message.

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[out]p_outPointer to store the output parameters from the user application.

Definition at line 136 of file light_lightness_setup_server.h.

◆ light_lightness_state_range_set_cb_t

typedef void(* light_lightness_state_range_set_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_lightness_range_set_params_t *p_in, light_lightness_range_status_params_t *p_out)

Callback type for Light Lightness Range Set/Set Unacknowledged message.

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[in]p_inPointer to the input parameters for the user application.
[out]p_outPointer to store the output parameters from the user application. If null, indicates that it is UNACKNOWLEDGED message and no output params are required.

Definition at line 150 of file light_lightness_setup_server.h.

◆ light_lightness_state_range_get_cb_t

typedef void(* light_lightness_state_range_get_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, light_lightness_range_status_params_t *p_out)

Callback type for Light Lightness Range Get message.

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[out]p_outPointer to store the output parameters from the user application.

Definition at line 162 of file light_lightness_setup_server.h.

◆ light_lightness_state_delta_set_cb_t

typedef void(* light_lightness_state_delta_set_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_lightness_delta_set_params_t *p_in, const model_transition_t *p_in_transition, light_lightness_status_params_t *p_out)

Callback type for Light Lightness delta Set/Set Unacknowledged "message".

This isn't a real message, but light lightness converts a level delta set to this to allow the app layer to properly handle level delta functionality

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[in]p_inPointer to the input parameters for the user application.
[in]p_in_transitionPointer to transition parameters, if present in the incoming message, otherwise set to null.
[out]p_outPointer to store the output parameters from the user application. If null, indicates that it is UNACKNOWLEDGED message and no output params are required.

Definition at line 181 of file light_lightness_setup_server.h.

◆ light_lightness_state_move_set_cb_t

typedef void(* light_lightness_state_move_set_cb_t) (const light_lightness_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_lightness_move_set_params_t *p_in, const model_transition_t *p_in_transition, light_lightness_status_params_t *p_out)

Callback type for Light Lightness move Set/Set Unacknowledged "message".

This isn't a real message, but light lightness converts a level move set to this to allow the app layer to properly handle level move functionality

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[in]p_inPointer to the input parameters for the user application.
[in]p_in_transitionPointer to transition parameters, if present in the incoming message, otherwise set to null.
[out]p_outPointer to store the output parameters from the user application. If null, indicates that it is UNACKNOWLEDGED message and no output params are required.

Definition at line 203 of file light_lightness_setup_server.h.

Function Documentation

◆ light_lightness_server_status_publish()

uint32_t light_lightness_server_status_publish ( const light_lightness_server_t *  p_server,
const light_lightness_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_NULLNULL pointer given to function.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_NOT_FOUNDThe model is not initialized.
NRF_ERROR_INVALID_PARAMThe model not bound to application key or publish address not set.
NRF_ERROR_FORBIDDENFailed to allocate a sequence number from network.
NRF_ERROR_INVALID_STATEThere's already a segmented packet that is being to sent to this destination. Wait for the transmission to finish before sending new segmented packets.

◆ light_lightness_server_linear_status_publish()

uint32_t light_lightness_server_linear_status_publish ( light_lightness_server_t *  p_server,
const light_lightness_linear_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_NULLNULL pointer given to function.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_NOT_FOUNDThe model is not initialized.
NRF_ERROR_INVALID_PARAMThe model not bound to application key or publish address not set.
NRF_ERROR_FORBIDDENFailed to allocate a sequence number from network.
NRF_ERROR_INVALID_STATEThere's already a segmented packet that is being to sent to this destination. Wait for the transmission to finish before sending new segmented packets.

◆ light_lightness_server_last_status_publish()

uint32_t light_lightness_server_last_status_publish ( light_lightness_server_t *  p_server,
const light_lightness_last_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_NULLNULL pointer given to function.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_NOT_FOUNDThe model is not initialized.
NRF_ERROR_INVALID_PARAMIncorrect message parameters, the model not bound to application key, or publish address not set.
NRF_ERROR_FORBIDDENFailed to allocate a sequence number from network.
NRF_ERROR_INVALID_STATEThere's already a segmented packet that is being to sent to this destination. Wait for the transmission to finish before sending new segmented packets.

◆ light_lightness_server_default_status_publish()

uint32_t light_lightness_server_default_status_publish ( const light_lightness_server_t *  p_server,
const light_lightness_default_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_NULLNULL pointer given to function.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_NOT_FOUNDThe model is not initialized.
NRF_ERROR_INVALID_PARAMThe model not bound to application key or publish address not set.
NRF_ERROR_FORBIDDENFailed to allocate a sequence number from network.
NRF_ERROR_INVALID_STATEThere's already a segmented packet that is being to sent to this destination. Wait for the transmission to finish before sending new segmented packets.

◆ light_lightness_server_range_status_publish()

uint32_t light_lightness_server_range_status_publish ( const light_lightness_server_t *  p_server,
const light_lightness_range_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_NULLNULL pointer given to function.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_NOT_FOUNDThe model is not initialized.
NRF_ERROR_INVALID_PARAMIncorrect message parameters, the model not bound to application key, or publish address not set.
NRF_ERROR_FORBIDDENFailed to allocate a sequence number from network.
NRF_ERROR_INVALID_STATEThere's already a segmented packet that is being to sent to this destination. Wait for the transmission to finish before sending new segmented packets.

◆ light_lightness_setup_server_init()

uint32_t light_lightness_setup_server_init ( light_lightness_setup_server_t *  p_server,
uint8_t  element_index 
)

Initializes Light Lightness Setup server.

Note
The server handles the model allocation and adding.
Parameters
[in]p_serverLight Lightness server context pointer.
[in]element_indexElement index to add the model to.
Return values
NRF_SUCCESSThe model is initialized successfully.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_NO_MEMACCESS_MODEL_COUNT number of models already allocated or no more subscription lists available in memory pool (see ACCESS_SUBSCRIPTION_LIST_COUNT).
NRF_ERROR_FORBIDDENMultiple model instances per element are not allowed or changes to device composition are not allowed. Adding a new model after device is provisioned is not allowed.
NRF_ERROR_NOT_FOUNDInvalid access element index.
NRF_ERROR_RESOURCESNo more Light Lightness Setup server instance can be allocated. Increase LIGHT_LIGHTNESS_SETUP_SERVER_INSTANCES_MAX.

◆ light_lightness_ponoff_binding_setup()

uint32_t light_lightness_ponoff_binding_setup ( light_lightness_setup_server_t *  p_s_server,
light_lightness_saved_values_t p_saved_values 
)

Function to do the OnPowerup binding.

This is called when the mesh is initialized and stable. The caller is responsible for reading the saved state values out of flash and pass those so this function can determine what the current lightness should be set to.

The following rules are applied when restoring the lightness level:

If onpowerup in the p_saved_values is equal to GENERIC_ON_POWERUP_OFF, the lightness level is set to 0.

If onpowerup in the p_saved_values is equal to GENERIC_ON_POWERUP_DEFAULT and default_lightness in p_saved_values is not zero, the lightness level is set to default_lightness of the p_saved_values.

If onpowerup in the p_saved_values is equal to GENERIC_ON_POWERUP_DEFAULT and default_lightness in p_saved_values is zero, the lightness level is set to last_lightness of the p_saved_values.

If onpowerup in the p_saved_values is equal to GENERIC_ON_POWERUP_RESTORE the lightness level is set to actual_lightness of the p_saved_values.

The range value in the p_saved_values is used to restrict the lightness level.

Parameters
[in]p_s_serverStatus server context pointer.
[in]p_saved_valuesPointer to the structure containing the restored flash value of the lightness states.
Return values
NRF_SUCCESSThe model is initialized successfully.
NRF_ERROR_NULLNULL pointer given to function.

Documentation feedback | Developer Zone | Subscribe | Updated