Skip to content

Commit

Permalink
Merge branch 'bugfix/admin_commissioning' into 'release/v1.2'
Browse files Browse the repository at this point in the history
components/esp-matter: Add feature for the administrator commissioning cluster

See merge request app-frameworks/esp-matter!814
  • Loading branch information
dhrishi committed Jul 23, 2024
2 parents d692395 + 5563d57 commit 5cf7aa3
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 5 deletions.
8 changes: 6 additions & 2 deletions components/esp_matter/esp_matter_cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ namespace administrator_commissioning {
const function_generic_t *function_list = NULL;
const int function_flags = CLUSTER_FLAG_NONE;

cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features)
{
cluster_t *cluster = cluster::create(endpoint, AdministratorCommissioning::Id, flags);
if (!cluster) {
Expand Down Expand Up @@ -575,9 +575,13 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
}
}

/* Features */
if (features & feature::basic::get_id()) {
feature::basic::add(cluster);
}

/* Commands */
command::create_open_commissioning_window(cluster);
command::create_open_basic_commissioning_window(cluster);
command::create_revoke_commissioning(cluster);

return cluster;
Expand Down
2 changes: 1 addition & 1 deletion components/esp_matter/esp_matter_cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ typedef struct config {
config() : cluster_revision(1) {}
} config_t;

cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features);
} /* administrator_commissioning */

namespace operational_credentials {
Expand Down
3 changes: 2 additions & 1 deletion components/esp_matter/esp_matter_endpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
general_commissioning::create(endpoint, &(config->general_commissioning), CLUSTER_FLAG_SERVER);
network_commissioning::create(endpoint, &(config->network_commissioning), CLUSTER_FLAG_SERVER);
general_diagnostics::create(endpoint, &(config->general_diagnostics), CLUSTER_FLAG_SERVER);
administrator_commissioning::create(endpoint, &(config->administrator_commissioning), CLUSTER_FLAG_SERVER);
administrator_commissioning::create(endpoint, &(config->administrator_commissioning), CLUSTER_FLAG_SERVER,
ESP_MATTER_NONE_FEATURE_ID);
operational_credentials::create(endpoint, &(config->operational_credentials), CLUSTER_FLAG_SERVER);
group_key_management::create(endpoint, CLUSTER_FLAG_SERVER);

Expand Down
26 changes: 25 additions & 1 deletion components/esp_matter/esp_matter_feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,36 @@ esp_err_t add(cluster_t *cluster)

/* Attributes managed internally */
attribute::create_tag_list(cluster, NULL, 0, 0);

return ESP_OK;
}

} /* taglist */
}
}

namespace administrator_commissioning {
namespace feature {
namespace basic {

uint32_t get_id()
{
return (uint32_t)AdministratorCommissioning::Feature::kBasic;
}

esp_err_t add(cluster_t *cluster)
{
if (!cluster) {
ESP_LOGE(TAG, "Cluster cannot be NULL");
return ESP_ERR_INVALID_ARG;
}
update_feature_map(cluster, get_id());

command::create_open_basic_commissioning_window(cluster);

return ESP_OK;
}

} /* basic */
}
}

Expand Down
12 changes: 12 additions & 0 deletions components/esp_matter/esp_matter_feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ esp_err_t add(cluster_t *cluster);
} /* feature */
} /* descriptor */

namespace administrator_commissioning {
namespace feature {
namespace basic {

uint32_t get_id();
esp_err_t add(cluster_t *cluster);

} /* basic */

} /* feature */
} /* administrator_commissioning */

namespace power_source {
namespace feature {
namespace wired {
Expand Down

0 comments on commit 5cf7aa3

Please sign in to comment.