Skip to content

RFID Reader

Open RFID Reader

To open the RFID chip reading controller and start its processing, use the method below.

Warning

Don't forget to specify the app IDs in the Info.plist file. You can find them here.

DocReader.shared.startRFIDReader(fromPresenter: self, completion: { (action, results, error) in
    switch action {
    case .complete:
        print("Completed")
    case .cancel:
        print("Cancelled by user")
    case .error:
        print("Error: \(error)")
    default:
        break;
    }
})
[RGLDocReader.shared startRFIDReaderFromPresenter:self completion:^(RGLDocReaderAction action, RGLDocumentReaderResults * _Nullable results, NSError * _Nullable error) {
    switch (action) {
        case RGLDocReaderActionComplete: {
            NSLog(@"Completed");
        }
        break;

        case RGLDocReaderActionCancel: {
            NSLog(@"Cancelled by user");
        }
        break;

        case RGLDocReaderActionError: {
            NSLog(@"Error: %@", error);
        }
        break;

        default:
        break;
    }
}];

Stop RFID Reader

To stop the RFID chip reading controller programmatically, use the method below.

  • Without the completion block:
DocReader.shared.stopRFIDReader()
[RGLDocReader.shared stopRFIDReader:nil];
  • With the completion block:
DocReader.shared.stopRFIDReader {
    print("Stopped")
}
[RGLDocReader.shared stopRFIDReader:^{
    NSLog(@"Stopped");
}];
  • Without the completion block with specifying the error message that has to be displayed on the UI:
DocReader.shared.stopRFIDReader(errorMessage: "Custom error message")
[RGLDocReader.shared stopRFIDReaderWithErrorMessage:@"Custom error message" completion:nil];
  • With the completion block with specifying the error message that has to be displayed on the UI:
DocReader.shared.stopRFIDReader(errorMessage: "Custom error message") {
    print("Stopped")
}
[RGLDocReader.shared stopRFIDReaderWithErrorMessage:@"Custom error message" completion:^{
    NSLog(@"Stopped");
}];

RFID Delegate

The RFID chip delegate:

DocReader.shared.rfidDelegate = self
[RGLDocReader shared].rfidDelegate = self;

TCC Params

Sets the given TCCParams to the RFID session. The parameters are required to be set before starting the RFID session.
TCCParams:
Property serviceTAURLString - The TA URL for the TCC service. The value of the property must be a valid URL string.
Property servicePAURLString - The PA URL for the TCC service. The value of the property must be a valid URL string.
Property pfxCertURLString - The URL for the certificate for a TCC service. The value of the property must be a valid URL string.
Property pfxCertData - The bytes of the certificate for a TCC service. This data will be used instead of loading the certificate via pfxCertURLString.
Property pfxPassPhrase - The passphrase for the cerficiate provided by the pfxCertURLString property.

let tccParams = TCCParams(
    serviceTAURLString: "",
    servicePAURLString: "",
    pfxCertURLString: "",
    pfxCertData: nil,
    pfxPassPhrase: ""
)
DocReader.shared.setTCCParams(tccParams) { success, error in
    // check `success` or `error`...
}
TCCParams *tccParams = [[TCCParams alloc] initWithServiceTAURLString:@""
                                                  servicePAURLString:@""
                                                    pfxCertURLString:@""
                                                        pfxCertData:nil,
                                                       pfxPassPhrase:@""];
[RGLDocReader.shared setTCCParams:tccParams completion:^(BOOL success, NSError * _Nullable error) {
    // check `success` or `error`...
}];

For information about the methods you can implement for your delegate object, see the following page.