Share via


Scale.ReadWeight Method

Call to read a weight from the scale.

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

Usage

'Usage
Dim timeout As Integer
Dim returnValue As Decimal
Dim scale1 As Scale
returnValue = scale1.ReadWeight(timeout)

Syntax

'Declaration
Public MustOverride Function ReadWeight( _
    ByVal timeout As Integer _
) As Decimal
public abstract decimal ReadWeight(
    int timeout
);
public: abstract Decimal^ ReadWeight(
    Int32 timeout
);
public abstract System.Decimal ReadWeight(
    int timeout
);
public abstract function ReadWeight(
     timeout : int
) : Decimal;

Parameters

  • timeout
    The number of milliseconds to wait for a settled weight before ReadWeight fails. If zero, ReadWeight attempts to read the scale weight, then returns the status immediately. If WaitForever, ReadWeight waits as long as needed until a weight is successfully read or an error occurs.

Remarks

The weighing process is performed synchronously and ReadWeight returns after finishing the weighing process.

If AsyncMode is FALSE, ReadWeight operates synchronously.

If AsyncMode is TRUE, weighing is performed asynchronously. ReadWeight initiates a read, then returns immediately. If ReadWeight returns a success status, weighing is started and a DataEvent containing the weight in its status parameter indicates its completion.

The weight has an assumed decimal place after the “thousands” digit position. For example, an actual value of 12345 represents 12.345, and an actual value of 5 represents 0.005.

ReadWeight returns void if successful, and it can throw the following exceptions:

Value

Meaning

Illegal

An invalid timeout parameter was specified.

Timeout

A stable non-zero weight was not available before timeout milliseconds elapsed (can only be returned if AsyncMode is FALSE).

ExtendedOverWeight

The weight was over MaximumWeight (can only be returned if AsyncMode is FALSE).

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.

Platforms

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Longhorn, and Windows 2000

Target Platforms

See Also

Reference

Scale Class
Scale Members
Microsoft.PointOfService Namespace
UnitPrice
WeightUnit
CapPriceCalculating
SalesPrice
TareWeight