CashDrawer CashDrawer CashDrawer CashDrawer Class

Definition

A cash drawer device in a retail scenario.

public : sealed class CashDrawer : ICashDrawer, IClosablepublic sealed class CashDrawer : ICashDrawer, IDisposablePublic NotInheritable Class CashDrawer Implements ICashDrawer, IDisposable// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

To get a CashDrawer object, use the FromIdAsync or GetDefaultAsync static methods.

See the cash drawer sample for an example implementation.

Properties

Capabilities Capabilities Capabilities Capabilities

The functionality of the cash drawer device as exposed by API.

public : CashDrawerCapabilities Capabilities { get; }public CashDrawerCapabilities Capabilities { get; }Public ReadOnly Property Capabilities As CashDrawerCapabilities// You can use this property in JavaScript.
Value
CashDrawerCapabilities CashDrawerCapabilities CashDrawerCapabilities CashDrawerCapabilities

The functionality of the cash drawer device as exposed by API.

DeviceId DeviceId DeviceId DeviceId

The identifier string of the cash drawer device.

public : PlatForm::String DeviceId { get; }public string DeviceId { get; }Public ReadOnly Property DeviceId As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

String representing the ID of the device.

DrawerEventSource DrawerEventSource DrawerEventSource DrawerEventSource

Gets the CashDrawerEventSource to allow the app to detect the open/close state of the drawer. The actual current state is reported by IsDrawerOpen..

public : CashDrawerEventSource DrawerEventSource { get; }public CashDrawerEventSource DrawerEventSource { get; }Public ReadOnly Property DrawerEventSource As CashDrawerEventSource// You can use this property in JavaScript.
Value
CashDrawerEventSource CashDrawerEventSource CashDrawerEventSource CashDrawerEventSource

The cash drawer event source. If the drawer does not support open/close detection, then it will return null.

IsDrawerOpen IsDrawerOpen IsDrawerOpen IsDrawerOpen

Indicates whether the cash drawer is open.

public : PlatForm::Boolean IsDrawerOpen { get; }public bool IsDrawerOpen { get; }Public ReadOnly Property IsDrawerOpen As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

True if the drawer is open, otherwise false.

Status Status Status Status

Get the current power and availability status of the cash drawer.

public : CashDrawerStatus Status { get; }public CashDrawerStatus Status { get; }Public ReadOnly Property Status As CashDrawerStatus// You can use this property in JavaScript.

Methods

CheckHealthAsync(UnifiedPosHealthCheckLevel) CheckHealthAsync(UnifiedPosHealthCheckLevel) CheckHealthAsync(UnifiedPosHealthCheckLevel) CheckHealthAsync(UnifiedPosHealthCheckLevel)

Gets the device's health state asynchronously.

public : IAsyncOperation<PlatForm::String> CheckHealthAsync(UnifiedPosHealthCheckLevel level)public IAsyncOperation<string> CheckHealthAsync(UnifiedPosHealthCheckLevel level)Public Function CheckHealthAsync(level As UnifiedPosHealthCheckLevel) As IAsyncOperation( Of string )// You can use this method in JavaScript.
Parameters
Returns

This value is intended to be reflected in the app interface immediately so the user of the app can interpret it. For example, it will return “OK” as the health string if the device state is good.

Remarks

This feature behaves identically to corresponding features in the other POS peripherals, and support for this operation is required by the UPOS standard.

ClaimDrawerAsync() ClaimDrawerAsync() ClaimDrawerAsync() ClaimDrawerAsync()

Attempts to get exclusive access on the cash drawer.

public : IAsyncOperation<ClaimedCashDrawer> ClaimDrawerAsync()public IAsyncOperation<ClaimedCashDrawer> ClaimDrawerAsync()Public Function ClaimDrawerAsync() As IAsyncOperation( Of ClaimedCashDrawer )// You can use this method in JavaScript.
Returns

Close() Close() Close() Close()

Close the cash drawer session.

public : void Close()This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Dispose() Dispose() Dispose() Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

This member is not implemented in C++void Dispose()Sub Disposevoid Dispose()

FromIdAsync(String) FromIdAsync(String) FromIdAsync(String) FromIdAsync(String)

Creates CashDrawer object from the DeviceInformation.Id.

