| 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 FakeBluetoothGattCharacteristicClient::GetHeartRateControlPointPath() const { | 447 FakeBluetoothGattCharacteristicClient::GetHeartRateControlPointPath() const { |
| 448 return dbus::ObjectPath(heart_rate_control_point_path_); | 448 return dbus::ObjectPath(heart_rate_control_point_path_); |
| 449 } | 449 } |
| 450 | 450 |
| 451 void FakeBluetoothGattCharacteristicClient::OnPropertyChanged( | 451 void FakeBluetoothGattCharacteristicClient::OnPropertyChanged( |
| 452 const dbus::ObjectPath& object_path, | 452 const dbus::ObjectPath& object_path, |
| 453 const std::string& property_name) { | 453 const std::string& property_name) { |
| 454 VLOG(2) << "Characteristic property changed: " << object_path.value() << ": " | 454 VLOG(2) << "Characteristic property changed: " << object_path.value() << ": " |
| 455 << property_name; | 455 << property_name; |
| 456 | 456 |
| 457 FOR_EACH_OBSERVER( | 457 for (auto& observer : observers_) |
| 458 BluetoothGattCharacteristicClient::Observer, observers_, | 458 observer.GattCharacteristicPropertyChanged(object_path, property_name); |
| 459 GattCharacteristicPropertyChanged(object_path, property_name)); | |
| 460 } | 459 } |
| 461 | 460 |
| 462 void FakeBluetoothGattCharacteristicClient::NotifyCharacteristicAdded( | 461 void FakeBluetoothGattCharacteristicClient::NotifyCharacteristicAdded( |
| 463 const dbus::ObjectPath& object_path) { | 462 const dbus::ObjectPath& object_path) { |
| 464 VLOG(2) << "GATT characteristic added: " << object_path.value(); | 463 VLOG(2) << "GATT characteristic added: " << object_path.value(); |
| 465 FOR_EACH_OBSERVER(BluetoothGattCharacteristicClient::Observer, observers_, | 464 for (auto& observer : observers_) |
| 466 GattCharacteristicAdded(object_path)); | 465 observer.GattCharacteristicAdded(object_path); |
| 467 } | 466 } |
| 468 | 467 |
| 469 void FakeBluetoothGattCharacteristicClient::NotifyCharacteristicRemoved( | 468 void FakeBluetoothGattCharacteristicClient::NotifyCharacteristicRemoved( |
| 470 const dbus::ObjectPath& object_path) { | 469 const dbus::ObjectPath& object_path) { |
| 471 VLOG(2) << "GATT characteristic removed: " << object_path.value(); | 470 VLOG(2) << "GATT characteristic removed: " << object_path.value(); |
| 472 FOR_EACH_OBSERVER(BluetoothGattCharacteristicClient::Observer, observers_, | 471 for (auto& observer : observers_) |
| 473 GattCharacteristicRemoved(object_path)); | 472 observer.GattCharacteristicRemoved(object_path); |
| 474 } | 473 } |
| 475 | 474 |
| 476 void FakeBluetoothGattCharacteristicClient:: | 475 void FakeBluetoothGattCharacteristicClient:: |
| 477 ScheduleHeartRateMeasurementValueChange() { | 476 ScheduleHeartRateMeasurementValueChange() { |
| 478 if (!IsHeartRateVisible()) | 477 if (!IsHeartRateVisible()) |
| 479 return; | 478 return; |
| 480 | 479 |
| 481 // Don't send updates if the characteristic is not notifying. | 480 // Don't send updates if the characteristic is not notifying. |
| 482 if (!heart_rate_measurement_properties_->notifying.value()) | 481 if (!heart_rate_measurement_properties_->notifying.value()) |
| 483 return; | 482 return; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 DCHECK(heart_rate_visible_ != heart_rate_measurement_path_.empty()); | 550 DCHECK(heart_rate_visible_ != heart_rate_measurement_path_.empty()); |
| 552 DCHECK(heart_rate_visible_ != body_sensor_location_path_.empty()); | 551 DCHECK(heart_rate_visible_ != body_sensor_location_path_.empty()); |
| 553 DCHECK(heart_rate_visible_ != heart_rate_control_point_path_.empty()); | 552 DCHECK(heart_rate_visible_ != heart_rate_control_point_path_.empty()); |
| 554 DCHECK(heart_rate_visible_ == !!heart_rate_measurement_properties_.get()); | 553 DCHECK(heart_rate_visible_ == !!heart_rate_measurement_properties_.get()); |
| 555 DCHECK(heart_rate_visible_ == !!body_sensor_location_properties_.get()); | 554 DCHECK(heart_rate_visible_ == !!body_sensor_location_properties_.get()); |
| 556 DCHECK(heart_rate_visible_ == !!heart_rate_control_point_properties_.get()); | 555 DCHECK(heart_rate_visible_ == !!heart_rate_control_point_properties_.get()); |
| 557 return heart_rate_visible_; | 556 return heart_rate_visible_; |
| 558 } | 557 } |
| 559 | 558 |
| 560 } // namespace bluez | 559 } // namespace bluez |
| OLD | NEW |