Custom Scan Termination
The scan termination option can be configured with the BcmScanConfig class.
There are three configurations available:
/**
* Configurable scan termination options.
*/
enum class ScanTerminationOptions {
/**
* The scan is not terminated by the SDK -
* an own termination logic can be implemented
*/
DISABLE,
/**
* A default button would be visible in the scan screen,
* when clicking the button - the scan terminates.
*/
MANUAL,
/**
* When the finger threshold is reached of the selected fingers, a countdown timer starts.
* The scan terminates, when the countdown timer expires.
*
* The score threshold can be configured with "fingerScoreThreshold"
* The timeout can be configured with "fingerScoreTimeout"
*/
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 IBcmFlowDelegate 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.
*/
fun fingerImagesCachedLiveScore(
fingerImageLiveScores: Set<BcmFingerImageLiveScore>
) {
}
To terminate a Scan session you have to call the finishScan() method of
the BcmScanFragment.
Implementation
Kotlin:
class YourBcmScanActivity : BcmScanActivity(), IBcmFlowDelegate {
/** Internal finger cache was updated, because fingers with a better score was detected.
* The callback will continuously called, during the scan. */
override fun fingerImagesCachedLiveScore(
fingerImageLiveScores: List<FingerImageLiveScore>
) {
if (fingerImageLiveScores.isNotEmpty()) {
// a simple example of a scan termination logic
fingerImageLiveScores.forEach { it ->
if (it.score > 0.18) {
scanFragment?.finishScan()
}
}
}
}
}
Java:
public class YourBcmScanActivity extends BcmScanActivity implements IBcmFlowDelegate {
/**
* 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.
*/
@Override
public void fingerImagesCachedLiveScore(
@NotNull List<FingerImageLiveScore> fingerImageLiveScores
) {
if (!fingerImageLiveScores.isEmpty()) {
// a simple example of a scan termination logic
for (FingerImageLiveScore fiLiveScore : fingerImageLiveScores) {
if (fiLiveScore.getScore() > 0.18) {
getScanFragment().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 BcmScanFragment after the timer has finished.
Kotlin:
class YourBcmScanActivity : BcmScanActivity(), IBcmFlowDelegate {
override fun bcmReadyToScan() {
val terminationTime = 30000 //30 secs
val tick = 1000 // tick every 1 seccond
object : CountDownTimer(terminationTime, tick) {
override fun onTick(millisUntilFinished: Long) = Unit
override fun onFinish() {
scanFragment?.finishScan() // terminate scan after terminationTime is over
}
}.start()
}
}
Java:
public class YourBcmScanActivity extends BcmScanActivity implements IBcmFlowDelegate {
@Override
public void bcmReadyToScan() {
int terminationTime = 30000; //30 seconds
int tick = 1000; // tick every 1 seconds
new CountDownTimer(terminationTime, tick) {
public void onTick(long millisUntilFinished) {
mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
}
public void onFinish() {
getScanFragment().finishScan(); // terminate scan after terminationTime is over
}
}.start();
}
}