I'm currently developing an UWP App in which one step is to scan a barcode encoded in code39 using the camera.
With other (UWP-)Apps I found in the store my sample code does get recognized correctly as code39 encoded (so I assume it is a valid code).
I looked at the BarcodeScanner Sample from the microsoft uwp samples on github (I also looked at the CameraBarcodeScanner sample, which got removed from the github recently)
When I use BarcodeScanner
and ClaimedBarcodeScanner
classes from Windows.Devices.PointOfService
, other barcodes (EAN8 or EAN13) get recognized correctly. (So I assume barcode regognition as such works)
I tried using SetActiveSymbologiesAsync
to enable the scanner to find code39 barcodes. Whenever I call it without BarcodeSymbologies.Ean8
in the list, an exception gets thrown:
"A device attached to the system is not functioning. (Exception from HRESULT: 0x8007001F)"
When I call it with BarcodeSymbologies.Ean8
in the list, it falsely recognizes an EAN8 code when pointing the camera to the code39 barcode.
Here is my code:
private void OnScannerDataReceived(ClaimedBarcodeScanner sender, BarcodeScannerDataReceivedEventArgs args)
{
var dataLabel = string.Format("{0}", Encoding.UTF8.GetString(args.Report.ScanData));
var symbol = BarcodeSymbologies.GetName(args.Report.ScanDataType);
Debug.WriteLine($"LABEL: {dataLabel} | BARCODE: {symbol}.");
BarcodeReceived?.Invoke(this, dataLabel);
}
Thank you for reporting this issue.
Well, the scenario you asked is using our in-box software decoder with a standard camera lens. Unfortunately we have discovered issues with this decoder accurately reading 1D barcodes, including Code 39 and will be addressing this in a future release.
Code 39 works fine with physical barcode scanners, so this is an issue specific to the camera lens decoder. We hope to have a new software decoder available in a future release that will address this issue. We would recommend using this camera lens decoder with QR Code only for now.
@Nasto,
The Spring 2018 update to Windows 10 version 1803 has introduced a new software decoder that will support Code39. You can find more information at https://aka.ms/camerabarcode. The UWP sample application for barcode scanner has also been updated to demonstrate camera barcode support.
Terry Warwick, Microsoft
User contributions licensed under CC BY-SA 3.0