From 2a46ef5d4a8fb7037def587b7927cd359561b296 Mon Sep 17 00:00:00 2001 From: "armansito@chromium.org" Date: Fri, 11 Apr 2014 08:20:12 +0000 Subject: device/bluetooth: Add chromeos::BluetoothRemoteGattDescriptorChromeOS. Added the chromeos::BluetoothRemoteGattDescriptorChromeOS class which implements a remote instance of device::BluetoothGattDescriptor for the Chrome OS platform. BUG=360266,340529 TEST=device_unittests Review URL: https://codereview.chromium.org/234443005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263194 0039d316-1c4b-4281-b951-d872f2087c98 --- .../fake_bluetooth_gatt_characteristic_client.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc') diff --git a/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc b/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc index 55784a9..dbbdcc3 100644 --- a/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc +++ b/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc @@ -8,6 +8,8 @@ #include "base/message_loop/message_loop.h" #include "base/rand_util.h" #include "base/time/time.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h" #include "third_party/cros_system_api/dbus/service_constants.h" namespace chromeos { @@ -207,12 +209,28 @@ void FakeBluetoothGattCharacteristicClient::ExposeHeartRateCharacteristics( // be handled by BlueZ, automatically set up notifications for now. ScheduleHeartRateMeasurementValueChange(); - // TODO(armansito): Add descriptors. + // Expose CCC descriptor for Heart Rate Measurement characteristic. + FakeBluetoothGattDescriptorClient* descriptor_client = + static_cast( + DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()); + dbus::ObjectPath ccc_path(descriptor_client->ExposeDescriptor( + dbus::ObjectPath(heart_rate_measurement_path_), + FakeBluetoothGattDescriptorClient:: + kClientCharacteristicConfigurationUUID)); + DCHECK(ccc_path.IsValid()); + heart_rate_measurement_ccc_desc_path_ = ccc_path.value(); } void FakeBluetoothGattCharacteristicClient::HideHeartRateCharacteristics() { VLOG(2) << "Hiding fake Heart Rate characteristics."; + // Hide the descriptors. + FakeBluetoothGattDescriptorClient* descriptor_client = + static_cast( + DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()); + descriptor_client->HideDescriptor( + dbus::ObjectPath(heart_rate_measurement_ccc_desc_path_)); + // Notify the observers before deleting the properties structures so that they // can be accessed from the observer method. NotifyCharacteristicRemoved(dbus::ObjectPath(heart_rate_measurement_path_)); -- cgit v1.1