| 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_BLUEZ_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_BLUEZ_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "dbus/object_path.h" | 15 #include "dbus/object_path.h" |
| 16 #include "device/bluetooth/bluetooth_adapter.h" | 16 #include "device/bluetooth/bluetooth_adapter.h" |
| 17 #include "device/bluetooth/bluetooth_audio_sink.h" | 17 #include "device/bluetooth/bluetooth_audio_sink.h" |
| 18 #include "device/bluetooth/bluetooth_device.h" | 18 #include "device/bluetooth/bluetooth_device.h" |
| 19 #include "device/bluetooth/bluetooth_discovery_session.h" | 19 #include "device/bluetooth/bluetooth_discovery_session.h" |
| 20 #include "device/bluetooth/bluetooth_export.h" | 20 #include "device/bluetooth/bluetooth_export.h" |
| 21 #include "device/bluetooth/dbus/bluetooth_adapter_client.h" | 21 #include "device/bluetooth/dbus/bluetooth_adapter_client.h" |
| 22 #include "device/bluetooth/dbus/bluetooth_agent_service_provider.h" | 22 #include "device/bluetooth/dbus/bluetooth_agent_service_provider.h" |
| 23 #include "device/bluetooth/dbus/bluetooth_device_client.h" | 23 #include "device/bluetooth/dbus/bluetooth_device_client.h" |
| 24 #include "device/bluetooth/dbus/bluetooth_input_client.h" | 24 #include "device/bluetooth/dbus/bluetooth_input_client.h" |
| 25 #include "device/bluetooth/dbus/bluetooth_profile_manager_client.h" | 25 #include "device/bluetooth/dbus/bluetooth_profile_manager_client.h" |
| 26 #include "device/bluetooth/dbus/bluetooth_profile_service_provider.h" | 26 #include "device/bluetooth/dbus/bluetooth_profile_service_provider.h" |
| 27 | 27 |
| 28 namespace base { | 28 namespace base { |
| 29 class SequencedTaskRunner; | 29 class SequencedTaskRunner; |
| 30 } // namespace base | 30 } // namespace base |
| 31 | 31 |
| 32 namespace device { | 32 namespace device { |
| 33 class BluetoothSocketThread; | 33 class BluetoothSocketThread; |
| 34 } // namespace device | 34 } // namespace device |
| 35 | 35 |
| 36 namespace chromeos { | 36 namespace bluez { |
| 37 | 37 |
| 38 class BluetoothChromeOSTest; | 38 class BluetoothBlueZTest; |
| 39 class BluetoothAdapterProfileChromeOS; | 39 class BluetoothAdapterProfileBlueZ; |
| 40 class BluetoothDeviceChromeOS; | 40 class BluetoothDeviceBlueZ; |
| 41 class BluetoothPairingChromeOS; | 41 class BluetoothPairingBlueZ; |
| 42 class BluetoothRemoteGattCharacteristicChromeOS; | 42 class BluetoothRemoteGattCharacteristicBlueZ; |
| 43 class BluetoothRemoteGattDescriptorChromeOS; | 43 class BluetoothRemoteGattDescriptorBlueZ; |
| 44 class BluetoothRemoteGattServiceChromeOS; | 44 class BluetoothRemoteGattServiceBlueZ; |
| 45 | 45 |
| 46 // The BluetoothAdapterChromeOS class implements BluetoothAdapter for the | 46 // The BluetoothAdapterBlueZ 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 | 49 // All methods are called from the dbus origin / UI thread and are generally |
| 50 // not assumed to be thread-safe. | 50 // not assumed to be thread-safe. |
| 51 // | 51 // |
| 52 // This class interacts with sockets using the BluetoothSocketThread to ensure | 52 // This class interacts with sockets using the BluetoothSocketThread to ensure |
| 53 // single-threaded calls, and posts tasks to the UI thread. | 53 // single-threaded calls, and posts tasks to the UI thread. |
| 54 // | 54 // |
| 55 // Methods tolerate a shutdown scenario where BluetoothAdapterChromeOS::Shutdown | 55 // Methods tolerate a shutdown scenario where BluetoothAdapterBlueZ::Shutdown |
| 56 // 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 |
| 57 // while references to the BluetoothAdapterChromeOS object still exists. | 57 // while references to the BluetoothAdapterBlueZ object still exists. |
| 58 // | 58 // |
| 59 // When adding methods to this class verify shutdown behavior in | 59 // When adding methods to this class verify shutdown behavior in |
| 60 // BluetoothChromeOSTest, Shutdown. | 60 // BluetoothBlueZTest, Shutdown. |
| 61 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS | 61 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterBlueZ |
| 62 : public device::BluetoothAdapter, | 62 : public device::BluetoothAdapter, |
| 63 public bluez::BluetoothAdapterClient::Observer, | 63 public bluez::BluetoothAdapterClient::Observer, |
| 64 public bluez::BluetoothDeviceClient::Observer, | 64 public bluez::BluetoothDeviceClient::Observer, |
| 65 public bluez::BluetoothInputClient::Observer, | 65 public bluez::BluetoothInputClient::Observer, |
| 66 public bluez::BluetoothAgentServiceProvider::Delegate { | 66 public bluez::BluetoothAgentServiceProvider::Delegate { |
| 67 public: | 67 public: |
| 68 typedef base::Callback<void(const std::string& error_message)> | 68 typedef base::Callback<void(const std::string& error_message)> |
| 69 ErrorCompletionCallback; | 69 ErrorCompletionCallback; |
| 70 typedef base::Callback<void(BluetoothAdapterProfileChromeOS* profile)> | 70 typedef base::Callback<void(BluetoothAdapterProfileBlueZ* profile)> |
| 71 ProfileRegisteredCallback; | 71 ProfileRegisteredCallback; |
| 72 | 72 |
| 73 static base::WeakPtr<BluetoothAdapter> CreateAdapter(); | 73 static base::WeakPtr<BluetoothAdapter> CreateAdapter(); |
| 74 | 74 |
| 75 // BluetoothAdapter: | 75 // BluetoothAdapter: |
| 76 void Shutdown() override; | 76 void Shutdown() override; |
| 77 std::string GetAddress() const override; | 77 std::string GetAddress() const override; |
| 78 std::string GetName() const override; | 78 std::string GetName() const override; |
| 79 void SetName(const std::string& name, | 79 void SetName(const std::string& name, |
| 80 const base::Closure& callback, | 80 const base::Closure& callback, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 105 const device::BluetoothAdapter::AcquiredCallback& callback, | 105 const device::BluetoothAdapter::AcquiredCallback& callback, |
| 106 const device::BluetoothAudioSink::ErrorCallback& error_callback) override; | 106 const device::BluetoothAudioSink::ErrorCallback& error_callback) override; |
| 107 | 107 |
| 108 void RegisterAdvertisement( | 108 void RegisterAdvertisement( |
| 109 scoped_ptr<device::BluetoothAdvertisement::Data> advertisement_data, | 109 scoped_ptr<device::BluetoothAdvertisement::Data> advertisement_data, |
| 110 const CreateAdvertisementCallback& callback, | 110 const CreateAdvertisementCallback& callback, |
| 111 const CreateAdvertisementErrorCallback& error_callback) override; | 111 const CreateAdvertisementErrorCallback& error_callback) override; |
| 112 | 112 |
| 113 // Locates the device object by object path (the devices map and | 113 // Locates the device object by object path (the devices map and |
| 114 // BluetoothDevice methods are by address). | 114 // BluetoothDevice methods are by address). |
| 115 BluetoothDeviceChromeOS* GetDeviceWithPath( | 115 BluetoothDeviceBlueZ* GetDeviceWithPath(const dbus::ObjectPath& object_path); |
| 116 const dbus::ObjectPath& object_path); | |
| 117 | 116 |
| 118 // Announces to observers a change in device state that is not reflected by | 117 // Announces to observers a change in device state that is not reflected by |
| 119 // its D-Bus properties. |device| is owned by the caller and cannot be NULL. | 118 // its D-Bus properties. |device| is owned by the caller and cannot be NULL. |
| 120 void NotifyDeviceChanged(BluetoothDeviceChromeOS* device); | 119 void NotifyDeviceChanged(BluetoothDeviceBlueZ* device); |
| 121 | 120 |
| 122 // The following methods are used to send various GATT observer events to | 121 // The following methods are used to send various GATT observer events to |
| 123 // observers. | 122 // observers. |
| 124 void NotifyGattServiceAdded(BluetoothRemoteGattServiceChromeOS* service); | 123 void NotifyGattServiceAdded(BluetoothRemoteGattServiceBlueZ* service); |
| 125 void NotifyGattServiceRemoved(BluetoothRemoteGattServiceChromeOS* service); | 124 void NotifyGattServiceRemoved(BluetoothRemoteGattServiceBlueZ* service); |
| 126 void NotifyGattServiceChanged(BluetoothRemoteGattServiceChromeOS* service); | 125 void NotifyGattServiceChanged(BluetoothRemoteGattServiceBlueZ* service); |
| 127 void NotifyGattDiscoveryComplete(BluetoothRemoteGattServiceChromeOS* service); | 126 void NotifyGattDiscoveryComplete(BluetoothRemoteGattServiceBlueZ* service); |
| 128 void NotifyGattCharacteristicAdded( | 127 void NotifyGattCharacteristicAdded( |
| 129 BluetoothRemoteGattCharacteristicChromeOS* characteristic); | 128 BluetoothRemoteGattCharacteristicBlueZ* characteristic); |
| 130 void NotifyGattCharacteristicRemoved( | 129 void NotifyGattCharacteristicRemoved( |
| 131 BluetoothRemoteGattCharacteristicChromeOS* characteristic); | 130 BluetoothRemoteGattCharacteristicBlueZ* characteristic); |
| 132 void NotifyGattDescriptorAdded( | 131 void NotifyGattDescriptorAdded( |
| 133 BluetoothRemoteGattDescriptorChromeOS* descriptor); | 132 BluetoothRemoteGattDescriptorBlueZ* descriptor); |
| 134 void NotifyGattDescriptorRemoved( | 133 void NotifyGattDescriptorRemoved( |
| 135 BluetoothRemoteGattDescriptorChromeOS* descriptor); | 134 BluetoothRemoteGattDescriptorBlueZ* descriptor); |
| 136 void NotifyGattCharacteristicValueChanged( | 135 void NotifyGattCharacteristicValueChanged( |
| 137 BluetoothRemoteGattCharacteristicChromeOS* characteristic, | 136 BluetoothRemoteGattCharacteristicBlueZ* characteristic, |
| 138 const std::vector<uint8>& value); | 137 const std::vector<uint8>& value); |
| 139 void NotifyGattDescriptorValueChanged( | 138 void NotifyGattDescriptorValueChanged( |
| 140 BluetoothRemoteGattDescriptorChromeOS* descriptor, | 139 BluetoothRemoteGattDescriptorBlueZ* descriptor, |
| 141 const std::vector<uint8>& value); | 140 const std::vector<uint8>& value); |
| 142 | 141 |
| 143 // Returns the object path of the adapter. | 142 // Returns the object path of the adapter. |
| 144 const dbus::ObjectPath& object_path() const { return object_path_; } | 143 const dbus::ObjectPath& object_path() const { return object_path_; } |
| 145 | 144 |
| 146 // Request a profile on the adapter for a custom service with a | 145 // Request a profile on the adapter for a custom service with a |
| 147 // specific UUID for the device at |device_path| to be sent to |delegate|. | 146 // specific UUID for the device at |device_path| to be sent to |delegate|. |
| 148 // If |device_path| is the empty string, incoming connections will be | 147 // If |device_path| is the empty string, incoming connections will be |
| 149 // assigned to |delegate|. When the profile is | 148 // assigned to |delegate|. When the profile is |
| 150 // successfully registered, |success_callback| will be called with a pointer | 149 // successfully registered, |success_callback| will be called with a pointer |
| 151 // to the profile which is managed by BluetoothAdapterChromeOS. On failure, | 150 // to the profile which is managed by BluetoothAdapterBlueZ. On failure, |
| 152 // |error_callback| will be called. | 151 // |error_callback| will be called. |
| 153 void UseProfile(const device::BluetoothUUID& uuid, | 152 void UseProfile(const device::BluetoothUUID& uuid, |
| 154 const dbus::ObjectPath& device_path, | 153 const dbus::ObjectPath& device_path, |
| 155 const bluez::BluetoothProfileManagerClient::Options& options, | 154 const bluez::BluetoothProfileManagerClient::Options& options, |
| 156 bluez::BluetoothProfileServiceProvider::Delegate* delegate, | 155 bluez::BluetoothProfileServiceProvider::Delegate* delegate, |
| 157 const ProfileRegisteredCallback& success_callback, | 156 const ProfileRegisteredCallback& success_callback, |
| 158 const ErrorCompletionCallback& error_callback); | 157 const ErrorCompletionCallback& error_callback); |
| 159 | 158 |
| 160 // Release use of a profile by a device. | 159 // Release use of a profile by a device. |
| 161 void ReleaseProfile(const dbus::ObjectPath& device_path, | 160 void ReleaseProfile(const dbus::ObjectPath& device_path, |
| 162 BluetoothAdapterProfileChromeOS* profile); | 161 BluetoothAdapterProfileBlueZ* profile); |
| 163 | 162 |
| 164 protected: | 163 protected: |
| 165 // BluetoothAdapter: | 164 // BluetoothAdapter: |
| 166 void RemovePairingDelegateInternal( | 165 void RemovePairingDelegateInternal( |
| 167 device::BluetoothDevice::PairingDelegate* pairing_delegate) override; | 166 device::BluetoothDevice::PairingDelegate* pairing_delegate) override; |
| 168 | 167 |
| 169 private: | 168 private: |
| 170 friend class BluetoothChromeOSTest; | 169 friend class BluetoothBlueZTest; |
| 171 friend class BluetoothChromeOSTest_Shutdown_Test; | 170 friend class BluetoothBlueZTest_Shutdown_Test; |
| 172 friend class BluetoothChromeOSTest_Shutdown_OnStartDiscovery_Test; | 171 friend class BluetoothBlueZTest_Shutdown_OnStartDiscovery_Test; |
| 173 friend class BluetoothChromeOSTest_Shutdown_OnStartDiscoveryError_Test; | 172 friend class BluetoothBlueZTest_Shutdown_OnStartDiscoveryError_Test; |
| 174 friend class BluetoothChromeOSTest_Shutdown_OnStopDiscovery_Test; | 173 friend class BluetoothBlueZTest_Shutdown_OnStopDiscovery_Test; |
| 175 friend class BluetoothChromeOSTest_Shutdown_OnStopDiscoveryError_Test; | 174 friend class BluetoothBlueZTest_Shutdown_OnStopDiscoveryError_Test; |
| 176 | 175 |
| 177 // typedef for callback parameters that are passed to AddDiscoverySession | 176 // typedef for callback parameters that are passed to AddDiscoverySession |
| 178 // and RemoveDiscoverySession. This is used to queue incoming requests while | 177 // and RemoveDiscoverySession. This is used to queue incoming requests while |
| 179 // a call to BlueZ is pending. | 178 // a call to BlueZ is pending. |
| 180 typedef std::tuple<device::BluetoothDiscoveryFilter*, | 179 typedef std::tuple<device::BluetoothDiscoveryFilter*, |
| 181 base::Closure, | 180 base::Closure, |
| 182 DiscoverySessionErrorCallback> DiscoveryParamTuple; | 181 DiscoverySessionErrorCallback> DiscoveryParamTuple; |
| 183 typedef std::queue<DiscoveryParamTuple> DiscoveryCallbackQueue; | 182 typedef std::queue<DiscoveryParamTuple> DiscoveryCallbackQueue; |
| 184 | 183 |
| 185 // Callback pair for the profile registration queue. | 184 // Callback pair for the profile registration queue. |
| 186 typedef std::pair<base::Closure, ErrorCompletionCallback> | 185 typedef std::pair<base::Closure, ErrorCompletionCallback> |
| 187 RegisterProfileCompletionPair; | 186 RegisterProfileCompletionPair; |
| 188 | 187 |
| 189 BluetoothAdapterChromeOS(); | 188 BluetoothAdapterBlueZ(); |
| 190 ~BluetoothAdapterChromeOS() override; | 189 ~BluetoothAdapterBlueZ() override; |
| 191 | 190 |
| 192 // bluez::BluetoothAdapterClient::Observer override. | 191 // bluez::BluetoothAdapterClient::Observer override. |
| 193 void AdapterAdded(const dbus::ObjectPath& object_path) override; | 192 void AdapterAdded(const dbus::ObjectPath& object_path) override; |
| 194 void AdapterRemoved(const dbus::ObjectPath& object_path) override; | 193 void AdapterRemoved(const dbus::ObjectPath& object_path) override; |
| 195 void AdapterPropertyChanged(const dbus::ObjectPath& object_path, | 194 void AdapterPropertyChanged(const dbus::ObjectPath& object_path, |
| 196 const std::string& property_name) override; | 195 const std::string& property_name) override; |
| 197 | 196 |
| 198 // bluez::BluetoothDeviceClient::Observer override. | 197 // bluez::BluetoothDeviceClient::Observer override. |
| 199 void DeviceAdded(const dbus::ObjectPath& object_path) override; | 198 void DeviceAdded(const dbus::ObjectPath& object_path) override; |
| 200 void DeviceRemoved(const dbus::ObjectPath& object_path) override; | 199 void DeviceRemoved(const dbus::ObjectPath& object_path) override; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 231 void OnRegisterAgent(); | 230 void OnRegisterAgent(); |
| 232 void OnRegisterAgentError(const std::string& error_name, | 231 void OnRegisterAgentError(const std::string& error_name, |
| 233 const std::string& error_message); | 232 const std::string& error_message); |
| 234 | 233 |
| 235 // Called by dbus:: on completion of the D-Bus method call to request that | 234 // Called by dbus:: on completion of the D-Bus method call to request that |
| 236 // the pairing agent be made the default. | 235 // the pairing agent be made the default. |
| 237 void OnRequestDefaultAgent(); | 236 void OnRequestDefaultAgent(); |
| 238 void OnRequestDefaultAgentError(const std::string& error_name, | 237 void OnRequestDefaultAgentError(const std::string& error_name, |
| 239 const std::string& error_message); | 238 const std::string& error_message); |
| 240 | 239 |
| 241 // Called by BluetoothAudioSinkChromeOS on completion of registering an audio | 240 // Called by BluetoothAudioSinkBlueZ on completion of registering an audio |
| 242 // sink. | 241 // sink. |
| 243 void OnRegisterAudioSink( | 242 void OnRegisterAudioSink( |
| 244 const device::BluetoothAdapter::AcquiredCallback& callback, | 243 const device::BluetoothAdapter::AcquiredCallback& callback, |
| 245 const device::BluetoothAudioSink::ErrorCallback& error_callback, | 244 const device::BluetoothAudioSink::ErrorCallback& error_callback, |
| 246 scoped_refptr<device::BluetoothAudioSink> audio_sink); | 245 scoped_refptr<device::BluetoothAudioSink> audio_sink); |
| 247 | 246 |
| 248 // Internal method to obtain a BluetoothPairingChromeOS object for the device | 247 // Internal method to obtain a BluetoothPairingBlueZ object for the device |
| 249 // with path |object_path|. Returns the existing pairing object if the device | 248 // with path |object_path|. Returns the existing pairing object if the device |
| 250 // already has one (usually an outgoing connection in progress) or a new | 249 // already has one (usually an outgoing connection in progress) or a new |
| 251 // pairing object with the default pairing delegate if not. If no default | 250 // pairing object with the default pairing delegate if not. If no default |
| 252 // pairing object exists, NULL will be returned. | 251 // pairing object exists, NULL will be returned. |
| 253 BluetoothPairingChromeOS* GetPairing(const dbus::ObjectPath& object_path); | 252 BluetoothPairingBlueZ* GetPairing(const dbus::ObjectPath& object_path); |
| 254 | 253 |
| 255 // Set the tracked adapter to the one in |object_path|, this object will | 254 // Set the tracked adapter to the one in |object_path|, this object will |
| 256 // subsequently operate on that adapter until it is removed. | 255 // subsequently operate on that adapter until it is removed. |
| 257 void SetAdapter(const dbus::ObjectPath& object_path); | 256 void SetAdapter(const dbus::ObjectPath& object_path); |
| 258 | 257 |
| 259 // Set the adapter name to one chosen from the system information. | 258 // Set the adapter name to one chosen from the system information. |
| 260 void SetDefaultAdapterName(); | 259 void SetDefaultAdapterName(); |
| 261 | 260 |
| 262 // Remove the currently tracked adapter. IsPresent() will return false after | 261 // Remove the currently tracked adapter. IsPresent() will return false after |
| 263 // this is called. | 262 // this is called. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 const base::Closure& callback, | 318 const base::Closure& callback, |
| 320 const DiscoverySessionErrorCallback& error_callback); | 319 const DiscoverySessionErrorCallback& error_callback); |
| 321 void OnSetDiscoveryFilterError( | 320 void OnSetDiscoveryFilterError( |
| 322 const base::Closure& callback, | 321 const base::Closure& callback, |
| 323 const DiscoverySessionErrorCallback& error_callback, | 322 const DiscoverySessionErrorCallback& error_callback, |
| 324 const std::string& error_name, | 323 const std::string& error_name, |
| 325 const std::string& error_message); | 324 const std::string& error_message); |
| 326 | 325 |
| 327 // Called by dbus:: on completion of the D-Bus method to register a profile. | 326 // Called by dbus:: on completion of the D-Bus method to register a profile. |
| 328 void OnRegisterProfile(const device::BluetoothUUID& uuid, | 327 void OnRegisterProfile(const device::BluetoothUUID& uuid, |
| 329 scoped_ptr<BluetoothAdapterProfileChromeOS> profile); | 328 scoped_ptr<BluetoothAdapterProfileBlueZ> profile); |
| 330 | 329 |
| 331 void SetProfileDelegate( | 330 void SetProfileDelegate( |
| 332 const device::BluetoothUUID& uuid, | 331 const device::BluetoothUUID& uuid, |
| 333 const dbus::ObjectPath& device_path, | 332 const dbus::ObjectPath& device_path, |
| 334 bluez::BluetoothProfileServiceProvider::Delegate* delegate, | 333 bluez::BluetoothProfileServiceProvider::Delegate* delegate, |
| 335 const ProfileRegisteredCallback& success_callback, | 334 const ProfileRegisteredCallback& success_callback, |
| 336 const ErrorCompletionCallback& error_callback); | 335 const ErrorCompletionCallback& error_callback); |
| 337 void OnRegisterProfileError(const device::BluetoothUUID& uuid, | 336 void OnRegisterProfileError(const device::BluetoothUUID& uuid, |
| 338 const std::string& error_name, | 337 const std::string& error_name, |
| 339 const std::string& error_message); | 338 const std::string& error_message); |
| 340 | 339 |
| 341 // Called by BluetoothAdapterProfileChromeOS when no users of a profile | 340 // Called by BluetoothAdapterProfileBlueZ when no users of a profile |
| 342 // remain. | 341 // remain. |
| 343 void RemoveProfile(const device::BluetoothUUID& uuid); | 342 void RemoveProfile(const device::BluetoothUUID& uuid); |
| 344 | 343 |
| 345 // Processes the queued discovery requests. For each DiscoveryParamTuple in | 344 // Processes the queued discovery requests. For each DiscoveryParamTuple in |
| 346 // the queue, this method will try to add a new discovery session. This method | 345 // the queue, this method will try to add a new discovery session. This method |
| 347 // is called whenever a pending D-Bus call to start or stop discovery has | 346 // is called whenever a pending D-Bus call to start or stop discovery has |
| 348 // ended (with either success or failure). | 347 // ended (with either success or failure). |
| 349 void ProcessQueuedDiscoveryRequests(); | 348 void ProcessQueuedDiscoveryRequests(); |
| 350 | 349 |
| 351 // Set in |Shutdown()|, makes IsPresent()| return false. | 350 // Set in |Shutdown()|, makes IsPresent()| return false. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 373 | 372 |
| 374 // Instance of the D-Bus agent object used for pairing, initialized with | 373 // Instance of the D-Bus agent object used for pairing, initialized with |
| 375 // our own class as its delegate. | 374 // our own class as its delegate. |
| 376 scoped_ptr<bluez::BluetoothAgentServiceProvider> agent_; | 375 scoped_ptr<bluez::BluetoothAgentServiceProvider> agent_; |
| 377 | 376 |
| 378 // UI thread task runner and socket thread object used to create sockets. | 377 // UI thread task runner and socket thread object used to create sockets. |
| 379 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 378 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 380 scoped_refptr<device::BluetoothSocketThread> socket_thread_; | 379 scoped_refptr<device::BluetoothSocketThread> socket_thread_; |
| 381 | 380 |
| 382 // The profiles we have registered with the bluetooth daemon. | 381 // The profiles we have registered with the bluetooth daemon. |
| 383 std::map<device::BluetoothUUID, BluetoothAdapterProfileChromeOS*> profiles_; | 382 std::map<device::BluetoothUUID, BluetoothAdapterProfileBlueZ*> profiles_; |
| 384 | 383 |
| 385 // Queue of delegates waiting for a profile to register. | 384 // Queue of delegates waiting for a profile to register. |
| 386 std::map<device::BluetoothUUID, std::vector<RegisterProfileCompletionPair>*> | 385 std::map<device::BluetoothUUID, std::vector<RegisterProfileCompletionPair>*> |
| 387 profile_queues_; | 386 profile_queues_; |
| 388 | 387 |
| 389 scoped_ptr<device::BluetoothDiscoveryFilter> current_filter_; | 388 scoped_ptr<device::BluetoothDiscoveryFilter> current_filter_; |
| 390 | 389 |
| 391 // Note: This should remain the last member so it'll be destroyed and | 390 // Note: This should remain the last member so it'll be destroyed and |
| 392 // invalidate its weak pointers before any other members are destroyed. | 391 // invalidate its weak pointers before any other members are destroyed. |
| 393 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; | 392 base::WeakPtrFactory<BluetoothAdapterBlueZ> weak_ptr_factory_; |
| 394 | 393 |
| 395 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); | 394 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterBlueZ); |
| 396 }; | 395 }; |
| 397 | 396 |
| 398 } // namespace chromeos | 397 } // namespace bluez |
| 399 | 398 |
| 400 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 399 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_BLUEZ_H_ |
| OLD | NEW |