| 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 "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h" | 5 #include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 // Expose CCC descriptor for Heart Rate Measurement characteristic. | 380 // Expose CCC descriptor for Heart Rate Measurement characteristic. |
| 381 FakeBluetoothGattDescriptorClient* descriptor_client = | 381 FakeBluetoothGattDescriptorClient* descriptor_client = |
| 382 static_cast<FakeBluetoothGattDescriptorClient*>( | 382 static_cast<FakeBluetoothGattDescriptorClient*>( |
| 383 bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient()); | 383 bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient()); |
| 384 dbus::ObjectPath ccc_path(descriptor_client->ExposeDescriptor( | 384 dbus::ObjectPath ccc_path(descriptor_client->ExposeDescriptor( |
| 385 dbus::ObjectPath(heart_rate_measurement_path_), | 385 dbus::ObjectPath(heart_rate_measurement_path_), |
| 386 FakeBluetoothGattDescriptorClient:: | 386 FakeBluetoothGattDescriptorClient:: |
| 387 kClientCharacteristicConfigurationUUID)); | 387 kClientCharacteristicConfigurationUUID)); |
| 388 DCHECK(ccc_path.IsValid()); | 388 DCHECK(ccc_path.IsValid()); |
| 389 heart_rate_measurement_ccc_desc_path_ = ccc_path.value(); | 389 heart_rate_measurement_ccc_desc_path_ = ccc_path.value(); |
| 390 | |
| 391 std::vector<dbus::ObjectPath> desc_paths; | |
| 392 desc_paths.push_back(ccc_path); | |
| 393 | |
| 394 heart_rate_measurement_properties_->descriptors.ReplaceValue(desc_paths); | |
| 395 } | 390 } |
| 396 | 391 |
| 397 void FakeBluetoothGattCharacteristicClient::HideHeartRateCharacteristics() { | 392 void FakeBluetoothGattCharacteristicClient::HideHeartRateCharacteristics() { |
| 398 VLOG(2) << "Hiding fake Heart Rate characteristics."; | 393 VLOG(2) << "Hiding fake Heart Rate characteristics."; |
| 399 | 394 |
| 400 // Hide the descriptors. | 395 // Hide the descriptors. |
| 401 FakeBluetoothGattDescriptorClient* descriptor_client = | 396 FakeBluetoothGattDescriptorClient* descriptor_client = |
| 402 static_cast<FakeBluetoothGattDescriptorClient*>( | 397 static_cast<FakeBluetoothGattDescriptorClient*>( |
| 403 bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient()); | 398 bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient()); |
| 404 descriptor_client->HideDescriptor( | 399 descriptor_client->HideDescriptor( |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 DCHECK(heart_rate_visible_ != heart_rate_measurement_path_.empty()); | 551 DCHECK(heart_rate_visible_ != heart_rate_measurement_path_.empty()); |
| 557 DCHECK(heart_rate_visible_ != body_sensor_location_path_.empty()); | 552 DCHECK(heart_rate_visible_ != body_sensor_location_path_.empty()); |
| 558 DCHECK(heart_rate_visible_ != heart_rate_control_point_path_.empty()); | 553 DCHECK(heart_rate_visible_ != heart_rate_control_point_path_.empty()); |
| 559 DCHECK(heart_rate_visible_ == !!heart_rate_measurement_properties_.get()); | 554 DCHECK(heart_rate_visible_ == !!heart_rate_measurement_properties_.get()); |
| 560 DCHECK(heart_rate_visible_ == !!body_sensor_location_properties_.get()); | 555 DCHECK(heart_rate_visible_ == !!body_sensor_location_properties_.get()); |
| 561 DCHECK(heart_rate_visible_ == !!heart_rate_control_point_properties_.get()); | 556 DCHECK(heart_rate_visible_ == !!heart_rate_control_point_properties_.get()); |
| 562 return heart_rate_visible_; | 557 return heart_rate_visible_; |
| 563 } | 558 } |
| 564 | 559 |
| 565 } // namespace bluez | 560 } // namespace bluez |
| OLD | NEW |