mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Remove unnecessary c'tor from struct.
PiperOrigin-RevId: 733138400
This commit is contained in:
committed by
Copybara-Service
parent
d22c273f1f
commit
0b2a0961f9
@@ -44,7 +44,7 @@ class FakeNearbyConnectionsService : public NearbyConnectionsService {
|
||||
MOCK_METHOD(void, StartAdvertising,
|
||||
(absl::string_view service_id,
|
||||
const std::vector<uint8_t>& endpoint_info,
|
||||
AdvertisingOptions advertising_options,
|
||||
const AdvertisingOptions& advertising_options,
|
||||
ConnectionListener advertising_listener,
|
||||
std::function<void(Status status)> callback),
|
||||
(override));
|
||||
@@ -55,7 +55,8 @@ class FakeNearbyConnectionsService : public NearbyConnectionsService {
|
||||
(override));
|
||||
|
||||
MOCK_METHOD(void, StartDiscovery,
|
||||
(absl::string_view service_id, DiscoveryOptions discovery_options,
|
||||
(absl::string_view service_id,
|
||||
const DiscoveryOptions& discovery_options,
|
||||
DiscoveryListener discovery_listener,
|
||||
std::function<void(Status status)> callback),
|
||||
(override));
|
||||
@@ -69,7 +70,7 @@ class FakeNearbyConnectionsService : public NearbyConnectionsService {
|
||||
(absl::string_view service_id,
|
||||
const std::vector<uint8_t>& endpoint_info,
|
||||
absl::string_view endpoint_id,
|
||||
ConnectionOptions connection_options,
|
||||
const ConnectionOptions& connection_options,
|
||||
ConnectionListener connection_listener,
|
||||
std::function<void(Status status)> callback),
|
||||
(override));
|
||||
|
||||
@@ -252,15 +252,17 @@ void NearbyConnectionsManagerImpl::StartAdvertising(
|
||||
|
||||
nearby_connections_service_->StartAdvertising(
|
||||
kServiceId, endpoint_info,
|
||||
AdvertisingOptions(
|
||||
kStrategy, std::move(allowed_mediums), auto_upgrade_bandwidth,
|
||||
/*enforce_topology_constraints=*/true,
|
||||
/*enable_bluetooth_listening=*/use_ble,
|
||||
/*enable_webrtc_listening=*/
|
||||
ShouldEnableWebRtc(connectivity_manager_, data_usage, power_level),
|
||||
/*use_stable_endpoint_id=*/use_stable_endpoint_id,
|
||||
/*fast_advertisement_service_uuid=*/
|
||||
fast_advertisement_service_uuid),
|
||||
{
|
||||
.strategy = kStrategy,
|
||||
.allowed_mediums = std::move(allowed_mediums),
|
||||
.auto_upgrade_bandwidth = auto_upgrade_bandwidth,
|
||||
.enforce_topology_constraints = true,
|
||||
.enable_bluetooth_listening = use_ble,
|
||||
.enable_webrtc_listening = ShouldEnableWebRtc(
|
||||
connectivity_manager_, data_usage, power_level),
|
||||
.use_stable_endpoint_id = use_stable_endpoint_id,
|
||||
.fast_advertisement_service_uuid = fast_advertisement_service_uuid,
|
||||
},
|
||||
std::move(connection_listener), std::move(callback));
|
||||
}
|
||||
|
||||
@@ -310,9 +312,13 @@ void NearbyConnectionsManagerImpl::StartDiscovery(
|
||||
|
||||
nearby_connections_service_->StartDiscovery(
|
||||
kServiceId,
|
||||
DiscoveryOptions(kStrategy, std::move(allowed_mediums),
|
||||
Uuid(kFastAdvertisementServiceUuid),
|
||||
/*is_out_of_band_connection=*/false),
|
||||
{
|
||||
.strategy = kStrategy,
|
||||
.allowed_mediums = std::move(allowed_mediums),
|
||||
.fast_advertisement_service_uuid =
|
||||
Uuid(kFastAdvertisementServiceUuid),
|
||||
.is_out_of_band_connection = false,
|
||||
},
|
||||
std::move(service_discovery_listener), std::move(callback));
|
||||
}
|
||||
|
||||
@@ -406,12 +412,12 @@ void NearbyConnectionsManagerImpl::Connect(
|
||||
|
||||
nearby_connections_service_->RequestConnection(
|
||||
kServiceId, endpoint_info, endpoint_id,
|
||||
ConnectionOptions(
|
||||
std::move(allowed_mediums), std::move(bluetooth_mac_address),
|
||||
/*keep_alive_interval=*/std::nullopt,
|
||||
/*keep_alive_timeout=*/std::nullopt,
|
||||
IsTransportTypeFlagsSet(transport_type,
|
||||
TransportType::kHighQualityNonDisruptive)),
|
||||
{
|
||||
.allowed_mediums = std::move(allowed_mediums),
|
||||
.remote_bluetooth_mac_address = std::move(bluetooth_mac_address),
|
||||
.non_disruptive_hotspot_mode = IsTransportTypeFlagsSet(
|
||||
transport_type, TransportType::kHighQualityNonDisruptive),
|
||||
},
|
||||
std::move(connection_listener),
|
||||
[this, endpoint_id = std::string(endpoint_id)](ConnectionsStatus status) {
|
||||
MutexLock lock(&mutex_);
|
||||
|
||||
@@ -122,14 +122,14 @@ class NearbyConnectionsService {
|
||||
|
||||
virtual void StartAdvertising(
|
||||
absl::string_view service_id, const std::vector<uint8_t>& endpoint_info,
|
||||
AdvertisingOptions advertising_options,
|
||||
const AdvertisingOptions& advertising_options,
|
||||
ConnectionListener advertising_listener,
|
||||
std::function<void(Status status)> callback) = 0;
|
||||
virtual void StopAdvertising(absl::string_view service_id,
|
||||
std::function<void(Status status)> callback) = 0;
|
||||
|
||||
virtual void StartDiscovery(absl::string_view service_id,
|
||||
DiscoveryOptions discovery_options,
|
||||
const DiscoveryOptions& discovery_options,
|
||||
DiscoveryListener discovery_listener,
|
||||
std::function<void(Status status)> callback) = 0;
|
||||
virtual void StopDiscovery(absl::string_view service_id,
|
||||
@@ -137,7 +137,8 @@ class NearbyConnectionsService {
|
||||
|
||||
virtual void RequestConnection(
|
||||
absl::string_view service_id, const std::vector<uint8_t>& endpoint_info,
|
||||
absl::string_view endpoint_id, ConnectionOptions connection_options,
|
||||
absl::string_view endpoint_id,
|
||||
const ConnectionOptions& connection_options,
|
||||
ConnectionListener connection_listener,
|
||||
std::function<void(Status status)> callback) = 0;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ NearbyConnectionsServiceImpl::~NearbyConnectionsServiceImpl() = default;
|
||||
|
||||
void NearbyConnectionsServiceImpl::StartAdvertising(
|
||||
absl::string_view service_id, const std::vector<uint8_t>& endpoint_info,
|
||||
AdvertisingOptions advertising_options,
|
||||
const AdvertisingOptions& advertising_options,
|
||||
ConnectionListener advertising_listener,
|
||||
std::function<void(Status status)> callback) {
|
||||
advertising_listener_ = std::move(advertising_listener);
|
||||
@@ -138,7 +138,7 @@ void NearbyConnectionsServiceImpl::StopAdvertising(
|
||||
}
|
||||
|
||||
void NearbyConnectionsServiceImpl::StartDiscovery(
|
||||
absl::string_view service_id, DiscoveryOptions discovery_options,
|
||||
absl::string_view service_id, const DiscoveryOptions& discovery_options,
|
||||
DiscoveryListener discovery_listener,
|
||||
std::function<void(Status status)> callback) {
|
||||
discovery_listener_ = std::move(discovery_listener);
|
||||
@@ -188,7 +188,7 @@ void NearbyConnectionsServiceImpl::StopDiscovery(
|
||||
|
||||
void NearbyConnectionsServiceImpl::RequestConnection(
|
||||
absl::string_view service_id, const std::vector<uint8_t>& endpoint_info,
|
||||
absl::string_view endpoint_id, ConnectionOptions connection_options,
|
||||
absl::string_view endpoint_id, const ConnectionOptions& connection_options,
|
||||
ConnectionListener connection_listener,
|
||||
std::function<void(Status status)> callback) {
|
||||
connection_listener_ = std::move(connection_listener);
|
||||
|
||||
@@ -43,14 +43,14 @@ class NearbyConnectionsServiceImpl : public NearbyConnectionsService {
|
||||
|
||||
void StartAdvertising(absl::string_view service_id,
|
||||
const std::vector<uint8_t>& endpoint_info,
|
||||
AdvertisingOptions advertising_options,
|
||||
const AdvertisingOptions& advertising_options,
|
||||
ConnectionListener advertising_listener,
|
||||
std::function<void(Status status)> callback) override;
|
||||
void StopAdvertising(absl::string_view service_id,
|
||||
std::function<void(Status status)> callback) override;
|
||||
|
||||
void StartDiscovery(absl::string_view service_id,
|
||||
DiscoveryOptions discovery_options,
|
||||
const DiscoveryOptions& discovery_options,
|
||||
DiscoveryListener discovery_listener,
|
||||
std::function<void(Status status)> callback) override;
|
||||
void StopDiscovery(absl::string_view service_id,
|
||||
@@ -59,7 +59,7 @@ class NearbyConnectionsServiceImpl : public NearbyConnectionsService {
|
||||
void RequestConnection(absl::string_view service_id,
|
||||
const std::vector<uint8_t>& endpoint_info,
|
||||
absl::string_view endpoint_id,
|
||||
ConnectionOptions connection_options,
|
||||
const ConnectionOptions& connection_options,
|
||||
ConnectionListener connection_listener,
|
||||
std::function<void(Status status)> callback) override;
|
||||
|
||||
|
||||
@@ -200,24 +200,6 @@ struct MediumSelection {
|
||||
|
||||
// Options for a call to NearbyConnections::StartAdvertising().
|
||||
struct AdvertisingOptions {
|
||||
AdvertisingOptions() = default;
|
||||
AdvertisingOptions(Strategy strategy, MediumSelection allowed_mediums,
|
||||
bool auto_upgrade_bandwidth,
|
||||
bool enforce_topology_constraints,
|
||||
bool enable_bluetooth_listening,
|
||||
bool enable_webrtc_listening,
|
||||
bool use_stable_endpoint_id,
|
||||
Uuid fast_advertisement_service_uuid) {
|
||||
this->strategy = strategy;
|
||||
this->allowed_mediums = allowed_mediums;
|
||||
this->auto_upgrade_bandwidth = auto_upgrade_bandwidth;
|
||||
this->enforce_topology_constraints = enforce_topology_constraints;
|
||||
this->enable_bluetooth_listening = enable_bluetooth_listening;
|
||||
this->enable_webrtc_listening = enable_webrtc_listening;
|
||||
this->use_stable_endpoint_id = use_stable_endpoint_id;
|
||||
this->fast_advertisement_service_uuid = fast_advertisement_service_uuid;
|
||||
}
|
||||
|
||||
// The strategy to use for advertising. Must match the strategy used in
|
||||
// DiscoveryOptions for remote devices to see this advertisement.
|
||||
Strategy strategy;
|
||||
@@ -252,15 +234,6 @@ struct AdvertisingOptions {
|
||||
|
||||
// Options for a call to NearbyConnections::StartDiscovery().
|
||||
struct DiscoveryOptions {
|
||||
DiscoveryOptions() = default;
|
||||
DiscoveryOptions(Strategy strategy, MediumSelection allowed_mediums,
|
||||
std::optional<Uuid> fast_advertisement_service_uuid,
|
||||
bool is_out_of_band_connection) {
|
||||
this->strategy = strategy;
|
||||
this->allowed_mediums = allowed_mediums;
|
||||
this->fast_advertisement_service_uuid = fast_advertisement_service_uuid,
|
||||
this->is_out_of_band_connection = is_out_of_band_connection;
|
||||
}
|
||||
// The strategy to use for discovering. Must match the strategy used in
|
||||
// AdvertisingOptions in order to see advertisements.
|
||||
Strategy strategy;
|
||||
@@ -278,20 +251,6 @@ struct DiscoveryOptions {
|
||||
|
||||
// Options for a call to NearbyConnections::RequestConnection().
|
||||
struct ConnectionOptions {
|
||||
ConnectionOptions() = default;
|
||||
ConnectionOptions(
|
||||
MediumSelection allowed_mediums,
|
||||
std::optional<std::vector<uint8_t>> remote_bluetooth_mac_address,
|
||||
std::optional<absl::Duration> keep_alive_interval,
|
||||
std::optional<absl::Duration> keep_alive_timeout,
|
||||
bool non_disruptive_hotspot_mode) {
|
||||
this->allowed_mediums = allowed_mediums;
|
||||
this->remote_bluetooth_mac_address = remote_bluetooth_mac_address;
|
||||
this->keep_alive_interval = keep_alive_interval;
|
||||
this->keep_alive_timeout = keep_alive_timeout;
|
||||
this->non_disruptive_hotspot_mode = non_disruptive_hotspot_mode;
|
||||
}
|
||||
|
||||
// Describes which mediums are allowed to be used for connection. Note that
|
||||
// allowing an otherwise unsupported medium is ok. Only the intersection of
|
||||
// allowed and supported mediums will be used to connect.
|
||||
|
||||
Reference in New Issue
Block a user