Commit ee2bd71c authored by bryeung@chromium.org's avatar bryeung@chromium.org

Fix Bluetooth Connect API.

We weren't checking the UUID in the returned service records list, so we
would always connect to the first device in the list.

BUG=none
TEST=manually


Review URL: https://chromiumcodereview.appspot.com/10829391

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152385 0039d316-1c4b-4281-b951-d872f2087c98
parent 27077a29
...@@ -642,9 +642,10 @@ void BluetoothDevice::GetServiceRecordsForConnectCallback( ...@@ -642,9 +642,10 @@ void BluetoothDevice::GetServiceRecordsForConnectCallback(
const std::string& service_uuid, const std::string& service_uuid,
const SocketCallback& callback, const SocketCallback& callback,
const ServiceRecordList& list) { const ServiceRecordList& list) {
// If multiple service records are found, use the first one that works.
for (ServiceRecordList::const_iterator i = list.begin(); for (ServiceRecordList::const_iterator i = list.begin();
i != list.end(); ++i) { i != list.end(); ++i) {
if ((*i)->uuid() == service_uuid) {
// If multiple service records are found, use the first one that works.
scoped_refptr<BluetoothSocket> socket( scoped_refptr<BluetoothSocket> socket(
BluetoothSocket::CreateBluetoothSocket(**i)); BluetoothSocket::CreateBluetoothSocket(**i));
if (socket.get() != NULL) { if (socket.get() != NULL) {
...@@ -652,6 +653,7 @@ void BluetoothDevice::GetServiceRecordsForConnectCallback( ...@@ -652,6 +653,7 @@ void BluetoothDevice::GetServiceRecordsForConnectCallback(
return; return;
} }
} }
}
callback.Run(NULL); callback.Run(NULL);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment