mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
components/esp_matter: add chime cluster in esp_matter
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user