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...
|
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...
|
|
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.
◆ light_lightness_state_set_cb_t
Callback type for Light Lightness Set/Set Unacknowledged message.
- Parameters
-
[in] | p_self | Pointer to the model structure. |
[in] | p_meta | Access metadata for the received message. |
[in] | p_in | Pointer to the input parameters for the user application. |
[in] | p_in_transition | Pointer to transition parameters, if present in the incoming message, otherwise set to null. |
[out] | p_out | Pointer 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
Callback type for Light Lightness Get message.
- Parameters
-
[in] | p_self | Pointer to the model structure. |
[in] | p_meta | Access metadata for the received message. |
[out] | p_out | Pointer 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
Callback type for Light Lightness Last Get message.
- Parameters
-
[in] | p_self | Pointer to the model structure. |
[in] | p_meta | Access metadata for the received message. |
[out] | p_out | Pointer 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
Callback type for Light Lightness Default Set/Set Unacknowledged message.
- Parameters
-
[in] | p_self | Pointer to the model structure. |
[in] | p_meta | Access metadata for the received message. |
[in] | p_in | Pointer to the input parameters for the user application. |
[out] | p_out | Pointer 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
Callback type for Light Lightness Default Get message.
- Parameters
-
[in] | p_self | Pointer to the model structure. |
[in] | p_meta | Access metadata for the received message. |
[out] | p_out | Pointer 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
Callback type for Light Lightness Range Set/Set Unacknowledged message.
- Parameters
-
[in] | p_self | Pointer to the model structure. |
[in] | p_meta | Access metadata for the received message. |
[in] | p_in | Pointer to the input parameters for the user application. |
[out] | p_out | Pointer 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
Callback type for Light Lightness Range Get message.
- Parameters
-
[in] | p_self | Pointer to the model structure. |
[in] | p_meta | Access metadata for the received message. |
[out] | p_out | Pointer 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
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_self | Pointer to the model structure. |
[in] | p_meta | Access metadata for the received message. |
[in] | p_in | Pointer to the input parameters for the user application. |
[in] | p_in_transition | Pointer to transition parameters, if present in the incoming message, otherwise set to null. |
[out] | p_out | Pointer 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
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_self | Pointer to the model structure. |
[in] | p_meta | Access metadata for the received message. |
[in] | p_in | Pointer to the input parameters for the user application. |
[in] | p_in_transition | Pointer to transition parameters, if present in the incoming message, otherwise set to null. |
[out] | p_out | Pointer 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.
◆ light_lightness_server_status_publish()
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_server | Status server context pointer. |
[in] | p_params | Message parameters. |
- Return values
-
NRF_SUCCESS | If the message is published successfully. |
NRF_ERROR_NULL | NULL pointer given to function. |
NRF_ERROR_NO_MEM | No memory available to send the message at this point. |
NRF_ERROR_NOT_FOUND | The model is not initialized. |
NRF_ERROR_INVALID_PARAM | The model not bound to application key or publish address not set. |
NRF_ERROR_FORBIDDEN | Failed to allocate a sequence number from network. |
NRF_ERROR_INVALID_STATE | There'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()
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_server | Status server context pointer. |
[in] | p_params | Message parameters. |
- Return values
-
NRF_SUCCESS | If the message is published successfully. |
NRF_ERROR_NULL | NULL pointer given to function. |
NRF_ERROR_NO_MEM | No memory available to send the message at this point. |
NRF_ERROR_NOT_FOUND | The model is not initialized. |
NRF_ERROR_INVALID_PARAM | The model not bound to application key or publish address not set. |
NRF_ERROR_FORBIDDEN | Failed to allocate a sequence number from network. |
NRF_ERROR_INVALID_STATE | There'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()
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_server | Status server context pointer. |
[in] | p_params | Message parameters. |
- Return values
-
NRF_SUCCESS | If the message is published successfully. |
NRF_ERROR_NULL | NULL pointer given to function. |
NRF_ERROR_NO_MEM | No memory available to send the message at this point. |
NRF_ERROR_NOT_FOUND | The model is not initialized. |
NRF_ERROR_INVALID_PARAM | Incorrect message parameters, the model not bound to application key, or publish address not set. |
NRF_ERROR_FORBIDDEN | Failed to allocate a sequence number from network. |
NRF_ERROR_INVALID_STATE | There'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()
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_server | Status server context pointer. |
[in] | p_params | Message parameters. |
- Return values
-
NRF_SUCCESS | If the message is published successfully. |
NRF_ERROR_NULL | NULL pointer given to function. |
NRF_ERROR_NO_MEM | No memory available to send the message at this point. |
NRF_ERROR_NOT_FOUND | The model is not initialized. |
NRF_ERROR_INVALID_PARAM | The model not bound to application key or publish address not set. |
NRF_ERROR_FORBIDDEN | Failed to allocate a sequence number from network. |
NRF_ERROR_INVALID_STATE | There'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()
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_server | Status server context pointer. |
[in] | p_params | Message parameters. |
- Return values
-
NRF_SUCCESS | If the message is published successfully. |
NRF_ERROR_NULL | NULL pointer given to function. |
NRF_ERROR_NO_MEM | No memory available to send the message at this point. |
NRF_ERROR_NOT_FOUND | The model is not initialized. |
NRF_ERROR_INVALID_PARAM | Incorrect message parameters, the model not bound to application key, or publish address not set. |
NRF_ERROR_FORBIDDEN | Failed to allocate a sequence number from network. |
NRF_ERROR_INVALID_STATE | There'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_server | Light Lightness server context pointer. |
[in] | element_index | Element index to add the model to. |
- Return values
-
NRF_SUCCESS | The model is initialized successfully. |
NRF_ERROR_NULL | NULL pointer given to function. |
NRF_ERROR_NO_MEM | ACCESS_MODEL_COUNT number of models already allocated or no more subscription lists available in memory pool (see ACCESS_SUBSCRIPTION_LIST_COUNT). |
NRF_ERROR_FORBIDDEN | Multiple 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_FOUND | Invalid access element index. |
NRF_ERROR_RESOURCES | No more Light Lightness Setup server instance can be allocated. Increase LIGHT_LIGHTNESS_SETUP_SERVER_INSTANCES_MAX. |
◆ light_lightness_ponoff_binding_setup()
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_server | Status server context pointer. |
[in] | p_saved_values | Pointer to the structure containing the restored flash value of the lightness states. |
- Return values
-
NRF_SUCCESS | The model is initialized successfully. |
NRF_ERROR_NULL | NULL pointer given to function. |