diff --git a/examples/bridge-app/linux/main.cpp b/examples/bridge-app/linux/main.cpp index 3d73688594c5a9..2cfe37a12d4125 100644 --- a/examples/bridge-app/linux/main.cpp +++ b/examples/bridge-app/linux/main.cpp @@ -1024,6 +1024,7 @@ int main(int argc, char * argv[]) // Run CHIP + ChipLinuxAppInitNetworkCommissioning(); ApplicationInit(); registerAttributeAccessOverride(&gPowerAttrAccess); chip::DeviceLayer::PlatformMgr().RunEventLoop(); diff --git a/examples/platform/linux/AppMain.cpp b/examples/platform/linux/AppMain.cpp index 56e6edd44687f2..2056734dfa7696 100644 --- a/examples/platform/linux/AppMain.cpp +++ b/examples/platform/linux/AppMain.cpp @@ -177,8 +177,9 @@ void EnableWiFiNetworkCommissioning(EndpointId endpoint) sWiFiNetworkCommissioningInstance.Value().Init(); #endif // CHIP_APP_MAIN_HAS_WIFI_DRIVER } +} // anonymous namespace -void InitNetworkCommissioning() +void ChipLinuxAppInitNetworkCommissioning() { if (sSecondaryNetworkCommissioningEndpoint.HasValue()) { @@ -232,7 +233,6 @@ void InitNetworkCommissioning() #endif // CHIP_APP_MAIN_HAS_ETHERNET_DRIVER } } -} // anonymous namespace #if defined(ENABLE_CHIP_SHELL) using chip::Shell::Engine; @@ -582,7 +582,7 @@ void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl) #endif // defined(ENABLE_CHIP_SHELL) #endif // CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE - InitNetworkCommissioning(); + ChipLinuxAppInitNetworkCommissioning(); ApplicationInit(); diff --git a/examples/platform/linux/AppMain.h b/examples/platform/linux/AppMain.h index 94bf4d3e609da1..d8af2775bd2346 100644 --- a/examples/platform/linux/AppMain.h +++ b/examples/platform/linux/AppMain.h @@ -88,6 +88,11 @@ class DefaultAppMainLoopImplementation : public AppMainLoopImplementation */ void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl = nullptr); +// This function supports initializing the Network Commissioning cluster for the +// Linux app that does not call ChipLinuxAppMainLoop. This function should be +// called before calling the ApplicationInit function. +void ChipLinuxAppInitNetworkCommissioning(); + #if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE using chip::Controller::DeviceCommissioner;