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

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

Issue 2891493002: Revert of bluetooth: bluez: Fixed issue with missing notifications after reconnect. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « device/bluetooth/bluetooth_device.h ('k') | device/bluetooth/bluetooth_device_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 // Connection request should only be made if there are no active 463 // Connection request should only be made if there are no active
464 // connections. 464 // connections.
465 DCHECK(gatt_connections_.empty()); 465 DCHECK(gatt_connections_.empty());
466 466
467 for (const auto& error_callback : create_gatt_connection_error_callbacks_) 467 for (const auto& error_callback : create_gatt_connection_error_callbacks_)
468 error_callback.Run(error); 468 error_callback.Run(error);
469 create_gatt_connection_success_callbacks_.clear(); 469 create_gatt_connection_success_callbacks_.clear();
470 create_gatt_connection_error_callbacks_.clear(); 470 create_gatt_connection_error_callbacks_.clear();
471 } 471 }
472 472
473 void BluetoothDevice::DidDisconnectGatt(bool notifyDeviceChanged) { 473 void BluetoothDevice::DidDisconnectGatt() {
474 gatt_services_.clear();
475 device_uuids_.ClearServiceUUIDs();
476 SetGattServicesDiscoveryComplete(false);
477
478 // Pending calls to connect GATT are not expected, if they were then 474 // Pending calls to connect GATT are not expected, if they were then
479 // DidFailToConnectGatt should have been called. 475 // DidFailToConnectGatt should have been called.
480 DCHECK(create_gatt_connection_error_callbacks_.empty()); 476 DCHECK(create_gatt_connection_error_callbacks_.empty());
481 477
482 // Invalidate all BluetoothGattConnection objects. 478 // Invalidate all BluetoothGattConnection objects.
483 for (BluetoothGattConnection* connection : gatt_connections_) { 479 for (BluetoothGattConnection* connection : gatt_connections_) {
484 connection->InvalidateConnectionReference(); 480 connection->InvalidateConnectionReference();
485 } 481 }
486 gatt_connections_.clear(); 482 gatt_connections_.clear();
487 if (notifyDeviceChanged) 483 GetAdapter()->NotifyDeviceChanged(this);
488 GetAdapter()->NotifyDeviceChanged(this);
489 } 484 }
490 485
491 void BluetoothDevice::AddGattConnection(BluetoothGattConnection* connection) { 486 void BluetoothDevice::AddGattConnection(BluetoothGattConnection* connection) {
492 auto result = gatt_connections_.insert(connection); 487 auto result = gatt_connections_.insert(connection);
493 DCHECK(result.second); // Check insert happened; there was no duplicate. 488 DCHECK(result.second); // Check insert happened; there was no duplicate.
494 } 489 }
495 490
496 void BluetoothDevice::RemoveGattConnection( 491 void BluetoothDevice::RemoveGattConnection(
497 BluetoothGattConnection* connection) { 492 BluetoothGattConnection* connection) {
498 size_t erased_count = gatt_connections_.erase(connection); 493 size_t erased_count = gatt_connections_.erase(connection);
(...skipping 27 matching lines...) Expand all
526 if (power < INT8_MIN) { 521 if (power < INT8_MIN) {
527 return INT8_MIN; 522 return INT8_MIN;
528 } 523 }
529 if (power > INT8_MAX) { 524 if (power > INT8_MAX) {
530 return INT8_MAX; 525 return INT8_MAX;
531 } 526 }
532 return static_cast<int8_t>(power); 527 return static_cast<int8_t>(power);
533 } 528 }
534 529
535 } // namespace device 530 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device.h ('k') | device/bluetooth/bluetooth_device_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698