ScannerBase Class (POS for .NET v1.12 SDK Documentation)

2/27/2008

Contains most of the functionality for support of scanner devices.

Namespace: Microsoft.PointOfService.BaseServiceObjects
Assembly: Microsoft.PointOfService.ControlBase (in microsoft.pointofservice.controlbase.dll)

Syntax

'Declaration
Public MustInherit Class ScannerBase
    Inherits ScannerBasic
public abstract class ScannerBase : ScannerBasic
public ref class ScannerBase abstract : public ScannerBasic
public abstract class ScannerBase extends ScannerBasic
public abstract class ScannerBase extends ScannerBasic

Remarks

ScannerBase class derives from ScannerBasic class and contains most of the functionality for support of scanner devices. When deriving from ScannerBase, service objects need only implement the CheckHealth and DirectIO methods. Optionally, service objects can provide implementations for the DecodeScanDataLabel and DecodeScanDataType protected methods if they wish to delay decoding of the ScanDataLabel and ScanDataType properties until the application requests those properties.

ScannerBase class provides the core functionality for opening, claiming, and enabling scanner devices. Typically, though, service objects will want to override these methods to add their own custom processing. (A typical example would be to update device statistics during the Open method, or to bring the device online when the application enables it.) When overriding these methods, the service object must call the base class implementation.

ScannerBase class provides two protected methods, GoodScan and FailedScan, to manage scanned data. When data has been scanned, the service object should call the appropriate method. When GoodScan is called, ScannerBase class queues a DataEvent event and increments the StatisticGoodScanCount statistic. When BadScan is called, ScannerBase class queues an ErrorEvent event. The ScannerBase class event queue handles the details of firing the events to the application when the conditions are correct.

ScannerBase class allows service object writers the option of decoding the scan data into the ScanDataType and ScanDataLabel properties either at the time the data is scanned or at a later time when requested by the application. The syntax of the overloads for the GoodScan method reflect these options--one syntax takes only raw scanned data, the other takes the decoded scanned data. If the service object uses the GoodScan syntax for raw scanned data, the service object must override the DecodeScanDataLabel and DecodeScanDataType methods with its own implementations. ScannerBase class will call these implementations, passing in the raw scanned data, when the application requests the ScanDataLabel and ScanDataType properties. If the service object uses the GoodScan syntax that takes decoded scanned data, ScannerBase class doesn't call the DecodeScanDataLabel and DecodeScanDataType methods.

Inheritance Hierarchy

System.Object
   Microsoft.PointOfService.PosDevice
     Microsoft.PointOfService.PosCommon
       Microsoft.PointOfService.Scanner
         Microsoft.PointOfService.BasicServiceObjects.ScannerBasic
          Microsoft.PointOfService.BaseServiceObjects.ScannerBase

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread-safe. Any instance members are not guaranteed to be thread-safe.

See Also

Reference

ScannerBase Members
Microsoft.PointOfService.BaseServiceObjects Namespace