PosPrinterBase Class
2/27/2008
PosPrinterBase class derives from PosPrinterBasic class and contains more complete device functionality implemented by POS for .NET for support of POS printer devices.
Namespace: Microsoft.PointOfService.BaseServiceObjects
Assembly: Microsoft.PointOfService.ControlBase (in microsoft.pointofservice.controlbase.dll)
Syntax
'Declaration
Public MustInherit Class PosPrinterBase
Inherits PosPrinterBasic
public abstract class PosPrinterBase : PosPrinterBasic
public ref class PosPrinterBase abstract : public PosPrinterBasic
public abstract class PosPrinterBase extends PosPrinterBasic
public abstract class PosPrinterBase extends PosPrinterBasic
Remarks
PosPrinterBase class derives from PosPrinterBasic class and contains more complete device functionality implemented by POS for .NET for support of POS printer devices. When deriving from PosPrinterBase, service objects can take advantage of code that provides a structured environment supporting the standard functionality of printer devices.
As with all other devices, the service object should implement the CheckHealth and ClearInput methods. PosPrinterBase class provides the core functionality for opening, claiming, and enabling printer 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.
PosPrinterBase class provides implementations for all UPOS-defined print methods. For each method, PosPrinterBase performs basic validations and then calls the service object's implementation. For example, for RotatePrint method, after performing validations, PosPrinterBase calls the service object's implementation of the RotatePrintImpl method. Although in most cases PosPrinterBase provides a default implementation that returns without error, service objects should plan to provide their own implementation for each of the print methods.
PosPrinterBase makes use of a number of helper classes. These are:
The PrintResults class, returned by a number of methods, which the service object should use to provide updates to printer statistics and to report any error conditions that have occurred;
The PrinterState class, used to capture and store a group of printer property values set by the application for a print operation, then passed as a parameter for several print methods;
PrintOperation and <PrintMethodName>Operation derived classes, which store state information for a specific print operation at the time of the method call;
PrintOperationCollection, which is enumerable and contains a list of requested print operations; and
RotatePrintCollection, which is enumerable and contains a list of requested rotate print operations.
Print operations can be performed synchronously or asynchronously, depending on the value of the AsyncMode property. When the application sets AsyncMode to TRUE, asynchronous processing is enabled. PosPrinterBase class will perform basic validations for each method called by the application, then add the print request to an internal queue and return to the application. (State and property value information is captured at the time of the call, to be processed later. See the description of the helper classes above.) Requests added to the internal queue are processed in FIFO order.
To process the print operations on the internal queue, PosPrinterBase class dequeues the next request, then calls the appropriate Print*Impl method, based on the type of print operation. (State information is captured in an instance of the PrinterState helper class and passed as a parameter to the appropriate Print*Impl method.) Service objects should process the request in the same manner that they would a synchronous operation.
When in asynchronous mode, PosPrinterBase class updates printer statistics based on the values returned by the service object in the PrintResults helper class. In addition, PosPrinterBase class sends either an OutputCompleteEvent event or an ErrorEvent event, as appropriate. If PosPrinterBase class sends an ErrorEvent event, it manages the processing of Retry or Clear logic, depending on the response from the application.
Inheritance Hierarchy
System.Object
Microsoft.PointOfService.PosDevice
Microsoft.PointOfService.PosCommon
Microsoft.PointOfService.PosPrinter
Microsoft.PointOfService.BasicServiceObjects.PosPrinterBasic
Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase
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
PosPrinterBase Members
Microsoft.PointOfService.BaseServiceObjects Namespace