Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1994)

Unified Diff: device/bluetooth/dbus/fake_bluetooth_device_client.cc

Issue 2105423003: bluetooth: Update the map of GATT services when services resolve (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Address luiz's comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/dbus/fake_bluetooth_device_client.cc
diff --git a/device/bluetooth/dbus/fake_bluetooth_device_client.cc b/device/bluetooth/dbus/fake_bluetooth_device_client.cc
index 2dcc3a330050cfdf9001d853221fc5343a16beba..278e79b72b8db5fd261856a98f877b52516964ff 100644
--- a/device/bluetooth/dbus/fake_bluetooth_device_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_device_client.cc
@@ -253,15 +253,6 @@ const char FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDeviceName[] =
const uint32_t
FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDeviceClass = 0x7a020c;
-const char FakeBluetoothDeviceClient::kCachedLowEnergyPath[] =
- "/fake/hci0/devF";
-const char FakeBluetoothDeviceClient::kCachedLowEnergyAddress[] =
- "02:A5:11:0D:15:40";
-const char FakeBluetoothDeviceClient::kCachedLowEnergyName[] =
- "Bluetooth 4.0 Heart Rate Monitor";
-const uint32_t FakeBluetoothDeviceClient::kCachedLowEnergyClass =
- 0x000918; // Major class "Health", Minor class "Heart/Pulse Rate Monitor."
-
FakeBluetoothDeviceClient::Properties::Properties(
const PropertyChangedCallback& callback)
: BluetoothDeviceClient::Properties(
@@ -435,6 +426,7 @@ void FakeBluetoothDeviceClient::Connect(const dbus::ObjectPath& object_path,
static_cast<FakeBluetoothGattServiceClient*>(
bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient());
gatt_service_client->ExposeHeartRateService(object_path);
+ properties->services_resolved.ReplaceValue(true);
}
AddInputDeviceIfNeeded(object_path, properties);
@@ -743,6 +735,7 @@ void FakeBluetoothDeviceClient::CreateDevice(
properties->bluetooth_class.ReplaceValue(kLowEnergyClass);
properties->name.ReplaceValue("Heart Rate Monitor");
properties->alias.ReplaceValue(kLowEnergyName);
+ properties->services_resolved.ReplaceValue(false);
std::vector<std::string> uuids;
uuids.push_back(FakeBluetoothGattServiceClient::kHeartRateServiceUUID);
@@ -757,17 +750,6 @@ void FakeBluetoothDeviceClient::CreateDevice(
properties->paired.ReplaceValue(false);
properties->name.ReplaceValue("Connected Pairable Device");
properties->alias.ReplaceValue(kConnectedTrustedNotPairedDeviceName);
- } else if (device_path == dbus::ObjectPath(kCachedLowEnergyPath)) {
- properties->address.ReplaceValue(kLowEnergyAddress);
- properties->bluetooth_class.ReplaceValue(kLowEnergyClass);
- properties->name.ReplaceValue("Heart Rate Monitor");
- properties->alias.ReplaceValue(kLowEnergyName);
- properties->alias.ReplaceValue(kLowEnergyName);
- properties->services_resolved.ReplaceValue(false);
-
- std::vector<std::string> uuids;
- uuids.push_back(FakeBluetoothGattServiceClient::kHeartRateServiceUUID);
- properties->uuids.ReplaceValue(uuids);
} else {
NOTREACHED();
}
@@ -775,14 +757,6 @@ void FakeBluetoothDeviceClient::CreateDevice(
properties_map_.insert(std::make_pair(device_path, std::move(properties)));
device_list_.push_back(device_path);
- // After the new properties| is added to the map, expose the heart rate
- // service to emulate the device with cached GATT services.
- if (device_path == dbus::ObjectPath(kCachedLowEnergyPath)) {
- static_cast<FakeBluetoothGattServiceClient*>(
- bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient())
- ->ExposeHeartRateServiceWithoutDelay(device_path);
- }
-
FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_,
DeviceAdded(device_path));
}

Powered by Google App Engine
This is Rietveld 408576698