Zembra Xamarin EMDK ScannerException

A Alessandro Caliaro 2 years 11 months ago
76 4 0

Hi.

I am tring this code: http://techdocs.zebra.com/emdk-for-xamarin/3-0/tutorial/barcodeapitutor…
Basic Scanning Tutorial using Barcode API - Zebra Technologies Techdocs

It seems to work but I have an exception here:

   try   {   //Get the feature object such as BarcodeManager object for accessing the feature.  barcodeManager = (BarcodeManager)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);  scanner = barcodeManager.GetDevice(BarcodeManager.DeviceIdentifier.Default);   if (scanner != null)   {   //Attahch the Data Event handler to get the data callbacks.  scanner.Data += scanner_Data;   //Attach Scanner Status Event to get the status callbacks.  scanner.Status += scanner_Status;  scanner.Enable();   //EMDK: Configure the scanner settings   ScannerConfig config = scanner.GetConfig();  config.SkipOnUnsupported = ScannerConfig.SkipOnUnSupported.None;  config.ScanParams.DecodeLEDFeedback = true;  config.ReaderParams.ReaderSpecific.ImagerSpecific.PickList = ScannerConfig.PickList.Enabled;  config.DecoderParams.Code39.Enabled = true;  config.DecoderParams.Code128.Enabled = false;  scanner.SetConfig(config);   }   else   {  displayStatus("Failed to enable scanner.\n");   }   }   catch (ScannerException e)   {  displayStatus("Error: " + e.Message);   }

When the execution reach scanner.SetConfig, I receive an exception:

Already scanning. Wait for current scanning to complete

I don't understand which could be the problem, but in this way the configuration is not accepted.

Thanks
Alessandro

Please register or login to post a reply

4 Replies

A Alexey Vinnik

Have same problem.
As I understood the reason of this exception is that our scanner is in IDLE state and tries to read while we try to set config.
I just cancel reading before configuring scanner and add small delay to allow scanner change his state on WAITING.
...
scanner?.let {
it.cancelRead()
try {
Thread.sleep(500)
} catch (e: Exception) {
e.printStackTrace()
}
if (it.isEnabled && !it.isReadPending) {
//EMDK: Configure the scanner settings
...
}
}
May be it can help.

S Simone Giglio

Hi!
I have the same problem too. I also used the same example. For business needs I can't use continuous reading. Any possible solution?
thanks to all

N Nicolas SALVIN

Hi !
Same problem here. Do you found a solution without enabling continuous reading ?
thanks

V Vedsatx Saddvv

Hi, can you please try with the barcode sample: samples-emdkforxamarin-3_0/BarcodeSample1 at master · Zebra/samples-emdkforxamarin-3_0 · GitHub .  To get that sample to compile you will also need to include the EMDK component from Nuget.

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