Apply GO frequency to NC that queries from Intel PIE SDK

PiperOrigin-RevId: 569558266
This commit is contained in:
hai007
2023-09-29 12:25:01 -07:00
committed by Copybara-Service
parent eba928e784
commit d477a2d174
11 changed files with 43 additions and 14 deletions
@@ -20,16 +20,17 @@
#include <vector>
#include "absl/strings/string_view.h"
#include "absl/time/time.h"
#include "internal/platform/feature_flags.h"
#include "internal/platform/flags/nearby_platform_feature_flags.h"
#include "internal/platform/implementation/windows/wifi_hotspot.h"
#include "internal/platform/implementation/windows/wifi_intel.h"
// Nearby connections headers
#include "internal/flags/nearby_flags.h"
#include "internal/platform/cancellation_flag_listener.h"
#include "internal/platform/implementation/windows/utils.h"
#include "internal/platform/logging.h"
#include "internal/platform/wifi_utils.h"
namespace nearby {
namespace windows {
@@ -256,6 +257,20 @@ bool WifiHotspotMedium::StartWifiHotspot(
WiFiDirectAdvertisementPublisherStatus::Started) {
NEARBY_LOGS(INFO) << __func__ << ": WiFi Hotspot created and started.";
medium_status_ |= kMediumStatusBeaconing;
if (NearbyFlags::GetInstance().GetBoolFlag(
platform::config_package_nearby::nearby_platform_feature::
kEnableIntelPieSdk)) {
WifiIntel& intel_wifi{WifiIntel::GetInstance()};
intel_wifi.Start();
int GO_channel = static_cast<int>(intel_wifi.GetGOChannel());
NEARBY_LOGS(INFO) << "Hotspot is running on channel: " << GO_channel;
intel_wifi.Stop();
hotspot_credentials_->SetFrequency(
WifiUtils::ConvertChannelToFrequencyMhz(GO_channel,
WifiBandType::kUnknown));
} else {
hotspot_credentials_->SetFrequency(-1);
}
return true;
}
@@ -428,7 +428,7 @@ HINSTANCE WifiIntel::PIEDllLoader() {
// load the library and get the handle
murocApiDllHandle = LoadLibraryW(pDllPathValue); // NOLINT
NEARBY_LOGS(INFO) << absl::StrFormat("Muroc Api Dll Handle is 0x%p ",
NEARBY_LOGS(VERBOSE) << absl::StrFormat("Muroc Api Dll Handle is 0x%p ",
murocApiDllHandle);
} else {
NEARBY_LOGS(INFO) << "GetFullDllLoadPathFromPieRegistry fails eith error: "
@@ -458,7 +458,7 @@ HADAPTER WifiGetAdapterList(HINSTANCE murocApiDllHandle,
return INVALID_HADAPTER;
}
NEARBY_LOGS(INFO) << "GetProcAddress for WifiGetAdapterListFunction API "
NEARBY_LOGS(VERBOSE) << "GetProcAddress for WifiGetAdapterListFunction API "
"completed successfully";
INTEL_WIFI_HEADER intelHeader = {INTEL_STRUCT_VERSION_V156, // NOLINT
sizeof(MurocDefs::INTEL_ADAPTER_LIST_V120)};
@@ -475,7 +475,7 @@ HADAPTER WifiGetAdapterList(HINSTANCE murocApiDllHandle,
}
firstAdapterOnTheList = (*ppAllAdapters)->adapter[0].hAdapter;
NEARBY_LOGS(INFO) << "Return WIFI Adapter: " << firstAdapterOnTheList;
NEARBY_LOGS(INFO) << "WIFI Adapter on the list: " << firstAdapterOnTheList;
return firstAdapterOnTheList;
}
@@ -532,7 +532,7 @@ void DeregisterIntelCallback(HINSTANCE murocApiDllHandle,
murocApiRetVal = deregisterIntelCBFunc(fnCallback);
if (murocApiRetVal == IWLAN_E_SUCCESS) {
NEARBY_LOGS(INFO) << "Calling DeregisterIntelCallback API succeeded.";
NEARBY_LOGS(VERBOSE) << "Calling DeregisterIntelCallback API succeeded.";
} else {
NEARBY_LOGS(INFO)
<< "Calling DeregisterIntelCallback API fails with error:"
@@ -566,7 +566,7 @@ void FreeMemoryList(HINSTANCE murocApiDllHandle, void* ptr) {
murocApiRetVal = freeMemoryListFunction(ptr);
if (murocApiRetVal == IWLAN_E_SUCCESS) {
NEARBY_LOGS(INFO) << "Calling FreeListMemory API succeeded.";
NEARBY_LOGS(VERBOSE) << "Calling FreeListMemory API succeeded.";
} else {
NEARBY_LOGS(INFO) << "Calling FreeListMemory API failed with error: "
<< murocApiRetVal;