Optical Mouse as encoder - c++

Recently I discovered the beauty of the optical mouse as an incremental position encoder.
An optical mouse usually contains one component in which a camera is linked to an image processor linked to an USB interface. The resolution depends on the camera resolution. On the internet it is easy to find back the datasheets of this type of components describing also how to read/write with them.
My problem I first need to solve is how to make sure that an encoder mouse is not seen by the laptop/pc as a pointing device without disabling the USB port to which it is connected. I need to use 2 encoders so that means that 3 usb ports need to be used on my PC (running Windows XP), one for the mouse as pointing device and two for a mouse as encoder.
A second question is how to read/write instructions/data from/to the encoder mouse over an USB port? Could someone send me a link to a tutorial/example in C++?
Thanks very much in advance,
Stefan

The USB mouse microcontroller is probably hardcoded to send USB frames identifying itself as a HID device. In that case there's little hope you can succeed in preventing Windows to use it as a mouse. After all this IS a mouse.
If you are in DIY, you could try to hack the mouse board by unsoldering component/wires and directly control the encoders with your arduino. This way, the Arduino could read the data from the encoder and send it to the PC using its own USB serial port.
See an example there:
http://www.martijnthe.nl/2009/07/interfacing-an-optical-mouse-sensor-to-your-arduino/
For more info on HID device: http://en.wikipedia.org/wiki/USB_human_interface_device_class
Excerpt:
"There are two levels of APIs related to USB HID: the USB level and the operating system level. At the USB level, there is a protocol for devices to announce their capabilities and the operating system to parse the data it gets. The operating system then offers a higher-level view to applications, which do not need to include support for individual devices but for classes of devices. This abstraction layer allows a game to work with any USB controller, for example, even ones created after the game."

Take a look at the Raw Input API to see if you can pick up on the events that way and block Windows from acting on them.

Related

How to access USB camera through Qt c++ gui application

I am new to Qt GUI development. I have installed Qt GUI on windows platform. I need to setup a Qt C++ based GUI application to run connected USB camera. I tried to find out the related example but mostly based on webcam application. Is there any suggested example for accessing USB camera via Qt C++ GUI, I can go through?
There is no essential difference between "webcam" and "usb camera". A webcam is a video camera that feeds or streams an image or video in real time. This means that your USB camera can be a webcam if it supports such a function.
To accomplish your task, use the qt documentation and it's perfect examples, like this camera example.
Also, could be useful:
Recording Video from USB Cam with Qt5
Camera Overview

Hide camera device name from windows applications with MS Media Foundation?

Context
I am trying to build an image filter application where, the application will get the user's selected camera frames, apply some filters on the frames, create a virtual camera device and send the frame to that virtual camera. I am successful in doing all of these except I have to hide the actual camera device because it is being used by my application and other applications (suppose zoom/meet) should see my virtual camera instead of the actual camera device.
I have become able to create a virtual camera and send frames there with the help of obs-virtual-cam's obs-virtualsource.dll.
Desired Outcome
I need to create some kind of wrapper for device enumeration DLL from Microsoft. Once my wrapper is registered, it will modify the list of devices returning by the system to the applications. The settings can be saved in Registry and invoked in the context of other processes.
Answer I want
I am proficient at C/C++ but newbie in COM and MS Media Foundation API. So, even if the problem cannot be solved right here in the answer, I welcome and link or guidance to get started in the right direction to solve this specific problem.
Microsoft Media Foundation API does not offer you means to hide cameras for applications. Neither for application that use Media Foundation to access the cameras, nor specifically for applications that access cameras without Media Foundation.

How to make a code inside a C++ software communicate with an arduino board?

I am trying to track time delays inside a software called OpenVibe, this software is a graphical programming environment which relies on a C++ architecture. every boxes (Hence the Graphical programming) are actually C++ codes. The ones I developed are visual stimulus appearing on the screen (It used a standard GDK drawing approach). However, I want to see the delay between the sending of the information and the actual display on the screen. Therefore I want to activate a serial port connected to an arduino board during the activation of the box in the software. I intend to send a numerical value that could be read by the arduino board and would light a LED. If I don't have a delay the LED would light up exactly at the same time of the screen display, and I doubt that.
I am not sure of the process to send data to a serial port using C++ while a program is already running.
Thanks in advance.
Tristan

Windows events for 3D mouse

I am developing a Windows application that must respond to events of 3d mouse, such as the 3DConnexion mouses, for example.
We have added support for 3DConnexion mouses using their dlls and libraries in C++, and it works properly. Now we would like to extend this support to any such device.
What I want to know is if there is a standard Windows support for these devices (via, for example, responding to Windows messages, like normal mouse events) or if I should give specific support for each type of mouse, loading the corresponding DLLs.
The latter would be rather unpleasant, because a separate library for each device should be used. I note that Google Earth, Photoshop and other applications respond to 3DConnexion events, and I gess they will respond to other 3d mouses. In this case, I doubt Google uses that cumbersome technique, and that makes me suspect that there must be a general mechanism, just as there is for the "normal" mouse.
Any idea?
Thank you.

Simulate keyboard input at system level in C++

I am trying to control games and do free tracking using an external IMU device here by simulating keyboard inputs like left and right arrows.
I have successfully done with calling SendInput() function in C++ to simulate pressing left and right arrow. However, it doesn't actually function in a game application (even for a small flash game.)
I searched on MSDN and found that SendInput() only works in the applications of the same integrity level. So is there a way to accomplish this keyboard input simulation at system level to pass around this integrity problem?
Thanks~
Not a direct answer to your question, but an alternate suggestion.
Saitek (a manufacturer of big range of game devices) always uses virtual keyboard/mouse drivers to accomplish the same task. I'd suggest you do the same. OR you can make your device a HID-compliant one at hardware level, so it can emulate keyboard/mouse/joystick without any drivers.