bogQ Posted January 8, 2015 Share Posted January 8, 2015 can you share that dll, if not publicly maybe to send link in perosnal message? TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
Solution funkey Posted January 8, 2015 Solution Share Posted January 8, 2015 (edited) I've gone a little more specific with targeting the unit, namely selecting the COM port (3) and baud rate (9600). Here is the current code: $DLL = DllOpen("jeti_core.dll") Local $Ret Local $hDevice Local $Close Local $cDevice ; Open Device #0 $Ret = DllCall($DLL,"DWORD", "JETI_OpenCOMDevice", "DWORD", "3", "DWORD", "9600", "DWORD*", $hDevice) $hDevice = $Ret[3] ; Set laser BOOL = 1 DllCall($DLL,"DWORD", "JETI_SetLaserStat", "DWORD", $hDevice, "BOOL", 1) ; Close Device $Close = DllCall($DLL,"DWORD", "JETI_CloseDevice", "DWORD", $hDevice) $cDevice = $Close[1] ; $hDevice gives us 0000000000000000 code which according to Jeti manual = JETI_SUCCESS MsgBox(0,"",Hex($hDevice)) The one thing I'm curious about is $hDevice become the handle? As I find I keep getting 0000000000000015 codes which are "JETI_INVALID_HANDLE" $hDevice is zero. I'm quite sure this means opening the device didn't success. You have to check $Ret[0] (Return value) first to see if handle in $Ret[3] is valid. Edit: Try to use another baudrate because in documentation says 38400, 115200, 921600. Edited January 8, 2015 by funkey Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
hyperjase Posted January 9, 2015 Author Share Posted January 9, 2015 Try... $DLL = DllOpen("jeti_core.dll") $STRUCT = DllStructCreate("DWORD") $CALL = DllCall($DLL, "DWORD", "JETI_GetNumDevices", "DWORD*", DllStructGetPtr($STRUCT)) If Not $CALL[0] Then MsgBox(0, "Num:", DllStructGetData($STRUCT, 1)) DllClose($DLL) Exit EndIf DllClose($DLL) MsgBox(0, "Num:", "Error") Ends up returning zero, thank you also for your assistance, this is a during-work project so only post during working hours. Link to comment Share on other sites More sharing options...
hyperjase Posted January 9, 2015 Author Share Posted January 9, 2015 $hDevice is zero. I'm quite sure this means opening the device didn't success. You have to check $Ret[0] (Return value) first to see if handle in $Ret[3] is valid. Edit: Try to use another baudrate because in documentation says 38400, 115200, 921600. Oddly, setting the baud rate to 921600, I keep having different numbers returned, always 8 digits long but always unique. Link to comment Share on other sites More sharing options...
hyperjase Posted January 9, 2015 Author Share Posted January 9, 2015 (edited) Ah; just thinking, the unique 8 digit number - does that become the "handle" as such? EDIT Doubly weirdly; when I launch the software designed to take readings from the hardware, the unique number becomes zero! Presumably because the hardware is locked to the launched software. Edited January 9, 2015 by hyperjase Link to comment Share on other sites More sharing options...
hyperjase Posted January 9, 2015 Author Share Posted January 9, 2015 Well - thank you everyone for your generous assistance with this, it turns out that setting the baud rate higher works! I only went for 9600 is that is what's set in the COM3 settings. Using the baud rate that the software uses sorts the issue and and I think the unique number does become the unique identifier. Thanks all once again. 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