|
Z-Wave Protocol Controller Reference
|
#include "zwave_command_class_wake_up.h"#include "zwave_command_classes_utils.h"#include "zwave_command_class_indices.h"#include "zwave_controller_utils.h"#include "attribute_store.h"#include "attribute_store_defined_attribute_types.h"#include "attribute_store_helper.h"#include "zpc_attribute_store_network_helper.h"#include "zwave_network_management.h"#include "attribute_resolver.h"#include "attribute_timeouts.h"#include "zpc_attribute_resolver.h"#include "zwave_command_handler.h"#include "zwave_tx_scheme_selector.h"#include "zwave_tx.h"#include "zpc_config.h"#include "sl_status.h"#include "zwave_utils.h"#include "zwave_command_class_wake_up_types.h"#include "ZW_classcmd.h"#include <assert.h>#include <stdlib.h>#include <stdio.h>#include "sl_log.h"Macros | |
| #define | LOG_TAG "zwave_command_class_wake_up" |
| #define | ATTRIBUTE(type) ATTRIBUTE_COMMAND_CLASS_WAKE_UP_##type |
| #define | WAKE_UP_ON_DEMAND_INDEX 14 |
| #define | WAKE_UP_ON_DEMAND_BITMASK 1 |
| Bitmask for the Wake Up On demand capability. More... | |
| #define | MINIMUM_WAKE_UP_INTERVAL 0 |
| Minimum possible Wake Up Interval. More... | |
| #define | MAXIMUM_WAKE_UP_INTERVAL 16777215 |
| Maximum possible Wake Up Interval. More... | |
| #define | DEFAULT_WAKE_UP_STEP 1 |
| Default possible Wake Up Step. More... | |
| #define | DEFAULT_WAKE_UP_CAPBILITIES_BITMASK 0 |
| Default capabilities bitmask (nothing is supported) More... | |
| #define | WAKE_UP_NO_MORE_DISCARD_TIMEOUT 15000 |
| #define | WAKE_UP_NO_MORE_DELAY 1000 |
Functions | |
| static void | send_wake_up_no_more (attribute_store_node_t node_id_node) |
| Check if we need and send a Wake Up No more command to a node and puts it in the Tx Queue. More... | |
| static bool | we_are_the_wake_up_destination (attribute_store_node_t node_id_node) |
| Verifies if we are the Wake Up destination of a NodeID. More... | |
| static void | verify_if_wake_up_setting_needs_resolution (attribute_store_node_t wake_up_setting_node) |
| Verifies if either NodeID / Wake Up interval settings are still undefined or mismatched and a resolution is needed. More... | |
| static sl_status_t | save_reported_interval (attribute_store_node_t parent, attribute_store_type_t type, uint8_t interval_1_msb, uint8_t interval_2, uint8_t interval_3_lsb) |
| Takes the 3 bytes of a wake_up_interval_t and saves it in the attribute store. More... | |
| static wake_up_interval_t | get_maximum_possible_interval (attribute_store_node_t endpoint_node) |
| Finds the value that would lead to the largest time between Wake Ups for a node. More... | |
| static wake_up_interval_t | get_closest_supported_interval (attribute_store_node_t endpoint_node, wake_up_interval_t wished_interval) |
| Finds the closest supported value for a Wake Up Interval. More... | |
| static void | set_default_v2_capabilities (attribute_store_node_t wake_up_capabilities_node) |
| Writes down assumed non-advertised capabilities for a v2 node. More... | |
| static void | set_default_v1_capabilities (attribute_store_node_t wake_up_capabilities_node) |
| Writes down assumed non-advertised capabilities for a v1 node. More... | |
| static sl_status_t | wake_up_capabilities_get (attribute_store_node_t wake_up_capabilities_node, uint8_t *frame, uint16_t *frame_len) |
| static sl_status_t | wake_up_interval_get (attribute_store_node_t wake_up_setting_node, uint8_t *frame, uint16_t *frame_len) |
| static sl_status_t | wake_up_interval_set (attribute_store_node_t wake_up_setting_node, uint8_t *frame, uint16_t *frame_len) |
| static sl_status_t | handle_wake_up_notification (const zwave_controller_connection_info_t *connection) |
| static sl_status_t | handle_wake_up_interval_report (const zwave_controller_connection_info_t *connection, const uint8_t *frame_data, uint16_t frame_length) |
| static sl_status_t | handle_wake_up_interval_capabilities_report (const zwave_controller_connection_info_t *connection, const uint8_t *frame_data, uint16_t frame_length) |
| static void | configure_wake_up_interval (attribute_store_node_t wake_up_capabilities_node) |
| Configures the Wake Up Interval setting for a node. More... | |
| static void | on_wake_up_setting_send_data_complete (attribute_store_node_t wake_up_setting_node, resolver_rule_type_t rule_type, zpc_resolver_event_t event) |
| static void | on_version_attribute_update (attribute_store_node_t updated_node, attribute_store_change_t change) |
| static void | on_capabilities_attribute_update (attribute_store_node_t updated_node, attribute_store_change_t change) |
| Verifies if we are resolving capabilities, and if yes, set a resolutio listener to set the Wake Up Interval. More... | |
| static void | on_desired_wake_up_setting_update (attribute_store_node_t updated_node, attribute_store_change_t change) |
| Verifies if either NodeID / Wake Up interval settings have changed and need resolution in this case, we will mismatch the Setting attribute to get a resolution. More... | |
| static sl_status_t | wake_up_control_handler (const zwave_controller_connection_info_t *connection, const uint8_t *frame_data, uint16_t frame_length) |
| bool | zwave_command_class_wake_up_supports_wake_up_on_demand (attribute_store_node_t node_id_node) |
| Verifies if a Node supports the Wake Up on demand functionality. More... | |
| sl_status_t | zwave_command_class_wake_up_init () |
| Initializes the Wake Up Command Class handler. More... | |
Variables | |
| static const attribute_store_type_t | setting_node_type [] = {ATTRIBUTE(SETTING)} |
| static const attribute_store_type_t | capabilities_node_type [] = {ATTRIBUTE(CAPABILITIES)} |
| static const attribute_store_type_t | setting_attributes [] = {ATTRIBUTE(INTERVAL), ATTRIBUTE(NODE_ID)} |
| static const attribute_store_type_t | capabilities_attributes [] |
| #define ATTRIBUTE | ( | type | ) | ATTRIBUTE_COMMAND_CLASS_WAKE_UP_##type |
| #define DEFAULT_WAKE_UP_CAPBILITIES_BITMASK 0 |
Default capabilities bitmask (nothing is supported)
| #define DEFAULT_WAKE_UP_STEP 1 |
Default possible Wake Up Step.
| #define LOG_TAG "zwave_command_class_wake_up" |
| #define MAXIMUM_WAKE_UP_INTERVAL 16777215 |
Maximum possible Wake Up Interval.
| #define MINIMUM_WAKE_UP_INTERVAL 0 |
Minimum possible Wake Up Interval.
| #define WAKE_UP_NO_MORE_DELAY 1000 |
| #define WAKE_UP_NO_MORE_DISCARD_TIMEOUT 15000 |
Timing to send a Wake Up No More (ms). The node falls asleep after 10s, so no reasons to keep this frame more than e.g 15 seconds in the queue.
| #define WAKE_UP_ON_DEMAND_BITMASK 1 |
Bitmask for the Wake Up On demand capability.
| #define WAKE_UP_ON_DEMAND_INDEX 14 |
|
static |
Configures the Wake Up Interval setting for a node.
| wake_up_capabilities_node | The Attribute Store node for the Wake Up capabilities |
|
static |
Finds the closest supported value for a Wake Up Interval.
Nodes support between Min and Max allowing certain steps. Not all values are allowed.
| endpoint_node | The Attribute Store node for the Endpoint ID |
| wished_interval | The Interval that we wish to set |
|
static |
Finds the value that would lead to the largest time between Wake Ups for a node.
| endpoint_node | The Attribute Store node for the Endpoint ID which which will be read. |
|
static |
|
static |
|
static |
|
static |
Verifies if we are resolving capabilities, and if yes, set a resolutio listener to set the Wake Up Interval.
We register a listener callback on the lowest possible level, so we configure the wake up interval as early as possible.
| updated_node | Attribute Store node that was updated (ATTRIBUTE(CAPABILITIES)) |
| change | Attribute Store change. |
|
static |
Verifies if either NodeID / Wake Up interval settings have changed and need resolution in this case, we will mismatch the Setting attribute to get a resolution.
| updated_node | Attribute Store node that was updated Setting->NodeID or Setting->Interval |
| change | Attribute Store change. |
|
static |
|
static |
|
static |
Takes the 3 bytes of a wake_up_interval_t and saves it in the attribute store.
| parent | The Attribute Store node under which the child with the type reported value will be saved. |
| type | Type of the attribute store node to be saved under the parent |
| interval_1_msb | MSB for the wake_up_interval_t. See the Command Class specifications for details. |
| interval_2 | Middle byte for the wake_up_interval_t. See the Command Class specifications for details. |
| interval_3_lsb | specifications for details. |
|
static |
Check if we need and send a Wake Up No more command to a node and puts it in the Tx Queue.
| node_id_node | The Attribute Store node for the NODE_ID to send back to sleep. |
|
static |
Writes down assumed non-advertised capabilities for a v1 node.
V1, there are no range of capabilities, we just write that everything Is supported. It can be overridden by somebody else (e.g. Mapper) if we know of a v1 device that does not support the full range.
| wake_up_capabilities_node | The Attribute Store node for the Wake Up capabilities node. |
|
static |
Writes down assumed non-advertised capabilities for a v2 node.
V2, the nodes do not advertise if they support the Wake Up On Demand, so we Set that to false.
| wake_up_capabilities_node | The Attribute Store node for the Wake Up capabilities node. |
|
static |
Verifies if either NodeID / Wake Up interval settings are still undefined or mismatched and a resolution is needed.
If the wake_up_setting_node needs resolution, the wake_up_setting_node value will be adjusted to either undefined value or NEEDS_ONE_COMMAND / FINAL_STATE value mismatch, to trigger resolution.
| wake_up_setting_node | Attribute Store node for the Wake Up Setting. |
|
static |
|
static |
|
static |
|
static |
|
static |
Verifies if we are the Wake Up destination of a NodeID.
It will search all endpoints for a Wake Up Configuration containing our NodeID.
| node_id_node | The Attribute Store Node of the NodeID for which we want to check if we are the Wake Up Destination |
|
static |
|
static |
|
static |
|
static |