| 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_descriptor_service_provider.
h" | 5 #include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.
h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 10 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 11 #include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provi
der.h" | 11 #include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provi
der.h" |
| 12 #include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h" | 12 #include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h" |
| 13 | 13 |
| 14 namespace bluez { | 14 namespace bluez { |
| 15 | 15 |
| 16 FakeBluetoothGattDescriptorServiceProvider:: | 16 FakeBluetoothGattDescriptorServiceProvider:: |
| 17 FakeBluetoothGattDescriptorServiceProvider( | 17 FakeBluetoothGattDescriptorServiceProvider( |
| 18 const dbus::ObjectPath& object_path, | 18 const dbus::ObjectPath& object_path, |
| 19 std::unique_ptr<BluetoothGattAttributeValueDelegate> delegate, | 19 std::unique_ptr<BluetoothGattAttributeValueDelegate> delegate, |
| 20 const std::string& uuid, | 20 const std::string& uuid, |
| 21 const std::vector<std::string>& permissions, | 21 const std::vector<std::string>& flags, |
| 22 const dbus::ObjectPath& characteristic_path) | 22 const dbus::ObjectPath& characteristic_path) |
| 23 : object_path_(object_path), | 23 : object_path_(object_path), |
| 24 uuid_(uuid), | 24 uuid_(uuid), |
| 25 characteristic_path_(characteristic_path), | 25 characteristic_path_(characteristic_path), |
| 26 delegate_(std::move(delegate)) { | 26 delegate_(std::move(delegate)) { |
| 27 VLOG(1) << "Creating Bluetooth GATT descriptor: " << object_path_.value(); | 27 VLOG(1) << "Creating Bluetooth GATT descriptor: " << object_path_.value(); |
| 28 | 28 |
| 29 DCHECK(object_path_.IsValid()); | 29 DCHECK(object_path_.IsValid()); |
| 30 DCHECK(characteristic_path_.IsValid()); | 30 DCHECK(characteristic_path_.IsValid()); |
| 31 DCHECK(!uuid.empty()); | 31 DCHECK(!uuid.empty()); |
| 32 DCHECK(delegate_); | 32 DCHECK(delegate_); |
| 33 DCHECK(base::StartsWith(object_path_.value(), | 33 DCHECK(base::StartsWith(object_path_.value(), |
| 34 characteristic_path_.value() + "/", | 34 characteristic_path_.value() + "/", |
| 35 base::CompareCase::SENSITIVE)); | 35 base::CompareCase::SENSITIVE)); |
| 36 // TODO(armansito): Do something with |permissions|. | 36 // TODO(rkc): Do something with |flags|. |
| 37 | 37 |
| 38 FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = | 38 FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = |
| 39 static_cast<FakeBluetoothGattManagerClient*>( | 39 static_cast<FakeBluetoothGattManagerClient*>( |
| 40 bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); | 40 bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); |
| 41 fake_bluetooth_gatt_manager_client->RegisterDescriptorServiceProvider(this); | 41 fake_bluetooth_gatt_manager_client->RegisterDescriptorServiceProvider(this); |
| 42 } | 42 } |
| 43 | 43 |
| 44 FakeBluetoothGattDescriptorServiceProvider:: | 44 FakeBluetoothGattDescriptorServiceProvider:: |
| 45 ~FakeBluetoothGattDescriptorServiceProvider() { | 45 ~FakeBluetoothGattDescriptorServiceProvider() { |
| 46 VLOG(1) << "Cleaning up Bluetooth GATT descriptor: " << object_path_.value(); | 46 VLOG(1) << "Cleaning up Bluetooth GATT descriptor: " << object_path_.value(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 DCHECK(delegate_); | 118 DCHECK(delegate_); |
| 119 delegate_->SetValue(value, callback, error_callback); | 119 delegate_->SetValue(value, callback, error_callback); |
| 120 } | 120 } |
| 121 | 121 |
| 122 const dbus::ObjectPath& | 122 const dbus::ObjectPath& |
| 123 FakeBluetoothGattDescriptorServiceProvider::object_path() const { | 123 FakeBluetoothGattDescriptorServiceProvider::object_path() const { |
| 124 return object_path_; | 124 return object_path_; |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // namespace bluez | 127 } // namespace bluez |
| OLD | NEW |