From 42043ee856d2f26bc9ea0c9894162276d56b5f73 Mon Sep 17 00:00:00 2001 From: hai007 Date: Tue, 31 Oct 2023 23:19:40 -0700 Subject: [PATCH] Add more log for Intel PIE API calling PiperOrigin-RevId: 578409693 --- .../platform/implementation/windows/wifi_hotspot_medium.cc | 6 +++++- internal/platform/implementation/windows/wifi_intel.cc | 7 ++++--- internal/platform/implementation/windows/wifi_intel.h | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/internal/platform/implementation/windows/wifi_hotspot_medium.cc b/internal/platform/implementation/windows/wifi_hotspot_medium.cc index a7108a21..e8d61d3e 100644 --- a/internal/platform/implementation/windows/wifi_hotspot_medium.cc +++ b/internal/platform/implementation/windows/wifi_hotspot_medium.cc @@ -263,12 +263,16 @@ bool WifiHotspotMedium::StartWifiHotspot( WifiIntel& intel_wifi{WifiIntel::GetInstance()}; intel_wifi.Start(); int GO_channel = static_cast(intel_wifi.GetGOChannel()); - NEARBY_LOGS(INFO) << "Hotspot is running on channel: " << GO_channel; + NEARBY_LOGS(INFO) + << "Intel PIE enabled, Hotspot is running on channel: " + << GO_channel; intel_wifi.Stop(); hotspot_credentials_->SetFrequency( WifiUtils::ConvertChannelToFrequencyMhz(GO_channel, WifiBandType::kUnknown)); } else { + NEARBY_LOGS(INFO) + << "Intel PIE disabled, Can't extract Hotspot channel info!"; hotspot_credentials_->SetFrequency(-1); } return true; diff --git a/internal/platform/implementation/windows/wifi_intel.cc b/internal/platform/implementation/windows/wifi_intel.cc index 432c1a3d..8517826d 100644 --- a/internal/platform/implementation/windows/wifi_intel.cc +++ b/internal/platform/implementation/windows/wifi_intel.cc @@ -34,6 +34,7 @@ #ifndef NO_INTEL_PIE #include "absl/strings/str_format.h" +#include "third_party/intel/pie/include/PieApiErrors.h" #include "third_party/intel/pie/include/PieApiTypes.h" #include "third_party/intel/pie/include/PieDefinitions.h" #include "third_party/intel/pie/include/PieErrorMacro.h" @@ -172,11 +173,11 @@ void WifiIntel::Stop() { #endif } -uint8_t WifiIntel::GetGOChannel() { +int8_t WifiIntel::GetGOChannel() { #ifndef NO_INTEL_PIE WIFIPANQUERYPREFFEDCHANNELSETTING WifiPanQueryPreferredChannelSettingFunc = nullptr; - uint8_t channel = 0; + int8_t channel = -1; DWORD dwError = ERROR_SUCCESS; // NOLINT MUROC_RET murocApiRetVal = IWLAN_E_FAILURE; // NOLINT INTEL_WIFI_HEADER intelWifiHeader; @@ -210,7 +211,7 @@ uint8_t WifiIntel::GetGOChannel() { if (intelGOChan.goState == MurocDefs::INTEL_GO_CURRENT_CHANNEL_ACTIVE) { channel = intelGOChan.channel; } else { - NEARBY_LOGS(INFO) << "No active GO found, return 0"; + NEARBY_LOGS(INFO) << "No active GO found, return -1"; } } else { NEARBY_LOGS(INFO) << "Calling WifiPanQueryPreferredChannelSetting API " diff --git a/internal/platform/implementation/windows/wifi_intel.h b/internal/platform/implementation/windows/wifi_intel.h index 03562b12..577df76f 100644 --- a/internal/platform/implementation/windows/wifi_intel.h +++ b/internal/platform/implementation/windows/wifi_intel.h @@ -45,7 +45,7 @@ class WifiIntel { bool IsValid() const { return intel_wifi_valid_; } void Start(); void Stop(); - uint8_t GetGOChannel(); + int8_t GetGOChannel(); private: // This is a singleton object, for which destructor will never be called.