Zigbee Protocol Controller 1.6.0
Attribute Store Value Helpers

Helper functions to perform actions on the attribute store. More...

Functions

bool attribute_store_is_value_defined (attribute_store_node_t node, attribute_store_node_value_state_t value_state)
 Indicate whether a value is defined in the attribute store. More...
 
bool attribute_store_is_reported_defined (attribute_store_node_t node)
 Indicate whether the reported value of a node is defined in the attribute store. More...
 
bool attribute_store_is_desired_defined (attribute_store_node_t node)
 Indicate whether the desired value of a node is defined in the attribute store. More...
 
bool attribute_store_is_value_matched (attribute_store_node_t node)
 Indicate whether reported and desired values are matched in the attribute store. More...
 
sl_status_t attribute_store_set_desired_as_reported (attribute_store_node_t node)
 Set the Desired value to the same as the Reported value. More...
 
sl_status_t attribute_store_set_reported_as_desired (attribute_store_node_t node)
 Set the Reported value to the same as the Desired value. More...
 
void attribute_store_undefine_reported (attribute_store_node_t node)
 Set the Reported value to "undefined" (0 size no value) More...
 
sl_status_t attribute_store_set_reported (attribute_store_node_t node, const void *value, uint8_t value_size)
 Set the Reported value of an Attribute Store node. More...
 
sl_status_t attribute_store_get_reported (attribute_store_node_t node, void *value, size_t expected_size)
 Reads the reported value of an attribute store node. More...
 
sl_status_t attribute_store_set_reported_number (attribute_store_node_t node, number_t value)
 Sets a numerical value for an Attribute Store node. More...
 
sl_status_t attribute_store_set_desired_number (attribute_store_node_t node, number_t value)
 Sets a numerical value for an Attribute Store node. More...
 
number_t attribute_store_get_reported_number (attribute_store_node_t node)
 Gets a numerical value from an Attribute Store node. More...
 
number_t attribute_store_get_desired_number (attribute_store_node_t node)
 Gets a numerical value from an Attribute Store node. More...
 
sl_status_t attribute_store_set_reported_string (attribute_store_node_t node, const char *string)
 Safely copies a String in the Attribute Store. More...
 
sl_status_t attribute_store_set_desired_string (attribute_store_node_t node, const char *string)
 Safely copies a String in the Attribute Store. More...
 
sl_status_t attribute_store_get_reported_string (attribute_store_node_t node, char *string, size_t maximum_size)
 Safely retrieves a String from the Attribute Store. More...
 
sl_status_t attribute_store_get_desired_string (attribute_store_node_t node, char *string, size_t maximum_size)
 Safely retrieves a String from the Attribute Store. More...
 
sl_status_t attribute_store_get_desired_else_reported_string (attribute_store_node_t node, char *string, size_t maximum_size)
 Safely retrieves a String from the Attribute Store. More...
 
sl_status_t attribute_store_concatenate_to_reported_string (attribute_store_node_t node, const char *string)
 Safely concatenate a string to a String attribute in the Attribute Store. More...
 
sl_status_t attribute_store_append_to_reported (attribute_store_node_t node, const uint8_t *array, uint8_t extra_array_length)
 Safely append a new byte array to a byte array attribute in the Attribute Store. More...
 
void attribute_store_undefine_desired (attribute_store_node_t node)
 Set the Desired value to "undefined" (0 size no value) More...
 
sl_status_t attribute_store_set_desired (attribute_store_node_t node, const void *value, uint8_t value_size)
 Set the Desired value of an Attribute Store node. More...
 
sl_status_t attribute_store_get_desired (attribute_store_node_t node, void *value, size_t expected_size)
 Reads the desired value of an attribute store node. More...
 
sl_status_t attribute_store_get_desired_else_reported (attribute_store_node_t node, void *value, size_t expected_size)
 Reads the desired value of an attribute store node, or the reported if desired is undefined. More...
 
