From d0b5d232902e891a672a8c9329cb6b58962dc305 Mon Sep 17 00:00:00 2001 From: Rohit Jadhav Date: Tue, 6 Aug 2024 16:46:50 +0530 Subject: [PATCH] Example changes --- .../src/occupancy-sensing-stub.cpp | 2 +- .../all-clusters-app/ameba/main/chipinterface.cpp | 3 +++ examples/all-clusters-app/asr/src/AppTask.cpp | 3 +++ .../all-clusters-app/cc13x4_26x4/main/AppTask.cpp | 3 +++ examples/all-clusters-app/esp32/main/CMakeLists.txt | 6 +----- examples/all-clusters-app/esp32/main/main.cpp | 11 +++-------- .../all-clusters-app/infineon/psoc6/src/AppTask.cpp | 3 +++ examples/all-clusters-app/linux/main-common.cpp | 1 - examples/all-clusters-app/mbed/main/AppTask.cpp | 5 ++++- examples/all-clusters-app/nrfconnect/main/AppTask.cpp | 3 +++ examples/all-clusters-app/nxp/mw320/main.cpp | 3 +++ examples/all-clusters-app/telink/src/AppTask.cpp | 3 +++ examples/all-clusters-app/tizen/src/main.cpp | 3 +++ .../ameba/main/chipinterface.cpp | 3 +++ examples/all-clusters-minimal-app/asr/src/AppTask.cpp | 3 +++ examples/all-clusters-minimal-app/esp32/main/main.cpp | 3 +++ .../infineon/psoc6/src/AppTask.cpp | 3 +++ .../all-clusters-minimal-app/linux/main-common.cpp | 7 ++++++- .../all-clusters-minimal-app/mbed/main/AppTask.cpp | 3 +++ .../nrfconnect/main/AppTask.cpp | 3 +++ .../all-clusters-minimal-app/telink/src/AppTask.cpp | 3 +++ examples/all-clusters-minimal-app/tizen/src/main.cpp | 3 +++ .../linux/include/static-supported-modes-manager.h | 8 +------- .../linux/static-supported-modes-manager.cpp | 7 ------- .../mode-support/static-supported-modes-manager.cpp | 7 ------- .../mode-support/static-supported-modes-manager.h | 8 +------- examples/shell/cc13x4_26x4/main/AppTask.cpp | 3 +++ 27 files changed, 68 insertions(+), 45 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/src/occupancy-sensing-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/occupancy-sensing-stub.cpp index dcbb90ff659bcb..ebc8780813cb3b 100644 --- a/examples/all-clusters-app/all-clusters-common/src/occupancy-sensing-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/occupancy-sensing-stub.cpp @@ -29,7 +29,7 @@ using namespace chip::DeviceLayer; using chip::Protocols::InteractionModel::Status; static std::unique_ptr - gAttrAccess[MATTER_DM_OCCUPANCY_SENSING_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT]; + gAttrAccess[MATTER_DM_OCCUPANCY_SENSING_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT + 1]; void emberAfOccupancySensingClusterInitCallback(EndpointId endpointId) { diff --git a/examples/all-clusters-app/ameba/main/chipinterface.cpp b/examples/all-clusters-app/ameba/main/chipinterface.cpp index 2a35d86eadc3a2..99ed719f0fab28 100644 --- a/examples/all-clusters-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-app/ameba/main/chipinterface.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #if CONFIG_ENABLE_AMEBA_TEST_EVENT_TRIGGER @@ -77,6 +78,7 @@ app::Clusters::NetworkCommissioning::Instance &(NetworkCommissioning::AmebaWiFiDriver::GetInstance())); app::Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupportedTemperatureLevelsDelegate; +Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; } // namespace void NetWorkCommissioningInstInit() @@ -181,6 +183,7 @@ static void InitServer(intptr_t context) InitManualOperation(); #endif app::Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate); + Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); MatterMicrowaveOvenServerInit(); #if CONFIG_ENABLE_AMEBA_TEST_EVENT_TRIGGER static SmokeCOTestEventTriggerHandler sSmokeCOTestEventTriggerHandler; diff --git a/examples/all-clusters-app/asr/src/AppTask.cpp b/examples/all-clusters-app/asr/src/AppTask.cpp index 1a829ca3de1798..ef3c86d2720436 100644 --- a/examples/all-clusters-app/asr/src/AppTask.cpp +++ b/examples/all-clusters-app/asr/src/AppTask.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include using chip::Protocols::InteractionModel::Status; @@ -66,6 +67,7 @@ app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(kNetworkCommissioningEndpointMain /* Endpoint Id */, &(NetworkCommissioning::ASRWiFiDriver::GetInstance())); app::Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupportedTemperatureLevelsDelegate; +app::Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; } // namespace AppTask AppTask::sAppTask; @@ -131,6 +133,7 @@ CHIP_ERROR AppTask::Init() #endif /* CONFIG_NETWORK_LAYER_BLE */ app::Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate); + app::Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); return CHIP_NO_ERROR; } diff --git a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp index 88099f009f2dac..c9a54347657c3d 100644 --- a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp @@ -49,6 +49,7 @@ #include #include +#include #include #include @@ -73,6 +74,7 @@ static Button_Handle sAppRightHandle; static DeviceInfoProviderImpl sExampleDeviceInfoProvider; AppTask AppTask::sAppTask; +app::Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; @@ -334,6 +336,7 @@ int AppTask::Init() // QR code will be used with CHIP Tool PrintOnboardingCodes(RendezvousInformationFlags(RendezvousInformationFlag::kBLE)); + app::Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); return 0; } diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 7fd1d548609257..4faa40de15332b 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -34,7 +34,6 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/mode-support" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd/server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util" @@ -106,8 +105,6 @@ set(SRC_DIRS_LIST ) -set(EXCLUDE_SRCS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp") - if (CONFIG_ENABLE_PW_RPC) # Append additional directories for RPC build set(PRIV_INCLUDE_DIRS_LIST "${PRIV_INCLUDE_DIRS_LIST}" @@ -137,8 +134,7 @@ if (CONFIG_ENABLE_ICD_SERVER) endif() idf_component_register(PRIV_INCLUDE_DIRS ${PRIV_INCLUDE_DIRS_LIST} - SRC_DIRS ${SRC_DIRS_LIST} - EXCLUDE_SRCS ${EXCLUDE_SRCS}) + SRC_DIRS ${SRC_DIRS_LIST}) get_filename_component(CHIP_ROOT ${CMAKE_SOURCE_DIR}/third_party/connectedhomeip REALPATH) diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index af94d2b2d36afe..6a0d0d389a92e2 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -41,8 +41,8 @@ #include #include #include -#include #include +#include #include #if CONFIG_HAVE_DISPLAY @@ -95,6 +95,7 @@ class AppCallbacks : public AppDelegate AppCallbacks sCallbacks; app::Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupportedTemperatureLevelsDelegate; +app::Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; @@ -122,15 +123,9 @@ static void InitServer(intptr_t context) #if CONFIG_DEVICE_TYPE_M5STACK SetupPretendDevices(); #endif - CHIP_ERROR err = - app::Clusters::ModeSelect::StaticSupportedModesManager::getStaticSupportedModesManagerInstance().InitEndpointArray( - FIXED_ENDPOINT_COUNT); - if (err != CHIP_NO_ERROR) - { - ESP_LOGE(TAG, "Failed to initialize endpoint array for supported-modes, err:%" CHIP_ERROR_FORMAT, err.Format()); - } app::Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate); + app::Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); } // #include diff --git a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp index 143e25e87e0114..46b3a2fbf158e8 100644 --- a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include /* OTA related includes */ @@ -98,6 +99,7 @@ OTAImageProcessorImpl gImageProcessor; #endif chip::app::Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupportedTemperatureLevelsDelegate; +app::Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; } // namespace using namespace ::chip; @@ -141,6 +143,7 @@ static void InitServer(intptr_t context) GetAppTask().InitOTARequestor(); #endif chip::app::Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate); + app::Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); } CHIP_ERROR AppTask::StartAppTask() diff --git a/examples/all-clusters-app/linux/main-common.cpp b/examples/all-clusters-app/linux/main-common.cpp index d1ef91fba2ab89..badda7f3b68b40 100644 --- a/examples/all-clusters-app/linux/main-common.cpp +++ b/examples/all-clusters-app/linux/main-common.cpp @@ -249,7 +249,6 @@ void ApplicationInit() #endif Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate); Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); - ; Clusters::ValveConfigurationAndControl::SetDefaultDelegate(chip::EndpointId(1), &sValveDelegate); Clusters::TimeSynchronization::SetDefaultDelegate(&sTimeSyncDelegate); diff --git a/examples/all-clusters-app/mbed/main/AppTask.cpp b/examples/all-clusters-app/mbed/main/AppTask.cpp index b497ea7919a0a3..f67876b1da5b57 100644 --- a/examples/all-clusters-app/mbed/main/AppTask.cpp +++ b/examples/all-clusters-app/mbed/main/AppTask.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -45,7 +46,8 @@ using namespace ::chip::Credentials; namespace { app::Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupportedTemperatureLevelsDelegate; -} +app::Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; +} // namespace AppTask AppTask::sAppTask; @@ -90,6 +92,7 @@ int AppTask::Init() return EXIT_FAILURE; } app::Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate); + app::Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); return 0; } diff --git a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp index 3551087a969411..067e8113c4138a 100644 --- a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp @@ -35,6 +35,7 @@ #include #include +#include #include #ifdef CONFIG_CHIP_WIFI @@ -95,6 +96,7 @@ bool sIsNetworkEnabled = false; bool sHaveBLEConnections = false; app::Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupportedTemperatureLevelsDelegate; +app::Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; #ifdef CONFIG_CHIP_CRYPTO_PSA chip::Crypto::PSAOperationalKeystore sPSAOperationalKeystore{}; @@ -257,6 +259,7 @@ CHIP_ERROR AppTask::Init() } app::Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate); + app::Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); return err; } diff --git a/examples/all-clusters-app/nxp/mw320/main.cpp b/examples/all-clusters-app/nxp/mw320/main.cpp index 5f2df7b501e88d..82d335cccbb6b3 100644 --- a/examples/all-clusters-app/nxp/mw320/main.cpp +++ b/examples/all-clusters-app/nxp/mw320/main.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -121,6 +122,7 @@ static struct wlan_network sta_network; static struct wlan_network uap_network; chip::app::Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupportedTemperatureLevelsDelegate; +chip::app::Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; const int TASK_MAIN_PRIO = OS_PRIO_3; const int TASK_MAIN_STACK_SIZE = 800; @@ -1083,6 +1085,7 @@ static void run_chip_srv(System::Layer * aSystemLayer, void * aAppState) // binding -- chip::app::Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate); + chip::app::Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); return; } diff --git a/examples/all-clusters-app/telink/src/AppTask.cpp b/examples/all-clusters-app/telink/src/AppTask.cpp index 03b81fb434a8ef..909f89af2236ab 100644 --- a/examples/all-clusters-app/telink/src/AppTask.cpp +++ b/examples/all-clusters-app/telink/src/AppTask.cpp @@ -18,10 +18,12 @@ #include "AppTask.h" #include "binding-handler.h" +#include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); AppTask AppTask::sAppTask; +chip::app::Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; CHIP_ERROR AppTask::Init(void) { @@ -35,5 +37,6 @@ CHIP_ERROR AppTask::Init(void) return err; } + chip::app::Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); return CHIP_NO_ERROR; } diff --git a/examples/all-clusters-app/tizen/src/main.cpp b/examples/all-clusters-app/tizen/src/main.cpp index 49c9f06ad9b8f6..191138c1f32424 100644 --- a/examples/all-clusters-app/tizen/src/main.cpp +++ b/examples/all-clusters-app/tizen/src/main.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -40,6 +41,7 @@ NetworkCommissioning::TizenEthernetDriver sEthernetDriver; Clusters::NetworkCommissioning::Instance sEthernetNetworkCommissioningInstance(kNetworkCommissioningEndpointMain, &sEthernetDriver); app::Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupportedTemperatureLevelsDelegate; +Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; } // namespace void ApplicationInit() @@ -49,6 +51,7 @@ void ApplicationInit() sEthernetNetworkCommissioningInstance.Init(); app::Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate); + Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); } void ApplicationShutdown() {} diff --git a/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp b/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp index abb0791ac9a132..61f7db147f807d 100644 --- a/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #if CONFIG_ENABLE_OTA_REQUESTOR @@ -64,6 +65,7 @@ namespace { // Network Commissioning constexpr EndpointId kNetworkCommissioningEndpointMain = 0; constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; +Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(kNetworkCommissioningEndpointMain /* Endpoint Id */, &(NetworkCommissioning::AmebaWiFiDriver::GetInstance())); @@ -170,6 +172,7 @@ static void InitServer(intptr_t context) // QR code will be used with CHIP Tool PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); } + Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); } extern "C" void ChipTest(void) diff --git a/examples/all-clusters-minimal-app/asr/src/AppTask.cpp b/examples/all-clusters-minimal-app/asr/src/AppTask.cpp index f9d05c2157382d..7e33211b8a978b 100644 --- a/examples/all-clusters-minimal-app/asr/src/AppTask.cpp +++ b/examples/all-clusters-minimal-app/asr/src/AppTask.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include "init_Matter.h" #include "lega_rtos_api.h" @@ -60,6 +61,7 @@ QueueHandle_t sAppEventQueue; constexpr EndpointId kNetworkCommissioningEndpointMain = 0; constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; +app::Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(kNetworkCommissioningEndpointMain /* Endpoint Id */, &(NetworkCommissioning::ASRWiFiDriver::GetInstance())); @@ -120,6 +122,7 @@ CHIP_ERROR AppTask::Init() sLightLED.Init(LIGHT_LED); + app::Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); return CHIP_NO_ERROR; } diff --git a/examples/all-clusters-minimal-app/esp32/main/main.cpp b/examples/all-clusters-minimal-app/esp32/main/main.cpp index 993dc609300943..4972e775bd6f31 100644 --- a/examples/all-clusters-minimal-app/esp32/main/main.cpp +++ b/examples/all-clusters-minimal-app/esp32/main/main.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #if CONFIG_HAVE_DISPLAY #include "DeviceWithDisplay.h" @@ -74,6 +75,7 @@ extern const char TAG[] = "all-clusters-minimal-app"; static AppDeviceCallbacks EchoCallbacks; static AppDeviceCallbacksDelegate sAppDeviceCallbacksDelegate; +app::Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; namespace { class AppCallbacks : public AppDelegate @@ -116,6 +118,7 @@ static void InitServer(intptr_t context) #if CONFIG_DEVICE_TYPE_M5STACK SetupPretendDevices(); #endif + app::Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); } extern "C" void app_main() diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp b/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp index 169b2f88acb7ab..27d47515d4cd10 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp @@ -41,6 +41,7 @@ #include #include #include +#include /* OTA related includes */ #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR @@ -87,6 +88,7 @@ StaticQueue_t sAppEventQueueStruct; StackType_t appStack[APP_TASK_STACK_SIZE / sizeof(StackType_t)]; StaticTask_t appTaskStruct; +app::Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR DefaultOTARequestor gRequestorCore; @@ -138,6 +140,7 @@ static void InitServer(intptr_t context) #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR GetAppTask().InitOTARequestor(); #endif + app::Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); } CHIP_ERROR AppTask::StartAppTask() diff --git a/examples/all-clusters-minimal-app/linux/main-common.cpp b/examples/all-clusters-minimal-app/linux/main-common.cpp index f0bf3cafe8553c..d99927cea0487e 100644 --- a/examples/all-clusters-minimal-app/linux/main-common.cpp +++ b/examples/all-clusters-minimal-app/linux/main-common.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -37,6 +38,7 @@ using namespace chip::DeviceLayer; namespace { static LowPowerManager lowPowerManager; +Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; } // namespace void OnIdentifyStart(::Identify *) @@ -81,7 +83,10 @@ static Identify gIdentify1 = { OnTriggerEffect, }; -void ApplicationInit() {} +void ApplicationInit() +{ + Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); +} void ApplicationShutdown() {} diff --git a/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp b/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp index 62317774c1520c..eb1188b93aa759 100644 --- a/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp @@ -27,6 +27,7 @@ #include #include +#include static LEDWidget sStatusLED(MBED_CONF_APP_SYSTEM_STATE_LED); @@ -43,6 +44,7 @@ using namespace ::chip::DeviceLayer; using namespace ::chip::Credentials; AppTask AppTask::sAppTask; +app::Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; int AppTask::Init() { @@ -85,6 +87,7 @@ int AppTask::Init() return EXIT_FAILURE; } + app::Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); return 0; } diff --git a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp index 86bfe7a9aa132b..be858eae561921 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp @@ -30,6 +30,7 @@ #include #include +#include #if CONFIG_CHIP_OTA_REQUESTOR #include "OTAUtil.h" @@ -63,6 +64,7 @@ static k_timer sFunctionTimer; LEDWidget sStatusLED; FactoryResetLEDsWrapper<3> sFactoryResetLEDs{ { FACTORY_RESET_SIGNAL_LED, FACTORY_RESET_SIGNAL_LED1, FACTORY_RESET_SIGNAL_LED2 } }; +app::Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; bool sIsNetworkProvisioned = false; bool sIsNetworkEnabled = false; @@ -198,6 +200,7 @@ CHIP_ERROR AppTask::Init() { LOG_ERR("PlatformMgr().StartEventLoopTask() failed"); } + app::Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); return err; } diff --git a/examples/all-clusters-minimal-app/telink/src/AppTask.cpp b/examples/all-clusters-minimal-app/telink/src/AppTask.cpp index 55d46154f98fad..ee78fddf5b3d94 100644 --- a/examples/all-clusters-minimal-app/telink/src/AppTask.cpp +++ b/examples/all-clusters-minimal-app/telink/src/AppTask.cpp @@ -18,10 +18,12 @@ #include "AppTask.h" #include "binding-handler.h" +#include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); AppTask AppTask::sAppTask; +chip::app::Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; CHIP_ERROR AppTask::Init() { @@ -35,5 +37,6 @@ CHIP_ERROR AppTask::Init() return err; } + chip::app::Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); return CHIP_NO_ERROR; } diff --git a/examples/all-clusters-minimal-app/tizen/src/main.cpp b/examples/all-clusters-minimal-app/tizen/src/main.cpp index fd2a345c952dd8..2d37747fe82c12 100644 --- a/examples/all-clusters-minimal-app/tizen/src/main.cpp +++ b/examples/all-clusters-minimal-app/tizen/src/main.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -36,6 +37,7 @@ constexpr EndpointId kNetworkCommissioningEndpointMain = 0; constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; NetworkCommissioning::TizenEthernetDriver sEthernetDriver; +Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; Clusters::NetworkCommissioning::Instance sEthernetNetworkCommissioningInstance(kNetworkCommissioningEndpointMain, &sEthernetDriver); } // namespace @@ -45,6 +47,7 @@ void ApplicationInit() emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false); sEthernetNetworkCommissioningInstance.Init(); + Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); } void ApplicationShutdown(){}; diff --git a/examples/placeholder/linux/include/static-supported-modes-manager.h b/examples/placeholder/linux/include/static-supported-modes-manager.h index b4ce50b8cd49a3..168482e0303704 100644 --- a/examples/placeholder/linux/include/static-supported-modes-manager.h +++ b/examples/placeholder/linux/include/static-supported-modes-manager.h @@ -31,7 +31,7 @@ namespace ModeSelect { * This implementation statically defines the options. */ -class StaticSupportedModesManager : public chip::app::Clusters::ModeSelect::SupportedModesManager +class StaticSupportedModesManager : public SupportedModesManager { using ModeOptionStructType = Structs::ModeOptionStruct::Type; using storage_value_type = const ModeOptionStructType; @@ -52,8 +52,6 @@ class StaticSupportedModesManager : public chip::app::Clusters::ModeSelect::Supp static const EndpointSpanPair supportedOptionsByEndpoints[MATTER_DM_MODE_SELECT_CLUSTER_SERVER_ENDPOINT_COUNT]; public: - static const StaticSupportedModesManager instance; - SupportedModesManager::ModeOptionsProvider getModeOptionsProvider(EndpointId endpointId) const override; Protocols::InteractionModel::Status getModeOptionByMode(EndpointId endpointId, uint8_t mode, @@ -62,12 +60,8 @@ class StaticSupportedModesManager : public chip::app::Clusters::ModeSelect::Supp ~StaticSupportedModesManager(){}; StaticSupportedModesManager() {} - - static inline const StaticSupportedModesManager & getStaticSupportedModesManagerInstance() { return instance; } }; -const SupportedModesManager * getSupportedModesManager(); - } // namespace ModeSelect } // namespace Clusters } // namespace app diff --git a/examples/placeholder/linux/static-supported-modes-manager.cpp b/examples/placeholder/linux/static-supported-modes-manager.cpp index 4060d4be85ec9c..94345600cf53fd 100644 --- a/examples/placeholder/linux/static-supported-modes-manager.cpp +++ b/examples/placeholder/linux/static-supported-modes-manager.cpp @@ -39,8 +39,6 @@ const StaticSupportedModesManager::EndpointSpanPair EndpointSpanPair(1, Span(StaticSupportedModesManager::coffeeOptions)) // Options for Endpoint 1 }; -const StaticSupportedModesManager StaticSupportedModesManager::instance = StaticSupportedModesManager(); - SupportedModesManager::ModeOptionsProvider StaticSupportedModesManager::getModeOptionsProvider(EndpointId endpointId) const { for (auto & endpointSpanPair : supportedOptionsByEndpoints) @@ -76,8 +74,3 @@ Status StaticSupportedModesManager::getModeOptionByMode(unsigned short endpointI ChipLogProgress(Zcl, "Cannot find the mode %u", mode); return Status::InvalidCommand; } - -const ModeSelect::SupportedModesManager * ModeSelect::getSupportedModesManager() -{ - return &StaticSupportedModesManager::instance; -} diff --git a/examples/platform/esp32/mode-support/static-supported-modes-manager.cpp b/examples/platform/esp32/mode-support/static-supported-modes-manager.cpp index d06a8b8b7dc809..fc9a94cbb307c4 100644 --- a/examples/platform/esp32/mode-support/static-supported-modes-manager.cpp +++ b/examples/platform/esp32/mode-support/static-supported-modes-manager.cpp @@ -33,8 +33,6 @@ using List = app::DataModel::List; SupportedModesManager::ModeOptionsProvider * StaticSupportedModesManager::epModeOptionsProviderList = nullptr; -const StaticSupportedModesManager StaticSupportedModesManager::instance = StaticSupportedModesManager(); - int StaticSupportedModesManager::mSize = 0; CHIP_ERROR StaticSupportedModesManager::InitEndpointArray(int size) @@ -194,11 +192,6 @@ Status StaticSupportedModesManager::getModeOptionByMode(unsigned short endpointI return Status::InvalidCommand; } -const ModeSelect::SupportedModesManager * ModeSelect::getSupportedModesManager() -{ - return &StaticSupportedModesManager::getStaticSupportedModesManagerInstance(); -} - void StaticSupportedModesManager::FreeSupportedModes(EndpointId endpointId) const { if (epModeOptionsProviderList[endpointId].begin() != nullptr) diff --git a/examples/platform/esp32/mode-support/static-supported-modes-manager.h b/examples/platform/esp32/mode-support/static-supported-modes-manager.h index 8d6bb3c665ff0c..658b25625471c5 100644 --- a/examples/platform/esp32/mode-support/static-supported-modes-manager.h +++ b/examples/platform/esp32/mode-support/static-supported-modes-manager.h @@ -25,7 +25,7 @@ namespace app { namespace Clusters { namespace ModeSelect { -class StaticSupportedModesManager : public chip::app::Clusters::ModeSelect::SupportedModesManager +class StaticSupportedModesManager : public SupportedModesManager { private: using ModeOptionStructType = Structs::ModeOptionStruct::Type; @@ -36,8 +36,6 @@ class StaticSupportedModesManager : public chip::app::Clusters::ModeSelect::Supp void FreeSupportedModes(EndpointId endpointId) const; - static const StaticSupportedModesManager instance; - public: // InitEndpointArray should be called only once in the application. Memory allocated to the // epModeOptionsProviderList will be needed for the lifetime of the program, so it's never deallocated. @@ -68,12 +66,8 @@ class StaticSupportedModesManager : public chip::app::Clusters::ModeSelect::Supp FreeSupportedModes(i); } } - - static inline const StaticSupportedModesManager & getStaticSupportedModesManagerInstance() { return instance; } }; -const SupportedModesManager * getSupportedModesManager(); - } // namespace ModeSelect } // namespace Clusters } // namespace app diff --git a/examples/shell/cc13x4_26x4/main/AppTask.cpp b/examples/shell/cc13x4_26x4/main/AppTask.cpp index 86432279d5c8ad..3f5ff1e659126c 100644 --- a/examples/shell/cc13x4_26x4/main/AppTask.cpp +++ b/examples/shell/cc13x4_26x4/main/AppTask.cpp @@ -41,6 +41,7 @@ #include #include +#include /* syscfg */ #include @@ -54,6 +55,7 @@ using namespace ::chip::DeviceLayer; using chip::Shell::Engine; AppTask AppTask::sAppTask; +Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; static TaskHandle_t sAppTaskHandle; @@ -171,6 +173,7 @@ CHIP_ERROR AppTask::Init() #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR InitializeOTARequestor(); #endif + Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); return err; }