Merge branch 'google3' to master, roll forward up to cl/355302206.

This commit is contained in:
hai007
2021-02-04 13:34:05 -08:00
41 changed files with 1194 additions and 472 deletions
+9 -1
View File
@@ -317,7 +317,8 @@ bool BleMedium::StopAcceptingConnections(const std::string& service_id) {
}
std::unique_ptr<api::BleSocket> BleMedium::Connect(
api::BlePeripheral& remote_peripheral, const std::string& service_id) {
api::BlePeripheral& remote_peripheral, const std::string& service_id,
CancellationFlag* cancellation_flag) {
NEARBY_LOG(INFO,
"G3 Ble Connect [self]: medium=%p, adapter=%p, peripheral=%p, "
"service_id=%s",
@@ -346,6 +347,13 @@ std::unique_ptr<api::BleSocket> BleMedium::Connect(
}
}
if (cancellation_flag->Cancelled()) {
NEARBY_LOGS(ERROR) << "G3 BLE Connect: Has been cancelled: "
"service_id="
<< service_id;
return {};
}
BlePeripheral peripheral = static_cast<BlePeripheral&>(remote_peripheral);
auto socket = std::make_unique<BleSocket>(&peripheral);
// Finally, Request to connect to this socket.