sl_status_t attribute_store_copy_value (attribute_store_node_t source_node, attribute_store_node_t destination_node, attribute_store_node_value_state_t value_state)
 Copy the value from a node to another. More...
 
sl_status_t attribute_store_read_value (attribute_store_node_t node, attribute_store_node_value_state_t value_state, void *read_value, size_t expected_size)
 Read an arbitrary sized value from the attribute store and writes it to a pointer. More...
 
sl_status_t attribute_store_set_child_reported (attribute_store_node_t parent, attribute_store_type_t type, const void *value, uint8_t value_size)
 Adds if missing and sets the value of the first child of a node with a given type. and writes its reported value. More...
 
sl_status_t attribute_store_set_all_children_reported (attribute_store_node_t parent, attribute_store_type_t type, const void *value, uint8_t value_size)
 Sets the value of the all children of a node with a given type. and writes their reported value. More...
 
sl_status_t attribute_store_set_child_desired (attribute_store_node_t parent, attribute_store_type_t type, const void *value, uint8_t value_size)
 Adds if missing and sets the value of the first child of a node with a given type. and writes its desired value. More...
 
sl_status_t attribute_store_get_child_reported (attribute_store_node_t parent, attribute_store_type_t type, void *value, size_t expected_size)
 Finds the reported value of the first child of a node with a given type. More...
 
sl_status_t attribute_store_set_child_reported_only_if_missing (attribute_store_node_t parent, attribute_store_type_t type, const void *value, uint8_t value_size)
 Adds and sets the reported value of the first child of a node with a given type only if it did not exist. More...
 
sl_status_t attribute_store_set_child_reported_only_if_exists (attribute_store_node_t parent, attribute_store_type_t type, const void *value, uint8_t value_size)
 Sets the value of the child node, only if the child node already exists in the Attribute Store. More...
 
sl_status_t attribute_store_set_child_reported_only_if_undefined (attribute_store_node_t parent, attribute_store_type_t type, const void *value, uint8_t value_size)
 Finds the first child of a node and and sets the reported value only if it undefined. More...
 
sl_status_t attribute_store_set_child_desired_only_if_exists (attribute_store_node_t parent, attribute_store_type_t type, const void *value, uint8_t value_size)
 Sets the value of the child node, only if the child node already exists in the Attribute Store. More...
 
void attribute_store_walk_tree (attribute_store_node_t top, void(*function)(attribute_store_node_t))
 Visit all nodes in the tree. More...
 
void attribute_store_walk_tree_with_return_value (attribute_store_node_t top, sl_status_t(*function)(attribute_store_node_t))
 Visit all nodes in the tree, applying a function. More...
 
void attribute_store_add_if_missing (attribute_store_node_t parent_node, const attribute_store_type_t attributes[], uint32_t count)
 Add multiple nodes to a parent if they are not already present. More...
 
attribute_store_node_t attribute_store_emplace (attribute_store_node_t parent_node, attribute_store_type_t type, const void *value, uint8_t value_size)
 Adds a child with a given reported value under a parent node, if it does not already exist. More...
 
attribute_store_node_t attribute_store_emplace_desired (attribute_store_node_t parent_node, attribute_store_type_t type, const void *value, uint8_t value_size)
 Adds a child with a given desired value under a parent node, if it does not already exist. More...
 
sl_status_t attribute_store_register_callback_by_type_to_array (attribute_store_node_changed_callback_t callback_function, const attribute_store_type_t types[], uint32_t types_count)
 Loop helper that register the same callback function for many attribute types. More...
 
sl_status_t attribute_store_delete_all_children (attribute_store_node_t node)
 Removes all children of an attribute store node. More...
 
attribute_store_node_t attribute_store_create_child_if_missing (attribute_store_node_t node, attribute_store_type_t type)
 Finds and returns the first child with a type under a node, creates it if missing. More...
 
