@@ -377,18 +377,18 @@ static esp_err_t custom_cluster_create()
377
377
/* Update the value of the attribute after esp_rmaker_node_init() is done */
378
378
char rmaker_node_id[ESP_MATTER_RAINMAKER_MAX_NODE_ID_LEN] = {0 };
379
379
attribute::create (cluster, cluster::rainmaker::attribute::rmaker_node_id::Id, ATTRIBUTE_FLAG_NONE,
380
- esp_matter_char_str (rmaker_node_id, sizeof (rmaker_node_id)));
380
+ esp_matter_char_str (rmaker_node_id, strlen (rmaker_node_id)), sizeof (rmaker_node_id ));
381
381
382
382
/* Create custom challenge_response attribute */
383
383
/* Update the value of the attribute after sign_data command is called */
384
384
char challenge_response[ESP_MATTER_RAINMAKER_MAX_CHALLENGE_RESPONSE_LEN] = {0 };
385
385
attribute::create (cluster, cluster::rainmaker::attribute::challenge_response::Id, ATTRIBUTE_FLAG_NONE,
386
- esp_matter_char_str (challenge_response, sizeof (challenge_response)));
386
+ esp_matter_char_str (challenge_response, strlen (challenge_response)), sizeof (challenge_response ));
387
387
388
388
/* Create custom challenge attribute */
389
389
char challenge[ESP_MATTER_RAINMAKER_MAX_CHALLENGE_LEN] = {0 };
390
390
attribute::create (cluster, cluster::rainmaker::attribute::challenge::Id, ATTRIBUTE_FLAG_WRITABLE,
391
- esp_matter_char_str (challenge, sizeof (challenge)));
391
+ esp_matter_char_str (challenge, strlen (challenge)), sizeof (challenge ));
392
392
393
393
/* Create custom configuration command */
394
394
command::create (cluster, cluster::rainmaker::command::configuration::Id,
@@ -415,7 +415,10 @@ class RainmakerAttrAccess : public AttributeAccessInterface
415
415
416
416
CHIP_ERROR Write (const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override
417
417
{
418
- if (aPath == ConcreteDataAttributePath (cluster::rainmaker::endpoint_id, cluster::rainmaker::Id, cluster::rainmaker::attribute::challenge::Id))
418
+ ConcreteDataAttributePath challengeAttrPath (cluster::rainmaker::endpoint_id, cluster::rainmaker::Id,
419
+ cluster::rainmaker::attribute::challenge::Id);
420
+
421
+ if (challengeAttrPath.MatchesConcreteAttributePath (aPath))
419
422
{
420
423
chip::CharSpan challenge;
421
424
CHIP_ERROR c_err = aDecoder.Decode (challenge);
@@ -427,10 +430,8 @@ class RainmakerAttrAccess : public AttributeAccessInterface
427
430
428
431
return (ESP_OK == sign_and_update_challenge_response (challenge)) ? CHIP_NO_ERROR : CHIP_ERROR_INCORRECT_STATE;
429
432
}
430
- else
431
- {
432
- return CHIP_NO_ERROR;
433
- }
433
+
434
+ return CHIP_NO_ERROR;
434
435
}
435
436
};
436
437
0 commit comments