PBcmFlowDelegate
The scan flow delegate receives messages about scan progress and results by BcmScanController. It provides your application with the scan result or error, including environment-related errors such as license or calibration problems.
You may provide your own scan flow by implementing the following interface:
Interface
Swift:
public enum ScanError {
/**
* There is a problem with the given license key.
* Please also check the network connection -
* a network connection is mandatory.
*/
case LicenseProblem
/**
* No pre-calibration configuration for the device was found.
*/
case DeviceNotCalibrated
/**
* An internal error occurred, please inspect the logs for details.
*/
case Unknown
/**
* The camera cannot be used due to an error.
*/
case CameraProblem
}
public protocol PBcmFlowDelegate {
/**
* Something went terribly wrong (as indicated by errorCode)
* and things are now broken.
* Notify your user.
*/
func bcmUnrecoverableError(
errorCode: ScanError,
errorMessage: String
)
/**
* A scan has completed.
* Inspect the BcmFingerImageDTO structure
* to check the recorded fingerprints.
* The scan termination can be configured via the `BcmSdkConfig`
*/
func bcmFingerImagesResult(
fingerImages: Set<BcmFingerImage>
)
/**
* Finger selection dialog callback.
* The callback contains a set of all finger selected
* in the Finger selection dialog.
*
* You can save these configuration in user defaults
* to save the last selected fingers.
* Then you can start with this configuration
* by setting selectedFingers parameter in the BcmScanConfig
*
* Optional
*
*/
func bcmFingerSelected(
fingerSelected: Set<BcmFingerHand>
)
/**
* Setup has completed and fingers may now be scanned.
*
* Optional
*
*/
func bcmReadyToScan()
/**
* Fingers are recognized on the given preview position
* with a given evaluation score.
* Inspect the AssignedBoundingBox structure for the object details.
* The callback will continuously called, during the scan.
*
* Optional
*
*/
func bcmBoundingBoxesAssigned(
assignedBoundingboxes: Set<AssignedBoundingBox>
)
/**
* 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.
*
* Optional
*
*/
func bcmFingerImagesCachedLiveScore(
fingerImageLiveScores: Set<BcmFingerImageLiveScore>
)
}
Usage
Implement at least PBcmFlowDelegate.unrecoverableError() and PBcmFlowDelegate.fingerImagesResult() for receiving scan results.
Using the PBcmFlowDelegate.fingerImagesCachedLiveScore() it is possible to implement your own scan termination logic. Please refer to Custom Scan Termination for an example implementation.
The BCM SDK callbacks can be implemented in the in the AppDelegate as follows
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
...
}
// MARK: - Bcm SDK callbacks
extension AppDelegate: PBcmFlowDelegate {
func unrecoverableError(
errorCode: ScanError
) {
}
func fingerImagesResult(
_ fingerImages: Set<BcmFingerImage>
) {
}
/**
* Optional
*/
func fingerSelected(
_ fingerSelected: Set<BcmFingerHandDto>
) {
}
func readyToScan() {
}
func boundingBoxesAssigned(
_ assignedBoundingboxes: Set<AssignedBoundingBox>
) {
}
func fingerImagesCachedLiveScore(
_ fingerImageLiveScores: Set<BcmFingerImageLiveScore>
) {
}
}