public class SEDiscovery
extends java.lang.Object
Constructor and Description |
---|
SEDiscovery(SEService service,
SERecognizer recognizer)
Creates a discovery object that will perform a discovery algorithm
specified by the recognizer object, and will be applied to the given
SEService.
|
Modifier and Type | Method and Description |
---|---|
Reader |
getFirstMatch()
Returns the first Secure Element reader containing a Secure Element that
matches the search criterion.
|
Reader |
getNextMatch()
Returns the next Secure Element reader containing a Secure Element that
matches the search criterion.
|
public SEDiscovery(SEService service, SERecognizer recognizer) throws java.lang.IllegalArgumentException
service
- The SEService used to perform the discovery. Cannot be
null.recognizer
- An SERecognizer instance, whose isMatching method of
the SERecognizer will be called. Cannot be null.java.lang.IllegalArgumentException
- If any of the parameters is null.public Reader getFirstMatch()
Actually starts a full discovery process:
- Secure Element readers are enumerated
- For the first reader, if a Secure Element is present, open a session
- On this session, call the isMatching method of the SERecognizer object given at construction time.
- The session is closed.
- If the isMatching method returns false, the process is continued with the next reader.
- If the isMatching method returns true, the reader object is returned
The sessions used by the discovery process are closed to avoid the risk of leaks: if they were opened and returned to the caller, there would be a risk for the caller to forget to close them.
Calling getFirstMatch twice simply restarts the discovery process (e.g. probably returns the same result, unless a Secure Element has been removed).
public Reader getNextMatch() throws java.lang.IllegalStateException
Actually continues the discovery process:
- For the next reader in the enumeration, if a Secure Element is present, open a session
- On this session, call the isMatching method of the SERecognizer object given at construction time.
- The session is closed.
- If the isMatching method returns false, the process is continued with the next reader.
- If the isMatching method returns true, the reader object is returned
java.lang.IllegalStateException
- if the getNextMatch() method is called without
calling getFirstMatch() before, since the creation of the
SEDiscovery object, or since the last call to getFirstMatch or
getNextMatch that returned null.SEEK for Android Copyright 2015, Giesecke & Devrient GmbH