mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Change BWU priority from Hotspot to WifiLan
PiperOrigin-RevId: 491388299
This commit is contained in:
@@ -423,6 +423,7 @@ let package = Package(
|
||||
"connections/implementation/offline_service_controller_test.cc",
|
||||
"connections/implementation/encryption_runner_test.cc",
|
||||
"connections/implementation/p2p_cluster_pcp_handler_test.cc",
|
||||
"connections/implementation/p2p_point_to_point_pcp_handler_test.cc",
|
||||
"connections/implementation/base_pcp_handler_test.cc",
|
||||
"connections/implementation/injected_bluetooth_device_store_test.cc",
|
||||
"connections/implementation/internal_payload_factory_test.cc",
|
||||
|
||||
@@ -220,6 +220,7 @@ cc_test(
|
||||
"offline_frames_validator_test.cc",
|
||||
"offline_service_controller_test.cc",
|
||||
"p2p_cluster_pcp_handler_test.cc",
|
||||
"p2p_point_to_point_pcp_handler_test.cc",
|
||||
"payload_manager_test.cc",
|
||||
"pcp_manager_test.cc",
|
||||
"service_controller_router_test.cc",
|
||||
|
||||
@@ -196,7 +196,14 @@ BooleanMediumSelector BasePcpHandler::ComputeIntersectionOfSupportedMediums(
|
||||
their_mediums.push_back(GetDefaultUpgradeMedium());
|
||||
}
|
||||
|
||||
for (auto medium : their_mediums) {
|
||||
NEARBY_LOGS(VERBOSE) << "Their supported medium name: "
|
||||
<< proto::connections::Medium_Name(medium);
|
||||
}
|
||||
|
||||
for (Medium my_medium : GetConnectionMediumsByPriority()) {
|
||||
NEARBY_LOGS(VERBOSE) << "Our supported medium name: "
|
||||
<< proto::connections::Medium_Name(my_medium);
|
||||
if (std::find(their_mediums.begin(), their_mediums.end(), my_medium) !=
|
||||
their_mediums.end()) {
|
||||
// We use advertising options as a proxy to whether or not the local
|
||||
|
||||
@@ -1213,12 +1213,12 @@ std::vector<Medium> BwuManager::StripOutUnavailableMediums(
|
||||
for (Medium m : mediums) {
|
||||
bool available = false;
|
||||
switch (m) {
|
||||
case Medium::WIFI_HOTSPOT:
|
||||
available = mediums_->GetWifiHotspot().IsAPAvailable();
|
||||
break;
|
||||
case Medium::WIFI_LAN:
|
||||
available = mediums_->GetWifiLan().IsAvailable();
|
||||
break;
|
||||
case Medium::WIFI_HOTSPOT:
|
||||
available = mediums_->GetWifiHotspot().IsAPAvailable();
|
||||
break;
|
||||
case Medium::WEB_RTC:
|
||||
available = mediums_->GetWebRtc().IsAvailable();
|
||||
break;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "connections/implementation/p2p_point_to_point_pcp_handler.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace connections {
|
||||
@@ -28,13 +30,13 @@ P2pPointToPointPcpHandler::P2pPointToPointPcpHandler(
|
||||
std::vector<proto::connections::Medium>
|
||||
P2pPointToPointPcpHandler::GetConnectionMediumsByPriority() {
|
||||
std::vector<proto::connections::Medium> mediums;
|
||||
if (mediums_->GetWifiLan().IsAvailable()) {
|
||||
mediums.push_back(proto::connections::WIFI_LAN);
|
||||
}
|
||||
if (mediums_->GetWifi().IsAvailable() &&
|
||||
mediums_->GetWifiHotspot().IsClientAvailable()) {
|
||||
mediums.push_back(proto::connections::WIFI_HOTSPOT);
|
||||
}
|
||||
if (mediums_->GetWifiLan().IsAvailable()) {
|
||||
mediums.push_back(proto::connections::WIFI_LAN);
|
||||
}
|
||||
if (mediums_->GetWebRtc().IsAvailable()) {
|
||||
mediums.push_back(proto::connections::WEB_RTC);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright 2022 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "connections/implementation/p2p_point_to_point_pcp_handler.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "protobuf-matchers/protocol-buffer-matchers.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace connections {
|
||||
|
||||
// TODO(b/257120173): Add Units Test for P2pPointToPointPcpHandler
|
||||
TEST(P2pPointToPointPcpHandlerTest, CanConnect) {}
|
||||
|
||||
} // namespace connections
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
@@ -33,13 +33,13 @@ P2pStarPcpHandler::P2pStarPcpHandler(
|
||||
std::vector<proto::connections::Medium>
|
||||
P2pStarPcpHandler::GetConnectionMediumsByPriority() {
|
||||
std::vector<proto::connections::Medium> mediums;
|
||||
if (mediums_->GetWifiLan().IsAvailable()) {
|
||||
mediums.push_back(proto::connections::WIFI_LAN);
|
||||
}
|
||||
if (mediums_->GetWifi().IsAvailable() &&
|
||||
mediums_->GetWifiHotspot().IsClientAvailable()) {
|
||||
mediums.push_back(proto::connections::WIFI_HOTSPOT);
|
||||
}
|
||||
if (mediums_->GetWifiLan().IsAvailable()) {
|
||||
mediums.push_back(proto::connections::WIFI_LAN);
|
||||
}
|
||||
if (mediums_->GetWebRtc().IsAvailable()) {
|
||||
mediums.push_back(proto::connections::WEB_RTC);
|
||||
}
|
||||
|
||||
@@ -63,8 +63,8 @@ struct MediumSelector {
|
||||
std::vector<Medium> GetMediums(T value) const {
|
||||
std::vector<Medium> mediums;
|
||||
// Mediums are sorted in order of decreasing preference.
|
||||
if (wifi_hotspot == value) mediums.push_back(Medium::WIFI_HOTSPOT);
|
||||
if (wifi_lan == value) mediums.push_back(Medium::WIFI_LAN);
|
||||
if (wifi_hotspot == value) mediums.push_back(Medium::WIFI_HOTSPOT);
|
||||
if (web_rtc == value) mediums.push_back(Medium::WEB_RTC);
|
||||
if (bluetooth == value) mediums.push_back(Medium::BLUETOOTH);
|
||||
if (ble == value) mediums.push_back(Medium::BLE);
|
||||
|
||||
@@ -148,7 +148,7 @@ api::WifiInformation& WifiMedium::GetInformation() {
|
||||
wifi_information_.ap_frequency =
|
||||
WifiUtils::ConvertChannelToFrequencyMhz(
|
||||
*channel, api::WifiBandType::kUnknown);
|
||||
NEARBY_LOGS(INFO) << "Frequency: " << *channel << "; ap_frequency: "
|
||||
NEARBY_LOGS(INFO) << "Channel: " << *channel << "; ap_frequency: "
|
||||
<< wifi_information_.ap_frequency;
|
||||
WlanFreeMemory(channel);
|
||||
channel = NULL;
|
||||
|
||||
Reference in New Issue
Block a user