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() {}