下面是c语言关于引用这个函数的代码,本人对c更是一窍不通,请高手帮忙看看是否可以改写成au3,谢谢!void SDK_BtInquiry()
{
UCHAR ucInqMode = INQUIRY_GENERAL_MODE,
ucInqLen = 15;
BLUETOOTH_DEVICE_INFO lpDevsList[MAX_SERVICE_COUNT] = {0};
DWORD DevsListLen = sizeof(BLUETOOTH_DEVICE_INFO) * MAX_SERVICE_COUNT;
char temp[MAX_PATH]={0};
if(GetPrivateProfileString("BT_INQUIRY_DEVICE", "Inquiry Mode", NULL, temp, MAX_PATH, g_szIniPath)==0){
printf("Get Inquiry Mode Failed!\n");
return;
}
ucInqMode = atoi(temp);
//Get Inquiry Length 0x00-0xFF
if(GetPrivateProfileString("BT_INQUIRY_DEVICE", "Inquiry Length", NULL, temp, MAX_PATH, g_szIniPath)==0){
printf("Get Inquiry Mode Failed!\n");
return;
}
ucInqLen = atoi(temp);
if(ucInqLen=0){
printf("Get Inquiry Mode Failed!\n");
return;
}
BOOL bAsynchronous = GetPrivateProfileInt("BT_INQUIRY_DEVICE", "bAsynchronous",1, g_szIniPath);
DWORD dwResult;
if(bAsynchronous)
DevsListLen = 0;
dwResult = BT_InquireDevices(ucInqMode, ucInqLen, &DevsListLen, lpDevsList);
PrintError("BT_InquireDevices",dwResult);
if(!bAsynchronous && dwResult == BTSTATUS_SUCCESS){
printf("Devices List\n");
DWORD i, offset;
offset = sizeof(BLUETOOTH_DEVICE_INFO);
BLUETOOTH_DEVICE_INFO *pDevice;
for(i=0; i<((DevsListLen)/sizeof(BLUETOOTH_DEVICE_INFO)); i++){
pDevice=(BLUETOOTH_DEVICE_INFO*)((UCHAR*)lpDevsList+i*offset);
printf("Device No.%d\n Device Address: %02X:%02X:%02X:%02X:%02X:%02X\n",
i,
pDevice->address[5],
pDevice->address[4],
pDevice->address[3],
pDevice->address[2],
pDevice->address[1],
pDevice->address[0]);
DWORD dwMask = 0;
BLUETOOTH_DEVICE_INFO_EX devInfo = {0};
memcpy(&devInfo.address, pDevice->address, DEVICE_ADDRESS_LENGTH);
devInfo.dwSize = sizeof(BLUETOOTH_DEVICE_INFO_EX);
devInfo.szName[0]='\0';
dwMask = MASK_DEVICE_NAME;
DWORD dwResult;
dwResult = BT_SetRemoteDeviceInfo(dwMask, &devInfo);
PrintError("BT_SetRemoteDeviceInfo",dwResult);
dwResult = BT_GetRemoteDeviceInfo(dwMask, &devInfo);
PrintError("BT_GetRemoteDeviceInfo",dwResult);
printf(" Device Name: %s\n", devInfo.szName);
PrintDeviceClassInfo(pDevice->classOfDevice);
if(pDevice->bPaired)
printf(" Device Is Paired: Yes\n");
else
printf(" Device Is Paired: No\n");
}
}
}
|