BarcodeScanner.GetDefaultAsync () returns null

I am trying to read barcode data using PointOfService APIs.

I started with a clean Windows application template. Added a button and on clicking this button I have the following code

var defaultScanner = await BarcodeScanner.GetDefaultAsync();

      

but defaultScanner is always null.

I have added capabilities to the Package.appxmanifest file like

<Capabilities>
      <DeviceCapability Name="pointOfService" />
</Capabilities>

      

I am using an Adesso 4000B barcode reader.

Am I missing something?

There is one more method BarcodeScanner.FromIdAsync (string deviceId)

Can someone please tell me where can I get the deviceId of the attached barcode scanner? Tried searching in barcode scanner properties in devices and printers but no special property called DeviceId.

+3


source to share


1 answer


The scanner must be in USB HID mode to access them using the POS API. You will find programming instructions in the manual for your specific device.

For Adesso 4000B I really don't see an option for USB HID in the programming manual , so it may not be supported.



Also, there are certain times in the application life cycle when GetDefaultAsync

it seems to return null

. Make sure you call the function from your button handler or use SDK Sample for testing.

0


source







All Articles