What I have for now is scanning for the devices using WMI and write the deviceID's to array
So net step is how to open the device and send data, and receive data.
What I understand from the code is, that it sends array of 9 byte and receives array with 9 bytes.
first it has to send 9 byte with settings for getting the calibration data and next the 9 byte to get the temperature value
and this is as I understand in byte 7 and 8 as byte and has to be converted to INT and then calcualted with the converted calibration value to get the
correct temp-values.
But how can this be done. Anyone experiences with communication with USB HID devices?
My actual code:
**********************************
#include <GUIConstantsEx.au3>
#include <Array.au3>
#include <Math.au3>
#include <Date.au3>
#include <Misc.au3>
#include <StructureConstants.au3>
#Include <WinAPI.au3>
#include <RawInput.au3>
$temp1 = 0;
$temp2 = 0;
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
;$readCalibCmd = new byte[] ( ................................?);
$readTemperCmd = new byte[] ( 0, 1, 0x80, 0x33, 1, 0, 0, 0, 0 );
$writeDataCmd = new byte[] ( 0, 1, 0x81, 0x55, 1, 0, 0, 0, 0 );
Global Const $SP_DEV_BUF = "byte[9]";
hotkeyset("{Esc}","Terminate")
Func Terminate()
Exit 0
EndFunc ;==>Terminat
$stringDevices = "";
Local $vObjWMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
$vObjItem = $vObjWMI.ExecQuery("SELECT * FROM Win32_PnPEntity WHERE DeviceID LIKE '%VID_0C45&PID_7401\\%' ","WQL",$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
;MsgBox(0, "Fehler", @error);
If IsObj($vObjItem) then
For $objItem In $vObjItem
;here has to be what I need
;$calibValArray = array.....
;tempValArray = array.....
;CalculTION OF CORRECT TEMPERATURE VALUE BASED ON CALIBRATION AND TEMPERATURE DATA
$stringDevices = $stringDevices & $objItem.DeviceID & @CRLF;
Next
Msgbox(1,"TEMPER1F Geräte",$stringDevices); Actually shows up all found devices with the VID/PID and suppressed NULL Devices/Interfaces
Endif
***************************