Skip to content

Commit

Permalink
SiliconLabsGH-23: Stop setting undefine reported on UserID attributes…
Browse files Browse the repository at this point in the history
… creation.

Previously we were using ADD_IF_MISSING which creates a GET/REPORT sequence for each
UserID. This was slowing down the interview process.
User Code and User Id Status are now set to default value, which can be
updated using GetAllPinCodes command.

Bug-SiliconLabs: UIC-3062
Signed-off-by: Thomas du Boisrouvray <thdubois@silabs.com>
Forwarded-SiliconLabs: thdubois/UIC-3072/c4/develop

(cherry picked from commit ad72e34eb291502c60940a59e5db7d52cd744e41)
  • Loading branch information
Thomasdjb committed Jan 23, 2024
1 parent 5a4ebcd commit dc88870
Showing 1 changed file with 4 additions and 18 deletions.
Expand Up @@ -48,8 +48,6 @@ static const attribute_store_type_t default_attributes[]
ATTRIBUTE(CAPABILITIES)};

static const attribute_store_type_t v2_attributes[] = {ATTRIBUTE(KEYPAD_MODE)};
static const attribute_store_type_t user_id_attributes[]
= {ATTRIBUTE(CODE), ATTRIBUTE(USER_ID_STATUS)};

static const attribute_store_type_t capabilities_attributes[]
= {ATTRIBUTE(SUPPORTED_FLAGS),
Expand Down Expand Up @@ -952,18 +950,6 @@ static void zwave_command_class_user_code_on_number_of_users_update(
attribute_store_node_t endpoint_node
= attribute_store_get_first_parent_with_type(updated_node,
ATTRIBUTE_ENDPOINT_ID);
attribute_store_node_t version_node
= attribute_store_get_first_child_by_type(endpoint_node,
ATTRIBUTE(VERSION));
// We need to check the version of the supporting node:
zwave_cc_version_t supporting_node_version = 0;
attribute_store_get_reported(version_node,
&supporting_node_version,
sizeof(supporting_node_version));
if (supporting_node_version == 1) {
sl_log_debug(LOG_TAG, "Skip creating User ID nodes for CC UserCode V1.");
return;
}

attribute_store_node_t data_node
= attribute_store_get_first_child_by_type(endpoint_node, ATTRIBUTE(DATA));
Expand All @@ -976,12 +962,13 @@ static void zwave_command_class_user_code_on_number_of_users_update(
static void zwave_command_class_user_code_on_user_id_created(
attribute_store_node_t node, attribute_store_change_t change)
{
const uint8_t user_id_status = 0;
const char empty_string = '\0';
if (change != ATTRIBUTE_CREATED) {
return;
}
attribute_store_add_if_missing(node,
user_id_attributes,
COUNT_OF(user_id_attributes));
attribute_store_emplace(node, ATTRIBUTE(CODE), &empty_string, sizeof(empty_string));
attribute_store_emplace(node, ATTRIBUTE(USER_ID_STATUS), &user_id_status, sizeof(user_id_status));
}

static void zwave_command_class_user_code_on_capabilities_created(
Expand Down Expand Up @@ -1564,7 +1551,6 @@ sl_status_t zwave_command_class_user_code_init()
attribute_store_register_callback_by_type(
&zwave_command_class_user_code_on_capabilities_created,
ATTRIBUTE(CAPABILITIES));

// Attribute resolver rules
attribute_resolver_register_rule(ATTRIBUTE(NUMBER_OF_USERS),
NULL,
Expand Down

0 comments on commit dc88870

Please sign in to comment.