From 320447d72fca8cbcd8ddef035f47e554a175a32c Mon Sep 17 00:00:00 2001 From: "keybuk@chromium.org" Date: Fri, 5 Apr 2013 03:32:26 +0000 Subject: Bluetooth: clean up Bluetooth classes The abstract BluetoothDevice class has a few problems inherited from its origin as a ChromeOS-specific class split between implementation and platform-specific components. Clean those problems up, specifically: - replace bluetooth_class_, name_ and address_ non-abstract members with getter functions that the platform should implement. - also make IsConnected(), IsConnectable() and IsConnecting() abstract functions rather than providing an implementation - remove IsVisible() which was a CrOS-specific hack - remove IsBonded(), use IsPaired() instead - remove service_uuids_ non-abstract member; make GetServices return a copy of the list to allow implementations to fetch it on demand BluetoothDevice retains implementations for GetName(), GetDisplayType() and ProvidesServiceWithUUID() since those can be implemented entirely using platform-provided information functions and would be identical in each platform. Also rename BluetoothAdapter::address() and BluetoothAdapter::name() to GetAddress() and GetName() to match since they are also pure virtual. BUG=none TEST=device_unittests, browser_tests, unit_tests Review URL: https://chromiumcodereview.appspot.com/13416005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192474 0039d316-1c4b-4281-b951-d872f2087c98 --- device/bluetooth/bluetooth_device_win.cc | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'device/bluetooth/bluetooth_device_win.cc') diff --git a/device/bluetooth/bluetooth_device_win.cc b/device/bluetooth/bluetooth_device_win.cc index c06693f..22f51de 100644 --- a/device/bluetooth/bluetooth_device_win.cc +++ b/device/bluetooth/bluetooth_device_win.cc @@ -30,8 +30,9 @@ BluetoothDeviceWin::BluetoothDeviceWin( name_ = state.name; address_ = state.address; bluetooth_class_ = state.bluetooth_class; + visible_ = state.visible; connected_ = state.connected; - bonded_ = state.authenticated; + paired_ = state.authenticated; for (ScopedVector::const_iterator iter = state.service_record_states.begin(); @@ -58,11 +59,35 @@ void BluetoothDeviceWin::SetVisible(bool visible) { visible_ = visible; } +uint32 BluetoothDeviceWin::GetBluetoothClass() const { + return bluetooth_class_; +} + +std::string BluetoothDeviceWin::GetDeviceName() const { + return name_; +} + +std::string BluetoothDeviceWin::GetAddress() const { + return address_; +} + bool BluetoothDeviceWin::IsPaired() const { + return paired_; +} + +bool BluetoothDeviceWin::IsConnected() const { + return connected_; +} + +bool BluetoothDeviceWin::IsConnectable() const { + return false; +} + +bool BluetoothDeviceWin::IsConnecting() const { return false; } -const BluetoothDevice::ServiceList& BluetoothDeviceWin::GetServices() const { +BluetoothDevice::ServiceList BluetoothDeviceWin::GetServices() const { return service_uuids_; } -- cgit v1.1