BcmScanController
The Scan Controller (BcmScanController) is the Biocapture SDK's central Controller and the main player in the scanning process.
It internally manages a camera object and a scan session.
The Scan Controller is configured using an instance of the BcmGlobalConfig and the BcmScanConfig.
Progress is reported to an object implementing the PBcmFlowDelegate interface. Please refer to the usage examples for a high-level overview of the Scan Fragment.
Caveats
Changes made to the SDK global configuration through BcmGlobalConfig are applied only when a scan session is started.
Configure the SDK while no Scan Controller (BcmScanController) is active to ensure that your configuration is applied to all scan sessions.
Interface
Swift:
open class BcmScanController: ScanController {
// MARK: - Scan view controller creation
override public init(
/**
* An object enables basic configuration of SDK behavior.
*/
globalConfig: BcmGlobalConfig = BcmGlobalConfig(),
/**
* An instance of IBcmScanConfig,
* which may be changed/replaced at will prior to presenting the scan fragment
*/
scanConfig: BcmScanConfig = BcmScanConfig(),
/**
* A delegate object for scan flow events
*/
flowDelegate: PBcmFlowDelegate? = nil
) {
super.init(globalConfig: globalConfig,
scanConfig: scanConfig,
flowDelegate: flowDelegate)
}
}
Usage
Configuring the Scan Controller
The Scan Controller maintains the Biocapture SDK's global configuration using the BcmGlobalConfig interface.
The BcmGlobalConfig object can be set in the Constructor of the Controller, using the globalConfig field.
Additionally, you may change the Scan behavior by providing your own instance of scanConfig or changing values of the configuration object.
For a list of configurable options, please refer to the class documentation of BcmScanConfig.
Assign a flowDelegate object to receive information about scan progress and the final result (PBcmFlowDelegate).
Swift:
let bcmGlobalConfig = BcmGlobalConfig(
licenseKey: "<licenseKey>",
...
)
let bcmScanConfig = BcmScanConfig(
scanTerminationOption: BcmScanConfig.ScanTerminationOptions.SCORE_WITH_TIMEOUT,
...
)
...
let bcmScanController = BcmScanController(globalConfig: BcmGlobalConfig(),
scanConfig: bcmScanConfig,
flowDelegate: self)
The settings are applied for all future scan sessions during your app's Scan Controller lifetime.
Scan Session Management
The Scan Controller by default automatically manages scan sessions, meaning it will start a scan session when presented, stop it when hidden or dismissed, and restart a new scan session after a scan completes.