Custom Scan Termination
The scan termination option can be configured with the BcmScanConfig class.
There are three configurations available:
/**
* Configurable scan termination options.
*/
public enum ScanTerminationOptions {
/**
* The scan is not terminated by the SDK -
* an own termination logic can be implemented
*/
case DISABLE
/**
* A default button would be visible in the scan screen,
* when clicking the button - the scan terminates.
*/
case BUTTON
/**
* When all selected fingers scan score reach to "fingerScoreThreshold",
* the scan terminates with timeout (fingerScoreTimeout)
*
* The score threshold can be configured with "fingerScoreThreshold"
* The timeout can be configured with "fingerScoreTimeout"
*/
case SCORE_WITH_TIMEOUT
}
By using the ScanTerminationOptions.DISABLE configuration, it is possible to configure your own
termination option.
When the scan termination option is disabled, you can put your own scan termination logic in
the fingerImagesCachedLiveScore of the PBcmFlowDelegate interface.
/**
* Internal finger cache was updated,
* because fingers with a better score was detected.
* Inspect the BcmFingerImageLiveScore structure to check live score.
* The callback will continuously called, during the scan.
*/
func fingerImagesCachedLiveScore(
_ fingerImageLiveScores: Array<BcmFingerImageLiveScore>
)
To terminate a Scan session you have to call the finishScan() method of
the BcmScanController.
Implementation
Swift:
/**
* Internal finger cache was updated,
* because fingers with a better score was detected.
* The callback will continuously called, during the scan.
*/
extension YourViewController : PBcmFlowDelegate {
func bcmFingerImagesCachedLiveScore(
fingerImageLiveScores: Set<BcmFingerImageLiveScore>
) {
if (!fingerImageLiveScores.isEmpty) {
// a simple example of a scan termination logic
fingerImageLiveScores.forEach { item in
if (item.score > 0.18) {
bcmScanController?.finishScan()
}
}
}
}
}
Timed Scan Termination option
This way you can terminate the scan after a certain amount of time even if there is no fingers
images detected. This option can be achieved by calling the finishScan() method in
the bcmReadyToScan() method of the BcmScanController after the
timer has finished.
Swift:
extension YourViewController : PBcmFlowDelegate {
func bcmReadyToScan() {
let terminationTime = 30.0 // 30 seconds
DispatchQueue.main.asyncAfter(deadline: .now() + terminationTime) {
self.bcmScanController.finishScan()
}
}
}