Что нового

Ищется компонента для работы с Bluetooth

El Panda

Продвинутый
Сообщения
101
Репутация
59
Давно ищу компоненту для работы с Bluetooth девайсами из под AutoIt, пока безуспешно :(
За рабочую компоненту с примерами, готов заплатить ;)
 

ynbIpb

Скриптер
Сообщения
399
Репутация
110
нарыл на pastebin кусочек (не проверял)
Код:
#include <WinAPI.au3>
 
Func _BluetoothFindFirstDevice($REMEMBER = False)
Local $HRESULT[3], $tBLUETOOTH_DEVICE_INFO
$tBLUETOOTH_DEVICE_SEARCH_PARAMS = DllStructCreate('DWORD;BOOL;BOOL;BOOL;BOOL;BOOL;BYTE;HANDLE')
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 1 , DllStructGetSize($tBLUETOOTH_DEVICE_SEARCH_PARAMS))
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 2 , False)
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 3 , $REMEMBER)
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 4 , True)
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 5 , True)
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 6 , True)
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 7 , 6)
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 8 , 0)
$tBLUETOOTH_DEVICE_INFO = DllStructCreate('DWORD;UINT64;ULONG;BOOL;BOOL;BOOL;word[8];word[8];WCHAR[248]')
DllStructSetData($tBLUETOOTH_DEVICE_INFO,1,DllStructGetSize($tBLUETOOTH_DEVICE_INFO))
$RESULT = DllCall("bthprops.cpl", "handle", "BluetoothFindFirstDevice", "struct*", $tBLUETOOTH_DEVICE_SEARCH_PARAMS, "struct*", $tBLUETOOTH_DEVICE_INFO)
$HRESULT[0] = DllStructGetData($tBLUETOOTH_DEVICE_INFO, 9)
$HRESULT[1] = DllStructGetData($tBLUETOOTH_DEVICE_INFO, 2)
$HRESULT[2] = DllStructGetData($tBLUETOOTH_DEVICE_INFO, 3)
Do
$ULTRA = _BluetoothFindNextDevice($RESULT[0])
until $ULTRA = "0"
Return $HRESULT
EndFunc
 
Func _BluetoothFindFirstRadio(ByRef $phRadio)
$tBLUETOOTH_FIND_RADIO_PARAMS = DllStructCreate('DWORD')
DllStructSetData($tBLUETOOTH_FIND_RADIO_PARAMS, 1 , DllStructGetSize($tBLUETOOTH_FIND_RADIO_PARAMS))
$aResult = DllCall("bthprops.cpl", "handle", "BluetoothFindFirstRadio", "struct*", $tBLUETOOTH_FIND_RADIO_PARAMS, "handle*", 0)
If @error Then Return SetError(2, @error, 0)
$phRadio = $aResult[2]
Return SetError($aResult[0] = 0, 0, $aResult[0])
EndFunc
 
Func _BluetoothFindRadioClose($hBtFind)
Local $aResult = DllCall("bthprops.cpl", "bool", "BluetoothFindRadioClose", "handle", $hBtFind)
If @error Then Return SetError(2, @error, 0)
Return SetError($aResult[0] = 0, 0, $aResult[0])
EndFunc
 
Func _BluetoothFindNextDevice($HANDLE)
$t1BLUETOOTH_DEVICE_INFO = DllStructCreate('DWORD;UINT64;ULONG;BOOL;BOOL;BOOL;word[8];word[8];WCHAR[248]')
$RESULTX = DllCall("bthprops.cpl", "Bool", "BluetoothFindNextDevice", "handle", $HANDLE, "struct*", $t1BLUETOOTH_DEVICE_INFO)
Return $RESULTX[0]
EndFunc
 
Func _BluetoothRegisterForAuthenticationEx()
Local $ZRESULT, $tBLUETOOTH_DEVICE_REG
$tBLUETOOTH_DEVICE_REG = DllStructCreate('DWORD;UINT64;ULONG;BOOL;BOOL;BOOL;word[8];word[8];WCHAR[248]')
DllStructSetData($tBLUETOOTH_DEVICE_REG,1,DllStructGetSize($tBLUETOOTH_DEVICE_REG))
DllStructSetData($tBLUETOOTH_DEVICE_REG, 2 , 560)
DllStructSetData($tBLUETOOTH_DEVICE_REG, 3 , 550377916751)
DllStructSetData($tBLUETOOTH_DEVICE_REG, 4 , 9600)
DllStructSetData($tBLUETOOTH_DEVICE_REG, 5 , False)
DllStructSetData($tBLUETOOTH_DEVICE_REG, 6 , False)
DllStructSetData($tBLUETOOTH_DEVICE_REG, 7 , False)
$ZRESULT = DllCall("bthprops.cpl", "handle", "BluetoothRegisterForAuthenticationEx", "struct*",  $tBLUETOOTH_DEVICE_REG, "handle*", 0)
Return $ZRESULT
EndFunc
 

