mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 07:36:10 -04:00
Roll forward to cl/331498408
Signed-off-by: Alexey Polyudov <apolyudov@google.com> Change-Id: If30a8df80799adec3aafba5b8dd4c539fc21e16d
This commit is contained in:
@@ -18,9 +18,7 @@ cc_library(
|
||||
"scheduled_executor.h",
|
||||
"single_thread_executor.h",
|
||||
],
|
||||
visibility = [
|
||||
"//platform_v2/impl/g3:__pkg__",
|
||||
],
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
"//base",
|
||||
"//platform_v2/api:platform",
|
||||
@@ -52,9 +50,7 @@ cc_library(
|
||||
"webrtc.h",
|
||||
"wifi_lan.h",
|
||||
],
|
||||
visibility = [
|
||||
"//platform_v2/impl/g3:__pkg__",
|
||||
],
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":types",
|
||||
"//platform_v2/api:comm",
|
||||
|
||||
@@ -182,15 +182,20 @@ BleMedium::~BleMedium() {
|
||||
}
|
||||
}
|
||||
|
||||
bool BleMedium::StartAdvertising(const std::string& service_id,
|
||||
const ByteArray& advertisement_bytes) {
|
||||
bool BleMedium::StartAdvertising(
|
||||
const std::string& service_id, const ByteArray& advertisement_bytes,
|
||||
const std::string& fast_advertisement_service_uuid) {
|
||||
NEARBY_LOGS(INFO) << "G3 Ble StartAdvertising: service_id=" << service_id
|
||||
<< ", advertisement bytes=" << advertisement_bytes.data()
|
||||
<< "(" << advertisement_bytes.size() << ")";
|
||||
<< "(" << advertisement_bytes.size() << "),"
|
||||
<< " fast advertisement service uuid="
|
||||
<< fast_advertisement_service_uuid;
|
||||
auto& env = MediumEnvironment::Instance();
|
||||
auto& peripheral = adapter_->GetPeripheral();
|
||||
peripheral.SetAdvertisementBytes(service_id, advertisement_bytes);
|
||||
env.UpdateBleMediumForAdvertising(*this, peripheral, service_id, true);
|
||||
bool fast_advertisement = !fast_advertisement_service_uuid.empty();
|
||||
env.UpdateBleMediumForAdvertising(*this, peripheral, service_id,
|
||||
fast_advertisement, true);
|
||||
|
||||
absl::MutexLock lock(&mutex_);
|
||||
if (server_socket_ != nullptr) server_socket_.release();
|
||||
@@ -227,7 +232,8 @@ bool BleMedium::StopAdvertising(const std::string& service_id) {
|
||||
|
||||
auto& env = MediumEnvironment::Instance();
|
||||
env.UpdateBleMediumForAdvertising(*this, adapter_->GetPeripheral(),
|
||||
service_id, false);
|
||||
service_id, /*fast_advertisement=*/false,
|
||||
/*enabled=*/false);
|
||||
accept_loops_runner_.Shutdown();
|
||||
if (server_socket_ == nullptr) {
|
||||
NEARBY_LOGS(ERROR) << "G3 Ble StopAdvertising: Failed to find Ble Server "
|
||||
|
||||
@@ -137,8 +137,9 @@ class BleMedium : public api::BleMedium {
|
||||
~BleMedium() override;
|
||||
|
||||
// Returns true once the Ble advertising has been initiated.
|
||||
bool StartAdvertising(const std::string& service_id,
|
||||
const ByteArray& advertisement_bytes) override
|
||||
bool StartAdvertising(
|
||||
const std::string& service_id, const ByteArray& advertisement_bytes,
|
||||
const std::string& fast_advertisement_service_uuid) override
|
||||
ABSL_LOCKS_EXCLUDED(mutex_);
|
||||
bool StopAdvertising(const std::string& service_id) override
|
||||
ABSL_LOCKS_EXCLUDED(mutex_);
|
||||
|
||||
Reference in New Issue
Block a user