From 84a143aa1b9654e4133cb19016c3a95fbfb57bf2 Mon Sep 17 00:00:00 2001 From: Wei Shuai Date: Tue, 6 Feb 2018 22:30:46 +0800 Subject: tracker/wii: bluetooth auto pair speed optimization --- tracker-wii/wii_camera.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tracker-wii/wii_camera.cpp') diff --git a/tracker-wii/wii_camera.cpp b/tracker-wii/wii_camera.cpp index 0ce7859b..99a1414c 100644 --- a/tracker-wii/wii_camera.cpp +++ b/tracker-wii/wii_camera.cpp @@ -157,6 +157,9 @@ wii_camera_status WIICamera::_pair() if (btdevinfo.fRemembered) { //BluetoothRemoveDevice(&btdevinfo.Address); } + if (btdevinfo.fConnected) { + break; + } WCHAR pwd[6]; pwd[0] = btinfo.address.rgBytes[0]; pwd[1] = btinfo.address.rgBytes[1]; @@ -170,6 +173,7 @@ wii_camera_status WIICamera::_pair() GUID guids[32]; if (ERROR_SUCCESS != BluetoothEnumerateInstalledServices(hbtlist[i], &btdevinfo, &servicecount, guids)) { continue; } if (ERROR_SUCCESS != BluetoothSetServiceState(hbtlist[i], &btdevinfo, &HumanInterfaceDeviceServiceClass_UUID, BLUETOOTH_SERVICE_ENABLE)) { continue; } + break; } while (BluetoothFindNextDevice(hbtdevfd, &btdevinfo)); BluetoothFindDeviceClose(hbtdevfd); } -- cgit v1.2.3