Control flash system from a c++ program - c++

I'm currently building a c++ program (with Qt) to take picture from a camera device. This part is actualy done, now I need to control 8 flashs divided in two groups in an automatic way.
The flash I already use are from ELINCHROM http://www.elinchrom.com/ and this device seems to be perfect for what I need but I could not find anywhere a way to control it from a different application than the one elinchrom propose.
Do you know if what I intend to do is even possible? If a solution exist with another brand I will also take it.
Thank you in advance for any replies, and please excuse my english.

Should be possible; the driver guide states that the driver is really a USB serial port driver. That means you can probably reverse-engineer the protocol.

Related

Recycle USB port in C++

I need to simulate plug/unplug for USB device in C++ under Windows environment. I know the existence of this IOCTL
http://msdn.microsoft.com/en-us/library/windows/hardware/ff537243(v=vs.85).aspx
(IOCTL_INTERNAL_USB_CYCLE_PORT) which indeed is what I am looking for, but I don't know how to use.
Is there anyone which can tell me who I can find an example or share some lines of code in order to help me, please!
Thanks in advance.
Since you are in User Mode land and using C++ I'd recommend looking at the devcon sample. Out of the box you can use it on the command line to issue PnP or disable/enable requests to devices. The source code is also available, so you can use that as a start to get this functionality added to your environment.

Video capture from USB webcam using C++ and USB library

I just want to know if its possible to write a program in c++ on Windows which can grab frames of video from a web cam by making use of a USB library like libusb.
I have looked at http://www.dreamincode.net/forums/topic/148707-introduction-to-using-libusb-10/ . They define a basic sequence of the steps one must follow while using libusb to work with usb devices. To summarize:
1) Find and connect to the USB device
2) Send and receive data
3) Release the USB device
libusb handles part 1) and 3). So, the question comes down to part 2). I wonder if it is possible/feasible to send commands to the camera and receive data via USB by adhering to some type of standard (UVC 1.5 for example). I'm thinking that not knowing some proprietary, device specific information might be a problem though.
If this is possible but super hard, I would appreciate any insights into what the biggest challenge would be.
The hardware I have in mind are low-end logitech USB cameras.
Also, I am fully aware that OpenCV, Video for Windows (VFW), DirectShow, and FFMPEG can do web-cam video capture. I am interested in this project as a learning experience.
Thanks in advance!
Since you're obviously a bit inexperienced, I'll give an answer in high-level terms.
To talk to someone, or something, you need to speak a common language, or have a translator. Now, there are many different USB devices, and they speak many different languages, but OpenCV can act as a translator for many of those. If you don't want to use that, you will need to find another translator, or possibly learn to speak the camera's native language.
The first option (another translator) is no option for you, because you don't want a translator.
The second option is something we can't help you with, because we don't know which camera you have.

SDL_Mixer MIDI Volume issues on Windows Vista/7

I'm not actually well versed in C++ or SDL_Mixer, but I'm asking this question anyway on behalf on the Doom community. Put simply, nobody writing Doom source ports can seem to figure out how to control normal sound volume and MIDI sound volume independently using SDL_Mixer on Windows Vista or 7. I'll let James Haley, author of Eternity Engine, put it in his own words:
Seems the concept of independent volume for native MIDI doesn't exist under Windows Vista or 7, as using MIDI volume sliders in any application that has them (including most games that use SDL_mixer) also affects the volume of digital sound output. This makes attempting to adjust the relative volume of music for comfort impossible.
Has anybody found any workarounds for this? I'm guessing it's unlikely given how Microsoft seems to have skimped throughout the OS on any way to control the volume of individual sound devices separately.
I've heard of various workarounds all involving a Timidity driver, but this requires the user go above and beyond simply installing the game on his system. The only port that I know of that definitively fixes this issue is ZDoom, but it uses the GPL-incompatible FModEx and is thus not a suitable solution.
If you want some code to look at, Chocolate Doom is perhaps the easiest Doom source port to grok and you can grab its source here.
Any suggestions on other open-source sound and music libraries would be welcome as well.
A solution would be to ship with a FluidSynth-enabled SDL_mixer. You would also need to ship a SoundFont2 file to go with it. Fortunately, there are free SF2's out there, and some are even optimized for Doom's MIDI files. Licenses shouldn't be a problem, since SoundFonts are assets, not code.
You then load the SF2 using Mix_SetSoundFonts().
You may want to look at different MIDI libraries outside of SDL.
http://wildmidi.sourceforge.net/
http://sourceforge.net/apps/trac/fluidsynth/
http://timidity.sourceforge.net
I am maintaining a similar game port (Descent 2), and I have come across the same problem. Afaik there is no solution for it when using SDL_mixer. A cure to avoid sound being muted when turning off midi music I have found is to retrieve a handle to a temporary midi device, set the midi volume to max and then close the temporary device again.
For the longest time, the only solution we found was to use something like PortMIDI. However, Quasar of Eternity Engine fame has come across a neat solution:
http://www.doomworld.com/vb/showthread.php?s=&postid=1124981#post1124981
He essentially puts SDL_Mixer into its own process and controls it with RPC. Very clever.
So one problem with the previous answer I gave was that sometimes the MIDI subprocess did not behave itself, and would break or stop working in strange ways. Eternity's specific implementation used IDL, and I personally re-implemented it using pipes, but the subprocess itself was a bug magnet.
Thankfully, another answer was figured out rather recently. You can simply bypass SDL_Mixer entirely and deal with Windows' native MIDI support directly, which turns out to not require a ton of code once you know what you're doing.
https://github.com/chocolate-doom/chocolate-doom/blob/master/src/i_winmusic.c
You can also implement this sort of idea with PortMIDI and get the benefit of being able to communicate with external MIDI devices as well.
https://github.com/odamex/odamex/blob/stable/client/sdl/i_musicsystem_portmidi.cpp

