Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: device/bluetooth/bluetooth_device.cc

Issue 2826383002: bluetooth: Make in progress errors consistent across android
Patch Set: Fix windows Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_device.h" 5 #include "device/bluetooth/bluetooth_device.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 void BluetoothDevice::DeviceUUIDs::UpdateDeviceUUIDs() { 67 void BluetoothDevice::DeviceUUIDs::UpdateDeviceUUIDs() {
68 device_uuids_.clear(); 68 device_uuids_.clear();
69 std::set_union(advertised_uuids_.begin(), advertised_uuids_.end(), 69 std::set_union(advertised_uuids_.begin(), advertised_uuids_.end(),
70 service_uuids_.begin(), service_uuids_.end(), 70 service_uuids_.begin(), service_uuids_.end(),
71 std::inserter(device_uuids_, device_uuids_.begin())); 71 std::inserter(device_uuids_, device_uuids_.begin()));
72 } 72 }
73 73
74 BluetoothDevice::BluetoothDevice(BluetoothAdapter* adapter) 74 BluetoothDevice::BluetoothDevice(BluetoothAdapter* adapter)
75 : adapter_(adapter), 75 : adapter_(adapter),
76 gatt_services_discovery_complete_(false), 76 gatt_services_discovery_complete_(false),
77 pending_gatt_operation_(false),
77 last_update_time_(base::Time()) {} 78 last_update_time_(base::Time()) {}
78 79
79 BluetoothDevice::~BluetoothDevice() { 80 BluetoothDevice::~BluetoothDevice() {
80 for (BluetoothGattConnection* connection : gatt_connections_) { 81 for (BluetoothGattConnection* connection : gatt_connections_) {
81 connection->InvalidateConnectionReference(); 82 connection->InvalidateConnectionReference();
82 } 83 }
83 } 84 }
84 85
85 BluetoothDevice::ConnectionInfo::ConnectionInfo() 86 BluetoothDevice::ConnectionInfo::ConnectionInfo()
86 : rssi(kUnknownPower), 87 : rssi(kUnknownPower),
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } 510 }
510 511
511 void BluetoothDevice::RemoveGattConnection( 512 void BluetoothDevice::RemoveGattConnection(
512 BluetoothGattConnection* connection) { 513 BluetoothGattConnection* connection) {
513 size_t erased_count = gatt_connections_.erase(connection); 514 size_t erased_count = gatt_connections_.erase(connection);
514 DCHECK(erased_count); 515 DCHECK(erased_count);
515 if (gatt_connections_.size() == 0) 516 if (gatt_connections_.size() == 0)
516 DisconnectGatt(); 517 DisconnectGatt();
517 } 518 }
518 519
520 bool BluetoothDevice::HasPendingGattOperation() const {
521 return pending_gatt_operation_;
522 }
523
524 void BluetoothDevice::SetPendingGattOperation(bool pending) {
525 pending_gatt_operation_ = pending;
526 }
527
519 void BluetoothDevice::SetAsExpiredForTesting() { 528 void BluetoothDevice::SetAsExpiredForTesting() {
520 last_update_time_ = 529 last_update_time_ =
521 base::Time::NowFromSystemTime() - 530 base::Time::NowFromSystemTime() -
522 (BluetoothAdapter::timeoutSec + base::TimeDelta::FromSeconds(1)); 531 (BluetoothAdapter::timeoutSec + base::TimeDelta::FromSeconds(1));
523 } 532 }
524 533
525 void BluetoothDevice::Pair(PairingDelegate* pairing_delegate, 534 void BluetoothDevice::Pair(PairingDelegate* pairing_delegate,
526 const base::Closure& callback, 535 const base::Closure& callback,
527 const ConnectErrorCallback& error_callback) { 536 const ConnectErrorCallback& error_callback) {
528 NOTREACHED(); 537 NOTREACHED();
(...skipping 12 matching lines...) Expand all
541 if (power < INT8_MIN) { 550 if (power < INT8_MIN) {
542 return INT8_MIN; 551 return INT8_MIN;
543 } 552 }
544 if (power > INT8_MAX) { 553 if (power > INT8_MAX) {
545 return INT8_MAX; 554 return INT8_MAX;
546 } 555 }
547 return static_cast<int8_t>(power); 556 return static_cast<int8_t>(power);
548 } 557 }
549 558
550 } // namespace device 559 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698