I am trying to automate CCTV arming on Windows 10 using AutoIt - trying to arm the camera when I am not at home by pinging my phone (Samsung Galaxy S7).
I tried pinging the phone's local IP address, but when it goes to sleep, it stops pinging. I have seen some posts about pinging the Bluetooth address, but I can't find any actual instructions... How can I do it?
31 Answer
You can use DllCall() and the Windows API:Bluetoothand Bluetooth Reference. And take a look here:
To these examples:
#include <WinAPI.au3>
;~
Global Const $hDllBthProps = DllOpen("bthprops.cpl")
Global $phRadio
Global $hFind = _BluetoothFindFirstRadio($phRadio)
MsgBox(0, "", "error: " & @error & @CRLF & "hFind: " & $hFind & @CRLF & "hRadio: " & $phRadio)
_WinAPI_CloseHandle($phRadio)
_BluetoothFindRadioClose($hFind)
Func _BluetoothFindFirstRadio(ByRef $phRadio) Local $tBLUETOOTH_FIND_RADIO_PARAMS = DllStructCreate('DWORD') DllStructSetData($tBLUETOOTH_FIND_RADIO_PARAMS, 1, DllStructGetSize($tBLUETOOTH_FIND_RADIO_PARAMS)) Local $aResult = DllCall($hDllBthProps, "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 ;==>_BluetoothFindFirstRadio
Func _BluetoothFindRadioClose($hBtFind) Local $aResult = DllCall($hDllBthProps, "bool", "BluetoothFindRadioClose", "handle", $hBtFind) If @error Then Return SetError(2, @error, 0) Return SetError($aResult[0] = 0, 0, $aResult[0])
EndFunc ;==>_BluetoothFindRadioClose