number_t attribute_store_get_number (attribute_store_node_t node, attribute_store_node_value_state_t value_state)
 Helper function that sets the Reported or Desired value of a number. More...
 
sl_status_t attribute_store_set_number (attribute_store_node_t node, number_t value, attribute_store_node_value_state_t value_state)
 Helper function that sets the Reported or Desired value of a number. More...
 
uint8_t attribute_store_get_reported_size (attribute_store_node_t node)
 Returns the size of the reported value of a node. More...
 
uint8_t attribute_store_get_desired_size (attribute_store_node_t node)
 Returns the size of the desired value of a node. More...
 
uint8_t attribute_store_get_desired_else_reported_size (attribute_store_node_t node)
 Returns the size of the desired value of a node, and if 0, returns the size of the reported value instead. More...
 

Detailed Description

Helper functions to perform actions on the attribute store.

This module contains various helper function to ease the access of the attribute store.

Function Documentation

◆ attribute_store_add_if_missing()

void attribute_store_add_if_missing ( attribute_store_node_t  parent_node,
const attribute_store_type_t  attributes[],
uint32_t  count 
)

Add multiple nodes to a parent if they are not already present.

This is a helper function that will add a list of nodes to the parent if they are not already present.

Parameters
parent_nodeParent node for the nodes to add.
attributesarray of attribute types
countnumber of attributes to add.

◆ attribute_store_append_to_reported()

sl_status_t attribute_store_append_to_reported ( attribute_store_node_t  node,
const uint8_t *  array,
uint8_t  extra_array_length 
)

Safely append a new byte array to a byte array attribute in the Attribute Store.

Parameters
nodeThe Attribute store node under which the value must be appended
arraybyte array containing bytes
extra_array_lengthSize of the new array which will be append to the existing
Returns
sl_status_t returned by attribute_store_set_node_attribute_value

◆ attribute_store_concatenate_to_reported_string()

sl_status_t attribute_store_concatenate_to_reported_string ( attribute_store_node_t  node,
const char *  string 
)

Safely concatenate a string to a String attribute in the Attribute Store.

Parameters
nodeThe Attribute store node under which the value must be concatenated
stringC char array containing a String
Returns
sl_status_t returned by attribute_store_set_node_attribute_value

◆ attribute_store_copy_value()

sl_status_t attribute_store_copy_value ( attribute_store_node_t  source_node,
attribute_store_node_t  destination_node,
attribute_store_node_value_state_t  value_state 
)

Copy the value from a node to another.

Parameters
source_nodeThe node that contains a value to be copied to another node.
destination_nodeThe node that the source_node's value will be copied into.
value_stateThe value state to be copied from source_node to destination_node
Returns
SL_STATUS_OK if the value_state value was copied from source_node to destination_node. Empty value copy will be considered successful.
SL_STATUS_NOT_FOUND if one of the attribute store nodes does not exist
SL_FAIL if the value cannot be copied

◆ attribute_store_create_child_if_missing()

attribute_store_node_t attribute_store_create_child_if_missing ( attribute_store_node_t  node,
attribute_store_type_t  type 
)

Finds and returns the first child with a type under a node, creates it if missing.

This is a helper function that will return the first child with a type under a node and create it if needed.

Parameters
nodeAttribute Store Node under which the child of a type is to be returned
typeAttribute Store type of the child we are looking for
Returns
attribute_store_node_t ID of the child with the type. ATTRIBUTE_STORE_INVALID_NODE if the parent does not exist of the child could not be created.

◆ attribute_store_delete_all_children()

sl_status_t attribute_store_delete_all_children ( attribute_store_node_t  node)

Removes all children of an attribute store node.

This is a helper function that will make sure a node has no more children.

Parameters
nodeNode for which all the children should be deleted
Returns
SL_STATUS_OK if no more children, SL_STATUS_FAIL if an error occurred and a child could not be deleted.

◆ attribute_store_emplace()

