| 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 // Announce to observers a device address change. | 121 // Announce to observers a device address change. |
| 123 void NotifyDeviceAddressChanged(BluetoothDeviceChromeOS* device, | 122 void NotifyDeviceAddressChanged(BluetoothDeviceBlueZ* device, |
| 124 const std::string& old_address); | 123 const std::string& old_address); |
| 125 | 124 |
| 126 // The following methods are used to send various GATT observer events to | 125 // The following methods are used to send various GATT observer events to |
| 127 // observers. | 126 // observers. |
| 128 void NotifyGattServiceAdded(BluetoothRemoteGattServiceChromeOS* service); | 127 void NotifyGattServiceAdded(BluetoothRemoteGattServiceBlueZ* service); |
| 129 void NotifyGattServiceRemoved(BluetoothRemoteGattServiceChromeOS* service); | 128 void NotifyGattServiceRemoved(BluetoothRemoteGattServiceBlueZ* service); |
| 130 void NotifyGattServiceChanged(BluetoothRemoteGattServiceChromeOS* service); | 129 void NotifyGattServiceChanged(BluetoothRemoteGattServiceBlueZ* service); |
| 131 void NotifyGattDiscoveryComplete(BluetoothRemoteGattServiceChromeOS* service); | 130 void NotifyGattDiscoveryComplete(BluetoothRemoteGattServiceBlueZ* service); |
| 132 void NotifyGattCharacteristicAdded( | 131 void NotifyGattCharacteristicAdded( |
| 133 BluetoothRemoteGattCharacteristicChromeOS* characteristic); | 132 BluetoothRemoteGattCharacteristicBlueZ* characteristic); |
| 134 void NotifyGattCharacteristicRemoved( | 133 void NotifyGattCharacteristicRemoved( |
| 135 BluetoothRemoteGattCharacteristicChromeOS* characteristic); | 134 BluetoothRemoteGattCharacteristicBlueZ* characteristic); |
| 136 void NotifyGattDescriptorAdded( | 135 void NotifyGattDescriptorAdded( |
| 137 BluetoothRemoteGattDescriptorChromeOS* descriptor); | 136 BluetoothRemoteGattDescriptorBlueZ* descriptor); |
| 138 void NotifyGattDescriptorRemoved( | 137 void NotifyGattDescriptorRemoved( |
| 139 BluetoothRemoteGattDescriptorChromeOS* descriptor); | 138 BluetoothRemoteGattDescriptorBlueZ* descriptor); |
| 140 void NotifyGattCharacteristicValueChanged( | 139 void NotifyGattCharacteristicValueChanged( |
| 141 BluetoothRemoteGattCharacteristicChromeOS* characteristic, | 140 BluetoothRemoteGattCharacteristicBlueZ* characteristic, |
| 142 const std::vector<uint8>& value); | 141 const std::vector<uint8>& value); |
| 143 void NotifyGattDescriptorValueChanged( | 142 void NotifyGattDescriptorValueChanged( |
| 144 BluetoothRemoteGattDescriptorChromeOS* descriptor, | 143 BluetoothRemoteGattDescriptorBlueZ* descriptor, |
| 145 const std::vector<uint8>& value); | 144 const std::vector<uint8>& value); |
| 146 | 145 |
| 147 // Returns the object path of the adapter. | 146 // Returns the object path of the adapter. |
| 148 const dbus::ObjectPath& object_path() const { return object_path_; } | 147 const dbus::ObjectPath& object_path() const { return object_path_; } |
| 149 | 148 |
| 150 // Request a profile on the adapter for a custom service with a | 149 // Request a profile on the adapter for a custom service with a |
| 151 // specific UUID for the device at |device_path| to be sent to |delegate|. | 150 // specific UUID for the device at |device_path| to be sent to |delegate|. |
| 152 // If |device_path| is the empty string, incoming connections will be | 151 // If |device_path| is the empty string, incoming connections will be |
| 153 // assigned to |delegate|. When the profile is | 152 // assigned to |delegate|. When the profile is |
| 154 // successfully registered, |success_callback| will be called with a pointer | 153 // successfully registered, |success_callback| will be called with a pointer |
| 155 // to the profile which is managed by BluetoothAdapterChromeOS. On failure, | 154 // to the profile which is managed by BluetoothAdapterBlueZ. On failure, |
| 156 // |error_callback| will be called. | 155 // |error_callback| will be called. |
| 157 void UseProfile(const device::BluetoothUUID& uuid, | 156 void UseProfile(const device::BluetoothUUID& uuid, |
| 158 const dbus::ObjectPath& device_path, | 157 const dbus::ObjectPath& device_path, |
| 159 const bluez::BluetoothProfileManagerClient::Options& options, | 158 const bluez::BluetoothProfileManagerClient::Options& options, |
| 160 bluez::BluetoothProfileServiceProvider::Delegate* delegate, | 159 bluez::BluetoothProfileServiceProvider::Delegate* delegate, |
| 161 const ProfileRegisteredCallback& success_callback, | 160 const ProfileRegisteredCallback& success_callback, |
| 162 const ErrorCompletionCallback& error_callback); | 161 const ErrorCompletionCallback& error_callback); |
| 163 | 162 |
| 164 // Release use of a profile by a device. | 163 // Release use of a profile by a device. |
| 165 void ReleaseProfile(const dbus::ObjectPath& device_path, | 164 void ReleaseProfile(const dbus::ObjectPath& device_path, |
| 166 BluetoothAdapterProfileChromeOS* profile); | 165 BluetoothAdapterProfileBlueZ* profile); |
| 167 | 166 |
| 168 protected: | 167 protected: |
| 169 // BluetoothAdapter: | 168 // BluetoothAdapter: |
| 170 void RemovePairingDelegateInternal( | 169 void RemovePairingDelegateInternal( |
| 171 device::BluetoothDevice::PairingDelegate* pairing_delegate) override; | 170 device::BluetoothDevice::PairingDelegate* pairing_delegate) override; |
| 172 | 171 |
| 173 private: | 172 private: |
| 174 friend class BluetoothChromeOSTest; | 173 friend class BluetoothBlueZTest; |
| 175 friend class BluetoothChromeOSTest_Shutdown_Test; | 174 friend class BluetoothBlueZTest_Shutdown_Test; |
| 176 friend class BluetoothChromeOSTest_Shutdown_OnStartDiscovery_Test; | 175 friend class BluetoothBlueZTest_Shutdown_OnStartDiscovery_Test; |
| 177 friend class BluetoothChromeOSTest_Shutdown_OnStartDiscoveryError_Test; | 176 friend class BluetoothBlueZTest_Shutdown_OnStartDiscoveryError_Test; |
| 178 friend class BluetoothChromeOSTest_Shutdown_OnStopDiscovery_Test; | 177 friend class BluetoothBlueZTest_Shutdown_OnStopDiscovery_Test; |
| 179 friend class BluetoothChromeOSTest_Shutdown_OnStopDiscoveryError_Test; | 178 friend class BluetoothBlueZTest_Shutdown_OnStopDiscoveryError_Test; |
| 180 | 179 |
| 181 // typedef for callback parameters that are passed to AddDiscoverySession | 180 // typedef for callback parameters that are passed to AddDiscoverySession |
| 182 // and RemoveDiscoverySession. This is used to queue incoming requests while | 181 // and RemoveDiscoverySession. This is used to queue incoming requests while |
| 183 // a call to BlueZ is pending. | 182 // a call to BlueZ is pending. |
| 184 typedef std::tuple<device::BluetoothDiscoveryFilter*, | 183 typedef std::tuple<device::BluetoothDiscoveryFilter*, |
| 185 base::Closure, | 184 base::Closure, |
| 186 DiscoverySessionErrorCallback> DiscoveryParamTuple; | 185 DiscoverySessionErrorCallback> DiscoveryParamTuple; |
| 187 typedef std::queue<DiscoveryParamTuple> DiscoveryCallbackQueue; | 186 typedef std::queue<DiscoveryParamTuple> DiscoveryCallbackQueue; |
| 188 | 187 |
| 189 // Callback pair for the profile registration queue. | 188 // Callback pair for the profile registration queue. |
| 190 typedef std::pair<base::Closure, ErrorCompletionCallback> | 189 typedef std::pair<base::Closure, ErrorCompletionCallback> |
| 191 RegisterProfileCompletionPair; | 190 RegisterProfileCompletionPair; |
| 192 | 191 |
| 193 BluetoothAdapterChromeOS(); | 192 BluetoothAdapterBlueZ(); |
| 194 ~BluetoothAdapterChromeOS() override; | 193 ~BluetoothAdapterBlueZ() override; |
| 195 | 194 |
| 196 // bluez::BluetoothAdapterClient::Observer override. | 195 // bluez::BluetoothAdapterClient::Observer override. |
| 197 void AdapterAdded(const dbus::ObjectPath& object_path) override; | 196 void AdapterAdded(const dbus::ObjectPath& object_path) override; |
| 198 void AdapterRemoved(const dbus::ObjectPath& object_path) override; | 197 void AdapterRemoved(const dbus::ObjectPath& object_path) override; |
| 199 void AdapterPropertyChanged(const dbus::ObjectPath& object_path, | 198 void AdapterPropertyChanged(const dbus::ObjectPath& object_path, |
| 200 const std::string& property_name) override; | 199 const std::string& property_name) override; |
| 201 | 200 |
| 202 // bluez::BluetoothDeviceClient::Observer override. | 201 // bluez::BluetoothDeviceClient::Observer override. |
| 203 void DeviceAdded(const dbus::ObjectPath& object_path) override; | 202 void DeviceAdded(const dbus::ObjectPath& object_path) override; |
| 204 void DeviceRemoved(const dbus::ObjectPath& object_path) override; | 203 void DeviceRemoved(const dbus::ObjectPath& object_path) override; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 235 void OnRegisterAgent(); | 234 void OnRegisterAgent(); |
| 236 void OnRegisterAgentError(const std::string& error_name, | 235 void OnRegisterAgentError(const std::string& error_name, |
| 237 const std::string& error_message); | 236 const std::string& error_message); |
| 238 | 237 |
| 239 // Called by dbus:: on completion of the D-Bus method call to request that | 238 // Called by dbus:: on completion of the D-Bus method call to request that |
| 240 // the pairing agent be made the default. | 239 // the pairing agent be made the default. |
| 241 void OnRequestDefaultAgent(); | 240 void OnRequestDefaultAgent(); |
| 242 void OnRequestDefaultAgentError(const std::string& error_name, | 241 void OnRequestDefaultAgentError(const std::string& error_name, |
| 243 const std::string& error_message); | 242 const std::string& error_message); |
| 244 | 243 |
| 245 // Called by BluetoothAudioSinkChromeOS on completion of registering an audio | 244 // Called by BluetoothAudioSinkBlueZ on completion of registering an audio |
| 246 // sink. | 245 // sink. |
| 247 void OnRegisterAudioSink( | 246 void OnRegisterAudioSink( |
| 248 const device::BluetoothAdapter::AcquiredCallback& callback, | 247 const device::BluetoothAdapter::AcquiredCallback& callback, |
| 249 const device::BluetoothAudioSink::ErrorCallback& error_callback, | 248 const device::BluetoothAudioSink::ErrorCallback& error_callback, |
| 250 scoped_refptr<device::BluetoothAudioSink> audio_sink); | 249 scoped_refptr<device::BluetoothAudioSink> audio_sink); |
| 251 | 250 |
| 252 // Internal method to obtain a BluetoothPairingChromeOS object for the device | 251 // Internal method to obtain a BluetoothPairingBlueZ object for the device |
| 253 // with path |object_path|. Returns the existing pairing object if the device | 252 // with path |object_path|. Returns the existing pairing object if the device |
| 254 // already has one (usually an outgoing connection in progress) or a new | 253 // already has one (usually an outgoing connection in progress) or a new |
| 255 // pairing object with the default pairing delegate if not. If no default | 254 // pairing object with the default pairing delegate if not. If no default |
| 256 // pairing object exists, NULL will be returned. | 255 // pairing object exists, NULL will be returned. |
| 257 BluetoothPairingChromeOS* GetPairing(const dbus::ObjectPath& object_path); | 256 BluetoothPairingBlueZ* GetPairing(const dbus::ObjectPath& object_path); |
| 258 | 257 |
| 259 // Set the tracked adapter to the one in |object_path|, this object will | 258 // Set the tracked adapter to the one in |object_path|, this object will |
| 260 // subsequently operate on that adapter until it is removed. | 259 // subsequently operate on that adapter until it is removed. |
| 261 void SetAdapter(const dbus::ObjectPath& object_path); | 260 void SetAdapter(const dbus::ObjectPath& object_path); |
| 262 | 261 |
| 263 // Set the adapter name to one chosen from the system information. | 262 // Set the adapter name to one chosen from the system information. |
| 264 void SetDefaultAdapterName(); | 263 void SetDefaultAdapterName(); |
| 265 | 264 |
| 266 // Remove the currently tracked adapter. IsPresent() will return false after | 265 // Remove the currently tracked adapter. IsPresent() will return false after |
| 267 // this is called. | 266 // this is called. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 const base::Closure& callback, | 322 const base::Closure& callback, |
| 324 const DiscoverySessionErrorCallback& error_callback); | 323 const DiscoverySessionErrorCallback& error_callback); |
| 325 void OnSetDiscoveryFilterError( | 324 void OnSetDiscoveryFilterError( |
| 326 const base::Closure& callback, | 325 const base::Closure& callback, |
| 327 const DiscoverySessionErrorCallback& error_callback, | 326 const DiscoverySessionErrorCallback& error_callback, |
| 328 const std::string& error_name, | 327 const std::string& error_name, |
| 329 const std::string& error_message); | 328 const std::string& error_message); |
| 330 | 329 |
| 331 // Called by dbus:: on completion of the D-Bus method to register a profile. | 330 // Called by dbus:: on completion of the D-Bus method to register a profile. |
| 332 void OnRegisterProfile(const device::BluetoothUUID& uuid, | 331 void OnRegisterProfile(const device::BluetoothUUID& uuid, |
| 333 scoped_ptr<BluetoothAdapterProfileChromeOS> profile); | 332 scoped_ptr<BluetoothAdapterProfileBlueZ> profile); |
| 334 | 333 |
| 335 void SetProfileDelegate( | 334 void SetProfileDelegate( |
| 336 const device::BluetoothUUID& uuid, | 335 const device::BluetoothUUID& uuid, |
| 337 const dbus::ObjectPath& device_path, | 336 const dbus::ObjectPath& device_path, |
| 338 bluez::BluetoothProfileServiceProvider::Delegate* delegate, | 337 bluez::BluetoothProfileServiceProvider::Delegate* delegate, |
| 339 const ProfileRegisteredCallback& success_callback, | 338 const ProfileRegisteredCallback& success_callback, |
| 340 const ErrorCompletionCallback& error_callback); | 339 const ErrorCompletionCallback& error_callback); |
| 341 void OnRegisterProfileError(const device::BluetoothUUID& uuid, | 340 void OnRegisterProfileError(const device::BluetoothUUID& uuid, |
| 342 const std::string& error_name, | 341 const std::string& error_name, |
| 343 const std::string& error_message); | 342 const std::string& error_message); |
| 344 | 343 |
| 345 // Called by BluetoothAdapterProfileChromeOS when no users of a profile | 344 // Called by BluetoothAdapterProfileBlueZ when no users of a profile |
| 346 // remain. | 345 // remain. |
| 347 void RemoveProfile(const device::BluetoothUUID& uuid); | 346 void RemoveProfile(const device::BluetoothUUID& uuid); |
| 348 | 347 |
| 349 // Processes the queued discovery requests. For each DiscoveryParamTuple in | 348 // Processes the queued discovery requests. For each DiscoveryParamTuple in |
| 350 // the queue, this method will try to add a new discovery session. This method | 349 // the queue, this method will try to add a new discovery session. This method |
| 351 // is called whenever a pending D-Bus call to start or stop discovery has | 350 // is called whenever a pending D-Bus call to start or stop discovery has |
| 352 // ended (with either success or failure). | 351 // ended (with either success or failure). |
| 353 void ProcessQueuedDiscoveryRequests(); | 352 void ProcessQueuedDiscoveryRequests(); |
| 354 | 353 |
| 355 // Set in |Shutdown()|, makes IsPresent()| return false. | 354 // Set in |Shutdown()|, makes IsPresent()| return false. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 377 | 376 |
| 378 // Instance of the D-Bus agent object used for pairing, initialized with | 377 // Instance of the D-Bus agent object used for pairing, initialized with |
| 379 // our own class as its delegate. | 378 // our own class as its delegate. |
| 380 scoped_ptr<bluez::BluetoothAgentServiceProvider> agent_; | 379 scoped_ptr<bluez::BluetoothAgentServiceProvider> agent_; |
| 381 | 380 |
| 382 // UI thread task runner and socket thread object used to create sockets. | 381 // UI thread task runner and socket thread object used to create sockets. |
| 383 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 382 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 384 scoped_refptr<device::BluetoothSocketThread> socket_thread_; | 383 scoped_refptr<device::BluetoothSocketThread> socket_thread_; |
| 385 | 384 |
| 386 // The profiles we have registered with the bluetooth daemon. | 385 // The profiles we have registered with the bluetooth daemon. |
| 387 std::map<device::BluetoothUUID, BluetoothAdapterProfileChromeOS*> profiles_; | 386 std::map<device::BluetoothUUID, BluetoothAdapterProfileBlueZ*> profiles_; |
| 388 | 387 |
| 389 // Queue of delegates waiting for a profile to register. | 388 // Queue of delegates waiting for a profile to register. |
| 390 std::map<device::BluetoothUUID, std::vector<RegisterProfileCompletionPair>*> | 389 std::map<device::BluetoothUUID, std::vector<RegisterProfileCompletionPair>*> |
| 391 profile_queues_; | 390 profile_queues_; |
| 392 | 391 |
| 393 scoped_ptr<device::BluetoothDiscoveryFilter> current_filter_; | 392 scoped_ptr<device::BluetoothDiscoveryFilter> current_filter_; |
| 394 | 393 |
| 395 // Note: This should remain the last member so it'll be destroyed and | 394 // Note: This should remain the last member so it'll be destroyed and |
| 396 // invalidate its weak pointers before any other members are destroyed. | 395 // invalidate its weak pointers before any other members are destroyed. |
| 397 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; | 396 base::WeakPtrFactory<BluetoothAdapterBlueZ> weak_ptr_factory_; |
| 398 | 397 |
| 399 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); | 398 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterBlueZ); |
| 400 }; | 399 }; |
| 401 | 400 |
| 402 } // namespace chromeos | 401 } // namespace bluez |
| 403 | 402 |
| 404 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 403 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_BLUEZ_H_ |
| OLD | NEW |