| OLD | NEW |
| 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 BluetoothRemoteGattCharacteristic* characteristic); | 437 BluetoothRemoteGattCharacteristic* characteristic); |
| 438 void NotifyGattDescriptorAdded(BluetoothRemoteGattDescriptor* descriptor); | 438 void NotifyGattDescriptorAdded(BluetoothRemoteGattDescriptor* descriptor); |
| 439 void NotifyGattDescriptorRemoved(BluetoothRemoteGattDescriptor* descriptor); | 439 void NotifyGattDescriptorRemoved(BluetoothRemoteGattDescriptor* descriptor); |
| 440 void NotifyGattCharacteristicValueChanged( | 440 void NotifyGattCharacteristicValueChanged( |
| 441 BluetoothRemoteGattCharacteristic* characteristic, | 441 BluetoothRemoteGattCharacteristic* characteristic, |
| 442 const std::vector<uint8_t>& value); | 442 const std::vector<uint8_t>& value); |
| 443 void NotifyGattDescriptorValueChanged( | 443 void NotifyGattDescriptorValueChanged( |
| 444 BluetoothRemoteGattDescriptor* descriptor, | 444 BluetoothRemoteGattDescriptor* descriptor, |
| 445 const std::vector<uint8_t>& value); | 445 const std::vector<uint8_t>& value); |
| 446 | 446 |
| 447 // The timeout in seconds used by RemoveTimedOutDevices. |
| 448 static const base::TimeDelta timeoutSec; |
| 449 |
| 447 protected: | 450 protected: |
| 448 friend class base::RefCounted<BluetoothAdapter>; | 451 friend class base::RefCounted<BluetoothAdapter>; |
| 449 friend class BluetoothDiscoverySession; | 452 friend class BluetoothDiscoverySession; |
| 450 friend class BluetoothTestBase; | 453 friend class BluetoothTestBase; |
| 451 | 454 |
| 452 typedef base::ScopedPtrHashMap<std::string, std::unique_ptr<BluetoothDevice>> | 455 typedef base::ScopedPtrHashMap<std::string, std::unique_ptr<BluetoothDevice>> |
| 453 DevicesMap; | 456 DevicesMap; |
| 454 typedef std::pair<BluetoothDevice::PairingDelegate*, PairingDelegatePriority> | 457 typedef std::pair<BluetoothDevice::PairingDelegate*, PairingDelegatePriority> |
| 455 PairingDelegatePair; | 458 PairingDelegatePair; |
| 456 typedef base::Callback<void(UMABluetoothDiscoverySessionOutcome)> | 459 typedef base::Callback<void(UMABluetoothDiscoverySessionOutcome)> |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 void MarkDiscoverySessionsAsInactive(); | 535 void MarkDiscoverySessionsAsInactive(); |
| 533 | 536 |
| 534 // Removes |discovery_session| from |discovery_sessions_|, if its in there. | 537 // Removes |discovery_session| from |discovery_sessions_|, if its in there. |
| 535 // Called by DiscoverySession when an instance is destroyed or becomes | 538 // Called by DiscoverySession when an instance is destroyed or becomes |
| 536 // inactive. | 539 // inactive. |
| 537 void DiscoverySessionBecameInactive( | 540 void DiscoverySessionBecameInactive( |
| 538 BluetoothDiscoverySession* discovery_session); | 541 BluetoothDiscoverySession* discovery_session); |
| 539 | 542 |
| 540 void DeleteDeviceForTesting(const std::string& address); | 543 void DeleteDeviceForTesting(const std::string& address); |
| 541 | 544 |
| 545 // Removes from |devices_| any previously paired, connected or seen |
| 546 // devices which are no longer present. Notifies observers. Note: |
| 547 // this is only used by platforms where there is no notification of |
| 548 // lost devices. |
| 549 void RemoveTimedOutDevices(); |
| 550 |
| 542 // Observers of BluetoothAdapter, notified from implementation subclasses. | 551 // Observers of BluetoothAdapter, notified from implementation subclasses. |
| 543 base::ObserverList<device::BluetoothAdapter::Observer> observers_; | 552 base::ObserverList<device::BluetoothAdapter::Observer> observers_; |
| 544 | 553 |
| 545 // Devices paired with, connected to, discovered by, or visible to the | 554 // Devices paired with, connected to, discovered by, or visible to the |
| 546 // adapter. The key is the Bluetooth address of the device and the value is | 555 // adapter. The key is the Bluetooth address of the device and the value is |
| 547 // the BluetoothDevice object whose lifetime is managed by the adapter | 556 // the BluetoothDevice object whose lifetime is managed by the adapter |
| 548 // instance. | 557 // instance. |
| 549 DevicesMap devices_; | 558 DevicesMap devices_; |
| 550 | 559 |
| 551 // Default pairing delegates registered with the adapter. | 560 // Default pairing delegates registered with the adapter. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 575 std::set<BluetoothDiscoverySession*> discovery_sessions_; | 584 std::set<BluetoothDiscoverySession*> discovery_sessions_; |
| 576 | 585 |
| 577 // Note: This should remain the last member so it'll be destroyed and | 586 // Note: This should remain the last member so it'll be destroyed and |
| 578 // invalidate its weak pointers before any other members are destroyed. | 587 // invalidate its weak pointers before any other members are destroyed. |
| 579 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; | 588 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; |
| 580 }; | 589 }; |
| 581 | 590 |
| 582 } // namespace device | 591 } // namespace device |
| 583 | 592 |
| 584 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 593 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| OLD | NEW |