Skip to content

IReaderListener

com.rvi.application.IReaderListener · Interface · SocialCard 1.0.3

Define callbacks for card insertion, removal and monitor failures.

Implement onCardInserted(terminal), onCardRemoved(terminal) and onError(exception). For a UI, use the appropriate dispatch mechanism, such as JavaFX Platform.runLater, before changing UI state from a callback.

final IReaderListener listener = new IReaderListener() {
@Override
public void onCardInserted(final CardTerminal terminal) {
System.out.println("Card inserted on " + terminal.getName());
}
@Override
public void onCardRemoved(final CardTerminal terminal) {
System.out.println("Card removed from " + terminal.getName());
}
@Override
public void onError(final Exception failure) {
System.err.println(failure.getMessage());
}
};
Java imports
import com.rvi.application.IReaderListener;
import javax.smartcardio.CardTerminal;

Pass this listener to new ReaderMonitor(terminal, listener) to observe events without modifying tags.

ReaderMonitor invokes callbacks on its worker thread. Both card events carry the same watched terminal. An uncaught runtime error in an event callback can stop monitoring, so handle recoverable application failures at the callback boundary.

ReaderMonitor · ReaderListener · ReaderService

Method signatures in the Javadoc · All API types