| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 9 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 10 #include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provi
der.h" | 10 #include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provi
der.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(); |
| 47 | 47 |
| 48 FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = | 48 FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = |
| 49 static_cast<FakeBluetoothGattManagerClient*>( | 49 static_cast<FakeBluetoothGattManagerClient*>( |
| 50 bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); | 50 bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); |
| 51 fake_bluetooth_gatt_manager_client->UnregisterDescriptorServiceProvider(this); | 51 fake_bluetooth_gatt_manager_client->UnregisterDescriptorServiceProvider(this); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void FakeBluetoothGattDescriptorServiceProvider::SendValueChanged( | 54 void FakeBluetoothGattDescriptorServiceProvider::SendValueChanged( |
| 55 const std::vector<uint8>& value) { | 55 const std::vector<uint8_t>& value) { |
| 56 VLOG(1) << "Sent descriptor value changed: " << object_path_.value() | 56 VLOG(1) << "Sent descriptor value changed: " << object_path_.value() |
| 57 << " UUID: " << uuid_; | 57 << " UUID: " << uuid_; |
| 58 } | 58 } |
| 59 | 59 |
| 60 void FakeBluetoothGattDescriptorServiceProvider::GetValue( | 60 void FakeBluetoothGattDescriptorServiceProvider::GetValue( |
| 61 const Delegate::ValueCallback& callback, | 61 const Delegate::ValueCallback& callback, |
| 62 const Delegate::ErrorCallback& error_callback) { | 62 const Delegate::ErrorCallback& error_callback) { |
| 63 VLOG(1) << "GATT descriptor value Get request: " << object_path_.value() | 63 VLOG(1) << "GATT descriptor value Get request: " << object_path_.value() |
| 64 << " UUID: " << uuid_; | 64 << " UUID: " << uuid_; |
| 65 | 65 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 81 error_callback.Run(); | 81 error_callback.Run(); |
| 82 return; | 82 return; |
| 83 } | 83 } |
| 84 | 84 |
| 85 // Pass on to the delegate. | 85 // Pass on to the delegate. |
| 86 DCHECK(delegate_); | 86 DCHECK(delegate_); |
| 87 delegate_->GetDescriptorValue(callback, error_callback); | 87 delegate_->GetDescriptorValue(callback, error_callback); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void FakeBluetoothGattDescriptorServiceProvider::SetValue( | 90 void FakeBluetoothGattDescriptorServiceProvider::SetValue( |
| 91 const std::vector<uint8>& value, | 91 const std::vector<uint8_t>& value, |
| 92 const base::Closure& callback, | 92 const base::Closure& callback, |
| 93 const Delegate::ErrorCallback& error_callback) { | 93 const Delegate::ErrorCallback& error_callback) { |
| 94 VLOG(1) << "GATT descriptor value Set request: " << object_path_.value() | 94 VLOG(1) << "GATT descriptor value Set request: " << object_path_.value() |
| 95 << " UUID: " << uuid_; | 95 << " UUID: " << uuid_; |
| 96 | 96 |
| 97 // Check if this descriptor is registered. | 97 // Check if this descriptor is registered. |
| 98 FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = | 98 FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = |
| 99 static_cast<FakeBluetoothGattManagerClient*>( | 99 static_cast<FakeBluetoothGattManagerClient*>( |
| 100 bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); | 100 bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); |
| 101 FakeBluetoothGattCharacteristicServiceProvider* characteristic = | 101 FakeBluetoothGattCharacteristicServiceProvider* characteristic = |
| (...skipping 10 matching lines...) Expand all Loading... |
| 112 error_callback.Run(); | 112 error_callback.Run(); |
| 113 return; | 113 return; |
| 114 } | 114 } |
| 115 | 115 |
| 116 // Pass on to the delegate. | 116 // Pass on to the delegate. |
| 117 DCHECK(delegate_); | 117 DCHECK(delegate_); |
| 118 delegate_->SetDescriptorValue(value, callback, error_callback); | 118 delegate_->SetDescriptorValue(value, callback, error_callback); |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace bluez | 121 } // namespace bluez |
| OLD | NEW |