Skip to content

Commit 95866a9

Browse files
committed
SiliconLabsGH-23: Stop setting undefine reported on UserID attributes 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 <[email protected]> Forwarded-SiliconLabs: thdubois/UIC-3072/c4/develop (cherry picked from commit ad72e34eb291502c60940a59e5db7d52cd744e41)
1 parent 306e06c commit 95866a9

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

applications/zpc/components/zwave_command_classes/src/zwave_command_class_user_code.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ static const attribute_store_type_t default_attributes[]
4848
ATTRIBUTE(CAPABILITIES)};
4949

5050
static const attribute_store_type_t v2_attributes[] = {ATTRIBUTE(KEYPAD_MODE)};
51-
static const attribute_store_type_t user_id_attributes[]
52-
= {ATTRIBUTE(CODE), ATTRIBUTE(USER_ID_STATUS)};
5351

5452
static const attribute_store_type_t capabilities_attributes[]
5553
= {ATTRIBUTE(SUPPORTED_FLAGS),
@@ -952,18 +950,6 @@ static void zwave_command_class_user_code_on_number_of_users_update(
952950
attribute_store_node_t endpoint_node
953951
= attribute_store_get_first_parent_with_type(updated_node,
954952
ATTRIBUTE_ENDPOINT_ID);
955-
attribute_store_node_t version_node
956-
= attribute_store_get_first_child_by_type(endpoint_node,
957-
ATTRIBUTE(VERSION));
958-
// We need to check the version of the supporting node:
959-
zwave_cc_version_t supporting_node_version = 0;
960-
attribute_store_get_reported(version_node,
961-
&supporting_node_version,
962-
sizeof(supporting_node_version));
963-
if (supporting_node_version == 1) {
964-
sl_log_debug(LOG_TAG, "Skip creating User ID nodes for CC UserCode V1.");
965-
return;
966-
}
967953

968954
attribute_store_node_t data_node
969955
= attribute_store_get_first_child_by_type(endpoint_node, ATTRIBUTE(DATA));
@@ -976,12 +962,13 @@ static void zwave_command_class_user_code_on_number_of_users_update(
976962
static void zwave_command_class_user_code_on_user_id_created(
977963
attribute_store_node_t node, attribute_store_change_t change)
978964
{
965+
const uint8_t user_id_status = 0;
966+
const char empty_string = '\0';
979967
if (change != ATTRIBUTE_CREATED) {
980968
return;
981969
}
982-
attribute_store_add_if_missing(node,
983-
user_id_attributes,
984-
COUNT_OF(user_id_attributes));
970+
attribute_store_emplace(node, ATTRIBUTE(CODE), &empty_string, sizeof(empty_string));
971+
attribute_store_emplace(node, ATTRIBUTE(USER_ID_STATUS), &user_id_status, sizeof(user_id_status));
985972
}
986973

987974
static void zwave_command_class_user_code_on_capabilities_created(
@@ -1564,7 +1551,6 @@ sl_status_t zwave_command_class_user_code_init()
15641551
attribute_store_register_callback_by_type(
15651552
&zwave_command_class_user_code_on_capabilities_created,
15661553
ATTRIBUTE(CAPABILITIES));
1567-
15681554
// Attribute resolver rules
15691555
attribute_resolver_register_rule(ATTRIBUTE(NUMBER_OF_USERS),
15701556
NULL,

0 commit comments

Comments
 (0)