mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Merge branch 'feat/add-chime-cluster' into 'main'
Add Chime Cluster to esp-matter Data Model See merge request app-frameworks/esp-matter!1325
This commit is contained in:
@@ -4921,5 +4921,29 @@ attribute_t *create_current_sessions(cluster_t *cluster, uint8_t *value, uint16_
|
||||
}/*webrtc transport requestor*/
|
||||
|
||||
|
||||
namespace chime {
|
||||
namespace attribute {
|
||||
attribute_t *create_installed_chime_sounds(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, Chime::Attributes::InstalledChimeSounds::Id,
|
||||
ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count));
|
||||
}
|
||||
|
||||
attribute_t *create_selected_chime(cluster_t *cluster, uint8_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, Chime::Attributes::SelectedChime::Id,
|
||||
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value));
|
||||
}
|
||||
|
||||
attribute_t *create_enabled(cluster_t *cluster, bool value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, Chime::Attributes::Enabled::Id,
|
||||
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value));
|
||||
}
|
||||
|
||||
} /* attribute */
|
||||
|
||||
} /* chime */
|
||||
|
||||
} /* cluster */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -1270,5 +1270,14 @@ attribute_t *create_current_sessions(cluster_t *cluster, uint8_t * value, uint16
|
||||
} /* attribute */
|
||||
}/*webrtc transport requestor*/
|
||||
|
||||
namespace chime {
|
||||
namespace attribute {
|
||||
|
||||
attribute_t *create_installed_chime_sounds(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count);
|
||||
attribute_t *create_selected_chime(cluster_t *cluster, uint8_t value);
|
||||
attribute_t *create_enabled(cluster_t *cluster, bool value);
|
||||
} /* attribute */
|
||||
} /* chime */
|
||||
|
||||
} /* cluster */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -998,5 +998,14 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
|
||||
}/*webrtc transport requestor*/
|
||||
|
||||
|
||||
namespace chime {
|
||||
typedef struct config {
|
||||
void *delegate;
|
||||
config() : delegate(nullptr) {}
|
||||
} config_t;
|
||||
|
||||
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
|
||||
} /* chime */
|
||||
|
||||
} /* cluster */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -3002,5 +3002,16 @@ namespace webrtc_transport_requestor {
|
||||
}/*webrtc_transport_requestor*/
|
||||
|
||||
|
||||
namespace chime {
|
||||
namespace command {
|
||||
command_t *create_play_chime_sound(cluster_t *cluster)
|
||||
{
|
||||
return esp_matter::command::create(cluster, Chime::Commands::PlayChimeSound::Id,
|
||||
COMMAND_FLAG_ACCEPTED, NULL);
|
||||
}
|
||||
|
||||
} /* command */
|
||||
} /* chime */
|
||||
|
||||
} /* cluster */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -546,5 +546,11 @@ command_t *create_end(cluster_t *cluster);
|
||||
}/*webrtc transport requestor*/
|
||||
|
||||
|
||||
namespace chime {
|
||||
namespace command {
|
||||
command_t *create_play_chime_sound(cluster_t *cluster);
|
||||
} /* command */
|
||||
} /* chime */
|
||||
|
||||
} /* cluster */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <app/clusters/ota-provider/ota-provider-cluster.h>
|
||||
#include <app/clusters/ota-provider/CodegenIntegration.h>
|
||||
#include <app/clusters/diagnostic-logs-server/diagnostic-logs-server.h>
|
||||
#include <app/clusters/chime-server/chime-server.h>
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace chip::app::Clusters;
|
||||
@@ -539,7 +540,14 @@ void DiagnosticLogsDelegateInitCB(void *delegate, uint16_t endpoint_id)
|
||||
DiagnosticLogs::DiagnosticLogsServer::Instance().SetDiagnosticLogsProviderDelegate(endpoint_id, diagnostic_logs_delegate);
|
||||
}
|
||||
|
||||
} // namespace delegate_cb
|
||||
void ChimeDelegateInitCB(void *delegate, uint16_t endpoint_id)
|
||||
{
|
||||
VerifyOrReturn(delegate != nullptr);
|
||||
ChimeDelegate *chime_delegate = static_cast<ChimeDelegate*>(delegate);
|
||||
ChimeServer *chime_server = new ChimeServer(endpoint_id, *chime_delegate);
|
||||
chime_server->Init();
|
||||
}
|
||||
|
||||
} // namespace delegate_cb
|
||||
} // namespace cluster
|
||||
} // namespace esp_matter
|
||||
|
||||
@@ -55,6 +55,7 @@ void ActionsDelegateInitCB(void *delegate, uint16_t endpoint_id);
|
||||
void ThermostatDelegateInitCB(void *delegate, uint16_t endpoint_id);
|
||||
void OtaSoftwareUpdateProviderDelegateInitCB(void *delegate, uint16_t endpoint_id);
|
||||
void DiagnosticLogsDelegateInitCB(void *delegate, uint16_t endpoint_id);
|
||||
void ChimeDelegateInitCB(void *delegate, uint16_t endpoint_id);
|
||||
} // namespace delegate_cb
|
||||
|
||||
} // namespace cluster
|
||||
|
||||
@@ -379,6 +379,10 @@ namespace webrtc_transport_requestor {
|
||||
constexpr uint16_t cluster_revision = 1;
|
||||
} // namespace webrtc_transport_requestor
|
||||
|
||||
namespace chime {
|
||||
constexpr uint16_t cluster_revision = 1;
|
||||
} // namespace chime
|
||||
|
||||
} // namespace cluster
|
||||
} // namespace esp_matter
|
||||
|
||||
|
||||
Reference in New Issue
Block a user