From 5cba29a1cec62d9fbfd7849095d01920a892a5f7 Mon Sep 17 00:00:00 2001 From: SirRu24 Date: Wed, 29 May 2024 14:41:21 +0800 Subject: [PATCH] [sdk] Optimize ameba data model, Add Matter core and prov control, and Fix Build --- .../matter/common/atcmd/atcmd_matter.c | 39 +- .../matter/core/matter_control.cpp | 226 +++ .../application/matter/core/matter_control.h | 26 + .../application/matter/core/matter_core.cpp | 98 +- .../application/matter/core/matter_core.h | 18 + .../matter/core/matter_data_model.cpp | 544 +------ .../matter/core/matter_data_model.h | 184 +-- .../matter/core/matter_data_model_presets.cpp | 1348 ++++++++--------- .../matter/core/matter_data_model_presets.h | 31 +- .../matter/core/matter_interaction.cpp | 25 + .../matter/core/matter_interaction.h | 1 + .../application/matter/core/matter_prov.cpp | 103 ++ .../application/matter/core/matter_prov.h | 35 + .../matter/driver/bridge_dm_driver.cpp | 14 +- .../matter/driver/bridge_dm_driver.h | 2 +- .../matter/example/bridge_dm/README.md | 15 +- .../bridge_dm/example_matter_bridge.cpp | 39 +- .../example_matter_laundrywasher.cpp | 2 +- .../matter/example/light_dm/README.md | 11 - .../example/light_dm/example_matter_light.cpp | 27 +- .../amebad/make/chip/aircon_app/Makefile | 1 + .../amebad/make/chip/dishwasher_app/Makefile | 1 + .../make/chip/laundrywasher_app/Makefile | 1 + .../amebad/make/chip/lighting_app/Makefile | 1 + .../make/chip/refrigerator_app/Makefile | 1 + .../amebad/make/chip/thermostat_app/Makefile | 1 + .../make/chip_main/aircon_port/Makefile | 12 + .../make/chip_main/dishwasher_port/Makefile | 12 + .../chip_main/laundrywasher_port/Makefile | 12 + .../make/chip_main/light_switch_app/Makefile | 12 +- .../make/chip_main/lighting_dm_app/Makefile | 13 + .../make/chip_main/lighting_port/Makefile | 12 + .../make/chip_main/refrigerator_port/Makefile | 12 + .../make/chip_main/thermostat_port/Makefile | 12 + 34 files changed, 1403 insertions(+), 1488 deletions(-) create mode 100644 component/common/application/matter/core/matter_control.cpp create mode 100644 component/common/application/matter/core/matter_control.h create mode 100644 component/common/application/matter/core/matter_prov.cpp create mode 100644 component/common/application/matter/core/matter_prov.h diff --git a/component/common/application/matter/common/atcmd/atcmd_matter.c b/component/common/application/matter/common/atcmd/atcmd_matter.c index e83d16f2..3b288818 100644 --- a/component/common/application/matter/common/atcmd/atcmd_matter.c +++ b/component/common/application/matter/common/atcmd/atcmd_matter.c @@ -54,15 +54,50 @@ void fATchipapp2(void *arg) #endif } +__weak void MatterCoreStatusCommandHandler(void) +{ + printf("MatterCoreStatusCommandHandler() not implemented\r\n"); +} + +__weak void MatterCoreStartCommandHandler(void) +{ + printf("MatterCoreStartCommandHandler() not implemented\r\n"); +} + +__weak void MatterCoreStopCommandHandler(void) +{ + printf("MatterCoreStopCommandHandler() not implemented\r\n"); +} + void fATmattershell(void *arg) { if (arg != NULL) { - xQueueSend(shell_queue, arg, pdMS_TO_TICKS(10)); + if(strcmp((const char *) arg, "status") == 0) + { + MatterCoreStatusCommandHandler(); + } + else if(strcmp((const char *) arg, "start") == 0) + { + MatterCoreStartCommandHandler(); + } + else if(strcmp((const char *) arg, "stop") == 0) + { + MatterCoreStopCommandHandler(); + } + else + { + xQueueSend(shell_queue, arg, pdMS_TO_TICKS(10)); + } } else { - printf("No arguments provided for matter shell\r\n"); + printf("%s\n%s\n%s\n%s\n%s\r\n", + "No arguments provided for matter shell", + "ATMS=status to check matter server status", + "ATMS=start to turn on matter server", + "ATMS=stop to turn off matter server", + "ATMS=help to check built in matter commands while matter server is on"); } } diff --git a/component/common/application/matter/core/matter_control.cpp b/component/common/application/matter/core/matter_control.cpp new file mode 100644 index 00000000..01d7637d --- /dev/null +++ b/component/common/application/matter/core/matter_control.cpp @@ -0,0 +1,226 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "platform_opts_matter.h" +#include "matter_control.h" +#include "matter_core.h" +#include "matter_interaction.h" +#include "matter_prov.h" + +#include "app/server/Server.h" +#include "platform/CHIPDeviceLayer.h" +#include + +#if defined(CONFIG_ENABLE_CHIP_SHELL) && (CONFIG_ENABLE_CHIP_SHELL == 1) +#include "lib/shell/Engine.h" +#include "lib/shell/commands/Help.h" +#endif // defined(CONFIG_ENABLE_CHIP_SHELL) && (CONFIG_ENABLE_CHIP_SHELL == 1) + +using namespace chip; +using namespace chip::app; + +#if defined(CONFIG_ENABLE_CHIP_SHELL) && (CONFIG_ENABLE_CHIP_SHELL == 1) +using Shell::Engine; +using Shell::shell_command_t; +using Shell::streamer_get; +using Shell::streamer_printf; + +Engine sShellMatterProvisioningSubCommands; +#endif // defined(CONFIG_ENABLE_CHIP_SHELL) && (CONFIG_ENABLE_CHIP_SHELL == 1) + +namespace { +#if defined(CONFIG_ENABLE_CHIP_SHELL) && (CONFIG_ENABLE_CHIP_SHELL == 1) + +/******************************************************** + * Matter Core shell functions, controlled by Ameba Shell + *********************************************************/ + +extern "C" void MatterCoreStatusCommandHandler() +{ + if (matter_core_server_is_running()) + { + ChipLogProgress(DeviceLayer, "Matter device is running!"); + } + else + { + ChipLogProgress(DeviceLayer, "Matter device is not running!"); + } +} + +extern "C" void MatterCoreStartCommandHandler() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + if(matter_core_server_is_running()) + { + ChipLogProgress(DeviceLayer, "Matter device is already started!"); + } + else + { + err = matter_core_start(); + if (err != CHIP_NO_ERROR) + ChipLogProgress(DeviceLayer, "matter_core_start failed!\n"); + +#if !(defined(CONFIG_EXAMPLE_MATTER_AIRCON) && CONFIG_EXAMPLE_MATTER_AIRCON) // aircon example does not include downlink + err = matter_interaction_start_downlink(); + if (err != CHIP_NO_ERROR) + ChipLogProgress(DeviceLayer, "matter_interaction_start_downlink failed!\n"); +#endif + + err = matter_interaction_start_uplink(); + if (err != CHIP_NO_ERROR) + ChipLogProgress(DeviceLayer, "matter_interaction_start_uplink failed!\n"); + } +} + +extern "C" void MatterCoreStopCommandHandler() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + if(matter_core_server_is_running()) + { + err = matter_core_stop(); + if (err != CHIP_NO_ERROR) + ChipLogProgress(DeviceLayer, "matter_core_stop failed!\n"); + + matter_interaction_clean_up(); + } + else + { + ChipLogProgress(DeviceLayer, "Matter device is already stopped!"); + } +} + +/******************************************************** + * Matter Provisioning shell functions + *********************************************************/ + +CHIP_ERROR MatterProvisioningCommandHelpHandler(int argc, char ** argv) +{ + sShellMatterProvisioningSubCommands.ForEachCommand(Shell::PrintCommandHelp, nullptr); + return CHIP_NO_ERROR; +} + +CHIP_ERROR MatterProvisioningCommandHandler(int argc, char ** argv) +{ + if (argc == 0) + { + return MatterProvisioningCommandHelpHandler(argc, argv); + } + + return sShellMatterProvisioningSubCommands.ExecCommand(argc, argv); +} + +CHIP_ERROR MatterProvisioningStatusCommandHandler(int argc, char ** argv) +{ + if (argc != 0) + { + return MatterProvisioningCommandHelpHandler(argc, argv); + } + + if (matter_prov_is_provisioned()) + { + ChipLogProgress(DeviceLayer, "Matter device is provisioned!"); + } + else + { + ChipLogProgress(DeviceLayer, "Matter device is not provisioned!"); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR MatterProvisioningEnterProvModeCommandHandler(int argc, char ** argv) +{ + if (argc != 0) + { + return MatterProvisioningCommandHelpHandler(argc, argv); + } + + return matter_prov_start(); +} + +CHIP_ERROR MatterProvisioningExitProvModeCommandHandler(int argc, char ** argv) +{ + if (argc != 0) + { + return MatterProvisioningCommandHelpHandler(argc, argv); + } + + return matter_prov_stop(); +} + +CHIP_ERROR MatterProvisioningPrintProvTableCommandHandler(int argc, char ** argv) +{ + if (argc != 0) + { + return MatterProvisioningCommandHelpHandler(argc, argv); + } + + return matter_prov_print_fabric_table(); +} + +CHIP_ERROR MatterProvisioningEraseRowCommandHandler(int argc, char ** argv) +{ + if (argc != 1) + { + return MatterProvisioningCommandHelpHandler(argc, argv); + } + + uint8_t row = atoi(argv[0]); + return matter_prov_delete_fabric_table_row(row); +} +/** + * @brief configures matter control shell + * + */ +static void RegisterMatterProvisioningCommands() +{ + static const shell_command_t sMatterProvisioningSubCommands[] = { + { &MatterProvisioningCommandHelpHandler, "help", "Usage: prov help" }, + { &MatterProvisioningStatusCommandHandler, "status", "status Usage: prov status" }, + { &MatterProvisioningEnterProvModeCommandHandler, "enterprovmode", "enterprovmode Usage: prov enterprovmode" }, + { &MatterProvisioningExitProvModeCommandHandler, "exitprovmode", "exitprovmode Usage: prov exitprovmode" }, + { &MatterProvisioningPrintProvTableCommandHandler, "printprovtable", "printprovtable Usage: prov printprovtable" }, + { &MatterProvisioningEraseRowCommandHandler, "eraserow", "eraserow Usage: prov eraserow " }, + }; + + static const shell_command_t sMatterProvisioningCommand = { &MatterProvisioningCommandHandler, "prov", + "Matter Provisioning commands. Usage: prov " }; + + // Register commands + sShellMatterProvisioningSubCommands.RegisterCommands(sMatterProvisioningSubCommands, + ArraySize(sMatterProvisioningSubCommands)); + + Engine::Root().RegisterCommands(&sMatterProvisioningCommand, 1); +} +#endif // defined(CONFIG_ENABLE_CHIP_SHELL) && (CONFIG_ENABLE_CHIP_SHELL == 1) + +} // namespace + +/******************************************************** + * Switch functions + *********************************************************/ + +CHIP_ERROR InitMatterProvisioningControl() +{ +#if CONFIG_ENABLE_CHIP_SHELL + RegisterMatterProvisioningCommands(); +#endif + return CHIP_NO_ERROR; +} diff --git a/component/common/application/matter/core/matter_control.h b/component/common/application/matter/core/matter_control.h new file mode 100644 index 00000000..f2624d57 --- /dev/null +++ b/component/common/application/matter/core/matter_control.h @@ -0,0 +1,26 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "app-common/zap-generated/ids/Attributes.h" +#include "app-common/zap-generated/ids/Clusters.h" +#include "app-common/zap-generated/ids/Commands.h" +#include "lib/core/CHIPError.h" + +CHIP_ERROR InitMatterProvisioningControl(); diff --git a/component/common/application/matter/core/matter_core.cpp b/component/common/application/matter/core/matter_core.cpp index 888412a5..cdeeb2bc 100644 --- a/component/common/application/matter/core/matter_core.cpp +++ b/component/common/application/matter/core/matter_core.cpp @@ -35,8 +35,9 @@ #include #include -#if CONFIG_ENABLE_CHIP_SHELL +#if defined(CONFIG_ENABLE_CHIP_SHELL) && (CONFIG_ENABLE_CHIP_SHELL == 1) #include +#include "matter_control.h" #endif using namespace ::chip; @@ -47,6 +48,8 @@ app::Clusters::NetworkCommissioning::Instance chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; chip::DeviceLayer::FactoryDataProvider mFactoryDataProvider; +static bool bMatterServerRunning = false; +static bool bMatterPlatformInitialized = false; void matter_core_device_callback_internal(const ChipDeviceEvent * event, intptr_t arg) { @@ -131,10 +134,6 @@ void matter_core_init_server(intptr_t context) PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); } -#if CONFIG_ENABLE_CHIP_SHELL - InitBindingHandler(); -#endif - xTaskNotifyGive(task_to_notify); } @@ -167,9 +166,15 @@ CHIP_ERROR matter_core_init() err = PlatformMgr().StartEventLoopTask(); SuccessOrExit(err); +#if defined(CONFIG_ENABLE_CHIP_SHELL) && (CONFIG_ENABLE_CHIP_SHELL == 1) + chip::LaunchShell(); + InitMatterProvisioningControl(); +#endif + // Register a function to receive events from the CHIP device layer. Note that calls to // this function will happen on the CHIP event loop thread, not the app_main thread. PlatformMgr().AddEventHandler(matter_core_device_callback_internal, reinterpret_cast(NULL)); + bMatterPlatformInitialized = true; // PlatformMgr().ScheduleWork(matter_core_init_server, 0); PlatformMgr().ScheduleWork(matter_core_init_server, reinterpret_cast(xTaskGetCurrentTaskHandle())); @@ -179,8 +184,87 @@ CHIP_ERROR matter_core_init() return err; } +#if defined(CONFIG_USE_AMEBA_DATA_MODEL) && (CONFIG_USE_AMEBA_DATA_MODEL == 1) +#include "matter_data_model.h" +#endif + CHIP_ERROR matter_core_start() { - return matter_core_init(); - // matter_core_init_server(); + CHIP_ERROR err = CHIP_NO_ERROR; + if (matter_core_server_is_running()) + { + ChipLogProgress(DeviceLayer, "Matter device is already started!"); + } + else + { + if (bMatterPlatformInitialized) + { + PlatformMgr().ScheduleWork(matter_core_init_server, reinterpret_cast(xTaskGetCurrentTaskHandle())); + xTaskNotifyWait(0, 0, NULL, portMAX_DELAY); +#if defined(CONFIG_USE_AMEBA_DATA_MODEL) && (CONFIG_USE_AMEBA_DATA_MODEL == 1) + Node::getInstance().enableAllEndpoints(); +#endif + // customer can also add code to retain back the current value of the driver to the matter layer + } + else + { + err = matter_core_init(); + } + bMatterServerRunning = true; + } + return err; +} + +#if defined(CONFIG_EXAMPLE_MATTER_DISHWASHER) && (CONFIG_EXAMPLE_MATTER_DISHWASHER == 1) +#include "dishwasher_mode.h" +#include +#elif defined(CONFIG_EXAMPLE_MATTER_LAUNDRYWASHER) && (CONFIG_EXAMPLE_MATTER_LAUNDRYWASHER == 1) +#include +#elif defined(CONFIG_EXAMPLE_MATTER_REFRIGERATOR) && (CONFIG_EXAMPLE_MATTER_REFRIGERATOR == 1) +#include "tcc_mode.h" +#endif + +void clusters_shutdown(void) // These may have been initialised via the emberAfXxxClusterInitCallback methods. We need to destroy them during stop. +{ +#if defined(CONFIG_EXAMPLE_MATTER_DISHWASHER) && (CONFIG_EXAMPLE_MATTER_DISHWASHER == 1) + chip::app::Clusters::OperationalState::Shutdown(); + chip::app::Clusters::DishwasherMode::Shutdown(); +#elif defined(CONFIG_EXAMPLE_MATTER_LAUNDRYWASHER) && (CONFIG_EXAMPLE_MATTER_LAUNDRYWASHER == 1) + chip::app::Clusters::OperationalState::Shutdown(); +#elif defined(CONFIG_EXAMPLE_MATTER_REFRIGERATOR) && (CONFIG_EXAMPLE_MATTER_REFRIGERATOR == 1) + chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Shutdown(); +#endif +} + +CHIP_ERROR matter_core_stop() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + if (matter_core_server_is_running()) + { + PlatformMgr().LockChipStack(); + chip::Server::GetInstance().Shutdown(); + PlatformMgr().UnlockChipStack(); +#if CONFIG_NETWORK_LAYER_BLE // Clear state of BLE which was not run in the server shutdown + if(ConnectivityMgr().GetBleLayer()->mBleTransport) + { + chip::Platform::Delete(ConnectivityMgr().GetBleLayer()->mBleTransport); + } +#endif + clusters_shutdown(); +#if defined(CONFIG_USE_AMEBA_DATA_MODEL) && (CONFIG_USE_AMEBA_DATA_MODEL == 1) + Node::getInstance().disableAllEndpoints(); +#endif + bMatterServerRunning = false; + } + else + { + ChipLogProgress(DeviceLayer, "Matter device is already stopped!"); + } + return err; +} + +bool matter_core_server_is_running() +{ + return bMatterServerRunning; } diff --git a/component/common/application/matter/core/matter_core.h b/component/common/application/matter/core/matter_core.h index aa49531f..5392d075 100644 --- a/component/common/application/matter/core/matter_core.h +++ b/component/common/application/matter/core/matter_core.h @@ -2,4 +2,22 @@ #include +/** + * @brief + * This function is to start matter core related functions (server, platform manager) + * Matter Platform (chip stack, event loop) will only be started at the first start + */ CHIP_ERROR matter_core_start(void); + +/** + * @brief + * This function is to stop matter server + * Matter Platform will not be stopped in the function + */ +CHIP_ERROR matter_core_stop(void); + +/** + * @brief + * This function returns true if matter server is still running, otherwise return false + */ +bool matter_core_server_is_running(void); diff --git a/component/common/application/matter/core/matter_data_model.cpp b/component/common/application/matter/core/matter_data_model.cpp index d17b2580..c154b278 100644 --- a/component/common/application/matter/core/matter_data_model.cpp +++ b/component/common/application/matter/core/matter_data_model.cpp @@ -19,16 +19,17 @@ Status emberAfExternalAttributeReadCallback(EndpointId endpoint_id, ClusterId cl { Node & node = Node::getInstance(); Endpoint *endpoint = node.getEndpoint(endpoint_id); - Cluster *cluster = endpoint->getCluster(cluster_id); - Attribute *attribute = cluster->getAttribute(matter_attribute->attributeId); + const EmberAfCluster *cluster = endpoint->getCluster(cluster_id); + const EmberAfAttributeMetadata *attribute = endpoint->getAttributeOfCluster(cluster, matter_attribute->attributeId); - if (attribute->getAttributeSize() > max_read_length) + if (attribute->size > max_read_length) { ChipLogError(DeviceLayer, "[%s] Insufficient space to read Attribute 0x%08x from Cluster 0x%08x in Endpoint 0x%04x", __FUNCTION__, matter_attribute->attributeId, cluster_id, endpoint_id); return Status::ResourceExhausted; } - attribute->getValue(buffer); + Attribute attributeHelper(cluster_id, endpoint_id, attribute); + attributeHelper.getValue(buffer); return Status::Success; } @@ -37,10 +38,11 @@ Status emberAfExternalAttributeWriteCallback(EndpointId endpoint_id, ClusterId c { Node & node = Node::getInstance(); Endpoint *endpoint = node.getEndpoint(endpoint_id); - Cluster *cluster = endpoint->getCluster(cluster_id); - Attribute *attribute = cluster->getAttribute(matter_attribute->attributeId); + const EmberAfCluster *cluster = endpoint->getCluster(cluster_id); + const EmberAfAttributeMetadata *attribute = endpoint->getAttributeOfCluster(cluster, matter_attribute->attributeId); - attribute->setValue(buffer); + Attribute attributeHelper(cluster_id, endpoint_id, attribute); + attributeHelper.setValue(buffer); return Status::Success; } @@ -308,311 +310,36 @@ CHIP_ERROR Attribute::retrieveValue(uint8_t *buffer, size_t size) return AmebaUtils::MapError(getPref_bin_new(key, key, buffer, size, &len), AmebaErrorType::kDctError); } -/* Events */ -chip::EventId Event::getEventId() const -{ - return eventId; -} - -chip::ClusterId Event::getParentClusterId() const -{ - return parentClusterId; -} - -/* Commands */ -chip::CommandId Command::getCommandId() const -{ - return commandId; -} - -chip::ClusterId Command::getParentClusterId() const -{ - return parentClusterId; -} - -uint8_t Command::getFlag() const -{ - return commandFlag; -} - -/* Cluster */ -chip::ClusterId Cluster::getClusterId() const -{ - return clusterId; -} - -EmberAfClusterMask Cluster::getClusterMask() const -{ - return clusterMask; -} - -chip::EndpointId Cluster::getParentEndpointId() const -{ - return parentEndpointId; -} - -Attribute *Cluster::getAttribute(chip::AttributeId attributeId) -{ - for (auto & att : attributes) - { - if (att.getAttributeId() == attributeId) - { - return &att; - } - } - - return NULL; -} - -Event *Cluster::getEvent(chip::EventId eventId) -{ - for (auto & evt : events) - { - if (evt.getEventId() == eventId) - { - return &evt; - } - } - - return NULL; -} - -Command *Cluster::getAcceptedCommand(chip::CommandId commandId) -{ - for (auto & cmd : acceptedCommands) - { - if (cmd.getCommandId() == commandId) - { - return &cmd; - } - } - - return NULL; -} - -Command *Cluster::getGeneratedCommand(chip::CommandId commandId) -{ - for (auto & cmd : generatedCommands) - { - if (cmd.getCommandId() == commandId) - { - return &cmd; - } - } - - return NULL; -} - -void Cluster::addAttribute(AttributeConfig attributeConfig) -{ - Attribute attribute(clusterId, parentEndpointId, attributeConfig); - addAttribute(attribute); -} - -void Cluster::addAttribute(const Attribute& attribute) -{ - // Check if attribute already exist - if (getAttribute(attribute.getAttributeId()) != NULL) - { - return; - } - - attributes.push_back(attribute); -} - -void Cluster::removeAttribute(chip::AttributeId attributeId) -{ - auto it = std::find_if(attributes.begin(), attributes.end(), [&](const Attribute & attribute) - { - return attribute.getAttributeId() == attributeId; - }); - - if (it != attributes.end()) - { - attributes.erase(it); - } -} - -void Cluster::addEvent(EventConfig eventConfig) -{ - Event event(clusterId, parentEndpointId, eventConfig); - addEvent(event); -} - -void Cluster::addEvent(const Event& event) -{ - // Check if event already exist - if (getEvent(event.getEventId()) != NULL) - { - return; - } - - events.push_back(event); -} - -void Cluster::removeEvent(chip::EventId eventId) -{ - auto it = std::find_if(events.begin(), events.end(), [&](const Event & event) - { - return event.getEventId() == eventId; - }); - - if (it != events.end()) - { - events.erase(it); - } -} - -void Cluster::addAcceptedCommand(CommandConfig commandConfig) -{ - Command command(clusterId, parentEndpointId, commandConfig); - addAcceptedCommand(command); -} - -void Cluster::addAcceptedCommand(const Command& command) -{ - // Check if command already exist - if (getAcceptedCommand(command.getCommandId()) != NULL) - { - return; - } - - if (command.getFlag() & COMMAND_MASK_ACCEPTED) - { - acceptedCommands.push_back(command); - } -} - -void Cluster::addGeneratedCommand(CommandConfig commandConfig) -{ - Command command(clusterId, parentEndpointId, commandConfig); - addGeneratedCommand(command); -} - -void Cluster::addGeneratedCommand(const Command& command) -{ - // Check if command already exist - if (getGeneratedCommand(command.getCommandId()) != NULL) - { - return; - } - - if (command.getFlag() & COMMAND_MASK_GENERATED) - { - generatedCommands.push_back(command); - } -} - -void Cluster::removeAcceptedCommand(chip::CommandId commandId) -{ - auto it = std::find_if(acceptedCommands.begin(), acceptedCommands.end(), [commandId](const Command& command) - { - return command.getCommandId() == commandId; - }); - - if (it != acceptedCommands.end()) - { - acceptedCommands.erase(it); - } -} - -void Cluster::removeGeneratedCommand(chip::CommandId commandId) -{ - auto it = std::find_if(generatedCommands.begin(), generatedCommands.end(), [commandId](const Command& command) - { - return command.getCommandId() == commandId; - }); - - if (it != generatedCommands.end()) - { - generatedCommands.erase(it); - } -} - -void Cluster::addFunction(const EmberAfGenericClusterFunction function) -{ - functions.push_back(function); -} - -void Cluster::removeFunction() -{ - // not implemented -} - /* Endpoint */ chip::EndpointId Endpoint::getEndpointId() const { return endpointId; } -Cluster *Endpoint::getCluster(chip::ClusterId clusterId) +const EmberAfCluster *Endpoint::getCluster(chip::ClusterId clusterId) { - for (auto & cls : clusters) + for (size_t i=0; iclusterCount; i++) { - if (cls.getClusterId() == clusterId) + if (endpointMetadata->cluster[i].clusterId == clusterId) { - return &cls; + return &endpointMetadata->cluster[i]; } } return NULL; } -void Endpoint::addCluster(ClusterConfig & clusterConfig) +const EmberAfAttributeMetadata *Endpoint::getAttributeOfCluster(const EmberAfCluster *cluster, chip::AttributeId attributeId) { - Cluster cluster(endpointId, clusterConfig); - for (const AttributeConfig & attributeConfig : clusterConfig.attributeConfigs) - { - Attribute attribute(cluster.getClusterId(), endpointId, attributeConfig); - cluster.addAttribute(attribute); - } - for (const EventConfig & eventConfig : clusterConfig.eventConfigs) - { - Event event(cluster.getClusterId(), endpointId, eventConfig); - cluster.addEvent(event); - } - for (const CommandConfig & commandConfig : clusterConfig.commandConfigs) + for (size_t i=0; iattributeCount; i++) { - Command command(cluster.getClusterId(), endpointId, commandConfig); - if (command.getFlag() & COMMAND_MASK_ACCEPTED) + if (cluster->attributes[i].attributeId == attributeId) { - cluster.addAcceptedCommand(command); + return &cluster->attributes[i]; } - if (command.getFlag() & COMMAND_MASK_GENERATED) - { - cluster.addGeneratedCommand(command); - } - } - for (const EmberAfGenericClusterFunction & functionConfig : clusterConfig.functionConfigs) - { - cluster.addFunction(functionConfig); - } - addCluster(cluster); -} - -void Endpoint::addCluster(const Cluster& cluster) -{ - // Check if cluster already exist - if (getCluster(cluster.getClusterId()) != NULL) - { - return; } - clusters.push_back(cluster); -} - -void Endpoint::removeCluster(chip::ClusterId clusterId) -{ - // Remove the cluster from the vector - auto it = std::find_if(clusters.begin(), clusters.end(), [&](const Cluster& cluster) - { - return cluster.getClusterId() == clusterId; - }); - - if (it != clusters.end()) - { - clusters.erase(it); - } + return NULL; } chip::EndpointId Endpoint::getParentEndpointId() const @@ -625,167 +352,39 @@ void Endpoint::setParentEndpointId(chip::EndpointId newParentEndpointId) parentEndpointId = newParentEndpointId; } +void Endpoint::addEndpointType(EmberAfEndpointType *endpointType) +{ + endpointMetadata = endpointType; +} + void Endpoint::enableEndpoint() { if (enabled) { - ChipLogDetail(DeviceLayer, "Endpoint %d already enabled", endpointId); + ChipLogDetail(DeviceLayer, "Endpoint 0x%x already enabled", endpointId); return; } - dataVersion = (chip::DataVersion*) calloc(clusters.size(), sizeof(chip::DataVersion)); - - EmberAfEndpointType *endpointType = nullptr; - EmberAfCluster *clusterType = nullptr; - EmberAfAttributeMetadata *attributeType = nullptr; - EmberAfGenericClusterFunction *functionType = nullptr; - chip::CommandId *acceptedCommandType = nullptr; - chip::CommandId *generatedCommandType = nullptr; - chip::EventId *eventType = nullptr; - - // Setup cluster type - if (clusters.size() > 0) - { - clusterType = (EmberAfCluster*) calloc(clusters.size(), sizeof(EmberAfCluster)); - clusterCollector.push_back(clusterType); - } - - for (size_t i=0; i 0) - { - attributeType = (EmberAfAttributeMetadata*) calloc(cluster.attributes.size(), sizeof(EmberAfAttributeMetadata)); - attributeCollector.push_back(attributeType); - } - - for (size_t j=0; j 0) - { - functionType = (EmberAfGenericClusterFunction*) calloc(cluster.functions.size(), sizeof(EmberAfGenericClusterFunction)); - functionCollector.push_back(functionType); - } - - for (size_t j=0; j 0) - { - acceptedCommandType = (chip::CommandId*) calloc(cluster.acceptedCommands.size(), sizeof(chip::CommandId)); - acceptedCommandCollector.push_back(acceptedCommandType); - } - - for (size_t j=0; j 0) - { - generatedCommandType = (chip::CommandId*) calloc(cluster.generatedCommands.size(), sizeof(chip::CommandId)); - generatedCommandCollector.push_back(generatedCommandType); - } - - for (size_t j=0; j 0) - { - eventType = (chip::EventId*) calloc(cluster.events.size(), sizeof(chip::EventId)); - eventCollector.push_back(eventType); - } - - for (size_t j=0; jclusterCount = clusters.size(); - endpointType->endpointSize = 0; // set to 0 as default - endpointType->cluster = clusterType; + dataVersion = (chip::DataVersion*) calloc(endpointMetadata->clusterCount, sizeof(chip::DataVersion)); // Register endpoint as dynamic endpoint in matter stack chip::DeviceLayer::PlatformMgr().LockChipStack(); - ChipError status = emberAfSetDynamicEndpoint(endpointIndex, endpointId, endpointType, chip::Span(dataVersion, clusters.size()), deviceTypeList, parentEndpointId); + CHIP_ERROR status = emberAfSetDynamicEndpoint(endpointIndex, endpointId, endpointMetadata, chip::Span(dataVersion, endpointMetadata->clusterCount), deviceTypeList, parentEndpointId); chip::DeviceLayer::PlatformMgr().UnlockChipStack(); if (status == CHIP_NO_ERROR) { - ChipLogProgress(DeviceLayer, "Set dynamic endpoint %d success", endpointId); - endpointMetadata = endpointType; + ChipLogProgress(DeviceLayer, "Set dynamic endpoint 0x%x success", endpointId); enabled = true; return; } else { - ChipLogError(DeviceLayer, "Failed to set dynamic endpoint %d with status %d", endpointId, status); + ChipLogError(DeviceLayer, "Failed to set dynamic endpoint 0x%x with status %d", endpointId, status); } // free allocated memory if error - for (EmberAfCluster *cls : clusterCollector) - { - free(cls); - } - - for (EmberAfAttributeMetadata *att : attributeCollector) - { - free(att); - } - - for (EmberAfGenericClusterFunction *fun : functionCollector) - { - free(fun); - } - - for (chip::CommandId *acmd : acceptedCommandCollector) - { - free(acmd); - } - - for (chip::CommandId *gcmd : generatedCommandCollector) - { - free(gcmd); - } - - for (chip::EventId *evt : eventCollector) - { - free(evt); - } - free(dataVersion); - free(endpointType); } void Endpoint::disableEndpoint() @@ -808,56 +407,25 @@ void Endpoint::disableEndpoint() enabled = false; // free allocated memory - for (EmberAfCluster *cls : clusterCollector) - { - free(cls); - } - - for (EmberAfAttributeMetadata *att : attributeCollector) - { - free(att); - } - - for (EmberAfGenericClusterFunction *fun : functionCollector) - { - free(fun); - } - - for (chip::CommandId *acmd : acceptedCommandCollector) - { - free(acmd); - } - - for (chip::CommandId *gcmd : generatedCommandCollector) - { - free(gcmd); - } - - for (chip::EventId *evt : eventCollector) - { - free(evt); - } - free(dataVersion); - free(endpointMetadata); char key[64]; // Clear persistent data on this endpoint - for (size_t i=0; iclusterCount; i++) { - Cluster cluster = clusters[i]; - for (size_t j=0; jcluster[i]; + for (size_t j=0; jattributeCount; j++) { - Attribute attribute = cluster.attributes[j]; - if (cluster.attributes[j].getAttributeMask() & ATTRIBUTE_MASK_TOKENIZE) + const EmberAfAttributeMetadata *attribute = &cluster->attributes[j]; + if (attribute->mask & ATTRIBUTE_MASK_TOKENIZE) { - sprintf(key, "g/a/%x/%x/%x", attribute.getParentEndpointId(), attribute.getParentClusterId(), attribute.getAttributeId()); + sprintf(key, "g/a/%x/%x/%x", endpointId, cluster->clusterId, attribute->attributeId); deleteKey(key, key); } } } - ChipLogProgress(DeviceLayer, "Successfully disabled dynamic endpoint %d", endpointId); + ChipLogProgress(DeviceLayer, "Successfully disabled dynamic endpoint 0x%x", endpointId); } /* Node */ @@ -886,7 +454,7 @@ chip::EndpointId Node::getNextEndpointId() const return nextEndpointId; } -chip::EndpointId Node::addEndpoint(const EndpointConfig& endpointConfig, Span deviceTypeList) +chip::EndpointId Node::addEndpoint(EmberAfEndpointType *endpointType, Span deviceTypeList) { Endpoint endpoint(this, nextEndpointId, endpointCount, deviceTypeList); // Set parentEndpointId based on the previous endpoint's endpointId @@ -894,38 +462,8 @@ chip::EndpointId Node::addEndpoint(const EndpointConfig& endpointConfig, Span #include #include +#include using namespace ::chip; class Node; class Endpoint; -class Cluster; class Attribute; -class Command; -class Event; // Use variant to represent the different data types supported typedef std::variant AttributeValue; -// Configurations -struct AttributeConfig -{ - std::uint32_t attributeId; - std::uint8_t dataType; /* use ZAP_TYPE(type) */ - EmberAfDefaultOrMinMaxAttributeValue value; /* use ZAP_EMPTY(), ZAP_SIMPLE(), etc */ - std::uint16_t size; - std::uint8_t mask = 0; /* attribute flag */ - AttributeConfig(uint32_t attributeId, uint8_t dataType, EmberAfDefaultOrMinMaxAttributeValue value, uint16_t size, uint8_t mask) : attributeId(attributeId), dataType(dataType), value(value), size(size), mask(mask) {} -}; - -struct EventConfig -{ - std::uint32_t eventId; - EventConfig(uint32_t eventId) : eventId(eventId) {} -}; - -struct CommandConfig -{ - std::uint32_t commandId; - std::uint8_t mask = 0; /* command flag */ - CommandConfig(uint32_t commandId, uint8_t mask) : commandId(commandId), mask(mask) {} -}; - -struct ClusterConfig -{ -public: - std::uint32_t clusterId; - std::vector attributeConfigs; - std::vector eventConfigs; - std::vector commandConfigs; - std::vector functionConfigs; - std::uint8_t mask = 0; /* cluster flag */ -}; - -class EndpointConfig -{ -public: - std::vector clusterConfigs; -}; - // Attribute class class Attribute { public: - Attribute(chip::ClusterId clusterId, chip::EndpointId endpointId, AttributeConfig attributeConfig) : - attributeId(attributeConfig.attributeId), - attributeSize(attributeConfig.size), - attributeType(attributeConfig.dataType), - attributeMask(attributeConfig.mask), + Attribute(chip::ClusterId clusterId, chip::EndpointId endpointId, const EmberAfAttributeMetadata *attributeConfig) : + attributeId(attributeConfig->attributeId), + attributeSize(attributeConfig->size), + attributeType(attributeConfig->attributeType), + attributeMask(attributeConfig->mask), parentClusterId(clusterId), parentEndpointId(endpointId), - defaultValue(attributeConfig.value) + defaultValue(attributeConfig->defaultValue) { // Retrieve value from NVS if available, else // assign value to be of base type with default value from config @@ -86,7 +43,7 @@ class Attribute } else { - value = uint8_t(attributeConfig.value.defaultValue); + value = uint8_t(attributeConfig->defaultValue.defaultValue); } break; case ZCL_INT16U_ATTRIBUTE_TYPE: @@ -97,7 +54,7 @@ class Attribute } else { - value = uint16_t(attributeConfig.value.defaultValue); + value = uint16_t(attributeConfig->defaultValue.defaultValue); } break; case ZCL_INT32U_ATTRIBUTE_TYPE: @@ -108,7 +65,7 @@ class Attribute } else { - value = uint32_t(attributeConfig.value.defaultValue); + value = uint32_t(attributeConfig->defaultValue.defaultValue); } break; case ZCL_INT64U_ATTRIBUTE_TYPE: @@ -119,7 +76,7 @@ class Attribute } else { - value = uint64_t(attributeConfig.value.defaultValue); + value = uint64_t(attributeConfig->defaultValue.defaultValue); } break; case ZCL_INT8S_ATTRIBUTE_TYPE: @@ -130,7 +87,7 @@ class Attribute } else { - value = int8_t(attributeConfig.value.defaultValue); + value = int8_t(attributeConfig->defaultValue.defaultValue); } break; case ZCL_INT16S_ATTRIBUTE_TYPE: @@ -141,7 +98,7 @@ class Attribute } else { - value = int16_t(attributeConfig.value.defaultValue); + value = int16_t(attributeConfig->defaultValue.defaultValue); } break; case ZCL_INT32S_ATTRIBUTE_TYPE: @@ -152,7 +109,7 @@ class Attribute } else { - value = int32_t(attributeConfig.value.defaultValue); + value = int32_t(attributeConfig->defaultValue.defaultValue); } break; case ZCL_INT64S_ATTRIBUTE_TYPE: @@ -163,7 +120,7 @@ class Attribute } else { - value = int64_t(attributeConfig.value.defaultValue); + value = int64_t(attributeConfig->defaultValue.defaultValue); } break; case ZCL_SINGLE_ATTRIBUTE_TYPE: @@ -174,7 +131,7 @@ class Attribute } else { - value = float(attributeConfig.value.defaultValue); + value = float(attributeConfig->defaultValue.defaultValue); } break; case ZCL_OCTET_STRING_ATTRIBUTE_TYPE: @@ -183,9 +140,9 @@ class Attribute if (retrieveValue(valueBuffer, attributeSize) != CHIP_NO_ERROR) { memset(valueBuffer, 0, ATTRIBUTE_LARGEST); - if (attributeConfig.value.ptrToDefaultValue != nullptr) + if (attributeConfig->defaultValue.ptrToDefaultValue != nullptr) { - memcpy(valueBuffer, attributeConfig.value.ptrToDefaultValue, attributeSize); + memcpy(valueBuffer, attributeConfig->defaultValue.ptrToDefaultValue, attributeSize); } } break; @@ -249,23 +206,6 @@ class Attribute uint8_t valueBuffer[ATTRIBUTE_LARGEST]; }; -// Event class -class Event -{ -public: - Event(chip::ClusterId clusterId, chip::EndpointId endpointId, EventConfig eventConfig) : - eventId(eventConfig.eventId), - parentClusterId(clusterId), - parentEndpointId(endpointId) {} - chip::EventId getEventId() const; - chip::ClusterId getParentClusterId() const; - -private: - chip::EventId eventId; - chip::ClusterId parentClusterId; - chip::EndpointId parentEndpointId; -}; - /** Command flags */ /** The command is not a standard command */ #define COMMAND_MASK_CUSTOM (0x01) @@ -274,74 +214,6 @@ class Event /** The command is server generated */ #define COMMAND_MASK_GENERATED (0x04) -// Command class -class Command -{ -public: - Command(chip::ClusterId clusterId, chip::EndpointId endpointId, CommandConfig commandConfig) : - commandId(commandConfig.commandId), - commandFlag(commandConfig.mask), - parentClusterId(clusterId), - parentEndpointId(endpointId) {} - chip::CommandId getCommandId() const; - chip::ClusterId getParentClusterId() const; - uint8_t getFlag() const; - -private: - chip::CommandId commandId; - uint8_t commandFlag; - chip::ClusterId parentClusterId; - chip::EndpointId parentEndpointId; -}; - -// Cluster class -class Cluster -{ -public: - friend class Endpoint; - - Cluster(chip::EndpointId endpointId, ClusterConfig clusterConfig) : - clusterId(clusterConfig.clusterId), - clusterMask(clusterConfig.mask), - parentEndpointId(endpointId) {} - chip::ClusterId getClusterId() const; - EmberAfClusterMask getClusterMask() const; - chip::EndpointId getParentEndpointId() const; - Attribute *getAttribute(chip::AttributeId attributeId); - uint32_t getAttributeCount() const; - Event *getEvent(chip::EventId eventId); - uint32_t getEventCount() const; - Command *getAcceptedCommand(chip::CommandId commandId); - uint32_t getAcceptedCommandCount() const; - Command *getGeneratedCommand(chip::CommandId commandId); - uint32_t getGeneratedCommandCount() const; - uint32_t getFunctionCount() const; - void addAttribute(AttributeConfig attributeConfig); - void addAttribute(const Attribute& attribute); - void removeAttribute(chip::AttributeId attributeId); - void addEvent(EventConfig eventConfig); - void addEvent(const Event& event); - void removeEvent(chip::EventId eventId); - void addAcceptedCommand(CommandConfig commandConfig); - void addAcceptedCommand(const Command& command); - void addGeneratedCommand(CommandConfig commandConfig); - void addGeneratedCommand(const Command& command); - void removeAcceptedCommand(chip::CommandId commandId); - void removeGeneratedCommand(chip::CommandId commandId); - void addFunction(const EmberAfGenericClusterFunction function); - void removeFunction(); - -private: - chip::ClusterId clusterId; - EmberAfClusterMask clusterMask; - chip::EndpointId parentEndpointId; - std::vector attributes; - std::vector events; - std::vector acceptedCommands; - std::vector generatedCommands; - std::vector functions; -}; - // Endpoint class class Endpoint { @@ -355,12 +227,11 @@ class Endpoint parentNode(node), deviceTypeList(deviceTypeList) {} chip::EndpointId getEndpointId() const; - Cluster *getCluster(chip::ClusterId clusterId); - void addCluster(ClusterConfig & clusterConfig); - void addCluster(const Cluster& cluster); - void removeCluster(chip::ClusterId clusterId); + const EmberAfCluster *getCluster(chip::ClusterId clusterId); + const EmberAfAttributeMetadata *getAttributeOfCluster(const EmberAfCluster *cluster, chip::AttributeId attributeId); chip::EndpointId getParentEndpointId() const; // This returns the endpointId of the previous endpoint, not to be confused with Cluster::getParentEndpointId void setParentEndpointId(chip::EndpointId parentEndpointId); + void addEndpointType(EmberAfEndpointType *endpointType); void enableEndpoint(); void disableEndpoint(); @@ -372,17 +243,7 @@ class Endpoint chip::DataVersion *dataVersion = nullptr; Span deviceTypeList; EmberAfEndpointType *endpointMetadata; - std::vector clusters; bool enabled = false; - - // Metadata collectors - // Store dynamic allocated objects here when endpoint is enabled, then delete it when disabled - std::vector clusterCollector; - std::vector attributeCollector; - std::vector functionCollector; - std::vector acceptedCommandCollector; - std::vector generatedCommandCollector; - std::vector eventCollector; }; // Node class @@ -392,9 +253,10 @@ class Node static Node& getInstance(); Endpoint *getEndpoint(chip::EndpointId endpointId); chip::EndpointId getNextEndpointId() const; - chip::EndpointId addEndpoint(const EndpointConfig& endpointConfig, Span deviceTypeList); + chip::EndpointId addEndpoint(EmberAfEndpointType *endpointType, Span deviceTypeList); void removeEndpoint(chip::EndpointId endpointId); void enableAllEndpoints(); + void disableAllEndpoints(); private: Node() {} /* singleton instance */ diff --git a/component/common/application/matter/core/matter_data_model_presets.cpp b/component/common/application/matter/core/matter_data_model_presets.cpp index 667ba8a0..d689573f 100644 --- a/component/common/application/matter/core/matter_data_model_presets.cpp +++ b/component/common/application/matter/core/matter_data_model_presets.cpp @@ -16,715 +16,655 @@ EmberAfAttributeMinMaxValue onoffStartUpOnOffMinMaxValue = {(uint16_t)0xFF, (uin EmberAfAttributeMinMaxValue levelcontrolOptionsMinMaxValue = {(uint16_t)0x0, (uint16_t)0x0, (uint16_t)0x3}; uint8_t generalcommissioningBreadCrumbValue[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -void matter_cluster_descriptor_server(ClusterConfig *clusterConfig) -{ - AttributeConfig descriptorDeviceTypeList(0x00000000, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig descriptorServerList(0x00000001, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig descriptorClientList(0x00000002, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig descriptorPartsList(0x00000003, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig descriptorFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(0), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig descriptorClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_EMPTY_DEFAULT(), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - clusterConfig->clusterId = 0x0000001D; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER); - clusterConfig->attributeConfigs.push_back(descriptorDeviceTypeList); - clusterConfig->attributeConfigs.push_back(descriptorServerList); - clusterConfig->attributeConfigs.push_back(descriptorClientList); - clusterConfig->attributeConfigs.push_back(descriptorPartsList); - clusterConfig->attributeConfigs.push_back(descriptorFeatureMap); - clusterConfig->attributeConfigs.push_back(descriptorClusterRevision); -} - -void matter_cluster_acl_server(ClusterConfig *clusterConfig) -{ - AttributeConfig aclACL(0x00000000, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)); - AttributeConfig aclExtension(0x00000001, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)); - AttributeConfig aclSubjectsPerAccessControlEntry(0x00000002, ZAP_TYPE(INT16U), ZAP_EMPTY_DEFAULT(), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig aclTargetsPerAccessControlEntry(0x00000003, ZAP_TYPE(INT16U), ZAP_EMPTY_DEFAULT(), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig aclAccessControlEntriesPerFabric(0x00000004, ZAP_TYPE(INT16U), ZAP_EMPTY_DEFAULT(), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig aclFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(0), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig aclClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(1), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - EventConfig aclAccessControlEntryChanged(0x00000000); - EventConfig aclAccessControlExtensionChanged(0x00000001); - - clusterConfig->clusterId = 0x0000001F; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER); - clusterConfig->attributeConfigs.push_back(aclACL); - clusterConfig->attributeConfigs.push_back(aclExtension); - clusterConfig->attributeConfigs.push_back(aclSubjectsPerAccessControlEntry); - clusterConfig->attributeConfigs.push_back(aclTargetsPerAccessControlEntry); - clusterConfig->attributeConfigs.push_back(aclAccessControlEntriesPerFabric); - clusterConfig->attributeConfigs.push_back(aclFeatureMap); - clusterConfig->attributeConfigs.push_back(aclClusterRevision); - clusterConfig->eventConfigs.push_back(aclAccessControlEntryChanged); - clusterConfig->eventConfigs.push_back(aclAccessControlExtensionChanged); -} - -void matter_cluster_basic_information_server(ClusterConfig *clusterConfig) -{ - AttributeConfig basicinfoDataModelRevision(0x00000000, ZAP_TYPE(INT16U), ZAP_EMPTY_DEFAULT(), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - AttributeConfig basicinfoVendorName(0x00000001, ZAP_TYPE(CHAR_STRING), ZAP_EMPTY_DEFAULT(), 33, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - AttributeConfig basicinfoVendorId(0x00000002, ZAP_TYPE(VENDOR_ID), ZAP_EMPTY_DEFAULT(), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - AttributeConfig basicinfoProductName(0x00000003, ZAP_TYPE(CHAR_STRING), ZAP_EMPTY_DEFAULT(), 33, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - AttributeConfig basicinfoProductId(0x00000004, ZAP_TYPE(VENDOR_ID), ZAP_EMPTY_DEFAULT(), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - AttributeConfig basicinfoNodeLabel(0x00000005, ZAP_TYPE(CHAR_STRING), ZAP_EMPTY_DEFAULT(), 33, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE)); - AttributeConfig basicinfoLocation(0x00000006, ZAP_TYPE(CHAR_STRING), ZAP_EMPTY_DEFAULT(), 3, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE)); - AttributeConfig basicinfoHardwareVersion(0x00000007, ZAP_TYPE(INT16U), ZAP_EMPTY_DEFAULT(), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - AttributeConfig basicinfoHardwareVersionString(0x00000008, ZAP_TYPE(CHAR_STRING), ZAP_EMPTY_DEFAULT(), 65, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - AttributeConfig basicinfoSoftwareVersion(0x00000009, ZAP_TYPE(INT32U), ZAP_EMPTY_DEFAULT(), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - AttributeConfig basicinfoSoftwareVersionString(0x0000000A, ZAP_TYPE(CHAR_STRING), ZAP_EMPTY_DEFAULT(), 65, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - AttributeConfig basicinfoManufacturingDate(0x0000000B, ZAP_TYPE(CHAR_STRING), ZAP_EMPTY_DEFAULT(), 17, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - AttributeConfig basicinfoPartNumber(0x0000000C, ZAP_TYPE(CHAR_STRING), ZAP_EMPTY_DEFAULT(), 33, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - AttributeConfig basicinfoProductUrl(0x0000000D, ZAP_TYPE(LONG_CHAR_STRING), ZAP_EMPTY_DEFAULT(), 258, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - AttributeConfig basicinfoProductLabel(0x0000000E, ZAP_TYPE(CHAR_STRING), ZAP_EMPTY_DEFAULT(), 65, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - AttributeConfig basicinfoSerialNumber(0x0000000F, ZAP_TYPE(CHAR_STRING), ZAP_EMPTY_DEFAULT(), 33, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - AttributeConfig basicinfoLocalConfigDisabled(0x00000010, ZAP_TYPE(BOOLEAN), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE)); - AttributeConfig basicinfoUniqueId(0x00000012, ZAP_TYPE(CHAR_STRING), ZAP_EMPTY_DEFAULT(), 33, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - AttributeConfig basicinfoCapabilityMinima(0x00000013, ZAP_TYPE(STRUCT), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig basicinfoFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(0), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig basicinfoClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(1), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)); - - EventConfig basicinfoStartUp(0x00000000); - EventConfig basicinfoShutDown(0x00000001); - EventConfig basicinfoLeave(0x00000002); - - clusterConfig->clusterId = 0x00000028; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER); - clusterConfig->attributeConfigs.push_back(basicinfoDataModelRevision); - clusterConfig->attributeConfigs.push_back(basicinfoVendorName); - clusterConfig->attributeConfigs.push_back(basicinfoVendorId); - clusterConfig->attributeConfigs.push_back(basicinfoProductName); - clusterConfig->attributeConfigs.push_back(basicinfoProductId); - clusterConfig->attributeConfigs.push_back(basicinfoNodeLabel); - clusterConfig->attributeConfigs.push_back(basicinfoLocation); - clusterConfig->attributeConfigs.push_back(basicinfoHardwareVersion); - clusterConfig->attributeConfigs.push_back(basicinfoHardwareVersionString); - clusterConfig->attributeConfigs.push_back(basicinfoSoftwareVersion); - clusterConfig->attributeConfigs.push_back(basicinfoSoftwareVersionString); - clusterConfig->attributeConfigs.push_back(basicinfoManufacturingDate); - clusterConfig->attributeConfigs.push_back(basicinfoPartNumber); - clusterConfig->attributeConfigs.push_back(basicinfoProductUrl); - clusterConfig->attributeConfigs.push_back(basicinfoProductLabel); - clusterConfig->attributeConfigs.push_back(basicinfoSerialNumber); - clusterConfig->attributeConfigs.push_back(basicinfoLocalConfigDisabled); - clusterConfig->attributeConfigs.push_back(basicinfoUniqueId); - clusterConfig->attributeConfigs.push_back(basicinfoCapabilityMinima); - clusterConfig->attributeConfigs.push_back(basicinfoFeatureMap); - clusterConfig->attributeConfigs.push_back(basicinfoClusterRevision); - clusterConfig->eventConfigs.push_back(basicinfoStartUp); - clusterConfig->eventConfigs.push_back(basicinfoShutDown); - clusterConfig->eventConfigs.push_back(basicinfoLeave); -} - -void matter_cluster_ota_requestor_server(ClusterConfig *clusterConfig) -{ - AttributeConfig otarDefaultOtaProviders(0x00000000, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)); - AttributeConfig otarUpdatePossible(0x00000001, ZAP_TYPE(BOOLEAN), ZAP_SIMPLE_DEFAULT(1), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig otarUpdateState(0x00000002, ZAP_TYPE(ENUM8), ZAP_SIMPLE_DEFAULT(0), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig otarUpdateStateProgress(0x00000003, ZAP_TYPE(INT8U), ZAP_SIMPLE_DEFAULT(0), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig otarFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(0), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig otarClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(1), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - CommandConfig otarAnnounceOtaProvider(0x00000000, COMMAND_MASK_ACCEPTED); - CommandConfig otarEndOfAcceptedCommandList(chip::kInvalidCommandId, COMMAND_MASK_ACCEPTED); - - EventConfig otarStateTransition(0x00000000); - EventConfig otarVersionApplied(0x00000001); - EventConfig otarDownloadError(0x00000002); - - clusterConfig->clusterId = 0x0000002A; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER); - clusterConfig->attributeConfigs.push_back(otarDefaultOtaProviders); - clusterConfig->attributeConfigs.push_back(otarUpdatePossible); - clusterConfig->attributeConfigs.push_back(otarUpdateState); - clusterConfig->attributeConfigs.push_back(otarUpdateStateProgress); - clusterConfig->attributeConfigs.push_back(otarFeatureMap); - clusterConfig->attributeConfigs.push_back(otarClusterRevision); - clusterConfig->commandConfigs.push_back(otarAnnounceOtaProvider); - clusterConfig->commandConfigs.push_back(otarEndOfAcceptedCommandList); - clusterConfig->eventConfigs.push_back(otarStateTransition); - clusterConfig->eventConfigs.push_back(otarVersionApplied); - clusterConfig->eventConfigs.push_back(otarDownloadError); -} - -void matter_cluster_general_commissioning_server(ClusterConfig *clusterConfig) -{ - AttributeConfig gencomBreadcrumb(0x00000000, ZAP_TYPE(INT64U), uint32_t(0), 8, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)); - AttributeConfig gencomBasicCommissioningInfo(0x00000001, ZAP_TYPE(STRUCT), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gencomRegulatoryConfig(0x00000002, ZAP_TYPE(ENUM8), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gencomLocationCapability(0x00000003, ZAP_TYPE(ENUM8), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gencomSupportsConcurrentConnection(0x00000004, ZAP_TYPE(BOOLEAN), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gencomFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(0), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gencomClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(1), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - CommandConfig gencomArmFailSafe(0x00000000, COMMAND_MASK_ACCEPTED); - CommandConfig gencomSetRegulatoryConfig(0x00000002, COMMAND_MASK_ACCEPTED); - CommandConfig gencomCommissioningComplete(0x00000004, COMMAND_MASK_ACCEPTED); - CommandConfig gencomEndOfAcceptedCommandList(chip::kInvalidCommandId, COMMAND_MASK_ACCEPTED); - - CommandConfig gencomArmFailSafeResponse(0x00000001, COMMAND_MASK_GENERATED); - CommandConfig gencomSetRegulatoryConfigResponse(0x00000003, COMMAND_MASK_GENERATED); - CommandConfig gencomCommissioningCompleteResponse(0x00000005, COMMAND_MASK_GENERATED); - CommandConfig gencomEndOfGeneratedCommandList(chip::kInvalidCommandId, COMMAND_MASK_GENERATED); - - clusterConfig->clusterId = 0x00000030; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER); - clusterConfig->attributeConfigs.push_back(gencomBreadcrumb); - clusterConfig->attributeConfigs.push_back(gencomBasicCommissioningInfo); - clusterConfig->attributeConfigs.push_back(gencomRegulatoryConfig); - clusterConfig->attributeConfigs.push_back(gencomLocationCapability); - clusterConfig->attributeConfigs.push_back(gencomSupportsConcurrentConnection); - clusterConfig->attributeConfigs.push_back(gencomFeatureMap); - clusterConfig->attributeConfigs.push_back(gencomClusterRevision); - clusterConfig->commandConfigs.push_back(gencomArmFailSafe); - clusterConfig->commandConfigs.push_back(gencomSetRegulatoryConfig); - clusterConfig->commandConfigs.push_back(gencomCommissioningComplete); - clusterConfig->commandConfigs.push_back(gencomEndOfAcceptedCommandList); - clusterConfig->commandConfigs.push_back(gencomArmFailSafeResponse); - clusterConfig->commandConfigs.push_back(gencomSetRegulatoryConfigResponse); - clusterConfig->commandConfigs.push_back(gencomCommissioningCompleteResponse); - clusterConfig->commandConfigs.push_back(gencomEndOfGeneratedCommandList); -} - -void matter_cluster_network_commissioning_server(ClusterConfig *clusterConfig) -{ - AttributeConfig netcomMaxNetworks(0x00000000, ZAP_TYPE(INT8U), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig netcomNetworks(0x00000001, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig netcomScanMaxTimeSeconds(0x00000002, ZAP_TYPE(INT8U), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig netcomConnectMaxTimeSeconds(0x00000003, ZAP_TYPE(INT8U), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig netcomInterfaceEnabled(0x00000004, ZAP_TYPE(BOOLEAN), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)); - AttributeConfig netcomLastNetworkingStatus(0x00000005, ZAP_TYPE(ENUM8), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig netcomLastNetworkId(0x00000006, ZAP_TYPE(OCTET_STRING), ZAP_EMPTY_DEFAULT(), 33, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig netcomLastConnectErrorValue(0x00000007, ZAP_TYPE(INT32S), ZAP_EMPTY_DEFAULT(), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig netcomFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(1), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig netcomClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(1), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - CommandConfig netcomScanNetworks(0x00000000, COMMAND_MASK_ACCEPTED); - CommandConfig netcomAddOrUpdateWiFiNetwork(0x00000002, COMMAND_MASK_ACCEPTED); - CommandConfig netcomRemoveNetwork(0x00000004, COMMAND_MASK_ACCEPTED); - CommandConfig netcomConnectNetwork(0x00000006, COMMAND_MASK_ACCEPTED); - CommandConfig netcomReorderNetwork(0x00000008, COMMAND_MASK_ACCEPTED); - CommandConfig netcomEndOfAcceptedCommandList(chip::kInvalidCommandId, COMMAND_MASK_ACCEPTED); - - CommandConfig netcomScanNetworksResponse(0x00000001, COMMAND_MASK_GENERATED); - CommandConfig netcomNetworkConfigResponse(0x00000005, COMMAND_MASK_GENERATED); - CommandConfig netcomConnectNetworkResponse(0x00000007, COMMAND_MASK_GENERATED); - CommandConfig netcomEndOfGeneratedCommandList(chip::kInvalidCommandId, COMMAND_MASK_GENERATED); - - clusterConfig->clusterId = 0x00000031; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER); - clusterConfig->attributeConfigs.push_back(netcomMaxNetworks); - clusterConfig->attributeConfigs.push_back(netcomNetworks); - clusterConfig->attributeConfigs.push_back(netcomScanMaxTimeSeconds); - clusterConfig->attributeConfigs.push_back(netcomConnectMaxTimeSeconds); - clusterConfig->attributeConfigs.push_back(netcomInterfaceEnabled); - clusterConfig->attributeConfigs.push_back(netcomLastNetworkingStatus); - clusterConfig->attributeConfigs.push_back(netcomLastNetworkId); - clusterConfig->attributeConfigs.push_back(netcomLastConnectErrorValue); - clusterConfig->attributeConfigs.push_back(netcomFeatureMap); - clusterConfig->attributeConfigs.push_back(netcomClusterRevision); - clusterConfig->commandConfigs.push_back(netcomScanNetworks); - clusterConfig->commandConfigs.push_back(netcomAddOrUpdateWiFiNetwork); - clusterConfig->commandConfigs.push_back(netcomRemoveNetwork); - clusterConfig->commandConfigs.push_back(netcomConnectNetwork); - clusterConfig->commandConfigs.push_back(netcomReorderNetwork); - clusterConfig->commandConfigs.push_back(netcomEndOfAcceptedCommandList); - clusterConfig->commandConfigs.push_back(netcomScanNetworksResponse); - clusterConfig->commandConfigs.push_back(netcomNetworkConfigResponse); - clusterConfig->commandConfigs.push_back(netcomConnectNetworkResponse); - clusterConfig->commandConfigs.push_back(netcomEndOfGeneratedCommandList); -} - -void matter_cluster_general_diagnostics_server(ClusterConfig *clusterConfig) -{ - AttributeConfig gendiagNetworkInterfaces(0x00000000, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gendiagRebootCount(0x00000001, ZAP_TYPE(INT16U), ZAP_EMPTY_DEFAULT(), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gendiagUpTime(0x00000002, ZAP_TYPE(INT64U), ZAP_EMPTY_DEFAULT(), 8, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gendiagTotalOperationalHours(0x00000003, ZAP_TYPE(INT32U), ZAP_EMPTY_DEFAULT(), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gendiagBootReason(0x00000004, ZAP_TYPE(ENUM8), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gendiagActiveHardwareFaults(0x00000005, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gendiagActiveRadioFaults(0x00000006, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gendiagActiveNetworkFaults(0x00000007, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gendiagTestEventTriggersEnabled(0x00000008, ZAP_TYPE(BOOLEAN), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gendiagFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(0), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gendiagClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(1), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - EventConfig gendiagHardwareFaultChange(0x00000000); - EventConfig gendiagRadioFaultChange(0x00000001); - EventConfig gendiagNetworkFaultChange(0x00000002); - EventConfig gendiagBootReasonEvent(0x00000003); - - clusterConfig->clusterId = 0x00000033; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER); - clusterConfig->attributeConfigs.push_back(gendiagNetworkInterfaces); - clusterConfig->attributeConfigs.push_back(gendiagRebootCount); - clusterConfig->attributeConfigs.push_back(gendiagUpTime); - clusterConfig->attributeConfigs.push_back(gendiagTotalOperationalHours); - clusterConfig->attributeConfigs.push_back(gendiagBootReason); - clusterConfig->attributeConfigs.push_back(gendiagActiveHardwareFaults); - clusterConfig->attributeConfigs.push_back(gendiagActiveRadioFaults); - clusterConfig->attributeConfigs.push_back(gendiagActiveNetworkFaults); - clusterConfig->attributeConfigs.push_back(gendiagTestEventTriggersEnabled); - clusterConfig->attributeConfigs.push_back(gendiagFeatureMap); - clusterConfig->attributeConfigs.push_back(gendiagClusterRevision); - clusterConfig->eventConfigs.push_back(gendiagHardwareFaultChange); - clusterConfig->eventConfigs.push_back(gendiagRadioFaultChange); - clusterConfig->eventConfigs.push_back(gendiagNetworkFaultChange); - clusterConfig->eventConfigs.push_back(gendiagBootReasonEvent); -} - -void matter_cluster_software_diagnostics_server(ClusterConfig *clusterConfig) -{ - AttributeConfig swdiagThreadMetrics(0x00000000, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig swdiagCurrentHeapFree(0x00000001, ZAP_TYPE(INT64U), ZAP_EMPTY_DEFAULT(), 8, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig swdiagCurrentHeapUsed(0x00000002, ZAP_TYPE(INT64U), ZAP_EMPTY_DEFAULT(), 8, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig swdiagCurrentHeapHighWatermark(0x00000003, ZAP_TYPE(INT64U), ZAP_EMPTY_DEFAULT(), 8, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig swdiagFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(1), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig swdiagClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(1), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - clusterConfig->clusterId = 0x00000034; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER); - clusterConfig->attributeConfigs.push_back(swdiagThreadMetrics); - clusterConfig->attributeConfigs.push_back(swdiagCurrentHeapFree); - clusterConfig->attributeConfigs.push_back(swdiagCurrentHeapUsed); - clusterConfig->attributeConfigs.push_back(swdiagCurrentHeapHighWatermark); - clusterConfig->attributeConfigs.push_back(swdiagFeatureMap); - clusterConfig->attributeConfigs.push_back(swdiagClusterRevision); -} - -void matter_cluster_wifi_diagnostics_server(ClusterConfig *clusterConfig) -{ - AttributeConfig wifidiagBssid(0x00000000, ZAP_TYPE(OCTET_STRING), ZAP_EMPTY_DEFAULT(), 7, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig wifidiagSecurityType(0x00000001, ZAP_TYPE(ENUM8), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig wifidiagWiFiVersion(0x00000002, ZAP_TYPE(ENUM8), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig wifidiagChannelNumber(0x00000003, ZAP_TYPE(INT16U), ZAP_EMPTY_DEFAULT(), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig wifidiagRssi(0x00000004, ZAP_TYPE(INT8S), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig wifidiagFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(3), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig wifidiagClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(1), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - EventConfig wifidiagDisconnection(0x00000000); - EventConfig wifidiagAssociationFailure(0x00000001); - EventConfig wifidiagConnectionStatus(0x00000002); - - clusterConfig->clusterId = 0x00000036; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER); - clusterConfig->attributeConfigs.push_back(wifidiagBssid); - clusterConfig->attributeConfigs.push_back(wifidiagSecurityType); - clusterConfig->attributeConfigs.push_back(wifidiagWiFiVersion); - clusterConfig->attributeConfigs.push_back(wifidiagChannelNumber); - clusterConfig->attributeConfigs.push_back(wifidiagRssi); - clusterConfig->attributeConfigs.push_back(wifidiagFeatureMap); - clusterConfig->attributeConfigs.push_back(wifidiagClusterRevision); - clusterConfig->eventConfigs.push_back(wifidiagDisconnection); - clusterConfig->eventConfigs.push_back(wifidiagAssociationFailure); - clusterConfig->eventConfigs.push_back(wifidiagConnectionStatus); -} - -void matter_cluster_administrator_commissioning_server(ClusterConfig *clusterConfig) -{ - AttributeConfig admincomWindowStatus(0x00000000, ZAP_TYPE(ENUM8), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig admincomAdminFabricIndex(0x00000001, ZAP_TYPE(FABRIC_IDX), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig admincomAdminVendorId(0x00000002, ZAP_TYPE(INT16U), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig admincomAdminFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(0), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig admincomAdminClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(1), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - clusterConfig->clusterId = 0x0000003C; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER); - clusterConfig->attributeConfigs.push_back(admincomWindowStatus); - clusterConfig->attributeConfigs.push_back(admincomAdminFabricIndex); - clusterConfig->attributeConfigs.push_back(admincomAdminVendorId); - clusterConfig->attributeConfigs.push_back(admincomAdminFeatureMap); - clusterConfig->attributeConfigs.push_back(admincomAdminClusterRevision); -} - -void matter_cluster_operational_credentials_server(ClusterConfig *clusterConfig) -{ - AttributeConfig opcredsNocs(0x00000000, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig opcredsFabrics(0x00000001, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig opcredsSupportedFabrics(0x00000002, ZAP_TYPE(INT8U), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig opcredsCommissionedFabrics(0x00000003, ZAP_TYPE(INT8U), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig opcredsTrustedRootCertificates(0x00000004, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig opcredsCurrentFabricIndex(0x00000005, ZAP_TYPE(INT8U), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig opcredsFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(0), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig opcredsClusterRevision(0x0000FFFD, ZAP_TYPE(INT8U), ZAP_SIMPLE_DEFAULT(1), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - CommandConfig opcredsAttestationRequest(0x00000000, COMMAND_MASK_ACCEPTED); - CommandConfig opcredsCertificateChainRequest(0x00000002, COMMAND_MASK_ACCEPTED); - CommandConfig opcredsCSRRequest(0x00000004, COMMAND_MASK_ACCEPTED); - CommandConfig opcredsAddNOC(0x00000006, COMMAND_MASK_ACCEPTED); - CommandConfig opcredsUpdateNOC(0x00000007, COMMAND_MASK_ACCEPTED); - CommandConfig opcredsRemoveFabric(0x0000000A, COMMAND_MASK_ACCEPTED); - CommandConfig opcredsAddTrustedRootCertificate(0x0000000B, COMMAND_MASK_ACCEPTED); - CommandConfig opcredsEndOfAcceptedCommandList(chip::kInvalidCommandId, COMMAND_MASK_ACCEPTED); - - CommandConfig opcredsAttestationResponse(0x00000001, COMMAND_MASK_GENERATED); - CommandConfig opcredsCertificateChainResponse(0x00000003, COMMAND_MASK_GENERATED); - CommandConfig opcredsCSRResponse(0x00000005, COMMAND_MASK_GENERATED); - CommandConfig opcredsNOCResponse(0x00000008, COMMAND_MASK_GENERATED); - CommandConfig opcredsEndOfGeneratedCommandList(chip::kInvalidCommandId, COMMAND_MASK_GENERATED); - - clusterConfig->clusterId = 0x0000003E; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER); - clusterConfig->attributeConfigs.push_back(opcredsNocs); - clusterConfig->attributeConfigs.push_back(opcredsFabrics); - clusterConfig->attributeConfigs.push_back(opcredsSupportedFabrics); - clusterConfig->attributeConfigs.push_back(opcredsCommissionedFabrics); - clusterConfig->attributeConfigs.push_back(opcredsTrustedRootCertificates); - clusterConfig->attributeConfigs.push_back(opcredsCurrentFabricIndex); - clusterConfig->attributeConfigs.push_back(opcredsFeatureMap); - clusterConfig->attributeConfigs.push_back(opcredsClusterRevision); - clusterConfig->commandConfigs.push_back(opcredsAttestationRequest); - clusterConfig->commandConfigs.push_back(opcredsCertificateChainRequest); - clusterConfig->commandConfigs.push_back(opcredsCSRRequest); - clusterConfig->commandConfigs.push_back(opcredsAddNOC); - clusterConfig->commandConfigs.push_back(opcredsUpdateNOC); - clusterConfig->commandConfigs.push_back(opcredsRemoveFabric); - clusterConfig->commandConfigs.push_back(opcredsAddTrustedRootCertificate); - clusterConfig->commandConfigs.push_back(opcredsEndOfAcceptedCommandList); - clusterConfig->commandConfigs.push_back(opcredsAttestationResponse); - clusterConfig->commandConfigs.push_back(opcredsCertificateChainResponse); - clusterConfig->commandConfigs.push_back(opcredsCSRResponse); - clusterConfig->commandConfigs.push_back(opcredsNOCResponse); - clusterConfig->commandConfigs.push_back(opcredsEndOfGeneratedCommandList); -} - -void matter_cluster_group_key_management_server(ClusterConfig *clusterConfig) -{ - AttributeConfig gkmGroupKeyMap(0x00000000, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)); - AttributeConfig gkmGroupTable(0x00000001, ZAP_TYPE(ARRAY), ZAP_EMPTY_DEFAULT(), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gkmMaxGroupsPerFabric(0x00000002, ZAP_TYPE(INT16U), ZAP_EMPTY_DEFAULT(), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gkmMaxGroupKeysPerFabric(0x00000003, ZAP_TYPE(INT16U), ZAP_EMPTY_DEFAULT(), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gkmFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(0), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig gkmClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(1), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - clusterConfig->clusterId = 0x0000003F; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER); - clusterConfig->attributeConfigs.push_back(gkmGroupKeyMap); - clusterConfig->attributeConfigs.push_back(gkmGroupTable); - clusterConfig->attributeConfigs.push_back(gkmMaxGroupsPerFabric); - clusterConfig->attributeConfigs.push_back(gkmMaxGroupKeysPerFabric); - clusterConfig->attributeConfigs.push_back(gkmFeatureMap); - clusterConfig->attributeConfigs.push_back(gkmClusterRevision); -} - -void matter_cluster_identify_server(ClusterConfig *clusterConfig) -{ - AttributeConfig identifyIdentifyTime(0x00000000, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(0x0000), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)); - AttributeConfig identifyIdentifyType(0x00000001, ZAP_TYPE(ENUM8), ZAP_SIMPLE_DEFAULT(0x0), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig identifyFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(0), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig identifyClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(4), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - CommandConfig identifyIdentify(0x00000000, COMMAND_MASK_ACCEPTED); - CommandConfig identifyTriggerEffect(0x00000040, COMMAND_MASK_ACCEPTED); - CommandConfig identifyEndOfAcceptedCommandList(chip::kInvalidCommandId, COMMAND_MASK_ACCEPTED); - - clusterConfig->clusterId = 0x00000003; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION); - clusterConfig->attributeConfigs.push_back(identifyIdentifyTime); - clusterConfig->attributeConfigs.push_back(identifyIdentifyType); - clusterConfig->attributeConfigs.push_back(identifyFeatureMap); - clusterConfig->attributeConfigs.push_back(identifyClusterRevision); - clusterConfig->commandConfigs.push_back(identifyIdentify); - clusterConfig->commandConfigs.push_back(identifyTriggerEffect); - clusterConfig->commandConfigs.push_back(identifyEndOfAcceptedCommandList); - clusterConfig->functionConfigs.push_back((EmberAfGenericClusterFunction) emberAfIdentifyClusterServerInitCallback); - clusterConfig->functionConfigs.push_back((EmberAfGenericClusterFunction) MatterIdentifyClusterServerAttributeChangedCallback); -} - -void matter_cluster_groups_server(ClusterConfig *clusterConfig) -{ - AttributeConfig groupsNameSupport(0x00000000, ZAP_TYPE(BITMAP8), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig groupsFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(0), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig groupsClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(4), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - CommandConfig groupsAddGroup(0x00000000, COMMAND_MASK_ACCEPTED); - CommandConfig groupsViewGroup(0x00000001, COMMAND_MASK_ACCEPTED); - CommandConfig groupsGetGroupMembership(0x00000002, COMMAND_MASK_ACCEPTED); - CommandConfig groupsRemoveGroup(0x00000003, COMMAND_MASK_ACCEPTED); - CommandConfig groupsRemoveAllGroups(0x00000004, COMMAND_MASK_ACCEPTED); - CommandConfig groupsAddGroupIfIdentifying(0x00000005, COMMAND_MASK_ACCEPTED); - CommandConfig groupsEndOfAcceptedCommandList(chip::kInvalidCommandId, COMMAND_MASK_ACCEPTED); - - CommandConfig groupsAddGroupResponse(0x00000000, COMMAND_MASK_GENERATED); - CommandConfig groupsViewGroupResponse(0x00000001, COMMAND_MASK_GENERATED); - CommandConfig groupsGetGroupMembershipResponse(0x00000002, COMMAND_MASK_GENERATED); - CommandConfig groupsRemoveGroupResponse(0x00000003, COMMAND_MASK_GENERATED); - CommandConfig groupsEndOfGeneratedCommandList(chip::kInvalidCommandId, COMMAND_MASK_GENERATED); - - clusterConfig->clusterId = 0x00000004; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION); - clusterConfig->attributeConfigs.push_back(groupsNameSupport); - clusterConfig->attributeConfigs.push_back(groupsFeatureMap); - clusterConfig->attributeConfigs.push_back(groupsClusterRevision); - clusterConfig->commandConfigs.push_back(groupsAddGroup); - clusterConfig->commandConfigs.push_back(groupsViewGroup); - clusterConfig->commandConfigs.push_back(groupsGetGroupMembership); - clusterConfig->commandConfigs.push_back(groupsRemoveGroup); - clusterConfig->commandConfigs.push_back(groupsRemoveAllGroups); - clusterConfig->commandConfigs.push_back(groupsAddGroupIfIdentifying); - clusterConfig->commandConfigs.push_back(groupsEndOfAcceptedCommandList); - clusterConfig->commandConfigs.push_back(groupsAddGroupResponse); - clusterConfig->commandConfigs.push_back(groupsViewGroupResponse); - clusterConfig->commandConfigs.push_back(groupsGetGroupMembershipResponse); - clusterConfig->commandConfigs.push_back(groupsRemoveGroupResponse); - clusterConfig->commandConfigs.push_back(groupsEndOfGeneratedCommandList); - clusterConfig->functionConfigs.push_back((EmberAfGenericClusterFunction) emberAfGroupsClusterServerInitCallback); -} - -void matter_cluster_scenes_server(ClusterConfig *clusterConfig) -{ - AttributeConfig scenesSceneCount(0x00000000, ZAP_TYPE(INT8U), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig scenesCurrentScene(0x00000001, ZAP_TYPE(INT8U), ZAP_SIMPLE_DEFAULT(0x00), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig scenesCurrentGroup(0x00000002, ZAP_TYPE(GROUP_ID), ZAP_SIMPLE_DEFAULT(0x0000), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig scenesSceneValid(0x00000003, ZAP_TYPE(BOOLEAN), ZAP_SIMPLE_DEFAULT(0x00), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig scenesNameSupport(0x00000004, ZAP_TYPE(BITMAP8), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig scenesLastConfiguredBy(0x00000005, ZAP_TYPE(NODE_ID), uint32_t(0), 8, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig scenesSceneTableSize(0x00000006, ZAP_TYPE(INT16U), ZAP_EMPTY_DEFAULT(), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig scenesRemainingCapacity(0x00000007, ZAP_TYPE(INT8U), ZAP_EMPTY_DEFAULT(), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig scenesFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(0), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig scenesClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(5), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - CommandConfig scenesAddScene(0x00000000, COMMAND_MASK_ACCEPTED); - CommandConfig scenesViewScene(0x00000001, COMMAND_MASK_ACCEPTED); - CommandConfig scenesRemoveScene(0x00000002, COMMAND_MASK_ACCEPTED); - CommandConfig scenesRemoveAllScenes(0x00000003, COMMAND_MASK_ACCEPTED); - CommandConfig scenesStoreScene(0x00000004, COMMAND_MASK_ACCEPTED); - CommandConfig scenesRecallScene(0x00000005, COMMAND_MASK_ACCEPTED); - CommandConfig scenesGetSceneMembership(0x00000006, COMMAND_MASK_ACCEPTED); - CommandConfig scenesEndOfAcceptedCommandList(chip::kInvalidCommandId, COMMAND_MASK_ACCEPTED); - - CommandConfig scenesAddSceneResponse(0x00000000, COMMAND_MASK_GENERATED); - CommandConfig scenesViewSceneResponse(0x00000001, COMMAND_MASK_GENERATED); - CommandConfig scenesRemoveSceneResponse(0x00000002, COMMAND_MASK_GENERATED); - CommandConfig scenesRemoveAllScenesResponse(0x00000003, COMMAND_MASK_GENERATED); - CommandConfig scenesStoreSceneResponse(0x00000004, COMMAND_MASK_GENERATED); - CommandConfig scenesGetSceneMembershipResponse(0x00000006, COMMAND_MASK_GENERATED); - CommandConfig scenesEndOfGeneratedCommandList(chip::kInvalidCommandId, COMMAND_MASK_GENERATED); - - clusterConfig->clusterId = 0x00000005; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER); - clusterConfig->attributeConfigs.push_back(scenesSceneCount); - clusterConfig->attributeConfigs.push_back(scenesCurrentScene); - clusterConfig->attributeConfigs.push_back(scenesCurrentGroup); - clusterConfig->attributeConfigs.push_back(scenesSceneValid); - clusterConfig->attributeConfigs.push_back(scenesNameSupport); - clusterConfig->attributeConfigs.push_back(scenesLastConfiguredBy); - clusterConfig->attributeConfigs.push_back(scenesSceneTableSize); - clusterConfig->attributeConfigs.push_back(scenesRemainingCapacity); - clusterConfig->attributeConfigs.push_back(scenesFeatureMap); - clusterConfig->attributeConfigs.push_back(scenesClusterRevision); - clusterConfig->commandConfigs.push_back(scenesAddScene); - clusterConfig->commandConfigs.push_back(scenesViewScene); - clusterConfig->commandConfigs.push_back(scenesRemoveScene); - clusterConfig->commandConfigs.push_back(scenesRemoveAllScenes); - clusterConfig->commandConfigs.push_back(scenesStoreScene); - clusterConfig->commandConfigs.push_back(scenesRecallScene); - clusterConfig->commandConfigs.push_back(scenesGetSceneMembership); - clusterConfig->commandConfigs.push_back(scenesEndOfAcceptedCommandList); - clusterConfig->commandConfigs.push_back(scenesAddSceneResponse); - clusterConfig->commandConfigs.push_back(scenesViewSceneResponse); - clusterConfig->commandConfigs.push_back(scenesRemoveSceneResponse); - clusterConfig->commandConfigs.push_back(scenesRemoveAllScenesResponse); - clusterConfig->commandConfigs.push_back(scenesStoreSceneResponse); - clusterConfig->commandConfigs.push_back(scenesGetSceneMembershipResponse); - clusterConfig->commandConfigs.push_back(scenesEndOfGeneratedCommandList); -} - -void matter_cluster_onoff_server(ClusterConfig *clusterConfig) -{ - AttributeConfig onoffOnOff(0x00000000, ZAP_TYPE(BOOLEAN), ZAP_SIMPLE_DEFAULT(0x00), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(TOKENIZE)); - AttributeConfig onoffGlobalSceneControl(0x00004000, ZAP_TYPE(BOOLEAN), ZAP_SIMPLE_DEFAULT(0x01), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig onoffOnTime(0x00004001, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(0x0000), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)); - AttributeConfig onoffOffWaitTime(0x00004002, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(0x0000), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)); - AttributeConfig onoffStartUpOnOff(0x00004003, ZAP_TYPE(ENUM8), &onoffStartUpOnOffMinMaxValue, 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig onoffFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(1), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig onoffClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(4), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - CommandConfig onoffOff(0x00000000, COMMAND_MASK_ACCEPTED); - CommandConfig onoffOn(0x00000001, COMMAND_MASK_ACCEPTED); - CommandConfig onoffToggle(0x00000002, COMMAND_MASK_ACCEPTED); - CommandConfig onoffOffWithEffect(0x00000040, COMMAND_MASK_ACCEPTED); - CommandConfig onoffOnWithRecallGlobalScene(0x00000041, COMMAND_MASK_ACCEPTED); - CommandConfig onoffOnWithTimedOff(0x00000042, COMMAND_MASK_ACCEPTED); - CommandConfig onoffEndOfAcceptedCommandList(chip::kInvalidCommandId, COMMAND_MASK_ACCEPTED); - - CommandConfig onoffMoveToLevel(0x00000000, COMMAND_MASK_GENERATED); - CommandConfig onoffMove(0x00000001, COMMAND_MASK_GENERATED); - CommandConfig onoffStep(0x00000002, COMMAND_MASK_GENERATED); - CommandConfig onoffStop(0x00000003, COMMAND_MASK_GENERATED); - CommandConfig onoffMoveToLevelWithOnOff(0x00000004, COMMAND_MASK_GENERATED); - CommandConfig onoffMoveWithOnOff(0x00000005, COMMAND_MASK_GENERATED); - CommandConfig onoffStepWithOnOff(0x00000006, COMMAND_MASK_GENERATED); - CommandConfig onoffStopWithOnOff(0x00000007, COMMAND_MASK_GENERATED); - CommandConfig onoffEndOfGeneratedCommandList(chip::kInvalidCommandId, COMMAND_MASK_GENERATED); - - clusterConfig->clusterId = 0x00000006; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION); - clusterConfig->attributeConfigs.push_back(onoffOnOff); - clusterConfig->attributeConfigs.push_back(onoffGlobalSceneControl); - clusterConfig->attributeConfigs.push_back(onoffOnTime); - clusterConfig->attributeConfigs.push_back(onoffOffWaitTime); - clusterConfig->attributeConfigs.push_back(onoffStartUpOnOff); - clusterConfig->attributeConfigs.push_back(onoffFeatureMap); - clusterConfig->attributeConfigs.push_back(onoffClusterRevision); - clusterConfig->commandConfigs.push_back(onoffOff); - clusterConfig->commandConfigs.push_back(onoffOn); - clusterConfig->commandConfigs.push_back(onoffToggle); - clusterConfig->commandConfigs.push_back(onoffOffWithEffect); - clusterConfig->commandConfigs.push_back(onoffOnWithRecallGlobalScene); - clusterConfig->commandConfigs.push_back(onoffOnWithTimedOff); - clusterConfig->commandConfigs.push_back(onoffEndOfAcceptedCommandList); - clusterConfig->commandConfigs.push_back(onoffMoveToLevel); - clusterConfig->commandConfigs.push_back(onoffMove); - clusterConfig->commandConfigs.push_back(onoffStep); - clusterConfig->commandConfigs.push_back(onoffStop); - clusterConfig->commandConfigs.push_back(onoffMoveToLevelWithOnOff); - clusterConfig->commandConfigs.push_back(onoffStepWithOnOff); - clusterConfig->commandConfigs.push_back(onoffStopWithOnOff); - clusterConfig->commandConfigs.push_back(onoffEndOfGeneratedCommandList); - clusterConfig->functionConfigs.push_back((EmberAfGenericClusterFunction) emberAfOnOffClusterServerInitCallback); - clusterConfig->functionConfigs.push_back((EmberAfGenericClusterFunction) MatterOnOffClusterServerShutdownCallback); -} - -void matter_cluster_level_control_server(ClusterConfig *clusterConfig) -{ - AttributeConfig levelcontrolCurrentLevel(0x00000000, ZAP_TYPE(INT8U), ZAP_SIMPLE_DEFAULT(0x01), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig levelcontrolRemainingTime(0x00000001, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(0x0000), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig levelcontrolMinLevel(0x00000002, ZAP_TYPE(INT8U), ZAP_SIMPLE_DEFAULT(0x01), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig levelcontrolMaxLevel(0x00000003, ZAP_TYPE(INT8U), ZAP_SIMPLE_DEFAULT(0xFE), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig levelcontrolCurrentFrequency(0x00000004, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(0x0000), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig levelcontrolMinFrequency(0x00000005, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(0x0000), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig levelcontrolMaxFrequency(0x00000006, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(0x0000), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig levelcontrolOptions(0x0000000F, ZAP_TYPE(BITMAP8), &levelcontrolOptionsMinMaxValue, 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE)); - AttributeConfig levelcontrolOnOffTransitionTime(0x00000010, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(0x0000), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)); - AttributeConfig levelcontrolOnLevel(0x00000011, ZAP_TYPE(INT8U), ZAP_SIMPLE_DEFAULT(0xFF), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig levelcontrolOnTransitionTime(0x00000012, ZAP_TYPE(INT16U), ZAP_EMPTY_DEFAULT(), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig levelcontrolOffTransitionTime(0x00000013, ZAP_TYPE(INT16U), ZAP_EMPTY_DEFAULT(), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig levelcontrolDefaultMoveRate(0x00000014, ZAP_TYPE(INT8U), ZAP_SIMPLE_DEFAULT(50), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig levelcontrolStartUpCurrentLevel(0x00004000, ZAP_TYPE(INT8U), ZAP_SIMPLE_DEFAULT(255), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE)); - AttributeConfig levelcontrolFeatureMap(0x0000FFFC, ZAP_TYPE(BITMAP32), ZAP_SIMPLE_DEFAULT(3), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - AttributeConfig levelcontrolClusterRevision(0x0000FFFD, ZAP_TYPE(INT16U), ZAP_SIMPLE_DEFAULT(5), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)); - - CommandConfig levelcontrolMoveToLevel(0x00000000, COMMAND_MASK_ACCEPTED); - CommandConfig levelcontrolMove(0x00000001, COMMAND_MASK_ACCEPTED); - CommandConfig levelcontrolStep(0x00000002, COMMAND_MASK_ACCEPTED); - CommandConfig levelcontrolStop(0x00000003, COMMAND_MASK_ACCEPTED); - CommandConfig levelcontrolMoveToLevelWithOnOff(0x00000004, COMMAND_MASK_ACCEPTED); - CommandConfig levelcontrolMoveWithOnOff(0x00000005, COMMAND_MASK_ACCEPTED); - CommandConfig levelcontrolStepWithOnOff(0x00000006, COMMAND_MASK_ACCEPTED); - CommandConfig levelcontrolStopWithOnOff(0x00000007, COMMAND_MASK_ACCEPTED); - CommandConfig levelcontrolEndOfAcceptedCommandList(chip::kInvalidCommandId, COMMAND_MASK_ACCEPTED); - - clusterConfig->clusterId = 0x00000008; - clusterConfig->mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION); - clusterConfig->attributeConfigs.push_back(levelcontrolCurrentLevel); - clusterConfig->attributeConfigs.push_back(levelcontrolRemainingTime); - clusterConfig->attributeConfigs.push_back(levelcontrolMinLevel); - clusterConfig->attributeConfigs.push_back(levelcontrolMaxLevel); - clusterConfig->attributeConfigs.push_back(levelcontrolCurrentFrequency); - clusterConfig->attributeConfigs.push_back(levelcontrolMinFrequency); - clusterConfig->attributeConfigs.push_back(levelcontrolMaxFrequency); - clusterConfig->attributeConfigs.push_back(levelcontrolOptions); - clusterConfig->attributeConfigs.push_back(levelcontrolOnOffTransitionTime); - clusterConfig->attributeConfigs.push_back(levelcontrolOnLevel); - clusterConfig->attributeConfigs.push_back(levelcontrolOnTransitionTime); - clusterConfig->attributeConfigs.push_back(levelcontrolOffTransitionTime); - clusterConfig->attributeConfigs.push_back(levelcontrolDefaultMoveRate); - clusterConfig->attributeConfigs.push_back(levelcontrolStartUpCurrentLevel); - clusterConfig->attributeConfigs.push_back(levelcontrolFeatureMap); - clusterConfig->attributeConfigs.push_back(levelcontrolClusterRevision); - clusterConfig->commandConfigs.push_back(levelcontrolMoveToLevel); - clusterConfig->commandConfigs.push_back(levelcontrolMove); - clusterConfig->commandConfigs.push_back(levelcontrolStep); - clusterConfig->commandConfigs.push_back(levelcontrolStop); - clusterConfig->commandConfigs.push_back(levelcontrolMoveToLevelWithOnOff); - clusterConfig->commandConfigs.push_back(levelcontrolMoveWithOnOff); - clusterConfig->commandConfigs.push_back(levelcontrolStepWithOnOff); - clusterConfig->commandConfigs.push_back(levelcontrolStopWithOnOff); - clusterConfig->commandConfigs.push_back(levelcontrolEndOfAcceptedCommandList); - clusterConfig->functionConfigs.push_back((EmberAfGenericClusterFunction) emberAfLevelControlClusterServerInitCallback); - clusterConfig->functionConfigs.push_back((EmberAfGenericClusterFunction) MatterLevelControlClusterServerShutdownCallback); -} +EmberAfAttributeMetadata matter_cluster_descriptor_attributes[] = { + {ZAP_EMPTY_DEFAULT() , 0x0000, 0, ZAP_TYPE(ARRAY) , ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT() , 0x0001, 0, ZAP_TYPE(ARRAY) , ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT() , 0x0002, 0, ZAP_TYPE(ARRAY) , ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT() , 0x0003, 0, ZAP_TYPE(ARRAY) , ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT() , 0xFFFD, 2, ZAP_TYPE(INT16U) , ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)} +}; + +EmberAfCluster matter_cluster_descriptor_server = { + .clusterId = 0x0000001D, + .attributes = matter_cluster_descriptor_attributes, + .attributeCount = ArraySize(matter_cluster_descriptor_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER), + .functions = NULL, + .acceptedCommandList = nullptr, + .generatedCommandList = nullptr, + .eventList = nullptr, + .eventCount = 0 +}; + +EmberAfAttributeMetadata matter_cluster_acl_attributes[] = { + {ZAP_EMPTY_DEFAULT() , 0x0000, 0, ZAP_TYPE(ARRAY) , ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)}, + {ZAP_EMPTY_DEFAULT() , 0x0001, 0, ZAP_TYPE(ARRAY) , ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)}, + {ZAP_EMPTY_DEFAULT() , 0x0002, 2, ZAP_TYPE(INT16U) , ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT() , 0x0003, 2, ZAP_TYPE(INT16U) , ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT() , 0x0004, 2, ZAP_TYPE(INT16U) , ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(1), 0xFFFD, 2, ZAP_TYPE(INT16U) , ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)} +}; + +constexpr chip::EventId matter_cluster_acl_events[] = { + 0x0000, + 0x0001, + kInvalidEventId, +}; + +EmberAfCluster matter_cluster_acl_server = { + .clusterId = 0x0000001F, + .attributes = matter_cluster_acl_attributes, + .attributeCount = ArraySize(matter_cluster_acl_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER), + .functions = NULL, + .acceptedCommandList = nullptr, + .generatedCommandList = nullptr, + .eventList = matter_cluster_acl_events, + .eventCount = ArraySize(matter_cluster_acl_events) +}; + +EmberAfAttributeMetadata matter_cluster_basic_information_attributes[] = { + {ZAP_EMPTY_DEFAULT(), 0x0000, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, + {ZAP_EMPTY_DEFAULT(), 0x0001, 33, ZAP_TYPE(CHAR_STRING), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, + {ZAP_EMPTY_DEFAULT(), 0x0002, 2, ZAP_TYPE(VENDOR_ID), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, + {ZAP_EMPTY_DEFAULT(), 0x0003, 33, ZAP_TYPE(CHAR_STRING), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, + {ZAP_EMPTY_DEFAULT(), 0x0004, 2, ZAP_TYPE(VENDOR_ID), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, + {ZAP_EMPTY_DEFAULT(), 0x0005, 33, ZAP_TYPE(CHAR_STRING), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0006, 3, ZAP_TYPE(CHAR_STRING), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0007, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, + {ZAP_EMPTY_DEFAULT(), 0x0008, 65, ZAP_TYPE(CHAR_STRING), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, + {ZAP_EMPTY_DEFAULT(), 0x0009, 4, ZAP_TYPE(INT32U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, + {ZAP_EMPTY_DEFAULT(), 0x000A, 65, ZAP_TYPE(CHAR_STRING), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, + {ZAP_EMPTY_DEFAULT(), 0x000B, 17, ZAP_TYPE(CHAR_STRING), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, + {ZAP_EMPTY_DEFAULT(), 0x000C, 33, ZAP_TYPE(CHAR_STRING), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, + {ZAP_EMPTY_DEFAULT(), 0x000D, 258, ZAP_TYPE(LONG_CHAR_STRING), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, + {ZAP_EMPTY_DEFAULT(), 0x000E, 65, ZAP_TYPE(CHAR_STRING), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, + {ZAP_EMPTY_DEFAULT(), 0x000F, 33, ZAP_TYPE(CHAR_STRING), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, + {ZAP_EMPTY_DEFAULT(), 0x0010, 1, ZAP_TYPE(BOOLEAN), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0012, 33, ZAP_TYPE(CHAR_STRING), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, + {ZAP_EMPTY_DEFAULT(), 0x0013, 0, ZAP_TYPE(STRUCT), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(1), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON)}, +}; // ZAP_SIMPLE_DEFAULT(1), 0xFFFD, 2, ZAP_TYPE(INT16U) , ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +constexpr chip::EventId matter_cluster_basic_information_events[] = { + 0x0000, + 0x0001, + 0x0002, + kInvalidEventId, +}; + +EmberAfCluster matter_cluster_basic_information_server = { + .clusterId = 0x00000028, + .attributes = matter_cluster_basic_information_attributes, + .attributeCount = ArraySize(matter_cluster_basic_information_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER), + .functions = NULL, + .acceptedCommandList = nullptr, + .generatedCommandList = nullptr, + .eventList = matter_cluster_basic_information_events, + .eventCount = ArraySize(matter_cluster_basic_information_events) +}; + +EmberAfAttributeMetadata matter_cluster_ota_requestor_attributes[] = { + {ZAP_EMPTY_DEFAULT(), 0x0000, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)}, + {ZAP_SIMPLE_DEFAULT(1), 0x0001, 1, ZAP_TYPE(BOOLEAN), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0x0002, 1, ZAP_TYPE(ENUM8), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0x0003, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_SIMPLE_DEFAULT(0), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(1), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, +}; // ZAP_SIMPLE_DEFAULT(1), 0xFFFD, 2, ZAP_TYPE(INT16U) , ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +constexpr chip::CommandId matter_cluster_ota_requestor_accepted_commands[] = { + 0x0000, + kInvalidCommandId, +}; +constexpr chip::EventId matter_cluster_ota_requestor_events[] = { + 0x0000, + 0x0001, + 0x0002, + kInvalidEventId, +}; + +EmberAfCluster matter_cluster_ota_requestor_server = { + .clusterId = 0x0000002A, + .attributes = matter_cluster_ota_requestor_attributes, + .attributeCount = ArraySize(matter_cluster_ota_requestor_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER), + .functions = NULL, + .acceptedCommandList = matter_cluster_ota_requestor_accepted_commands, + .generatedCommandList = nullptr, + .eventList = matter_cluster_ota_requestor_events, + .eventCount = ArraySize(matter_cluster_ota_requestor_events) +}; + +EmberAfAttributeMetadata matter_cluster_general_commissioning_attributes[] = { + {uint32_t(0), 0x0000, 8, ZAP_TYPE(INT64U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0001, 0, ZAP_TYPE(STRUCT), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0002, 1, ZAP_TYPE(ENUM8), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0003, 1, ZAP_TYPE(ENUM8), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0004, 1, ZAP_TYPE(BOOLEAN), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(1), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, +}; // ZAP_SIMPLE_DEFAULT(1), 0xFFFD, 2, ZAP_TYPE(INT16U) , ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +constexpr chip::CommandId matter_cluster_general_commissioning_accepted_commands[] = { + 0x0000, + 0x0002, + 0x0004, + kInvalidCommandId, +}; +constexpr chip::CommandId matter_cluster_general_commissioning_generated_commands[] = { + 0x0001, + 0x0003, + 0x0005, + kInvalidCommandId, +}; + +EmberAfCluster matter_cluster_general_commissioning_server = { + .clusterId = 0x00000030, + .attributes = matter_cluster_general_commissioning_attributes, + .attributeCount = ArraySize(matter_cluster_general_commissioning_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER), + .functions = NULL, + .acceptedCommandList = matter_cluster_general_commissioning_accepted_commands, + .generatedCommandList = matter_cluster_general_commissioning_generated_commands, + .eventList = nullptr, + .eventCount = 0 +}; + +EmberAfAttributeMetadata matter_cluster_network_commissioning_attributes[] = { + {ZAP_EMPTY_DEFAULT(), 0x0000, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0001, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0002, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0003, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0004, 1, ZAP_TYPE(BOOLEAN), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0005, 1, ZAP_TYPE(ENUM8), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0006, 33, ZAP_TYPE(OCTET_STRING), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0007, 4, ZAP_TYPE(INT32S), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_SIMPLE_DEFAULT(1), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(1), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, +}; // ZAP_EMPTY_DEFAULT(), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +constexpr chip::CommandId matter_cluster_network_commissioning_accepted_commands[] = { + 0x0000, + 0x0002, + 0x0004, + 0x0006, + 0x0008, + kInvalidCommandId, +}; +constexpr chip::CommandId matter_cluster_network_commissioning_generated_commands[] = { + 0x0001, + 0x0005, + 0x0007, + kInvalidCommandId, +}; +EmberAfCluster matter_cluster_network_commissioning_server = { + .clusterId = 0x00000031, + .attributes = matter_cluster_network_commissioning_attributes, + .attributeCount = ArraySize(matter_cluster_network_commissioning_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER), + .functions = NULL, + .acceptedCommandList = matter_cluster_network_commissioning_accepted_commands, + .generatedCommandList = matter_cluster_network_commissioning_generated_commands, + .eventList = nullptr, + .eventCount = 0 +}; + +EmberAfAttributeMetadata matter_cluster_general_diagnostics_attributes[] = { + {ZAP_EMPTY_DEFAULT(), 0x0000, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0001, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0002, 8, ZAP_TYPE(INT64U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0003, 4, ZAP_TYPE(INT32U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0004, 1, ZAP_TYPE(ENUM8), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0005, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0006, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0007, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0008, 1, ZAP_TYPE(BOOLEAN), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(1), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, +}; // ZAP_EMPTY_DEFAULT(), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +constexpr chip::EventId matter_cluster_general_diagnostics_events[] = { + 0x0000, + 0x0001, + 0x0002, + 0x0003, + kInvalidEventId, +}; +EmberAfCluster matter_cluster_general_diagnostics_server = { + .clusterId = 0x00000033, + .attributes = matter_cluster_general_diagnostics_attributes, + .attributeCount = ArraySize(matter_cluster_general_diagnostics_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER), + .functions = NULL, + .acceptedCommandList = nullptr, + .generatedCommandList = nullptr, + .eventList = matter_cluster_general_diagnostics_events, + .eventCount = ArraySize(matter_cluster_general_diagnostics_events) +}; + +EmberAfAttributeMetadata matter_cluster_software_diagnostics_attributes[] = { + {ZAP_EMPTY_DEFAULT(), 0x0000, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0001, 8, ZAP_TYPE(INT64U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0002, 8, ZAP_TYPE(INT64U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0003, 8, ZAP_TYPE(INT64U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(1), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(1), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, +}; // ZAP_EMPTY_DEFAULT(), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +EmberAfCluster matter_cluster_software_diagnostics_server = { + .clusterId = 0x00000034, + .attributes = matter_cluster_software_diagnostics_attributes, + .attributeCount = ArraySize(matter_cluster_software_diagnostics_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER), + .functions = NULL, + .acceptedCommandList = nullptr, + .generatedCommandList = nullptr, + .eventList = nullptr, + .eventCount = 0 +}; + +EmberAfAttributeMetadata matter_cluster_wifi_diagnostics_attributes[] = { + {ZAP_EMPTY_DEFAULT(), 0x0000, 7, ZAP_TYPE(OCTET_STRING), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0001, 1, ZAP_TYPE(ENUM8), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0002, 1, ZAP_TYPE(ENUM8), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0003, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0004, 1, ZAP_TYPE(INT8S), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_SIMPLE_DEFAULT(3), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(1), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, +}; // ZAP_EMPTY_DEFAULT(), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +constexpr chip::EventId matter_cluster_wifi_diagnostics_events[] = { + 0x0000, + 0x0001, + 0x0002, + kInvalidEventId, +}; +EmberAfCluster matter_cluster_wifi_diagnostics_server = { + .clusterId = 0x00000036, + .attributes = matter_cluster_wifi_diagnostics_attributes, + .attributeCount = ArraySize(matter_cluster_wifi_diagnostics_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER), + .functions = NULL, + .acceptedCommandList = nullptr, + .generatedCommandList = nullptr, + .eventList = matter_cluster_wifi_diagnostics_events, + .eventCount = ArraySize(matter_cluster_wifi_diagnostics_events) +}; + +EmberAfAttributeMetadata matter_cluster_administrator_commissioning_attributes[] = { + {ZAP_EMPTY_DEFAULT(), 0x0000, 1, ZAP_TYPE(ENUM8), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0001, 1, ZAP_TYPE(FABRIC_IDX), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0002, 1, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_SIMPLE_DEFAULT(0), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(1), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, +}; // ZAP_EMPTY_DEFAULT(), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +EmberAfCluster matter_cluster_administrator_commissioning_server = { + .clusterId = 0x0000003C, + .attributes = matter_cluster_administrator_commissioning_attributes, + .attributeCount = ArraySize(matter_cluster_administrator_commissioning_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER), + .functions = NULL, + .acceptedCommandList = nullptr, + .generatedCommandList = nullptr, + .eventList = nullptr, + .eventCount = 0 +}; + +EmberAfAttributeMetadata matter_cluster_operational_credentials_attributes[] = { + {ZAP_EMPTY_DEFAULT(), 0x0000, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0001, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0002, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0003, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0004, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0005, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(1), 0xFFFD, 2, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, +}; // ZAP_EMPTY_DEFAULT(), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +constexpr chip::CommandId matter_cluster_operational_credentials_accepted_commands[] = { + 0x0000, + 0x0002, + 0x0004, + 0x0006, + 0x0007, + 0x000A, + 0x000B, + kInvalidCommandId, +}; +constexpr chip::CommandId matter_cluster_operational_credentials_generated_commands[] = { + 0x0001, + 0x0003, + 0x0005, + 0x0008, + kInvalidCommandId, +}; +EmberAfCluster matter_cluster_operational_credentials_server = { + .clusterId = 0x0000003E, + .attributes = matter_cluster_operational_credentials_attributes, + .attributeCount = ArraySize(matter_cluster_operational_credentials_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER), + .functions = NULL, + .acceptedCommandList = matter_cluster_operational_credentials_accepted_commands, + .generatedCommandList = matter_cluster_operational_credentials_generated_commands, + .eventList = nullptr, + .eventCount = 0 +}; + +EmberAfAttributeMetadata matter_cluster_group_key_management_attributes[] = { + {ZAP_EMPTY_DEFAULT(), 0x0000, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0001, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0002, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0003, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(1), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, +}; // ZAP_EMPTY_DEFAULT(), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +EmberAfCluster matter_cluster_group_key_management_server = { + .clusterId = 0x0000003F, + .attributes = matter_cluster_group_key_management_attributes, + .attributeCount = ArraySize(matter_cluster_group_key_management_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER), + .functions = NULL, + .acceptedCommandList = nullptr, + .generatedCommandList = nullptr, + .eventList = nullptr, + .eventCount = 0 +}; + +EmberAfAttributeMetadata matter_cluster_identify_attributes[] = { + {ZAP_SIMPLE_DEFAULT(0), 0x0000, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)}, + {ZAP_SIMPLE_DEFAULT(0), 0x0001, 1, ZAP_TYPE(ENUM8), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(4), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, +}; // ZAP_EMPTY_DEFAULT(), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +constexpr chip::CommandId matter_cluster_identify_accepted_commands[] = { + 0x0000, + 0x0040, + kInvalidCommandId, +}; +EmberAfGenericClusterFunction matter_cluster_identify_functions[] = { + (EmberAfGenericClusterFunction) emberAfIdentifyClusterServerInitCallback, + (EmberAfGenericClusterFunction) MatterIdentifyClusterServerAttributeChangedCallback, +}; +EmberAfCluster matter_cluster_identify_server = { + .clusterId = 0x00000003, + .attributes = matter_cluster_identify_attributes, + .attributeCount = ArraySize(matter_cluster_identify_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), + .functions = matter_cluster_identify_functions, + .acceptedCommandList = matter_cluster_identify_accepted_commands, + .generatedCommandList = nullptr, + .eventList = nullptr, + .eventCount = 0 +}; + +EmberAfAttributeMetadata matter_cluster_groups_attributes[] = { + {ZAP_EMPTY_DEFAULT(), 0x0000, 1, ZAP_TYPE(BITMAP8), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(4), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, +}; // ZAP_EMPTY_DEFAULT(), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +constexpr chip::CommandId matter_cluster_groups_accepted_commands[] = { + 0x0000, + 0x0001, + 0x0002, + 0x0003, + 0x0004, + 0x0005, + kInvalidCommandId, +}; +constexpr chip::CommandId matter_cluster_groups_generated_commands[] = { + 0x0000, + 0x0001, + 0x0002, + 0x0003, + kInvalidCommandId, +}; +EmberAfGenericClusterFunction matter_cluster_groups_functions[] = { + (EmberAfGenericClusterFunction) emberAfGroupsClusterServerInitCallback, +}; +EmberAfCluster matter_cluster_groups_server = { + .clusterId = 0x00000004, + .attributes = matter_cluster_groups_attributes, + .attributeCount = ArraySize(matter_cluster_groups_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), + .functions = matter_cluster_groups_functions, + .acceptedCommandList = matter_cluster_groups_accepted_commands, + .generatedCommandList = matter_cluster_groups_generated_commands, + .eventList = nullptr, + .eventCount = 0 +}; + +EmberAfAttributeMetadata matter_cluster_scenes_attributes[] = { + {ZAP_EMPTY_DEFAULT(), 0x0000, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0x0001, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0x0002, 2, ZAP_TYPE(GROUP_ID), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0x0003, 1, ZAP_TYPE(BOOLEAN), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0004, 1, ZAP_TYPE(BITMAP8), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {uint32_t(0), 0x0005, 8, ZAP_TYPE(NODE_ID), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0006, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_EMPTY_DEFAULT(), 0x0007, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(5), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, +}; // ZAP_EMPTY_DEFAULT(), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +constexpr chip::CommandId matter_cluster_scenes_accepted_commands[] = { + 0x0000, + 0x0001, + 0x0002, + 0x0003, + 0x0004, + 0x0005, + 0x0006, + kInvalidCommandId, +}; +constexpr chip::CommandId matter_cluster_scenes_generated_commands[] = { + 0x0000, + 0x0001, + 0x0002, + 0x0003, + 0x0004, + 0x0006, + kInvalidCommandId, +}; +EmberAfCluster matter_cluster_scenes_server = { + .clusterId = 0x00000005, + .attributes = matter_cluster_scenes_attributes, + .attributeCount = ArraySize(matter_cluster_scenes_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER), + .functions = NULL, + .acceptedCommandList = matter_cluster_scenes_accepted_commands, + .generatedCommandList = matter_cluster_scenes_generated_commands, + .eventList = nullptr, + .eventCount = 0 +}; + +EmberAfAttributeMetadata matter_cluster_onoff_attributes[] = { + {ZAP_SIMPLE_DEFAULT(0), 0x0000, 1, ZAP_TYPE(BOOLEAN), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(TOKENIZE)}, + {ZAP_SIMPLE_DEFAULT(1), 0x4000, 1, ZAP_TYPE(BOOLEAN), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0), 0x4001, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)}, + {ZAP_SIMPLE_DEFAULT(0), 0x4002, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)}, + {&onoffStartUpOnOffMinMaxValue, 0x4003, 1, ZAP_TYPE(ENUM8), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_SIMPLE_DEFAULT(1), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(4), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, +}; // ZAP_EMPTY_DEFAULT(), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +constexpr chip::CommandId matter_cluster_onoff_accepted_commands[] = { + 0x0000, + 0x0001, + 0x0002, + 0x0040, + 0x0041, + 0x0042, + kInvalidCommandId, +}; +constexpr chip::CommandId matter_cluster_onoff_generated_commands[] = { + 0x0000, + 0x0001, + 0x0002, + 0x0003, + 0x0004, + 0x0005, + 0x0006, + 0x0007, + kInvalidCommandId, +}; +EmberAfGenericClusterFunction matter_cluster_onoff_functions[] = { + (EmberAfGenericClusterFunction) emberAfOnOffClusterServerInitCallback, + (EmberAfGenericClusterFunction) MatterOnOffClusterServerShutdownCallback, +}; +EmberAfCluster matter_cluster_onoff_server = { + .clusterId = 0x00000006, + .attributes = matter_cluster_onoff_attributes, + .attributeCount = ArraySize(matter_cluster_onoff_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION), + .functions = matter_cluster_onoff_functions, + .acceptedCommandList = matter_cluster_onoff_accepted_commands, + .generatedCommandList = matter_cluster_onoff_generated_commands, + .eventList = nullptr, + .eventCount = 0 +}; + +EmberAfAttributeMetadata matter_cluster_level_control_attributes[] = { + {ZAP_SIMPLE_DEFAULT(0x01), 0x0000, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_SIMPLE_DEFAULT(0x0000), 0x0001, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0x01), 0x0002, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0xFE), 0x0003, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0x0000), 0x0004, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0x0000), 0x0005, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(0x0000), 0x0006, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {&levelcontrolOptionsMinMaxValue, 0x000F, 1, ZAP_TYPE(BITMAP8), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE)}, + {ZAP_SIMPLE_DEFAULT(0x0000), 0x0010, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE)}, + {ZAP_SIMPLE_DEFAULT(0xFF), 0x0011, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0012, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_EMPTY_DEFAULT(), 0x0013, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_SIMPLE_DEFAULT(50), 0x0014, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_SIMPLE_DEFAULT(255), 0x4000, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE)}, + {ZAP_SIMPLE_DEFAULT(3), 0xFFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, + {ZAP_SIMPLE_DEFAULT(5), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE)}, +}; // ZAP_EMPTY_DEFAULT(), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +constexpr chip::CommandId matter_cluster_level_control_accepted_commands[] = { + 0x0000, + 0x0001, + 0x0002, + 0x0003, + 0x0004, + 0x0005, + 0x0006, + 0x0007, + kInvalidCommandId, +}; +EmberAfGenericClusterFunction matter_cluster_level_control_functions[] = { + (EmberAfGenericClusterFunction) emberAfLevelControlClusterServerInitCallback, + (EmberAfGenericClusterFunction) MatterLevelControlClusterServerShutdownCallback, +}; +EmberAfCluster matter_cluster_level_control_server = { + .clusterId = 0x00000008, + .attributes = matter_cluster_level_control_attributes, + .attributeCount = ArraySize(matter_cluster_level_control_attributes), + .clusterSize = 0, + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION), + .functions = matter_cluster_level_control_functions, + .acceptedCommandList = matter_cluster_level_control_accepted_commands, + .generatedCommandList = nullptr, + .eventList = nullptr, + .eventCount = 0 +}; + +#define MAT_ATTR_READONLY (ATTRIBUTE_MASK_EXTERNAL_STORAGE) +#define MAT_ATTR_WRITABLE (ATTRIBUTE_MASK_EXTERNAL_STORAGE | ATTRIBUTE_MASK_WRITABLE) + +using namespace Thermostat::Attributes; +using namespace Thermostat::Commands; +EmberAfAttributeMetadata matter_cluster_thermostat_attributes[] = { + {2500, LocalTemperature::Id, 2, ZAP_TYPE(INT16S), MAT_ATTR_READONLY}, + {700, AbsMinHeatSetpointLimit::Id, 2, ZAP_TYPE(INT16S), MAT_ATTR_WRITABLE}, + {3000, AbsMaxHeatSetpointLimit::Id, 2, ZAP_TYPE(INT16S), MAT_ATTR_WRITABLE}, + {1600, AbsMinCoolSetpointLimit::Id, 2, ZAP_TYPE(INT16S), MAT_ATTR_WRITABLE}, + {3200, AbsMaxCoolSetpointLimit::Id, 2, ZAP_TYPE(INT16S), MAT_ATTR_WRITABLE}, + {2000, OccupiedCoolingSetpoint::Id, 2, ZAP_TYPE(INT16S), MAT_ATTR_WRITABLE}, + {1600, OccupiedHeatingSetpoint::Id, 2, ZAP_TYPE(INT16S), MAT_ATTR_WRITABLE}, + {700, MinHeatSetpointLimit::Id, 2, ZAP_TYPE(INT16S), MAT_ATTR_WRITABLE}, + {3000, MaxHeatSetpointLimit::Id, 2, ZAP_TYPE(INT16S), MAT_ATTR_WRITABLE}, + {1600, MinCoolSetpointLimit::Id, 2, ZAP_TYPE(INT16S), MAT_ATTR_WRITABLE}, + {3200, MaxCoolSetpointLimit::Id, 2, ZAP_TYPE(INT16S), MAT_ATTR_WRITABLE}, + {25, MinSetpointDeadBand::Id, 1, ZAP_TYPE(INT8S), MAT_ATTR_WRITABLE}, + {ZAP_EMPTY_DEFAULT(), ControlSequenceOfOperation::Id, 1, ZAP_TYPE(ENUM8), MAT_ATTR_WRITABLE}, + {ZAP_EMPTY_DEFAULT(), SystemMode::Id, 1, ZAP_TYPE(ENUM8), MAT_ATTR_WRITABLE}, + {ZAP_EMPTY_DEFAULT(), ThermostatRunningMode::Id, 1, ZAP_TYPE(ENUM8), MAT_ATTR_READONLY}, +}; // ZAP_EMPTY_DEFAULT(), 0xFFFD, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) +constexpr chip::CommandId matter_cluster_thermostat_accepted_commands[] = { + SetpointRaiseLower::Id, + kInvalidCommandId, +}; +EmberAfCluster matter_cluster_thermostat_server = { + .clusterId = Thermostat::Id, + .attributes = matter_cluster_thermostat_attributes, + .attributeCount = ArraySize(matter_cluster_thermostat_attributes), + .clusterSize = 0, + .mask = CLUSTER_MASK_SERVER, + .functions = NULL, + .acceptedCommandList = matter_cluster_thermostat_accepted_commands, + .generatedCommandList = nullptr, + .eventList = nullptr, + .eventCount = 0 +}; } // Clusters namespace Endpoints { -void matter_root_node_preset(EndpointConfig *rootNodeEndpointConfig) -{ - ClusterConfig descriptorServerCluster; - ClusterConfig aclServerCluster; - ClusterConfig basicInformationServerCluster; - ClusterConfig otarServerCluster; - ClusterConfig generalCommissioningServerCluster; - ClusterConfig networkCommissioningServerCluster; - ClusterConfig generalDiagnosticsServerCluster; - ClusterConfig softwareDiagnosticsServerCluster; - ClusterConfig wifiDiagnosticsServerCluster; - ClusterConfig administratorCommissioningServerCluster; - ClusterConfig operationalCredentialsServerCluster; - ClusterConfig groupKeyManagementServerCluster; - - Presets::Clusters::matter_cluster_descriptor_server(&descriptorServerCluster); - Presets::Clusters::matter_cluster_acl_server(&aclServerCluster); - Presets::Clusters::matter_cluster_basic_information_server(&basicInformationServerCluster); - Presets::Clusters::matter_cluster_ota_requestor_server(&otarServerCluster); - Presets::Clusters::matter_cluster_general_commissioning_server(&generalCommissioningServerCluster); - Presets::Clusters::matter_cluster_network_commissioning_server(&networkCommissioningServerCluster); - Presets::Clusters::matter_cluster_general_diagnostics_server(&generalDiagnosticsServerCluster); - Presets::Clusters::matter_cluster_software_diagnostics_server(&softwareDiagnosticsServerCluster); - Presets::Clusters::matter_cluster_wifi_diagnostics_server(&wifiDiagnosticsServerCluster); - Presets::Clusters::matter_cluster_administrator_commissioning_server(&administratorCommissioningServerCluster); - Presets::Clusters::matter_cluster_operational_credentials_server(&operationalCredentialsServerCluster); - Presets::Clusters::matter_cluster_group_key_management_server(&groupKeyManagementServerCluster); - - rootNodeEndpointConfig->clusterConfigs.push_back(descriptorServerCluster); - rootNodeEndpointConfig->clusterConfigs.push_back(aclServerCluster); - rootNodeEndpointConfig->clusterConfigs.push_back(basicInformationServerCluster); - rootNodeEndpointConfig->clusterConfigs.push_back(otarServerCluster); - rootNodeEndpointConfig->clusterConfigs.push_back(generalCommissioningServerCluster); - rootNodeEndpointConfig->clusterConfigs.push_back(networkCommissioningServerCluster); - rootNodeEndpointConfig->clusterConfigs.push_back(generalDiagnosticsServerCluster); - rootNodeEndpointConfig->clusterConfigs.push_back(softwareDiagnosticsServerCluster); - rootNodeEndpointConfig->clusterConfigs.push_back(wifiDiagnosticsServerCluster); - rootNodeEndpointConfig->clusterConfigs.push_back(administratorCommissioningServerCluster); - rootNodeEndpointConfig->clusterConfigs.push_back(operationalCredentialsServerCluster); - rootNodeEndpointConfig->clusterConfigs.push_back(groupKeyManagementServerCluster); -} - -void matter_dimmable_light_preset(EndpointConfig *dimmableLightEndpointConfig) -{ - ClusterConfig descriptorServerCluster; - ClusterConfig identifyServerCluster; - ClusterConfig groupsServerCluster; - ClusterConfig scenesServerCluster; - ClusterConfig onOffServerCluster; - ClusterConfig levelControlServerCluster; - - Presets::Clusters::matter_cluster_descriptor_server(&descriptorServerCluster); - Presets::Clusters::matter_cluster_identify_server(&identifyServerCluster); - Presets::Clusters::matter_cluster_groups_server(&groupsServerCluster); - Presets::Clusters::matter_cluster_scenes_server(&scenesServerCluster); - Presets::Clusters::matter_cluster_onoff_server(&onOffServerCluster); - Presets::Clusters::matter_cluster_level_control_server(&levelControlServerCluster); - - dimmableLightEndpointConfig->clusterConfigs.push_back(descriptorServerCluster); - dimmableLightEndpointConfig->clusterConfigs.push_back(identifyServerCluster); - dimmableLightEndpointConfig->clusterConfigs.push_back(groupsServerCluster); - dimmableLightEndpointConfig->clusterConfigs.push_back(scenesServerCluster); - dimmableLightEndpointConfig->clusterConfigs.push_back(onOffServerCluster); - dimmableLightEndpointConfig->clusterConfigs.push_back(levelControlServerCluster); -} - -void matter_aggregator_preset(EndpointConfig *aggregatorEndpointConfig) -{ - ClusterConfig descriptorServerCluster; - - Presets::Clusters::matter_cluster_descriptor_server(&descriptorServerCluster); - - aggregatorEndpointConfig->clusterConfigs.push_back(descriptorServerCluster); -} +EmberAfCluster matter_root_node_clusters[] = { + Presets::Clusters::matter_cluster_descriptor_server, + Presets::Clusters::matter_cluster_acl_server, + Presets::Clusters::matter_cluster_basic_information_server, + Presets::Clusters::matter_cluster_ota_requestor_server, + Presets::Clusters::matter_cluster_general_commissioning_server, + Presets::Clusters::matter_cluster_network_commissioning_server, + Presets::Clusters::matter_cluster_general_diagnostics_server, + Presets::Clusters::matter_cluster_software_diagnostics_server, + Presets::Clusters::matter_cluster_wifi_diagnostics_server, + Presets::Clusters::matter_cluster_administrator_commissioning_server, + Presets::Clusters::matter_cluster_operational_credentials_server, + Presets::Clusters::matter_cluster_group_key_management_server, +}; +EmberAfEndpointType matter_root_node_endpoint = { + .cluster = matter_root_node_clusters, + .clusterCount = ArraySize(matter_root_node_clusters), + .endpointSize = 0 +}; + +EmberAfCluster matter_dimmable_light_clusters[] = { + Presets::Clusters::matter_cluster_descriptor_server, + Presets::Clusters::matter_cluster_identify_server, + Presets::Clusters::matter_cluster_groups_server, + Presets::Clusters::matter_cluster_scenes_server, + Presets::Clusters::matter_cluster_onoff_server, + Presets::Clusters::matter_cluster_level_control_server, +}; +EmberAfEndpointType matter_dimmable_light_endpoint = { + .cluster = matter_dimmable_light_clusters, + .clusterCount = ArraySize(matter_dimmable_light_clusters), + .endpointSize = 0 +}; + +EmberAfCluster matter_aggregator_clusters[] = { + Presets::Clusters::matter_cluster_descriptor_server, +}; +EmberAfEndpointType matter_aggregator_endpoint = { + .cluster = matter_aggregator_clusters, + .clusterCount = ArraySize(matter_aggregator_clusters), + .endpointSize = 0 +}; } // Endpoints diff --git a/component/common/application/matter/core/matter_data_model_presets.h b/component/common/application/matter/core/matter_data_model_presets.h index ea7c7759..2e2f6d53 100644 --- a/component/common/application/matter/core/matter_data_model_presets.h +++ b/component/common/application/matter/core/matter_data_model_presets.h @@ -1,34 +1,13 @@ #pragma once -namespace Presets { -namespace Clusters { - -void matter_cluster_descriptor_server(ClusterConfig *clusterConfig); -void matter_cluster_acl_server(ClusterConfig *clusterConfig); -void matter_cluster_basic_information_server(ClusterConfig *clusterConfig); -void matter_cluster_ota_requestor_server(ClusterConfig *clusterConfig); -void matter_cluster_general_commissioning_server(ClusterConfig *clusterConfig); -void matter_cluster_network_commissioning_server(ClusterConfig *clusterConfig); -void matter_cluster_general_diagnostics_server(ClusterConfig *clusterConfig); -void matter_cluster_software_diagnostics_server(ClusterConfig *clusterConfig); -void matter_cluster_wifi_diagnostics_server(ClusterConfig *clusterConfig); -void matter_cluster_administrator_commissioning_server(ClusterConfig *clusterConfig); -void matter_cluster_operational_credentials_server(ClusterConfig *clusterConfig); -void matter_cluster_group_key_management_server(ClusterConfig *clusterConfig); -void matter_cluster_identify_server(ClusterConfig *clusterConfig); -void matter_cluster_groups_server(ClusterConfig *clusterConfig); -void matter_cluster_scenes_server(ClusterConfig *clusterConfig); -void matter_cluster_onoff_server(ClusterConfig *clusterConfig); -void matter_cluster_level_control_server(ClusterConfig *clusterConfig); -void matter_cluster_level_control_server(ClusterConfig *clusterConfig); - -} // Clusters +#include +namespace Presets { namespace Endpoints { -void matter_root_node_preset(EndpointConfig *rootNodeEndpointConfig); -void matter_dimmable_light_preset(EndpointConfig *dimmableLightEndpointConfig); -void matter_aggregator_preset(EndpointConfig *aggregatorEndpointConfig); +extern EmberAfEndpointType matter_root_node_endpoint; +extern EmberAfEndpointType matter_dimmable_light_endpoint; +extern EmberAfEndpointType matter_aggregator_endpoint; } // Endpoints } // Presets diff --git a/component/common/application/matter/core/matter_interaction.cpp b/component/common/application/matter/core/matter_interaction.cpp index b1aaa1cc..d8cd69ae 100644 --- a/component/common/application/matter/core/matter_interaction.cpp +++ b/component/common/application/matter/core/matter_interaction.cpp @@ -176,3 +176,28 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & uplink_event.mHandler = matter_driver_uplink_update_handler; PostUplinkEvent(&uplink_event); } + +void matter_interaction_clean_up(void) +{ + ChipLogProgress(DeviceLayer, "Cleaning Uplink and Downlink Tasks and Queues."); + if (UplinkTaskHandle) + { + vTaskDelete(UplinkTaskHandle); + memset(&UplinkTaskHandle, 0, sizeof(TaskHandle_t)); + } + if (DownlinkTaskHandle) + { + vTaskDelete(DownlinkTaskHandle); + memset(&DownlinkTaskHandle, 0, sizeof(TaskHandle_t)); + } + if (UplinkEventQueue) + { + vQueueDelete(UplinkEventQueue); + memset(&UplinkEventQueue, 0, sizeof(QueueHandle_t)); + } + if (DownlinkEventQueue) + { + vQueueDelete(DownlinkEventQueue); + memset(&DownlinkEventQueue, 0, sizeof(QueueHandle_t)); + } +} \ No newline at end of file diff --git a/component/common/application/matter/core/matter_interaction.h b/component/common/application/matter/core/matter_interaction.h index 22f55bcb..28a9e082 100644 --- a/component/common/application/matter/core/matter_interaction.h +++ b/component/common/application/matter/core/matter_interaction.h @@ -7,4 +7,5 @@ void PostDownlinkEvent(const AppEvent * aEvent); CHIP_ERROR matter_interaction_start_downlink(void); CHIP_ERROR matter_interaction_start_uplink(void); +void matter_interaction_clean_up(void); // void matter_interaction_onoff_handler(AppEvent *aEvent); diff --git a/component/common/application/matter/core/matter_prov.cpp b/component/common/application/matter/core/matter_prov.cpp new file mode 100644 index 00000000..4677bd59 --- /dev/null +++ b/component/common/application/matter/core/matter_prov.cpp @@ -0,0 +1,103 @@ +#include +#include + +#include "app/server/Server.h" +#include "platform/CHIPDeviceLayer.h" +#include + +#include +#include +#include + +using namespace ::chip; +using namespace ::chip::DeviceLayer; + +CHIP_ERROR matter_prov_start() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + if (Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen()) + { + ChipLogProgress(DeviceLayer, "Matter device is already in provisioning mode!"); + } + else + { + err = Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow(); + } + return err; +} + +CHIP_ERROR matter_prov_stop() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + if (Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen()) + { + Server::GetInstance().GetCommissioningWindowManager().CloseCommissioningWindow(); + } + else + { + ChipLogProgress(DeviceLayer, "Matter device is already out of provisioning mode!"); + } + return err; +} + +bool matter_prov_is_provisioned() +{ + return (Server::GetInstance().GetFabricTable().FabricCount() == 0 ? false : true); +} + +CHIP_ERROR matter_prov_print_fabric_table() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + uint8_t fabricCount = Server::GetInstance().GetFabricTable().FabricCount(); + if (fabricCount > 0) + { + ChipLogProgress(DeviceLayer, "Matter device is provisioned by %i admin(s)!", fabricCount); + uint8_t iterator = 0; + printf("|No|FabricIndex|FabricId|NodeId|%-32s|\r\n", "FabricLabel"); + for (auto fabricIterator = Server::GetInstance().GetFabricTable().begin(); + fabricIterator != Server::GetInstance().GetFabricTable().end(); fabricIterator++) + { + printf("|%-2u|%-11u|%-8u|%-6u|", iterator++, (uint8_t*)fabricIterator->GetFabricIndex(), + (uint64_t*)fabricIterator->GetFabricId(), (uint64_t*)fabricIterator->GetNodeId()); + if(fabricIterator->GetFabricLabel().empty()) + { + printf("%-32s|\r\n", "N.A."); + } + else + { + printf("%-32s|\r\n", (char*) fabricIterator->GetFabricLabel().begin()); + } + } + } + else + { + ChipLogProgress(DeviceLayer, "Matter device is not provisioned yet!"); + } + return err; +} + +CHIP_ERROR matter_prov_delete_fabric_table_row(uint8_t row) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + uint8_t fabricCount = Server::GetInstance().GetFabricTable().FabricCount(); + ConstFabricIterator fabricIterator = Server::GetInstance().GetFabricTable().begin(); + + if(fabricCount == 0) + { + ChipLogError(DeviceLayer, "Matter device is not provisioned yet!"); + return err; + } + if(row >= fabricCount) + { + ChipLogError(DeviceLayer, "Invalid argument, provided row (%u) must be lower than total available fabric(s) (%u)", row, fabricCount); + err = CHIP_ERROR_INVALID_ARGUMENT; + return err; + } + for(uint8_t i = 0; i < row;i++) + { + fabricIterator++; //iterate fabric to targeted fabric row + } + err = Server::GetInstance().GetFabricTable().Delete(fabricIterator->GetFabricIndex()); + + return err; +} diff --git a/component/common/application/matter/core/matter_prov.h b/component/common/application/matter/core/matter_prov.h new file mode 100644 index 00000000..df7e7c58 --- /dev/null +++ b/component/common/application/matter/core/matter_prov.h @@ -0,0 +1,35 @@ +#pragma once + +#include + +/** + * @brief + * This function starts provisioning mode by opening basic commissioning window + * Even though if one fabric is already provisioned, it can still open commissioning window for different fabric provisioning + */ +CHIP_ERROR matter_prov_start(void); + +/** + * @brief + * This function stops provisioning mode by closing commissioning window + */ +CHIP_ERROR matter_prov_stop(void); + +/** + * @brief + * This function returns true if the matter device is provisioned by at least one admin + */ +bool matter_prov_is_provisioned(void); + +/** + * @brief + * This function prints out the whole fabric table + * Row starts from no 0 + */ +CHIP_ERROR matter_prov_print_fabric_table(void); + +/** + * @brief + * This function deletes fabric based on the row of the fabric table + */ +CHIP_ERROR matter_prov_delete_fabric_table_row(uint8_t row); diff --git a/component/common/application/matter/driver/bridge_dm_driver.cpp b/component/common/application/matter/driver/bridge_dm_driver.cpp index 5935bb4f..f565ab2b 100644 --- a/component/common/application/matter/driver/bridge_dm_driver.cpp +++ b/component/common/application/matter/driver/bridge_dm_driver.cpp @@ -41,23 +41,17 @@ void MatterBridge::Init(Node& mNode) node->removeEndpoint(1); } - EndpointConfig rootNodeEndpointConfig; - EndpointConfig aggregatorEndpointConfig; - - Presets::Endpoints::matter_root_node_preset(&rootNodeEndpointConfig); - Presets::Endpoints::matter_aggregator_preset(&aggregatorEndpointConfig); - // Initialization for Bridge: Root Node on ep0 and Aggregator on ep1 - node->addEndpoint(rootNodeEndpointConfig, Span(gRootNodeDeviceTypes)); - node->addEndpoint(aggregatorEndpointConfig, Span(gAggregatorDeviceTypes)); + node->addEndpoint(&Presets::Endpoints::matter_root_node_endpoint, Span(gRootNodeDeviceTypes)); + node->addEndpoint(&Presets::Endpoints::matter_aggregator_endpoint, Span(gAggregatorDeviceTypes)); // Enable endpoints node->enableAllEndpoints(); } -void MatterBridge::addBridgedEndpoint(EndpointConfig bridgedConfig, Span bridgedDeviceType) +void MatterBridge::addBridgedEndpoint(EmberAfEndpointType *endpointType, Span bridgedDeviceType) { - node->addEndpoint(bridgedConfig, bridgedDeviceType); + node->addEndpoint(endpointType, bridgedDeviceType); node->enableAllEndpoints(); } diff --git a/component/common/application/matter/driver/bridge_dm_driver.h b/component/common/application/matter/driver/bridge_dm_driver.h index b9e3cff3..e05ee3e1 100644 --- a/component/common/application/matter/driver/bridge_dm_driver.h +++ b/component/common/application/matter/driver/bridge_dm_driver.h @@ -27,7 +27,7 @@ class MatterBridge char address[BRIDGE_DEVICE_ADDRESS_LENGTH]; }; void Init(Node& node); - void addBridgedEndpoint(EndpointConfig bridgedConfig, Span bridgedDeviceType); + void addBridgedEndpoint(EmberAfEndpointType *endpointType, Span bridgedDeviceType); void removeBridgedEndpoint(chip::EndpointId endpointID); private: diff --git a/component/common/application/matter/example/bridge_dm/README.md b/component/common/application/matter/example/bridge_dm/README.md index f3b9ab55..c3d77356 100644 --- a/component/common/application/matter/example/bridge_dm/README.md +++ b/component/common/application/matter/example/bridge_dm/README.md @@ -4,8 +4,8 @@ You will need 2 non-Matter peripherals running TCP client socket. ## Ameba Data Model This example demonstrates adding and removing endpoints dynamically using the *Ameba Data Model*. -A `Root Node` device type will be created on Endpoint0, a `Aggregator` device type on Endpoint1 and a `Dimmable Light` device type on Endpoint2. -After 20 seconds delay, the `Dimmable Light` endpoint on Endpoint2 will be removed. +A `Root Node` device type will be created on Endpoint0, a `Aggregator` device type on Endpoint1 and 18 `Dimmable Light` device type on Endpoint2 to Endpoint19. +After 60 seconds delay, the `Dimmable Light` endpoint on Endpoint19 to Endpoint2 will be removed. Additionally a new thread will be created for user to input their code to communicate with non-matter device based on the protocol (e.g., IP-based (TCP,UDP), BLE, zigbee and etc) they wish to use. @@ -15,17 +15,6 @@ Additionally a new thread will be created for user to input their code to commun Enable `CONFIG_EXAMPLE_MATTER` and `CONFIG_EXAMPLE_MATTER_BRIDGE` in `platform_opts_matter.h`. Ensure that `CONFIG_EXAMPLE_MATTER_CHIPTEST` is disabled. -### PSRAM usage -Due to insufficient memory in SRAM, we will use the PSRAM for dynamic allocation. -To run this example without error, you need to enable PSRAM. -In `rtl8721dhp_intfcfg.c`, set the below configurations - - PSRAMCFG_TypeDef psram_dev_config = { - .psram_dev_enable = TRUE, //enable psram - .psram_dev_cal_enable = TRUE, //enable psram calibration function - .psram_dev_retention = TRUE, - } - ### Setup the Build Environment cd connectedhomeip diff --git a/component/common/application/matter/example/bridge_dm/example_matter_bridge.cpp b/component/common/application/matter/example/bridge_dm/example_matter_bridge.cpp index 4be6544a..7fe25067 100644 --- a/component/common/application/matter/example/bridge_dm/example_matter_bridge.cpp +++ b/component/common/application/matter/example/bridge_dm/example_matter_bridge.cpp @@ -64,40 +64,33 @@ static void example_matter_bridge_task(void *pvParameters) if (err != CHIP_NO_ERROR) ChipLogProgress(DeviceLayer, "matter_interaction_start_uplink failed!\n"); - vTaskDelay(50); + vTaskDelay(1000); bridge.Init(node); - EndpointConfig bridgedonoffEndpointConfig; - Presets::Endpoints::matter_dimmable_light_preset(&bridgedonoffEndpointConfig); - bridge.addBridgedEndpoint(bridgedonoffEndpointConfig, Span(gBridgedOnOffDeviceTypes)); + ChipLogProgress(DeviceLayer, "Add dimmable lights"); + for (int i = 0; i < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT - 2; i++) //adding endpoints 2 to 19 + { + ChipLogProgress(DeviceLayer, "Add dimmable lights [Endpoint 0x%x]", node.getNextEndpointId()); + bridge.addBridgedEndpoint(&Presets::Endpoints::matter_dimmable_light_endpoint, Span(gBridgedOnOffDeviceTypes)); + } if(xTaskCreate(matter_customer_bridge_code, ((const char*)"matter_customer_bridge_code"), 1024, NULL, tskIDLE_PRIORITY + 1, NULL) != pdPASS) printf("\n\r%s xTaskCreate(matter_customer_bridge_code) failed\n", __FUNCTION__); - vTaskDelay(20000); - - bridge.removeBridgedEndpoint(2); + ChipLogProgress(DeviceLayer, "60 seconds until all lights removed\n\n"); + vTaskDelay(60000); + ChipLogProgress(DeviceLayer, "Removing All Lights"); + for (int i = 1; i <= CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT - 2; i++) //removing endpoints 19 to 2 + { + uint16_t epToBeRemoved = node.getNextEndpointId() - i; + ChipLogProgress(DeviceLayer, "Removing Endpoint 0x%x", epToBeRemoved); + bridge.removeBridgedEndpoint(epToBeRemoved); + } vTaskDelete(NULL); } -// let new and delete operators use psram for more memory by overloading these operators -// remember to enable psram in rtl8721dhp_intfcfg.c -extern "C" void *Psram_reserve_malloc(int size); -extern "C" void Psram_reserve_free(void *ptr); - -void *operator new(size_t size) -{ - void* ptr = Psram_reserve_malloc(size); - return ptr; -} - -void operator delete(void *p) -{ - Psram_reserve_free(p); -} - extern "C" void example_matter_bridge(void) { if(xTaskCreate(example_matter_bridge_task, ((const char*)"example_matter_task_thread"), 2048, NULL, tskIDLE_PRIORITY + 1, NULL) != pdPASS) diff --git a/component/common/application/matter/example/laundrywasher/example_matter_laundrywasher.cpp b/component/common/application/matter/example/laundrywasher/example_matter_laundrywasher.cpp index dc319ccd..5980ab80 100644 --- a/component/common/application/matter/example/laundrywasher/example_matter_laundrywasher.cpp +++ b/component/common/application/matter/example/laundrywasher/example_matter_laundrywasher.cpp @@ -54,4 +54,4 @@ extern "C" void example_matter_laundrywasher(void) ChipLogProgress(DeviceLayer, "\n\r%s xTaskCreate(example_matter_laundrywasher) failed", __FUNCTION__); } -#endif /* CONFIG_EXAMPLE_MATTER_LAUNDRY_WASHER */ \ No newline at end of file +#endif /* CONFIG_EXAMPLE_MATTER_LAUNDRYWASHER */ \ No newline at end of file diff --git a/component/common/application/matter/example/light_dm/README.md b/component/common/application/matter/example/light_dm/README.md index 65c19e6f..7f5e33ed 100644 --- a/component/common/application/matter/example/light_dm/README.md +++ b/component/common/application/matter/example/light_dm/README.md @@ -18,17 +18,6 @@ After another 20 second delay, the `Dimmable Light` endpoint on Endpoint2 will b Enable `CONFIG_EXAMPLE_MATTER` and `CONFIG_EXAMPLE_MATTER_LIGHT` in `platform_opts_matter.h`. Ensure that `CONFIG_EXAMPLE_MATTER_CHIPTEST` is disabled. -### PSRAM usage -Due to insufficient memory in SRAM, we will use the PSRAM for dynamic allocation. -To run this example without error, you need to enable PSRAM. -In `rtl8721dhp_intfcfg.c`, set the below configurations - - PSRAMCFG_TypeDef psram_dev_config = { - .psram_dev_enable = TRUE, //enable psram - .psram_dev_cal_enable = TRUE, //enable psram calibration function - .psram_dev_retention = TRUE, - } - ### Setup the Build Environment cd connectedhomeip diff --git a/component/common/application/matter/example/light_dm/example_matter_light.cpp b/component/common/application/matter/example/light_dm/example_matter_light.cpp index 77b8371a..493e3984 100644 --- a/component/common/application/matter/example/light_dm/example_matter_light.cpp +++ b/component/common/application/matter/example/light_dm/example_matter_light.cpp @@ -66,14 +66,9 @@ static void example_matter_light_task(void *pvParameters) if (err != CHIP_NO_ERROR) ChipLogProgress(DeviceLayer, "matter_driver_led_init failed!\n"); - EndpointConfig rootNodeEndpointConfig; - EndpointConfig dimmableLightEndpointConfig; - Presets::Endpoints::matter_root_node_preset(&rootNodeEndpointConfig); - Presets::Endpoints::matter_dimmable_light_preset(&dimmableLightEndpointConfig); - // Initial, root node on ep0, dimmable light on ep1 - node.addEndpoint(rootNodeEndpointConfig, Span(rootNodeDeviceTypes)); - node.addEndpoint(dimmableLightEndpointConfig, Span(dimmableLightDeviceTypes)); + node.addEndpoint(&Presets::Endpoints::matter_root_node_endpoint, Span(rootNodeDeviceTypes)); + node.addEndpoint(&Presets::Endpoints::matter_dimmable_light_endpoint, Span(dimmableLightDeviceTypes)); // Enable endpoints node.enableAllEndpoints(); @@ -98,7 +93,7 @@ static void example_matter_light_task(void *pvParameters) // Test add another dimmable light on ep2 chip::EndpointId testEndpointId; - testEndpointId = node.addEndpoint(dimmableLightEndpointConfig, Span(dimmableLightDeviceTypes)); + testEndpointId = node.addEndpoint(&Presets::Endpoints::matter_dimmable_light_endpoint, Span(dimmableLightDeviceTypes)); node.enableAllEndpoints(); vTaskDelay(20000); @@ -110,22 +105,6 @@ static void example_matter_light_task(void *pvParameters) vTaskDelete(NULL); } -// let new and delete operators use psram for more memory by overloading these operators -// remember to enable psram in rtl8721dhp_intfcfg.c -extern "C" void *Psram_reserve_malloc(int size); -extern "C" void Psram_reserve_free(void *ptr); - -void *operator new(size_t size) -{ - void* ptr = Psram_reserve_malloc(size); - return ptr; -} - -void operator delete(void *p) -{ - Psram_reserve_free(p); -} - extern "C" void example_matter_light(void) { if(xTaskCreate(example_matter_light_task, ((const char*)"example_matter_task_thread"), 2048, NULL, tskIDLE_PRIORITY + 1, NULL) != pdPASS) diff --git a/component/common/application/matter/project/amebad/make/chip/aircon_app/Makefile b/component/common/application/matter/project/amebad/make/chip/aircon_app/Makefile index f6ee0ef3..56647cab 100644 --- a/component/common/application/matter/project/amebad/make/chip/aircon_app/Makefile +++ b/component/common/application/matter/project/amebad/make/chip/aircon_app/Makefile @@ -55,6 +55,7 @@ GENERATE_NINJA: echo ameba_cpu = \"ameba\" >> $(OUTPUT_DIR)/args.gn && \ echo chip_inet_config_enable_ipv4 = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_enable_ota_requestor = "true" >> $(OUTPUT_DIR)/args.gn && \ + echo chip_build_libshell = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_support_enable_storage_api_audit = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_use_transitional_commissionable_data_provider = "true" >> $(OUTPUT_DIR)/args.gn && \ echo chip_logging = "true" >> $(OUTPUT_DIR)/args.gn && \ diff --git a/component/common/application/matter/project/amebad/make/chip/dishwasher_app/Makefile b/component/common/application/matter/project/amebad/make/chip/dishwasher_app/Makefile index 9cf7e90d..e4ecfeaf 100644 --- a/component/common/application/matter/project/amebad/make/chip/dishwasher_app/Makefile +++ b/component/common/application/matter/project/amebad/make/chip/dishwasher_app/Makefile @@ -55,6 +55,7 @@ GENERATE_NINJA: echo ameba_cpu = \"ameba\" >> $(OUTPUT_DIR)/args.gn && \ echo chip_inet_config_enable_ipv4 = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_enable_ota_requestor = "true" >> $(OUTPUT_DIR)/args.gn && \ + echo chip_build_libshell = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_support_enable_storage_api_audit = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_use_transitional_commissionable_data_provider = "true" >> $(OUTPUT_DIR)/args.gn && \ echo chip_logging = "true" >> $(OUTPUT_DIR)/args.gn && \ diff --git a/component/common/application/matter/project/amebad/make/chip/laundrywasher_app/Makefile b/component/common/application/matter/project/amebad/make/chip/laundrywasher_app/Makefile index 18fb9729..2637c754 100644 --- a/component/common/application/matter/project/amebad/make/chip/laundrywasher_app/Makefile +++ b/component/common/application/matter/project/amebad/make/chip/laundrywasher_app/Makefile @@ -55,6 +55,7 @@ GENERATE_NINJA: echo ameba_cpu = \"ameba\" >> $(OUTPUT_DIR)/args.gn && \ echo chip_inet_config_enable_ipv4 = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_enable_ota_requestor = "true" >> $(OUTPUT_DIR)/args.gn && \ + echo chip_build_libshell = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_support_enable_storage_api_audit = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_use_transitional_commissionable_data_provider = "true" >> $(OUTPUT_DIR)/args.gn && \ echo chip_logging = "true" >> $(OUTPUT_DIR)/args.gn && \ diff --git a/component/common/application/matter/project/amebad/make/chip/lighting_app/Makefile b/component/common/application/matter/project/amebad/make/chip/lighting_app/Makefile index de78b367..4d11d047 100644 --- a/component/common/application/matter/project/amebad/make/chip/lighting_app/Makefile +++ b/component/common/application/matter/project/amebad/make/chip/lighting_app/Makefile @@ -55,6 +55,7 @@ GENERATE_NINJA: echo ameba_cpu = \"ameba\" >> $(OUTPUT_DIR)/args.gn && \ echo chip_inet_config_enable_ipv4 = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_enable_ota_requestor = "true" >> $(OUTPUT_DIR)/args.gn && \ + echo chip_build_libshell = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_support_enable_storage_api_audit = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_use_transitional_commissionable_data_provider = "true" >> $(OUTPUT_DIR)/args.gn && \ echo chip_logging = "true" >> $(OUTPUT_DIR)/args.gn && \ diff --git a/component/common/application/matter/project/amebad/make/chip/refrigerator_app/Makefile b/component/common/application/matter/project/amebad/make/chip/refrigerator_app/Makefile index a0d010f1..909a3d7a 100644 --- a/component/common/application/matter/project/amebad/make/chip/refrigerator_app/Makefile +++ b/component/common/application/matter/project/amebad/make/chip/refrigerator_app/Makefile @@ -55,6 +55,7 @@ GENERATE_NINJA: echo ameba_cpu = \"ameba\" >> $(OUTPUT_DIR)/args.gn && \ echo chip_inet_config_enable_ipv4 = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_enable_ota_requestor = "true" >> $(OUTPUT_DIR)/args.gn && \ + echo chip_build_libshell = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_support_enable_storage_api_audit = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_use_transitional_commissionable_data_provider = "true" >> $(OUTPUT_DIR)/args.gn && \ echo chip_logging = "true" >> $(OUTPUT_DIR)/args.gn && \ diff --git a/component/common/application/matter/project/amebad/make/chip/thermostat_app/Makefile b/component/common/application/matter/project/amebad/make/chip/thermostat_app/Makefile index 9f2f962a..d1bf5a20 100644 --- a/component/common/application/matter/project/amebad/make/chip/thermostat_app/Makefile +++ b/component/common/application/matter/project/amebad/make/chip/thermostat_app/Makefile @@ -55,6 +55,7 @@ GENERATE_NINJA: echo ameba_cpu = \"ameba\" >> $(OUTPUT_DIR)/args.gn && \ echo chip_inet_config_enable_ipv4 = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_enable_ota_requestor = "true" >> $(OUTPUT_DIR)/args.gn && \ + echo chip_build_libshell = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_support_enable_storage_api_audit = "false" >> $(OUTPUT_DIR)/args.gn && \ echo chip_use_transitional_commissionable_data_provider = "true" >> $(OUTPUT_DIR)/args.gn && \ echo chip_logging = "true" >> $(OUTPUT_DIR)/args.gn && \ diff --git a/component/common/application/matter/project/amebad/make/chip_main/aircon_port/Makefile b/component/common/application/matter/project/amebad/make/chip_main/aircon_port/Makefile index 4d9f8639..ea72ca2f 100644 --- a/component/common/application/matter/project/amebad/make/chip_main/aircon_port/Makefile +++ b/component/common/application/matter/project/amebad/make/chip_main/aircon_port/Makefile @@ -30,6 +30,7 @@ OUTPUT_DIR = $(BASEDIR)/component/common/application/matter/example/aircon/build CODEGEN_DIR = $(OUTPUT_DIR)/codegen CHIP_ENABLE_OTA_REQUESTOR = $(shell grep 'chip_enable_ota_requestor' $(OUTPUT_DIR)/args.gn | cut -d' ' -f3) +CHIP_BUILD_LIBSHELL = $(shell grep 'chip_build_libshell' $(OUTPUT_DIR)/args.gn | cut -d' ' -f3) DIR = $(SRCDIR) DIR += $(CHIPDIR)/src/app @@ -37,6 +38,9 @@ DIR += $(CHIPDIR)/src/app/server DIR += $(CHIPDIR)/src/lib/dnssd/minimal_mdns/responders DIR += $(CHIPDIR)/examples/platform/ameba/ota DIR += $(CHIPDIR)/examples/platform/ameba/route_hook +ifeq ($(CHIP_BUILD_LIBSHELL), true) +DIR += $(CHIPDIR)/examples/platform/ameba/shell/ +endif DIR += $(CHIPDIR)/examples/providers DIR += $(CHIPDIR)/zzz_generated/app-common/app-common/zap-generated DIR += $(CHIPDIR)/zzz_generated/app-common/app-common/zap-generated/attributes @@ -56,6 +60,9 @@ vpath %.c $(DIR) $(shell find $(DIR) -type d) GLOBAL_CFLAGS += -DCHIP_PROJECT=1 GLOBAL_CFLAGS += -DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=\"lib/address_resolve/AddressResolve_DefaultImpl.h\" +ifeq ($(CHIP_BUILD_LIBSHELL), true) +GLOBAL_CFLAGS += -DCONFIG_ENABLE_CHIP_SHELL=1 +endif #*****************************************************************************# # Include FILE LIST # @@ -130,6 +137,11 @@ CSRC += $(CHIPDIR)/examples/platform/ameba/route_hook/ameba_route_table.c CPPSRC += $(BASEDIR)/component/common/application/matter/api/matter_api.cpp CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_core.cpp CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_interaction.cpp +ifeq ($(CHIP_BUILD_LIBSHELL), true) +CPPSRC += $(CHIPDIR)/examples/platform/ameba/shell/launch_shell.cpp +CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_prov.cpp +CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_control.cpp +endif ifeq ($(CHIP_ENABLE_OTA_REQUESTOR), true) CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_ota_initializer.cpp endif diff --git a/component/common/application/matter/project/amebad/make/chip_main/dishwasher_port/Makefile b/component/common/application/matter/project/amebad/make/chip_main/dishwasher_port/Makefile index 084c38d0..5027d3e7 100644 --- a/component/common/application/matter/project/amebad/make/chip_main/dishwasher_port/Makefile +++ b/component/common/application/matter/project/amebad/make/chip_main/dishwasher_port/Makefile @@ -30,6 +30,7 @@ OUTPUT_DIR = $(BASEDIR)/component/common/application/matter/example/dishwasher/b CODEGEN_DIR = $(OUTPUT_DIR)/codegen CHIP_ENABLE_OTA_REQUESTOR = $(shell grep 'chip_enable_ota_requestor' $(OUTPUT_DIR)/args.gn | cut -d' ' -f3) +CHIP_BUILD_LIBSHELL = $(shell grep 'chip_build_libshell' $(OUTPUT_DIR)/args.gn | cut -d' ' -f3) DIR = $(SRCDIR) DIR += $(CHIPDIR)/src/app @@ -39,6 +40,9 @@ DIR += $(CHIPDIR)/examples/all-clusters-app/ameba/main DIR += $(CHIPDIR)/src/lib/dnssd/minimal_mdns/responders DIR += $(CHIPDIR)/examples/platform/ameba/ota DIR += $(CHIPDIR)/examples/platform/ameba/route_hook +ifeq ($(CHIP_BUILD_LIBSHELL), true) +DIR += $(CHIPDIR)/examples/platform/ameba/shell/ +endif DIR += $(CHIPDIR)/examples/providers DIR += $(CHIPDIR)/zzz_generated/app-common/app-common/zap-generated DIR += $(CHIPDIR)/zzz_generated/app-common/app-common/zap-generated/attributes @@ -58,6 +62,9 @@ vpath %.c $(DIR) $(shell find $(DIR) -type d) GLOBAL_CFLAGS += -DCHIP_PROJECT=1 GLOBAL_CFLAGS += -DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=\"lib/address_resolve/AddressResolve_DefaultImpl.h\" +ifeq ($(CHIP_BUILD_LIBSHELL), true) +GLOBAL_CFLAGS += -DCONFIG_ENABLE_CHIP_SHELL=1 +endif #*****************************************************************************# # Include FILE LIST # @@ -136,6 +143,11 @@ CPPSRC += $(CHIPDIR)/examples/all-clusters-app/all-clusters-common/src/operation CPPSRC += $(BASEDIR)/component/common/application/matter/api/matter_api.cpp CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_core.cpp CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_interaction.cpp +ifeq ($(CHIP_BUILD_LIBSHELL), true) +CPPSRC += $(CHIPDIR)/examples/platform/ameba/shell/launch_shell.cpp +CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_prov.cpp +CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_control.cpp +endif ifeq ($(CHIP_ENABLE_OTA_REQUESTOR), true) CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_ota_initializer.cpp endif diff --git a/component/common/application/matter/project/amebad/make/chip_main/laundrywasher_port/Makefile b/component/common/application/matter/project/amebad/make/chip_main/laundrywasher_port/Makefile index 33c73547..f60ea0a3 100644 --- a/component/common/application/matter/project/amebad/make/chip_main/laundrywasher_port/Makefile +++ b/component/common/application/matter/project/amebad/make/chip_main/laundrywasher_port/Makefile @@ -30,6 +30,7 @@ OUTPUT_DIR = $(BASEDIR)/component/common/application/matter/example/laundrywashe CODEGEN_DIR = $(OUTPUT_DIR)/codegen CHIP_ENABLE_OTA_REQUESTOR = $(shell grep 'chip_enable_ota_requestor' $(OUTPUT_DIR)/args.gn | cut -d' ' -f3) +CHIP_BUILD_LIBSHELL = $(shell grep 'chip_build_libshell' $(OUTPUT_DIR)/args.gn | cut -d' ' -f3) DIR = $(SRCDIR) DIR += $(CHIPDIR)/src/app @@ -39,6 +40,9 @@ DIR += $(CHIPDIR)/examples/all-clusters-app/ameba/main DIR += $(CHIPDIR)/src/lib/dnssd/minimal_mdns/responders DIR += $(CHIPDIR)/examples/platform/ameba/ota DIR += $(CHIPDIR)/examples/platform/ameba/route_hook +ifeq ($(CHIP_BUILD_LIBSHELL), true) +DIR += $(CHIPDIR)/examples/platform/ameba/shell/ +endif DIR += $(CHIPDIR)/examples/providers DIR += $(CHIPDIR)/zzz_generated/app-common/app-common/zap-generated DIR += $(CHIPDIR)/zzz_generated/app-common/app-common/zap-generated/attributes @@ -58,6 +62,9 @@ vpath %.c $(DIR) $(shell find $(DIR) -type d) GLOBAL_CFLAGS += -DCHIP_PROJECT=1 GLOBAL_CFLAGS += -DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=\"lib/address_resolve/AddressResolve_DefaultImpl.h\" +ifeq ($(CHIP_BUILD_LIBSHELL), true) +GLOBAL_CFLAGS += -DCONFIG_ENABLE_CHIP_SHELL=1 +endif #*****************************************************************************# # Include FILE LIST # @@ -136,6 +143,11 @@ CPPSRC += $(CHIPDIR)/examples/all-clusters-app/all-clusters-common/src/operation CPPSRC += $(BASEDIR)/component/common/application/matter/api/matter_api.cpp CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_core.cpp CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_interaction.cpp +ifeq ($(CHIP_BUILD_LIBSHELL), true) +CPPSRC += $(CHIPDIR)/examples/platform/ameba/shell/launch_shell.cpp +CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_prov.cpp +CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_control.cpp +endif ifeq ($(CHIP_ENABLE_OTA_REQUESTOR), true) CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_ota_initializer.cpp endif diff --git a/component/common/application/matter/project/amebad/make/chip_main/light_switch_app/Makefile b/component/common/application/matter/project/amebad/make/chip_main/light_switch_app/Makefile index 79ec4baa..b8868123 100644 --- a/component/common/application/matter/project/amebad/make/chip_main/light_switch_app/Makefile +++ b/component/common/application/matter/project/amebad/make/chip_main/light_switch_app/Makefile @@ -173,11 +173,11 @@ $(STATIC_LIB):$(OBJS) # CLEAN GENERATED FILES # #*****************************************************************************# clean: - rm -f $(ROOTDIR)/make/chip_main/light-switch_app/*.o - rm -f $(ROOTDIR)/make/chip_main/light-switch_app/*.i - rm -f $(ROOTDIR)/make/chip_main/light-switch_app/*.s - rm -f $(ROOTDIR)/make/chip_main/light-switch_app/*.d - rm -f $(ROOTDIR)/make/chip_main/light-switch_app/*.ii - rm -f $(ROOTDIR)/make/chip_main/light-switch_app/*.su + rm -f $(ROOTDIR)/make/chip_main/light_switch_app/*.o + rm -f $(ROOTDIR)/make/chip_main/light_switch_app/*.i + rm -f $(ROOTDIR)/make/chip_main/light_switch_app/*.s + rm -f $(ROOTDIR)/make/chip_main/light_switch_app/*.d + rm -f $(ROOTDIR)/make/chip_main/light_switch_app/*.ii + rm -f $(ROOTDIR)/make/chip_main/light_switch_app/*.su -include $(DEPS) diff --git a/component/common/application/matter/project/amebad/make/chip_main/lighting_dm_app/Makefile b/component/common/application/matter/project/amebad/make/chip_main/lighting_dm_app/Makefile index d579186a..9e22969c 100644 --- a/component/common/application/matter/project/amebad/make/chip_main/lighting_dm_app/Makefile +++ b/component/common/application/matter/project/amebad/make/chip_main/lighting_dm_app/Makefile @@ -30,6 +30,7 @@ OUTPUT_DIR = $(CHIPDIR)/examples/lighting-app/ameba/build/chip CODEGEN_DIR = $(OUTPUT_DIR)/codegen CHIP_ENABLE_OTA_REQUESTOR = $(shell grep 'chip_enable_ota_requestor' $(OUTPUT_DIR)/args.gn | cut -d' ' -f3) +CHIP_BUILD_LIBSHELL = $(shell grep 'chip_build_libshell' $(OUTPUT_DIR)/args.gn | cut -d' ' -f3) DIR = $(SRCDIR) DIR += $(CHIPDIR)/src/app @@ -39,6 +40,9 @@ DIR += $(CHIPDIR)/examples/lighting-app/lighting-common DIR += $(CHIPDIR)/examples/lighting-app/ameba/main DIR += $(CHIPDIR)/examples/platform/ameba/ota DIR += $(CHIPDIR)/examples/platform/ameba/route_hook +ifeq ($(CHIP_BUILD_LIBSHELL), true) +DIR += $(CHIPDIR)/examples/platform/ameba/shell/ +endif DIR += $(CHIPDIR)/examples/providers DIR += $(CHIPDIR)/zzz_generated/lighting-app/zap-generated DIR += $(CHIPDIR)/zzz_generated/app-common/app-common/zap-generated @@ -59,6 +63,10 @@ vpath %.c $(DIR) $(shell find $(DIR) -type d) GLOBAL_CFLAGS += -DCHIP_PROJECT=1 GLOBAL_CFLAGS += -DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=\"lib/address_resolve/AddressResolve_DefaultImpl.h\" +ifeq ($(CHIP_BUILD_LIBSHELL), true) +GLOBAL_CFLAGS += -DCONFIG_ENABLE_CHIP_SHELL=1 +endif +GLOBAL_CFLAGS += -DCONFIG_USE_AMEBA_DATA_MODEL=1 #*****************************************************************************# # Include FILE LIST # @@ -139,6 +147,11 @@ CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_core.cpp CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_data_model.cpp CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_data_model_presets.cpp CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_interaction.cpp +ifeq ($(CHIP_BUILD_LIBSHELL), true) +CPPSRC += $(CHIPDIR)/examples/platform/ameba/shell/launch_shell.cpp +CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_prov.cpp +CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_control.cpp +endif ifeq ($(CHIP_ENABLE_OTA_REQUESTOR), true) CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_ota_initializer.cpp endif diff --git a/component/common/application/matter/project/amebad/make/chip_main/lighting_port/Makefile b/component/common/application/matter/project/amebad/make/chip_main/lighting_port/Makefile index 1f80d15b..06f0621d 100644 --- a/component/common/application/matter/project/amebad/make/chip_main/lighting_port/Makefile +++ b/component/common/application/matter/project/amebad/make/chip_main/lighting_port/Makefile @@ -30,6 +30,7 @@ OUTPUT_DIR = $(CHIPDIR)/examples/lighting-app/ameba/build/chip CODEGEN_DIR = $(OUTPUT_DIR)/codegen CHIP_ENABLE_OTA_REQUESTOR = $(shell grep 'chip_enable_ota_requestor' $(OUTPUT_DIR)/args.gn | cut -d' ' -f3) +CHIP_BUILD_LIBSHELL = $(shell grep 'chip_build_libshell' $(OUTPUT_DIR)/args.gn | cut -d' ' -f3) DIR = $(SRCDIR) DIR += $(CHIPDIR)/src/app @@ -39,6 +40,9 @@ DIR += $(CHIPDIR)/examples/lighting-app/lighting-common DIR += $(CHIPDIR)/examples/lighting-app/ameba/main DIR += $(CHIPDIR)/examples/platform/ameba/ota DIR += $(CHIPDIR)/examples/platform/ameba/route_hook +ifeq ($(CHIP_BUILD_LIBSHELL), true) +DIR += $(CHIPDIR)/examples/platform/ameba/shell/ +endif DIR += $(CHIPDIR)/examples/providers DIR += $(CHIPDIR)/zzz_generated/lighting-app/zap-generated DIR += $(CHIPDIR)/zzz_generated/app-common/app-common/zap-generated @@ -59,6 +63,9 @@ vpath %.c $(DIR) $(shell find $(DIR) -type d) GLOBAL_CFLAGS += -DCHIP_PROJECT=1 GLOBAL_CFLAGS += -DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=\"lib/address_resolve/AddressResolve_DefaultImpl.h\" +ifeq ($(CHIP_BUILD_LIBSHELL), true) +GLOBAL_CFLAGS += -DCONFIG_ENABLE_CHIP_SHELL=1 +endif #*****************************************************************************# # Include FILE LIST # @@ -137,6 +144,11 @@ CSRC += $(CHIPDIR)/examples/platform/ameba/route_hook/ameba_route_table.c CPPSRC += $(BASEDIR)/component/common/application/matter/api/matter_api.cpp CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_core.cpp CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_interaction.cpp +ifeq ($(CHIP_BUILD_LIBSHELL), true) +CPPSRC += $(CHIPDIR)/examples/platform/ameba/shell/launch_shell.cpp +CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_prov.cpp +CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_control.cpp +endif ifeq ($(CHIP_ENABLE_OTA_REQUESTOR), true) CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_ota_initializer.cpp endif diff --git a/component/common/application/matter/project/amebad/make/chip_main/refrigerator_port/Makefile b/component/common/application/matter/project/amebad/make/chip_main/refrigerator_port/Makefile index 04724033..3ea9c2a5 100644 --- a/component/common/application/matter/project/amebad/make/chip_main/refrigerator_port/Makefile +++ b/component/common/application/matter/project/amebad/make/chip_main/refrigerator_port/Makefile @@ -30,6 +30,7 @@ OUTPUT_DIR = $(CHIPDIR)/examples/refrigerator-app/ameba/build/chip CODEGEN_DIR = $(OUTPUT_DIR)/codegen CHIP_ENABLE_OTA_REQUESTOR = $(shell grep 'chip_enable_ota_requestor' $(OUTPUT_DIR)/args.gn | cut -d' ' -f3) +CHIP_BUILD_LIBSHELL = $(shell grep 'chip_build_libshell' $(OUTPUT_DIR)/args.gn | cut -d' ' -f3) DIR = $(SRCDIR) DIR += $(CHIPDIR)/src/app @@ -39,6 +40,9 @@ DIR += $(CHIPDIR)/examples/refrigerator-app/refrigerator-common DIR += $(CHIPDIR)/examples/refrigerator-app/ameba/main DIR += $(CHIPDIR)/examples/platform/ameba/ota DIR += $(CHIPDIR)/examples/platform/ameba/route_hook +ifeq ($(CHIP_BUILD_LIBSHELL), true) +DIR += $(CHIPDIR)/examples/platform/ameba/shell/ +endif DIR += $(CHIPDIR)/examples/providers DIR += $(CHIPDIR)/zzz_generated/refrigerator-app/zap-generated DIR += $(CHIPDIR)/zzz_generated/app-common/app-common/zap-generated @@ -59,6 +63,9 @@ vpath %.c $(DIR) $(shell find $(DIR) -type d) GLOBAL_CFLAGS += -DCHIP_PROJECT=1 GLOBAL_CFLAGS += -DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=\"lib/address_resolve/AddressResolve_DefaultImpl.h\" +ifeq ($(CHIP_BUILD_LIBSHELL), true) +GLOBAL_CFLAGS += -DCONFIG_ENABLE_CHIP_SHELL=1 +endif #*****************************************************************************# # Include FILE LIST # @@ -137,6 +144,11 @@ CSRC += $(CHIPDIR)/examples/platform/ameba/route_hook/ameba_route_table.c CPPSRC += $(BASEDIR)/component/common/application/matter/api/matter_api.cpp CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_core.cpp CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_interaction.cpp +ifeq ($(CHIP_BUILD_LIBSHELL), true) +CPPSRC += $(CHIPDIR)/examples/platform/ameba/shell/launch_shell.cpp +CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_prov.cpp +CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_control.cpp +endif ifeq ($(CHIP_ENABLE_OTA_REQUESTOR), true) CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_ota_initializer.cpp endif diff --git a/component/common/application/matter/project/amebad/make/chip_main/thermostat_port/Makefile b/component/common/application/matter/project/amebad/make/chip_main/thermostat_port/Makefile index d1e04cc7..19f0474f 100644 --- a/component/common/application/matter/project/amebad/make/chip_main/thermostat_port/Makefile +++ b/component/common/application/matter/project/amebad/make/chip_main/thermostat_port/Makefile @@ -30,6 +30,7 @@ OUTPUT_DIR = $(CHIPDIR)/examples/thermostat/ameba/build/chip CODEGEN_DIR = $(OUTPUT_DIR)/codegen CHIP_ENABLE_OTA_REQUESTOR = $(shell grep 'chip_enable_ota_requestor' $(OUTPUT_DIR)/args.gn | cut -d' ' -f3) +CHIP_BUILD_LIBSHELL = $(shell grep 'chip_build_libshell' $(OUTPUT_DIR)/args.gn | cut -d' ' -f3) DIR = $(SRCDIR) DIR += $(CHIPDIR)/src/app @@ -39,6 +40,9 @@ DIR += $(CHIPDIR)/examples/thermostat/thermostat-common DIR += $(CHIPDIR)/examples/thermostat/ameba/main DIR += $(CHIPDIR)/examples/platform/ameba/ota DIR += $(CHIPDIR)/examples/platform/ameba/route_hook +ifeq ($(CHIP_BUILD_LIBSHELL), true) +DIR += $(CHIPDIR)/examples/platform/ameba/shell/ +endif DIR += $(CHIPDIR)/examples/providers DIR += $(CHIPDIR)/zzz_generated/thermostat/zap-generated DIR += $(CHIPDIR)/zzz_generated/app-common/app-common/zap-generated @@ -59,6 +63,9 @@ vpath %.c $(DIR) $(shell find $(DIR) -type d) GLOBAL_CFLAGS += -DCHIP_PROJECT=1 GLOBAL_CFLAGS += -DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=\"lib/address_resolve/AddressResolve_DefaultImpl.h\" +ifeq ($(CHIP_BUILD_LIBSHELL), true) +GLOBAL_CFLAGS += -DCONFIG_ENABLE_CHIP_SHELL=1 +endif #*****************************************************************************# # Include FILE LIST # @@ -137,6 +144,11 @@ CSRC += $(CHIPDIR)/examples/platform/ameba/route_hook/ameba_route_table.c CPPSRC += $(BASEDIR)/component/common/application/matter/api/matter_api.cpp CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_core.cpp CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_interaction.cpp +ifeq ($(CHIP_BUILD_LIBSHELL), true) +CPPSRC += $(CHIPDIR)/examples/platform/ameba/shell/launch_shell.cpp +CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_prov.cpp +CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_control.cpp +endif ifeq ($(CHIP_ENABLE_OTA_REQUESTOR), true) CPPSRC += $(BASEDIR)/component/common/application/matter/core/matter_ota_initializer.cpp endif