Zebra TC75 Scanner problem - Scanning Aztec containing a "raw" byte array

M Magnus Balldin 3 years 7 months ago
6 1 0

I am developing an application for TC75 which involve scanning (with the built in 2D area imager) an Aztek image. The application is based on Xamarin. Therefore I am using “EMDK for Xamarin 2.0” (http://techdocs.zebra.com/emdk-for-xamarin/2-0/guide/about/). I am initializing the scanner according to the sample code here: http://techdocs.zebra.com/emdk-for-xamarin/2-0/tutorial/barcodeapitutor…

I have set up the scanner configuration according to this code snippet (C#):

ScannerConfig config = scanner.GetConfig();
config.SkipOnUnsupported = ScannerConfig.SkipOnUnSupported.None;
config.ScanParams.DecodeLEDFeedback = true;
config.ReaderParams.ReaderSpecific.ImagerSpecific.PickList = ScannerConfig.PickList.Enabled;
config.DecoderParams.Aztec.Enabled = true;
scanner.SetConfig(config);

I can scan the Aztek and I receive an string representing the Aztek. So far so good!

Here is the problem. The Aztek contains a binary format. In other words, the Aztek contains a “raw” byte array. If it helps here is how the Aztek is generated (in C#) (The class Barcode is comming from a NuGet package called ”Bytescout.BarCode”):

public static Bitmap EncodeAztecWithBytescoutUsingRawBytes(string base64, int size, bool useCompression = true)
{
var bytes = Base64Url.Decode(base64);

if (useCompression)
{
bytes = Compress(bytes);
}

// Create Barcode component instance
using (var barcode = new Barcode())
{
barcode.RegistrationName = "demo";
barcode.RegistrationKey = "demo";

barcode.Symbology = SymbologyType.Aztec;

// Force binary mode
barcode.Options.AztecCompactionMode = AztecCompactionMode.Binary;
barcode.ResolutionX = size;
barcode.ResolutionY = size;

// Level 2 error correction. 23% of data region will be filled by error correction data
barcode.Options.AztecErrorCorrectionLevel = AztecErrorCorrectionLevel.Level2;

using (var ms = new MemoryStream(bytes))
{
barcode.LoadValueFromStream(ms);
}

var image = barcode.GetImage();

var bitmap = CropToSquare(image);

return bitmap;
}
        }

I have tried to recreate the byte array used in creating the Aztec bitmap but I have not been successfull. It seems like the scanner i not returning the raw data used to create the Aztek i.e. the "bytes" array in the code above is not the same after scan. Any ideas?

Please Register or Login to post a reply

1 Replies

Y Yanis Dalabiras

Have you tried creating the barcode without using compression?  bytes = Compress(bytes);

CONTACT
Can’t find what you’re looking for?