OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
(...skipping 28 matching lines...) Expand all Loading... |
39 class BluetoothAdapterProfileChromeOS; | 39 class BluetoothAdapterProfileChromeOS; |
40 class BluetoothDeviceChromeOS; | 40 class BluetoothDeviceChromeOS; |
41 class BluetoothPairingChromeOS; | 41 class BluetoothPairingChromeOS; |
42 class BluetoothRemoteGattCharacteristicChromeOS; | 42 class BluetoothRemoteGattCharacteristicChromeOS; |
43 class BluetoothRemoteGattDescriptorChromeOS; | 43 class BluetoothRemoteGattDescriptorChromeOS; |
44 class BluetoothRemoteGattServiceChromeOS; | 44 class BluetoothRemoteGattServiceChromeOS; |
45 | 45 |
46 // The BluetoothAdapterChromeOS class implements BluetoothAdapter for the | 46 // The BluetoothAdapterChromeOS class implements BluetoothAdapter for the |
47 // Chrome OS platform. | 47 // Chrome OS platform. |
48 // | 48 // |
| 49 // All methods are called from the dbus origin / UI thread and are generally |
| 50 // not assumed to be thread-safe. |
| 51 // |
| 52 // This class interacts with sockets using the BluetoothSocketThread to ensure |
| 53 // single-threaded calls, and posts tasks to the UI thread. |
| 54 // |
49 // Methods tolerate a shutdown scenario where BluetoothAdapterChromeOS::Shutdown | 55 // Methods tolerate a shutdown scenario where BluetoothAdapterChromeOS::Shutdown |
50 // causes IsPresent to return false just before the dbus system is shutdown but | 56 // causes IsPresent to return false just before the dbus system is shutdown but |
51 // while references to the BluetoothAdapterChromeOS object still exists. | 57 // while references to the BluetoothAdapterChromeOS object still exists. |
52 // | 58 // |
53 // When adding methods to this class verify shutdown behavior in | 59 // When adding methods to this class verify shutdown behavior in |
54 // BluetoothChromeOSTest, Shutdown. | 60 // BluetoothChromeOSTest, Shutdown. |
55 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS | 61 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS |
56 : public device::BluetoothAdapter, | 62 : public device::BluetoothAdapter, |
57 public chromeos::BluetoothAdapterClient::Observer, | 63 public chromeos::BluetoothAdapterClient::Observer, |
58 public chromeos::BluetoothDeviceClient::Observer, | 64 public chromeos::BluetoothDeviceClient::Observer, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 void RegisterAdvertisement( | 108 void RegisterAdvertisement( |
103 scoped_ptr<device::BluetoothAdvertisement::Data> advertisement_data, | 109 scoped_ptr<device::BluetoothAdvertisement::Data> advertisement_data, |
104 const CreateAdvertisementCallback& callback, | 110 const CreateAdvertisementCallback& callback, |
105 const CreateAdvertisementErrorCallback& error_callback) override; | 111 const CreateAdvertisementErrorCallback& error_callback) override; |
106 | 112 |
107 // Locates the device object by object path (the devices map and | 113 // Locates the device object by object path (the devices map and |
108 // BluetoothDevice methods are by address). | 114 // BluetoothDevice methods are by address). |
109 BluetoothDeviceChromeOS* GetDeviceWithPath( | 115 BluetoothDeviceChromeOS* GetDeviceWithPath( |
110 const dbus::ObjectPath& object_path); | 116 const dbus::ObjectPath& object_path); |
111 | 117 |
112 // Announce to observers a change in device state that is not reflected by | 118 // Announces to observers a change in device state that is not reflected by |
113 // its D-Bus properties. | 119 // its D-Bus properties. |device| is owned by the caller and cannot be NULL. |
114 void NotifyDeviceChanged(BluetoothDeviceChromeOS* device); | 120 void NotifyDeviceChanged(BluetoothDeviceChromeOS* device); |
115 | 121 |
116 // The following methods are used to send various GATT observer events to | 122 // The following methods are used to send various GATT observer events to |
117 // observers. | 123 // observers. |
118 void NotifyGattServiceAdded(BluetoothRemoteGattServiceChromeOS* service); | 124 void NotifyGattServiceAdded(BluetoothRemoteGattServiceChromeOS* service); |
119 void NotifyGattServiceRemoved(BluetoothRemoteGattServiceChromeOS* service); | 125 void NotifyGattServiceRemoved(BluetoothRemoteGattServiceChromeOS* service); |
120 void NotifyGattServiceChanged(BluetoothRemoteGattServiceChromeOS* service); | 126 void NotifyGattServiceChanged(BluetoothRemoteGattServiceChromeOS* service); |
121 void NotifyGattDiscoveryComplete(BluetoothRemoteGattServiceChromeOS* service); | 127 void NotifyGattDiscoveryComplete(BluetoothRemoteGattServiceChromeOS* service); |
122 void NotifyGattCharacteristicAdded( | 128 void NotifyGattCharacteristicAdded( |
123 BluetoothRemoteGattCharacteristicChromeOS* characteristic); | 129 BluetoothRemoteGattCharacteristicChromeOS* characteristic); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 // Note: This should remain the last member so it'll be destroyed and | 383 // Note: This should remain the last member so it'll be destroyed and |
378 // invalidate its weak pointers before any other members are destroyed. | 384 // invalidate its weak pointers before any other members are destroyed. |
379 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; | 385 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; |
380 | 386 |
381 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); | 387 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); |
382 }; | 388 }; |
383 | 389 |
384 } // namespace chromeos | 390 } // namespace chromeos |
385 | 391 |
386 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 392 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
OLD | NEW |