Skip to content

Commit 295475b

Browse files
silabs-borislrzr
authored andcommitted
UIC-3222: Update Get Checksum function
Add a notification to the UI Set the received checksum last
1 parent aad5a3f commit 295475b

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

applications/zpc/components/zwave_command_classes/src/zwave_command_class_user_credential.cpp

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
// DotDot
3737
#include "unify_dotdot_attribute_store_node_state.h"
38+
#include "dotdot_mqtt_helpers.hpp"
3839

3940
// Cpp related
4041
#include <vector>
@@ -1734,9 +1735,6 @@ sl_status_t zwave_command_class_user_credential_user_checksum_handle_report(
17341735
auto user_node
17351736
= get_user_unique_id_node(endpoint_node, user_id, REPORTED_ATTRIBUTE);
17361737

1737-
user_node.emplace_node(ATTRIBUTE(USER_CHECKSUM))
1738-
.set_reported(user_checksum);
1739-
17401738
// Compute checksum ourselves to see if it matches
17411739
user_credential::checksum_calculator checksum_calculator;
17421740

@@ -1778,6 +1776,19 @@ sl_status_t zwave_command_class_user_credential_user_checksum_handle_report(
17781776
ATTRIBUTE(USER_CHECKSUM_MISMATCH_ERROR),
17791777
checksum_calculator.compute_checksum(),
17801778
user_checksum);
1779+
1780+
user_node.emplace_node(ATTRIBUTE(USER_CHECKSUM))
1781+
.set_reported(user_checksum);
1782+
1783+
if (result == SL_STATUS_OK) {
1784+
send_message_to_mqtt(SL_LOG_INFO,
1785+
"User Checksum for user " + std::to_string(user_id)
1786+
+ " is correct.");
1787+
} else {
1788+
send_message_to_mqtt(SL_LOG_ERROR,
1789+
"Mismatch User Checksum for user "
1790+
+ std::to_string(user_id));
1791+
}
17811792
} catch (const std::exception &e) {
17821793
sl_log_error(LOG_TAG,
17831794
"Error while parsing User Checksum Report frame : %s",
@@ -1899,6 +1910,16 @@ sl_status_t
18991910
ATTRIBUTE(CREDENTIAL_CHECKSUM_MISMATCH_ERROR),
19001911
checksum_calculator.compute_checksum(),
19011912
credential_checksum);
1913+
1914+
if (result == SL_STATUS_OK) {
1915+
send_message_to_mqtt(SL_LOG_INFO,
1916+
"Credential Checksum for " + cred_type_get_enum_value_name(credential_type)
1917+
+ " is correct.");
1918+
} else {
1919+
send_message_to_mqtt(SL_LOG_ERROR,
1920+
"Mismatch Credential Checksum for "
1921+
+ cred_type_get_enum_value_name(credential_type));
1922+
}
19021923
} catch (const std::exception &e) {
19031924
sl_log_error(LOG_TAG,
19041925
"Error while parsing Credential Checksum Report frame : %s",

0 commit comments

Comments
 (0)