Detect the source of a keyboard/barcode scanner event

I need to read several barcode scanners and bind the read data according to its source.

In other words, my application needs to know where from the keystrokes came to be able to take the correct actions like update the UI and send commands to dedicated external hardware.

How can I "route" the inputs of different keyboards/scanners to specific events in my app OR retrieve information that allow my app to find out where from the input came?
(I start from the point that a barcode scanner is just a keyboard to the system.)

I know I can "open" the specific "device" to read raw data from it, but it is not the same as haveing a "keyboard event" in my app.
(Consider also that my app is written in Qt, but I don't really need to be tied to it.)

Thanks.

EDIT:
I'd better say that it must run on Linux. No windows nor .NET and no Embedded Linux too.
I also plan to code it in C++/Qt, but am open to other frameworks.
Sorry for the miss.