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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 | 78 |
79 // Called when a new device |device| is added to the adapter |adapter|, | 79 // Called when a new device |device| is added to the adapter |adapter|, |
80 // either because it has been discovered or a connection made. |device| | 80 // either because it has been discovered or a connection made. |device| |
81 // should not be cached. Instead, copy its Bluetooth address. | 81 // should not be cached. Instead, copy its Bluetooth address. |
82 virtual void DeviceAdded(BluetoothAdapter* adapter, | 82 virtual void DeviceAdded(BluetoothAdapter* adapter, |
83 BluetoothDevice* device) {} | 83 BluetoothDevice* device) {} |
84 | 84 |
85 // Called when properties of the device |device| known to the adapter | 85 // Called when properties of the device |device| known to the adapter |
86 // |adapter| change. |device| should not be cached. Instead, copy its | 86 // |adapter| change. |device| should not be cached. Instead, copy its |
87 // Bluetooth address. | 87 // Bluetooth address. |
88 virtual void DeviceChanged(BluetoothAdapter* adapter, | 88 virtual void DeviceChanged(BluetoothAdapter* adapter, |
scheib
2016/05/24 23:34:34
Please add disconnection to the comment; I'd like
Jeffrey Yasskin
2016/05/25 00:08:12
I've listed the methods whose changes this event r
| |
89 BluetoothDevice* device) {} | 89 BluetoothDevice* device) {} |
90 | 90 |
91 // Called when address property of the device |device| known to the adapter | 91 // Called when address property of the device |device| known to the adapter |
92 // |adapter| change due to pairing. | 92 // |adapter| change due to pairing. |
93 virtual void DeviceAddressChanged(BluetoothAdapter* adapter, | 93 virtual void DeviceAddressChanged(BluetoothAdapter* adapter, |
94 BluetoothDevice* device, | 94 BluetoothDevice* device, |
95 const std::string& old_address) {} | 95 const std::string& old_address) {} |
96 | 96 |
97 #if defined(OS_CHROMEOS) || defined(OS_LINUX) | 97 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
98 // This function is implemented for ChromeOS only, and the support for | 98 // This function is implemented for ChromeOS only, and the support for |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
421 const CreateAdvertisementCallback& callback, | 421 const CreateAdvertisementCallback& callback, |
422 const CreateAdvertisementErrorCallback& error_callback) = 0; | 422 const CreateAdvertisementErrorCallback& error_callback) = 0; |
423 | 423 |
424 // Returns the local GATT services associated with this adapter with the | 424 // Returns the local GATT services associated with this adapter with the |
425 // given identifier. Returns NULL if the service doesn't exist. | 425 // given identifier. Returns NULL if the service doesn't exist. |
426 virtual BluetoothLocalGattService* GetGattService( | 426 virtual BluetoothLocalGattService* GetGattService( |
427 const std::string& identifier) const = 0; | 427 const std::string& identifier) const = 0; |
428 | 428 |
429 // The following methods are used to send various events to observers. | 429 // The following methods are used to send various events to observers. |
430 void NotifyAdapterStateChanged(bool powered); | 430 void NotifyAdapterStateChanged(bool powered); |
431 void NotifyDeviceChanged(BluetoothDevice* device); | |
432 | |
431 #if defined(OS_CHROMEOS) || defined(OS_LINUX) | 433 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
432 // This function is implemented for ChromeOS only, and the support on | 434 // This function is implemented for ChromeOS only, and the support on |
433 // Android, MaxOS and Windows should be added on demand in the future. | 435 // Android, MaxOS and Windows should be added on demand in the future. |
434 void NotifyDevicePairedChanged(BluetoothDevice* device, | 436 void NotifyDevicePairedChanged(BluetoothDevice* device, |
435 bool new_paired_status); | 437 bool new_paired_status); |
436 #endif | 438 #endif |
437 void NotifyGattServiceAdded(BluetoothRemoteGattService* service); | 439 void NotifyGattServiceAdded(BluetoothRemoteGattService* service); |
438 void NotifyGattServiceRemoved(BluetoothRemoteGattService* service); | 440 void NotifyGattServiceRemoved(BluetoothRemoteGattService* service); |
439 void NotifyGattServiceChanged(BluetoothRemoteGattService* service); | 441 void NotifyGattServiceChanged(BluetoothRemoteGattService* service); |
440 void NotifyGattServicesDiscovered(BluetoothDevice* device); | 442 void NotifyGattServicesDiscovered(BluetoothDevice* device); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
583 std::set<BluetoothDiscoverySession*> discovery_sessions_; | 585 std::set<BluetoothDiscoverySession*> discovery_sessions_; |
584 | 586 |
585 // Note: This should remain the last member so it'll be destroyed and | 587 // Note: This should remain the last member so it'll be destroyed and |
586 // invalidate its weak pointers before any other members are destroyed. | 588 // invalidate its weak pointers before any other members are destroyed. |
587 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; | 589 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; |
588 }; | 590 }; |
589 | 591 |
590 } // namespace device | 592 } // namespace device |
591 | 593 |
592 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 594 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
OLD | NEW |