PDA

View Full Version : How can I use QT to make an application that simulates a mouse Bluetooh (HID)?



andreGama
2nd May 2010, 14:26
Hello, How can I use QT to make an application in C + + that simulates mouse Bluetooh (HID)? I know I can use "QMouseEvent: globalPos () const" to the mouse coordinates, but still have not found how to send that information as a mouse bluethooth.

Thanks ..;)

squidge
2nd May 2010, 15:40
If you wish to emulate a bluetooth mouse then you will need to write a driver which pretends to be a bluetooth mouse driver. You can't do it in Qt.

You can simulate mouse buttons and mouse position movement, but it will not simulate mouse bluetooth and it will be OS specific.

andreGama
2nd May 2010, 16:51
Then QT has no resources to develop applications using the client bluetooth HID (Human Interface Devices Bluetooth) to communicate with existing services hid in most OS's ?

squidge
2nd May 2010, 17:04
Qt is much generic than that - it doesn't care if your mouse is bluetooth, built in, or whatever. For example, on Windows, the OS will simply send a message to Qt saying "Mouse position changed", "Mouse buttons changed state", etc.

andreGama
2nd May 2010, 17:52
sorry if im being repetitive, I just want to use QT to make a simple remote control of PC, the idea is to control my pc from my n800, is possible? exist examples? How i can start?

ps: thanks for your patience, I'm from Brazil and my english sucks and :)

squidge
2nd May 2010, 19:05
You can use OS specific API function to do that (such as SetCursorPos), or you could just use VNC which already allows you to control your PC from an N800.

anistein
2nd May 2010, 20:40
The bluemaemo application does that already on maemo platforms.

andreGama
3rd May 2010, 02:01
yes I want to implement an aplication similar to bluemaemo, but more simple (just with mouse) to education propose! But I still do not know how to do using the resources of the QT.:(

andreGama
3rd May 2010, 02:17
Hi fatjuicymole.
Thanks, but my intention is to make my own application, learning the QT and the handle Bluetooth devices. Can you indicate an example?.:cool:

squidge
3rd May 2010, 09:01
Example:



INPUT Mouse;
// left down
Mouse.type = INPUT_MOUSE;
Mouse.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
::SendInput(1,&Mouse,sizeof(INPUT));
Mouse.mi.dwFlags = MOUSEEVENTF_LEFTUP;
::SendInput(1,&Mouse,sizeof(INPUT));


More docs: http://msdn.microsoft.com/en-us/library/ms646310%28VS.85%29.aspx

andreGama
4th May 2010, 00:28
Hello friends, I would like thanks the help, please forgive my little exeperiencia, it would be possible to post a complete example so I can view the operation?
But I still do not know how the application will communicate with the system, and how will the passage of events like a bluetooth mouse.

squidge
4th May 2010, 07:58
Just create a QTimer, and connect it's signal to the above code. Move your mouse and you'll notice that the left button is clicked for you when the timer expires. If you look at the docs, you can also change the mouse position and emulate a keyboard.

wysota
4th May 2010, 22:33
sorry if im being repetitive, I just want to use QT to make a simple remote control of PC, the idea is to control my pc from my n800, is possible? exist examples? How i can start?
The way this is usually done is through a dedicated bluetooth service that has to be running on the device to be controlled as part of the bluetooth stack.

http://en.wikipedia.org/wiki/Bluetooth_profile

I'm not sure if this is actually done by HID profile but regardless of that you need a low-level access to the bluetooth channel to be able to send appropriate commands through the profile. Qt doesn't provide wrappers over things like that. And remember this is done on the sender side, the receiving side needs the service I mentioned earlier. A much simpler thing to do would be to provide your own communication and your own protocol. Then (I guess) you can use the code fatjuicymole presented.