From 8ab54be7f770e4680e246ee0c4ecfe1a591ae01f Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Thu, 27 Jul 2023 18:09:34 -0400 Subject: [PATCH 1/9] Moved the default report scheduler to the application code and added a pointer to a report scheduler in ServerInitParams so it gets injected --- .../ameba/main/chipinterface.cpp | 6 ++ .../cc13x2x7_26x2x7/main/AppTask.cpp | 6 ++ .../cc13x4_26x4/main/AppTask.cpp | 6 ++ .../infineon/psoc6/src/AppTask.cpp | 6 ++ .../all-clusters-app/linux/fuzzing-main.cpp | 6 ++ .../all-clusters-app/mbed/main/AppTask.cpp | 6 ++ .../nrfconnect/main/AppTask.cpp | 6 ++ examples/all-clusters-app/nxp/mw320/main.cpp | 6 ++ .../ameba/main/chipinterface.cpp | 6 ++ .../infineon/psoc6/src/AppTask.cpp | 13 +++-- .../linux/fuzzing-main.cpp | 6 ++ .../mbed/main/AppTask.cpp | 6 ++ .../nrfconnect/main/AppTask.cpp | 6 ++ examples/bridge-app/linux/main.cpp | 6 ++ examples/chef/ameba/main/chipinterface.cpp | 6 ++ examples/chef/esp32/main/main.cpp | 6 ++ examples/chef/nrfconnect/main.cpp | 6 ++ .../nxp/k32w/k32w0/main/AppTask.cpp | 8 ++- .../ameba/main/chipinterface.cpp | 6 ++ .../light-switch-app/genio/src/AppTask.cpp | 6 ++ .../infineon/cyw30739/src/main.cpp | 6 ++ .../nrfconnect/main/AppTask.cpp | 6 ++ .../lighting-app/ameba/main/chipinterface.cpp | 6 ++ .../cc13x2x7_26x2x7/src/AppTask.cpp | 6 ++ .../lighting-app/cc13x4_26x4/src/AppTask.cpp | 6 ++ examples/lighting-app/genio/src/AppTask.cpp | 6 ++ .../infineon/cyw30739/src/main.cpp | 6 ++ .../infineon/psoc6/src/AppTask.cpp | 6 ++ examples/lighting-app/mbed/main/AppTask.cpp | 6 ++ .../lighting-app/nrfconnect/main/AppTask.cpp | 6 ++ .../nxp/k32w/k32w0/main/AppTask.cpp | 8 ++- examples/lighting-app/qpg/src/AppTask.cpp | 6 ++ .../lock-app/cc13x2x7_26x2x7/main/AppTask.cpp | 6 ++ .../lock-app/cc13x2x7_26x2x7/src/AppTask.cpp | 6 ++ examples/lock-app/cc13x4_26x4/src/AppTask.cpp | 6 ++ examples/lock-app/cc32xx/main/AppTask.cpp | 6 ++ examples/lock-app/genio/src/AppTask.cpp | 8 ++- .../lock-app/infineon/cyw30739/src/main.cpp | 6 ++ .../lock-app/infineon/psoc6/src/AppTask.cpp | 6 ++ examples/lock-app/mbed/main/AppTask.cpp | 6 ++ examples/lock-app/nrfconnect/main/AppTask.cpp | 6 ++ .../lock-app/nxp/k32w/k32w0/main/AppTask.cpp | 8 ++- examples/lock-app/qpg/src/AppTask.cpp | 6 ++ examples/log-source-app/linux/main.cpp | 6 ++ .../ameba/main/chipinterface.cpp | 6 ++ .../ota-requestor-app/genio/src/AppTask.cpp | 6 ++ .../infineon/cyw30739/src/main.cpp | 6 ++ .../ota-requestor-app/mbed/main/AppTask.cpp | 6 ++ examples/platform/asr/init_Matter.cpp | 6 ++ .../platform/beken/common/BekenAppServer.cpp | 6 ++ .../bouffalolab/common/plat/platform.cpp | 6 ++ .../platform/esp32/common/Esp32AppServer.cpp | 6 ++ examples/platform/linux/AppMain.cpp | 6 ++ examples/platform/nxp/se05x/linux/AppMain.cpp | 7 ++- .../platform/openiotsdk/app/CMakeLists.txt | 4 ++ .../openiotsdk/app/openiotsdk_platform.cpp | 8 ++- examples/platform/silabs/MatterConfig.cpp | 7 +++ .../telink/common/src/AppTaskCommon.cpp | 6 ++ .../pump-app/cc13x2x7_26x2x7/main/AppTask.cpp | 6 ++ .../pump-app/cc13x4_26x4/main/AppTask.cpp | 6 ++ examples/pump-app/nrfconnect/main/AppTask.cpp | 6 ++ .../cc13x2x7_26x2x7/main/AppTask.cpp | 6 ++ .../cc13x4_26x4/main/AppTask.cpp | 6 ++ .../nrfconnect/main/AppTask.cpp | 6 ++ .../shell/cc13x2x7_26x2x7/main/AppTask.cpp | 6 ++ examples/shell/cc13x4_26x4/main/AppTask.cpp | 6 ++ .../shell/nxp/k32w/k32w0/main/AppTask.cpp | 8 ++- examples/shell/shell_common/cmd_server.cpp | 6 ++ examples/thermostat/genio/src/AppTask.cpp | 6 ++ .../CastingServerBridge.mm | 6 ++ examples/tv-casting-app/linux/main.cpp | 6 ++ .../window-app/nrfconnect/main/AppTask.cpp | 6 ++ src/app/BUILD.gn | 2 + src/app/TimerDelegates.cpp | 55 +++++++++++++++++++ src/app/TimerDelegates.h | 27 ++------- src/app/server/Server.cpp | 6 +- src/app/server/Server.h | 17 +++--- src/app/tests/TestCommissionManager.cpp | 10 +++- 78 files changed, 521 insertions(+), 47 deletions(-) create mode 100644 src/app/TimerDelegates.cpp diff --git a/examples/all-clusters-app/ameba/main/chipinterface.cpp b/examples/all-clusters-app/ameba/main/chipinterface.cpp index 55107d380a555f..be401bce9cc3dc 100644 --- a/examples/all-clusters-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-app/ameba/main/chipinterface.cpp @@ -26,8 +26,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -127,6 +129,10 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp index 2d5896a236b570..80b464b56304fa 100644 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -20,6 +20,8 @@ #include "AppTask.h" #include "AppConfig.h" #include "AppEvent.h" +#include +#include #include #include @@ -249,6 +251,10 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Initialize info provider diff --git a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp index b8fa3a21a4f9d8..65cbc3721c242c 100644 --- a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp @@ -19,6 +19,8 @@ #include "AppTask.h" #include "AppConfig.h" #include "AppEvent.h" +#include +#include #include #include @@ -250,6 +252,10 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Initialize info provider diff --git a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp index 3fde24f3817d04..5ec1bc61151b78 100644 --- a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp @@ -25,6 +25,8 @@ #include "LEDWidget.h" #include #include +#include +#include #include #include #include @@ -125,6 +127,10 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/all-clusters-app/linux/fuzzing-main.cpp b/examples/all-clusters-app/linux/fuzzing-main.cpp index 4fe21865727371..9a2e3fb0eb707b 100644 --- a/examples/all-clusters-app/linux/fuzzing-main.cpp +++ b/examples/all-clusters-app/linux/fuzzing-main.cpp @@ -16,6 +16,8 @@ */ #include "AppMain.h" +#include +#include #include #include @@ -54,6 +56,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t * aData, size_t aSize) // ChipLinuxAppMainLoop blocks, and we don't want that here. static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); VerifyOrDie(Server::GetInstance().Init(initParams) == CHIP_NO_ERROR); diff --git a/examples/all-clusters-app/mbed/main/AppTask.cpp b/examples/all-clusters-app/mbed/main/AppTask.cpp index b497ea7919a0a3..5fa9c10a114db0 100644 --- a/examples/all-clusters-app/mbed/main/AppTask.cpp +++ b/examples/all-clusters-app/mbed/main/AppTask.cpp @@ -21,6 +21,8 @@ #include #include +#include +#include #include #include #include @@ -69,6 +71,10 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); error = Server::GetInstance().Init(initParams); if (error != CHIP_NO_ERROR) diff --git a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp index 4b837e04a01551..23abb312907ada 100644 --- a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include #include @@ -198,6 +200,10 @@ CHIP_ERROR AppTask::Init() #endif static CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; diff --git a/examples/all-clusters-app/nxp/mw320/main.cpp b/examples/all-clusters-app/nxp/mw320/main.cpp index 8344be7cda1b80..a928876d848d19 100644 --- a/examples/all-clusters-app/nxp/mw320/main.cpp +++ b/examples/all-clusters-app/nxp/mw320/main.cpp @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include #include #include @@ -1065,6 +1067,10 @@ static void run_chip_srv(System::Layer * aSystemLayer, void * aAppState) // chip::Server::GetInstance().Init(nullptr, securePort, unsecurePort); static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); PRINTF("Done to call chip::Server() \r\n"); diff --git a/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp b/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp index 870870bbf41999..183bcd5356e24e 100644 --- a/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp @@ -24,8 +24,10 @@ #include "chip_porting.h" #include +#include #include #include +#include #include #include #include @@ -154,6 +156,10 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); 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 efbbb4af9ec705..7edaef7614f683 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp @@ -23,8 +23,12 @@ #include "AppEvent.h" #include "ButtonHandler.h" #include "LEDWidget.h" +#include #include #include +#include +#include +#include #include #include #include @@ -34,13 +38,10 @@ #include #include #include +#include #include #include -#include -#include -#include - /* OTA related includes */ #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR #include @@ -123,6 +124,10 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp b/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp index b1736826ef335a..068dd3d454ae0c 100644 --- a/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp +++ b/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp @@ -16,6 +16,8 @@ */ #include "AppMain.h" +#include +#include #include using namespace chip; @@ -42,6 +44,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t * aData, size_t aSize) // ChipLinuxAppMainLoop blocks, and we don't want that here. static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); VerifyOrDie(Server::GetInstance().Init(initParams) == CHIP_NO_ERROR); diff --git a/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp b/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp index 62317774c1520c..c4aa8c345908f3 100644 --- a/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp @@ -21,6 +21,8 @@ #include #include +#include +#include #include #include #include @@ -64,6 +66,10 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); error = Server::GetInstance().Init(initParams); if (error != CHIP_NO_ERROR) diff --git a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp index 3307789c9e5989..fd622652c9fbd9 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp @@ -21,6 +21,8 @@ #include "LEDUtil.h" #include "binding-handler.h" +#include +#include #include #include @@ -149,6 +151,10 @@ CHIP_ERROR AppTask::Init() #endif static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); diff --git a/examples/bridge-app/linux/main.cpp b/examples/bridge-app/linux/main.cpp index 32930d7133db77..4549216b102daa 100644 --- a/examples/bridge-app/linux/main.cpp +++ b/examples/bridge-app/linux/main.cpp @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include #include @@ -941,6 +943,10 @@ int main(int argc, char * argv[]) // Init Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); #if CHIP_DEVICE_ENABLE_PORT_PARAMS diff --git a/examples/chef/ameba/main/chipinterface.cpp b/examples/chef/ameba/main/chipinterface.cpp index 7e52ae210e3ded..00fa72f970fa46 100644 --- a/examples/chef/ameba/main/chipinterface.cpp +++ b/examples/chef/ameba/main/chipinterface.cpp @@ -25,8 +25,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -103,6 +105,10 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/chef/esp32/main/main.cpp b/examples/chef/esp32/main/main.cpp index 49e817dfe5db9f..2f4f76c30f2f72 100644 --- a/examples/chef/esp32/main/main.cpp +++ b/examples/chef/esp32/main/main.cpp @@ -29,7 +29,9 @@ #include #include +#include #include +#include #include #include @@ -157,6 +159,10 @@ void InitServer(intptr_t) { // Start IM server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/chef/nrfconnect/main.cpp b/examples/chef/nrfconnect/main.cpp index c4157798567e5b..4e4cf808ddacbd 100644 --- a/examples/chef/nrfconnect/main.cpp +++ b/examples/chef/nrfconnect/main.cpp @@ -27,6 +27,8 @@ #include #include +#include +#include #include #include @@ -110,6 +112,10 @@ int main() // Start IM server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); err = chip::Server::GetInstance().Init(initParams); if (err != CHIP_NO_ERROR) diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp index ecd120d9020f17..052d490a105bce 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -18,6 +18,8 @@ */ #include "AppTask.h" #include "AppEvent.h" +#include +#include #include #include #include @@ -257,6 +259,10 @@ void UnlockOpenThreadTask(void) void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); auto & infoProvider = chip::DeviceLayer::DeviceInfoProviderImpl::GetDefaultInstance(); @@ -424,7 +430,7 @@ void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) void AppTask::KBD_Callback(uint8_t events) { - eventMask = eventMask | (uint32_t)(1 << events); + eventMask = eventMask | (uint32_t) (1 << events); HandleKeyboard(); } diff --git a/examples/light-switch-app/ameba/main/chipinterface.cpp b/examples/light-switch-app/ameba/main/chipinterface.cpp index 81cb25a2db011c..3bbf1f1004f4b7 100644 --- a/examples/light-switch-app/ameba/main/chipinterface.cpp +++ b/examples/light-switch-app/ameba/main/chipinterface.cpp @@ -26,8 +26,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -99,6 +101,10 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/light-switch-app/genio/src/AppTask.cpp b/examples/light-switch-app/genio/src/AppTask.cpp index f820d05ef14b05..f7447d4f4ecfe3 100644 --- a/examples/light-switch-app/genio/src/AppTask.cpp +++ b/examples/light-switch-app/genio/src/AppTask.cpp @@ -25,8 +25,10 @@ #include "qrcodegen.h" +#include #include #include +#include #include #include #include @@ -123,6 +125,10 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/light-switch-app/infineon/cyw30739/src/main.cpp b/examples/light-switch-app/infineon/cyw30739/src/main.cpp index dbfdb81b875b3f..8475c2c326c300 100644 --- a/examples/light-switch-app/infineon/cyw30739/src/main.cpp +++ b/examples/light-switch-app/infineon/cyw30739/src/main.cpp @@ -26,8 +26,10 @@ #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR #include #endif +#include #include #include +#include #include #include #include @@ -194,6 +196,10 @@ void InitApp(intptr_t args) /* Start CHIP datamodel server */ static chip::OTATestEventTriggerDelegate testEventTriggerDelegate{ chip::ByteSpan(sTestEventTriggerEnableKey) }; static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; gExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/light-switch-app/nrfconnect/main/AppTask.cpp b/examples/light-switch-app/nrfconnect/main/AppTask.cpp index 405664af872c24..f311199e0284e6 100644 --- a/examples/light-switch-app/nrfconnect/main/AppTask.cpp +++ b/examples/light-switch-app/nrfconnect/main/AppTask.cpp @@ -23,8 +23,10 @@ #include "LightSwitch.h" #include +#include #include #include +#include #include #include #include @@ -213,6 +215,10 @@ CHIP_ERROR AppTask::Init() #endif static CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; diff --git a/examples/lighting-app/ameba/main/chipinterface.cpp b/examples/lighting-app/ameba/main/chipinterface.cpp index 4b342b4b413578..822b9838383c44 100644 --- a/examples/lighting-app/ameba/main/chipinterface.cpp +++ b/examples/lighting-app/ameba/main/chipinterface.cpp @@ -28,8 +28,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -120,6 +122,10 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/lighting-app/cc13x2x7_26x2x7/src/AppTask.cpp b/examples/lighting-app/cc13x2x7_26x2x7/src/AppTask.cpp index c9e8845a4f7323..39cd2b2b92394f 100644 --- a/examples/lighting-app/cc13x2x7_26x2x7/src/AppTask.cpp +++ b/examples/lighting-app/cc13x2x7_26x2x7/src/AppTask.cpp @@ -43,8 +43,10 @@ #include +#include #include #include +#include #include #include #include @@ -218,6 +220,10 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Initialize info provider diff --git a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp index b6cce74ca13aae..44f0ba9646b9ac 100644 --- a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp @@ -42,8 +42,10 @@ #include +#include #include #include +#include #include #include #include @@ -217,6 +219,10 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Initialize info provider diff --git a/examples/lighting-app/genio/src/AppTask.cpp b/examples/lighting-app/genio/src/AppTask.cpp index 6a121673a002a6..9a41f7ca6911ad 100644 --- a/examples/lighting-app/genio/src/AppTask.cpp +++ b/examples/lighting-app/genio/src/AppTask.cpp @@ -26,9 +26,11 @@ #include "qrcodegen.h" #include +#include #include #include #include +#include #include #include #include @@ -325,6 +327,10 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/lighting-app/infineon/cyw30739/src/main.cpp b/examples/lighting-app/infineon/cyw30739/src/main.cpp index 14730252de08b3..17727a564b1109 100644 --- a/examples/lighting-app/infineon/cyw30739/src/main.cpp +++ b/examples/lighting-app/infineon/cyw30739/src/main.cpp @@ -26,8 +26,10 @@ #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR #include #endif +#include #include #include +#include #include #include #include @@ -193,6 +195,10 @@ void InitApp(intptr_t args) /* Start CHIP datamodel server */ static chip::OTATestEventTriggerDelegate testEventTriggerDelegate{ chip::ByteSpan(sTestEventTriggerEnableKey) }; static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; gExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/lighting-app/infineon/psoc6/src/AppTask.cpp b/examples/lighting-app/infineon/psoc6/src/AppTask.cpp index 987213e84073e1..a914a2b83d45f0 100644 --- a/examples/lighting-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/lighting-app/infineon/psoc6/src/AppTask.cpp @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include #include #include @@ -142,6 +144,10 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/lighting-app/mbed/main/AppTask.cpp b/examples/lighting-app/mbed/main/AppTask.cpp index fdbe8ea0cce291..8fadf51a928e9c 100644 --- a/examples/lighting-app/mbed/main/AppTask.cpp +++ b/examples/lighting-app/mbed/main/AppTask.cpp @@ -20,6 +20,8 @@ #include "LEDWidget.h" #include "LightingManager.h" +#include +#include #include #include #include @@ -115,6 +117,10 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); error = Server::GetInstance().Init(initParams); diff --git a/examples/lighting-app/nrfconnect/main/AppTask.cpp b/examples/lighting-app/nrfconnect/main/AppTask.cpp index e16230e000ca0f..05dbe66f103370 100644 --- a/examples/lighting-app/nrfconnect/main/AppTask.cpp +++ b/examples/lighting-app/nrfconnect/main/AppTask.cpp @@ -26,8 +26,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -237,6 +239,10 @@ CHIP_ERROR AppTask::Init() #endif static CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; diff --git a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp index d2bdbe55c0d2cc..b70af45a9260d8 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -18,6 +18,8 @@ */ #include "AppTask.h" #include "AppEvent.h" +#include +#include #include #include #include @@ -264,6 +266,10 @@ void UnlockOpenThreadTask(void) void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); auto & infoProvider = chip::DeviceLayer::DeviceInfoProviderImpl::GetDefaultInstance(); @@ -426,7 +432,7 @@ void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) void AppTask::KBD_Callback(uint8_t events) { - eventMask = eventMask | (uint32_t)(1 << events); + eventMask = eventMask | (uint32_t) (1 << events); } void AppTask::HandleKeyboard(void) diff --git a/examples/lighting-app/qpg/src/AppTask.cpp b/examples/lighting-app/qpg/src/AppTask.cpp index ab504abfb51a52..161a37ad81317a 100644 --- a/examples/lighting-app/qpg/src/AppTask.cpp +++ b/examples/lighting-app/qpg/src/AppTask.cpp @@ -38,6 +38,8 @@ #include #include +#include +#include #include #include #include @@ -234,6 +236,10 @@ CHIP_ERROR AppTask::StartAppTask() void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); gExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp index 1988455e958398..b17d567add27ec 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -20,6 +20,8 @@ #include "AppTask.h" #include "AppConfig.h" #include "AppEvent.h" +#include +#include #include #include "FreeRTOS.h" @@ -167,6 +169,10 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Initialize info provider diff --git a/examples/lock-app/cc13x2x7_26x2x7/src/AppTask.cpp b/examples/lock-app/cc13x2x7_26x2x7/src/AppTask.cpp index d4e3d8f17f42db..cd962f568b4f7a 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/src/AppTask.cpp +++ b/examples/lock-app/cc13x2x7_26x2x7/src/AppTask.cpp @@ -42,8 +42,10 @@ #include +#include #include #include +#include #include #include #include @@ -213,6 +215,10 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Initialize info provider diff --git a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp index c73fd1f3909100..f5b1005e49bd3a 100644 --- a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp @@ -41,8 +41,10 @@ #include +#include #include #include +#include #include #include #include @@ -212,6 +214,10 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Initialize info provider diff --git a/examples/lock-app/cc32xx/main/AppTask.cpp b/examples/lock-app/cc32xx/main/AppTask.cpp index 28c0675b8c717a..26eacf6b05c309 100644 --- a/examples/lock-app/cc32xx/main/AppTask.cpp +++ b/examples/lock-app/cc32xx/main/AppTask.cpp @@ -23,6 +23,8 @@ #include #include +#include +#include #include #include @@ -150,6 +152,10 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/lock-app/genio/src/AppTask.cpp b/examples/lock-app/genio/src/AppTask.cpp index b06d9535c35c3b..3814f013224765 100644 --- a/examples/lock-app/genio/src/AppTask.cpp +++ b/examples/lock-app/genio/src/AppTask.cpp @@ -25,9 +25,11 @@ #include "qrcodegen.h" #include #include +#include #include #include #include +#include #include #include #include @@ -50,7 +52,7 @@ #define APP_TASK_STACK_SIZE (4096) #define APP_TASK_PRIORITY 2 #define APP_EVENT_QUEUE_SIZE 10 -//#define EXAMPLE_VENDOR_ID 0xcafe +// #define EXAMPLE_VENDOR_ID 0xcafe #ifdef portYIELD_FROM_ISR #define OS_YIELD_FROM_ISR(yield) portYIELD_FROM_ISR(yield) @@ -138,6 +140,10 @@ CHIP_ERROR AppTask::Init() #endif // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/lock-app/infineon/cyw30739/src/main.cpp b/examples/lock-app/infineon/cyw30739/src/main.cpp index 76fa8484ce74eb..d9032bef3a7062 100644 --- a/examples/lock-app/infineon/cyw30739/src/main.cpp +++ b/examples/lock-app/infineon/cyw30739/src/main.cpp @@ -28,9 +28,11 @@ #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR #include #endif +#include #include #include #include +#include #include #include #include @@ -193,6 +195,10 @@ void InitApp(intptr_t args) /* Start CHIP datamodel server */ static chip::OTATestEventTriggerDelegate testEventTriggerDelegate{ chip::ByteSpan(sTestEventTriggerEnableKey) }; static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; gExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/lock-app/infineon/psoc6/src/AppTask.cpp b/examples/lock-app/infineon/psoc6/src/AppTask.cpp index 14d5aba533d2b1..2a7eba19e81509 100644 --- a/examples/lock-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/lock-app/infineon/psoc6/src/AppTask.cpp @@ -24,8 +24,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -150,6 +152,10 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/lock-app/mbed/main/AppTask.cpp b/examples/lock-app/mbed/main/AppTask.cpp index 4e1d0c70e943cc..aa5d8900f90702 100644 --- a/examples/lock-app/mbed/main/AppTask.cpp +++ b/examples/lock-app/mbed/main/AppTask.cpp @@ -20,6 +20,8 @@ #include "BoltLockManager.h" #include +#include +#include #include #include #include @@ -118,6 +120,10 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); error = Server::GetInstance().Init(initParams); diff --git a/examples/lock-app/nrfconnect/main/AppTask.cpp b/examples/lock-app/nrfconnect/main/AppTask.cpp index aa65236ba747d2..e63ba82aaa95b3 100644 --- a/examples/lock-app/nrfconnect/main/AppTask.cpp +++ b/examples/lock-app/nrfconnect/main/AppTask.cpp @@ -24,9 +24,11 @@ #include #include +#include #include #include #include +#include #include #include #include @@ -207,6 +209,10 @@ CHIP_ERROR AppTask::Init() #endif static CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; diff --git a/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp index b4e793a525d8d4..514e1f60c2a41d 100644 --- a/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -18,6 +18,8 @@ */ #include "AppTask.h" #include "AppEvent.h" +#include +#include #include #include #include @@ -180,6 +182,10 @@ void UnlockOpenThreadTask(void) void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); auto & infoProvider = chip::DeviceLayer::DeviceInfoProviderImpl::GetDefaultInstance(); @@ -323,7 +329,7 @@ void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) void AppTask::KBD_Callback(uint8_t events) { - eventMask = eventMask | (uint32_t)(1 << events); + eventMask = eventMask | (uint32_t) (1 << events); HandleKeyboard(); } diff --git a/examples/lock-app/qpg/src/AppTask.cpp b/examples/lock-app/qpg/src/AppTask.cpp index 3466d8c4a4c395..0f5f42ac7d6669 100644 --- a/examples/lock-app/qpg/src/AppTask.cpp +++ b/examples/lock-app/qpg/src/AppTask.cpp @@ -26,9 +26,11 @@ #include #include +#include #include #include #include +#include #include #include #include @@ -178,6 +180,10 @@ CHIP_ERROR AppTask::StartAppTask() void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); gExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/log-source-app/linux/main.cpp b/examples/log-source-app/linux/main.cpp index 9443a946e1a871..a459dacff6696f 100644 --- a/examples/log-source-app/linux/main.cpp +++ b/examples/log-source-app/linux/main.cpp @@ -18,7 +18,9 @@ #include #include +#include #include +#include #include #include #include @@ -103,6 +105,10 @@ int main(int argc, char * argv[]) chip::DeviceLayer::ConfigurationMgr().LogDeviceConfig(); static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/ota-requestor-app/ameba/main/chipinterface.cpp b/examples/ota-requestor-app/ameba/main/chipinterface.cpp index ee8e80086fbca4..25fce7deaf05b8 100644 --- a/examples/ota-requestor-app/ameba/main/chipinterface.cpp +++ b/examples/ota-requestor-app/ameba/main/chipinterface.cpp @@ -22,7 +22,9 @@ #include "chip_porting.h" #include +#include #include +#include #include #include @@ -75,6 +77,10 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/ota-requestor-app/genio/src/AppTask.cpp b/examples/ota-requestor-app/genio/src/AppTask.cpp index 43c92cf26adeeb..dbf45da43bfcd5 100644 --- a/examples/ota-requestor-app/genio/src/AppTask.cpp +++ b/examples/ota-requestor-app/genio/src/AppTask.cpp @@ -16,8 +16,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include #include #include +#include #include #include #include @@ -107,6 +109,10 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/ota-requestor-app/infineon/cyw30739/src/main.cpp b/examples/ota-requestor-app/infineon/cyw30739/src/main.cpp index 14ce58809f68dc..09860b48592350 100644 --- a/examples/ota-requestor-app/infineon/cyw30739/src/main.cpp +++ b/examples/ota-requestor-app/infineon/cyw30739/src/main.cpp @@ -20,6 +20,8 @@ #include #include +#include +#include #include #include #include @@ -122,6 +124,10 @@ void InitApp(intptr_t args) /* Start CHIP datamodel server */ static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Inet::EndPointStateOpenThread::OpenThreadEndpointInitParam nativeParams; nativeParams.lockCb = [] { ThreadStackMgr().LockThreadStack(); }; diff --git a/examples/ota-requestor-app/mbed/main/AppTask.cpp b/examples/ota-requestor-app/mbed/main/AppTask.cpp index 0fa7df26f8d19c..ed7326580a1def 100644 --- a/examples/ota-requestor-app/mbed/main/AppTask.cpp +++ b/examples/ota-requestor-app/mbed/main/AppTask.cpp @@ -19,6 +19,8 @@ #include "AppTask.h" #include +#include +#include #include #include #include @@ -105,6 +107,10 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); error = Server::GetInstance().Init(initParams); diff --git a/examples/platform/asr/init_Matter.cpp b/examples/platform/asr/init_Matter.cpp index 8f46ac4f9ed423..3e495cb5c0c5b6 100644 --- a/examples/platform/asr/init_Matter.cpp +++ b/examples/platform/asr/init_Matter.cpp @@ -18,6 +18,8 @@ #include "AppConfig.h" #include +#include +#include #include #include #include @@ -99,6 +101,10 @@ CHIP_ERROR MatterInitializer::Init_Matter_Server(void) // Init Matter Server and Start Event Loop chip::DeviceLayer::PlatformMgr().LockChipStack(); static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); diff --git a/examples/platform/beken/common/BekenAppServer.cpp b/examples/platform/beken/common/BekenAppServer.cpp index 50f68cf441b05f..3b0a1e083febe5 100644 --- a/examples/platform/beken/common/BekenAppServer.cpp +++ b/examples/platform/beken/common/BekenAppServer.cpp @@ -18,7 +18,9 @@ #include "BekenAppServer.h" #include "CHIPDeviceManager.h" +#include #include +#include #include #include #include @@ -37,6 +39,10 @@ void BekenAppServer::Init(AppDelegate * sAppDelegate) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); if (sAppDelegate != nullptr) { diff --git a/examples/platform/bouffalolab/common/plat/platform.cpp b/examples/platform/bouffalolab/common/plat/platform.cpp index d2e6a434e91296..0cf2bd52ef997f 100644 --- a/examples/platform/bouffalolab/common/plat/platform.cpp +++ b/examples/platform/bouffalolab/common/plat/platform.cpp @@ -17,6 +17,8 @@ */ #include #include +#include +#include #include #include #include @@ -229,6 +231,10 @@ CHIP_ERROR PlatformManagerImpl::PlatformInit(void) chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); static CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); ReturnLogErrorOnFailure(chip::Server::GetInstance().Init(initParams)); diff --git a/examples/platform/esp32/common/Esp32AppServer.cpp b/examples/platform/esp32/common/Esp32AppServer.cpp index 06bb0d9a6c6c0b..de89986f2f59cb 100644 --- a/examples/platform/esp32/common/Esp32AppServer.cpp +++ b/examples/platform/esp32/common/Esp32AppServer.cpp @@ -18,8 +18,10 @@ #include "Esp32AppServer.h" #include "CHIPDeviceManager.h" +#include #include #include +#include #include #include #include @@ -97,6 +99,10 @@ void Esp32AppServer::Init(AppDelegate * sAppDelegate) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; #if CONFIG_TEST_EVENT_TRIGGER_ENABLED && CONFIG_ENABLE_OTA_REQUESTOR if (hex_string_to_binary(CONFIG_TEST_EVENT_TRIGGER_ENABLE_KEY, sTestEventTriggerEnableKey, sizeof(sTestEventTriggerEnableKey)) == 0) diff --git a/examples/platform/linux/AppMain.cpp b/examples/platform/linux/AppMain.cpp index 22ff4d2db71cb6..af8a937cb6f6ea 100644 --- a/examples/platform/linux/AppMain.cpp +++ b/examples/platform/linux/AppMain.cpp @@ -20,6 +20,8 @@ #include #include "app/clusters/network-commissioning/network-commissioning.h" +#include +#include #include #include #include @@ -482,6 +484,10 @@ void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl) gMainLoopImplementation = impl; static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; VerifyOrDie(initParams.InitializeStaticResourcesBeforeServerInit() == CHIP_NO_ERROR); #if defined(ENABLE_CHIP_SHELL) diff --git a/examples/platform/nxp/se05x/linux/AppMain.cpp b/examples/platform/nxp/se05x/linux/AppMain.cpp index 2c04b81b0ce8bb..1c00ed90587f58 100644 --- a/examples/platform/nxp/se05x/linux/AppMain.cpp +++ b/examples/platform/nxp/se05x/linux/AppMain.cpp @@ -19,7 +19,9 @@ #include #include +#include #include +#include #include #include #include @@ -288,7 +290,10 @@ int ChipLinuxAppInit(int argc, char * const argv[], OptionSet * customOptions) void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl) { static chip::CommonCaseDeviceServerInitParams initParams; - + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; VerifyOrDie(initParams.InitializeStaticResourcesBeforeServerInit() == CHIP_NO_ERROR); #if defined(ENABLE_CHIP_SHELL) diff --git a/examples/platform/openiotsdk/app/CMakeLists.txt b/examples/platform/openiotsdk/app/CMakeLists.txt index f7cc06f9fa14d1..9f57550c936e47 100644 --- a/examples/platform/openiotsdk/app/CMakeLists.txt +++ b/examples/platform/openiotsdk/app/CMakeLists.txt @@ -22,6 +22,10 @@ add_library(openiotsdk-startup openiotsdk_startup_gcc.cpp ) +add_definitions( + "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=" +) + target_link_libraries(openiotsdk-startup PUBLIC # iotsdk-serial-retarget contains the UART but we don't need the retarget part diff --git a/examples/platform/openiotsdk/app/openiotsdk_platform.cpp b/examples/platform/openiotsdk/app/openiotsdk_platform.cpp index 29662d6e8df4e9..252ff7568f9dc2 100644 --- a/examples/platform/openiotsdk/app/openiotsdk_platform.cpp +++ b/examples/platform/openiotsdk/app/openiotsdk_platform.cpp @@ -32,6 +32,8 @@ #endif #include +#include +#include #include #include #include @@ -266,7 +268,11 @@ int openiotsdk_chip_run(void) #ifdef USE_CHIP_DATA_MODEL // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; - CHIP_ERROR err = initParams.InitializeStaticResourcesBeforeServerInit(); + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; + CHIP_ERROR err = initParams.InitializeStaticResourcesBeforeServerInit(); if (err != CHIP_NO_ERROR) { ChipLogError(NotSpecified, "Initialize static resources before server init failed: %s", err.AsString()); diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index 9c2253233f79e7..85f364296800c5 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -56,6 +56,8 @@ static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeys #include "SilabsDeviceDataProvider.h" #include "SilabsTestEventTriggerDelegate.h" #include +#include +#include #include #ifdef CHIP_CONFIG_USE_ICD_SUBSCRIPTION_CALLBACKS @@ -188,6 +190,11 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) // Create initParams with SDK example defaults here static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; + #if SILABS_TEST_EVENT_TRIGGER_ENABLED if (Encoding::HexToBytes(SILABS_TEST_EVENT_TRIGGER_ENABLE_KEY, strlen(SILABS_TEST_EVENT_TRIGGER_ENABLE_KEY), sTestEventTriggerEnableKey, diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index a13e84ca527cad..5fb210a7a97f05 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -25,7 +25,9 @@ #include "ThreadUtil.h" #include +#include #include +#include #include #include #include @@ -292,6 +294,10 @@ CHIP_ERROR AppTaskCommon::InitCommonParts(void) // Init ZCL Data Model and start server static CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.appDelegate = &sCallbacks; ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); diff --git a/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp index 2dfecb65a11bc0..e9cf6166f0fe85 100644 --- a/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -22,6 +22,8 @@ #include "AppEvent.h" #include "CHIPDeviceManager.h" #include "DeviceCallbacks.h" +#include +#include #include #include @@ -218,6 +220,10 @@ int AppTask::Init() // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp index b5be215216a4bf..a3e261d0c0572c 100644 --- a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp @@ -21,6 +21,8 @@ #include "AppEvent.h" #include "CHIPDeviceManager.h" #include "DeviceCallbacks.h" +#include +#include #include #include @@ -219,6 +221,10 @@ int AppTask::Init() // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/pump-app/nrfconnect/main/AppTask.cpp b/examples/pump-app/nrfconnect/main/AppTask.cpp index 9c75c54e1fcc87..e057b0bdc6e6ee 100644 --- a/examples/pump-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-app/nrfconnect/main/AppTask.cpp @@ -24,7 +24,9 @@ #include #include +#include #include +#include #include #include #include @@ -180,6 +182,10 @@ CHIP_ERROR AppTask::Init() #endif static CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp index fa5d85eaa6e42e..d4eefd2f0332ae 100644 --- a/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -20,6 +20,8 @@ #include "AppTask.h" #include "AppConfig.h" #include "AppEvent.h" +#include +#include #include #include "FreeRTOS.h" @@ -172,6 +174,10 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp index 51ef817cff14ac..2052b1f26c61d1 100644 --- a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp @@ -19,6 +19,8 @@ #include "AppTask.h" #include "AppConfig.h" #include "AppEvent.h" +#include +#include #include #include "FreeRTOS.h" @@ -172,6 +174,10 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp index 9580af61ae451d..01c93c34e9ef74 100644 --- a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp @@ -24,7 +24,9 @@ #include #include +#include #include +#include #include #include #include @@ -178,6 +180,10 @@ CHIP_ERROR AppTask::Init() #endif static CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; diff --git a/examples/shell/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/shell/cc13x2x7_26x2x7/main/AppTask.cpp index dda97f4e566ef5..266955771d3ab0 100644 --- a/examples/shell/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/shell/cc13x2x7_26x2x7/main/AppTask.cpp @@ -18,6 +18,8 @@ */ #include "AppTask.h" +#include +#include #include #include @@ -147,6 +149,10 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/shell/cc13x4_26x4/main/AppTask.cpp b/examples/shell/cc13x4_26x4/main/AppTask.cpp index 302f8b8baf8c96..9ccc0bed5595ee 100644 --- a/examples/shell/cc13x4_26x4/main/AppTask.cpp +++ b/examples/shell/cc13x4_26x4/main/AppTask.cpp @@ -17,6 +17,8 @@ */ #include "AppTask.h" +#include +#include #include #include @@ -152,6 +154,10 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/shell/nxp/k32w/k32w0/main/AppTask.cpp b/examples/shell/nxp/k32w/k32w0/main/AppTask.cpp index ac98d19eb0d574..c04973a31a8dc3 100644 --- a/examples/shell/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/shell/nxp/k32w/k32w0/main/AppTask.cpp @@ -18,6 +18,8 @@ */ #include "AppTask.h" #include "AppEvent.h" +#include +#include #include #include @@ -139,6 +141,10 @@ void UnlockOpenThreadTask(void) void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Init ZCL Data Model and start server @@ -246,7 +252,7 @@ void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) void AppTask::KBD_Callback(uint8_t events) { - eventMask = eventMask | (uint32_t)(1 << events); + eventMask = eventMask | (uint32_t) (1 << events); HandleKeyboard(); } diff --git a/examples/shell/shell_common/cmd_server.cpp b/examples/shell/shell_common/cmd_server.cpp index d18eb88cf7a1b0..11d8ac9d17e5ab 100644 --- a/examples/shell/shell_common/cmd_server.cpp +++ b/examples/shell/shell_common/cmd_server.cpp @@ -24,6 +24,8 @@ #include #include +#include +#include #include #include #include @@ -57,6 +59,10 @@ static CHIP_ERROR CmdAppServerStart(int argc, char ** argv) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.operationalServicePort = sServerPortOperational; initParams.userDirectedCommissioningPort = sServerPortCommissioning; diff --git a/examples/thermostat/genio/src/AppTask.cpp b/examples/thermostat/genio/src/AppTask.cpp index ac419e01f51b9b..79009062699c37 100644 --- a/examples/thermostat/genio/src/AppTask.cpp +++ b/examples/thermostat/genio/src/AppTask.cpp @@ -24,8 +24,10 @@ #include "qrcodegen.h" +#include #include #include +#include #include #include #include @@ -122,6 +124,10 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm index 3f4dbce0700bb7..df05775813742c 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm @@ -25,6 +25,8 @@ #import "MatterCallbacks.h" #import "OnboardingPayload.h" +#include +#include #include #include #include @@ -332,6 +334,10 @@ - (MatterError *)initializeApp:(AppParameters * _Nullable)appParameters // init app Server _serverInitParams = new chip::CommonCaseDeviceServerInitParams(); + // Report scheduler and timer delegate instance + chip::app::DefaultTimerDelegate * timerDelegate = new chip::app::DefaultTimerDelegate(); + chip::app::reporting::ReportSchedulerImpl * reportScheduler = new chip::app::reporting::ReportSchedulerImpl(timerDelegate); + _serverInitParams->reportScheduler = reportScheduler; err = _serverInitParams->InitializeStaticResourcesBeforeServerInit(); if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, "InitializeStaticResourcesBeforeServerInit failed: %s", ErrorStr(err)); diff --git a/examples/tv-casting-app/linux/main.cpp b/examples/tv-casting-app/linux/main.cpp index 45c53c842568f8..f9884f3ef0009a 100644 --- a/examples/tv-casting-app/linux/main.cpp +++ b/examples/tv-casting-app/linux/main.cpp @@ -31,6 +31,8 @@ #include "LinuxCommissionableDataProvider.h" #include "Options.h" +#include +#include #include #include #include @@ -138,6 +140,10 @@ int main(int argc, char * argv[]) // Enter commissioning mode, open commissioning window static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; VerifyOrDie(CHIP_NO_ERROR == initParams.InitializeStaticResourcesBeforeServerInit()); VerifyOrDie(CHIP_NO_ERROR == chip::Server::GetInstance().Init(initParams)); diff --git a/examples/window-app/nrfconnect/main/AppTask.cpp b/examples/window-app/nrfconnect/main/AppTask.cpp index 38e20fd503d4ea..c74294a2907e37 100644 --- a/examples/window-app/nrfconnect/main/AppTask.cpp +++ b/examples/window-app/nrfconnect/main/AppTask.cpp @@ -23,8 +23,10 @@ #include +#include #include #include +#include #include #include #include @@ -186,6 +188,10 @@ CHIP_ERROR AppTask::Init() #endif static CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 312a53aa6ee1a7..cc380ddf680c71 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -191,6 +191,8 @@ static_library("app") { "TimedHandler.h", "TimedRequest.cpp", "TimedRequest.h", + "TimerDelegates.cpp", + "TimerDelegates.h", "WriteClient.cpp", "WriteHandler.cpp", "reporting/Engine.cpp", diff --git a/src/app/TimerDelegates.cpp b/src/app/TimerDelegates.cpp new file mode 100644 index 00000000000000..d41503d0947d04 --- /dev/null +++ b/src/app/TimerDelegates.cpp @@ -0,0 +1,55 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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 +#include +#include + +using TimerContext = chip::app::reporting::TimerContext; +using Timeout = chip::System::Clock::Timeout; + +namespace chip { +namespace app { + +static void TimerCallbackInterface(System::Layer * aLayer, void * aAppState) +{ + TimerContext * context = static_cast(aAppState); + context->TimerFired(); +} +CHIP_ERROR DefaultTimerDelegate::StartTimer(TimerContext * context, Timeout aTimeout) +{ + return InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionManager()->SystemLayer()->StartTimer( + aTimeout, TimerCallbackInterface, context); +} +void DefaultTimerDelegate::CancelTimer(TimerContext * context) +{ + InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionManager()->SystemLayer()->CancelTimer( + TimerCallbackInterface, context); +} +bool DefaultTimerDelegate::IsTimerActive(TimerContext * context) +{ + return InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionManager()->SystemLayer()->IsTimerActive( + TimerCallbackInterface, context); +} + +System::Clock::Timestamp DefaultTimerDelegate::GetCurrentMonotonicTimestamp() +{ + return System::SystemClock().GetMonotonicTimestamp(); +} + +} // namespace app +} // namespace chip diff --git a/src/app/TimerDelegates.h b/src/app/TimerDelegates.h index 8e24fd4aef09bd..563ee138d9199f 100644 --- a/src/app/TimerDelegates.h +++ b/src/app/TimerDelegates.h @@ -17,7 +17,6 @@ #pragma once -#include #include #include @@ -29,28 +28,10 @@ class DefaultTimerDelegate : public reporting::ReportScheduler::TimerDelegate public: using TimerContext = reporting::TimerContext; using Timeout = System::Clock::Timeout; - static void TimerCallbackInterface(System::Layer * aLayer, void * aAppState) - { - TimerContext * context = static_cast(aAppState); - context->TimerFired(); - } - CHIP_ERROR StartTimer(TimerContext * context, Timeout aTimeout) override - { - return InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionManager()->SystemLayer()->StartTimer( - aTimeout, TimerCallbackInterface, context); - } - void CancelTimer(TimerContext * context) override - { - InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionManager()->SystemLayer()->CancelTimer( - TimerCallbackInterface, context); - } - bool IsTimerActive(TimerContext * context) override - { - return InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionManager()->SystemLayer()->IsTimerActive( - TimerCallbackInterface, context); - } - - System::Clock::Timestamp GetCurrentMonotonicTimestamp() override { return System::SystemClock().GetMonotonicTimestamp(); } + CHIP_ERROR StartTimer(TimerContext * context, Timeout aTimeout) override; + void CancelTimer(TimerContext * context) override; + bool IsTimerActive(TimerContext * context) override; + System::Clock::Timestamp GetCurrentMonotonicTimestamp() override; }; } // namespace app diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index b416d5086c3096..7b7af39dfb25b5 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -117,6 +117,7 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) VerifyOrExit(initParams.sessionKeystore != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(initParams.operationalKeystore != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(initParams.opCertStore != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(initParams.reportScheduler != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); // TODO(16969): Remove chip::Platform::MemoryInit() call from Server class, it belongs to outer code chip::Platform::MemoryInit(); @@ -171,6 +172,8 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) mGroupsProvider = initParams.groupDataProvider; SetGroupDataProvider(mGroupsProvider); + mReportScheduler = initParams.reportScheduler; + mTestEventTriggerDelegate = initParams.testEventTriggerDelegate; deviceInfoprovider = DeviceLayer::GetDeviceInfoProvider(); @@ -317,7 +320,7 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) &mCertificateValidityPolicy, mGroupsProvider); SuccessOrExit(err); - err = chip::app::InteractionModelEngine::GetInstance()->Init(&mExchangeMgr, &GetFabricTable(), &mReportScheduler, + err = chip::app::InteractionModelEngine::GetInstance()->Init(&mExchangeMgr, &GetFabricTable(), mReportScheduler, &mCASESessionManager, mSubscriptionResumptionStorage); SuccessOrExit(err); @@ -555,6 +558,7 @@ KvsPersistentStorageDelegate CommonCaseDeviceServerInitParams::sKvsPersistenStor PersistentStorageOperationalKeystore CommonCaseDeviceServerInitParams::sPersistentStorageOperationalKeystore; Credentials::PersistentStorageOpCertStore CommonCaseDeviceServerInitParams::sPersistentStorageOpCertStore; Credentials::GroupDataProviderImpl CommonCaseDeviceServerInitParams::sGroupDataProvider; + #if CHIP_CONFIG_ENABLE_SESSION_RESUMPTION SimpleSessionResumptionStorage CommonCaseDeviceServerInitParams::sSessionResumptionStorage; #endif diff --git a/src/app/server/Server.h b/src/app/server/Server.h index c41a9e3127e0d9..bf2746f202c1a4 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -100,7 +100,7 @@ struct ServerInitParams ServerInitParams() = default; // Not copyable - ServerInitParams(const ServerInitParams &) = delete; + ServerInitParams(const ServerInitParams &) = delete; ServerInitParams & operator=(const ServerInitParams &) = delete; // Application delegate to handle some commissioning lifecycle events @@ -146,6 +146,8 @@ struct ServerInitParams // Operational certificate store with access to the operational certs in persisted storage: // must not be null at timne of Server::Init(). Credentials::OperationalCertificateStore * opCertStore = nullptr; + // Report Scheduler Must be injected. If none injected the IM engine will throw an error on Init() + app::reporting::ReportScheduler * reportScheduler = nullptr; }; /** @@ -180,7 +182,7 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams CommonCaseDeviceServerInitParams() = default; // Not copyable - CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; + CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; CommonCaseDeviceServerInitParams & operator=(const CommonCaseDeviceServerInitParams &) = delete; /** @@ -340,7 +342,7 @@ class Server app::DefaultAttributePersistenceProvider & GetDefaultAttributePersister() { return mAttributePersister; } - app::reporting::ReportScheduler & GetReportScheduler() { return mReportScheduler; } + app::reporting::ReportScheduler * GetReportScheduler() { return mReportScheduler; } /** * This function causes the ShutDown event to be generated async on the @@ -360,7 +362,7 @@ class Server static Server & GetInstance() { return sServer; } private: - Server() : mTimerDelegate(), mReportScheduler(&mTimerDelegate) {} + Server() {} static Server sServer; @@ -594,12 +596,7 @@ class Server app::DefaultAttributePersistenceProvider mAttributePersister; GroupDataProviderListener mListener; ServerFabricDelegate mFabricDelegate; - app::DefaultTimerDelegate mTimerDelegate; -#if CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED - app::reporting::SynchronizedReportSchedulerImpl mReportScheduler; -#else - app::reporting::ReportSchedulerImpl mReportScheduler; -#endif + app::reporting::ReportScheduler * mReportScheduler; Access::AccessControl mAccessControl; app::AclStorage * mAclStorage; diff --git a/src/app/tests/TestCommissionManager.cpp b/src/app/tests/TestCommissionManager.cpp index e2886f16dbdeab..90399522e90556 100644 --- a/src/app/tests/TestCommissionManager.cpp +++ b/src/app/tests/TestCommissionManager.cpp @@ -15,6 +15,8 @@ * limitations under the License. */ +#include +#include #include #include #include @@ -92,6 +94,10 @@ void InitializeChip(nlTestSuite * suite) chip::DeviceLayer::SetCommissionableDataProvider(&commissionableDataProvider); static chip::CommonCaseDeviceServerInitParams initParams; + // Report scheduler and timer delegate instance + static chip::app::DefaultTimerDelegate sTimerDelegate; + static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); + initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); err = chip::Server::GetInstance().Init(initParams); @@ -131,7 +137,7 @@ void CheckCommissioningWindowManagerBasicWindowOpenCloseTask(intptr_t context) CommissioningWindowManager & commissionMgr = Server::GetInstance().GetCommissioningWindowManager(); CHIP_ERROR err = commissionMgr.OpenBasicCommissioningWindow(commissionMgr.MaxCommissioningTimeout(), - CommissioningWindowAdvertisement::kDnssdOnly); + CommissioningWindowAdvertisement::kDnssdOnly); NL_TEST_ASSERT(suite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(suite, commissionMgr.IsCommissioningWindowOpen()); NL_TEST_ASSERT(suite, @@ -169,7 +175,7 @@ void CheckCommissioningWindowManagerBasicWindowOpenCloseFromClusterTask(intptr_t constexpr auto fabricIndex = static_cast(1); constexpr auto vendorId = static_cast(0xFFF3); CHIP_ERROR err = commissionMgr.OpenBasicCommissioningWindowForAdministratorCommissioningCluster( - commissionMgr.MaxCommissioningTimeout(), fabricIndex, vendorId); + commissionMgr.MaxCommissioningTimeout(), fabricIndex, vendorId); NL_TEST_ASSERT(suite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(suite, commissionMgr.IsCommissioningWindowOpen()); NL_TEST_ASSERT(suite, From 53ba76be1a99a26675016ab954c43b3419942497 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 3 Aug 2023 14:59:52 +0000 Subject: [PATCH 2/9] Restyled by clang-format --- examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp | 2 +- examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp | 2 +- examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp | 2 +- examples/shell/nxp/k32w/k32w0/main/AppTask.cpp | 2 +- src/app/server/Server.h | 4 ++-- src/app/tests/TestCommissionManager.cpp | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp index 052d490a105bce..7e19ce7be107f7 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -430,7 +430,7 @@ void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) void AppTask::KBD_Callback(uint8_t events) { - eventMask = eventMask | (uint32_t) (1 << events); + eventMask = eventMask | (uint32_t)(1 << events); HandleKeyboard(); } diff --git a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp index b70af45a9260d8..fa3834f755de52 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -432,7 +432,7 @@ void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) void AppTask::KBD_Callback(uint8_t events) { - eventMask = eventMask | (uint32_t) (1 << events); + eventMask = eventMask | (uint32_t)(1 << events); } void AppTask::HandleKeyboard(void) diff --git a/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp index 514e1f60c2a41d..3be1bd0f683e86 100644 --- a/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -329,7 +329,7 @@ void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) void AppTask::KBD_Callback(uint8_t events) { - eventMask = eventMask | (uint32_t) (1 << events); + eventMask = eventMask | (uint32_t)(1 << events); HandleKeyboard(); } diff --git a/examples/shell/nxp/k32w/k32w0/main/AppTask.cpp b/examples/shell/nxp/k32w/k32w0/main/AppTask.cpp index c04973a31a8dc3..0324c64e6af2bf 100644 --- a/examples/shell/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/shell/nxp/k32w/k32w0/main/AppTask.cpp @@ -252,7 +252,7 @@ void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) void AppTask::KBD_Callback(uint8_t events) { - eventMask = eventMask | (uint32_t) (1 << events); + eventMask = eventMask | (uint32_t)(1 << events); HandleKeyboard(); } diff --git a/src/app/server/Server.h b/src/app/server/Server.h index bf2746f202c1a4..5bd155cf215b74 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -100,7 +100,7 @@ struct ServerInitParams ServerInitParams() = default; // Not copyable - ServerInitParams(const ServerInitParams &) = delete; + ServerInitParams(const ServerInitParams &) = delete; ServerInitParams & operator=(const ServerInitParams &) = delete; // Application delegate to handle some commissioning lifecycle events @@ -182,7 +182,7 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams CommonCaseDeviceServerInitParams() = default; // Not copyable - CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; + CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; CommonCaseDeviceServerInitParams & operator=(const CommonCaseDeviceServerInitParams &) = delete; /** diff --git a/src/app/tests/TestCommissionManager.cpp b/src/app/tests/TestCommissionManager.cpp index 90399522e90556..73cf9423ef0838 100644 --- a/src/app/tests/TestCommissionManager.cpp +++ b/src/app/tests/TestCommissionManager.cpp @@ -137,7 +137,7 @@ void CheckCommissioningWindowManagerBasicWindowOpenCloseTask(intptr_t context) CommissioningWindowManager & commissionMgr = Server::GetInstance().GetCommissioningWindowManager(); CHIP_ERROR err = commissionMgr.OpenBasicCommissioningWindow(commissionMgr.MaxCommissioningTimeout(), - CommissioningWindowAdvertisement::kDnssdOnly); + CommissioningWindowAdvertisement::kDnssdOnly); NL_TEST_ASSERT(suite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(suite, commissionMgr.IsCommissioningWindowOpen()); NL_TEST_ASSERT(suite, @@ -175,7 +175,7 @@ void CheckCommissioningWindowManagerBasicWindowOpenCloseFromClusterTask(intptr_t constexpr auto fabricIndex = static_cast(1); constexpr auto vendorId = static_cast(0xFFF3); CHIP_ERROR err = commissionMgr.OpenBasicCommissioningWindowForAdministratorCommissioningCluster( - commissionMgr.MaxCommissioningTimeout(), fabricIndex, vendorId); + commissionMgr.MaxCommissioningTimeout(), fabricIndex, vendorId); NL_TEST_ASSERT(suite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(suite, commissionMgr.IsCommissioningWindowOpen()); NL_TEST_ASSERT(suite, From 2dc03f7d1451d88f59cfc1788ee8149c74fa75da Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Thu, 3 Aug 2023 13:27:26 -0400 Subject: [PATCH 3/9] Added a default ReportScheduler to the server init --- src/app/server/Server.cpp | 6 ++- src/app/server/Server.h | 111 ++++++++++++++++++++++++++++++-------- 2 files changed, 94 insertions(+), 23 deletions(-) diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index 7b7af39dfb25b5..7d8a27be94d751 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -117,7 +117,6 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) VerifyOrExit(initParams.sessionKeystore != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(initParams.operationalKeystore != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(initParams.opCertStore != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrExit(initParams.reportScheduler != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); // TODO(16969): Remove chip::Platform::MemoryInit() call from Server class, it belongs to outer code chip::Platform::MemoryInit(); @@ -253,7 +252,7 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) #endif // CHIP_CONFIG_ENABLE_SERVER_IM_EVENT #if CHIP_CONFIG_ENABLE_ICD_SERVER - mICDManager.Init(mDeviceStorage, &GetFabricTable(), &mReportScheduler); + mICDManager.Init(mDeviceStorage, &GetFabricTable(), mReportScheduler); mICDEventManager.Init(&mICDManager); #endif // CHIP_CONFIG_ENABLE_ICD_SERVER @@ -558,6 +557,9 @@ KvsPersistentStorageDelegate CommonCaseDeviceServerInitParams::sKvsPersistenStor PersistentStorageOperationalKeystore CommonCaseDeviceServerInitParams::sPersistentStorageOperationalKeystore; Credentials::PersistentStorageOpCertStore CommonCaseDeviceServerInitParams::sPersistentStorageOpCertStore; Credentials::GroupDataProviderImpl CommonCaseDeviceServerInitParams::sGroupDataProvider; +app::DefaultTimerDelegate CommonCaseDeviceServerInitParams::sTimerDelegate; +app::reporting::ReportSchedulerImpl + CommonCaseDeviceServerInitParams::sReportScheduler(&CommonCaseDeviceServerInitParams::sTimerDelegate); #if CHIP_CONFIG_ENABLE_SESSION_RESUMPTION SimpleSessionResumptionStorage CommonCaseDeviceServerInitParams::sSessionResumptionStorage; diff --git a/src/app/server/Server.h b/src/app/server/Server.h index 5bd155cf215b74..e7eed636df5532 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -100,7 +100,7 @@ struct ServerInitParams ServerInitParams() = default; // Not copyable - ServerInitParams(const ServerInitParams &) = delete; + ServerInitParams(const ServerInitParams &) = delete; ServerInitParams & operator=(const ServerInitParams &) = delete; // Application delegate to handle some commissioning lifecycle events @@ -182,7 +182,7 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams CommonCaseDeviceServerInitParams() = default; // Not copyable - CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; + CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; CommonCaseDeviceServerInitParams & operator=(const CommonCaseDeviceServerInitParams &) = delete; /** @@ -224,6 +224,11 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams this->opCertStore = &sPersistentStorageOpCertStore; } + if (this->reportScheduler == nullptr) + { + reportScheduler = &sReportScheduler; + } + // Session Keystore injection this->sessionKeystore = &sSessionKeystore; @@ -263,6 +268,13 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams static Credentials::PersistentStorageOpCertStore sPersistentStorageOpCertStore; static Credentials::GroupDataProviderImpl sGroupDataProvider; +#if CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED + static chip::SynchronizedTimerDelegate sTimerDelegate; + static app::reporting::SynchronizedReportSchedulerImpl sReportScheduler; +#else + static chip::app::DefaultTimerDelegate sTimerDelegate; + static app::reporting::ReportSchedulerImpl sReportScheduler; +#endif #if CHIP_CONFIG_ENABLE_SESSION_RESUMPTION static SimpleSessionResumptionStorage sSessionResumptionStorage; #endif @@ -306,43 +318,97 @@ class Server */ void RejoinExistingMulticastGroups(); - FabricTable & GetFabricTable() { return mFabrics; } + FabricTable & GetFabricTable() + { + return mFabrics; + } - CASESessionManager * GetCASESessionManager() { return &mCASESessionManager; } + CASESessionManager * GetCASESessionManager() + { + return &mCASESessionManager; + } - Messaging::ExchangeManager & GetExchangeManager() { return mExchangeMgr; } + Messaging::ExchangeManager & GetExchangeManager() + { + return mExchangeMgr; + } - SessionManager & GetSecureSessionManager() { return mSessions; } + SessionManager & GetSecureSessionManager() + { + return mSessions; + } - SessionResumptionStorage * GetSessionResumptionStorage() { return mSessionResumptionStorage; } + SessionResumptionStorage * GetSessionResumptionStorage() + { + return mSessionResumptionStorage; + } - app::SubscriptionResumptionStorage * GetSubscriptionResumptionStorage() { return mSubscriptionResumptionStorage; } + app::SubscriptionResumptionStorage * GetSubscriptionResumptionStorage() + { + return mSubscriptionResumptionStorage; + } - TransportMgrBase & GetTransportManager() { return mTransports; } + TransportMgrBase & GetTransportManager() + { + return mTransports; + } - Credentials::GroupDataProvider * GetGroupDataProvider() { return mGroupsProvider; } + Credentials::GroupDataProvider * GetGroupDataProvider() + { + return mGroupsProvider; + } - Crypto::SessionKeystore * GetSessionKeystore() const { return mSessionKeystore; } + Crypto::SessionKeystore * GetSessionKeystore() const + { + return mSessionKeystore; + } #if CONFIG_NETWORK_LAYER_BLE - Ble::BleLayer * GetBleLayerObject() { return mBleLayer; } + Ble::BleLayer * GetBleLayerObject() + { + return mBleLayer; + } #endif - CommissioningWindowManager & GetCommissioningWindowManager() { return mCommissioningWindowManager; } + CommissioningWindowManager & GetCommissioningWindowManager() + { + return mCommissioningWindowManager; + } - PersistentStorageDelegate & GetPersistentStorage() { return *mDeviceStorage; } + PersistentStorageDelegate & GetPersistentStorage() + { + return *mDeviceStorage; + } - app::FailSafeContext & GetFailSafeContext() { return mFailSafeContext; } + app::FailSafeContext & GetFailSafeContext() + { + return mFailSafeContext; + } - TestEventTriggerDelegate * GetTestEventTriggerDelegate() { return mTestEventTriggerDelegate; } + TestEventTriggerDelegate * GetTestEventTriggerDelegate() + { + return mTestEventTriggerDelegate; + } - Crypto::OperationalKeystore * GetOperationalKeystore() { return mOperationalKeystore; } + Crypto::OperationalKeystore * GetOperationalKeystore() + { + return mOperationalKeystore; + } - Credentials::OperationalCertificateStore * GetOpCertStore() { return mOpCertStore; } + Credentials::OperationalCertificateStore * GetOpCertStore() + { + return mOpCertStore; + } - app::DefaultAttributePersistenceProvider & GetDefaultAttributePersister() { return mAttributePersister; } + app::DefaultAttributePersistenceProvider & GetDefaultAttributePersister() + { + return mAttributePersister; + } - app::reporting::ReportScheduler * GetReportScheduler() { return mReportScheduler; } + app::reporting::ReportScheduler * GetReportScheduler() + { + return mReportScheduler; + } /** * This function causes the ShutDown event to be generated async on the @@ -359,7 +425,10 @@ class Server return System::SystemClock().GetMonotonicMicroseconds64() - mInitTimestamp; } - static Server & GetInstance() { return sServer; } + static Server & GetInstance() + { + return sServer; + } private: Server() {} From 55bccd67db394a89d243c166665af2169e98ed8c Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 3 Aug 2023 17:31:06 +0000 Subject: [PATCH 4/9] Restyled by clang-format --- src/app/server/Server.h | 99 +++++++++-------------------------------- 1 file changed, 21 insertions(+), 78 deletions(-) diff --git a/src/app/server/Server.h b/src/app/server/Server.h index e7eed636df5532..a715b552274c05 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -100,7 +100,7 @@ struct ServerInitParams ServerInitParams() = default; // Not copyable - ServerInitParams(const ServerInitParams &) = delete; + ServerInitParams(const ServerInitParams &) = delete; ServerInitParams & operator=(const ServerInitParams &) = delete; // Application delegate to handle some commissioning lifecycle events @@ -182,7 +182,7 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams CommonCaseDeviceServerInitParams() = default; // Not copyable - CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; + CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; CommonCaseDeviceServerInitParams & operator=(const CommonCaseDeviceServerInitParams &) = delete; /** @@ -318,97 +318,43 @@ class Server */ void RejoinExistingMulticastGroups(); - FabricTable & GetFabricTable() - { - return mFabrics; - } + FabricTable & GetFabricTable() { return mFabrics; } - CASESessionManager * GetCASESessionManager() - { - return &mCASESessionManager; - } + CASESessionManager * GetCASESessionManager() { return &mCASESessionManager; } - Messaging::ExchangeManager & GetExchangeManager() - { - return mExchangeMgr; - } + Messaging::ExchangeManager & GetExchangeManager() { return mExchangeMgr; } - SessionManager & GetSecureSessionManager() - { - return mSessions; - } + SessionManager & GetSecureSessionManager() { return mSessions; } - SessionResumptionStorage * GetSessionResumptionStorage() - { - return mSessionResumptionStorage; - } + SessionResumptionStorage * GetSessionResumptionStorage() { return mSessionResumptionStorage; } - app::SubscriptionResumptionStorage * GetSubscriptionResumptionStorage() - { - return mSubscriptionResumptionStorage; - } + app::SubscriptionResumptionStorage * GetSubscriptionResumptionStorage() { return mSubscriptionResumptionStorage; } - TransportMgrBase & GetTransportManager() - { - return mTransports; - } + TransportMgrBase & GetTransportManager() { return mTransports; } - Credentials::GroupDataProvider * GetGroupDataProvider() - { - return mGroupsProvider; - } + Credentials::GroupDataProvider * GetGroupDataProvider() { return mGroupsProvider; } - Crypto::SessionKeystore * GetSessionKeystore() const - { - return mSessionKeystore; - } + Crypto::SessionKeystore * GetSessionKeystore() const { return mSessionKeystore; } #if CONFIG_NETWORK_LAYER_BLE - Ble::BleLayer * GetBleLayerObject() - { - return mBleLayer; - } + Ble::BleLayer * GetBleLayerObject() { return mBleLayer; } #endif - CommissioningWindowManager & GetCommissioningWindowManager() - { - return mCommissioningWindowManager; - } + CommissioningWindowManager & GetCommissioningWindowManager() { return mCommissioningWindowManager; } - PersistentStorageDelegate & GetPersistentStorage() - { - return *mDeviceStorage; - } + PersistentStorageDelegate & GetPersistentStorage() { return *mDeviceStorage; } - app::FailSafeContext & GetFailSafeContext() - { - return mFailSafeContext; - } + app::FailSafeContext & GetFailSafeContext() { return mFailSafeContext; } - TestEventTriggerDelegate * GetTestEventTriggerDelegate() - { - return mTestEventTriggerDelegate; - } + TestEventTriggerDelegate * GetTestEventTriggerDelegate() { return mTestEventTriggerDelegate; } - Crypto::OperationalKeystore * GetOperationalKeystore() - { - return mOperationalKeystore; - } + Crypto::OperationalKeystore * GetOperationalKeystore() { return mOperationalKeystore; } - Credentials::OperationalCertificateStore * GetOpCertStore() - { - return mOpCertStore; - } + Credentials::OperationalCertificateStore * GetOpCertStore() { return mOpCertStore; } - app::DefaultAttributePersistenceProvider & GetDefaultAttributePersister() - { - return mAttributePersister; - } + app::DefaultAttributePersistenceProvider & GetDefaultAttributePersister() { return mAttributePersister; } - app::reporting::ReportScheduler * GetReportScheduler() - { - return mReportScheduler; - } + app::reporting::ReportScheduler * GetReportScheduler() { return mReportScheduler; } /** * This function causes the ShutDown event to be generated async on the @@ -425,10 +371,7 @@ class Server return System::SystemClock().GetMonotonicMicroseconds64() - mInitTimestamp; } - static Server & GetInstance() - { - return sServer; - } + static Server & GetInstance() { return sServer; } private: Server() {} From 2451ab0586d3002b4d44a7596f22bf0060143ecb Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Thu, 3 Aug 2023 15:48:47 -0400 Subject: [PATCH 5/9] Removed the double instanciation of report scheduler in ESP32 to reduce ram usage --- examples/chef/esp32/main/main.cpp | 7 +- .../platform/esp32/common/Esp32AppServer.cpp | 7 +- src/app/server/Server.h | 103 ++++++++++++++---- 3 files changed, 81 insertions(+), 36 deletions(-) diff --git a/examples/chef/esp32/main/main.cpp b/examples/chef/esp32/main/main.cpp index 2f4f76c30f2f72..cf97a1a830d769 100644 --- a/examples/chef/esp32/main/main.cpp +++ b/examples/chef/esp32/main/main.cpp @@ -29,9 +29,7 @@ #include #include -#include #include -#include #include #include @@ -159,10 +157,7 @@ void InitServer(intptr_t) { // Start IM server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; + (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/platform/esp32/common/Esp32AppServer.cpp b/examples/platform/esp32/common/Esp32AppServer.cpp index de89986f2f59cb..0dcc6e9471e77b 100644 --- a/examples/platform/esp32/common/Esp32AppServer.cpp +++ b/examples/platform/esp32/common/Esp32AppServer.cpp @@ -18,10 +18,8 @@ #include "Esp32AppServer.h" #include "CHIPDeviceManager.h" -#include #include #include -#include #include #include #include @@ -99,10 +97,7 @@ void Esp32AppServer::Init(AppDelegate * sAppDelegate) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; + #if CONFIG_TEST_EVENT_TRIGGER_ENABLED && CONFIG_ENABLE_OTA_REQUESTOR if (hex_string_to_binary(CONFIG_TEST_EVENT_TRIGGER_ENABLE_KEY, sTestEventTriggerEnableKey, sizeof(sTestEventTriggerEnableKey)) == 0) diff --git a/src/app/server/Server.h b/src/app/server/Server.h index a715b552274c05..bd09091c73f068 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -100,7 +100,7 @@ struct ServerInitParams ServerInitParams() = default; // Not copyable - ServerInitParams(const ServerInitParams &) = delete; + ServerInitParams(const ServerInitParams &) = delete; ServerInitParams & operator=(const ServerInitParams &) = delete; // Application delegate to handle some commissioning lifecycle events @@ -182,7 +182,7 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams CommonCaseDeviceServerInitParams() = default; // Not copyable - CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; + CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; CommonCaseDeviceServerInitParams & operator=(const CommonCaseDeviceServerInitParams &) = delete; /** @@ -267,12 +267,10 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams static PersistentStorageOperationalKeystore sPersistentStorageOperationalKeystore; static Credentials::PersistentStorageOpCertStore sPersistentStorageOpCertStore; static Credentials::GroupDataProviderImpl sGroupDataProvider; - + static chip::app::DefaultTimerDelegate sTimerDelegate; #if CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED - static chip::SynchronizedTimerDelegate sTimerDelegate; static app::reporting::SynchronizedReportSchedulerImpl sReportScheduler; #else - static chip::app::DefaultTimerDelegate sTimerDelegate; static app::reporting::ReportSchedulerImpl sReportScheduler; #endif #if CHIP_CONFIG_ENABLE_SESSION_RESUMPTION @@ -318,43 +316,97 @@ class Server */ void RejoinExistingMulticastGroups(); - FabricTable & GetFabricTable() { return mFabrics; } + FabricTable & GetFabricTable() + { + return mFabrics; + } - CASESessionManager * GetCASESessionManager() { return &mCASESessionManager; } + CASESessionManager * GetCASESessionManager() + { + return &mCASESessionManager; + } - Messaging::ExchangeManager & GetExchangeManager() { return mExchangeMgr; } + Messaging::ExchangeManager & GetExchangeManager() + { + return mExchangeMgr; + } - SessionManager & GetSecureSessionManager() { return mSessions; } + SessionManager & GetSecureSessionManager() + { + return mSessions; + } - SessionResumptionStorage * GetSessionResumptionStorage() { return mSessionResumptionStorage; } + SessionResumptionStorage * GetSessionResumptionStorage() + { + return mSessionResumptionStorage; + } - app::SubscriptionResumptionStorage * GetSubscriptionResumptionStorage() { return mSubscriptionResumptionStorage; } + app::SubscriptionResumptionStorage * GetSubscriptionResumptionStorage() + { + return mSubscriptionResumptionStorage; + } - TransportMgrBase & GetTransportManager() { return mTransports; } + TransportMgrBase & GetTransportManager() + { + return mTransports; + } - Credentials::GroupDataProvider * GetGroupDataProvider() { return mGroupsProvider; } + Credentials::GroupDataProvider * GetGroupDataProvider() + { + return mGroupsProvider; + } - Crypto::SessionKeystore * GetSessionKeystore() const { return mSessionKeystore; } + Crypto::SessionKeystore * GetSessionKeystore() const + { + return mSessionKeystore; + } #if CONFIG_NETWORK_LAYER_BLE - Ble::BleLayer * GetBleLayerObject() { return mBleLayer; } + Ble::BleLayer * GetBleLayerObject() + { + return mBleLayer; + } #endif - CommissioningWindowManager & GetCommissioningWindowManager() { return mCommissioningWindowManager; } + CommissioningWindowManager & GetCommissioningWindowManager() + { + return mCommissioningWindowManager; + } - PersistentStorageDelegate & GetPersistentStorage() { return *mDeviceStorage; } + PersistentStorageDelegate & GetPersistentStorage() + { + return *mDeviceStorage; + } - app::FailSafeContext & GetFailSafeContext() { return mFailSafeContext; } + app::FailSafeContext & GetFailSafeContext() + { + return mFailSafeContext; + } - TestEventTriggerDelegate * GetTestEventTriggerDelegate() { return mTestEventTriggerDelegate; } + TestEventTriggerDelegate * GetTestEventTriggerDelegate() + { + return mTestEventTriggerDelegate; + } - Crypto::OperationalKeystore * GetOperationalKeystore() { return mOperationalKeystore; } + Crypto::OperationalKeystore * GetOperationalKeystore() + { + return mOperationalKeystore; + } - Credentials::OperationalCertificateStore * GetOpCertStore() { return mOpCertStore; } + Credentials::OperationalCertificateStore * GetOpCertStore() + { + return mOpCertStore; + } - app::DefaultAttributePersistenceProvider & GetDefaultAttributePersister() { return mAttributePersister; } + app::DefaultAttributePersistenceProvider & GetDefaultAttributePersister() + { + return mAttributePersister; + } - app::reporting::ReportScheduler * GetReportScheduler() { return mReportScheduler; } + app::reporting::ReportScheduler * GetReportScheduler() + { + return mReportScheduler; + } /** * This function causes the ShutDown event to be generated async on the @@ -371,7 +423,10 @@ class Server return System::SystemClock().GetMonotonicMicroseconds64() - mInitTimestamp; } - static Server & GetInstance() { return sServer; } + static Server & GetInstance() + { + return sServer; + } private: Server() {} From ae40e287dbb1ae882467bd206714d287af09a91e Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 3 Aug 2023 19:50:05 +0000 Subject: [PATCH 6/9] Restyled by clang-format --- src/app/server/Server.h | 99 +++++++++-------------------------------- 1 file changed, 21 insertions(+), 78 deletions(-) diff --git a/src/app/server/Server.h b/src/app/server/Server.h index bd09091c73f068..464843320a22c2 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -100,7 +100,7 @@ struct ServerInitParams ServerInitParams() = default; // Not copyable - ServerInitParams(const ServerInitParams &) = delete; + ServerInitParams(const ServerInitParams &) = delete; ServerInitParams & operator=(const ServerInitParams &) = delete; // Application delegate to handle some commissioning lifecycle events @@ -182,7 +182,7 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams CommonCaseDeviceServerInitParams() = default; // Not copyable - CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; + CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; CommonCaseDeviceServerInitParams & operator=(const CommonCaseDeviceServerInitParams &) = delete; /** @@ -316,97 +316,43 @@ class Server */ void RejoinExistingMulticastGroups(); - FabricTable & GetFabricTable() - { - return mFabrics; - } + FabricTable & GetFabricTable() { return mFabrics; } - CASESessionManager * GetCASESessionManager() - { - return &mCASESessionManager; - } + CASESessionManager * GetCASESessionManager() { return &mCASESessionManager; } - Messaging::ExchangeManager & GetExchangeManager() - { - return mExchangeMgr; - } + Messaging::ExchangeManager & GetExchangeManager() { return mExchangeMgr; } - SessionManager & GetSecureSessionManager() - { - return mSessions; - } + SessionManager & GetSecureSessionManager() { return mSessions; } - SessionResumptionStorage * GetSessionResumptionStorage() - { - return mSessionResumptionStorage; - } + SessionResumptionStorage * GetSessionResumptionStorage() { return mSessionResumptionStorage; } - app::SubscriptionResumptionStorage * GetSubscriptionResumptionStorage() - { - return mSubscriptionResumptionStorage; - } + app::SubscriptionResumptionStorage * GetSubscriptionResumptionStorage() { return mSubscriptionResumptionStorage; } - TransportMgrBase & GetTransportManager() - { - return mTransports; - } + TransportMgrBase & GetTransportManager() { return mTransports; } - Credentials::GroupDataProvider * GetGroupDataProvider() - { - return mGroupsProvider; - } + Credentials::GroupDataProvider * GetGroupDataProvider() { return mGroupsProvider; } - Crypto::SessionKeystore * GetSessionKeystore() const - { - return mSessionKeystore; - } + Crypto::SessionKeystore * GetSessionKeystore() const { return mSessionKeystore; } #if CONFIG_NETWORK_LAYER_BLE - Ble::BleLayer * GetBleLayerObject() - { - return mBleLayer; - } + Ble::BleLayer * GetBleLayerObject() { return mBleLayer; } #endif - CommissioningWindowManager & GetCommissioningWindowManager() - { - return mCommissioningWindowManager; - } + CommissioningWindowManager & GetCommissioningWindowManager() { return mCommissioningWindowManager; } - PersistentStorageDelegate & GetPersistentStorage() - { - return *mDeviceStorage; - } + PersistentStorageDelegate & GetPersistentStorage() { return *mDeviceStorage; } - app::FailSafeContext & GetFailSafeContext() - { - return mFailSafeContext; - } + app::FailSafeContext & GetFailSafeContext() { return mFailSafeContext; } - TestEventTriggerDelegate * GetTestEventTriggerDelegate() - { - return mTestEventTriggerDelegate; - } + TestEventTriggerDelegate * GetTestEventTriggerDelegate() { return mTestEventTriggerDelegate; } - Crypto::OperationalKeystore * GetOperationalKeystore() - { - return mOperationalKeystore; - } + Crypto::OperationalKeystore * GetOperationalKeystore() { return mOperationalKeystore; } - Credentials::OperationalCertificateStore * GetOpCertStore() - { - return mOpCertStore; - } + Credentials::OperationalCertificateStore * GetOpCertStore() { return mOpCertStore; } - app::DefaultAttributePersistenceProvider & GetDefaultAttributePersister() - { - return mAttributePersister; - } + app::DefaultAttributePersistenceProvider & GetDefaultAttributePersister() { return mAttributePersister; } - app::reporting::ReportScheduler * GetReportScheduler() - { - return mReportScheduler; - } + app::reporting::ReportScheduler * GetReportScheduler() { return mReportScheduler; } /** * This function causes the ShutDown event to be generated async on the @@ -423,10 +369,7 @@ class Server return System::SystemClock().GetMonotonicMicroseconds64() - mInitTimestamp; } - static Server & GetInstance() - { - return sServer; - } + static Server & GetInstance() { return sServer; } private: Server() {} From 9ebd8b5e9ba1c1cd1f31ad10196c8ce25c534523 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Fri, 4 Aug 2023 11:10:29 -0400 Subject: [PATCH 7/9] Removed instanciation of ReportScheduler in examples as the default is now in Common Server Init params --- .../ameba/main/chipinterface.cpp | 6 ----- .../cc13x2x7_26x2x7/main/AppTask.cpp | 6 ----- .../cc13x4_26x4/main/AppTask.cpp | 6 ----- .../infineon/psoc6/src/AppTask.cpp | 6 ----- .../all-clusters-app/linux/fuzzing-main.cpp | 6 ----- .../all-clusters-app/mbed/main/AppTask.cpp | 6 ----- .../nrfconnect/main/AppTask.cpp | 6 ----- examples/all-clusters-app/nxp/mw320/main.cpp | 6 ----- .../ameba/main/chipinterface.cpp | 6 ----- .../infineon/psoc6/src/AppTask.cpp | 13 ++++------- .../linux/fuzzing-main.cpp | 6 ----- .../mbed/main/AppTask.cpp | 6 ----- .../nrfconnect/main/AppTask.cpp | 6 ----- examples/bridge-app/linux/main.cpp | 6 ----- examples/chef/ameba/main/chipinterface.cpp | 6 ----- examples/chef/esp32/main/main.cpp | 1 - examples/chef/nrfconnect/main.cpp | 6 ----- .../nxp/k32w/k32w0/main/AppTask.cpp | 6 ----- .../ameba/main/chipinterface.cpp | 6 ----- .../light-switch-app/genio/src/AppTask.cpp | 6 ----- .../infineon/cyw30739/src/main.cpp | 6 ----- .../nrfconnect/main/AppTask.cpp | 6 ----- .../lighting-app/ameba/main/chipinterface.cpp | 6 ----- .../cc13x2x7_26x2x7/src/AppTask.cpp | 6 ----- .../lighting-app/cc13x4_26x4/src/AppTask.cpp | 6 ----- examples/lighting-app/genio/src/AppTask.cpp | 6 ----- .../infineon/cyw30739/src/main.cpp | 6 ----- .../infineon/psoc6/src/AppTask.cpp | 6 ----- examples/lighting-app/mbed/main/AppTask.cpp | 6 ----- .../lighting-app/nrfconnect/main/AppTask.cpp | 6 ----- .../nxp/k32w/k32w0/main/AppTask.cpp | 6 ----- examples/lighting-app/qpg/src/AppTask.cpp | 6 ----- .../lock-app/cc13x2x7_26x2x7/main/AppTask.cpp | 6 ----- .../lock-app/cc13x2x7_26x2x7/src/AppTask.cpp | 6 ----- examples/lock-app/cc13x4_26x4/src/AppTask.cpp | 6 ----- examples/lock-app/cc32xx/main/AppTask.cpp | 6 ----- examples/lock-app/genio/src/AppTask.cpp | 8 +------ .../lock-app/infineon/cyw30739/src/main.cpp | 6 ----- .../lock-app/infineon/psoc6/src/AppTask.cpp | 6 ----- examples/lock-app/mbed/main/AppTask.cpp | 6 ----- examples/lock-app/nrfconnect/main/AppTask.cpp | 6 ----- .../lock-app/nxp/k32w/k32w0/main/AppTask.cpp | 6 ----- examples/lock-app/qpg/src/AppTask.cpp | 6 ----- examples/log-source-app/linux/main.cpp | 6 ----- .../ameba/main/chipinterface.cpp | 6 ----- .../ota-requestor-app/genio/src/AppTask.cpp | 6 ----- .../infineon/cyw30739/src/main.cpp | 6 ----- .../ota-requestor-app/mbed/main/AppTask.cpp | 6 ----- examples/platform/asr/init_Matter.cpp | 6 ----- .../platform/beken/common/BekenAppServer.cpp | 6 ----- .../bouffalolab/common/plat/platform.cpp | 6 ----- .../platform/esp32/common/Esp32AppServer.cpp | 1 - examples/platform/linux/AppMain.cpp | 6 ----- examples/platform/nxp/se05x/linux/AppMain.cpp | 7 +----- .../platform/openiotsdk/app/CMakeLists.txt | 4 ---- .../openiotsdk/app/openiotsdk_platform.cpp | 8 +------ examples/platform/silabs/MatterConfig.cpp | 12 ++++++++++ .../telink/common/src/AppTaskCommon.cpp | 6 ----- .../pump-app/cc13x2x7_26x2x7/main/AppTask.cpp | 6 ----- .../pump-app/cc13x4_26x4/main/AppTask.cpp | 6 ----- examples/pump-app/nrfconnect/main/AppTask.cpp | 6 ----- .../cc13x2x7_26x2x7/main/AppTask.cpp | 6 ----- .../cc13x4_26x4/main/AppTask.cpp | 6 ----- .../nrfconnect/main/AppTask.cpp | 6 ----- .../shell/cc13x2x7_26x2x7/main/AppTask.cpp | 6 ----- examples/shell/cc13x4_26x4/main/AppTask.cpp | 6 ----- .../shell/nxp/k32w/k32w0/main/AppTask.cpp | 6 ----- examples/shell/shell_common/cmd_server.cpp | 6 ----- examples/thermostat/genio/src/AppTask.cpp | 6 ----- .../CastingServerBridge.mm | 6 ----- examples/tv-casting-app/linux/main.cpp | 6 ----- .../window-app/nrfconnect/main/AppTask.cpp | 6 ----- src/app/server/Server.cpp | 2 +- src/app/server/Server.h | 22 +++++++++---------- src/lib/core/CHIPConfig.h | 2 +- 75 files changed, 31 insertions(+), 433 deletions(-) diff --git a/examples/all-clusters-app/ameba/main/chipinterface.cpp b/examples/all-clusters-app/ameba/main/chipinterface.cpp index be401bce9cc3dc..55107d380a555f 100644 --- a/examples/all-clusters-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-app/ameba/main/chipinterface.cpp @@ -26,10 +26,8 @@ #include #include -#include #include #include -#include #include #include #include @@ -129,10 +127,6 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp index 80b464b56304fa..2d5896a236b570 100644 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -20,8 +20,6 @@ #include "AppTask.h" #include "AppConfig.h" #include "AppEvent.h" -#include -#include #include #include @@ -251,10 +249,6 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Initialize info provider diff --git a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp index 65cbc3721c242c..b8fa3a21a4f9d8 100644 --- a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp @@ -19,8 +19,6 @@ #include "AppTask.h" #include "AppConfig.h" #include "AppEvent.h" -#include -#include #include #include @@ -252,10 +250,6 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Initialize info provider diff --git a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp index 5ec1bc61151b78..3fde24f3817d04 100644 --- a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp @@ -25,8 +25,6 @@ #include "LEDWidget.h" #include #include -#include -#include #include #include #include @@ -127,10 +125,6 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/all-clusters-app/linux/fuzzing-main.cpp b/examples/all-clusters-app/linux/fuzzing-main.cpp index 9a2e3fb0eb707b..4fe21865727371 100644 --- a/examples/all-clusters-app/linux/fuzzing-main.cpp +++ b/examples/all-clusters-app/linux/fuzzing-main.cpp @@ -16,8 +16,6 @@ */ #include "AppMain.h" -#include -#include #include #include @@ -56,10 +54,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t * aData, size_t aSize) // ChipLinuxAppMainLoop blocks, and we don't want that here. static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); VerifyOrDie(Server::GetInstance().Init(initParams) == CHIP_NO_ERROR); diff --git a/examples/all-clusters-app/mbed/main/AppTask.cpp b/examples/all-clusters-app/mbed/main/AppTask.cpp index 5fa9c10a114db0..b497ea7919a0a3 100644 --- a/examples/all-clusters-app/mbed/main/AppTask.cpp +++ b/examples/all-clusters-app/mbed/main/AppTask.cpp @@ -21,8 +21,6 @@ #include #include -#include -#include #include #include #include @@ -71,10 +69,6 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); error = Server::GetInstance().Init(initParams); if (error != CHIP_NO_ERROR) diff --git a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp index 23abb312907ada..4b837e04a01551 100644 --- a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp @@ -23,8 +23,6 @@ #include -#include -#include #include #include @@ -200,10 +198,6 @@ CHIP_ERROR AppTask::Init() #endif static CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; diff --git a/examples/all-clusters-app/nxp/mw320/main.cpp b/examples/all-clusters-app/nxp/mw320/main.cpp index a928876d848d19..8344be7cda1b80 100644 --- a/examples/all-clusters-app/nxp/mw320/main.cpp +++ b/examples/all-clusters-app/nxp/mw320/main.cpp @@ -32,8 +32,6 @@ #include #include #include -#include -#include #include #include #include @@ -1067,10 +1065,6 @@ static void run_chip_srv(System::Layer * aSystemLayer, void * aAppState) // chip::Server::GetInstance().Init(nullptr, securePort, unsecurePort); static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); PRINTF("Done to call chip::Server() \r\n"); diff --git a/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp b/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp index 183bcd5356e24e..870870bbf41999 100644 --- a/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp @@ -24,10 +24,8 @@ #include "chip_porting.h" #include -#include #include #include -#include #include #include #include @@ -156,10 +154,6 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); 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 7edaef7614f683..efbbb4af9ec705 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp @@ -23,12 +23,8 @@ #include "AppEvent.h" #include "ButtonHandler.h" #include "LEDWidget.h" -#include #include #include -#include -#include -#include #include #include #include @@ -38,10 +34,13 @@ #include #include #include -#include #include #include +#include +#include +#include + /* OTA related includes */ #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR #include @@ -124,10 +123,6 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp b/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp index 068dd3d454ae0c..b1736826ef335a 100644 --- a/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp +++ b/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp @@ -16,8 +16,6 @@ */ #include "AppMain.h" -#include -#include #include using namespace chip; @@ -44,10 +42,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t * aData, size_t aSize) // ChipLinuxAppMainLoop blocks, and we don't want that here. static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); VerifyOrDie(Server::GetInstance().Init(initParams) == CHIP_NO_ERROR); diff --git a/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp b/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp index c4aa8c345908f3..62317774c1520c 100644 --- a/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp @@ -21,8 +21,6 @@ #include #include -#include -#include #include #include #include @@ -66,10 +64,6 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); error = Server::GetInstance().Init(initParams); if (error != CHIP_NO_ERROR) diff --git a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp index fd622652c9fbd9..3307789c9e5989 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp @@ -21,8 +21,6 @@ #include "LEDUtil.h" #include "binding-handler.h" -#include -#include #include #include @@ -151,10 +149,6 @@ CHIP_ERROR AppTask::Init() #endif static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); diff --git a/examples/bridge-app/linux/main.cpp b/examples/bridge-app/linux/main.cpp index 4549216b102daa..32930d7133db77 100644 --- a/examples/bridge-app/linux/main.cpp +++ b/examples/bridge-app/linux/main.cpp @@ -24,8 +24,6 @@ #include #include #include -#include -#include #include #include #include @@ -943,10 +941,6 @@ int main(int argc, char * argv[]) // Init Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); #if CHIP_DEVICE_ENABLE_PORT_PARAMS diff --git a/examples/chef/ameba/main/chipinterface.cpp b/examples/chef/ameba/main/chipinterface.cpp index 00fa72f970fa46..7e52ae210e3ded 100644 --- a/examples/chef/ameba/main/chipinterface.cpp +++ b/examples/chef/ameba/main/chipinterface.cpp @@ -25,10 +25,8 @@ #include #include -#include #include #include -#include #include #include #include @@ -105,10 +103,6 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/chef/esp32/main/main.cpp b/examples/chef/esp32/main/main.cpp index cf97a1a830d769..49e817dfe5db9f 100644 --- a/examples/chef/esp32/main/main.cpp +++ b/examples/chef/esp32/main/main.cpp @@ -157,7 +157,6 @@ void InitServer(intptr_t) { // Start IM server static chip::CommonCaseDeviceServerInitParams initParams; - (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/chef/nrfconnect/main.cpp b/examples/chef/nrfconnect/main.cpp index 4e4cf808ddacbd..c4157798567e5b 100644 --- a/examples/chef/nrfconnect/main.cpp +++ b/examples/chef/nrfconnect/main.cpp @@ -27,8 +27,6 @@ #include #include -#include -#include #include #include @@ -112,10 +110,6 @@ int main() // Start IM server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); err = chip::Server::GetInstance().Init(initParams); if (err != CHIP_NO_ERROR) diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp index 7e19ce7be107f7..ecd120d9020f17 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -18,8 +18,6 @@ */ #include "AppTask.h" #include "AppEvent.h" -#include -#include #include #include #include @@ -259,10 +257,6 @@ void UnlockOpenThreadTask(void) void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); auto & infoProvider = chip::DeviceLayer::DeviceInfoProviderImpl::GetDefaultInstance(); diff --git a/examples/light-switch-app/ameba/main/chipinterface.cpp b/examples/light-switch-app/ameba/main/chipinterface.cpp index 3bbf1f1004f4b7..81cb25a2db011c 100644 --- a/examples/light-switch-app/ameba/main/chipinterface.cpp +++ b/examples/light-switch-app/ameba/main/chipinterface.cpp @@ -26,10 +26,8 @@ #include #include -#include #include #include -#include #include #include #include @@ -101,10 +99,6 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/light-switch-app/genio/src/AppTask.cpp b/examples/light-switch-app/genio/src/AppTask.cpp index f7447d4f4ecfe3..f820d05ef14b05 100644 --- a/examples/light-switch-app/genio/src/AppTask.cpp +++ b/examples/light-switch-app/genio/src/AppTask.cpp @@ -25,10 +25,8 @@ #include "qrcodegen.h" -#include #include #include -#include #include #include #include @@ -125,10 +123,6 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/light-switch-app/infineon/cyw30739/src/main.cpp b/examples/light-switch-app/infineon/cyw30739/src/main.cpp index 8475c2c326c300..dbfdb81b875b3f 100644 --- a/examples/light-switch-app/infineon/cyw30739/src/main.cpp +++ b/examples/light-switch-app/infineon/cyw30739/src/main.cpp @@ -26,10 +26,8 @@ #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR #include #endif -#include #include #include -#include #include #include #include @@ -196,10 +194,6 @@ void InitApp(intptr_t args) /* Start CHIP datamodel server */ static chip::OTATestEventTriggerDelegate testEventTriggerDelegate{ chip::ByteSpan(sTestEventTriggerEnableKey) }; static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; gExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/light-switch-app/nrfconnect/main/AppTask.cpp b/examples/light-switch-app/nrfconnect/main/AppTask.cpp index f311199e0284e6..405664af872c24 100644 --- a/examples/light-switch-app/nrfconnect/main/AppTask.cpp +++ b/examples/light-switch-app/nrfconnect/main/AppTask.cpp @@ -23,10 +23,8 @@ #include "LightSwitch.h" #include -#include #include #include -#include #include #include #include @@ -215,10 +213,6 @@ CHIP_ERROR AppTask::Init() #endif static CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; diff --git a/examples/lighting-app/ameba/main/chipinterface.cpp b/examples/lighting-app/ameba/main/chipinterface.cpp index 822b9838383c44..4b342b4b413578 100644 --- a/examples/lighting-app/ameba/main/chipinterface.cpp +++ b/examples/lighting-app/ameba/main/chipinterface.cpp @@ -28,10 +28,8 @@ #include #include -#include #include #include -#include #include #include #include @@ -122,10 +120,6 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/lighting-app/cc13x2x7_26x2x7/src/AppTask.cpp b/examples/lighting-app/cc13x2x7_26x2x7/src/AppTask.cpp index 39cd2b2b92394f..c9e8845a4f7323 100644 --- a/examples/lighting-app/cc13x2x7_26x2x7/src/AppTask.cpp +++ b/examples/lighting-app/cc13x2x7_26x2x7/src/AppTask.cpp @@ -43,10 +43,8 @@ #include -#include #include #include -#include #include #include #include @@ -220,10 +218,6 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Initialize info provider diff --git a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp index 44f0ba9646b9ac..b6cce74ca13aae 100644 --- a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp @@ -42,10 +42,8 @@ #include -#include #include #include -#include #include #include #include @@ -219,10 +217,6 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Initialize info provider diff --git a/examples/lighting-app/genio/src/AppTask.cpp b/examples/lighting-app/genio/src/AppTask.cpp index 9a41f7ca6911ad..6a121673a002a6 100644 --- a/examples/lighting-app/genio/src/AppTask.cpp +++ b/examples/lighting-app/genio/src/AppTask.cpp @@ -26,11 +26,9 @@ #include "qrcodegen.h" #include -#include #include #include #include -#include #include #include #include @@ -327,10 +325,6 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/lighting-app/infineon/cyw30739/src/main.cpp b/examples/lighting-app/infineon/cyw30739/src/main.cpp index 17727a564b1109..14730252de08b3 100644 --- a/examples/lighting-app/infineon/cyw30739/src/main.cpp +++ b/examples/lighting-app/infineon/cyw30739/src/main.cpp @@ -26,10 +26,8 @@ #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR #include #endif -#include #include #include -#include #include #include #include @@ -195,10 +193,6 @@ void InitApp(intptr_t args) /* Start CHIP datamodel server */ static chip::OTATestEventTriggerDelegate testEventTriggerDelegate{ chip::ByteSpan(sTestEventTriggerEnableKey) }; static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; gExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/lighting-app/infineon/psoc6/src/AppTask.cpp b/examples/lighting-app/infineon/psoc6/src/AppTask.cpp index a914a2b83d45f0..987213e84073e1 100644 --- a/examples/lighting-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/lighting-app/infineon/psoc6/src/AppTask.cpp @@ -25,8 +25,6 @@ #include #include #include -#include -#include #include #include #include @@ -144,10 +142,6 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/lighting-app/mbed/main/AppTask.cpp b/examples/lighting-app/mbed/main/AppTask.cpp index 8fadf51a928e9c..fdbe8ea0cce291 100644 --- a/examples/lighting-app/mbed/main/AppTask.cpp +++ b/examples/lighting-app/mbed/main/AppTask.cpp @@ -20,8 +20,6 @@ #include "LEDWidget.h" #include "LightingManager.h" -#include -#include #include #include #include @@ -117,10 +115,6 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); error = Server::GetInstance().Init(initParams); diff --git a/examples/lighting-app/nrfconnect/main/AppTask.cpp b/examples/lighting-app/nrfconnect/main/AppTask.cpp index 05dbe66f103370..e16230e000ca0f 100644 --- a/examples/lighting-app/nrfconnect/main/AppTask.cpp +++ b/examples/lighting-app/nrfconnect/main/AppTask.cpp @@ -26,10 +26,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -239,10 +237,6 @@ CHIP_ERROR AppTask::Init() #endif static CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; diff --git a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp index fa3834f755de52..d2bdbe55c0d2cc 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -18,8 +18,6 @@ */ #include "AppTask.h" #include "AppEvent.h" -#include -#include #include #include #include @@ -266,10 +264,6 @@ void UnlockOpenThreadTask(void) void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); auto & infoProvider = chip::DeviceLayer::DeviceInfoProviderImpl::GetDefaultInstance(); diff --git a/examples/lighting-app/qpg/src/AppTask.cpp b/examples/lighting-app/qpg/src/AppTask.cpp index 161a37ad81317a..ab504abfb51a52 100644 --- a/examples/lighting-app/qpg/src/AppTask.cpp +++ b/examples/lighting-app/qpg/src/AppTask.cpp @@ -38,8 +38,6 @@ #include #include -#include -#include #include #include #include @@ -236,10 +234,6 @@ CHIP_ERROR AppTask::StartAppTask() void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); gExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp index b17d567add27ec..1988455e958398 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -20,8 +20,6 @@ #include "AppTask.h" #include "AppConfig.h" #include "AppEvent.h" -#include -#include #include #include "FreeRTOS.h" @@ -169,10 +167,6 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Initialize info provider diff --git a/examples/lock-app/cc13x2x7_26x2x7/src/AppTask.cpp b/examples/lock-app/cc13x2x7_26x2x7/src/AppTask.cpp index cd962f568b4f7a..d4e3d8f17f42db 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/src/AppTask.cpp +++ b/examples/lock-app/cc13x2x7_26x2x7/src/AppTask.cpp @@ -42,10 +42,8 @@ #include -#include #include #include -#include #include #include #include @@ -215,10 +213,6 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Initialize info provider diff --git a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp index f5b1005e49bd3a..c73fd1f3909100 100644 --- a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp @@ -41,10 +41,8 @@ #include -#include #include #include -#include #include #include #include @@ -214,10 +212,6 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Initialize info provider diff --git a/examples/lock-app/cc32xx/main/AppTask.cpp b/examples/lock-app/cc32xx/main/AppTask.cpp index 26eacf6b05c309..28c0675b8c717a 100644 --- a/examples/lock-app/cc32xx/main/AppTask.cpp +++ b/examples/lock-app/cc32xx/main/AppTask.cpp @@ -23,8 +23,6 @@ #include #include -#include -#include #include #include @@ -152,10 +150,6 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/lock-app/genio/src/AppTask.cpp b/examples/lock-app/genio/src/AppTask.cpp index 3814f013224765..b06d9535c35c3b 100644 --- a/examples/lock-app/genio/src/AppTask.cpp +++ b/examples/lock-app/genio/src/AppTask.cpp @@ -25,11 +25,9 @@ #include "qrcodegen.h" #include #include -#include #include #include #include -#include #include #include #include @@ -52,7 +50,7 @@ #define APP_TASK_STACK_SIZE (4096) #define APP_TASK_PRIORITY 2 #define APP_EVENT_QUEUE_SIZE 10 -// #define EXAMPLE_VENDOR_ID 0xcafe +//#define EXAMPLE_VENDOR_ID 0xcafe #ifdef portYIELD_FROM_ISR #define OS_YIELD_FROM_ISR(yield) portYIELD_FROM_ISR(yield) @@ -140,10 +138,6 @@ CHIP_ERROR AppTask::Init() #endif // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/lock-app/infineon/cyw30739/src/main.cpp b/examples/lock-app/infineon/cyw30739/src/main.cpp index d9032bef3a7062..76fa8484ce74eb 100644 --- a/examples/lock-app/infineon/cyw30739/src/main.cpp +++ b/examples/lock-app/infineon/cyw30739/src/main.cpp @@ -28,11 +28,9 @@ #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR #include #endif -#include #include #include #include -#include #include #include #include @@ -195,10 +193,6 @@ void InitApp(intptr_t args) /* Start CHIP datamodel server */ static chip::OTATestEventTriggerDelegate testEventTriggerDelegate{ chip::ByteSpan(sTestEventTriggerEnableKey) }; static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; gExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/lock-app/infineon/psoc6/src/AppTask.cpp b/examples/lock-app/infineon/psoc6/src/AppTask.cpp index 2a7eba19e81509..14d5aba533d2b1 100644 --- a/examples/lock-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/lock-app/infineon/psoc6/src/AppTask.cpp @@ -24,10 +24,8 @@ #include #include -#include #include #include -#include #include #include #include @@ -152,10 +150,6 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/lock-app/mbed/main/AppTask.cpp b/examples/lock-app/mbed/main/AppTask.cpp index aa5d8900f90702..4e1d0c70e943cc 100644 --- a/examples/lock-app/mbed/main/AppTask.cpp +++ b/examples/lock-app/mbed/main/AppTask.cpp @@ -20,8 +20,6 @@ #include "BoltLockManager.h" #include -#include -#include #include #include #include @@ -120,10 +118,6 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); error = Server::GetInstance().Init(initParams); diff --git a/examples/lock-app/nrfconnect/main/AppTask.cpp b/examples/lock-app/nrfconnect/main/AppTask.cpp index e63ba82aaa95b3..aa65236ba747d2 100644 --- a/examples/lock-app/nrfconnect/main/AppTask.cpp +++ b/examples/lock-app/nrfconnect/main/AppTask.cpp @@ -24,11 +24,9 @@ #include #include -#include #include #include #include -#include #include #include #include @@ -209,10 +207,6 @@ CHIP_ERROR AppTask::Init() #endif static CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; diff --git a/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp index 3be1bd0f683e86..b4e793a525d8d4 100644 --- a/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -18,8 +18,6 @@ */ #include "AppTask.h" #include "AppEvent.h" -#include -#include #include #include #include @@ -182,10 +180,6 @@ void UnlockOpenThreadTask(void) void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); auto & infoProvider = chip::DeviceLayer::DeviceInfoProviderImpl::GetDefaultInstance(); diff --git a/examples/lock-app/qpg/src/AppTask.cpp b/examples/lock-app/qpg/src/AppTask.cpp index 0f5f42ac7d6669..3466d8c4a4c395 100644 --- a/examples/lock-app/qpg/src/AppTask.cpp +++ b/examples/lock-app/qpg/src/AppTask.cpp @@ -26,11 +26,9 @@ #include #include -#include #include #include #include -#include #include #include #include @@ -180,10 +178,6 @@ CHIP_ERROR AppTask::StartAppTask() void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); gExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); diff --git a/examples/log-source-app/linux/main.cpp b/examples/log-source-app/linux/main.cpp index a459dacff6696f..9443a946e1a871 100644 --- a/examples/log-source-app/linux/main.cpp +++ b/examples/log-source-app/linux/main.cpp @@ -18,9 +18,7 @@ #include #include -#include #include -#include #include #include #include @@ -105,10 +103,6 @@ int main(int argc, char * argv[]) chip::DeviceLayer::ConfigurationMgr().LogDeviceConfig(); static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/ota-requestor-app/ameba/main/chipinterface.cpp b/examples/ota-requestor-app/ameba/main/chipinterface.cpp index 25fce7deaf05b8..ee8e80086fbca4 100644 --- a/examples/ota-requestor-app/ameba/main/chipinterface.cpp +++ b/examples/ota-requestor-app/ameba/main/chipinterface.cpp @@ -22,9 +22,7 @@ #include "chip_porting.h" #include -#include #include -#include #include #include @@ -77,10 +75,6 @@ static void InitServer(intptr_t context) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); diff --git a/examples/ota-requestor-app/genio/src/AppTask.cpp b/examples/ota-requestor-app/genio/src/AppTask.cpp index dbf45da43bfcd5..43c92cf26adeeb 100644 --- a/examples/ota-requestor-app/genio/src/AppTask.cpp +++ b/examples/ota-requestor-app/genio/src/AppTask.cpp @@ -16,10 +16,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include #include #include -#include #include #include #include @@ -109,10 +107,6 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/ota-requestor-app/infineon/cyw30739/src/main.cpp b/examples/ota-requestor-app/infineon/cyw30739/src/main.cpp index 09860b48592350..14ce58809f68dc 100644 --- a/examples/ota-requestor-app/infineon/cyw30739/src/main.cpp +++ b/examples/ota-requestor-app/infineon/cyw30739/src/main.cpp @@ -20,8 +20,6 @@ #include #include -#include -#include #include #include #include @@ -124,10 +122,6 @@ void InitApp(intptr_t args) /* Start CHIP datamodel server */ static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Inet::EndPointStateOpenThread::OpenThreadEndpointInitParam nativeParams; nativeParams.lockCb = [] { ThreadStackMgr().LockThreadStack(); }; diff --git a/examples/ota-requestor-app/mbed/main/AppTask.cpp b/examples/ota-requestor-app/mbed/main/AppTask.cpp index ed7326580a1def..0fa7df26f8d19c 100644 --- a/examples/ota-requestor-app/mbed/main/AppTask.cpp +++ b/examples/ota-requestor-app/mbed/main/AppTask.cpp @@ -19,8 +19,6 @@ #include "AppTask.h" #include -#include -#include #include #include #include @@ -107,10 +105,6 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); error = Server::GetInstance().Init(initParams); diff --git a/examples/platform/asr/init_Matter.cpp b/examples/platform/asr/init_Matter.cpp index 3e495cb5c0c5b6..8f46ac4f9ed423 100644 --- a/examples/platform/asr/init_Matter.cpp +++ b/examples/platform/asr/init_Matter.cpp @@ -18,8 +18,6 @@ #include "AppConfig.h" #include -#include -#include #include #include #include @@ -101,10 +99,6 @@ CHIP_ERROR MatterInitializer::Init_Matter_Server(void) // Init Matter Server and Start Event Loop chip::DeviceLayer::PlatformMgr().LockChipStack(); static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); diff --git a/examples/platform/beken/common/BekenAppServer.cpp b/examples/platform/beken/common/BekenAppServer.cpp index 3b0a1e083febe5..50f68cf441b05f 100644 --- a/examples/platform/beken/common/BekenAppServer.cpp +++ b/examples/platform/beken/common/BekenAppServer.cpp @@ -18,9 +18,7 @@ #include "BekenAppServer.h" #include "CHIPDeviceManager.h" -#include #include -#include #include #include #include @@ -39,10 +37,6 @@ void BekenAppServer::Init(AppDelegate * sAppDelegate) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); if (sAppDelegate != nullptr) { diff --git a/examples/platform/bouffalolab/common/plat/platform.cpp b/examples/platform/bouffalolab/common/plat/platform.cpp index 0cf2bd52ef997f..d2e6a434e91296 100644 --- a/examples/platform/bouffalolab/common/plat/platform.cpp +++ b/examples/platform/bouffalolab/common/plat/platform.cpp @@ -17,8 +17,6 @@ */ #include #include -#include -#include #include #include #include @@ -231,10 +229,6 @@ CHIP_ERROR PlatformManagerImpl::PlatformInit(void) chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); static CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); ReturnLogErrorOnFailure(chip::Server::GetInstance().Init(initParams)); diff --git a/examples/platform/esp32/common/Esp32AppServer.cpp b/examples/platform/esp32/common/Esp32AppServer.cpp index 0dcc6e9471e77b..06bb0d9a6c6c0b 100644 --- a/examples/platform/esp32/common/Esp32AppServer.cpp +++ b/examples/platform/esp32/common/Esp32AppServer.cpp @@ -97,7 +97,6 @@ void Esp32AppServer::Init(AppDelegate * sAppDelegate) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; - #if CONFIG_TEST_EVENT_TRIGGER_ENABLED && CONFIG_ENABLE_OTA_REQUESTOR if (hex_string_to_binary(CONFIG_TEST_EVENT_TRIGGER_ENABLE_KEY, sTestEventTriggerEnableKey, sizeof(sTestEventTriggerEnableKey)) == 0) diff --git a/examples/platform/linux/AppMain.cpp b/examples/platform/linux/AppMain.cpp index af8a937cb6f6ea..22ff4d2db71cb6 100644 --- a/examples/platform/linux/AppMain.cpp +++ b/examples/platform/linux/AppMain.cpp @@ -20,8 +20,6 @@ #include #include "app/clusters/network-commissioning/network-commissioning.h" -#include -#include #include #include #include @@ -484,10 +482,6 @@ void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl) gMainLoopImplementation = impl; static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; VerifyOrDie(initParams.InitializeStaticResourcesBeforeServerInit() == CHIP_NO_ERROR); #if defined(ENABLE_CHIP_SHELL) diff --git a/examples/platform/nxp/se05x/linux/AppMain.cpp b/examples/platform/nxp/se05x/linux/AppMain.cpp index 1c00ed90587f58..2c04b81b0ce8bb 100644 --- a/examples/platform/nxp/se05x/linux/AppMain.cpp +++ b/examples/platform/nxp/se05x/linux/AppMain.cpp @@ -19,9 +19,7 @@ #include #include -#include #include -#include #include #include #include @@ -290,10 +288,7 @@ int ChipLinuxAppInit(int argc, char * const argv[], OptionSet * customOptions) void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl) { static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; + VerifyOrDie(initParams.InitializeStaticResourcesBeforeServerInit() == CHIP_NO_ERROR); #if defined(ENABLE_CHIP_SHELL) diff --git a/examples/platform/openiotsdk/app/CMakeLists.txt b/examples/platform/openiotsdk/app/CMakeLists.txt index 9f57550c936e47..f7cc06f9fa14d1 100644 --- a/examples/platform/openiotsdk/app/CMakeLists.txt +++ b/examples/platform/openiotsdk/app/CMakeLists.txt @@ -22,10 +22,6 @@ add_library(openiotsdk-startup openiotsdk_startup_gcc.cpp ) -add_definitions( - "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=" -) - target_link_libraries(openiotsdk-startup PUBLIC # iotsdk-serial-retarget contains the UART but we don't need the retarget part diff --git a/examples/platform/openiotsdk/app/openiotsdk_platform.cpp b/examples/platform/openiotsdk/app/openiotsdk_platform.cpp index 252ff7568f9dc2..29662d6e8df4e9 100644 --- a/examples/platform/openiotsdk/app/openiotsdk_platform.cpp +++ b/examples/platform/openiotsdk/app/openiotsdk_platform.cpp @@ -32,8 +32,6 @@ #endif #include -#include -#include #include #include #include @@ -268,11 +266,7 @@ int openiotsdk_chip_run(void) #ifdef USE_CHIP_DATA_MODEL // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; - CHIP_ERROR err = initParams.InitializeStaticResourcesBeforeServerInit(); + CHIP_ERROR err = initParams.InitializeStaticResourcesBeforeServerInit(); if (err != CHIP_NO_ERROR) { ChipLogError(NotSpecified, "Initialize static resources before server init failed: %s", err.AsString()); diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index 85f364296800c5..f5845b30cd12d4 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -57,7 +57,13 @@ static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeys #include "SilabsTestEventTriggerDelegate.h" #include #include + +#if CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED +#include +#else #include +#endif + #include #ifdef CHIP_CONFIG_USE_ICD_SUBSCRIPTION_CALLBACKS @@ -188,11 +194,17 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) chip::DeviceLayer::PlatformMgr().LockChipStack(); // Create initParams with SDK example defaults here + // TODO: replace with our own init param to avoid double allocation in examples static chip::CommonCaseDeviceServerInitParams initParams; // Report scheduler and timer delegate instance static chip::app::DefaultTimerDelegate sTimerDelegate; +#if CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED + static chip::app::reporting::SynchronizedReportSchedulerImpl sReportScheduler(&sTimerDelegate); +#else static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); +#endif + initParams.reportScheduler = &sReportScheduler; #if SILABS_TEST_EVENT_TRIGGER_ENABLED diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index 5fb210a7a97f05..a13e84ca527cad 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -25,9 +25,7 @@ #include "ThreadUtil.h" #include -#include #include -#include #include #include #include @@ -294,10 +292,6 @@ CHIP_ERROR AppTaskCommon::InitCommonParts(void) // Init ZCL Data Model and start server static CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.appDelegate = &sCallbacks; ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); diff --git a/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp index e9cf6166f0fe85..2dfecb65a11bc0 100644 --- a/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -22,8 +22,6 @@ #include "AppEvent.h" #include "CHIPDeviceManager.h" #include "DeviceCallbacks.h" -#include -#include #include #include @@ -220,10 +218,6 @@ int AppTask::Init() // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp index a3e261d0c0572c..b5be215216a4bf 100644 --- a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp @@ -21,8 +21,6 @@ #include "AppEvent.h" #include "CHIPDeviceManager.h" #include "DeviceCallbacks.h" -#include -#include #include #include @@ -221,10 +219,6 @@ int AppTask::Init() // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/pump-app/nrfconnect/main/AppTask.cpp b/examples/pump-app/nrfconnect/main/AppTask.cpp index e057b0bdc6e6ee..9c75c54e1fcc87 100644 --- a/examples/pump-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-app/nrfconnect/main/AppTask.cpp @@ -24,9 +24,7 @@ #include #include -#include #include -#include #include #include #include @@ -182,10 +180,6 @@ CHIP_ERROR AppTask::Init() #endif static CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp index d4eefd2f0332ae..fa5d85eaa6e42e 100644 --- a/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -20,8 +20,6 @@ #include "AppTask.h" #include "AppConfig.h" #include "AppEvent.h" -#include -#include #include #include "FreeRTOS.h" @@ -174,10 +172,6 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp index 2052b1f26c61d1..51ef817cff14ac 100644 --- a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp @@ -19,8 +19,6 @@ #include "AppTask.h" #include "AppConfig.h" #include "AppEvent.h" -#include -#include #include #include "FreeRTOS.h" @@ -174,10 +172,6 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp index 01c93c34e9ef74..9580af61ae451d 100644 --- a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp @@ -24,9 +24,7 @@ #include #include -#include #include -#include #include #include #include @@ -180,10 +178,6 @@ CHIP_ERROR AppTask::Init() #endif static CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; diff --git a/examples/shell/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/shell/cc13x2x7_26x2x7/main/AppTask.cpp index 266955771d3ab0..dda97f4e566ef5 100644 --- a/examples/shell/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/shell/cc13x2x7_26x2x7/main/AppTask.cpp @@ -18,8 +18,6 @@ */ #include "AppTask.h" -#include -#include #include #include @@ -149,10 +147,6 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/shell/cc13x4_26x4/main/AppTask.cpp b/examples/shell/cc13x4_26x4/main/AppTask.cpp index 9ccc0bed5595ee..302f8b8baf8c96 100644 --- a/examples/shell/cc13x4_26x4/main/AppTask.cpp +++ b/examples/shell/cc13x4_26x4/main/AppTask.cpp @@ -17,8 +17,6 @@ */ #include "AppTask.h" -#include -#include #include #include @@ -154,10 +152,6 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/shell/nxp/k32w/k32w0/main/AppTask.cpp b/examples/shell/nxp/k32w/k32w0/main/AppTask.cpp index 0324c64e6af2bf..ac98d19eb0d574 100644 --- a/examples/shell/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/shell/nxp/k32w/k32w0/main/AppTask.cpp @@ -18,8 +18,6 @@ */ #include "AppTask.h" #include "AppEvent.h" -#include -#include #include #include @@ -141,10 +139,6 @@ void UnlockOpenThreadTask(void) void AppTask::InitServer(intptr_t arg) { static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); // Init ZCL Data Model and start server diff --git a/examples/shell/shell_common/cmd_server.cpp b/examples/shell/shell_common/cmd_server.cpp index 11d8ac9d17e5ab..d18eb88cf7a1b0 100644 --- a/examples/shell/shell_common/cmd_server.cpp +++ b/examples/shell/shell_common/cmd_server.cpp @@ -24,8 +24,6 @@ #include #include -#include -#include #include #include #include @@ -59,10 +57,6 @@ static CHIP_ERROR CmdAppServerStart(int argc, char ** argv) { // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.operationalServicePort = sServerPortOperational; initParams.userDirectedCommissioningPort = sServerPortCommissioning; diff --git a/examples/thermostat/genio/src/AppTask.cpp b/examples/thermostat/genio/src/AppTask.cpp index 79009062699c37..ac419e01f51b9b 100644 --- a/examples/thermostat/genio/src/AppTask.cpp +++ b/examples/thermostat/genio/src/AppTask.cpp @@ -24,10 +24,8 @@ #include "qrcodegen.h" -#include #include #include -#include #include #include #include @@ -124,10 +122,6 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm index df05775813742c..3f4dbce0700bb7 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm @@ -25,8 +25,6 @@ #import "MatterCallbacks.h" #import "OnboardingPayload.h" -#include -#include #include #include #include @@ -334,10 +332,6 @@ - (MatterError *)initializeApp:(AppParameters * _Nullable)appParameters // init app Server _serverInitParams = new chip::CommonCaseDeviceServerInitParams(); - // Report scheduler and timer delegate instance - chip::app::DefaultTimerDelegate * timerDelegate = new chip::app::DefaultTimerDelegate(); - chip::app::reporting::ReportSchedulerImpl * reportScheduler = new chip::app::reporting::ReportSchedulerImpl(timerDelegate); - _serverInitParams->reportScheduler = reportScheduler; err = _serverInitParams->InitializeStaticResourcesBeforeServerInit(); if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, "InitializeStaticResourcesBeforeServerInit failed: %s", ErrorStr(err)); diff --git a/examples/tv-casting-app/linux/main.cpp b/examples/tv-casting-app/linux/main.cpp index f9884f3ef0009a..45c53c842568f8 100644 --- a/examples/tv-casting-app/linux/main.cpp +++ b/examples/tv-casting-app/linux/main.cpp @@ -31,8 +31,6 @@ #include "LinuxCommissionableDataProvider.h" #include "Options.h" -#include -#include #include #include #include @@ -140,10 +138,6 @@ int main(int argc, char * argv[]) // Enter commissioning mode, open commissioning window static chip::CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; VerifyOrDie(CHIP_NO_ERROR == initParams.InitializeStaticResourcesBeforeServerInit()); VerifyOrDie(CHIP_NO_ERROR == chip::Server::GetInstance().Init(initParams)); diff --git a/examples/window-app/nrfconnect/main/AppTask.cpp b/examples/window-app/nrfconnect/main/AppTask.cpp index c74294a2907e37..38e20fd503d4ea 100644 --- a/examples/window-app/nrfconnect/main/AppTask.cpp +++ b/examples/window-app/nrfconnect/main/AppTask.cpp @@ -23,10 +23,8 @@ #include -#include #include #include -#include #include #include #include @@ -188,10 +186,6 @@ CHIP_ERROR AppTask::Init() #endif static CommonCaseDeviceServerInitParams initParams; - // Report scheduler and timer delegate instance - static chip::app::DefaultTimerDelegate sTimerDelegate; - static chip::app::reporting::ReportSchedulerImpl sReportScheduler(&sTimerDelegate); - initParams.reportScheduler = &sReportScheduler; static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; (void) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.testEventTriggerDelegate = &testEventTriggerDelegate; diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index 7d8a27be94d751..f7d8d24ab36d2f 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -117,6 +117,7 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) VerifyOrExit(initParams.sessionKeystore != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(initParams.operationalKeystore != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(initParams.opCertStore != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(initParams.reportScheduler != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); // TODO(16969): Remove chip::Platform::MemoryInit() call from Server class, it belongs to outer code chip::Platform::MemoryInit(); @@ -560,7 +561,6 @@ Credentials::GroupDataProviderImpl CommonCaseDeviceServerInitParams::sGroupDataP app::DefaultTimerDelegate CommonCaseDeviceServerInitParams::sTimerDelegate; app::reporting::ReportSchedulerImpl CommonCaseDeviceServerInitParams::sReportScheduler(&CommonCaseDeviceServerInitParams::sTimerDelegate); - #if CHIP_CONFIG_ENABLE_SESSION_RESUMPTION SimpleSessionResumptionStorage CommonCaseDeviceServerInitParams::sSessionResumptionStorage; #endif diff --git a/src/app/server/Server.h b/src/app/server/Server.h index 464843320a22c2..07cd4b207c7796 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -64,12 +64,8 @@ #include #endif #include -#include -#if CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED -#include -#else #include -#endif +#include #if CHIP_CONFIG_ENABLE_ICD_SERVER #include // nogncheck @@ -100,7 +96,7 @@ struct ServerInitParams ServerInitParams() = default; // Not copyable - ServerInitParams(const ServerInitParams &) = delete; + ServerInitParams(const ServerInitParams &) = delete; ServerInitParams & operator=(const ServerInitParams &) = delete; // Application delegate to handle some commissioning lifecycle events @@ -146,7 +142,9 @@ struct ServerInitParams // Operational certificate store with access to the operational certs in persisted storage: // must not be null at timne of Server::Init(). Credentials::OperationalCertificateStore * opCertStore = nullptr; - // Report Scheduler Must be injected. If none injected the IM engine will throw an error on Init() + // Required, if not provided, the Server::Init() WILL fail. The default reportScheduler implementation will be used when using + // CommonCaseDeviceServerInitParams, but the injection of a custom scheduler requires using the ServerInitParams base class to + // avoid dual allocation of memory for the scheduler. app::reporting::ReportScheduler * reportScheduler = nullptr; }; @@ -182,7 +180,7 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams CommonCaseDeviceServerInitParams() = default; // Not copyable - CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; + CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; CommonCaseDeviceServerInitParams & operator=(const CommonCaseDeviceServerInitParams &) = delete; /** @@ -224,6 +222,9 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams this->opCertStore = &sPersistentStorageOpCertStore; } + // Injection of report scheduler WILL lead to two schedulers being allocated. As recommended above, this should only be used + // for IN-TREE examples. If a default scheduler is desired, the basic ServerInitParams should be used by the application and + // CommonCaseDeviceServerInitParams should not be allocated. if (this->reportScheduler == nullptr) { reportScheduler = &sReportScheduler; @@ -268,11 +269,8 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams static Credentials::PersistentStorageOpCertStore sPersistentStorageOpCertStore; static Credentials::GroupDataProviderImpl sGroupDataProvider; static chip::app::DefaultTimerDelegate sTimerDelegate; -#if CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED - static app::reporting::SynchronizedReportSchedulerImpl sReportScheduler; -#else static app::reporting::ReportSchedulerImpl sReportScheduler; -#endif + #if CHIP_CONFIG_ENABLE_SESSION_RESUMPTION static SimpleSessionResumptionStorage sSessionResumptionStorage; #endif diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index 2aba0915a2d52d..48def330feee66 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -1573,7 +1573,7 @@ extern const char CHIP_NON_PRODUCTION_MARKER[]; * various subscribers. */ #ifndef CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED -#define CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED 0 +#define CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED 1 #endif /** From 0dec6ad935bfdf33882814df6070b85b886eebad Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 4 Aug 2023 18:20:54 +0000 Subject: [PATCH 8/9] Restyled by clang-format --- src/app/server/Server.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/server/Server.h b/src/app/server/Server.h index 07cd4b207c7796..a24b3a1b4dcc54 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -96,7 +96,7 @@ struct ServerInitParams ServerInitParams() = default; // Not copyable - ServerInitParams(const ServerInitParams &) = delete; + ServerInitParams(const ServerInitParams &) = delete; ServerInitParams & operator=(const ServerInitParams &) = delete; // Application delegate to handle some commissioning lifecycle events @@ -180,7 +180,7 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams CommonCaseDeviceServerInitParams() = default; // Not copyable - CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; + CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; CommonCaseDeviceServerInitParams & operator=(const CommonCaseDeviceServerInitParams &) = delete; /** From 1e896396f5fedb93ef1f5825241751eed6727801 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Fri, 4 Aug 2023 14:34:45 -0400 Subject: [PATCH 9/9] Removed un-necessary mention to CommonCaseDeviceServerInitParams, restore CHIPConfig Synchronous reports to 0 --- src/app/server/Server.h | 4 +--- src/lib/core/CHIPConfig.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/server/Server.h b/src/app/server/Server.h index a24b3a1b4dcc54..e5b5585be19f44 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -142,9 +142,7 @@ struct ServerInitParams // Operational certificate store with access to the operational certs in persisted storage: // must not be null at timne of Server::Init(). Credentials::OperationalCertificateStore * opCertStore = nullptr; - // Required, if not provided, the Server::Init() WILL fail. The default reportScheduler implementation will be used when using - // CommonCaseDeviceServerInitParams, but the injection of a custom scheduler requires using the ServerInitParams base class to - // avoid dual allocation of memory for the scheduler. + // Required, if not provided, the Server::Init() WILL fail. app::reporting::ReportScheduler * reportScheduler = nullptr; }; diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index 48def330feee66..2aba0915a2d52d 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -1573,7 +1573,7 @@ extern const char CHIP_NON_PRODUCTION_MARKER[]; * various subscribers. */ #ifndef CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED -#define CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED 1 +#define CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED 0 #endif /**