components/esp_matter: add chime cluster in esp_matter

This commit is contained in:
mahesh
2025-12-03 12:24:07 +05:30
parent 507f9b8dcf
commit 716d1eadf5
9 changed files with 112 additions and 1 deletions
@@ -4042,5 +4042,44 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// // ToDo
// } /* audio_output */
namespace chime {
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 *cluster = esp_matter::cluster::create(endpoint, Chime::Id, flags);
VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, Chime::Id));
if (flags & CLUSTER_FLAG_SERVER) {
if (config->delegate != nullptr) {
static const auto delegate_init_cb = ChimeDelegateInitCB;
set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate);
}
static const auto plugin_server_init_cb = CALL_ONCE(MatterChimePluginServerInitCallback);
set_plugin_server_init_callback(cluster, plugin_server_init_cb);
add_function_list(cluster, function_list, function_flags);
/* Attributes managed internally */
global::attribute::create_feature_map(cluster, 0);
attribute::create_installed_chime_sounds(cluster, NULL, 0, 0);
attribute::create_selected_chime(cluster, 0);
attribute::create_enabled(cluster, false);
/* Attributes not managed internally */
global::attribute::create_cluster_revision(cluster, cluster_revision);
command::create_play_chime_sound(cluster);
}
if (flags & CLUSTER_FLAG_CLIENT) {
create_default_binding_cluster(endpoint);
}
return cluster;
}
} /* chime */
} /* cluster */
} /* esp_matter */