Share via


PosCommon.Claim Method (POS for .NET v1.14 SDK Documentation)

3/2/2014

Requests exclusive access to the device.

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

Syntax

'Declaration
Public MustOverride Sub Claim ( _
    timeout As Integer _
)
public abstract void Claim (
    int timeout
)
public:
virtual void Claim (
    int timeout
) abstract
public abstract void Claim (
    int timeout
)
public abstract function Claim (
    timeout : int
)

Parameters

  • timeout
    Contains the maximum number of milliseconds to wait for exclusive access to be satisfied.

Remarks

Many devices require an application to claim them before they can be used.

If the timeout parameter indicates the maximum time in milliseconds that the Service Object should wait for exclusive access to be granted. If timeout is set to 0 (zero), the method tries to claim the device, and then returns the appropriate status immediately. If timeout is set to WaitForever (-1), Claim waits as long as needed for exclusive access to be satisfied.

An application can claim a device multiple times without generating an error. When the Claim method is successful, POS for .NET sets the Claimed property to true and loads the appropriate statistics counters and device information.

All base and basic class implementations of the Claim method use a system-wide name Mutex object to provide exclusive access to the device. The name of the Mutex object is derived from a combination of the DeviceName and DevicePath properties and device type.

Claim may throw a PosControlException exception with the following values:

Value

Meaning

Illegal

One of the following conditions has occurred:

  • The device cannot currently be claimed for exclusive access;

  • A value of less than -1 has been specified for the timeout parameter.

Timeout

Another application has exclusive access to the device and did not relinquish control before timeout milliseconds expired.

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

PosCommon Class
PosCommon Members
Microsoft.PointOfService Namespace
Release