attribute_store_node_t attribute_store_emplace ( attribute_store_node_t  parent_node,
attribute_store_type_t  type,
const void *  value,
uint8_t  value_size 
)

Adds a child with a given reported value under a parent node, if it does not already exist.

This is a helper function that will add a child with a given reported value if the child does not already exist.

Parameters
parent_nodeParent node.
typeAttribute Store type of the child node.
valueA pointer to a variable containing the data to be set for the reported value
value_sizeThe number of bytes to read from the value pointer.
Returns
Attribute Store Node ID of the created (or existing) node

◆ attribute_store_emplace_desired()

attribute_store_node_t attribute_store_emplace_desired ( attribute_store_node_t  parent_node,
attribute_store_type_t  type,
const void *  value,
uint8_t  value_size 
)

Adds a child with a given desired value under a parent node, if it does not already exist.

This is a helper function that will add a child with a given desired value if the child does not already exist.

Parameters
parent_nodeParent node.
typeAttribute Store type of the child node.
valueA pointer to a variable containing the data to be set for the desired value
value_sizeThe number of bytes to read from the value pointer.
Returns
Attribute Store Node ID of the created (or existing) node

◆ attribute_store_get_child_reported()

sl_status_t attribute_store_get_child_reported ( attribute_store_node_t  parent,
attribute_store_type_t  type,
void *  value,
size_t  expected_size 
)

Finds the reported value of the first child of a node with a given type.

Parameters
parentThe Attribute store node under which the child's reported value must be read
typeThe type of the child
valueA pointer to a variable containing the data to be read from the node's child.
expected_sizeThe expected size of the memory to be copied in the value pointer
Returns
sl_status_t returned by attribute_store_get_node_attribute_value

◆ attribute_store_get_desired()

sl_status_t attribute_store_get_desired ( attribute_store_node_t  node,
void *  value,
size_t  expected_size 
)

Reads the desired value of an attribute store node.

Parameters
nodeThe Attribute store node under which the value must be retrieved
valuePointer where to copy the value
expected_sizeThe size of the pointer of read_value
Returns
SL_STATUS_OK if the read value has the expected size and has been copied to the pointer.
SL_STATUS_FAIL if the value is undefined, has not the expected size or has not been copied to the pointer.

◆ attribute_store_get_desired_else_reported()

sl_status_t attribute_store_get_desired_else_reported ( attribute_store_node_t  node,
void *  value,
size_t  expected_size 
)

Reads the desired value of an attribute store node, or the reported if desired is undefined.

Parameters
nodeThe Attribute store node under which the value must be retrieved
valuePointer where to copy the value
expected_sizeThe size of the pointer of read_value
Returns
SL_STATUS_OK if the read value has the expected size and has been copied to the pointer.
SL_STATUS_FAIL if the value is undefined, has not the expected size or has not been copied to the pointer.

◆ attribute_store_get_desired_else_reported_size()

uint8_t attribute_store_get_desired_else_reported_size ( attribute_store_node_t  node)

Returns the size of the desired value of a node, and if 0, returns the size of the reported value instead.

Parameters
nodeThe Attribute store node under for which we want to know the desired else reported value length
Returns
The size in bytes of the desired value. 0 in case of error.

◆ attribute_store_get_desired_else_reported_string()

sl_status_t attribute_store_get_desired_else_reported_string ( attribute_store_node_t  node,
char *  string,
size_t  maximum_size 
)

Safely retrieves a String from the Attribute Store.

Parameters
nodeThe Attribute store node where a string is saved.
string[out] C char array pointer where the string data will be copied NULL termination is guaranteed.
maximum_sizeCapacity of the string pointer
Returns
SL_STATUS_OK if the entire string was retrived. ("" string would work)
SL_STATUS_FAIL if the attribute does not exist, value was undefined or the string could not be copied.

◆ attribute_store_get_desired_number()

