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

This module provides APIs for handling persistence of the Generic Level Server model related states. More...

Macros

#define GENERIC_LEVEL_SERVER_STORED_WITH_SCENE_STATES
 Number of entry instances required to store the current state and state for each scene. More...
 
#define GENERIC_LEVEL_EID_START   (MESH_APP_MODEL_GENERIC_LEVEL_ID_START)
 
#define GENERIC_LEVEL_EID_END   (GENERIC_LEVEL_EID_START + GENERIC_LEVEL_SERVER_STORED_WITH_SCENE_STATES - 1)
 
#define GENERIC_LEVEL_EID   MESH_CONFIG_ENTRY_ID(MESH_OPT_MODEL_FILE_ID, GENERIC_LEVEL_EID_START)
 Generic Level state entry ID.
 

Functions

uint32_t generic_level_mc_level_state_set (uint8_t index, int16_t value)
 Set internal Level state variable. More...
 
uint32_t generic_level_mc_level_state_get (uint8_t index, int16_t *p_value)
 Get internal Level state variable. More...
 
uint32_t generic_level_mc_scene_level_store (uint8_t index, uint8_t scene_index, int16_t value)
 Store internal Scene Level state variable. More...
 
uint32_t generic_level_mc_scene_level_recall (uint8_t index, uint8_t scene_index, int16_t *p_value)
 Recall internal Scene Level state variable. More...
 
uint32_t generic_level_mc_open (uint8_t *p_handle)
 Create an instance of the Generic Level Server model states and return the corresponding handle. More...
 
void generic_level_mc_clear (void)
 Clear all stored data and reset state contexts to default values.
 
void generic_level_mc_init (void)
 Initialize the Generic Level Server persistent memory.
 

Detailed Description

This module provides APIs for handling persistence of the Generic Level Server model related states.

Macro Definition Documentation

◆ GENERIC_LEVEL_SERVER_STORED_WITH_SCENE_STATES

#define GENERIC_LEVEL_SERVER_STORED_WITH_SCENE_STATES
Value:
#define SCENE_REGISTER_ARRAY_SIZE
Scene Register size definitions.
Definition: scene_common.h:86
#define GENERIC_LEVEL_SERVER_INSTANCES_MAX
The number of the Generic Level Server (independent, root only) instances used by the application...
Definition: model_common.h:68

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_LEVEL_SERVER_INSTANCES_MAX.

Definition at line 66 of file generic_level_mc.h.

Function Documentation

◆ generic_level_mc_level_state_set()

uint32_t generic_level_mc_level_state_set ( uint8_t  index,
int16_t  value 
)

Set internal Level 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_level_mc_level_state_get()

uint32_t generic_level_mc_level_state_get ( uint8_t  index,
int16_t *  p_value 
)

Get internal Level 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_level_mc_scene_level_store()

uint32_t generic_level_mc_scene_level_store ( uint8_t  index,
uint8_t  scene_index,
int16_t  value 
)

Store internal Scene Level state variable.

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 state variable.
[in]scene_indexThe scene index to idenitfy the scene of a state variable.
[in]valueValue to store.
Return values
NRF_SUCCESSThe value was successfully set.
NRF_ERROR_NOT_FOUNDThe given index is unknown.
NRF_ERROR_INVALID_DATAThe value is invalid.

◆ generic_level_mc_scene_level_recall()

uint32_t generic_level_mc_scene_level_recall ( uint8_t  index,
uint8_t  scene_index,
int16_t *  p_value 
)

Recall internal Scene Level state variable.

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 state variable.
[in]scene_indexThe scene index to idenitfy the scene 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_level_mc_open()

uint32_t generic_level_mc_open ( uint8_t *  p_handle)

Create an instance of the Generic Level 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_LEVEL_SERVER_INSTANCES_MAX.

Documentation feedback | Developer Zone | Subscribe | Updated