Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

detect device from which input is provided

 
Preston Taylor
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing a program that needs to accept input from a bar code scanner, which is really not the issue since most scanners are just a keyboard, but because I can't trust the users to input non-falsified information I need certain text boxes to accept input from the scanner and the scanner only. how do I determine from what device text input is coming from?
 
Paul Clapham
Sheriff
Pie
Posts: 20750
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the operating system makes them look exactly like the keyboard, you don't have any hope of figuring out what hardware your keyboard inputs are coming from. (Or at least not much hope... scanning a barcode might send keystrokes faster than a human can, and you might be able to discern that with a KeyListener or something.) But I'd say your best approach would be, since it's an operating-system or hardware issue, to solve the problem at the operating-system or the hardware level.
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:scanning a barcode might send keystrokes faster than a human can, and you might be able to discern that with a KeyListener or something.

One word: macros. I have already programmed my keyboard to use a few, so with one press on my keyboard I can post entire pieces of text.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic