The role of the attribute resolver is to locate and resolve missing information in the attribute store.
More...
The role of the attribute resolver is to locate and resolve missing information in the attribute store.
The role of the attribute resolver is to try to fetch missing information and align reported and desired values in attributes. It does so by holding a rule set for attributes. Two hooks rules are allowed pr attributes,
- A rule on how to bring the attribute desired value to the reported value. This typically maps to sending a SET command. Several rules could map to the same set command. In other words, if multiple attributes exist in the set. When the SET command is executed, it is filled with the desired value of the attribute that make up the set command.
- A rule on how to trigger a reported updated of an attribute, i.e., if the attribute is unresolved. This rule typically maps to a GET command.
◆ MAX_FRAME_LEN
#define MAX_FRAME_LEN 255 |
Maximum size of the buffer that allows to copy rule frames
◆ attribute_resolver_callback_t
A callback type for notifying about resolver events.
- Parameters
-
node | The attribute store node for which something happened. |
◆ attribute_resolver_function_t
Generator function for building PAN frames.
This function prototype is used by the rules engine to retrieve PAN frames that will resolve a get or set attribute.
Resolution functions are expected to return the following return codes:
- SL_STATUS_OK : A frame was copied into the frame pointer and should be final to resolve the attribute
- SL_STATUS_IN_PROGRESS: A frame was copied into the frame pointer, but this attribute will require more frames to be fully resolved.
- SL_STATUS_ALREADY_EXISTS: The Attribute was solved using some calculation/deductions from the Attribute Store and no frame needs to be transmitted.
- SL_STATUS_IS_WAITING: The Attribute should not be resolved and should be skipped for now.
- SL_STATUS_FAIL: (or other codes) No frame was copied due to an error. The attribute should be skipped for now.
Function parameters:
- attribute_store_node_t node [in]: The attribute store node to resolve. Resolving functions can use this information to retrieve related information from the Attribute Store.
- uint8_t frame [out]: Frame pointer. The data payload for the resolution must be written at the address pointed by this variable
- uint16_t *frame_len [out]: Length variable pointer. The length of the payload written at the frame address must be written here.
◆ attribute_resolver_clear_resolution_listener()
Clear a node resolve listener.
See attribute_resolver_set_resolution_listener This will clear the callback function registered for the node. If the combination of node and callback is not found, it will do nothing.
- Parameters
-
node | Node to clear listener for |
callback | Callback function to clear from node |
◆ attribute_resolver_clear_resolution_resumption_listener()
Sets a listener for unpausing nodes.
Listeners to unpausing/resume will get a synchronous callback
- Parameters
-
node | Node to set a listener for |
callback | Callback function to invoke when the node is resumed for resolution. |
◆ attribute_resolver_get_config()
returns the current configuration for the attribute resolver
- Returns
- current configuration object
◆ attribute_resolver_init()
Initialize the attribute resolver. This function will clear the rulebook and reset the resolver state.
- Parameters
-
resolver_config | Attribute resolver configurations bundle |
- Returns
- sl_status_t
◆ attribute_resolver_node_or_child_needs_resolution()
Verifies if the provided node, or any of its child needs resolution.
This can be used in order to detect if paused node would be resolved if unpaused.
- Parameters
-
- Returns
- true if a get or set rule is to be applied on the node or a node of its subtree. false otherwise.
◆ attribute_resolver_pause_node_resolution()
Pause the resolution on a given node.
- Parameters
-
node | Attribute node that the resolution is paused. |
◆ attribute_resolver_register_rule()
Register an attribute rule.
This function registers a new rule into the resolver rule book. Only one rule can exist per attribute type. Some attributes have both a set and get rule, some only have a set rule, some have only a get rule, some have no rules.
- Parameters
-
node_type | Attribute type for which these rules apply. |
set_func | Generator function which will generate the SET command for this attribute type. |
get_func | Generator function which will generate the GET command for this attribute type. |
- Returns
- sl_status_t
◆ attribute_resolver_restart_get_resolution()
Instructs the resolver to try to resolve a get rule that was pending.
This function will have no effect if the node is not in the pending gets.
- Parameters
-
node | Node to resolve again. |
- Returns
- SL_STATUS_OK if the node will be retried. SL_STATUS_NOT_FOUND otherwise
◆ attribute_resolver_restart_set_resolution()
Instructs the resolver to try to resolve a set rule that was pending.
This function will have no effect if the node is not in the pending sets. It will remove a pending set from its list and try to resolve it again.
- Parameters
-
node | Node to resolve again. |
- Returns
- SL_STATUS_OK if the node will be retried. SL_STATUS_NOT_FOUND otherwise
◆ attribute_resolver_resume_node_resolution()
Resume the resolution on a given node.
- Parameters
-
node | Attribute node that the resolution is resumed |
◆ attribute_resolver_set_attribute_depth()
Set the relative depth of an attribute in the attribute tree.
This functions sets the relative depth of an attribute, this is used when the attribute resolver tries to detect if multiple attributes will be resolved by the same set frame. Normally the resolver will assume that all resolved attribute in a frame are siblings (depth=1), however once an a while the a frame will resolve attribute which are on deeper levels, ie cousins and grand cousins. It is assumed that all attributes resolved in a frame are all on the same level, ie all are siblings.
- Parameters
-
- Returns
- sl_status_t
◆ attribute_resolver_set_resolution_give_up_listener()
Registers a listener that will be informed if we give up trying to perform a Get resolution on a node.
- Parameters
-
node_type | to be informed about |
callback | Function to invoke when the node resolution has been given up |
◆ attribute_resolver_set_resolution_listener()
Register a listener to be called when a node and all its children has been resolved.
This function allows for a callback to be fired when the resolver has completed and resolved a part of the attribute tree. In other words, the node passed as a parameter and all its children.
This feature is used to send Wake Up No More Information for Z-Wave Wake Up nodes. It is also used by the network monitor to identify when the node is no longer interviewed after inclusion.
- Parameters
-
node | Node to monitor |
callback | Function to invoke when the node resolution is done. |
◆ attribute_resolver_set_resolution_resumption_listener()
Sets a listener for unpausing nodes.
Listeners to unpausing/resume will get a synchronous callback
- Parameters
-
node | Node to set a listener for |
callback | Callback function to invoke when the node is resumed for resolution. |
◆ attribute_resolver_state_log()
void attribute_resolver_state_log |
( |
| ) |
|
◆ attribute_resolver_teardown()
int attribute_resolver_teardown |
( |
| ) |
|
Teardown the attribute resolver.
This function will terminate the attribute resolver process.
- Returns
- 0 on success, any other value in case of error.
◆ is_node_or_parent_paused()
This function traverses attribute store to check if any parent of the attribute node is paused or not.
- Parameters
-
- Returns
- true if the node or any of its parents is paused false if none if the node and none of its parents is paused
◆ is_node_pending_set_resolution()
Returns true if a node is pending a set resolution. i.e. command has been sent and we are waiting for a state update in the attribute store.
- Parameters
-
- Returns
- true if the node is pending set execution false otherwise