Read from Magnetic Stripe

A

andrea.ponte

Hi,
I've a magnetic stripe reader connected via usb to my pc. When I slide
my badge into the reader it write the content of the magnetic card in
whatever editor is focused in that moment. I need to intercept this
stream. Another info, my computer see the card reader like a keyboard.
I've another question too. Is it possible to wrtite a listener that
focus on my application when I slide the badge into the reader?
Thanks in advance Andrea
 
I

Ian Wilson

Hi,
I've a magnetic stripe reader connected via usb to my pc.

I assume Windows.
When I slide
my badge into the reader it write the content of the magnetic card in
whatever editor is focused in that moment. I need to intercept this
stream. Another info, my computer see the card reader like a keyboard.

Commonly called a keyboard-wedge interface.
I've another question too.

Was there an earlier question?

Is it possible to wrtite a listener that
focus on my application when I slide the badge into the reader?

I find it hard to work out what your mean. If you want the use of the
card-reader to change which application has focus then you are probably
out of luck with your current card-reader.

If your card has some unique characters at the start then you might be
able to find a Windows "hotkey" application which could be configured to
launch your application.

I think you'd need a card reader with a different sort of interface.
Then you could probably write an application that listens to that interface.

Java wouldn't be my first choice for this sort of thing, but maybe
that's because I'm still a relative novice at it.
 
R

Rodrigo Zechin

Hi,
I've a magnetic stripe reader connected via usb to my pc. When I slide
my badge into the reader it write the content of the magnetic card in
whatever editor is focused in that moment. I need to intercept this
stream. Another info, my computer see the card reader like a keyboard.
I've another question too. Is it possible to wrtite a listener that
focus on my application when I slide the badge into the reader?
Thanks in advance Andrea

If you have focus on your application, you can set a global
KeyEventDispatcher to handle this. (Doing this you avoid to implement a
keyboard listener on every frame, dialog, etc)
See:
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new
MyDispatcher());

If you don't have focus, you will need to implement that using JNI...

RZR
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top