PDA

View Full Version : IR remote controller support of embedded Qt



jack_liu
24th August 2011, 06:15
Hi all:
So far as I've known, embedded Qt doesn't support IR remote controller, so how
can my GUI response a IR remote controller? After studying, I've following candidate
methods:

1. Following Qt's event-handling infrastructure which, say mouse, uses QMouseDriverFactory/
QMouseDriverPlugin/QxxMouseHandler family to load driver and QEventLoop :: processEvents()
in server application's main() to monitor corresponding event device file, I should write
my own factory/plugin/handler family for IR from the beginning(I say from the beginning because
it doesn't seem to have any class I can inherit), and even relative mechanisms to send
a new kind of event class about IR, say QIREvent. The defect is that Qt must be rebuilt.

2. Treat IR like keyboard, so only the plugin driver, like QxxMouseHandler mentioned above, needs
to be implemented and added to QKbdDriverFactory. The plugin driver's major job is to map IR
keys to some standard keyboard keys. And GUI also needs to know the key mapping rule to response
correctly. The defect is that there's problem when GUI also uses keyboard as input.

Do you have any better idea?

high_flyer
24th August 2011, 11:48
You are over complicating things.
Qt can not, and is not meant to, support every possible peripheral device.
But it DOES accommodate classes that can be used to build such support in to Qt applications.
Most notable is QIODevice.
It could be that Mobility might have even more specific classes I don't know as I am not mobility user, but you can check.
You need to have a lib, or code, that can operate your IR device.
Once you have that, it is trivial to map the IR "events" to Qt events of your choosing.