14#ifndef ATTRIBUTE_STORE_HELPER_H
15#define ATTRIBUTE_STORE_HELPER_H
150 size_t expected_size);
251 size_t maximum_size);
267 size_t maximum_size);
309 const uint8_t *array,
310 uint8_t extra_array_length);
350 size_t expected_size);
411 size_t expected_size);
493 size_t expected_size);
uint32_t attribute_store_type_t
Definition: attribute_store.h:50
float number_t
Definition: attribute_store_helper.h:24
attribute_store_node_value_state_t
This is the value state of a value.
Definition: attribute_store.h:121
datastore_attribute_id_t attribute_store_node_t
Handle to identify attribute store nodes.
Definition: attribute_store.h:101
void(* attribute_store_node_changed_callback_t)(attribute_store_node_t, attribute_store_change_t)
Attribute store callback type for tree node updates.
Definition: attribute_store.h:130
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.
Definition: attribute_store_helper.c:492
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.
Definition: attribute_store_helper.c:528
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.
Definition: attribute_store_helper.c:583
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.
Definition: attribute_store_helper.c:76
sl_status_t attribute_store_set_desired_string(attribute_store_node_t node, const char *string)
Safely copies a String in the Attribute Store.
Definition: attribute_store_helper.c:171
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.
Definition: attribute_store_helper.c:294
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.
Definition: attribute_store_helper.c:329
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.
Definition: attribute_store_helper.c:455
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.
Definition: attribute_store_helper.c:682
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.
Definition: attribute_store_helper.c:675
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.
Definition: attribute_store_helper.c:830
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.
Definition: attribute_store_helper.c:853
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.
Definition: attribute_store_helper.c:349
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 ex...
Definition: attribute_store_helper.c:466
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.
Definition: attribute_store_helper.c:304
number_t attribute_store_get_reported_number(attribute_store_node_t node)
Gets a numerical value from an Attribute Store node.
Definition: attribute_store_helper.c:796
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.
Definition: attribute_store_helper.c:669
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.
Definition: attribute_store_helper.c:214
bool attribute_store_is_value_matched(attribute_store_node_t node)
Indicate whether reported and desired values are matched in the attribute store.
Definition: attribute_store_helper.c:55
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.
Definition: attribute_store_helper.c:507
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....
Definition: attribute_store_helper.c:408
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.
Definition: attribute_store_helper.c:481
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.
Definition: attribute_store_helper.c:93
number_t attribute_store_get_desired_number(attribute_store_node_t node)
Gets a numerical value from an Attribute Store node.
Definition: attribute_store_helper.c:801
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.
Definition: attribute_store_helper.c:382
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.
Definition: attribute_store_helper.c:50
sl_status_t attribute_store_set_reported_string(attribute_store_node_t node, const char *string)
Safely copies a String in the Attribute Store.
Definition: attribute_store_helper.c:160
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 ins...
Definition: attribute_store_helper.c:875
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.
Definition: attribute_store_helper.c:422
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.
Definition: attribute_store_helper.c:183
uint8_t attribute_store_get_desired_size(attribute_store_node_t node)
Returns the size of the desired value of a node.
Definition: attribute_store_helper.c:869
void attribute_store_undefine_reported(attribute_store_node_t node)
Set the Reported value to "undefined" (0 size no value)
Definition: attribute_store_helper.c:110
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.
Definition: attribute_store_helper.c:45
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....
Definition: attribute_store_helper.c:442
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.
Definition: attribute_store_helper.c:807
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.
Definition: attribute_store_helper.c:314
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.
Definition: attribute_store_helper.c:359
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.
Definition: attribute_store_helper.c:30
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.
Definition: attribute_store_helper.c:556
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.
Definition: attribute_store_helper.c:125
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.
Definition: attribute_store_helper.c:115
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.
Definition: attribute_store_helper.c:339
sl_status_t attribute_store_delete_all_children(attribute_store_node_t node)
Removes all children of an attribute store node.
Definition: attribute_store_helper.c:569
uint8_t attribute_store_get_reported_size(attribute_store_node_t node)
Returns the size of the reported value of a node.
Definition: attribute_store_helper.c:864
void attribute_store_walk_tree(attribute_store_node_t top, void(*function)(attribute_store_node_t))
Visit all nodes in the tree.
Definition: attribute_store_helper.c:518
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.
Definition: attribute_store_helper.c:540
void attribute_store_undefine_desired(attribute_store_node_t node)
Set the Desired value to "undefined" (0 size no value)
Definition: attribute_store_helper.c:324
uint32_t sl_status_t
Definition: sl_status.h:139