Class QrCodeReader
- Namespace
- Iot.Device.AtomQrCode
- Assembly
- Iot.Device.AtomQrCode.dll
Class to control an M5Stack ATOM QR Code reader module.
public class QrCodeReader
- Inheritance
-
QrCodeReader
Constructors
QrCodeReader(string)
Initializes a new instance of the QrCodeReader class.
public QrCodeReader(string portName)
Parameters
portName
stringThe port to use (for example, COM1).
Properties
BuzzerVolume
Sets the buzzer volume intensity.
public BuzzerVolume BuzzerVolume { set; }
Property Value
EnableBeep
Sets a value indicating whether to enable all beeps. Sets to false to disable all beeps.
public bool EnableBeep { set; }
Property Value
FloodLight
Sets the flood light mode.
public FloodLight FloodLight { set; }
Property Value
Positioninglight
Sets the positioning light mode.
public Positioninglight Positioninglight { set; }
Property Value
Terminator
Gets or sets the terminator to be appended to the code data.
public Terminator Terminator { set; }
Property Value
TriggerMode
Gets or sets the trigger mode for scanning.
public TriggerMode TriggerMode { get; set; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
RestoreToFactoryDefaults()
Restore all parameters and configurations to factory defaults.
public void RestoreToFactoryDefaults()
StartScanning()
Starts scanning for barcodes in automatic mode. Requires to set the scan mode to Autosensing.
public void StartScanning()
Exceptions
- InvalidOperationException
If TriggerMode hasn't been set to Continuous previously.
StopScanning()
Stop scanning. Requires a previous call to StartScanning().
public void StopScanning()
Exceptions
- InvalidOperationException
If StartScanning() hasn't been set called before to start scanning.
TryReadBarcode(ScanTimeout, out string)
Tries to read a barcode within the provided timeout. Requires previously setting the scan mode to Host.
public bool TryReadBarcode(ScanTimeout timeout, out string data)
Parameters
timeout
ScanTimeoutTimeout waiting for a barcode to be read.
data
stringA string with the data read from the barcode.
Returns
Remarks
This call will block until a code is read by the scanner or a timeout occurs waiting to scan a barcode.
Exceptions
- ArgumentException
If
timeout
can't be rounded to a valid timeout value.- InvalidOperationException
If TriggerMode hasn't been set to Host previously.
-or-
A previous call has been made to StartScanning() and continuous reading it's active.
///-or-
If TriggerMode has been set to any mode other than Host.
TryReadBarcode(out string)
Tries to read a bar code. Requires previously setting the scan mode to Host.
public bool TryReadBarcode(out string data)
Parameters
data
stringA string with the data read from the barcode.
Returns
Remarks
This call will block until a code is read by the scanner or a timeout occurs waiting to scan a barcode.
Exceptions
- InvalidOperationException
If TriggerMode hasn't been set to Host previously.
-or-
A previous call has been made to StartScanning() and continuous reading it's active.
///-or-
If TriggerMode has been set to any mode other than Host.
Events
BarcodeDataAvailable
Indicates that barcode data is available from the QrCodeReader object.
public event BarcodeDataAvailableEventHandler BarcodeDataAvailable