public : static IAsyncOperation<CashDrawer> FromIdAsync(PlatForm::String deviceId)public static IAsyncOperation<CashDrawer> FromIdAsync(String deviceId)Public Static Function FromIdAsync(deviceId As String) As IAsyncOperation( Of CashDrawer )// You can use this method in JavaScript.
Parameters
deviceId
PlatForm::String String String String

The DeviceInformation.Id that identifies a specific cash drawer, which can be retrieved from the DeviceId property.

Returns

The cash drawer specified by the unique device identifier. Returns a null object in the following cases:

  • The specific device is not found.
  • Access denied to the existing device. The user can deny access to a device, which is not treated as an exception.

GetDefaultAsync() GetDefaultAsync() GetDefaultAsync() GetDefaultAsync()

Gets the default paired or locally-connected cash drawer.

public : static IAsyncOperation<CashDrawer> GetDefaultAsync()public static IAsyncOperation<CashDrawer> GetDefaultAsync()Public Static Function GetDefaultAsync() As IAsyncOperation( Of CashDrawer )// You can use this method in JavaScript.
Returns

The default locally-connected drawer. May return null if there is no drawer available.

GetDeviceSelector() GetDeviceSelector() GetDeviceSelector() GetDeviceSelector()

Gets an Advanced Query Syntax (AQS) string that you can use to list the available cash drawers.

public : static PlatForm::String GetDeviceSelector()public static string GetDeviceSelector()Public Static Function GetDeviceSelector() As string// You can use this method in JavaScript.
Returns
PlatForm::String string string string

An Advanced Query Syntax (AQS) string that is used to enumerate available cash drawers.

GetDeviceSelector(PosConnectionTypes) GetDeviceSelector(PosConnectionTypes) GetDeviceSelector(PosConnectionTypes) GetDeviceSelector(PosConnectionTypes)

Gets an Advanced Query Syntax (AQS) string that you can use to list the cash drawers available over the specified connection types

public : static PlatForm::String GetDeviceSelector(PosConnectionTypes connectionTypes)public static string GetDeviceSelector(PosConnectionTypes connectionTypes)Public Static Function GetDeviceSelector(connectionTypes As PosConnectionTypes) As string// You can use this method in JavaScript.
Parameters
connectionTypes
PosConnectionTypes PosConnectionTypes PosConnectionTypes PosConnectionTypes

A list of the connection types to check for available cash drawers.

Returns
PlatForm::String string string string

An Advanced Query Syntax (AQS) string that is used to enumerate the cash drawers available over the specified connection types

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

GetStatisticsAsync(IIterable) GetStatisticsAsync(IIterable) GetStatisticsAsync(IIterable) GetStatisticsAsync(IIterable)

Retrieves the requested statistics from the cash drawer.

public : IAsyncOperation<PlatForm::String> GetStatisticsAsync(IIterable<PlatForm::String> statisticsCategories)public IAsyncOperation<string> GetStatisticsAsync(IEnumerable<String> statisticsCategories)Public Function GetStatisticsAsync(statisticsCategories As IEnumerable<String>) As IAsyncOperation( Of string )// You can use this method in JavaScript.
Parameters
statisticsCategories
IIterable<PlatForm::String> IEnumerable<String> IEnumerable<String> IEnumerable<String>

The list of statistics to retrieve.

  • An empty string ("") retrieves all statistics.
  • "U_" retrieves all UnifiedPOS defined statistics.
  • "M_" retrieves all manufacturer defined statistics.
  • "name1" and/or "name2" retrieves specific named statistics as defined by the UnifiedPOS or manufacturer.
  • Any combination of individual and groups names ("name3", "U_", "M_").
Returns

String representing the requested statistics.

Events

StatusUpdated StatusUpdated StatusUpdated StatusUpdated

Indicates there has been a change in the power availability status of the drawer.

public : event TypedEventHandler StatusUpdated<CashDrawer,  CashDrawerStatusUpdatedEventArgs>public event TypedEventHandler StatusUpdated<CashDrawer,  CashDrawerStatusUpdatedEventArgs>Public Event StatusUpdated<CashDrawer,  CashDrawerStatusUpdatedEventArgs>// You can use this event in JavaScript.

See Also