| 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" | 11 #include "chromeos/dbus/dbus_thread_manager.h" |
| 12 #include "device/bluetooth/bluetooth_adapter.h" | 12 #include "device/bluetooth/bluetooth_adapter_chromeos.h" |
| 13 #include "device/bluetooth/bluetooth_device.h" | 13 #include "device/bluetooth/bluetooth_device.h" |
| 14 #include "device/bluetooth/bluetooth_gatt_notify_session_chromeos.h" | 14 #include "device/bluetooth/bluetooth_gatt_notify_session_chromeos.h" |
| 15 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h" | 15 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h" |
| 16 #include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h" | 16 #include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h" |
| 17 #include "third_party/cros_system_api/dbus/service_constants.h" | 17 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 18 | 18 |
| 19 namespace chromeos { | 19 namespace chromeos { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // this call as if the count were 0. | 237 // this call as if the count were 0. |
| 238 if (IsNotifying()) { | 238 if (IsNotifying()) { |
| 239 // Check for overflows, though unlikely. | 239 // Check for overflows, though unlikely. |
| 240 if (num_notify_sessions_ == std::numeric_limits<size_t>::max()) { | 240 if (num_notify_sessions_ == std::numeric_limits<size_t>::max()) { |
| 241 error_callback.Run(); | 241 error_callback.Run(); |
| 242 return; | 242 return; |
| 243 } | 243 } |
| 244 | 244 |
| 245 ++num_notify_sessions_; | 245 ++num_notify_sessions_; |
| 246 DCHECK(service_); | 246 DCHECK(service_); |
| 247 DCHECK(service_->GetAdapter()); |
| 247 DCHECK(service_->GetDevice()); | 248 DCHECK(service_->GetDevice()); |
| 248 scoped_ptr<device::BluetoothGattNotifySession> session( | 249 scoped_ptr<device::BluetoothGattNotifySession> session( |
| 249 new BluetoothGattNotifySessionChromeOS( | 250 new BluetoothGattNotifySessionChromeOS( |
| 250 service_->GetAdapter(), | 251 service_->GetAdapter(), |
| 251 service_->GetDevice()->GetAddress(), | 252 service_->GetDevice()->GetAddress(), |
| 252 service_->GetIdentifier(), | 253 service_->GetIdentifier(), |
| 253 GetIdentifier(), | 254 GetIdentifier(), |
| 254 object_path_)); | 255 object_path_)); |
| 255 callback.Run(session.Pass()); | 256 callback.Run(session.Pass()); |
| 256 return; | 257 return; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 468 |
| 468 void BluetoothRemoteGattCharacteristicChromeOS::ProcessStartNotifyQueue() { | 469 void BluetoothRemoteGattCharacteristicChromeOS::ProcessStartNotifyQueue() { |
| 469 while (!pending_start_notify_calls_.empty()) { | 470 while (!pending_start_notify_calls_.empty()) { |
| 470 PendingStartNotifyCall callbacks = pending_start_notify_calls_.front(); | 471 PendingStartNotifyCall callbacks = pending_start_notify_calls_.front(); |
| 471 pending_start_notify_calls_.pop(); | 472 pending_start_notify_calls_.pop(); |
| 472 StartNotifySession(callbacks.first, callbacks.second); | 473 StartNotifySession(callbacks.first, callbacks.second); |
| 473 } | 474 } |
| 474 } | 475 } |
| 475 | 476 |
| 476 } // namespace chromeos | 477 } // namespace chromeos |
| OLD | NEW |