Skip to content

Commit

Permalink
Update bridge app to init network commissioning
Browse files Browse the repository at this point in the history
This change modifies the linux bridge app to initialize the Network
Commissioning cluster, so that the FeatureMap of the cluster is set to
ethernet.
In other Linux example apps, the FeatureMap of the Network Commissioning
cluster is set to ethernet, but in the bridge app, the cluster is not
initialized, so the FeatureMap is set to thread. The default value of
the FeatureMap is thread in zap file of example apps.

Signed-off-by: Youngho Yoon <[email protected]>
  • Loading branch information
yhoyoon committed Oct 6, 2023
1 parent ccdbfee commit adb67d9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions examples/bridge-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,7 @@ int main(int argc, char * argv[])

// Run CHIP

ChipLinuxAppInitNetworkCommissioning();
ApplicationInit();
registerAttributeAccessOverride(&gPowerAttrAccess);
chip::DeviceLayer::PlatformMgr().RunEventLoop();
Expand Down
6 changes: 3 additions & 3 deletions examples/platform/linux/AppMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down Expand Up @@ -232,7 +233,6 @@ void InitNetworkCommissioning()
#endif // CHIP_APP_MAIN_HAS_ETHERNET_DRIVER
}
}
} // anonymous namespace

#if defined(ENABLE_CHIP_SHELL)
using chip::Shell::Engine;
Expand Down Expand Up @@ -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();

Expand Down
5 changes: 5 additions & 0 deletions examples/platform/linux/AppMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit adb67d9

Please sign in to comment.