public abstract class CardService
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static int |
SESSION_STARTED_STATE |
protected static int |
SESSION_STOPPED_STATE |
protected int |
state |
| Constructor and Description |
|---|
CardService()
Creates a new service.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAPDUListener(APDUListener l)
Adds a listener.
|
abstract void |
close()
Closes the session with the card.
|
java.util.Collection<APDUListener> |
getAPDUListeners()
Returns the collection of APDU listeners.
|
abstract byte[] |
getATR()
Gets the answer to reset.
|
static CardService |
getInstance(java.lang.Object object)
Creates a card service.
|
abstract boolean |
isConnectionLost(java.lang.Exception e)
Determines whether an exception indicates a tag is lost event.
|
boolean |
isExtendedAPDULengthSupported()
Returns a boolean indicating whether extended length APDUs are supported.
|
abstract boolean |
isOpen()
Whether there is a session started with the card.
|
protected void |
notifyExchangedAPDU(APDUEvent event)
Notifies listeners about APDU event.
|
abstract void |
open()
Opens a session with the card.
|
void |
removeAPDUListener(APDUListener l)
Removes a listener.
|
abstract ResponseAPDU |
transmit(CommandAPDU commandAPDU)
Sends an APDU to the card.
|
protected static final int SESSION_STOPPED_STATE
protected static final int SESSION_STARTED_STATE
protected int state
public static CardService getInstance(java.lang.Object object)
object - some platform object responsible for transporting the APDUpublic void addAPDUListener(APDUListener l)
l - the listener to addpublic void removeAPDUListener(APDUListener l)
l - the listener to removepublic java.util.Collection<APDUListener> getAPDUListeners()
protected void notifyExchangedAPDU(APDUEvent event)
event - the APDU eventpublic abstract void open()
throws CardServiceException
CardServiceException - on errorpublic abstract boolean isOpen()
public abstract ResponseAPDU transmit(CommandAPDU commandAPDU) throws CardServiceException
commandAPDU - the Command APDU to sendCardServiceException - if the card operation failedpublic abstract byte[] getATR()
throws CardServiceException
CardServiceException - on errorpublic boolean isExtendedAPDULengthSupported()
public abstract void close()
public abstract boolean isConnectionLost(java.lang.Exception e)
e - an exceptionCopyright © 2023. All rights reserved.