Skip to content

A simplified abstraction over a collection of barcode scanner SDK's and supports device detection. Supports the following device: Intermec, Motorola, Symbol, and Casio

License

Notifications You must be signed in to change notification settings

ff-fernando/BarcodeScannerFactory

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BarcodeScannerFactory

A simplified abstraction over a collection of barcode scanner SDK's with device detetction support for the .NET Compact Framework 3.5

Supports the following device:

  • Intermec
  • Motorola
  • Symbol
  • Casio

It is recommended to use the ReaderFactory for creating instances of IBarcodeScanner. Since IBarcodeScanner implements IDisposable and the implementations must release resources in the Dispose method. It is recommended to require that the IBarcodeScanner instances is Disposed when no longer to be in use, otherwise the device might end up in a very unstable state and might require a restart.

Another way to get an instance of IBarcodeScanner is through the BarcodeScannerFacade. This class implements a facade over retrieving the correct implementation of IBarcodeScanner based on the OEM information provided by the operating system. The BarcodeScannerFacade also exposes a singleton instance of IBarcodeScanner which might be useful in a scenario in which changing the state of the scanner takes too much time, or where barcode scanning is enabled everywhere in the application

This example shows how you might use this interface through the ReaderFactory

private IBarcodeScanner reader;

private string ScanBarcode()
{
    if (reader == null)
        reader = new ReaderFactory().GetReader()
    reader.Scanned += OnScan;
    reader.Open();
    reader.Scan();
}

private void OnScan(object sender, ScannedDataEventArgs e)
{
    MessageBox.Show(e.Data[0].Text);
}

This example shows how you might use this interface through the BarcodeScannerFacade

private string ScanBarcode()
{
    BarcodeScannerFacade.Instance.Scanned += OnScan;
    BarcodeScannerFacade.Instance.Open();
    BarcodeScannerFacade.Instance.Scan();
}

private void OnScan(object sender, ScannedDataEventArgs e)
{
    MessageBox.Show(e.Data[0].Text);
}

This example shows how you might use this interface through the BarcodeReader. This is not the recommended usage, and is marked as [Obsolete]

private BarcodeReader reader;

private string ScanBarcode()
{
    if (reader == null)
        reader = new BarcodeReader();
    reader.Scanner.Scanned += OnScan;
    reader.Scanner.Open();
    reader.Scanner.Scan();
}

private void OnScan(object sender, ScannedDataEventArgs e)
{
    MessageBox.Show(e.Data[0].Text);
}

About

A simplified abstraction over a collection of barcode scanner SDK's and supports device detection. Supports the following device: Intermec, Motorola, Symbol, and Casio

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%