summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc
diff options
context:
space:
mode:
authorarmansito@chromium.org <armansito@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-11 08:20:12 +0000
committerarmansito@chromium.org <armansito@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-11 08:20:12 +0000
commit2a46ef5d4a8fb7037def587b7927cd359561b296 (patch)
tree3972c42ee200f2ca0e2f6f8ef013ea4bb8e82d2d /chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc
parentb5e5a42df4b992425cb8692d418dfc1aca1bc316 (diff)
downloadchromium_src-2a46ef5d4a8fb7037def587b7927cd359561b296.zip
chromium_src-2a46ef5d4a8fb7037def587b7927cd359561b296.tar.gz
chromium_src-2a46ef5d4a8fb7037def587b7927cd359561b296.tar.bz2
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
Diffstat (limited to 'chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc')
-rw-r--r--chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc20
1 files changed, 19 insertions, 1 deletions
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<FakeBluetoothGattDescriptorClient*>(
+ 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<FakeBluetoothGattDescriptorClient*>(
+ 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_));