Skip to content

Commit

Permalink
Move connect callback calling to OnNetworkConnected handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ATmobica committed Feb 21, 2022
1 parent 4875036 commit b26a72e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/platform/mbed/NetworkCommissioningWiFiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ Status WiFiDriverImpl::ReorderNetwork(ByteSpan networkId, uint8_t index)

void WiFiDriverImpl::ExecuteWiFiInterfaceChange(nsapi_connection_status_t status)
{

switch (status)
{
case NSAPI_STATUS_LOCAL_UP:
Expand All @@ -193,12 +194,6 @@ void WiFiDriverImpl::ExecuteWiFiInterfaceChange(nsapi_connection_status_t status
ChipLogDetail(DeviceLayer, "Unknown connection status: 0x%08X", status);
break;
}

if (mConnectCallback)
{
mConnectCallback->OnResult(Status::kSuccess, CharSpan(), status);
}
mConnectCallback = nullptr;
}

void WiFiDriverImpl::OnWiFiInterfaceEvent(nsapi_event_t event, intptr_t data)
Expand Down Expand Up @@ -419,6 +414,12 @@ void WiFiDriverImpl::OnNetworkConnected()
{
ChipLogDetail(DeviceLayer, "OnNetworkConnected");

if (mConnectCallback)
{
mConnectCallback->OnResult(Status::kSuccess, CharSpan(), 0);
mConnectCallback = nullptr;
}

ChipDeviceEvent event;
event.Type = DeviceEventType::kWiFiConnectivityChange;
event.WiFiConnectivityChange.Result = kConnectivity_Established;
Expand Down

0 comments on commit b26a72e

Please sign in to comment.