Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and pankore committed Jun 21, 2022
1 parent 0de3014 commit 3b6c1b2
Showing 1 changed file with 31 additions and 26 deletions.
57 changes: 31 additions & 26 deletions src/platform/Ameba/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

#include <platform/Ameba/AmebaUtils.h>
#include <platform/Ameba/NetworkCommissioningDriver.h>
#include <platform/internal/BLEManager.h>
#include <platform/DiagnosticDataProvider.h>
#include <platform/internal/BLEManager.h>
#include <support/CodeUtils.h>
#include <support/logging/CHIPLogging.h>

Expand Down Expand Up @@ -589,7 +589,8 @@ void ConnectivityManagerImpl::OnStationConnected()

if (delegate)
{
delegate->OnConnectionStatusChanged(chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::WiFiConnectionStatus::kConnected));
delegate->OnConnectionStatusChanged(
chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::WiFiConnectionStatus::kConnected));
}

UpdateInternetConnectivityState();
Expand All @@ -603,42 +604,46 @@ void ConnectivityManagerImpl::OnStationDisconnected()
event.WiFiConnectivityChange.Result = kConnectivity_Lost;
PlatformMgr().PostEventOrDie(&event);
WiFiDiagnosticsDelegate * delegate = GetDiagnosticDataProvider().GetWiFiDiagnosticsDelegate();
uint16_t reason = NetworkCommissioning::AmebaWiFiDriver::GetInstance().GetLastDisconnectReason();
uint8_t associationFailureCause = chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause::kUnknown);
uint16_t reason = NetworkCommissioning::AmebaWiFiDriver::GetInstance().GetLastDisconnectReason();
uint8_t associationFailureCause =
chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause::kUnknown);

if (delegate)
{
switch (reason)
{
case RTW_NO_ERROR:
case RTW_NONE_NETWORK:
associationFailureCause = chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause::kSsidNotFound);
delegate->OnAssociationFailureDetected(associationFailureCause, reason);
break;
case RTW_CONNECT_FAIL:
associationFailureCause = chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause::kAssociationFailed);
delegate->OnAssociationFailureDetected(associationFailureCause, reason);
break;
case RTW_WRONG_PASSWORD:
associationFailureCause = chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause::kAuthenticationFailed);
delegate->OnAssociationFailureDetected(associationFailureCause, reason);
break;
case RTW_NO_ERROR:
case RTW_NONE_NETWORK:
associationFailureCause =
chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause::kSsidNotFound);
delegate->OnAssociationFailureDetected(associationFailureCause, reason);
break;
case RTW_CONNECT_FAIL:
associationFailureCause =
chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause::kAssociationFailed);
delegate->OnAssociationFailureDetected(associationFailureCause, reason);
break;
case RTW_WRONG_PASSWORD:
associationFailureCause =
chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause::kAuthenticationFailed);
delegate->OnAssociationFailureDetected(associationFailureCause, reason);
break;
#if defined(CONFIG_PLATFORM_8710C)
case RTW_4WAY_HANDSHAKE_TIMEOUT:
case RTW_4WAY_HANDSHAKE_TIMEOUT:
#endif
case RTW_DHCP_FAIL:
case RTW_UNKNOWN:
break;
case RTW_DHCP_FAIL:
case RTW_UNKNOWN:
break;

default:
delegate->OnAssociationFailureDetected(associationFailureCause, reason);
break;
default:
delegate->OnAssociationFailureDetected(associationFailureCause, reason);
break;
}
delegate->OnDisconnectionDetected(reason);
delegate->OnConnectionStatusChanged(chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::WiFiConnectionStatus::kNotConnected));
delegate->OnConnectionStatusChanged(
chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::WiFiConnectionStatus::kNotConnected));
}


UpdateInternetConnectivityState();
}

Expand Down

0 comments on commit 3b6c1b2

Please sign in to comment.