nRF5 SDK for Mesh v5.0.0
Macros | Functions
Persistence module for the Light CTL Setup Server model related states

This module provides APIs for handling persistence of the Light CTL Setup Server model related states. More...

Macros

#define LIGHT_CTL_SETUP_SERVER_STORED_WITH_SCENE_STATES   (LIGHT_CTL_SETUP_SERVER_INSTANCES_MAX + (SCENE_REGISTER_ARRAY_SIZE * LIGHT_CTL_SETUP_SERVER_INSTANCES_MAX))
 Number of entry instances required to store the current state and state for each scene. More...
 
#define LIGHT_CTL_TEMPERATURE_EID_START   (MESH_APP_MODEL_LIGHT_CTL_SERVER_ID_START)
 
#define LIGHT_CTL_TEMPERATURE_EID_END   (LIGHT_CTL_TEMPERATURE_EID_START + LIGHT_CTL_SETUP_SERVER_STORED_WITH_SCENE_STATES - 1)
 
#define LIGHT_CTL_DELTA_UV_EID_START   (LIGHT_CTL_TEMPERATURE_EID_END + 1)
 
#define LIGHT_CTL_DELTA_UV_EID_END   (LIGHT_CTL_DELTA_UV_EID_START + LIGHT_CTL_SETUP_SERVER_STORED_WITH_SCENE_STATES - 1)
 
#define LIGHT_CTL_TEMPERATURE_DEFAULT_EID_START   (LIGHT_CTL_DELTA_UV_EID_END + 1)
 
#define LIGHT_CTL_DEFAULT_TEMPERATURE_EID_END   (LIGHT_CTL_TEMPERATURE_DEFAULT_EID_START + LIGHT_CTL_SETUP_SERVER_INSTANCES_MAX - 1)
 
#define LIGHT_CTL_DELTA_UV_DEFAULT_EID_START   (LIGHT_CTL_DEFAULT_TEMPERATURE_EID_END + 1)
 
#define LIGHT_CTL_DELTA_UV_DEFAULT_EID_END   (LIGHT_CTL_DELTA_UV_DEFAULT_EID_START + LIGHT_CTL_SETUP_SERVER_INSTANCES_MAX - 1)
 
#define LIGHT_CTL_TEMPERATURE_RANGE_EID_START   (LIGHT_CTL_DELTA_UV_DEFAULT_EID_END + 1)
 
#define LIGHT_CTL_TEMPERATURE_RANGE_EID_END   (LIGHT_CTL_TEMPERATURE_RANGE_EID_START + LIGHT_CTL_SETUP_SERVER_INSTANCES_MAX - 1)
 
#define LIGHT_CTL_TEMPERATURE_EID   MESH_CONFIG_ENTRY_ID(MESH_OPT_MODEL_FILE_ID, LIGHT_CTL_TEMPERATURE_EID_START)
 Light CTL Temperature state entry ID.
 
#define LIGHT_CTL_DELTA_UV_EID   MESH_CONFIG_ENTRY_ID(MESH_OPT_MODEL_FILE_ID, LIGHT_CTL_DELTA_UV_EID_START)
 Light CTL Delta UV state entry ID.
 
#define LIGHT_CTL_TEMPERATURE_DEFAULT_EID   MESH_CONFIG_ENTRY_ID(MESH_OPT_MODEL_FILE_ID, LIGHT_CTL_TEMPERATURE_DEFAULT_EID_START)
 Light CTL Temperature Default state entry ID.
 
#define LIGHT_CTL_DELTA_UV_DEFAULT_EID   MESH_CONFIG_ENTRY_ID(MESH_OPT_MODEL_FILE_ID, LIGHT_CTL_DELTA_UV_DEFAULT_EID_START)
 Light CTL Delta UV Default state entry ID.
 
