Scale Class
2/27/2008
Defines the programmatic interface for a UPOS scale device.
Namespace: Microsoft.PointOfService
Assembly: Microsoft.PointOfService (in microsoft.pointofservice.dll)
Syntax
'Declaration
Public MustInherit Class Scale
Inherits PosCommon
public abstract class Scale : PosCommon
public ref class Scale abstract : public PosCommon
public abstract class Scale extends PosCommon
public abstract class Scale extends PosCommon
Remarks
Capabilities
The scale device has the following capability:
- Provides item weight to the application. The measure of weight may be in grams, kilograms, ounces, or pounds, depending upon the scale device.
The scale may have the following additional capabilities:
Provides item weight to the application. The measure of weight may be in grams, kilograms, ounces, or pounds, depending upon the scale device.
Includes an integrated display with the current weight, or with the current weight plus application-specified text.
Performs price calculations (weight X unit price) and returns the sale price. (This feature is mostly used in Europe.)
Supports application setting of tare weight.
Supports application zeroing of the scale.
A scale device is used to obtain weight for two distinct purposes, legal weight for calculating price, and live weight for updating customer displays. The following functionality was added to provide an interface for obtaining scale status and live weight:
A scale weight status update capability property, CapStatusUpdate.
A scale weight status notify property, StatusNotify, to enable or disable weight status event notification.
A ScaleLiveWeight property containing a value to be used for updating a customer display with the current scale weight.
Extensions to the ReadWeight method and StatusUpdateEvent for scale weight status.
Model
The general model of a scale is:
A scale returns the weight of an item placed on its weighing surface.
The primary scale method is ReadWeight. By default, it is performed synchronously. It returns after reading data from the scale. If an error occurs or if the timeout elapses, the ReadWeight method returns with an error code.
If the property AsyncMode is true when ReadWeight is called, then the method is performed asynchronously. It initiates event driven input and returns immediately. The timeout parameter specifies the maximum time the application wants to wait for a settled weight. Additional points are:
If an error occurs while initiating event-driven input (such as the device is offline), then an error code is returned by ReadWeight. Otherwise, ReadWeight returns a success status to the application, and scale processing continues asynchronously.
If a settled weight is received, then a DataEvent is queued containing the weight data in the status parameter.
If a scale error occurs (including a timeout with no settled weight), then an ErrorEvent is queued with an error code. The application event handler may retry the weighing process by setting the errorResponse parameter to Retry.
Only one asynchronous call to ReadWeight can be in progress at a time. Nesting of asynchronous scale operations is illegal.
An asynchronous scale operation can be cancelled with the ClearInput method.
For price-calculating scales, the application must set the UnitPrice property before calling ReadWeight. After a weight is read (and just before the DataEvent is delivered to the application, for asynchronous mode), the service object sets the SalesPrice property to the calculated price of the item.
Device Sharing
The scale is an exclusive-use device, as follows:
After opening the device, properties are readable.
The application must claim the device before enabling it.
The application must claim and enable the device before calling methods that manipulate the device.
Inheritance Hierarchy
System.Object
Microsoft.PointOfService.PosDevice
Microsoft.PointOfService.PosCommon
Microsoft.PointOfService.Scale
Microsoft.PointOfService.BasicServiceObjects.ScaleBasic
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.