Add Message Stream

Define MessageStream class for exchanging messages betweek the seeker and the
provider over rfcomm.

PiperOrigin-RevId: 516986541
This commit is contained in:
Janusz Sobczak
2023-03-15 18:42:39 -07:00
committed by Copybara-Service
parent a70826dbf8
commit 02ffb5d45e
12 changed files with 1628 additions and 0 deletions
+5
View File
@@ -25,6 +25,7 @@
#include "absl/container/flat_hash_set.h"
#include "absl/status/status.h"
#include "absl/strings/escaping.h"
#include "internal/platform/count_down_latch.h"
#include "internal/platform/feature_flags.h"
#include "internal/platform/implementation/ble_v2.h"
@@ -199,9 +200,13 @@ api::BluetoothDevice* MediumEnvironment::FindBluetoothDevice(
api::BluetoothDevice* device = nullptr;
CountDownLatch latch(1);
RunOnMediumEnvironmentThread([this, &device, &latch, &mac_address]() {
NEARBY_LOGS(INFO) << " Looking for: "
<< absl::BytesToHexString(mac_address);
for (auto& item : bluetooth_mediums_) {
auto* adapter = item.second.adapter;
if (!adapter) continue;
NEARBY_LOGS(INFO) << " Adapter: "
<< absl::BytesToHexString(adapter->GetMacAddress());
if (adapter->GetMacAddress() == mac_address) {
device = bluetooth_adapters_[adapter];
break;