OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h" | 5 #include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // Expose CCC descriptor for Heart Rate Measurement characteristic. | 287 // Expose CCC descriptor for Heart Rate Measurement characteristic. |
288 FakeBluetoothGattDescriptorClient* descriptor_client = | 288 FakeBluetoothGattDescriptorClient* descriptor_client = |
289 static_cast<FakeBluetoothGattDescriptorClient*>( | 289 static_cast<FakeBluetoothGattDescriptorClient*>( |
290 DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()); | 290 DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()); |
291 dbus::ObjectPath ccc_path(descriptor_client->ExposeDescriptor( | 291 dbus::ObjectPath ccc_path(descriptor_client->ExposeDescriptor( |
292 dbus::ObjectPath(heart_rate_measurement_path_), | 292 dbus::ObjectPath(heart_rate_measurement_path_), |
293 FakeBluetoothGattDescriptorClient:: | 293 FakeBluetoothGattDescriptorClient:: |
294 kClientCharacteristicConfigurationUUID)); | 294 kClientCharacteristicConfigurationUUID)); |
295 DCHECK(ccc_path.IsValid()); | 295 DCHECK(ccc_path.IsValid()); |
296 heart_rate_measurement_ccc_desc_path_ = ccc_path.value(); | 296 heart_rate_measurement_ccc_desc_path_ = ccc_path.value(); |
| 297 |
| 298 std::vector<dbus::ObjectPath> desc_paths; |
| 299 desc_paths.push_back(ccc_path); |
| 300 |
| 301 heart_rate_measurement_properties_->descriptors.ReplaceValue(desc_paths); |
297 } | 302 } |
298 | 303 |
299 void FakeBluetoothGattCharacteristicClient::HideHeartRateCharacteristics() { | 304 void FakeBluetoothGattCharacteristicClient::HideHeartRateCharacteristics() { |
300 VLOG(2) << "Hiding fake Heart Rate characteristics."; | 305 VLOG(2) << "Hiding fake Heart Rate characteristics."; |
301 | 306 |
302 // Hide the descriptors. | 307 // Hide the descriptors. |
303 FakeBluetoothGattDescriptorClient* descriptor_client = | 308 FakeBluetoothGattDescriptorClient* descriptor_client = |
304 static_cast<FakeBluetoothGattDescriptorClient*>( | 309 static_cast<FakeBluetoothGattDescriptorClient*>( |
305 DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()); | 310 DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()); |
306 descriptor_client->HideDescriptor( | 311 descriptor_client->HideDescriptor( |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 DCHECK(heart_rate_visible_ != heart_rate_measurement_path_.empty()); | 440 DCHECK(heart_rate_visible_ != heart_rate_measurement_path_.empty()); |
436 DCHECK(heart_rate_visible_ != body_sensor_location_path_.empty()); | 441 DCHECK(heart_rate_visible_ != body_sensor_location_path_.empty()); |
437 DCHECK(heart_rate_visible_ != heart_rate_control_point_path_.empty()); | 442 DCHECK(heart_rate_visible_ != heart_rate_control_point_path_.empty()); |
438 DCHECK(heart_rate_visible_ == !!heart_rate_measurement_properties_.get()); | 443 DCHECK(heart_rate_visible_ == !!heart_rate_measurement_properties_.get()); |
439 DCHECK(heart_rate_visible_ == !!body_sensor_location_properties_.get()); | 444 DCHECK(heart_rate_visible_ == !!body_sensor_location_properties_.get()); |
440 DCHECK(heart_rate_visible_ == !!heart_rate_control_point_properties_.get()); | 445 DCHECK(heart_rate_visible_ == !!heart_rate_control_point_properties_.get()); |
441 return heart_rate_visible_; | 446 return heart_rate_visible_; |
442 } | 447 } |
443 | 448 |
444 } // namespace chromeos | 449 } // namespace chromeos |
OLD | NEW |