Package pt.gov.cartaodecidadao
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete()
boolean
flushCache()
Flush the cachePTEID_ReaderContext
getReader()
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.PTEID_ReaderContext
getReaderByCardSerialNumber(java.lang.String cardSerialNumber)
Return the reader containing the card with this SN.
If no card with this SN is found, throw an exception PTEID_ExParamRange.PTEID_ReaderContext
getReaderByName(java.lang.String readerName)
Get the reader by its name.PTEID_ReaderContext
getReaderByNum(long ulIndex)
Get the reader by its Index.
Throw PTEID_ExParamRange exception if the index is out of range.java.lang.String
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
initSDK()
Init the SDK (Optional).
static void
initSDK(boolean bManageTestCard)
Init the SDK (Optional).static PTEID_ReaderSet
instance()
Return the singleton object (create it at first use)boolean
isReadersChanged()
Return true if readers has been added or removedlong
readerCount()
Return the number of card readers connected to the computer.
long
readerCount(boolean bForceRefresh)
Return the number of card readers connected to the computer.
java.lang.String[]
readerList()
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++) {...}
java.lang.String[]
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
releaseReaders()
Release the readers (Useful if readers had changed).
void
releaseReaders(boolean bAllReference)
Release the readers (Useful if readers had changed).
static void
releaseSDK()
Release the SDK
-
-
-
Method Detail
-
delete
public void delete()
- Overrides:
delete
in classPTEID_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 java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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
-
-