2010-05-12 185 views
2

我想掃描配對的藍牙設備來尋找服務之前執行新設備的發現..獲得藍牙配對設備

的Winsock

有一種方式來獲得配對的藍牙設備?

你能否給我一個樣本?

謝謝!

回答

3

回答我的問題..

HBLUETOOTH_DEVICE_FIND founded_device; 

BLUETOOTH_DEVICE_INFO device_info; 
device_info.dwSize = sizeof(device_info); 

BLUETOOTH_DEVICE_SEARCH_PARAMS search_criteria; 
search_criteria.dwSize = sizeof(BLUETOOTH_DEVICE_SEARCH_PARAMS); 
search_criteria.fReturnAuthenticated = TRUE; 
search_criteria.fReturnRemembered = FALSE; 
search_criteria.fReturnConnected = FALSE; 
search_criteria.fReturnUnknown = FALSE; 
search_criteria.fIssueInquiry = FALSE; 
search_criteria.cTimeoutMultiplier = 0; 

founded_device = BluetoothFindFirstDevice(&search_criteria, &device_info); 

if (founded_device == NULL) 
{ 
    _tprintf(TEXT("Error: \n%s\n"), getErrorMessage(WSAGetLastError(), error)); 
    return -1; 
} 

do 
{ 
    _tprintf(TEXT("founded device: %s\n"), device_info.szName); 

} while (BluetoothFindNextDevice(founded_device, &device_info)); 
return 0;