Wickedlasers / laserdocklib

client library to connect to laserdock
GNU Lesser General Public License v3.0
28 stars 8 forks source link

Question - LaserDock Dongle (and specifications) #12

Open doug62 opened 3 years ago

doug62 commented 3 years ago

Looks like this is a c++ wrapper for talking to USB and sending proprietary commands to have Dongle emit ILDA - correct? I am a C# developer, I would prefer to write those commands directly from C#, is there schema/specifications for what to write to USB to avoid having to compile/link this c++ for my C#? Ultimately I'm exposing a JSON/API endpoint - Implementation suggestions most welcome (Thanks)

tgreiser commented 3 years ago

Yes, this is the C++ reference driver for LaserDock. Wrapping this DLL would probably be the more direct way, otherwise you are porting all this code to C#. Most of the relevant libusb code for the protocol is here: https://github.com/Wickedlasers/laserdocklib/blob/master/lib/src/LaserdockDevice.cpp

If you want a Windows DLL that I precompiled you can download one here: https://github.com/Wickedlasers/Laser_OS_TouchDesigner/blob/main/TouchDesigner/Plugins/Laser%20OS%20v0.0.3/laserdocklib.dll

doug62 commented 3 years ago

@tgreiser Thanks ever so much for your assistance, I'm using VS Studio most recent version, I can open the CMakeList.txt and it shows up, I had to move a .dll into a path but now it "runs" but fails, unable to step through code, any tips, defines, environmental parameters, or dare i say project/solution files? Ultimately i wish to create a c# wrapper and http/API endpoint to control the laser. (thanks) - btw - this is a great product, worked with your GUI right off the bat.

doug62 commented 3 years ago

@tgreiser Actually - After reviewing the code, all i need to do is set laser color/intensity and then direct vectors point to point with timing, perhaps curves - is there a simple set of commands for the dongle? (thanks)

tgreiser commented 3 years ago

You probably want to wrap these methods:

LaserdockDeviceManager: getInstance, get_next_available_device LaserdockDevice: set_dac_rate, clear_ringbuffer, enable_output, get_output, send_samples, float_to_laserdock_xy

Here is a basic example of drawing a circle with laserdocklib. https://github.com/Wickedlasers/laserdocklib/blob/master/tests/laserdocklibcircle.cpp

doug62 commented 3 years ago

@tgreiser Thanks, I just edited this note, originally asked for more doc on the USB protocol but I was able to reverse engineer from code - thanks very much. I will be creating an http/api/core/c#/docker solution that will run on pc/raspberry - you are welcome to it if you wish.