nRF5 SDK for Mesh v5.0.0
Macros | Functions
Persistence module for the Generic OnOff Server model related states

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_SIZE
Scene Register size definitions.
Definition: scene_common.h:86
#define GENERIC_ONOFF_SERVER_INSTANCES_MAX
The 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]indexAn index to identify an instance of a state variable.
[in]valueValue to set.
Return values
NRF_SUCCESSThe value was successfully set.
NRF_ERROR_NOT_FOUNDThe given index is unknown.
NRF_ERROR_INVALID_DATAThe 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]indexAn index to identify an instance of a state variable.
[out]p_valuePointer to a buffer to copy the value into. Cannot be NULL.
Return values
NRF_SUCCESSThe entry value was successfully copied into p_value.
NRF_ERROR_NULLA parameter is NULL.
NRF_ERROR_NOT_FOUNDThe given index is unknown.
NRF_ERROR_INVALID_STATEThe 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]indexAn index to identify an instance of a model.
[in]scene_indexA scene index for which given value is saved.
[in]valueValue to set.
Return values
NRF_SUCCESSThe value was successfully set.
NRF_ERROR_NOT_FOUNDThe given index is unknown.
NRF_ERROR_INVALID_DATAThe 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]indexAn index to identify an instance of a model.
[in]scene_indexA scene index for which value is to be recalled.
[in]p_valuePointer to a buffer to copy the value into.
Return values
NRF_SUCCESSThe value was successfully set.
NRF_ERROR_NOT_FOUNDThe given index is unknown.
NRF_ERROR_INVALID_DATAThe 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_handlePointer to a buffer to copy the handle into to access internal state instance.
Return values
NRF_SUCCESSThe new instance is successfully created.
NRF_ERROR_NULLA parameter is NULL.
NRF_ERROR_RESOURCESNo more instances can be created. In that case, increase value of GENERIC_ONOFF_SERVER_INSTANCES_MAX.

Documentation feedback | Developer Zone | Subscribe | Updated