This module provides APIs for handling persistence of the Generic OnOff Server model related states. More...
Macros | |
| #define | GENERIC_ONOFF_SERVER_STORED_WITH_SCENE_STATES |
| Number of entry instances required to store the current state and state for each scene. More... | |
| #define | GENERIC_ONOFF_EID_START (MESH_APP_MODEL_GENERIC_ONOFF_ID_START) |
| #define | GENERIC_ONOFF_EID_END (GENERIC_ONOFF_EID_START + GENERIC_ONOFF_SERVER_STORED_WITH_SCENE_STATES - 1) |
| #define | GENERIC_ONOFF_EID MESH_CONFIG_ENTRY_ID(MESH_OPT_MODEL_FILE_ID, GENERIC_ONOFF_EID_START) |
| Generic OnOff state entry ID. | |
Functions | |
| uint32_t | generic_onoff_mc_onoff_state_set (uint8_t index, bool value) |
| Set internal OnOff state variable. More... | |
| uint32_t | generic_onoff_mc_onoff_state_get (uint8_t index, bool *p_value) |
| Get internal OnOff state variable. More... | |
| uint32_t | generic_onoff_mc_scene_onoff_store (uint8_t index, uint8_t scene_index, bool value) |
| Stores the given OnOff value for the specific scene index. More... | |
| uint32_t | generic_onoff_mc_scene_onoff_recall (uint8_t index, uint8_t scene_index, bool *p_value) |
| Restores the given OnOff value for the specific scene index. More... | |
| uint32_t | generic_onoff_mc_open (uint8_t *p_handle) |
| Create an instance of the Generic OnOff Server model states and return the corresponding handle. More... | |
| void | generic_onoff_mc_clear (void) |
| Clear all stored data and reset state contexts to default values. | |
| void | generic_onoff_mc_init (void) |
| Initialize the Generic OnOff Server persistent memory. | |
Detailed Description
This module provides APIs for handling persistence of the Generic OnOff Server model related states.
Macro Definition Documentation
◆ GENERIC_ONOFF_SERVER_STORED_WITH_SCENE_STATES
| #define GENERIC_ONOFF_SERVER_STORED_WITH_SCENE_STATES |
Value:
#define SCENE_REGISTER_ARRAY_SIZEScene Register size definitions. Definition: scene_common.h:86
#define GENERIC_ONOFF_SERVER_INSTANCES_MAXThe number of the Generic OnOff Server (independent, root only) instances used by the application...Definition: model_common.h:75
Number of entry instances required to store the current state and state for each scene.
- Note
- If SCENE_SETUP_SERVER_INSTANCES_MAX is equal to 0, then this is equal to GENERIC_ONOFF_SERVER_INSTANCES_MAX.
Definition at line 67 of file generic_onoff_mc.h.
Function Documentation
◆ generic_onoff_mc_onoff_state_set()
| uint32_t generic_onoff_mc_onoff_state_set | ( | uint8_t | index, |
| bool | value | ||
| ) |
Set internal OnOff 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.
◆ generic_onoff_mc_onoff_state_get()
| uint32_t generic_onoff_mc_onoff_state_get | ( | uint8_t | index, |
| bool * | p_value | ||
| ) |
Get internal OnOff 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.
◆ generic_onoff_mc_scene_onoff_store()
| uint32_t generic_onoff_mc_scene_onoff_store | ( | uint8_t | index, |
| uint8_t | scene_index, | ||
| bool | value | ||
| ) |
Stores the given OnOff value for the specific scene index.
- 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 model. [in] scene_index A scene index for which given value is saved. [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.
◆ generic_onoff_mc_scene_onoff_recall()
| uint32_t generic_onoff_mc_scene_onoff_recall | ( | uint8_t | index, |
| uint8_t | scene_index, | ||
| bool * | p_value | ||
| ) |
Restores the given OnOff value for the specific scene index.
- 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 model. [in] scene_index A scene index for which value is to be recalled. [in] p_value Pointer to a buffer to copy the 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.
◆ generic_onoff_mc_open()
| uint32_t generic_onoff_mc_open | ( | uint8_t * | p_handle | ) |
Create an instance of the Generic OnOff 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 GENERIC_ONOFF_SERVER_INSTANCES_MAX.