Skip to content

RFID reader

Open RFID Reader

Use the method below to open the RFID chip reading controller and start its processing.

#1

DocumentReader.Instance().startRFIDReader(MainActivity.this, new IDocumentReaderCompletion() {
    @Override
    public void onCompleted(int rfidAction, DocumentReaderResults results, Throwable error) {
        // do something
    }
});
DocumentReader.Instance().startRFIDReader(this@MainActivity) { rfidAction, results_RFIDReader, _ ->
    // do something
}

#2

DocumentReader.Instance().startRFIDReader(MainActivity.this, documentReaderCompletion, rfidReaderRequest);

private IDocumentReaderCompletion documentReaderCompletion = new IDocumentReaderCompletion() {
    @Override
    public void onCompleted(int action, DocumentReaderResults results, DocumentReaderException error) {
        // do something
    }
};

private IRfidReaderRequest rfidReaderRequest = new IRfidReaderRequest() {
    @Override
    public void onRequestPACertificates(byte[] serialNumber, PAResourcesIssuer issuer, IRfidPKDCertificateCompletion completion) {
        // do something
    }

    @Override
    public void onRequestTACertificates(String keyCAR, IRfidPKDCertificateCompletion completion) {
        // do something
    }

    @Override
    public void onRequestTASignature(TAChallenge challenge, IRfidTASignatureCompletion completion) {
        // do something
    }
};

#3

DocumentReader.Instance().startRFIDReader(MainActivity.this, documentReaderCompletion, null, rfidNotificationCompletion);

private IDocumentReaderCompletion documentReaderCompletion = new IDocumentReaderCompletion() {
    @Override
    public void onCompleted(int action, DocumentReaderResults results, DocumentReaderException error) {
        // do something
    }
};

private IRfidNotificationCompletion rfidNotificationCompletion = new IRfidNotificationCompletion() {
    @Override
    public void onRfidNotification(int notificationType, @Nullable @org.jetbrains.annotations.Nullable Bundle value) {
        Log.d("MainActivity", "RFID notification: " + notificationType + ", value: " + value);
    }
};

Stop RFID Reader

To stop the RFID chip reading controller programmatically, invoke:

DocumentReader.Instance().stopRFIDReader(MainActivity.this);
DocumentReader.Instance().stopRFIDReader(this@MainActivity)

Info

Go to the following page to find out how to set a timeout if defining timeout is a more preferred way for you.

TCC Params

Sets the given TccParams to the RFID session. The parameters are required to be set before starting RFID session.
TccParams:
Method setServiceUrlTA - The TA URL for the TCC service. The value of the property must be a valid URL string.
Method setServiceUrlPA - The PA URL for the TCC service. The value of the property must be a valid URL string.
Method setPfxCertUrl - The URL for the certificate for a TCC service. The value of the property must be a valid URL string.
Method setPfxCert - The bytes of the certificate for a TCC service. This data will be used instead of loading the certificate via setPfxCertUrl.
Method setPfxPassPhrase - The passphrase for the cerficiate provided by the setPfxCertUrl property.

TccParams tccParams = new TccParams();
tccParams.setServiceUrlTA("");
tccParams.setServiceUrlPA("");
tccParams.setPfxCertUrl("");
tccParams.setPfxCert(null);
tccParams.setPfxPassPhrase("");

DocumentReader.Instance().setTccParams(tccParams, new ITccParamsCompletion() {
    @Override
    public void onSetTccParamsCompleted(boolean success, @Nullable DocumentReaderException error) {

    }
});
val tccParams = TccParams()
tccParams.serviceUrlTA = ""
tccParams.serviceUrlPA = ""
tccParams.pfxCertUrl = ""
tccParams.pfxCert = null
tccParams.pfxPassPhrase = ""

DocumentReader.Instance().setTccParams(
    tccParams
) { success, error -> }