number_t attribute_store_get_desired_number ( attribute_store_node_t  node)

Gets a numerical value from an Attribute Store node.

Note: The storage type will be taken from Attribute Store registration The default type will be int32_t is no registration has been made for a given attribute

Parameters
nodeThe Attribute store node to get
Returns
Desired value found in the attribute store. Returns FLT_MIN if no value is defined or an error occured reading the value.

◆ attribute_store_get_desired_size()

uint8_t attribute_store_get_desired_size ( attribute_store_node_t  node)

Returns the size of the desired value of a node.

Parameters
nodeThe Attribute store node under for which we want to know the desired value length
Returns
The size in bytes of the desired value. 0 in case of error.

◆ attribute_store_get_desired_string()

sl_status_t attribute_store_get_desired_string ( attribute_store_node_t  node,
char *  string,
size_t  maximum_size 
)

Safely retrieves a String from the Attribute Store.

Parameters
nodeThe Attribute store node where a string is saved.
string[out] C char array pointer where the string data will be copied NULL termination is guaranteed.
maximum_sizeCapacity of the string pointer
Returns
SL_STATUS_OK if the entire string was retrived. ("" string would work)
SL_STATUS_FAIL if the attribute does not exist, value was undefined or the string could not be copied.

◆ attribute_store_get_number()

number_t attribute_store_get_number ( attribute_store_node_t  node,
attribute_store_node_value_state_t  value_state 
)

Helper function that sets the Reported or Desired value of a number.

Note: Does not work with the DESIRED_OR_REPORTED attribute value type.

Parameters
nodeAttribute Store node to read the value from
value_stateThe type of value ot set, REPORTED_ATTRIBUTE or DESIRED_ATTRIBUTE
Returns
Number stored for the attribute FLT_MIN if the value is undefined or not a number.

◆ attribute_store_get_reported()

sl_status_t attribute_store_get_reported ( attribute_store_node_t  node,
void *  value,
size_t  expected_size 
)

Reads the reported value of an attribute store node.

Parameters
nodeThe Attribute store node under which the value must be retrieved
valuePointer where to copy the value
expected_sizeThe size of the pointer of read_value
Returns
SL_STATUS_OK if the read value has the expected size and has been copied to the pointer.
SL_STATUS_FAIL if the value is undefined, has not the expected size or has not been copied to the pointer.

◆ attribute_store_get_reported_number()

number_t attribute_store_get_reported_number ( attribute_store_node_t  node)

Gets a numerical value from an Attribute Store node.

Note: The storage type will be taken from Attribute Store registration The default type will be int32_t is no registration has been made for a given attribute

Parameters
nodeThe Attribute store node to get
Returns
Reported value found in the attribute store. Returns FLT_MIN if no value is defined or an error occured reading the value.

◆ attribute_store_get_reported_size()

uint8_t attribute_store_get_reported_size ( attribute_store_node_t  node)

Returns the size of the reported value of a node.

Parameters
nodeThe Attribute store node under for which we want to know the reported value length
Returns
The size in bytes of the reported value. 0 in case of error.

◆ attribute_store_get_reported_string()

sl_status_t attribute_store_get_reported_string ( attribute_store_node_t  node,
char *  string,
size_t  maximum_size 
)

Safely retrieves a String from the Attribute Store.

Parameters
nodeThe Attribute store node where a string is saved.
string[out] C char array pointer where the string data will be copied NULL termination is guaranteed.
maximum_sizeCapacity of the string pointer
Returns
SL_STATUS_OK if the entire string was retrived. ("" string would work)
SL_STATUS_FAIL if the attribute does not exist, value was undefined or the string could not be copied.

◆ attribute_store_is_desired_defined()

bool attribute_store_is_desired_defined ( attribute_store_node_t  node)

Indicate whether the desired value of a node is defined in the attribute store.

Parameters
nodeThe Attribute store node under which the desired value must be retrieved
Returns
true If the desired value is defined (its size > 0)
false If the desired value is undefined (its size == 0)

