Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-39: Prioritize command classes for interview #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -155,6 +155,9 @@ static void
zwave_command_class_version_command_class_version_get);
attribute_resolver_set_attribute_depth(version_attribute[0], 0);

sl_log_debug(LOG_TAG, "Create CC 0x%02x version attribute for Endpoint ID %d\n",
command_class, endpoint_node);

// Add it into the attribute store.
attribute_store_add_if_missing(endpoint_node,
version_attribute,
Expand Down Expand Up @@ -214,6 +217,26 @@ static void zwave_command_class_version_create_cc_version_attributes(
uint8_t nif[ATTRIBUTE_STORE_MAXIMUM_VALUE_LENGTH];
uint8_t nif_length = 0;

// First time we use COMMAND_CLASS_VERSION, query its own version supported.
add_command_class_version_attributes(COMMAND_CLASS_VERSION, endpoint_node);

// Prioritize COMMAND_CLASS_MANUFACTURER_SPECIFIC before others
// UAM rules can match unique device model, so we could override
// supported command class version attributes for matching device model.
if (SL_STATUS_OK == attribute_store_read_value(endpoint_node,
REPORTED_ATTRIBUTE,
&endpoint_id,
sizeof(endpoint_id))
&& endpoint_id == 0) {

if(zwave_node_supports_command_class(COMMAND_CLASS_MANUFACTURER_SPECIFIC,
node_id,
endpoint_id)) {
add_command_class_version_attributes(COMMAND_CLASS_MANUFACTURER_SPECIFIC,
endpoint_node);
}
}

if ((non_secure_nif_node != ATTRIBUTE_STORE_INVALID_NODE)
&& (SL_STATUS_OK
== attribute_store_get_node_attribute_value(non_secure_nif_node,
Expand Down
Expand Up @@ -280,6 +280,13 @@ void test_on_nif_attribute_update()
NULL);
// Stop the stub, expect rule registrations for each Command Class.
attribute_resolver_register_rule_Stub(NULL);

attribute_resolver_register_rule_ExpectAndReturn(
ZWAVE_CC_VERSION_ATTRIBUTE(COMMAND_CLASS_VERSION),
NULL,
version_cc_get,
SL_STATUS_OK);

for (size_t i = 0; i < supported_cc_list_length; i++) {
if (supported_cc_list[i] >= COMMAND_CLASS_FIRST_APPLICATION_CC) {
attribute_resolver_register_rule_ExpectAndReturn(
Expand Down Expand Up @@ -328,6 +335,13 @@ void test_on_nif_attribute_update()
&supported_secure_cc_list_length,
NULL,
NULL);

attribute_resolver_register_rule_ExpectAndReturn(
ZWAVE_CC_VERSION_ATTRIBUTE(COMMAND_CLASS_VERSION),
NULL,
version_cc_get,
SL_STATUS_OK);

for (size_t i = 0; i < supported_cc_list_length; i++) {
if (supported_cc_list[i] >= COMMAND_CLASS_FIRST_APPLICATION_CC) {
attribute_resolver_register_rule_ExpectAndReturn(
Expand Down