Help me get started (traffic manipulation)

My main goal is to create an advanced program for manipulating the packets that route within my network via the router. Let my program have total control over the router. Set the download/upload speeds to my inputs, apply the effect to certain devices within in my network. Block upload or download traffic. Set second delay for either the upload or download speed. Specify % of loss packets, and the list goes on.
The problem is that I don't know where to start. I know most languages at the very most basic level. I'd like to create this program in either C, C++ or C# but I don't know yet. What else do I need to know before creating this program? Winsock or something? Winpcap APIs?
This goal is my motivation to learn programming to the extreme, and I'm really looking forward to it.
Thanks in advance!
Hmmm I guess you would want to look at pcap(?):
pcap
Check out:
http://beej.us/guide/bgnet/html/multi/index.html
'Beej's Guide to Network Programming
Using Internet Sockets'
All you could possibly need to know about programming sockets for capture and manipulation.
If I were you I'd write it in C, I'm writing a similar project at the moment in C++ and it's hell but too late to stop and start again.
Hope that helps.
Bear in mind that you either need a router that you can re-program or you need to use your PC as a router to do this.
Either way you want to look into how IPTABLES are implemented.
I've never seen Desktop Windows used as a router only Windows Server, though it may still be possible. libpcap is for packet capture, but not interception as I understand it. Programs like Wireshark use it to monitor copies of packets, but not to modify them. If you want to attempt this, my impression has been that there is a lot more documentation and tools for doing something like this with NetFilter/IPTables on Linux. You can even install something like OpenWRT on a compatible router and get a small, cheap Linux router, though having Desktop Linux will probably help for development. The NetFilter QUEUE library can be used with some IPTables firewall rules to redirects specific (or all) packets to a regular user program. That program can then read the packet and modify it or even request it to be dropped.
http://www.netfilter.org/projects/libnetfilter_queue/
If you want to manipulate network traffic on a Windows machine (as you mentioned), you will need some extra software. This operating system wont give you the full control over itself, which is fine for some reasons.
I think what you want to do, should be done with either winpcap or win10pcap if you are using Win10. These packages contains a windows driver and the libpcap user space library.

Controlling mouse in linux

Basically I'm currently using the wiiuse library to get the wiimote working on linux. I want to now be able to control the mouse through the IR readings.
Can somebody point me in the right direction as to how to approach this? I know of uinput but there doesn't seem to be a lot of tutorials/guides on the web.
I'm working with c/c++ so a library in c/c++ would be helpful.
Cheers.
I think you should look into "becoming" a new mouse device. This would require developing a device driver that knows how to read the Wii device, and present that data to the input system as if it came from a mouse. The Linux kernel supports multiple mice connected at the same time, and merges the inputs from all of them, so this will work fine.
This book might be a handy help along the way. Not sure if it's possible to do this totally in userland, but that is of course worth investigating too.
I`m not sure if I understood you question corectly. If looking for controling mouse pointer from userspace look at XTest Extension Usefull link
Edit:
From kernel POV uinput looks like good starting point
In the end I decided to just draw "cursor" objects on the screen and use setup each input device to control a separate "cursor" object. This seemed the best idea as we were short on time.