redpicker Posted October 14, 2016 Share Posted October 14, 2016 I a not sure this is even possible. I want to write a script that will connect to my BBQ thermometer, which is bluetooth enabled, and log the temperatures in an Excel file. I have done some scripts with AutoIt, and I am comfortable creating and writing the data to the excel file, but I am not sure how to connect to the bluetooth device and receive the data. There are Android Apps that receive the data on my cell phone, but I want to do it to my laptop. Is this even possible? If so, could someone point me in the right direction, I couldn't find a BlueTooth UDF. Is there one? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 14, 2016 Moderators Share Posted October 14, 2016 It would be a question for the manufacturer. Do they have an API for windows, or was it written specifically for Android? Even the Android app, is it open source? In other words, do they want you messing around with their code. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
genius257 Posted October 14, 2016 Share Posted October 14, 2016 (edited) It may be possible. If you could pair the thermometer with your pc and you can make sense of the data you receive. If you know android/java, you could just download the android APK file and look at the code. 16 hours ago, redpicker said: I couldn't find a BlueTooth UDF. Is there one? Googled Bluetooth UDF and 1st and 4th result was: Bluetooth Detector/Switching Script and Bluetooth UDF!!! Edited October 14, 2016 by genius257 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
redpicker Posted October 15, 2016 Author Share Posted October 15, 2016 On 10/14/2016 at 11:21 AM, genius257 said: It may be possible. If you could pair the thermometer with your pc and you can make sense of the data you receive. If you know android/java, you could just download the android APK file and look at the code. Googled Bluetooth UDF and 1st and 4th result was: Bluetooth Detector/Switching Script and Bluetooth UDF!!! I appreciate the reply. For anyone following, the first link is for a script to detect bluetooth devices, no UDF for sending or receiving data. The second link is in German. Per JLogan's post, I sent an e-mail to the manufacturer and they are not interested in helping me. My best bet seems to be to build my own and use an Arduino UNO board for communication. Link to comment Share on other sites More sharing options...
genius257 Posted October 15, 2016 Share Posted October 15, 2016 1 minute ago, redpicker said: The second link is in German. The last comment in link is a code example with Bluetooth calls. Just to give you a starting point here's the code extracted from Christoph54 on autoit.de: expandcollapse popup#include <WinAPI.au3> Local $phRadio $hFind = _BluetoothFindFirstRadio($phRadio) If $hFind = 0 Then MsgBox(16, "Hardware error", "Unable to find compatible bluetooth radio(s) on this machine.") _WinAPI_CloseHandle($phRadio) _BluetoothFindRadioClose($hFind) Exit Else _WinAPI_CloseHandle($phRadio) _BluetoothFindRadioClose($hFind) EndIf _BluetoothFindFirstDevice() Sleep(10000) _BluetoothRegisterForAuthenticationEx() 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 ;==>_BluetoothFindFirstDevice 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 ;==>_BluetoothFindFirstRadio 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 ;==>_BluetoothFindRadioClose 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 ;==>_BluetoothFindNextDevice 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 ;==>_BluetoothRegisterForAuthenticationEx Muhammad_Awais_Sharif 1 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
redpicker Posted October 15, 2016 Author Share Posted October 15, 2016 Cool! I guess the German just blinded me. This is good. It may take a while, but I might be able to get into it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now