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