#define LIGHT_CTL_TEMPERATURE_RANGE_EID   MESH_CONFIG_ENTRY_ID(MESH_OPT_MODEL_FILE_ID, LIGHT_CTL_TEMPERATURE_RANGE_EID_START)
 Light CTL Temperature Range state entry ID.
 

Functions

uint32_t light_ctl_mc_temperature32_state_set (uint8_t index, uint32_t value)
 Set internal Light CTL Temperature32 state variable. More...
 
uint32_t light_ctl_mc_temperature32_state_get (uint8_t index, uint32_t *p_value)
 Get internal Light CTL Temperature32 state variable. More...
 
uint32_t light_ctl_mc_delta_uv_state_set (uint8_t index, int16_t value)
 Set internal Light CTL Delta UV state variable. More...
 
uint32_t light_ctl_mc_delta_uv_state_get (uint8_t index, int16_t *p_value)
 Get internal Light CTL Delta UV state variable. More...
 
uint32_t light_ctl_mc_default_temperature32_state_set (uint8_t index, uint32_t value)
 Set internal Light CTL Temperature32 Default state variable. More...
 
uint32_t light_ctl_mc_default_temperature32_state_get (uint8_t index, uint32_t *p_value)
 Get internal Light CTL Temperature32 Default state variable. More...
 
uint32_t light_ctl_mc_default_delta_uv_state_set (uint8_t index, int16_t value)
 Set internal Light CTL Delta UV Default state variable. More...
 
uint32_t light_ctl_mc_default_delta_uv_state_get (uint8_t index, int16_t *p_value)
 Get internal Light CTL Delta UV Default state variable. More...
 
uint32_t light_ctl_mc_temperature32_range_state_set (uint8_t index, light_ctl_temperature_range_set_params_t *p_value)
 Set internal Range state variable. More...
 
uint32_t light_ctl_mc_temperature32_range_state_get (uint8_t index, light_ctl_temperature_range_set_params_t *p_value)
 Get internal Range Status state variable. More...
 
uint32_t light_ctl_mc_scene_temperature32_state_store (uint8_t index, uint8_t scene_index, uint32_t value)
 Stores internal Light CTL Temperature32 state variable for a specific scene index. More...
 
uint32_t light_ctl_mc_scene_temperature32_state_recall (uint8_t index, uint8_t scene_index, uint32_t *p_value)
 Recalls internal Light CTL Temperature32 state variable for a specific scene index. More...
 
uint32_t light_ctl_mc_scene_delta_uv_state_store (uint8_t index, uint8_t scene_index, int16_t value)
 Stores internal Light CTL Delta UV state variable for a specific scene index. More...
 
uint32_t light_ctl_mc_scene_delta_uv_state_recall (uint8_t index, uint8_t scene_index, int16_t *p_value)
 Recalls internal Light CTL Delta UV state variable for a specific scene index. More...
 
uint32_t light_ctl_mc_open (uint8_t *p_handle)
 Create an instance of the Light CTL Setup Server model states and return the corresponding handle. More...
 
void light_ctl_mc_clear (void)
 Clear all stored data and reset state contexts to default values.
 
void light_ctl_mc_init (void)
 Initialize the Light CTL Setup Server persistent memory.
 

Detailed Description

This module provides APIs for handling persistence of the Light CTL Setup Server model related states.

Macro Definition Documentation

◆ LIGHT_CTL_SETUP_SERVER_STORED_WITH_SCENE_STATES

#define LIGHT_CTL_SETUP_SERVER_STORED_WITH_SCENE_STATES   (LIGHT_CTL_SETUP_SERVER_INSTANCES_MAX + (SCENE_REGISTER_ARRAY_SIZE * LIGHT_CTL_SETUP_SERVER_INSTANCES_MAX))

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

Definition at line 65 of file light_ctl_mc.h.

Function Documentation

◆ light_ctl_mc_temperature32_state_set()

uint32_t light_ctl_mc_temperature32_state_set ( uint8_t  index,
uint32_t  value 
)

