Jump to content

BigMac121263

Members
  • Posts

    3
  • Joined

  • Last visited

BigMac121263's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. 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 ***************************
  2. I know that this theme was discussed several times but I read all These threats with no helping result. I have two pieces of TEMPer1F USB Thermometer. It is a Standard Windows HID device with no add. Driver needed. With the device I got an App reading from it and showing Graphs and much more and which can handle several devices. With the Software came also a RDingUSB.dll file handling the communication with the device. I can call the dll without any error. But the Problem is how to Access the device using the DLL and Access more than one of same VID/PID by Serial or anything else useful. I have also sources in c# doing the Job, but no experience in C# to successfuly port it to AutoIT. So my question: Can anyone help me to realize the simple pull of the temperature value from the devices based on C# source? The rest to write it to MySQL DB and repeat it etc. is no Problem for me. *************************************** The C# part with the DLL functions class: *************************************** using System; using System.Runtime.InteropServices; namespace TEMPer { internal class RDing { [DllImport("RDingUSB.dll")] public static extern IntPtr OpenUSBDevice(int VID, int PID); [DllImport("RDingUSB.dll")] public static extern IntPtr CloseUSBDevice(IntPtr hDevice); [DllImport("RDingUSB.dll")] public static extern bool WriteUSB(IntPtr hDevice, byte[] pBuffer, uint dwBytesToWrite, ref ulong lpNumberOfBytesWritten); [DllImport("RDingUSB.dll")] public static extern bool ReadUSB(IntPtr hDevice, byte[] pBuffer, uint dwBytesToRead, ref ulong lpNumberOfBytesRead); [DllImport("RDingUSB.dll")] public static extern ushort GetInputLength(IntPtr hDevice); [DllImport("RDingUSB.dll")] public static extern ushort GetOutputLength(IntPtr hDevice); [DllImport("RDingUSB.dll")] public static extern uint GetErrorMsg(ref string[] lpErrorMsg, uint dwErrorMsgSize); } } ********************************* The C# code snippet working with the functions of the class above is in the attachment this is the interesting part where the data is sent and pulled which I do not understand to transcode to AutoIT Important my devices are the type2 (TEMPer1F) : ********************************* So in the end I Need: Call DLL, read all devices in array Loop the Array until ubound(Array) and for each device in Array read the temperature value and prepare the data to decimal 6,1 (SQL Format) and °C So how to pull the value from the devices? Maybe somwbody finds the important part in the C# (the code above is for different models, mine is TEMPer1F Or maybe someone has solved this and has maybe a uDF for this MainForm.cs
  3. I am working on a small App for Managing Downloads from PHP site The Environment is done (Buttons etc.) 1. Action should be: Button click starting a lookup (lookup.php) by sending two or three vars to the php (userID, Action, pass) PHP Responses with three different states: error, new, or empty and if 'new' an 2dimensional Array (songlist) I tried with using <WinHttp.au3> and getting only the PHP site header but this I do not need 2. Action clicking on download but in songlist, when I have any Connenction to second php site sending id for download and userId, action and pass again Response will be a download-file via Header function and in some cases 2 files 3. Action create an XML file for exporting the downloaded file names for Import to a media player The Basic Idea is, to give the user the poss to look for new sons and download if there a´re any and Import to database of player Please excuse my english and I am working with AutoIT since three days now PreKnowledge: PHP, VBS, CMD, MySQL, VBA, JS, and a few Pascal Are There any codesnippet I can use or somebody who did this in the past in a simila project
×
×
  • Create New...