Custom Scan Termination

The scan termination option can be configured with the IBcmScanConfig 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.
     */
    BUTTON,

    /**
     * When the finger threshold is reached by > 50% 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 BcmFingerImageLiveScoreDTO structure to check live score.
     * The callback will continuously called, during the scan. */
    fun fingerImagesCachedLiveScore(
        fingerImageLiveScores: List<BcmFingerImageLiveScoreDTO>
    ) {
    }

To terminate a Scan session you have to call the finishScan() method of the BcmScanFragment.

Implementation

Kotlin:

class BcmScanActivityOverride : 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<FingerImageLiveScoreDTO>
    ) {
        if (fingerImageLiveScores.isNotEmpty()) {
            // a simple example of a scan termination logic
            fingerImageLiveScores.forEach { it ->
                if (it.score > 0.18) {
                    scanFragment?.finishScan()
                }
            }
        }
    }

}

Java:

public class BcmScanActivityOverride extends BcmScanActivity implements IBcmFlowDelegate {

    /**
     * Internal finger cache was updated, because fingers with a better score was detected.
     * The callback will continuously called, during the scan.
     */
    @Override
    public void fingerImagesCachedLiveScore(
            @NotNull List<FingerImageLiveScoreDTO> fingerImageLiveScores
    ) {
        if (!fingerImageLiveScores.isEmpty()) {
            // a simple example of a scan termination logic
            for (FingerImageLiveScoreDTO fiLiveScore : fingerImageLiveScores) {
                if (fiLiveScore.getScore() > 0.18) {
                    getScanFragment().finishScan();
                }
            }
        }
    }

}

See also

results matching ""

    No results matching ""