Set internal Light CTL Temperature32 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.

◆ light_ctl_mc_temperature32_state_get()

uint32_t light_ctl_mc_temperature32_state_get ( uint8_t  index,
uint32_t *  p_value 
)

Get internal Light CTL Temperature32 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.

◆ light_ctl_mc_delta_uv_state_set()

uint32_t light_ctl_mc_delta_uv_state_set ( uint8_t  index,
int16_t  value 
)

Set internal Light CTL Delta UV 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.

◆ light_ctl_mc_delta_uv_state_get()

uint32_t light_ctl_mc_delta_uv_state_get ( uint8_t  index,
int16_t *  p_value 
)

Get internal Light CTL Delta UV 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.

◆ light_ctl_mc_default_temperature32_state_set()

uint32_t light_ctl_mc_default_temperature32_state_set ( uint8_t  index,
uint32_t  value 
)

Set internal Light CTL Temperature32 Default 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.

◆ light_ctl_mc_default_temperature32_state_get()

uint32_t light_ctl_mc_default_temperature32_state_get ( uint8_t  index,
uint32_t *  p_value 
)

Get internal Light CTL Temperature32 Default 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.

◆ light_ctl_mc_default_delta_uv_state_set()

uint32_t light_ctl_mc_default_delta_uv_state_set ( uint8_t  index,
int16_t  value 
)

Set internal Light CTL Delta UV Default 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.

◆ light_ctl_mc_default_delta_uv_state_get()

uint32_t light_ctl_mc_default_delta_uv_state_get ( uint8_t  index,
int16_t *  p_value 
)

Get internal Light CTL Delta UV Default 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.

◆ light_ctl_mc_temperature32_range_state_set()

uint32_t light_ctl_mc_temperature32_range_state_set ( uint8_t  index,
light_ctl_temperature_range_set_params_t p_value 
)

Set internal Range state variable.

Parameters
[in]indexAn index to identify an instance of a state variable.
[in]p_valuePointer to a buffer of the value to be set.
Return values
NRF_SUCCESSThe value was successfully set.
NRF_ERROR_NOT_FOUNDThe given index is unknown.
NRF_ERROR_INVALID_DATAThe value is invalid.

◆ light_ctl_mc_temperature32_range_state_get()

uint32_t light_ctl_mc_temperature32_range_state_get ( uint8_t  index,
light_ctl_temperature_range_set_params_t p_value 
)

Get internal Range Status 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.

◆ light_ctl_mc_scene_temperature32_state_store()

uint32_t light_ctl_mc_scene_temperature32_state_store ( uint8_t  index,
uint8_t  scene_index,
uint32_t  value 
)

Stores internal Light CTL Temperature32 state variable for a 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 state variable.
[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.

◆ light_ctl_mc_scene_temperature32_state_recall()

uint32_t light_ctl_mc_scene_temperature32_state_recall ( uint8_t  index,
uint8_t  scene_index,
uint32_t *  p_value 
)

Recalls internal Light CTL Temperature32 state variable for a 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 state variable.
[in]scene_indexA scene index for which given value is saved.
[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.

◆ light_ctl_mc_scene_delta_uv_state_store()

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

Stores internal Light CTL Delta UV state variable for a 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 state variable.
[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.

◆ light_ctl_mc_scene_delta_uv_state_recall()

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

Recalls internal Light CTL Delta UV state variable for a 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 state variable.
[in]scene_indexA scene index for which given value is saved.
[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.

◆ light_ctl_mc_open()

uint32_t light_ctl_mc_open ( uint8_t *  p_handle)

Create an instance of the Light CTL Setup Server model states and return the corresponding handle.

Parameters
[out]p_handlePointer to a buffer to copy the handle of the 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 LIGHT_CTL_SETUP_SERVER_INSTANCES_MAX.

Documentation feedback | Developer Zone | Subscribe | Updated