Бублик2010

Новичок
Сообщения
14
Репутация
0
Рассматривал варианты как rapoo bluetooth mouse? которая "тупила" и "отваливалась" на Windows8.1, "прикрутить обратно". Включил две службы поддержки Bluetooch, не помогло. Надоело вручную переходить в панель bthprops.cpl , "удалять" и "коннектиться" снова и снова.

Вариант1 , командная строка
Код:
"BTHCxn.exe -nServerDevice -c50"

Вариант2, манипуляция с командной панелью, копипаст
Код:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Bluetooth Manager (just something)", 409, 135, 192, 124)
$Label1 = GUICtrlCreateLabel("This script will check if your PC is bluetooth enabled.", 8, 8, 368, 17)
$Button1 = GUICtrlCreateButton("Check if device present", 112, 48, 171, 25, $WS_GROUP)
$Checkbox1 = GUICtrlCreateCheckbox("Disable Discovery for all Bluetooth Devices on PC", 16, 96, 257, 17)
$Button2 = GUICtrlCreateButton("Exit", 312, 96, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$RESULT = DllCall("bthprops.cpl", "Bool", "BluetoothEnableIncomingConnections", "Handle", 0, "Bool", 1)
If $RESULT[0] = 1 then
msgbox(64, "Message", "Congrats! Your Computer is bluetooth enabled.")
    else
    msgbox(16, "", "No device found")
EndIf
Case $Checkbox1
If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) Then
                $RESULT = DllCall("bthprops.cpl", "Bool", "BluetoothEnableDiscovery", "Handle", 0, "Bool", 0)
                msgbox(64, "", "Discovery Disabled.")
            Else
                $RESULT = DllCall("bthprops.cpl", "Bool", "BluetoothEnableDiscovery", "Handle", 0, "Bool", 1)
                msgbox(64, "", "Discovery Enabled.")
            EndIf
Case $Button2
Exit
EndSwitch
WEnd

Вариант3 , показался удобнее, скопипастил
How to Disable or Enable Bluetooth Devices from the command line
================================================================


Andrew Sharrad 4/7/13

1. Download the Devcon package - http://support.microsoft.com/kb/311272 to your desktop or downloads folder.

2. Extract the Devcon package by double clicking on the download. Extract the files to a sub folder called "devcon extracted". Then copy the "devcon.exe" file from the i386 subfolder inside "devcon extracted".

3. Paste the devcon.exe file into a new working folder called "BT utilities"

4. Copy the enable_BT.cmd and disable_BT.CMD files into "BT utilities"

5. Modify the enable_BT.cmd and disable_BT.cmd files to include any additional device IDs that you might need.

6. Make the "BT utilities" folder available over the network, and test it.

7. You may be able to deploy this utility using group policy but bear in mind that any device manager operations, including those called by the Devcon utility, will require Administrative rights.

Enable

Код:
@echo off
set source=%~dp0
if "%source%x"=="x" set source=.\
rem disable Intel 2230, 6235, 135, 1030, 6230, 130 wireless adapter bluetooth controllers below
"%source%devcon" Enable "USB\VID_0A12&PID_0001" >NUL 2>&1
"%source%devcon" Enable "USB\VID_8086&PID_0189" >NUL 2>&1
"%source%devcon" Enable "USB\VID_8087&PID_07DA" >NUL 2>&1
rem add your devices below
rem "%source%devcon" Enable"device ID goes here" >NUL 2>&1

Disable

Код:
@echo off
set source=%~dp0
if "%source%x"=="x" set source=.\
rem disable Intel 2230, 6235, 135, 1030, 6230, 130 wireless adapter bluetooth controllers below
"%source%devcon" Disable "USB\VID_0A12&PID_0001" >NUL 2>&1
"%source%devcon" Disable "USB\VID_8086&PID_0189" >NUL 2>&1
"%source%devcon" Disable "USB\VID_8087&PID_07DA" >NUL 2>&1
rem add your devices below
rem "%source%devcon" Disable "device ID goes here" >NUL 2>&1
 

Yashied

Модератор
Команда форума
Глобальный модератор
Сообщения
5,379
Репутация
2,724
Вы бы хоть на дату последнего поста смотрели.
 

VadimKHL

Новичок
Сообщения
155
Репутация
0
Добрый день!
Удалось решить данную проблему?
 
Верх