◆ attribute_store_is_reported_defined()

bool attribute_store_is_reported_defined ( attribute_store_node_t  node)

Indicate whether the reported value of a node is defined in the attribute store.

Parameters
nodeThe Attribute store node under which the reported value must be retrieved
Returns
true If the reported value is defined (its size > 0)
false If the reported value is undefined (its size == 0)

◆ attribute_store_is_value_defined()

bool attribute_store_is_value_defined ( attribute_store_node_t  node,
attribute_store_node_value_state_t  value_state 
)

Indicate whether a value is defined in the attribute store.

Parameters
nodeThe Attribute store node under which the value must be retrieved
value_stateThe value_state to retrieve
Returns
true If the value is defined (its size > 0)
false If the value is undefined (its size == 0)

◆ attribute_store_is_value_matched()

bool attribute_store_is_value_matched ( attribute_store_node_t  node)

Indicate whether reported and desired values are matched in the attribute store.

Parameters
nodeThe Attribute store node under which the value must be retrieved
Returns
true If the values are matched
false If the value are unmatched

◆ attribute_store_read_value()

sl_status_t attribute_store_read_value ( attribute_store_node_t  node,
attribute_store_node_value_state_t  value_state,
void *  read_value,
size_t  expected_size 
)

Read an arbitrary sized value from the attribute store and writes it to a pointer.

Parameters
nodeThe Attribute store node under which the value must be retrieved
value_stateThe value_state to retrieve
read_valueA pointer where to copy the read value from the attribute store.
expected_sizeThe size of the pointer of read_value
Returns
SL_STATUS_OK if the read value has the expected size and has been copied to the pointer.
SL_STATUS_FAIL if the value is undefined, has not the expected size or has not been copied to the pointer.

◆ attribute_store_register_callback_by_type_to_array()

sl_status_t attribute_store_register_callback_by_type_to_array ( attribute_store_node_changed_callback_t  callback_function,
const attribute_store_type_t  types[],
uint32_t  types_count 
)

Loop helper that register the same callback function for many attribute types.

Parameters
callback_functionThe function to invoke when the node's value is updated.
typesArray of attribute types for which a callback will be registered.
types_countThe number of elements in the types array.
Returns
SL_STATUS_OK If the callbacks were registered successfully.

◆ attribute_store_set_all_children_reported()

sl_status_t attribute_store_set_all_children_reported ( attribute_store_node_t  parent,
attribute_store_type_t  type,
const void *  value,
uint8_t  value_size 
)

Sets the value of the all children of a node with a given type. and writes their reported value.

If there is no child of the given type for the parent, nothing will happen

Parameters
parentThe Attribute store node under which the children reported values must be written
typeThe type of the children
valueA pointer to a variable containing the data to be written for the node.
value_sizeThe number of bytes to read from the value pointer.
Returns
sl_status_t returned by attribute_store_set_node_attribute_value

◆ attribute_store_set_child_desired()

sl_status_t attribute_store_set_child_desired ( attribute_store_node_t  parent,
attribute_store_type_t  type,
const void *  value,
uint8_t  value_size 
)

Adds if missing and sets the value of the first child of a node with a given type. and writes its desired value.

If there is no child of the given type for the parent, it will be created.

Parameters
parentThe Attribute store node under which the child's desired value must be written
typeThe type of the child
valueA pointer to a variable containing the data to be written for the node.
value_sizeThe number of bytes to read from the value pointer.
Returns
sl_status_t returned by attribute_store_set_node_attribute_value

◆ attribute_store_set_child_desired_only_if_exists()

sl_status_t attribute_store_set_child_desired_only_if_exists ( attribute_store_node_t  parent,
attribute_store_type_t  type,
const void *  value,
uint8_t  value_size 
)

Sets the value of the child node, only if the child node already exists in the Attribute Store.

