diff options
author | keybuk@chromium.org <keybuk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-05 03:32:26 +0000 |
---|---|---|
committer | keybuk@chromium.org <keybuk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-05 03:32:26 +0000 |
commit | 320447d72fca8cbcd8ddef035f47e554a175a32c (patch) | |
tree | 5847508989e52d651ae1d5f92c33540aecf070ed /device/bluetooth/bluetooth_device_win.cc | |
parent | c308f512b3dd5008cf921d575ae669e340815ddf (diff) | |
download | chromium_src-320447d72fca8cbcd8ddef035f47e554a175a32c.zip chromium_src-320447d72fca8cbcd8ddef035f47e554a175a32c.tar.gz chromium_src-320447d72fca8cbcd8ddef035f47e554a175a32c.tar.bz2 |
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
Diffstat (limited to 'device/bluetooth/bluetooth_device_win.cc')
-rw-r--r-- | device/bluetooth/bluetooth_device_win.cc | 29 |
1 files changed, 27 insertions, 2 deletions
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<BluetoothTaskManagerWin::ServiceRecordState>::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_; } |