diff --git a/examples/all-clusters-app/p6/src/AppTask.cpp b/examples/all-clusters-app/p6/src/AppTask.cpp index 5ec2cf50dbdcbc..d58c7a3f108c56 100644 --- a/examples/all-clusters-app/p6/src/AppTask.cpp +++ b/examples/all-clusters-app/p6/src/AppTask.cpp @@ -74,6 +74,9 @@ AppTask AppTask::sAppTask; namespace { app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::P6WiFiDriver::GetInstance())); + +constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; + } // namespace void NetWorkCommissioningInstInit() @@ -88,6 +91,9 @@ static void InitServer(intptr_t context) (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); + // We only have network commissioning on endpoint 0. + emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false); + // Initialize device attestation config SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); } diff --git a/examples/all-clusters-minimal-app/p6/src/AppTask.cpp b/examples/all-clusters-minimal-app/p6/src/AppTask.cpp index 5ec2cf50dbdcbc..d58c7a3f108c56 100644 --- a/examples/all-clusters-minimal-app/p6/src/AppTask.cpp +++ b/examples/all-clusters-minimal-app/p6/src/AppTask.cpp @@ -74,6 +74,9 @@ AppTask AppTask::sAppTask; namespace { app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::P6WiFiDriver::GetInstance())); + +constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; + } // namespace void NetWorkCommissioningInstInit() @@ -88,6 +91,9 @@ static void InitServer(intptr_t context) (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); + // We only have network commissioning on endpoint 0. + emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false); + // Initialize device attestation config SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); } diff --git a/src/platform/P6/NetworkCommissioningWiFiDriver.cpp b/src/platform/P6/NetworkCommissioningWiFiDriver.cpp index b8dba7b1a17d1d..e9ca4f9e973501 100644 --- a/src/platform/P6/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/P6/NetworkCommissioningWiFiDriver.cpp @@ -160,7 +160,9 @@ void P6WiFiDriver::OnConnectWiFiNetwork() if (mpConnectCallback) { CommitConfiguration(); + chip::DeviceLayer::PlatformMgr().LockChipStack(); mpConnectCallback->OnResult(Status::kSuccess, CharSpan(), 0); + chip::DeviceLayer::PlatformMgr().UnlockChipStack(); mpConnectCallback = nullptr; } } @@ -185,7 +187,9 @@ void P6WiFiDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * callback { ChipLogError(NetworkProvisioning, "Failed to connect to WiFi network:%s", chip::ErrorStr(err)); mpConnectCallback = nullptr; + chip::DeviceLayer::PlatformMgr().LockChipStack(); callback->OnResult(networkingStatus, CharSpan(), 0); + chip::DeviceLayer::PlatformMgr().UnlockChipStack(); } }