SparkScan
Defined in namespace Scandit.DataCapture.Barcode.Spark.Capture
- SparkScan
class SparkScan
Added in version 6.16.0
Capture mode that implements SparkScan.
This capture mode uses the barcode scanning capability. It cannot be used together with other capture modes that require the same capabilities, e.g. BarcodeCapture.
- SparkScan()
SparkScan()
Added in version 6.16.0
Construct a new SparkScan mode with default settings.
- SparkScan()
SparkScan(SparkScanSettings settings)
Added in version 6.16.0
Construct a new SparkScan mode with the provided settings.
- Enabled
bool
Enabled { get;set; }Added in version 6.16.0
This flag indicates whether the SparkScan mode is currently processing frames to recognise barcodes.
Changing this property from false to true causes the connected SparkScanView to start its scanning flow.
Changing this property from true to false causes the connected SparkScanView to stop its scanning flow and go to idle mode.
- ApplySettings()
void
ApplySettings(SparkScanSettings settings)Added in version 6.16.0
Asynchronously applies the new settings to this mode. If the scanner is currently running, the task will complete when the next frame is processed, and will use the new settings for that frame. If the scanner is currently not running, the task will complete as soon as the settings have been stored and won’t wait until the next frame is going to be processed.
- AddListener()
void
AddListener(ISparkScanListener listener)Added in version 6.16.0
Adds the listener to this SparkScan instance.
In case the same listener is already observing this instance, calling this method will not add the listener again.
- RemoveListener()
void
RemoveListener(ISparkScanListener listener)Added in version 6.16.0
Removes a previously added listener from this SparkScan instance.
In case the listener is not currently observing this instance, calling this method has no effect.
- Feedback
SparkScanFeedback Feedback { get;set; }
Added in version 6.16.0
Deprecated since version 6.23: The feedback emitted is now specified for each detected barcode. See SparkScanView.Feedback.
Instance of SparkScanFeedback that is used by the SparkScanView to notify users about a success or error scan when SparkScanView.EmitFeedback() is invoked.
To change the feedback emitted, the SparkScanFeedback can be modified as shown below, or a new one can be assigned.
sparkScan.Feedback.Success = new Feedback(vibration: Vibration.DefaultVibration, sound: Sound.DefaultSound);
- SparkScanLicenseInfo
SparkScanLicenseInfo SparkScanLicenseInfo { get; }
Added in version 6.16.0
The object containing information about SparkScan licensing.
Note
This value is available with a small delay. To make sure it is available, set a IDataCaptureContextListener and, as soon as IDataCaptureContextListener.OnModeAdded() is called, this license object is available.
- BarcodeScanned
event EventHandler<SparkScanEventArgs> BarcodeScanned
Added in version 6.16.0
Invoked whenever a code has been scanned. The newly scanned barcode can be retrieved from SparkScanSession.NewlyRecognizedBarcode.
This method is invoked from a recognition internal thread. To perform UI work, you must dispatch to the main thread first. After receiving this event, you will typically want to start processing the scanned barcodes. Keep in mind however, that any further recognition is blocked until this event completes. Therefore, if you need to perform a time-consuming operation, like querying a database or opening an URL encoded in the barcode data, consider switching to another thread.
Sometimes, after receiving this event, you may want to pause scanning or to stop scanning completely.
To pause scanning, but keep the camera (frame source) running, just set the SparkScan’s enabled property to false.
sparkScan.Enabled = false
To stop scanning, you will need to both disable the capture mode and stop the frame source. While it’s possible to only stop the camera and keep the capture mode enabled, this may lead to additional scan events being delivered, which is typically not desired. The following lines of code show how to disable the capture mode and stop the frame source as well:
// no more events will be invoked after this call. sparkScan.Enabled = false // Asynchronously turn off the camera sparkScan.Context.FrameSource?.SwitchToDesiredStateAsync(FrameSourceState.Off);
- SessionUpdated
event EventHandler<SparkScanEventArgs> SessionUpdated
Added in version 6.16.0
Invoked after a frame has been processed by SparkScan and the session has been updated. In contrast to BarcodeScanned, this event is invoked, regardless whether a code was scanned or not. If codes were recognized in this frame, this event is invoked after BarcodeScanned.
This method is invoked from a recognition internal thread. To perform UI work, you must dispatch to the main thread first. Further recognition is blocked until this event completes. It is thus recommended to do as little work as possible in this event handler.