mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Separate ConnectionOptions into AdvertisingOptions, ConnectionOptions and DiscoveryOptions everywhere in the core.
PiperOrigin-RevId: 422626306
This commit is contained in:
committed by
Copybara-Service
parent
04ec681865
commit
56eb46db06
@@ -1,4 +1,4 @@
|
||||
// Copyright 2020 Google LLC
|
||||
// Copyright 2021 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@@ -17,9 +17,9 @@
|
||||
#include <string>
|
||||
|
||||
#include "absl/functional/bind_front.h"
|
||||
#include "core/advertising_options.h"
|
||||
#include "core/core.h"
|
||||
#include "core/listeners.h"
|
||||
#include "core/options.h"
|
||||
#include "core/params.h"
|
||||
#include "core/status.h"
|
||||
#include "platform/base/byte_array.h"
|
||||
@@ -37,7 +37,7 @@ using ::location::nearby::ByteArrayFromNSData;
|
||||
using ::location::nearby::CppStringFromObjCString;
|
||||
using ::location::nearby::ObjCStringFromCppString;
|
||||
using ::location::nearby::connections::ConnectionListener;
|
||||
using ::location::nearby::connections::ConnectionOptions;
|
||||
using ::location::nearby::connections::AdvertisingOptions;
|
||||
using ::location::nearby::connections::ConnectionRequestInfo;
|
||||
using ::location::nearby::connections::ConnectionResponseInfo;
|
||||
using ::location::nearby::connections::GNCStrategyToStrategy;
|
||||
@@ -289,17 +289,21 @@ using ::location::nearby::connections::GNCAdvertiserConnectionListener;
|
||||
advertiser->advertiserListener.get()),
|
||||
};
|
||||
|
||||
advertiser.core->_core->StartAdvertising(CppStringFromObjCString(serviceId),
|
||||
ConnectionOptions{
|
||||
.strategy = GNCStrategyToStrategy(strategy),
|
||||
.auto_upgrade_bandwidth = true,
|
||||
.enforce_topology_constraints = true,
|
||||
},
|
||||
ConnectionRequestInfo{
|
||||
.endpoint_info = ByteArrayFromNSData(endpointInfo),
|
||||
.listener = std::move(listener),
|
||||
},
|
||||
ResultListener{});
|
||||
advertiser.core->_core->StartAdvertising(
|
||||
CppStringFromObjCString(serviceId),
|
||||
AdvertisingOptions{
|
||||
{
|
||||
GNCStrategyToStrategy(strategy), // .strategy
|
||||
location::nearby::connections::BooleanMediumSelector(), // .allowed
|
||||
},
|
||||
true, // .auto_upgrade_bandwidth
|
||||
true, // .enforce_topology_constraints
|
||||
},
|
||||
ConnectionRequestInfo{
|
||||
.endpoint_info = ByteArrayFromNSData(endpointInfo),
|
||||
.listener = std::move(listener),
|
||||
},
|
||||
ResultListener{});
|
||||
return advertiser;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2020 Google LLC
|
||||
// Copyright 2021 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@@ -18,9 +18,10 @@
|
||||
#include <utility>
|
||||
|
||||
#include "absl/functional/bind_front.h"
|
||||
#include "core/connection_options.h"
|
||||
#include "core/core.h"
|
||||
#include "core/discovery_options.h"
|
||||
#include "core/listeners.h"
|
||||
#include "core/options.h"
|
||||
#include "core/status.h"
|
||||
#include "platform/base/byte_array.h"
|
||||
#import "platform/impl/ios/Source/GNCConnection.h"
|
||||
@@ -35,6 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
using ::location::nearby::ByteArray;
|
||||
using ::location::nearby::CppStringFromObjCString;
|
||||
using ::location::nearby::connections::DiscoveryOptions;
|
||||
using ::location::nearby::connections::ConnectionOptions;
|
||||
using ::location::nearby::connections::DiscoveryListener;
|
||||
using ::location::nearby::connections::DistanceInfo;
|
||||
@@ -379,8 +381,10 @@ using ::location::nearby::connections::GNCDiscoveryListener;
|
||||
};
|
||||
|
||||
discoverer.core->_core->StartDiscovery(CppStringFromObjCString(serviceId),
|
||||
ConnectionOptions{
|
||||
.strategy = GNCStrategyToStrategy(strategy),
|
||||
DiscoveryOptions{
|
||||
{
|
||||
GNCStrategyToStrategy(strategy),
|
||||
},
|
||||
},
|
||||
std::move(listener), ResultListener{});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2020 Google LLC
|
||||
// Copyright 2021 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <string>
|
||||
|
||||
#include "core/listeners.h"
|
||||
#include "core/options.h"
|
||||
#import "platform/impl/ios/Source/GNCAdvertiser.h"
|
||||
#import "platform/impl/ios/Source/GNCConnection.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user