diff options
author | youngki@chromium.org <youngki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-05 03:37:09 +0000 |
---|---|---|
committer | youngki@chromium.org <youngki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-05 03:37:09 +0000 |
commit | e55a50f5803110f145d3a81173de7f96d5e26302 (patch) | |
tree | 0d0ea32147c5b19336cdc5ca601f097be43fc0b0 /device/bluetooth/bluetooth_device_win.cc | |
parent | c0b1877384ba2e5f7b79ddbf3013b2a69c5e2691 (diff) | |
download | chromium_src-e55a50f5803110f145d3a81173de7f96d5e26302.zip chromium_src-e55a50f5803110f145d3a81173de7f96d5e26302.tar.gz chromium_src-e55a50f5803110f145d3a81173de7f96d5e26302.tar.bz2 |
Implemented BluetoothDeviceWin::ConnectToProfile()
I mostly reused BluetoothServiceRecordWin to implement this method (for now). Even if we deprecate BluetoothServiceRecord, I think we could keep BluetoothServiceRecordWin for Windows platform.
After I submit this I will send out cleanup CLs to delete the unused code.
BUG=229636
Review URL: https://chromiumcodereview.appspot.com/14582010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198350 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device/bluetooth/bluetooth_device_win.cc')
-rw-r--r-- | device/bluetooth/bluetooth_device_win.cc | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/device/bluetooth/bluetooth_device_win.cc b/device/bluetooth/bluetooth_device_win.cc index 7779166..11dc529 100644 --- a/device/bluetooth/bluetooth_device_win.cc +++ b/device/bluetooth/bluetooth_device_win.cc @@ -7,11 +7,11 @@ #include <string> #include "base/basictypes.h" -#include "base/hash.h" #include "base/logging.h" #include "base/memory/scoped_vector.h" #include "base/stringprintf.h" #include "device/bluetooth/bluetooth_out_of_band_pairing_data.h" +#include "device/bluetooth/bluetooth_profile_win.h" #include "device/bluetooth/bluetooth_service_record_win.h" #include "device/bluetooth/bluetooth_socket_win.h" #include "device/bluetooth/bluetooth_task_manager_win.h" @@ -26,7 +26,7 @@ namespace device { BluetoothDeviceWin::BluetoothDeviceWin( const BluetoothTaskManagerWin::DeviceState& state) - : BluetoothDevice(), device_fingerprint_(ComputeDeviceFingerprint(state)) { + : BluetoothDevice() { name_ = state.name; address_ = state.address; bluetooth_class_ = state.bluetooth_class; @@ -197,7 +197,10 @@ void BluetoothDeviceWin::ConnectToProfile( device::BluetoothProfile* profile, const base::Closure& callback, const ErrorCallback& error_callback) { - // TODO(keybuk): implement + if (static_cast<BluetoothProfileWin*>(profile)->Connect(this)) + callback.Run(); + else + error_callback.Run(); } void BluetoothDeviceWin::SetOutOfBandPairingData( @@ -213,27 +216,14 @@ void BluetoothDeviceWin::ClearOutOfBandPairingData( NOTIMPLEMENTED(); } -// static -uint32 BluetoothDeviceWin::ComputeDeviceFingerprint( - const BluetoothTaskManagerWin::DeviceState& state) { - std::string device_string = base::StringPrintf("%s%s%u%s%s%s", - state.name.c_str(), - state.address.c_str(), - state.bluetooth_class, - state.visible ? "true" : "false", - state.connected ? "true" : "false", - state.authenticated ? "true" : "false"); - for (ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>::const_iterator - iter = state.service_record_states.begin(); - iter != state.service_record_states.end(); - ++iter) { - base::StringAppendF(&device_string, - "%s%s%d", - (*iter)->name.c_str(), - (*iter)->address.c_str(), - (*iter)->sdp_bytes.size()); +const BluetoothServiceRecord* BluetoothDeviceWin::GetServiceRecord( + const std::string& uuid) const { + for (ServiceRecordList::const_iterator iter = service_record_list_.begin(); + iter != service_record_list_.end(); + ++iter) { + return *iter; } - return base::Hash(device_string); + return NULL; } } // namespace device |