Class PTEID_ReaderSet

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

public class PTEID_ReaderSet extends PTEID_Object
This is a singleton class that is the starting point to get all other objects.
You get an instance from the static instance() method (or using the define ReaderSet).
Then you get a READER (PTEID_ReaderContext)
-> from this reader, you a CARD (PTEID_Card or derived class)
-> from this card, you get identity or address objects (PTEID_EId or PTEID_Address)
-> ...
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    boolean
    Flush the cache
    Return the first readercontext with a card.
    If no card is present, return the firs reader.
    If no reader exist, throw an exception PTEID_ExNoReader.
    Return the reader containing the card with this SN.
    If no card with this SN is found, throw an exception PTEID_ExParamRange.
    getReaderByName(String readerName)
    Get the reader by its name.
    getReaderByNum(long ulIndex)
    Get the reader by its Index.
    Throw PTEID_ExParamRange exception if the index is out of range.
    getReaderName(long ulIndex)
    Get the name of the reader by its Index.
    Throw PTEID_ExParamRange exception if the index is out of range.
    static void
    Init the SDK (Optional).

    static void
    initSDK(boolean bManageTestCard)
    Init the SDK (Optional).
    Return the singleton object (create it at first use)
    boolean
    Return true if readers has been added or removed
    long
    Return the number of card readers connected to the computer.

    long
    readerCount(boolean bForceRefresh)
    Return the number of card readers connected to the computer.

    Get the list of the reader.
    Return an array of const char *
    The last pointer is NULL
    Usage : const char * const *ppList=PTEID_ReaderSet::readerList();
    for(const char * const *ppName=ppList;*ppName!=NULL;ppName++) {...}

    readerList(boolean bForceRefresh)
    Get the list of the reader.
    Return an array of const char *
    The last pointer is NULL
    Usage : const char * const *ppList=PTEID_ReaderSet::readerList();
    for(const char * const *ppName=ppList;*ppName!=NULL;ppName++) {...}

    void
    Release the readers (Useful if readers had changed).



    void
    releaseReaders(boolean bAllReference)
    Release the readers (Useful if readers had changed).

    static void
    Release the SDK

    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
    • instance

      public static PTEID_ReaderSet instance() throws PTEID_Exception
      Return the singleton object (create it at first use)
      Throws:
      PTEID_Exception
    • initSDK

      public static void initSDK(boolean bManageTestCard) throws PTEID_Exception
      Init the SDK (Optional).
      Parameters:
      bManageTestCard - If true the applayer must ask if test cards are allowed (used for compatibility with old C
      API).
      bManageTestCard - If false other applications (ex. gui) take that into their scope
      Throws:
      PTEID_Exception
    • initSDK

      public static void initSDK() throws PTEID_Exception
      Init the SDK (Optional).

      Throws:
      PTEID_Exception
    • releaseSDK

      public static void releaseSDK() throws PTEID_Exception
      Release the SDK
      Throws:
      PTEID_Exception
    • releaseReaders

      public void releaseReaders(boolean bAllReference) throws PTEID_Exception
      Release the readers (Useful if readers had changed).

      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
    • releaseReaders

      public void releaseReaders() throws PTEID_Exception
      Release the readers (Useful if readers had changed).



      Throws:
      PTEID_Exception
    • isReadersChanged

      public boolean isReadersChanged() throws PTEID_Exception
      Return true if readers has been added or removed
      Throws:
      PTEID_Exception
    • readerList

      public String[] readerList(boolean bForceRefresh) throws PTEID_Exception
      Get the list of the reader.
      Return an array of const char *
      The last pointer is NULL
      Usage : const char * const *ppList=PTEID_ReaderSet::readerList();
      for(const char * const *ppName=ppList;*ppName!=NULL;ppName++) {...}

      Parameters:
      bForceRefresh - force the reconnection to the lower layer to see if reader list have changed
      Throws:
      PTEID_Exception
    • readerList

      public String[] readerList() throws PTEID_Exception
      Get the list of the reader.
      Return an array of const char *
      The last pointer is NULL
      Usage : const char * const *ppList=PTEID_ReaderSet::readerList();
      for(const char * const *ppName=ppList;*ppName!=NULL;ppName++) {...}

      Throws:
      PTEID_Exception
    • getReader

      public PTEID_ReaderContext getReader() throws PTEID_Exception
      Return the first readercontext with a card.
      If no card is present, return the firs reader.
      If no reader exist, throw an exception PTEID_ExNoReader.
      Throws:
      PTEID_Exception
    • getReaderByName

      public PTEID_ReaderContext getReaderByName(String readerName) throws PTEID_Exception
      Get the reader by its name.
      Throws:
      PTEID_Exception
    • readerCount

      public long readerCount(boolean bForceRefresh) throws PTEID_Exception
      Return the number of card readers connected to the computer.

      Parameters:
      bForceRefresh - force the reconnection to the lower layer to see if reader list have changed
      Throws:
      PTEID_Exception
    • readerCount

      public long readerCount() throws PTEID_Exception
      Return the number of card readers connected to the computer.

      Throws:
      PTEID_Exception
    • getReaderName

      public String getReaderName(long ulIndex) throws PTEID_Exception
      Get the name of the reader by its Index.
      Throw PTEID_ExParamRange exception if the index is out of range.
      Throws:
      PTEID_Exception
    • getReaderByNum

      public PTEID_ReaderContext getReaderByNum(long ulIndex) throws PTEID_Exception
      Get the reader by its Index.
      Throw PTEID_ExParamRange exception if the index is out of range.
      Throws:
      PTEID_Exception
    • getReaderByCardSerialNumber

      public PTEID_ReaderContext getReaderByCardSerialNumber(String cardSerialNumber) throws PTEID_Exception
      Return the reader containing the card with this SN.
      If no card with this SN is found, throw an exception PTEID_ExParamRange.
      Throws:
      PTEID_Exception
    • flushCache

      public boolean flushCache() throws PTEID_Exception
      Flush the cache
      Throws:
      PTEID_Exception