Microsoft POS for .NET Overview
Microsoft POS for .NET is a class library that is part of Microsoft Windows Embedded for Point of Service. The class library provides .NET applications with a simple and consistent interface for communicating with Point of Service (POS) peripheral devices, such as bar code scanners, magnetic card readers, receipt printers, and so on. In addition, POS for .NET includes a set of programming interfaces and base classes for vendors of POS peripheral devices. These interfaces and classes help vendors write software components, or service objects, for their devices.
POS for .NET is Microsoft’s implementation of the industry’s Unified Point of Service (UPOS) version 1.8 standards, for the .NET platform. POS for .NET is also backward-compatible with existing implementations of UPOS on the Microsoft Windows platform, named OLE for Point of Service, or OPOS. For more information about UPOS and OPOS, go to http://www.nrf-arts.org/. POS for .NET is implemented for Microsoft .NET Framework version 1.1.
Benefits of Implementing POS for .NET
POS for .NET simplifies development for applications by providing an application programming interface (API) which builds upon the architecture of .NET Framework class libraries. POS for .NET simplifies development of service objects for peripherals by providing a set of .NET base classes for the most commonly used device types. In addition, POS for .NET brings support for Plug-n-Play to the world of POS peripherals. This, along with remote management and administration features, makes it easier to manage POS systems.
Key components of POS for .NET
POS for .NET consists of two assemblies, Microsoft.PointOfService.dll and Microsoft.PointOfService.ControlBase.dll.
The Microsoft.PointOfService.dll assembly defines interface classes for the 24 POS device types defined by UPOS. These interface classes are programming interface contracts between a POS application and service objects, and they expose all of the standard functionality defined for each device by UPOS. In addition, Microsoft.PointOfService.dll contains the following classes:
- PosCommon, which contains programming interface contracts for all Upos Common Properties and Methods;
- PosExplorer, which provides POS applications with information about what POS devices are available on the system and instantiates service objects for devices requested by applications. Also, PosExplorer provides a way for POS applications to receive Plug-n-Play notifications when POS devices are attached or removed from the system;
- PosExceptionet al classes, which are used to communicate error conditions to the POS application via exceptions; and
- PosEventArgset al classes, which are used for the management and delivery of POS events.
The Microsoft.PointOfService.ControlBase.dll assembly contains 24 “basic” classes for the 24 device types defined by UPOS. These classes provide a consistent programming interface for the service object for each of the 24 devices. Specifically, basic classes include:
- A generic constructor, which creates an instance of the class and initializes basic device statistics;
- Programmatic access to the CommonProperties helper class, which allows a service object to access without required state verification and update PosCommon properties that are designated read-only for the application;
- Code that manages state verification of the device—that is, code that checks to ensure the device has been opened, claimed, or enabled by the application prior to accessing properties or executing methods;
- Code that manages and delivers events to the application;
- A set of protected methods the service object can use to manage and update hardware-based statistics; and
- A set of Dispose methods, based on the .NET Framework IDisposable architecture.
For the 8 fully supported POS devices, the Microsoft.PointOfService.ControlBase.dll also contains a set of “base” classes. These classes derive from the corresponding device basic class and contain Microsoft’s more fully implemented, UPOS-compliant code for the device. When deriving from these base classes, service objects typically need only provide implementations for the Open and CheckHealth methods, as well as any methods that handle access to the hardware device itself, such as the physical opening of the cash drawer, the clearing of hardware device memory, and so on. POS for .NET base classes contain the following features:
- A generic implementation of the Open method, which the service object can use as the starting point for its own implementation;
- Code that manages state verification for all property access and method calls;
- Code that manages and delivers events to the application;
- Code that manages and updates all UPOS defined statistics for the device;
- Code that provides all standard validations and device functionality—including appropriate update and management of the device’s property values. The POS for .NET code also calls, as appropriate, implementations provided by the service object; and
- A set of “helper classes”, which can be used by the service object to return state and error information, queue asynchronous operations, update device properties while bypassing state verification, and so on.
Two other components come with POS for .NET—the POS for .NET WMI provider and its associated command line tool. POS for .NET WMI provider gives administrators a way to programmatically configure the library on a local or remote POS system. The Posdm.exe command line tool provides a convenient command line interface for the WMI provider, for use in local or remote configurations that do not require programming. For more information, see the POS Device Management Guide.
POS for .NET and OPOS
OPOS is an existing implementation of UPOS for Microsoft Windows, based on Component Object Model (COM) technology. POS for .NET constitutes an improved, next-generation implementation of UPOS for Microsoft Windows, based on .NET. In comparison to OPOS, POS for .NET increases productivity of developers of both POS applications and service objects, by providing all the benefits of .NET managed code while at the same time exposing a set of easy to use interfaces and base classes.
POS for .NET is backward-compatible with OPOS version 1.8 service objects. In other words, applications using POS for .NET can simultaneously interact with .NET service objects written for POS for .NET and OPOS service objects.