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/bluetooth_remote_gatt_characteristic_chromeos.h" | 5 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "chromeos/dbus/dbus_thread_manager.h" | |
12 #include "device/bluetooth/bluetooth_adapter_chromeos.h" | 11 #include "device/bluetooth/bluetooth_adapter_chromeos.h" |
13 #include "device/bluetooth/bluetooth_device.h" | 12 #include "device/bluetooth/bluetooth_device.h" |
14 #include "device/bluetooth/bluetooth_gatt_notify_session_chromeos.h" | 13 #include "device/bluetooth/bluetooth_gatt_notify_session_chromeos.h" |
15 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h" | 14 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h" |
16 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h" | 15 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h" |
17 #include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h" | 16 #include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h" |
| 17 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
18 #include "third_party/cros_system_api/dbus/service_constants.h" | 18 #include "third_party/cros_system_api/dbus/service_constants.h" |
19 | 19 |
20 namespace chromeos { | 20 namespace chromeos { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 // Stream operator for logging vector<uint8>. | 24 // Stream operator for logging vector<uint8>. |
25 std::ostream& operator<<(std::ostream& out, const std::vector<uint8> bytes) { | 25 std::ostream& operator<<(std::ostream& out, const std::vector<uint8> bytes) { |
26 out << "["; | 26 out << "["; |
27 for (std::vector<uint8>::const_iterator iter = bytes.begin(); | 27 for (std::vector<uint8>::const_iterator iter = bytes.begin(); |
28 iter != bytes.end(); ++iter) { | 28 iter != bytes.end(); ++iter) { |
29 out << base::StringPrintf("%02X", *iter); | 29 out << base::StringPrintf("%02X", *iter); |
30 } | 30 } |
31 return out << "]"; | 31 return out << "]"; |
32 } | 32 } |
33 | 33 |
34 } // namespace | 34 } // namespace |
35 | 35 |
36 BluetoothRemoteGattCharacteristicChromeOS:: | 36 BluetoothRemoteGattCharacteristicChromeOS:: |
37 BluetoothRemoteGattCharacteristicChromeOS( | 37 BluetoothRemoteGattCharacteristicChromeOS( |
38 BluetoothRemoteGattServiceChromeOS* service, | 38 BluetoothRemoteGattServiceChromeOS* service, |
39 const dbus::ObjectPath& object_path) | 39 const dbus::ObjectPath& object_path) |
40 : object_path_(object_path), | 40 : object_path_(object_path), |
41 service_(service), | 41 service_(service), |
42 num_notify_sessions_(0), | 42 num_notify_sessions_(0), |
43 notify_call_pending_(false), | 43 notify_call_pending_(false), |
44 weak_ptr_factory_(this) { | 44 weak_ptr_factory_(this) { |
45 VLOG(1) << "Creating remote GATT characteristic with identifier: " | 45 VLOG(1) << "Creating remote GATT characteristic with identifier: " |
46 << GetIdentifier() << ", UUID: " << GetUUID().canonical_value(); | 46 << GetIdentifier() << ", UUID: " << GetUUID().canonical_value(); |
47 DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()-> | 47 bluez::BluezDBusManager::Get() |
48 AddObserver(this); | 48 ->GetBluetoothGattDescriptorClient() |
| 49 ->AddObserver(this); |
49 | 50 |
50 // Add all known GATT characteristic descriptors. | 51 // Add all known GATT characteristic descriptors. |
51 const std::vector<dbus::ObjectPath>& gatt_descs = | 52 const std::vector<dbus::ObjectPath>& gatt_descs = |
52 DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()-> | 53 bluez::BluezDBusManager::Get() |
53 GetDescriptors(); | 54 ->GetBluetoothGattDescriptorClient() |
| 55 ->GetDescriptors(); |
54 for (std::vector<dbus::ObjectPath>::const_iterator iter = gatt_descs.begin(); | 56 for (std::vector<dbus::ObjectPath>::const_iterator iter = gatt_descs.begin(); |
55 iter != gatt_descs.end(); ++iter) | 57 iter != gatt_descs.end(); ++iter) |
56 GattDescriptorAdded(*iter); | 58 GattDescriptorAdded(*iter); |
57 } | 59 } |
58 | 60 |
59 BluetoothRemoteGattCharacteristicChromeOS:: | 61 BluetoothRemoteGattCharacteristicChromeOS:: |
60 ~BluetoothRemoteGattCharacteristicChromeOS() { | 62 ~BluetoothRemoteGattCharacteristicChromeOS() { |
61 DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()-> | 63 bluez::BluezDBusManager::Get() |
62 RemoveObserver(this); | 64 ->GetBluetoothGattDescriptorClient() |
| 65 ->RemoveObserver(this); |
63 | 66 |
64 // Clean up all the descriptors. There isn't much point in notifying service | 67 // Clean up all the descriptors. There isn't much point in notifying service |
65 // observers for each descriptor that gets removed, so just delete them. | 68 // observers for each descriptor that gets removed, so just delete them. |
66 for (DescriptorMap::iterator iter = descriptors_.begin(); | 69 for (DescriptorMap::iterator iter = descriptors_.begin(); |
67 iter != descriptors_.end(); ++iter) | 70 iter != descriptors_.end(); ++iter) |
68 delete iter->second; | 71 delete iter->second; |
69 | 72 |
70 // Report an error for all pending calls to StartNotifySession. | 73 // Report an error for all pending calls to StartNotifySession. |
71 while (!pending_start_notify_calls_.empty()) { | 74 while (!pending_start_notify_calls_.empty()) { |
72 PendingStartNotifyCall callbacks = pending_start_notify_calls_.front(); | 75 PendingStartNotifyCall callbacks = pending_start_notify_calls_.front(); |
73 pending_start_notify_calls_.pop(); | 76 pending_start_notify_calls_.pop(); |
74 callbacks.second.Run(device::BluetoothGattService::GATT_ERROR_FAILED); | 77 callbacks.second.Run(device::BluetoothGattService::GATT_ERROR_FAILED); |
75 } | 78 } |
76 } | 79 } |
77 | 80 |
78 std::string BluetoothRemoteGattCharacteristicChromeOS::GetIdentifier() const { | 81 std::string BluetoothRemoteGattCharacteristicChromeOS::GetIdentifier() const { |
79 return object_path_.value(); | 82 return object_path_.value(); |
80 } | 83 } |
81 | 84 |
82 device::BluetoothUUID | 85 device::BluetoothUUID |
83 BluetoothRemoteGattCharacteristicChromeOS::GetUUID() const { | 86 BluetoothRemoteGattCharacteristicChromeOS::GetUUID() const { |
84 BluetoothGattCharacteristicClient::Properties* properties = | 87 bluez::BluetoothGattCharacteristicClient::Properties* properties = |
85 DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()-> | 88 bluez::BluezDBusManager::Get() |
86 GetProperties(object_path_); | 89 ->GetBluetoothGattCharacteristicClient() |
| 90 ->GetProperties(object_path_); |
87 DCHECK(properties); | 91 DCHECK(properties); |
88 return device::BluetoothUUID(properties->uuid.value()); | 92 return device::BluetoothUUID(properties->uuid.value()); |
89 } | 93 } |
90 | 94 |
91 bool BluetoothRemoteGattCharacteristicChromeOS::IsLocal() const { | 95 bool BluetoothRemoteGattCharacteristicChromeOS::IsLocal() const { |
92 return false; | 96 return false; |
93 } | 97 } |
94 | 98 |
95 const std::vector<uint8>& | 99 const std::vector<uint8>& |
96 BluetoothRemoteGattCharacteristicChromeOS::GetValue() const { | 100 BluetoothRemoteGattCharacteristicChromeOS::GetValue() const { |
97 BluetoothGattCharacteristicClient::Properties* properties = | 101 bluez::BluetoothGattCharacteristicClient::Properties* properties = |
98 DBusThreadManager::Get() | 102 bluez::BluezDBusManager::Get() |
99 ->GetBluetoothGattCharacteristicClient() | 103 ->GetBluetoothGattCharacteristicClient() |
100 ->GetProperties(object_path_); | 104 ->GetProperties(object_path_); |
101 | 105 |
102 DCHECK(properties); | 106 DCHECK(properties); |
103 | 107 |
104 return properties->value.value(); | 108 return properties->value.value(); |
105 } | 109 } |
106 | 110 |
107 device::BluetoothGattService* | 111 device::BluetoothGattService* |
108 BluetoothRemoteGattCharacteristicChromeOS::GetService() const { | 112 BluetoothRemoteGattCharacteristicChromeOS::GetService() const { |
109 return service_; | 113 return service_; |
110 } | 114 } |
111 | 115 |
112 device::BluetoothGattCharacteristic::Properties | 116 device::BluetoothGattCharacteristic::Properties |
113 BluetoothRemoteGattCharacteristicChromeOS::GetProperties() const { | 117 BluetoothRemoteGattCharacteristicChromeOS::GetProperties() const { |
114 BluetoothGattCharacteristicClient::Properties* properties = | 118 bluez::BluetoothGattCharacteristicClient::Properties* properties = |
115 DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()-> | 119 bluez::BluezDBusManager::Get() |
116 GetProperties(object_path_); | 120 ->GetBluetoothGattCharacteristicClient() |
| 121 ->GetProperties(object_path_); |
117 DCHECK(properties); | 122 DCHECK(properties); |
118 | 123 |
119 Properties props = PROPERTY_NONE; | 124 Properties props = PROPERTY_NONE; |
120 const std::vector<std::string>& flags = properties->flags.value(); | 125 const std::vector<std::string>& flags = properties->flags.value(); |
121 for (std::vector<std::string>::const_iterator iter = flags.begin(); | 126 for (std::vector<std::string>::const_iterator iter = flags.begin(); |
122 iter != flags.end(); | 127 iter != flags.end(); |
123 ++iter) { | 128 ++iter) { |
124 if (*iter == bluetooth_gatt_characteristic::kFlagBroadcast) | 129 if (*iter == bluetooth_gatt_characteristic::kFlagBroadcast) |
125 props |= PROPERTY_BROADCAST; | 130 props |= PROPERTY_BROADCAST; |
126 if (*iter == bluetooth_gatt_characteristic::kFlagRead) | 131 if (*iter == bluetooth_gatt_characteristic::kFlagRead) |
(...skipping 20 matching lines...) Expand all Loading... |
147 } | 152 } |
148 | 153 |
149 device::BluetoothGattCharacteristic::Permissions | 154 device::BluetoothGattCharacteristic::Permissions |
150 BluetoothRemoteGattCharacteristicChromeOS::GetPermissions() const { | 155 BluetoothRemoteGattCharacteristicChromeOS::GetPermissions() const { |
151 // TODO(armansito): Once BlueZ defines the permissions, return the correct | 156 // TODO(armansito): Once BlueZ defines the permissions, return the correct |
152 // values here. | 157 // values here. |
153 return PERMISSION_NONE; | 158 return PERMISSION_NONE; |
154 } | 159 } |
155 | 160 |
156 bool BluetoothRemoteGattCharacteristicChromeOS::IsNotifying() const { | 161 bool BluetoothRemoteGattCharacteristicChromeOS::IsNotifying() const { |
157 BluetoothGattCharacteristicClient::Properties* properties = | 162 bluez::BluetoothGattCharacteristicClient::Properties* properties = |
158 DBusThreadManager::Get() | 163 bluez::BluezDBusManager::Get() |
159 ->GetBluetoothGattCharacteristicClient() | 164 ->GetBluetoothGattCharacteristicClient() |
160 ->GetProperties(object_path_); | 165 ->GetProperties(object_path_); |
161 DCHECK(properties); | 166 DCHECK(properties); |
162 | 167 |
163 return properties->notifying.value(); | 168 return properties->notifying.value(); |
164 } | 169 } |
165 | 170 |
166 std::vector<device::BluetoothGattDescriptor*> | 171 std::vector<device::BluetoothGattDescriptor*> |
167 BluetoothRemoteGattCharacteristicChromeOS::GetDescriptors() const { | 172 BluetoothRemoteGattCharacteristicChromeOS::GetDescriptors() const { |
168 std::vector<device::BluetoothGattDescriptor*> descriptors; | 173 std::vector<device::BluetoothGattDescriptor*> descriptors; |
(...skipping 25 matching lines...) Expand all Loading... |
194 return false; | 199 return false; |
195 } | 200 } |
196 | 201 |
197 void BluetoothRemoteGattCharacteristicChromeOS::ReadRemoteCharacteristic( | 202 void BluetoothRemoteGattCharacteristicChromeOS::ReadRemoteCharacteristic( |
198 const ValueCallback& callback, | 203 const ValueCallback& callback, |
199 const ErrorCallback& error_callback) { | 204 const ErrorCallback& error_callback) { |
200 VLOG(1) << "Sending GATT characteristic read request to characteristic: " | 205 VLOG(1) << "Sending GATT characteristic read request to characteristic: " |
201 << GetIdentifier() << ", UUID: " << GetUUID().canonical_value() | 206 << GetIdentifier() << ", UUID: " << GetUUID().canonical_value() |
202 << "."; | 207 << "."; |
203 | 208 |
204 DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->ReadValue( | 209 bluez::BluezDBusManager::Get() |
205 object_path_, callback, | 210 ->GetBluetoothGattCharacteristicClient() |
206 base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError, | 211 ->ReadValue( |
207 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 212 object_path_, callback, |
| 213 base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError, |
| 214 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
208 } | 215 } |
209 | 216 |
210 void BluetoothRemoteGattCharacteristicChromeOS::WriteRemoteCharacteristic( | 217 void BluetoothRemoteGattCharacteristicChromeOS::WriteRemoteCharacteristic( |
211 const std::vector<uint8>& new_value, | 218 const std::vector<uint8>& new_value, |
212 const base::Closure& callback, | 219 const base::Closure& callback, |
213 const ErrorCallback& error_callback) { | 220 const ErrorCallback& error_callback) { |
214 VLOG(1) << "Sending GATT characteristic write request to characteristic: " | 221 VLOG(1) << "Sending GATT characteristic write request to characteristic: " |
215 << GetIdentifier() << ", UUID: " << GetUUID().canonical_value() | 222 << GetIdentifier() << ", UUID: " << GetUUID().canonical_value() |
216 << ", with value: " << new_value << "."; | 223 << ", with value: " << new_value << "."; |
217 | 224 |
218 DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->WriteValue( | 225 bluez::BluezDBusManager::Get() |
219 object_path_, | 226 ->GetBluetoothGattCharacteristicClient() |
220 new_value, | 227 ->WriteValue( |
221 callback, | 228 object_path_, new_value, callback, |
222 base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError, | 229 base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError, |
223 weak_ptr_factory_.GetWeakPtr(), | 230 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
224 error_callback)); | |
225 } | 231 } |
226 | 232 |
227 void BluetoothRemoteGattCharacteristicChromeOS::StartNotifySession( | 233 void BluetoothRemoteGattCharacteristicChromeOS::StartNotifySession( |
228 const NotifySessionCallback& callback, | 234 const NotifySessionCallback& callback, |
229 const ErrorCallback& error_callback) { | 235 const ErrorCallback& error_callback) { |
230 VLOG(1) << __func__; | 236 VLOG(1) << __func__; |
231 | 237 |
232 if (num_notify_sessions_ > 0) { | 238 if (num_notify_sessions_ > 0) { |
233 // The characteristic might have stopped notifying even though the session | 239 // The characteristic might have stopped notifying even though the session |
234 // count is nonzero. This means that notifications stopped outside of our | 240 // count is nonzero. This means that notifications stopped outside of our |
(...skipping 25 matching lines...) Expand all Loading... |
260 num_notify_sessions_ = 0; | 266 num_notify_sessions_ = 0; |
261 } | 267 } |
262 | 268 |
263 // Queue the callbacks if there is a pending call to bluetoothd. | 269 // Queue the callbacks if there is a pending call to bluetoothd. |
264 if (notify_call_pending_) { | 270 if (notify_call_pending_) { |
265 pending_start_notify_calls_.push(std::make_pair(callback, error_callback)); | 271 pending_start_notify_calls_.push(std::make_pair(callback, error_callback)); |
266 return; | 272 return; |
267 } | 273 } |
268 | 274 |
269 notify_call_pending_ = true; | 275 notify_call_pending_ = true; |
270 DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->StartNotify( | 276 bluez::BluezDBusManager::Get() |
271 object_path_, | 277 ->GetBluetoothGattCharacteristicClient() |
272 base::Bind( | 278 ->StartNotify( |
273 &BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifySuccess, | 279 object_path_, |
274 weak_ptr_factory_.GetWeakPtr(), | 280 base::Bind( |
275 callback), | 281 &BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifySuccess, |
276 base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifyError, | 282 weak_ptr_factory_.GetWeakPtr(), callback), |
277 weak_ptr_factory_.GetWeakPtr(), | 283 base::Bind( |
278 error_callback)); | 284 &BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifyError, |
| 285 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
279 } | 286 } |
280 | 287 |
281 void BluetoothRemoteGattCharacteristicChromeOS::RemoveNotifySession( | 288 void BluetoothRemoteGattCharacteristicChromeOS::RemoveNotifySession( |
282 const base::Closure& callback) { | 289 const base::Closure& callback) { |
283 VLOG(1) << __func__; | 290 VLOG(1) << __func__; |
284 | 291 |
285 if (num_notify_sessions_ > 1) { | 292 if (num_notify_sessions_ > 1) { |
286 DCHECK(!notify_call_pending_); | 293 DCHECK(!notify_call_pending_); |
287 --num_notify_sessions_; | 294 --num_notify_sessions_; |
288 callback.Run(); | 295 callback.Run(); |
289 return; | 296 return; |
290 } | 297 } |
291 | 298 |
292 // Notifications may have stopped outside our control. If the characteristic | 299 // Notifications may have stopped outside our control. If the characteristic |
293 // is no longer notifying, return success. | 300 // is no longer notifying, return success. |
294 if (!IsNotifying()) { | 301 if (!IsNotifying()) { |
295 num_notify_sessions_ = 0; | 302 num_notify_sessions_ = 0; |
296 callback.Run(); | 303 callback.Run(); |
297 return; | 304 return; |
298 } | 305 } |
299 | 306 |
300 if (notify_call_pending_ || num_notify_sessions_ == 0) { | 307 if (notify_call_pending_ || num_notify_sessions_ == 0) { |
301 callback.Run(); | 308 callback.Run(); |
302 return; | 309 return; |
303 } | 310 } |
304 | 311 |
305 DCHECK(num_notify_sessions_ == 1); | 312 DCHECK(num_notify_sessions_ == 1); |
306 notify_call_pending_ = true; | 313 notify_call_pending_ = true; |
307 DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->StopNotify( | 314 bluez::BluezDBusManager::Get() |
308 object_path_, | 315 ->GetBluetoothGattCharacteristicClient() |
309 base::Bind( | 316 ->StopNotify( |
310 &BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifySuccess, | 317 object_path_, |
311 weak_ptr_factory_.GetWeakPtr(), | 318 base::Bind( |
312 callback), | 319 &BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifySuccess, |
313 base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifyError, | 320 weak_ptr_factory_.GetWeakPtr(), callback), |
314 weak_ptr_factory_.GetWeakPtr(), | 321 base::Bind( |
315 callback)); | 322 &BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifyError, |
| 323 weak_ptr_factory_.GetWeakPtr(), callback)); |
316 } | 324 } |
317 | 325 |
318 void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorAdded( | 326 void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorAdded( |
319 const dbus::ObjectPath& object_path) { | 327 const dbus::ObjectPath& object_path) { |
320 if (descriptors_.find(object_path) != descriptors_.end()) { | 328 if (descriptors_.find(object_path) != descriptors_.end()) { |
321 VLOG(1) << "Remote GATT characteristic descriptor already exists: " | 329 VLOG(1) << "Remote GATT characteristic descriptor already exists: " |
322 << object_path.value(); | 330 << object_path.value(); |
323 return; | 331 return; |
324 } | 332 } |
325 | 333 |
326 BluetoothGattDescriptorClient::Properties* properties = | 334 bluez::BluetoothGattDescriptorClient::Properties* properties = |
327 DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()-> | 335 bluez::BluezDBusManager::Get() |
328 GetProperties(object_path); | 336 ->GetBluetoothGattDescriptorClient() |
| 337 ->GetProperties(object_path); |
329 DCHECK(properties); | 338 DCHECK(properties); |
330 if (properties->characteristic.value() != object_path_) { | 339 if (properties->characteristic.value() != object_path_) { |
331 VLOG(3) << "Remote GATT descriptor does not belong to this characteristic."; | 340 VLOG(3) << "Remote GATT descriptor does not belong to this characteristic."; |
332 return; | 341 return; |
333 } | 342 } |
334 | 343 |
335 VLOG(1) << "Adding new remote GATT descriptor for GATT characteristic: " | 344 VLOG(1) << "Adding new remote GATT descriptor for GATT characteristic: " |
336 << GetIdentifier() << ", UUID: " << GetUUID().canonical_value(); | 345 << GetIdentifier() << ", UUID: " << GetUUID().canonical_value(); |
337 | 346 |
338 BluetoothRemoteGattDescriptorChromeOS* descriptor = | 347 BluetoothRemoteGattDescriptorChromeOS* descriptor = |
(...skipping 29 matching lines...) Expand all Loading... |
368 | 377 |
369 void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorPropertyChanged( | 378 void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorPropertyChanged( |
370 const dbus::ObjectPath& object_path, | 379 const dbus::ObjectPath& object_path, |
371 const std::string& property_name) { | 380 const std::string& property_name) { |
372 DescriptorMap::iterator iter = descriptors_.find(object_path); | 381 DescriptorMap::iterator iter = descriptors_.find(object_path); |
373 if (iter == descriptors_.end()) { | 382 if (iter == descriptors_.end()) { |
374 VLOG(2) << "Unknown descriptor removed: " << object_path.value(); | 383 VLOG(2) << "Unknown descriptor removed: " << object_path.value(); |
375 return; | 384 return; |
376 } | 385 } |
377 | 386 |
378 BluetoothGattDescriptorClient::Properties* properties = | 387 bluez::BluetoothGattDescriptorClient::Properties* properties = |
379 DBusThreadManager::Get() | 388 bluez::BluezDBusManager::Get() |
380 ->GetBluetoothGattDescriptorClient() | 389 ->GetBluetoothGattDescriptorClient() |
381 ->GetProperties(object_path); | 390 ->GetProperties(object_path); |
382 | 391 |
383 DCHECK(properties); | 392 DCHECK(properties); |
384 | 393 |
385 if (property_name != properties->value.name()) | 394 if (property_name != properties->value.name()) |
386 return; | 395 return; |
387 | 396 |
388 DCHECK(service_); | 397 DCHECK(service_); |
389 service_->NotifyDescriptorValueChanged(this, iter->second, | 398 service_->NotifyDescriptorValueChanged(this, iter->second, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 478 |
470 void BluetoothRemoteGattCharacteristicChromeOS::ProcessStartNotifyQueue() { | 479 void BluetoothRemoteGattCharacteristicChromeOS::ProcessStartNotifyQueue() { |
471 while (!pending_start_notify_calls_.empty()) { | 480 while (!pending_start_notify_calls_.empty()) { |
472 PendingStartNotifyCall callbacks = pending_start_notify_calls_.front(); | 481 PendingStartNotifyCall callbacks = pending_start_notify_calls_.front(); |
473 pending_start_notify_calls_.pop(); | 482 pending_start_notify_calls_.pop(); |
474 StartNotifySession(callbacks.first, callbacks.second); | 483 StartNotifySession(callbacks.first, callbacks.second); |
475 } | 484 } |
476 } | 485 } |
477 | 486 |
478 } // namespace chromeos | 487 } // namespace chromeos |
OLD | NEW |