This module provides APIs for handling persistence of the Light Lightness Setup Server model related states. More...
Macros | |
| #define | STORED_WITH_SCENE_INSTANCES |
| Defines number of state instances required to store current state and state for each scene. More... | |
| #define | LIGHT_LIGHTNESS_ONPOWERUP_EID_START (MESH_APP_MODEL_LIGHT_LIGHTNESS_ID_START) |
| #define | LIGHT_LIGHTNESS_LAST_EID_START (LIGHT_LIGHTNESS_ONPOWERUP_EID_START + LIGHT_LIGHTNESS_SETUP_SERVER_INSTANCES_MAX) |
| #define | LIGHT_LIGHTNESS_DEFAULT_EID_START (LIGHT_LIGHTNESS_LAST_EID_START + LIGHT_LIGHTNESS_SETUP_SERVER_INSTANCES_MAX) |
| #define | LIGHT_LIGHTNESS_RANGE_MIN_EID_START (LIGHT_LIGHTNESS_DEFAULT_EID_START + LIGHT_LIGHTNESS_SETUP_SERVER_INSTANCES_MAX) |
| #define | LIGHT_LIGHTNESS_RANGE_MAX_EID_START (LIGHT_LIGHTNESS_RANGE_MIN_EID_START + LIGHT_LIGHTNESS_SETUP_SERVER_INSTANCES_MAX) |
| #define | LIGHT_LIGHTNESS_RANGE_STATUS_EID_START (LIGHT_LIGHTNESS_RANGE_MAX_EID_START + LIGHT_LIGHTNESS_SETUP_SERVER_INSTANCES_MAX) |
| #define | LIGHT_LIGHTNESS_ACTUAL_EID_START (LIGHT_LIGHTNESS_RANGE_STATUS_EID_START + LIGHT_LIGHTNESS_SETUP_SERVER_INSTANCES_MAX) |
| #define | LIGHT_LIGHTNESS_DTT_EID_START (LIGHT_LIGHTNESS_ACTUAL_EID_START + STORED_WITH_SCENE_INSTANCES) |
| #define | LIGHT_LIGHTNESS_ONPOWERUP_EID MESH_CONFIG_ENTRY_ID(MESH_OPT_MODEL_FILE_ID, LIGHT_LIGHTNESS_ONPOWERUP_EID_START) |
| Light Lightness On PowerUp state entry ID. | |
| #define | LIGHT_LIGHTNESS_LAST_EID MESH_CONFIG_ENTRY_ID(MESH_OPT_MODEL_FILE_ID, LIGHT_LIGHTNESS_LAST_EID_START) |
| Light Lightness Last state entry ID. | |
| #define | LIGHT_LIGHTNESS_DEFAULT_EID MESH_CONFIG_ENTRY_ID(MESH_OPT_MODEL_FILE_ID, LIGHT_LIGHTNESS_DEFAULT_EID_START) |
| Light Lightness Default state entry ID. | |
| #define | LIGHT_LIGHTNESS_RANGE_MIN_EID MESH_CONFIG_ENTRY_ID(MESH_OPT_MODEL_FILE_ID, LIGHT_LIGHTNESS_RANGE_MIN_EID_START) |
| Light Lightness Range Min state entry ID. | |
| #define | LIGHT_LIGHTNESS_RANGE_MAX_EID MESH_CONFIG_ENTRY_ID(MESH_OPT_MODEL_FILE_ID, LIGHT_LIGHTNESS_RANGE_MAX_EID_START) |
| Light Lightness Range Max state entry ID. | |
| #define | LIGHT_LIGHTNESS_RANGE_STATUS_EID MESH_CONFIG_ENTRY_ID(MESH_OPT_MODEL_FILE_ID, LIGHT_LIGHTNESS_RANGE_STATUS_EID_START) |
| Light Lightness Range Statue state entry ID. | |
| #define | LIGHT_LIGHTNESS_ACTUAL_EID MESH_CONFIG_ENTRY_ID(MESH_OPT_MODEL_FILE_ID, LIGHT_LIGHTNESS_ACTUAL_EID_START) |
| Light Lightness Actual state entry ID. | |
| #define | LIGHT_LIGHTNESS_DTT_EID MESH_CONFIG_ENTRY_ID(MESH_OPT_MODEL_FILE_ID, LIGHT_LIGHTNESS_DTT_EID_START) |
| Light Lightness Default Transition Time state entry ID. | |
Enumerations | |
| enum | light_lightness_mc_write_destination_t { LIGHT_LIGHTNESS_MC_WRITE_DESTINATION_FLASH_ONLY, LIGHT_LIGHTNESS_MC_WRITE_DESTINATION_ALL } |
| Destination to write the value into. More... | |
Functions | |
| uint32_t | light_lightness_mc_onpowerup_state_set (uint8_t index, uint8_t value) |
| Set internal Generic OnPowerUp state variable. More... | |
| uint32_t | light_lightness_mc_onpowerup_state_get (uint8_t index, uint8_t *p_value) |
| Get internal Generic OnPowerUp state variable. More... | |
| uint32_t | light_lightness_mc_last_state_set (uint8_t index, uint16_t value, light_lightness_mc_write_destination_t write_to) |
| Set internal Light Lightness Last state variable. More... | |
| uint32_t | light_lightness_mc_last_state_get (uint8_t index, uint16_t *p_value) |
| Get internal Light Lightness Last state variable. More... | |
| uint32_t | light_lightness_mc_default_state_set (uint8_t index, uint16_t value) |
| Set internal Light Lightness Default state variable. More... | |
| uint32_t | light_lightness_mc_default_state_get (uint8_t index, uint16_t *p_value) |
| Get internal Light Lightness Default state variable. More... | |
| uint32_t | light_lightness_mc_range_status_state_set (uint8_t index, uint8_t value) |
| Set internal Range Status state variable. More... | |
| uint32_t | light_lightness_mc_range_status_state_get (uint8_t index, uint8_t *p_value) |
| Get internal Range Status state variable. More... | |
| uint32_t | light_lightness_mc_range_min_state_set (uint8_t index, uint16_t value) |
| Set internal Light Lightness Range Min state variable. More... | |
| uint32_t | light_lightness_mc_range_min_state_get (uint8_t index, uint16_t *p_value) |
| Get internal Light Lightness Range Min state variable. More... | |
| uint32_t | light_lightness_mc_range_max_state_set (uint8_t index, uint16_t value) |
| Set internal Light Lightness Range Max state variable. More... | |
| uint32_t | light_lightness_mc_range_max_state_get (uint8_t index, uint16_t *p_value) |
| Get internal Light Lightness Range Max state variable. More... | |
| uint32_t | light_lightness_mc_actual_state_set (uint8_t index, uint16_t value) |
| Set internal Light Lightness Actual state variable. More... | |
| uint32_t | light_lightness_mc_actual_state_get (uint8_t index, uint16_t *p_value) |
| Get internal Light Lightness Actual state variable. More... | |
| uint32_t | light_lightness_mc_dtt_state_set (uint8_t index, uint32_t value) |
| Set internal Default Transition Time state variable. More... | |
| uint32_t | light_lightness_mc_dtt_state_get (uint8_t index, uint32_t *p_value) |
| Get internal Default Transition Time state variable. More... | |
| uint32_t | light_lightness_mc_scene_actual_state_store (uint8_t index, uint8_t scene_index, uint16_t value) |
| Store internal Scene Actual state variable. More... | |
| uint32_t | light_lightness_mc_scene_actual_state_recall (uint8_t index, uint8_t scene_index, uint16_t *p_value) |
| Recall internal Scene Actual state variable. More... | |
| uint32_t | light_lightness_mc_open (uint8_t *p_handle) |
| Create an instance of the Light Lightness Setup Server model states and return the corresponding handle. More... | |
| void | light_lightness_mc_clear (void) |
| Clear all stored data and reset state contexts to default values. | |
| void | light_lightness_mc_init (void) |
| Initialize the Light Lightness Setup Server persistent memory. | |
Detailed Description
This module provides APIs for handling persistence of the Light Lightness Setup Server model related states.
Macro Definition Documentation
◆ STORED_WITH_SCENE_INSTANCES
| #define STORED_WITH_SCENE_INSTANCES |
#define LIGHT_LIGHTNESS_SETUP_SERVER_INSTANCES_MAXThe number of the Light Lightness Setup Server instances used by the application. ...Definition: model_common.h:82
#define SCENE_REGISTER_ARRAY_SIZEScene Register size definitions. Definition: scene_common.h:86
Defines number of state instances required to store current state and state for each scene.
- Note
- If SCENE_SETUP_SERVER_INSTANCES_MAX is equal to 0, then this is equal to LIGHT_LIGHTNESS_SETUP_SERVER_INSTANCES_MAX.
Definition at line 65 of file light_lightness_mc.h.
Enumeration Type Documentation
◆ light_lightness_mc_write_destination_t
Destination to write the value into.
| Enumerator | |
|---|---|
| LIGHT_LIGHTNESS_MC_WRITE_DESTINATION_FLASH_ONLY | The value is only stored to flash. Calling light_lightness_mc_last_state_get returns the last value stored with LIGHT_LIGHTNESS_MC_WRITE_DESTINATION_ALL flag. |
| LIGHT_LIGHTNESS_MC_WRITE_DESTINATION_ALL | The value is stored to flash and RAM. Calling light_lightness_mc_last_state_get returns the stored value. |
Definition at line 105 of file light_lightness_mc.h.
Function Documentation
◆ light_lightness_mc_onpowerup_state_set()
| uint32_t light_lightness_mc_onpowerup_state_set | ( | uint8_t | index, |
| uint8_t | value | ||
| ) |
Set internal Generic OnPowerUp state variable.
- Parameters
-
[in] index An index to identify an instance of a state variable. [in] value Value to set.
- Return values
-
NRF_SUCCESS The value was successfully set. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_DATA The value is invalid.
◆ light_lightness_mc_onpowerup_state_get()
| uint32_t light_lightness_mc_onpowerup_state_get | ( | uint8_t | index, |
| uint8_t * | p_value | ||
| ) |
Get internal Generic OnPowerUp state variable.
- Parameters
-
[in] index An index to identify an instance of a state variable. [out] p_value Pointer to a buffer to copy the value into. Cannot be NULL.
- Return values
-
NRF_SUCCESS The entry value was successfully copied into p_value.NRF_ERROR_NULL A parameter is NULL. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_STATE The given index is known, but has no data associated with it.
◆ light_lightness_mc_last_state_set()
| uint32_t light_lightness_mc_last_state_set | ( | uint8_t | index, |
| uint16_t | value, | ||
| light_lightness_mc_write_destination_t | write_to | ||
| ) |
Set internal Light Lightness Last state variable.
- Parameters
-
[in] index An index to identify an instance of a state variable. [in] value Value to set. [in] write_to Destination representation to write this value into.
- Return values
-
NRF_SUCCESS The value was successfully set. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_DATA The value is invalid.
◆ light_lightness_mc_last_state_get()
| uint32_t light_lightness_mc_last_state_get | ( | uint8_t | index, |
| uint16_t * | p_value | ||
| ) |
Get internal Light Lightness Last state variable.
- Note
- The function returns the last value stored with LIGHT_LIGHTNESS_MC_WRITE_DESTINATION_ALL flag.
- Parameters
-
[in] index An index to identify an instance of a state variable. [out] p_value Pointer to a buffer to copy the value into. Cannot be NULL.
- Return values
-
NRF_SUCCESS The entry value was successfully copied into p_value.NRF_ERROR_NULL A parameter is NULL. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_STATE The given index is known, but has no data associated with it.
◆ light_lightness_mc_default_state_set()
| uint32_t light_lightness_mc_default_state_set | ( | uint8_t | index, |
| uint16_t | value | ||
| ) |
Set internal Light Lightness Default state variable.
- Parameters
-
[in] index An index to identify an instance of a state variable. [in] value Value to set.
- Return values
-
NRF_SUCCESS The value was successfully set. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_DATA The value is invalid.
◆ light_lightness_mc_default_state_get()
| uint32_t light_lightness_mc_default_state_get | ( | uint8_t | index, |
| uint16_t * | p_value | ||
| ) |
Get internal Light Lightness Default state variable.
- Parameters
-
[in] index An index to identify an instance of a state variable. [out] p_value Pointer to a buffer to copy the value into. Cannot be NULL.
- Return values
-
NRF_SUCCESS The entry value was successfully copied into p_value.NRF_ERROR_NULL A parameter is NULL. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_STATE The given index is known, but has no data associated with it.
◆ light_lightness_mc_range_status_state_set()
| uint32_t light_lightness_mc_range_status_state_set | ( | uint8_t | index, |
| uint8_t | value | ||
| ) |
Set internal Range Status state variable.
This is required to persist the value of the Status code for range set operation executed by the previous Light Lightness Range Set message. This enables subsequent Light Lightness Range Get messages to receive status of the last operation.
- Parameters
-
[in] index An index to identify an instance of a state variable. [in] value Value to set.
- Return values
-
NRF_SUCCESS The value was successfully set. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_DATA The value is invalid.
◆ light_lightness_mc_range_status_state_get()
| uint32_t light_lightness_mc_range_status_state_get | ( | uint8_t | index, |
| uint8_t * | p_value | ||
| ) |
Get internal Range Status state variable.
- Parameters
-
[in] index An index to identify an instance of a state variable. [out] p_value Pointer to a buffer to copy the value into. Cannot be NULL.
- Return values
-
NRF_SUCCESS The entry value was successfully copied into p_value.NRF_ERROR_NULL A parameter is NULL. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_STATE The given index is known, but has no data associated with it.
◆ light_lightness_mc_range_min_state_set()
| uint32_t light_lightness_mc_range_min_state_set | ( | uint8_t | index, |
| uint16_t | value | ||
| ) |
Set internal Light Lightness Range Min state variable.
- Parameters
-
[in] index An index to identify an instance of a state variable. [in] value Value to set.
- Return values
-
NRF_SUCCESS The value was successfully set. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_DATA The value is invalid.
◆ light_lightness_mc_range_min_state_get()
| uint32_t light_lightness_mc_range_min_state_get | ( | uint8_t | index, |
| uint16_t * | p_value | ||
| ) |
Get internal Light Lightness Range Min state variable.
- Parameters
-
[in] index An index to identify an instance of a state variable. [out] p_value Pointer to a buffer to copy the value into. Cannot be NULL.
- Return values
-
NRF_SUCCESS The entry value was successfully copied into p_value.NRF_ERROR_NULL A parameter is NULL. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_STATE The given index is known, but has no data associated with it.
◆ light_lightness_mc_range_max_state_set()
| uint32_t light_lightness_mc_range_max_state_set | ( | uint8_t | index, |
| uint16_t | value | ||
| ) |
Set internal Light Lightness Range Max state variable.
- Parameters
-
[in] index An index to identify an instance of a state variable. [in] value Value to set.
- Return values
-
NRF_SUCCESS The value was successfully set. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_DATA The value is invalid.
◆ light_lightness_mc_range_max_state_get()
| uint32_t light_lightness_mc_range_max_state_get | ( | uint8_t | index, |
| uint16_t * | p_value | ||
| ) |
Get internal Light Lightness Range Max state variable.
- Parameters
-
[in] index An index to identify an instance of a state variable. [out] p_value Pointer to a buffer to copy the value into. Cannot be NULL.
- Return values
-
NRF_SUCCESS The entry value was successfully copied into p_value.NRF_ERROR_NULL A parameter is NULL. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_STATE The given index is known, but has no data associated with it.
◆ light_lightness_mc_actual_state_set()
| uint32_t light_lightness_mc_actual_state_set | ( | uint8_t | index, |
| uint16_t | value | ||
| ) |
Set internal Light Lightness Actual state variable.
- Parameters
-
[in] index An index to identify an instance of a state variable. [in] value Value to set.
- Return values
-
NRF_SUCCESS The value was successfully set. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_DATA The value is invalid.
◆ light_lightness_mc_actual_state_get()
| uint32_t light_lightness_mc_actual_state_get | ( | uint8_t | index, |
| uint16_t * | p_value | ||
| ) |
Get internal Light Lightness Actual state variable.
- Parameters
-
[in] index An index to identify an instance of a state variable. [out] p_value Pointer to a buffer to copy the value into. Cannot be NULL.
- Return values
-
NRF_SUCCESS The entry value was successfully copied into p_value.NRF_ERROR_NULL A parameter is NULL. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_STATE The given index is known, but has no data associated with it.
◆ light_lightness_mc_dtt_state_set()
| uint32_t light_lightness_mc_dtt_state_set | ( | uint8_t | index, |
| uint32_t | value | ||
| ) |
Set internal Default Transition Time state variable.
- Parameters
-
[in] index An index to identify an instance of a state variable. [in] value Value to set.
- Return values
-
NRF_SUCCESS The value was successfully set. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_DATA The value is invalid.
◆ light_lightness_mc_dtt_state_get()
| uint32_t light_lightness_mc_dtt_state_get | ( | uint8_t | index, |
| uint32_t * | p_value | ||
| ) |
Get internal Default Transition Time state variable.
- Parameters
-
[in] index An index to identify an instance of a state variable. [out] p_value Pointer to a buffer to copy the value into. Cannot be NULL.
- Return values
-
NRF_SUCCESS The entry value was successfully copied into p_value.NRF_ERROR_NULL A parameter is NULL. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_STATE The given index is known, but has no data associated with it.
◆ light_lightness_mc_scene_actual_state_store()
| uint32_t light_lightness_mc_scene_actual_state_store | ( | uint8_t | index, |
| uint8_t | scene_index, | ||
| uint16_t | value | ||
| ) |
Store internal Scene Actual state variable.
- Note
- Available only if SCENE_SETUP_SERVER_INSTANCES_MAX is equal or larger than 1.
- Parameters
-
[in] index An index to identify an instance of a state variable. [in] scene_index The scene index to idenitfy the scene of a state variable. [in] value Value to store.
- Return values
-
NRF_SUCCESS The value was successfully set. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_DATA The value is invalid.
◆ light_lightness_mc_scene_actual_state_recall()
| uint32_t light_lightness_mc_scene_actual_state_recall | ( | uint8_t | index, |
| uint8_t | scene_index, | ||
| uint16_t * | p_value | ||
| ) |
Recall internal Scene Actual state variable.
- Note
- Available only if SCENE_SETUP_SERVER_INSTANCES_MAX is equal or larger than 1.
- Parameters
-
[in] index An index to identify an instance of a state variable. [in] scene_index The scene index to idenitfy the scene of a state variable. [out] p_value Pointer to a buffer to copy the value into. Cannot be NULL.
- Return values
-
NRF_SUCCESS The entry value was successfully copied into p_value.NRF_ERROR_NULL A parameter is NULL. NRF_ERROR_NOT_FOUND The given index is unknown. NRF_ERROR_INVALID_STATE The given index is known, but has no data associated with it.
◆ light_lightness_mc_open()
| uint32_t light_lightness_mc_open | ( | uint8_t * | p_handle | ) |
Create an instance of the Light Lightness Setup Server model states and return the corresponding handle.
- Parameters
-
[out] p_handle Pointer to a buffer to copy the handle into to access internal state instance.
- Return values
-
NRF_SUCCESS The new instance is successfully created. NRF_ERROR_NULL A parameter is NULL. NRF_ERROR_RESOURCES No more instances can be created. In that case, increase value of LIGHT_LIGHTNESS_SETUP_SERVER_INSTANCES_MAX.