Parameters
parentThe Attribute store node under which the child's desired value must be written
typeThe type of the child
valueA pointer to a variable containing the data to be written for the node.
value_sizeThe number of bytes to read from the value pointer.
Returns
sl_status_t returned by attribute_store_set_node_attribute_value SL_STATUS_FAIL if the child not was not present.

◆ attribute_store_set_child_reported()

sl_status_t attribute_store_set_child_reported ( attribute_store_node_t  parent,
attribute_store_type_t  type,
const void *  value,
uint8_t  value_size 
)

Adds if missing and sets the value of the first child of a node with a given type. and writes its reported value.

If there is no child of the given type for the parent, it will be created.

Parameters
parentThe Attribute store node under which the child's reported value must be written
typeThe type of the child
valueA pointer to a variable containing the data to be written for the node.
value_sizeThe number of bytes to read from the value pointer.
Returns
sl_status_t returned by attribute_store_set_node_attribute_value

◆ attribute_store_set_child_reported_only_if_exists()

sl_status_t attribute_store_set_child_reported_only_if_exists ( attribute_store_node_t  parent,
attribute_store_type_t  type,
const void *  value,
uint8_t  value_size 
)

Sets the value of the child node, only if the child node already exists in the Attribute Store.

Parameters
parentThe Attribute store node under which the child's reported value must be written
typeThe type of the child
valueA pointer to a variable containing the data to be written for the node.
value_sizeThe number of bytes to read from the value pointer.
Returns
sl_status_t returned by attribute_store_set_node_attribute_value SL_STATUS_FAIL if the child not was not present.

◆ attribute_store_set_child_reported_only_if_missing()

sl_status_t attribute_store_set_child_reported_only_if_missing ( attribute_store_node_t  parent,
attribute_store_type_t  type,
const void *  value,
uint8_t  value_size 
)

Adds and sets the reported value of the first child of a node with a given type only if it did not exist.

If the child already exists, it will not be created.

Parameters
parentThe Attribute store node under which the child's reported value must be written
typeThe type of the child
valueA pointer to a variable containing the data to be written for the node.
value_sizeThe number of bytes to read from the value pointer.
Returns
sl_status_t returned by attribute_store_set_node_attribute_value SL_STATUS_ALREADY_EXIST if the child was already present.

◆ attribute_store_set_child_reported_only_if_undefined()

sl_status_t attribute_store_set_child_reported_only_if_undefined ( attribute_store_node_t  parent,
attribute_store_type_t  type,
const void *  value,
uint8_t  value_size 
)

Finds the first child of a node and and sets the reported value only if it undefined.

If the child does not exist, it will not be created and nothing will happen.

Parameters
parentThe Attribute store node under which the child's reported value must be written
typeThe type of the child
valueA pointer to a variable containing the data to be written for the node.
value_sizeThe number of bytes to read from the value pointer.
Returns
sl_status_t returned by attribute_store_set_node_attribute_value SL_STATUS_OK if no write operation has been attempted.

◆ attribute_store_set_desired()

sl_status_t attribute_store_set_desired ( attribute_store_node_t  node,
const void *  value,
uint8_t  value_size 
)

Set the Desired value of an Attribute Store node.

Parameters
nodeThe Attribute store node for which DESIRED must be updated
valueA pointer to a variable containing the data to be written for the node.
value_sizeThe number of bytes to read from the value pointer.
Returns
sl_status_t returned by attribute_store_set_node_attribute_value

◆ attribute_store_set_desired_as_reported()

sl_status_t attribute_store_set_desired_as_reported ( attribute_store_node_t  node)

Set the Desired value to the same as the Reported value.

Parameters
nodeThe Attribute store node for which DESIRED must be aligned to REPORTED
Returns
sl_status_t

◆ attribute_store_set_desired_number()

sl_status_t attribute_store_set_desired_number ( attribute_store_node_t  node,
number_t  value 
)

