Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Unified Diff: device/bluetooth/bluetooth_adapter_bluez.h

Issue 1367663002: Add Linux support for the Bluetooth API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor_dbus
Patch Set: rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth_adapter.cc ('k') | device/bluetooth/bluetooth_adapter_bluez.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_adapter_bluez.h
diff --git a/device/bluetooth/bluetooth_adapter_chromeos.h b/device/bluetooth/bluetooth_adapter_bluez.h
similarity index 83%
rename from device/bluetooth/bluetooth_adapter_chromeos.h
rename to device/bluetooth/bluetooth_adapter_bluez.h
index b51e603be7f8f076e09bbaa942afe3b0b5b007a3..a4d66a9e983e47932e4aa8ca8cdb27fa7ad7ae25 100644
--- a/device/bluetooth/bluetooth_adapter_chromeos.h
+++ b/device/bluetooth/bluetooth_adapter_bluez.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_BLUEZ_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_BLUEZ_H_
#include <map>
#include <queue>
@@ -33,17 +33,17 @@ namespace device {
class BluetoothSocketThread;
} // namespace device
-namespace chromeos {
+namespace bluez {
-class BluetoothChromeOSTest;
-class BluetoothAdapterProfileChromeOS;
-class BluetoothDeviceChromeOS;
-class BluetoothPairingChromeOS;
-class BluetoothRemoteGattCharacteristicChromeOS;
-class BluetoothRemoteGattDescriptorChromeOS;
-class BluetoothRemoteGattServiceChromeOS;
+class BluetoothBlueZTest;
+class BluetoothAdapterProfileBlueZ;
+class BluetoothDeviceBlueZ;
+class BluetoothPairingBlueZ;
+class BluetoothRemoteGattCharacteristicBlueZ;
+class BluetoothRemoteGattDescriptorBlueZ;
+class BluetoothRemoteGattServiceBlueZ;
-// The BluetoothAdapterChromeOS class implements BluetoothAdapter for the
+// The BluetoothAdapterBlueZ class implements BluetoothAdapter for the
// Chrome OS platform.
//
// All methods are called from the dbus origin / UI thread and are generally
@@ -52,13 +52,13 @@ class BluetoothRemoteGattServiceChromeOS;
// This class interacts with sockets using the BluetoothSocketThread to ensure
// single-threaded calls, and posts tasks to the UI thread.
//
-// Methods tolerate a shutdown scenario where BluetoothAdapterChromeOS::Shutdown
+// Methods tolerate a shutdown scenario where BluetoothAdapterBlueZ::Shutdown
// causes IsPresent to return false just before the dbus system is shutdown but
-// while references to the BluetoothAdapterChromeOS object still exists.
+// while references to the BluetoothAdapterBlueZ object still exists.
//
// When adding methods to this class verify shutdown behavior in
-// BluetoothChromeOSTest, Shutdown.
-class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
+// BluetoothBlueZTest, Shutdown.
+class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterBlueZ
: public device::BluetoothAdapter,
public bluez::BluetoothAdapterClient::Observer,
public bluez::BluetoothDeviceClient::Observer,
@@ -67,7 +67,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
public:
typedef base::Callback<void(const std::string& error_message)>
ErrorCompletionCallback;
- typedef base::Callback<void(BluetoothAdapterProfileChromeOS* profile)>
+ typedef base::Callback<void(BluetoothAdapterProfileBlueZ* profile)>
ProfileRegisteredCallback;
static base::WeakPtr<BluetoothAdapter> CreateAdapter();
@@ -112,36 +112,35 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
// Locates the device object by object path (the devices map and
// BluetoothDevice methods are by address).
- BluetoothDeviceChromeOS* GetDeviceWithPath(
- const dbus::ObjectPath& object_path);
+ BluetoothDeviceBlueZ* GetDeviceWithPath(const dbus::ObjectPath& object_path);
// Announces to observers a change in device state that is not reflected by
// its D-Bus properties. |device| is owned by the caller and cannot be NULL.
- void NotifyDeviceChanged(BluetoothDeviceChromeOS* device);
+ void NotifyDeviceChanged(BluetoothDeviceBlueZ* device);
// Announce to observers a device address change.
- void NotifyDeviceAddressChanged(BluetoothDeviceChromeOS* device,
+ void NotifyDeviceAddressChanged(BluetoothDeviceBlueZ* device,
const std::string& old_address);
// The following methods are used to send various GATT observer events to
// observers.
- void NotifyGattServiceAdded(BluetoothRemoteGattServiceChromeOS* service);
- void NotifyGattServiceRemoved(BluetoothRemoteGattServiceChromeOS* service);
- void NotifyGattServiceChanged(BluetoothRemoteGattServiceChromeOS* service);
- void NotifyGattDiscoveryComplete(BluetoothRemoteGattServiceChromeOS* service);
+ void NotifyGattServiceAdded(BluetoothRemoteGattServiceBlueZ* service);
+ void NotifyGattServiceRemoved(BluetoothRemoteGattServiceBlueZ* service);
+ void NotifyGattServiceChanged(BluetoothRemoteGattServiceBlueZ* service);
+ void NotifyGattDiscoveryComplete(BluetoothRemoteGattServiceBlueZ* service);
void NotifyGattCharacteristicAdded(
- BluetoothRemoteGattCharacteristicChromeOS* characteristic);
+ BluetoothRemoteGattCharacteristicBlueZ* characteristic);
void NotifyGattCharacteristicRemoved(
- BluetoothRemoteGattCharacteristicChromeOS* characteristic);
+ BluetoothRemoteGattCharacteristicBlueZ* characteristic);
void NotifyGattDescriptorAdded(
- BluetoothRemoteGattDescriptorChromeOS* descriptor);
+ BluetoothRemoteGattDescriptorBlueZ* descriptor);
void NotifyGattDescriptorRemoved(
- BluetoothRemoteGattDescriptorChromeOS* descriptor);
+ BluetoothRemoteGattDescriptorBlueZ* descriptor);
void NotifyGattCharacteristicValueChanged(
- BluetoothRemoteGattCharacteristicChromeOS* characteristic,
+ BluetoothRemoteGattCharacteristicBlueZ* characteristic,
const std::vector<uint8>& value);
void NotifyGattDescriptorValueChanged(
- BluetoothRemoteGattDescriptorChromeOS* descriptor,
+ BluetoothRemoteGattDescriptorBlueZ* descriptor,
const std::vector<uint8>& value);
// Returns the object path of the adapter.
@@ -152,7 +151,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
// If |device_path| is the empty string, incoming connections will be
// assigned to |delegate|. When the profile is
// successfully registered, |success_callback| will be called with a pointer
- // to the profile which is managed by BluetoothAdapterChromeOS. On failure,
+ // to the profile which is managed by BluetoothAdapterBlueZ. On failure,
// |error_callback| will be called.
void UseProfile(const device::BluetoothUUID& uuid,
const dbus::ObjectPath& device_path,
@@ -163,7 +162,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
// Release use of a profile by a device.
void ReleaseProfile(const dbus::ObjectPath& device_path,
- BluetoothAdapterProfileChromeOS* profile);
+ BluetoothAdapterProfileBlueZ* profile);
protected:
// BluetoothAdapter:
@@ -171,12 +170,12 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
device::BluetoothDevice::PairingDelegate* pairing_delegate) override;
private:
- friend class BluetoothChromeOSTest;
- friend class BluetoothChromeOSTest_Shutdown_Test;
- friend class BluetoothChromeOSTest_Shutdown_OnStartDiscovery_Test;
- friend class BluetoothChromeOSTest_Shutdown_OnStartDiscoveryError_Test;
- friend class BluetoothChromeOSTest_Shutdown_OnStopDiscovery_Test;
- friend class BluetoothChromeOSTest_Shutdown_OnStopDiscoveryError_Test;
+ friend class BluetoothBlueZTest;
+ friend class BluetoothBlueZTest_Shutdown_Test;
+ friend class BluetoothBlueZTest_Shutdown_OnStartDiscovery_Test;
+ friend class BluetoothBlueZTest_Shutdown_OnStartDiscoveryError_Test;
+ friend class BluetoothBlueZTest_Shutdown_OnStopDiscovery_Test;
+ friend class BluetoothBlueZTest_Shutdown_OnStopDiscoveryError_Test;
// typedef for callback parameters that are passed to AddDiscoverySession
// and RemoveDiscoverySession. This is used to queue incoming requests while
@@ -190,8 +189,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
typedef std::pair<base::Closure, ErrorCompletionCallback>
RegisterProfileCompletionPair;
- BluetoothAdapterChromeOS();
- ~BluetoothAdapterChromeOS() override;
+ BluetoothAdapterBlueZ();
+ ~BluetoothAdapterBlueZ() override;
// bluez::BluetoothAdapterClient::Observer override.
void AdapterAdded(const dbus::ObjectPath& object_path) override;
@@ -242,19 +241,19 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
void OnRequestDefaultAgentError(const std::string& error_name,
const std::string& error_message);
- // Called by BluetoothAudioSinkChromeOS on completion of registering an audio
+ // Called by BluetoothAudioSinkBlueZ on completion of registering an audio
// sink.
void OnRegisterAudioSink(
const device::BluetoothAdapter::AcquiredCallback& callback,
const device::BluetoothAudioSink::ErrorCallback& error_callback,
scoped_refptr<device::BluetoothAudioSink> audio_sink);
- // Internal method to obtain a BluetoothPairingChromeOS object for the device
+ // Internal method to obtain a BluetoothPairingBlueZ object for the device
// with path |object_path|. Returns the existing pairing object if the device
// already has one (usually an outgoing connection in progress) or a new
// pairing object with the default pairing delegate if not. If no default
// pairing object exists, NULL will be returned.
- BluetoothPairingChromeOS* GetPairing(const dbus::ObjectPath& object_path);
+ BluetoothPairingBlueZ* GetPairing(const dbus::ObjectPath& object_path);
// Set the tracked adapter to the one in |object_path|, this object will
// subsequently operate on that adapter until it is removed.
@@ -330,7 +329,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
// Called by dbus:: on completion of the D-Bus method to register a profile.
void OnRegisterProfile(const device::BluetoothUUID& uuid,
- scoped_ptr<BluetoothAdapterProfileChromeOS> profile);
+ scoped_ptr<BluetoothAdapterProfileBlueZ> profile);
void SetProfileDelegate(
const device::BluetoothUUID& uuid,
@@ -342,7 +341,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
const std::string& error_name,
const std::string& error_message);
- // Called by BluetoothAdapterProfileChromeOS when no users of a profile
+ // Called by BluetoothAdapterProfileBlueZ when no users of a profile
// remain.
void RemoveProfile(const device::BluetoothUUID& uuid);
@@ -384,7 +383,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
scoped_refptr<device::BluetoothSocketThread> socket_thread_;
// The profiles we have registered with the bluetooth daemon.
- std::map<device::BluetoothUUID, BluetoothAdapterProfileChromeOS*> profiles_;
+ std::map<device::BluetoothUUID, BluetoothAdapterProfileBlueZ*> profiles_;
// Queue of delegates waiting for a profile to register.
std::map<device::BluetoothUUID, std::vector<RegisterProfileCompletionPair>*>
@@ -394,11 +393,11 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothAdapterBlueZ> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterBlueZ);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_BLUEZ_H_
« no previous file with comments | « device/bluetooth/bluetooth_adapter.cc ('k') | device/bluetooth/bluetooth_adapter_bluez.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698