Search the Community
Showing results for tags 'usbhidapi'.
-
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