Class PTEID_ReaderContext

java.lang.Object
pt.gov.cartaodecidadao.PTEID_Object
pt.gov.cartaodecidadao.PTEID_ReaderContext

public class PTEID_ReaderContext extends PTEID_Object
This class represent a reader.
You get a reader object from the ReaderSet
either by its index (getReaderByNum) or by its name (getReaderByName).
Once you have a reader object, you can check if a card is present (isCardPresent).
Then you can ask which type of card is in the reader with getCardType()
and then get a card object using one of this methods :
getCard or getEIDCard.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Begin a transaction with the reader
    void
     
    static void
    doJavaCallBack(int iKey, long lRet, long ulState)
     
    void
    End the transaction
    Get the card in the reader.
    Instantiation is made regarding the type of the card
    (PTEID_EIDCard).

    If no card is present in the reader, exception PTEID_ExNoCardPresent is thrown.
    If the card type is not supported, exception PTEID_ExCardTypeUnknown is thrown.
    Get the card interface used on the current used card

    Returns the interface of the current card
    Return the type of the card in the reader.

    Throw PTEID_ExNoCardPresent exception if no card is present.
    Get the EIDcard in the reader.
    Instantiation is made regarding the type of the card
    (PTEID_EIDCard).

    If no card is present in the reader, exception PTEID_ExNoCardPresent is thrown.
    If the card type is not supported, exception PTEID_ExCardTypeUnknown is thrown.
    Get an instance of ICAO_Card if the smartcard chip present in reader is compatible with ICAO Doc 9303 specification

    Example of compatible documents: newer PT eID cards of type PTEID_CARDTYPE_IAS5, resident permits, european identity cards
    and ePassports

    If no card is present in the reader, exception PTEID_ExNoCardPresent is thrown.

    If the current card is not compatible with the ICAO specification, exception PTEID_ExCardTypeUnknown is thrown.
    Read the Multipass token information from the card present in the reader

    This token is a free access unique value, not related to personal citizen data.
    Its purpose is to be used in some physical access control scenarios.
    This is the only useful information available on IAS v5 cards without access control on contactless interface.

    The implementation uses Passive and Chip Authentication mechanisms defined in ICAO Doc 9303 Part 11 to counter the risk of receiving untrusted or cloned information.

    Return the name of the reader.
    boolean
    Return true if a card has changed since the last called (with the same ulOldId parameter).
    boolean
    Return true if a card is present and false otherwise.
    boolean
     
    void
    Recover the card when it's not responding properly anymore.
    This method attempts to reset the card connection and restore communication.
    void
    Release the card.



    void
    releaseCard(boolean bAllReference)
    Release the card.

    long
    SetEventCallback(Callback callback, Object pvRef)
    Specify a callback function to be called each time a
    card is inserted/remove in/from this reader.

    void
    StopEventCallback(long ulHandle)
    To tell that the callbacks are not longer needed.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • delete

      public void delete()
      Overrides:
      delete in class PTEID_Object
    • doJavaCallBack

      public static void doJavaCallBack(int iKey, long lRet, long ulState)
    • getName

      public String getName() throws PTEID_Exception
      Return the name of the reader.
      Throws:
      PTEID_Exception
    • isCardPresent

      public boolean isCardPresent() throws PTEID_Exception
      Return true if a card is present and false otherwise.
      Throws:
      PTEID_Exception
    • isPinpad

      public boolean isPinpad()
    • releaseCard

      public void releaseCard(boolean bAllReference) throws PTEID_Exception
      Release the card.

      Parameters:
      bAllReference - If true all the invalid reference/pointer are destroyed.
      bAllReference - PUT THIS PARAMETER TO TRUE IS THREAD UNSAFE.
      bAllReference - You have to be sure that you will not use any old reference/pointer after this release
      Throws:
      PTEID_Exception
    • releaseCard

      public void releaseCard() throws PTEID_Exception
      Release the card.



      Throws:
      PTEID_Exception
    • isCardChanged

      public boolean isCardChanged(PTEID_ulwrapper ulOldId) throws PTEID_Exception
      Return true if a card has changed since the last called (with the same ulOldId parameter).
      Throws:
      PTEID_Exception
    • getCardType

      public PTEID_CardType getCardType() throws PTEID_Exception
      Return the type of the card in the reader.

      Throw PTEID_ExNoCardPresent exception if no card is present.
      Throws:
      PTEID_Exception
    • getCard

      public PTEID_Card getCard() throws PTEID_Exception
      Get the card in the reader.
      Instantiation is made regarding the type of the card
      (PTEID_EIDCard).

      If no card is present in the reader, exception PTEID_ExNoCardPresent is thrown.
      If the card type is not supported, exception PTEID_ExCardTypeUnknown is thrown.
      Throws:
      PTEID_Exception
    • getCardContactInterface

      public PTEID_CardContactInterface getCardContactInterface()
      Get the card interface used on the current used card

      Returns the interface of the current card
    • getEIDCard

      public PTEID_EIDCard getEIDCard() throws PTEID_Exception
      Get the EIDcard in the reader.
      Instantiation is made regarding the type of the card
      (PTEID_EIDCard).

      If no card is present in the reader, exception PTEID_ExNoCardPresent is thrown.
      If the card type is not supported, exception PTEID_ExCardTypeUnknown is thrown.
      Throws:
      PTEID_Exception
    • getICAOCard

      public ICAO_Card getICAOCard() throws PTEID_Exception
      Get an instance of ICAO_Card if the smartcard chip present in reader is compatible with ICAO Doc 9303 specification

      Example of compatible documents: newer PT eID cards of type PTEID_CARDTYPE_IAS5, resident permits, european identity cards
      and ePassports

      If no card is present in the reader, exception PTEID_ExNoCardPresent is thrown.

      If the current card is not compatible with the ICAO specification, exception PTEID_ExCardTypeUnknown is thrown.
      Throws:
      PTEID_Exception
    • getMultiPassToken

      public PTEID_ByteArray getMultiPassToken() throws PTEID_Exception
      Read the Multipass token information from the card present in the reader

      This token is a free access unique value, not related to personal citizen data.
      Its purpose is to be used in some physical access control scenarios.
      This is the only useful information available on IAS v5 cards without access control on contactless interface.

      The implementation uses Passive and Chip Authentication mechanisms defined in ICAO Doc 9303 Part 11 to counter the risk of receiving untrusted or cloned information.

      Returns:
      A PTEID_ByteArray object containing the Multipass token which is a 16-byte value
      Throws:
      PTEID_Exception
    • SetEventCallback

      public long SetEventCallback(Callback callback, Object pvRef) throws PTEID_Exception
      Specify a callback function to be called each time a
      card is inserted/remove in/from this reader.

      Returns:
      A handle can be used to stop the callbacks when they are no longer needed.
      Throws:
      PTEID_Exception
    • StopEventCallback

      public void StopEventCallback(long ulHandle) throws PTEID_Exception
      To tell that the callbacks are not longer needed.
      Parameters:
      ulHandle - is the handle return by SetEventCallback
      Throws:
      PTEID_Exception
    • BeginTransaction

      public void BeginTransaction() throws PTEID_Exception
      Begin a transaction with the reader
      Throws:
      PTEID_Exception
    • EndTransaction

      public void EndTransaction() throws PTEID_Exception
      End the transaction
      Throws:
      PTEID_Exception
    • Recover

      public void Recover()
      Recover the card when it's not responding properly anymore.
      This method attempts to reset the card connection and restore communication.