Share via


BarcodeScanner Class

Definition

Represents the barcode scanner device.

[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class BarcodeScanner
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class BarcodeScanner : System.IDisposable
Inheritance
Object BarcodeScanner
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

This object is created when GetDefaultAsync or FromIdAsync method completes.

See the barcode scanner sample for an example implementation.

Version history

Windows version SDK version Value added
1607 14393 VideoDeviceId
1703 15063 GetDeviceSelector(PosConnectionTypes)

Properties

Capabilities

Gets the capabilities of the specified barcode scanner.

DeviceId

Gets the DeviceInformation.Id of the barcode scanner.

VideoDeviceId

Retrieves the video device ID which represents the camera lens associated with the claimed barcode scanner. (Not supported on mobile platforms)

Methods

CheckHealthAsync(UnifiedPosHealthCheckLevel)

Tests the state of the barcode scanner.

ClaimScannerAsync()

Attempts to get an exclusive access to the barcode scanner.

Close()

Close the barcode scanner session, allowing it to be claimed by another client. For C++ and JavaScript, use Close(). For C# and Visual Basic, use Dispose().

Dispose()

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

FromIdAsync(String)

Creates BarcodeScanner object from the DeviceInformation.Id.

GetDefaultAsync()

Returns the first available barcode scanner.

GetDeviceSelector()

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

GetDeviceSelector(PosConnectionTypes)

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

GetSupportedProfiles()

Gets the list of profiles supported by the barcode scanner.

Important

This API applies only to Build 10240 and Build 10586 of the Windows Mobile device family (Windows Mobile Extensions for the UWP). This API doesn't apply to the Windows Desktop device family, nor to other device families, nor to builds of Windows Mobile other than 10240 and 10586. When called on an operating system (OS) to which it doesn't apply, the behavior of this API is undefined. For more info about device families, see Device family extension SDKs and API contracts.

GetSupportedSymbologiesAsync()

Gets the symbologies supported by the claimed barcode scanner.

IsProfileSupported(String)

Determines whether the profile is supported.

Important

This API applies only to Build 10240 and Build 10586 of the Windows Mobile device family (Windows Mobile Extensions for the UWP). This API doesn't apply to the Windows Desktop device family, nor to other device families, nor to builds of Windows Mobile other than 10240 and 10586. When called on an operating system (OS) to which it doesn't apply, the behavior of this API is undefined. For more info about device families, see Device family extension SDKs and API contracts.

IsSymbologySupportedAsync(UInt32)

Determines whether the specified symbology is supported by the barcode scanner.

RetrieveStatisticsAsync(IIterable<String>)

Retrieves the requested statistics from the barcode scanner.

Events

StatusUpdated

Occurs when the barcode scanner detects an operation status change.

Applies to

Product Versions
WinRT Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100