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_descriptor_client.h" | 5 #include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chromeos/dbus/bluetooth_gatt_characteristic_client.h" | 9 #include "chromeos/dbus/bluetooth_gatt_characteristic_client.h" |
10 #include "chromeos/dbus/dbus_thread_manager.h" | 10 #include "chromeos/dbus/dbus_thread_manager.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 const std::vector<uint8>& value, | 129 const std::vector<uint8>& value, |
130 const base::Closure& callback, | 130 const base::Closure& callback, |
131 const ErrorCallback& error_callback) { | 131 const ErrorCallback& error_callback) { |
132 if (properties_.find(object_path) == properties_.end()) { | 132 if (properties_.find(object_path) == properties_.end()) { |
133 error_callback.Run(kUnknownDescriptorError, ""); | 133 error_callback.Run(kUnknownDescriptorError, ""); |
134 return; | 134 return; |
135 } | 135 } |
136 | 136 |
137 // Since the only fake descriptor is "Client Characteristic Configuration" | 137 // Since the only fake descriptor is "Client Characteristic Configuration" |
138 // and BlueZ doesn't allow writing to it, return failure. | 138 // and BlueZ doesn't allow writing to it, return failure. |
139 error_callback.Run("org.bluez.Error.WriteNotPermitted", | 139 error_callback.Run("org.bluez.Error.NotPermitted", |
140 "Writing to the Client Characteristic Configuration " | 140 "Writing to the Client Characteristic Configuration " |
141 "descriptor not allowed"); | 141 "descriptor not allowed"); |
142 } | 142 } |
143 | 143 |
144 dbus::ObjectPath FakeBluetoothGattDescriptorClient::ExposeDescriptor( | 144 dbus::ObjectPath FakeBluetoothGattDescriptorClient::ExposeDescriptor( |
145 const dbus::ObjectPath& characteristic_path, | 145 const dbus::ObjectPath& characteristic_path, |
146 const std::string& uuid) { | 146 const std::string& uuid) { |
147 if (uuid != kClientCharacteristicConfigurationUUID) { | 147 if (uuid != kClientCharacteristicConfigurationUUID) { |
148 VLOG(2) << "Unsupported UUID: " << uuid; | 148 VLOG(2) << "Unsupported UUID: " << uuid; |
149 return dbus::ObjectPath(); | 149 return dbus::ObjectPath(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 GattDescriptorAdded(object_path)); | 208 GattDescriptorAdded(object_path)); |
209 } | 209 } |
210 | 210 |
211 void FakeBluetoothGattDescriptorClient::NotifyDescriptorRemoved( | 211 void FakeBluetoothGattDescriptorClient::NotifyDescriptorRemoved( |
212 const dbus::ObjectPath& object_path) { | 212 const dbus::ObjectPath& object_path) { |
213 FOR_EACH_OBSERVER(BluetoothGattDescriptorClient::Observer, observers_, | 213 FOR_EACH_OBSERVER(BluetoothGattDescriptorClient::Observer, observers_, |
214 GattDescriptorRemoved(object_path)); | 214 GattDescriptorRemoved(object_path)); |
215 } | 215 } |
216 | 216 |
217 } // namespace chromeos | 217 } // namespace chromeos |
OLD | NEW |