Skip to content

Commit

Permalink
[NXP] fix on network build issue, add wifi diagnostics status code (#…
Browse files Browse the repository at this point in the history
…35888)

* [NXP][platform][common] Fix wifi onnetwork build issue

Signed-off-by: Martin Girardot <[email protected]>

* [NXP][platform][common] Add wlan status code

Signed-off-by: Martin Girardot <[email protected]>

* Restyled by whitespace

* Restyled by clang-format

---------

Signed-off-by: Martin Girardot <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
Martin-NXP and restyled-commits authored Oct 3, 2024
1 parent 4b6dcd8 commit a1bafe1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/platform/nxp/common/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ using namespace ::chip::System;
using namespace ::chip::DeviceLayer::Internal;
using namespace ::chip::DeviceLayer::DeviceEventType;

#if !SDK_2_16_100
// Table 9-50 "Status codes" of IEEE 802.11-2020: Unspecified failure
// Temporary default status code before SDK API to map wlan_event_reason to IEEE Status codes
#define WLAN_REFUSED_REASON_UNSPECIFIED 1
#endif

namespace chip {
namespace DeviceLayer {
Expand Down Expand Up @@ -243,6 +245,12 @@ void ConnectivityManagerImpl::ProcessWlanEvent(enum wlan_event_reason wlanEvent)
uint8_t associationFailureCause =
chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCauseEnum::kUnknown);

#if SDK_2_16_100
uint16_t wlan_status_code = wlan_get_status_code(wlanEvent);
#else
uint16_t wlan_status_code = WLAN_REFUSED_REASON_UNSPECIFIED;
#endif

#if CHIP_DETAIL_LOGGING
enum wlan_connection_state state;
int result;
Expand Down Expand Up @@ -283,7 +291,7 @@ void ConnectivityManagerImpl::ProcessWlanEvent(enum wlan_event_reason wlanEvent)
chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCauseEnum::kAssociationFailed);
if (delegate)
{
delegate->OnAssociationFailureDetected(associationFailureCause, WLAN_REFUSED_REASON_UNSPECIFIED);
delegate->OnAssociationFailureDetected(associationFailureCause, wlan_status_code);
}
UpdateInternetConnectivityState();
break;
Expand All @@ -296,7 +304,7 @@ void ConnectivityManagerImpl::ProcessWlanEvent(enum wlan_event_reason wlanEvent)
chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCauseEnum::kSsidNotFound);
if (delegate)
{
delegate->OnAssociationFailureDetected(associationFailureCause, WLAN_REFUSED_REASON_UNSPECIFIED);
delegate->OnAssociationFailureDetected(associationFailureCause, wlan_status_code);
}
break;

Expand All @@ -309,7 +317,7 @@ void ConnectivityManagerImpl::ProcessWlanEvent(enum wlan_event_reason wlanEvent)
chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCauseEnum::kAuthenticationFailed);
if (delegate)
{
delegate->OnAssociationFailureDetected(associationFailureCause, WLAN_REFUSED_REASON_UNSPECIFIED);
delegate->OnAssociationFailureDetected(associationFailureCause, wlan_status_code);
}
break;

Expand All @@ -321,7 +329,7 @@ void ConnectivityManagerImpl::ProcessWlanEvent(enum wlan_event_reason wlanEvent)
sInstance.OnStationDisconnected();
if (delegate)
{
delegate->OnAssociationFailureDetected(associationFailureCause, WLAN_REFUSED_REASON_UNSPECIFIED);
delegate->OnAssociationFailureDetected(associationFailureCause, wlan_status_code);
}
}
break;
Expand All @@ -332,7 +340,7 @@ void ConnectivityManagerImpl::ProcessWlanEvent(enum wlan_event_reason wlanEvent)
sInstance.OnStationDisconnected();
if (delegate)
{
delegate->OnAssociationFailureDetected(associationFailureCause, WLAN_REFUSED_REASON_UNSPECIFIED);
delegate->OnAssociationFailureDetected(associationFailureCause, wlan_status_code);
}
break;

Expand Down
1 change: 1 addition & 0 deletions src/platform/nxp/common/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "DiagnosticDataProviderImpl.h"
#include <crypto/CHIPCryptoPAL.h>
#include <lib/support/CHIPMemString.h>
#include <platform/DiagnosticDataProvider.h>

#include <inet/InetInterface.h>
Expand Down

0 comments on commit a1bafe1

Please sign in to comment.