Sets a numerical value for an Attribute Store node.

Note: The storage type will be taken from Attribute Store registration The default type will be int32_t is no registration has been made for a given attribute

Parameters
nodeThe Attribute store node to set
valueValue to set
Returns
sl_status_t returned by attribute_store_set_node_attribute_value

◆ attribute_store_set_desired_string()

sl_status_t attribute_store_set_desired_string ( attribute_store_node_t  node,
const char *  string 
)

Safely copies a String in the Attribute Store.

Parameters
nodeThe Attribute store node under which the value must be written
stringC char array containing a String
Returns
sl_status_t returned by attribute_store_set_node_attribute_value

◆ attribute_store_set_number()

sl_status_t attribute_store_set_number ( attribute_store_node_t  node,
number_t  value,
attribute_store_node_value_state_t  value_state 
)

Helper function that sets the Reported or Desired value of a number.

Note: Does not work with the DESIRED_OR_REPORTED attribute value type.

Parameters
nodeAttribute Store node to read the value from
valueThe value to set
value_stateThe value state/type to set (desired or reported)
Returns
sl_status_t

◆ attribute_store_set_reported()

sl_status_t attribute_store_set_reported ( attribute_store_node_t  node,
const void *  value,
uint8_t  value_size 
)

Set the Reported value of an Attribute Store node.

Parameters
nodeThe Attribute store node for which REPORTED must be updated
valueA pointer to a variable containing the data to be written for the node.
value_sizeThe number of bytes to read from the value pointer.
Returns
sl_status_t returned by attribute_store_set_node_attribute_value

◆ attribute_store_set_reported_as_desired()

sl_status_t attribute_store_set_reported_as_desired ( attribute_store_node_t  node)

Set the Reported value to the same as the Desired value.

Parameters
nodeThe Attribute store node for which REPORTED must be aligned to DESIRED
Returns
sl_status_t

◆ attribute_store_set_reported_number()

sl_status_t attribute_store_set_reported_number ( attribute_store_node_t  node,
number_t  value 
)

Sets a numerical value for an Attribute Store node.

Note: The storage type will be taken from Attribute Store registration The default type will be int32_t is no registration has been made for a given attribute

Parameters
nodeThe Attribute store node to set
valueValue to set
Returns
sl_status_t returned by attribute_store_set_node_attribute_value

◆ attribute_store_set_reported_string()

sl_status_t attribute_store_set_reported_string ( attribute_store_node_t  node,
const char *  string 
)

Safely copies a String in the Attribute Store.

Parameters
nodeThe Attribute store node under which the value must be written
stringC char array containing a String
Returns
sl_status_t returned by attribute_store_set_node_attribute_value

◆ attribute_store_undefine_desired()

void attribute_store_undefine_desired ( attribute_store_node_t  node)

Set the Desired value to "undefined" (0 size no value)

Parameters
nodeThe Attribute store node for which DESIRED must be set to nothing

◆ attribute_store_undefine_reported()

void attribute_store_undefine_reported ( attribute_store_node_t  node)

Set the Reported value to "undefined" (0 size no value)

Parameters
nodeThe Attribute store node for which REPORTED must be set to nothing

◆ attribute_store_walk_tree()

void attribute_store_walk_tree ( attribute_store_node_t  top,
void(*)(attribute_store_node_t function 
)

Visit all nodes in the tree.

This function visits all the attribute store nodes under the "top" node and applies the function passed in parameter.

Parameters
topFirst node to be visited
functionfunction to execute

◆ attribute_store_walk_tree_with_return_value()

void attribute_store_walk_tree_with_return_value ( attribute_store_node_t  top,
sl_status_t(*)(attribute_store_node_t function 
)

Visit all nodes in the tree, applying a function.

This function visits all the attribute store nodes under the "top" node and applies the function passed in parameter.

Parameters
topFirst node to be visited
functionfunction to execute