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,14 +642,16 @@ void BluetoothDevice::GetServiceRecordsForConnectCallback( ...@@ -642,14 +642,16 @@ 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) {
scoped_refptr<BluetoothSocket> socket( if ((*i)->uuid() == service_uuid) {
BluetoothSocket::CreateBluetoothSocket(**i)); // If multiple service records are found, use the first one that works.
if (socket.get() != NULL) { scoped_refptr<BluetoothSocket> socket(
callback.Run(socket); BluetoothSocket::CreateBluetoothSocket(**i));
return; if (socket.get() != NULL) {
callback.Run(socket);
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