Class EmrtdConnector
-
- All Implemented Interfaces:
public class EmrtdConnectorConnect an eMRTD NFC Chip with the Document Validation Server.
Will connect to the NFC Chip using an android.nfc.tech.IsoDep. Will connect to the Document Validation Server using a org.java_websocket.client.WebSocketClient.
-
-
Field Summary
Fields Modifier and Type Field Description public static Tracertracerpublic ExceptionnfcExceptionpublic ExceptionwebSocketClientExceptionpublic Exceptionexception
-
Constructor Summary
Constructors Constructor Description EmrtdConnector(String clientId, String webSocketUrl, ClosedListener closedListener, StatusListener statusListener, EmrtdPassportListener emrtdPassportListener)
-
Method Summary
Modifier and Type Method Description static TracergetTracer()Gets the currently used OpenTelemetry tracer. ExceptiongetNfcException()Gets the exception that occurred during IsoDep#connect() or IsoDep#transceive(byte[]). ExceptiongetWebSocketClientException()Get the exception that occurred during the WebSocketClient operations. ExceptiongetException()Gets any other exception that occurred during the session and not fit the getNfcException and getWebSocketClientException. static voidsetTracerProvider(TracerProvider tracerProvider)Sets a OpenTelemetry tracer provider that is used to provide traces. voidconnect(IsoDep isoDep, ConnectionOptions options)Starts the session. voidcancel()Cancels this session as soon as possible. booleanisOpen()-
-
Constructor Detail
-
EmrtdConnector
EmrtdConnector(String clientId, String webSocketUrl, ClosedListener closedListener, StatusListener statusListener, EmrtdPassportListener emrtdPassportListener)
- Parameters:
clientId- Client IdwebSocketUrl- Url of the WebSocket endpointclosedListener- will be called when the WebSocket connection is closed.statusListener- will be called every time the Server provides an update about the current status.emrtdPassportListener- will be called when the Server returns the result.
-
-
Method Detail
-
getTracer
static Tracer getTracer()
Gets the currently used OpenTelemetry tracer.
- Returns:
The tracer.
-
getNfcException
Exception getNfcException()
Gets the exception that occurred during IsoDep#connect() or IsoDep#transceive(byte[]).
Value may be queried if close reason is NFC_CHIP_COMMUNICATION_FAILED. In all other cases this value will be
null.
-
getWebSocketClientException
Exception getWebSocketClientException()
Get the exception that occurred during the WebSocketClient operations.
-
getException
Exception getException()
Gets any other exception that occurred during the session and not fit the getNfcException and getWebSocketClientException.
-
setTracerProvider
static void setTracerProvider(TracerProvider tracerProvider)
Sets a OpenTelemetry tracer provider that is used to provide traces. If none is set, a no-op implementation is used.
- Parameters:
tracerProvider- The provider to set.
-
connect
void connect(IsoDep isoDep, ConnectionOptions options)
Starts the session.
Example usage:
// Access Key values from the MRZ String documentNumber = "123456789"; String dateOfBirth = "970101"; // yyMMDD String dateOfExpiry = "221212"; // yyMMDD // Unique transaction ID, usually from your server String validationId = UUID.randomUUID().toString(); ConnectionOptions options = new ConnectionOptions.Builder() .setChipAccessKeyFromMrz(documentNumber, dateOfBirth, dateOfExpiry) .setValidationId(validationId) .build(); emrtdConnector.connect(isoDep, options);- Parameters:
isoDep- IsoDep of an ICAO-9303 NFC Tag.options- Options for this read.
-
cancel
void cancel()
Cancels this session as soon as possible.
The ClosedListener will be called once the WebSocket Session is closed. The Close Reason will be "CANCELLED_BY_USER".
-
isOpen
boolean isOpen()
- Returns:
true if session is open
-
-
-
-