org.dvb.smartcard
Class SmartCardReader

java.lang.Object
  extended by org.dvb.smartcard.SmartCardReader

public class SmartCardReader
extends java.lang.Object

Represents a physical smart card reader slot in the terminal.

Since:
MHP 1.1.3

Method Summary
 void addSmartCardReaderListener(SmartCardReaderListener listener)
          Allows the specified listener to received notifications about changes in the status of the smart card reader.
 int getSlotId()
          Each single reader is identified on the terminal with an increasing identifier.
 int getStatus()
          Retrieves current status of the smart card reader.
 boolean isSmartCardInserted()
          Allows applications to query if a smart card is inserted in the reader.
 javax.microedition.apdu.APDUConnection openRawConnection()
          Opens a raw APDU connection without selecting an application or managing channels.
 void removeSmartCardReaderListener(SmartCardReaderListener listener)
          Removes specified listener: the notifications about changes in the status of the smart card reader will no longer be forwarded to the given listener.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSlotId

public int getSlotId()
Each single reader is identified on the terminal with an increasing identifier. Default identifier for single slot terminals is zero.

Returns:
int id associated to the reader

getStatus

public int getStatus()
Retrieves current status of the smart card reader. The constant values are the ones defined in SmartCardReaderEvent.

Returns:
int current status of the reader

isSmartCardInserted

public boolean isSmartCardInserted()
Allows applications to query if a smart card is inserted in the reader. True is returned also if no ATR is correctly retrieved (i.e. smart card inserted upside-down).

Returns:
boolean true if smart card is inserted in given slot

addSmartCardReaderListener

public void addSmartCardReaderListener(SmartCardReaderListener listener)
Allows the specified listener to received notifications about changes in the status of the smart card reader.

Parameters:
listener - the SmartCardReaderListener that will receive the notifications

removeSmartCardReaderListener

public void removeSmartCardReaderListener(SmartCardReaderListener listener)
Removes specified listener: the notifications about changes in the status of the smart card reader will no longer be forwarded to the given listener.

Parameters:
listener - the SmartCardReaderListener that was receiving the notifications.

openRawConnection

public javax.microedition.apdu.APDUConnection openRawConnection()
                                                         throws java.io.IOException,
                                                                javax.microedition.io.ConnectionNotFoundException
Opens a raw APDU connection without selecting an application or managing channels. The following properties shall apply to raw connections.

Returns:
an APDUConnection with the selected smartcard
Throws:
java.lang.SecurityException - if the application does not have APDUPermission
javax.microedition.io.ConnectionNotFoundException - if either the smartcard is not inserted or if opening a connection is not permitted (e.g. for CA cards)
java.io.IOException - if an APDU connection is already open or if any other I/O error occurs