Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Storage, Groups and Access Delegate injection on Server::Init() #16956

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion examples/all-clusters-app/ameba/main/chipinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ static void InitServer(intptr_t context)
#endif

// Init ZCL Data Model and CHIP App Server
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
5 changes: 4 additions & 1 deletion examples/all-clusters-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE;
static void InitServer(intptr_t context)
{
// Init ZCL Data Model and CHIP App Server
chip::Server::GetInstance().Init(&sCallbacks);
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
initParams.appDelegate = &sCallbacks;
chip::Server::GetInstance().Init(initParams);

// We only have network commissioning on endpoint 0.
emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false);
Expand Down
4 changes: 3 additions & 1 deletion examples/all-clusters-app/linux/fuzzing-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t * aData, size_t aSize)
VerifyOrDie(PlatformMgr().InitChipStack() == CHIP_NO_ERROR);

// ChipLinuxAppMainLoop blocks, and we don't want that here.
VerifyOrDie(Server::GetInstance().Init() == CHIP_NO_ERROR);
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
VerifyOrDie(Server::GetInstance().Init(initParams) == CHIP_NO_ERROR);

ApplicationInit();

Expand Down
4 changes: 3 additions & 1 deletion examples/all-clusters-app/mbed/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ int AppTask::Init()
0);

// Init ZCL Data Model and start server
error = Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
error = Server::GetInstance().Init(initParams);
if (error != CHIP_NO_ERROR)
{
ChipLogError(NotSpecified, "Server initialization failed: %s", error.AsString());
Expand Down
5 changes: 4 additions & 1 deletion examples/all-clusters-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ CHIP_ERROR AppTask::Init()

// Initialize CHIP server
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
ReturnErrorOnFailure(chip::Server::GetInstance().Init());

static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams));
#if CONFIG_CHIP_OTA_REQUESTOR
InitBasicOTARequestor();
#endif
Expand Down
4 changes: 3 additions & 1 deletion examples/all-clusters-app/p6/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ void NetWorkCommissioningInstInit()
static void InitServer(intptr_t context)
{
// Init ZCL Data Model
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
4 changes: 3 additions & 1 deletion examples/bridge-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,9 @@ void HandleDeviceStatusChanged(Device * dev, Device::Changed_t itemChangedMask)

static void InitServer(intptr_t context)
{
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
4 changes: 3 additions & 1 deletion examples/bridge-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,9 @@ int main(int argc, char * argv[])
chip::DeviceLayer::ConnectivityMgr().SetBLEAdvertisingEnabled(true);

// Init ZCL Data Model and CHIP App Server
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
4 changes: 3 additions & 1 deletion examples/light-switch-app/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ int main(void)

chip::DeviceLayer::PlatformMgr().LockChipStack();
// Init ZCL Data Model
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);
chip::DeviceLayer::PlatformMgr().UnlockChipStack();

EFR32_LOG("Starting Platform Manager Event Loop");
Expand Down
4 changes: 3 additions & 1 deletion examples/light-switch-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ CHIP_ERROR AppTask::Init()

// Print initial configs
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
ReturnErrorOnFailure(Server::GetInstance().Init());
static chip::CommonCaseDeviceServerInitParams initParams;
ReturnErrorOnFailure(initParams.InitBeforeServerInit());
ReturnErrorOnFailure(Server::GetInstance().Init(initParams));
#if CONFIG_CHIP_OTA_REQUESTOR
InitBasicOTARequestor();
#endif
Expand Down
4 changes: 3 additions & 1 deletion examples/lighting-app/ameba/main/chipinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ static void InitServer(intptr_t context)
#endif

// Init ZCL Data Model and CHIP App Server
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
4 changes: 3 additions & 1 deletion examples/lighting-app/cyw30739/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ void InitApp(intptr_t args)
PlatformMgrImpl().AddEventHandler(EventHandler, 0);

/* Start CHIP datamodel server */
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());

Expand Down
4 changes: 3 additions & 1 deletion examples/lighting-app/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ int main(void)

chip::DeviceLayer::PlatformMgr().LockChipStack();
// Init ZCL Data Model
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);
chip::DeviceLayer::PlatformMgr().UnlockChipStack();

EFR32_LOG("Starting Platform Manager Event Loop");
Expand Down
4 changes: 3 additions & 1 deletion examples/lighting-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ static void InitServer(intptr_t context)
// Print QR Code URL
PrintOnboardingCodes(chip::RendezvousInformationFlags(CONFIG_RENDEZVOUS_MODE));

chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
5 changes: 4 additions & 1 deletion examples/lighting-app/mbed/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ int AppTask::Init()
LightingMgr().SetCallbacks(ActionInitiated, ActionCompleted);

// Init ZCL Data Model and start server
error = Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();

