Skip to content

Latest commit

 

History

History
21 lines (18 loc) · 1.05 KB

README.md

File metadata and controls

21 lines (18 loc) · 1.05 KB

InputReader

This is a library for handling keyboard input events. Specifically it allows you to separate input from multiple "keyboards" (maybe more devices later). To use it you must first identify the "keyboard" to track:

IntPtr deviceId = await DeviceManager.DetectKeyboard();

On the next "keypress" (magstripe, barcode, etc...) deviceId will be populated with the identifier of the keyboard - which you should be able to save for the next time the program is run.

Next we need to setup our listener:

BatchKeyboard scanner = new BatchKeyboard(deviceId);
scanner.BatchReceived += Scanner_BatchReceived;
DeviceManager.Listen(scanner);

That's it - your program is now listening (when it has focus - not globally) for any input from that "keyboard" device. When a batch of keys are pressed (all the digits of the barcode, magstripe, rfid tag, etc...) then the BatchReceived is triggered. The definition method definition is:

void Scanner_BatchReceived(object sender, string e){}

The second parameter e will contain the scanned data.