error = Server::GetInstance().Init(initParams);
if (error != CHIP_NO_ERROR)
{
ChipLogError(NotSpecified, "Server initialization failed: %s", error.AsString());
Expand Down
6 changes: 5 additions & 1 deletion examples/lighting-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ CHIP_ERROR AppTask::Init()
// Initialize CHIP server
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
chip::app::DnssdServer::Instance().SetExtendedDiscoveryTimeoutSecs(kExtDiscoveryTimeoutSecs);
ReturnErrorOnFailure(chip::Server::GetInstance().Init());

static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();

ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams));
#if CONFIG_CHIP_OTA_REQUESTOR
InitBasicOTARequestor();
#endif
Expand Down
4 changes: 3 additions & 1 deletion examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ CHIP_ERROR AppTask::Init()
CHIP_ERROR err = CHIP_NO_ERROR;

// Init ZCL Data Model and start server
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
#ifdef ENABLE_HSM_DEVICE_ATTESTATION
Expand Down
4 changes: 3 additions & 1 deletion examples/lighting-app/p6/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ void NetWorkCommissioningInstInit()
static void InitServer(intptr_t context)
{
// Init ZCL Data Model
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
4 changes: 3 additions & 1 deletion examples/lighting-app/qpg/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ CHIP_ERROR AppTask::Init()
#endif

// Init ZCL Data Model
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Init OTA engine
InitializeOTARequestor();
Expand Down
4 changes: 3 additions & 1 deletion examples/lighting-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ CHIP_ERROR AppTask::Init()
LightingMgr().SetCallbacks(ActionInitiated, ActionCompleted);

// Init ZCL Data Model and start server
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
4 changes: 3 additions & 1 deletion examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ int AppTask::Init()

// Init ZCL Data Model and start server
PLAT_LOG("Initialize Server");
Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
4 changes: 3 additions & 1 deletion examples/lock-app/cyw30739/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ APPLICATION_START()
PlatformMgrImpl().AddEventHandler(EventHandler, 0);

/* Start CHIP datamodel server */
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());

Expand Down
4 changes: 3 additions & 1 deletion examples/lock-app/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ int main(void)

chip::DeviceLayer::PlatformMgr().LockChipStack();
// Init ZCL Data Model
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);
chip::DeviceLayer::PlatformMgr().UnlockChipStack();

EFR32_LOG("Starting Platform Manager Event Loop");
Expand Down
4 changes: 3 additions & 1 deletion examples/lock-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ app::Clusters::NetworkCommissioning::Instance

static void InitServer(intptr_t context)
{
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
5 changes: 4 additions & 1 deletion examples/lock-app/mbed/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ int AppTask::Init()
BoltLockMgr().SetCallbacks(ActionInitiated, ActionCompleted);

// Init ZCL Data Model and start server
error = Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();

error = Server::GetInstance().Init(initParams);
if (error != CHIP_NO_ERROR)
{
ChipLogError(NotSpecified, "Server initialization failed: %s", error.AsString());
Expand Down
5 changes: 4 additions & 1 deletion examples/lock-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ CHIP_ERROR AppTask::Init()

// Initialize CHIP server
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
ReturnErrorOnFailure(chip::Server::GetInstance().Init());
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();

ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams));
#if CONFIG_CHIP_OTA_REQUESTOR
InitBasicOTARequestor();
#endif
Expand Down
4 changes: 3 additions & 1 deletion examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ CHIP_ERROR AppTask::Init()
CHIP_ERROR err = CHIP_NO_ERROR;

// Init ZCL Data Model and start server
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
4 changes: 3 additions & 1 deletion examples/lock-app/p6/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ void NetWorkCommissioningInstInit()
static void InitServer(intptr_t context)
{
// Init ZCL Data Model
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
4 changes: 3 additions & 1 deletion examples/lock-app/qpg/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ CHIP_ERROR AppTask::Init()
#endif

// Init ZCL Data Model
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Init OTA engine
InitializeOTARequestor();
Expand Down
4 changes: 3 additions & 1 deletion examples/log-source-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ int main(int argc, char * argv[])
}

chip::DeviceLayer::ConfigurationMgr().LogDeviceConfig();
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(chip::Credentials::Examples::GetExampleDACProvider());
Expand Down
4 changes: 3 additions & 1 deletion examples/ota-provider-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ app::Clusters::NetworkCommissioning::Instance

static void InitServer(intptr_t context)
{
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
4 changes: 3 additions & 1 deletion examples/ota-requestor-app/ameba/main/chipinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ static void InitServer(intptr_t context)
InitOTARequestor();

// Init ZCL Data Model and CHIP App Server
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
4 changes: 3 additions & 1 deletion examples/ota-requestor-app/cyw30739/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ void InitApp(intptr_t args)
ConfigurationMgr().LogDeviceConfig();

/* Start CHIP datamodel server */
Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());

Expand Down
4 changes: 3 additions & 1 deletion examples/ota-requestor-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ CHIP_ERROR AppTask::Init()
CHIP_ERROR err = CHIP_NO_ERROR;

// Init ZCL Data Model
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

chip::DeviceLayer::PlatformMgr().LockChipStack();
// Initialize device attestation config
Expand Down
4 changes: 3 additions & 1 deletion examples/ota-requestor-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ app::Clusters::NetworkCommissioning::Instance

static void InitServer(intptr_t context)
{
chip::Server::GetInstance().Init();
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitBeforeServerInit();
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
Loading