Hello everyone,
I have been following tutorials and samples for EMDK for Android 7.0. I am developing an application for one of my clients and that application must be able to scan Interlaved 2of5 codes. Unfortunately no matter what I write, setting up decoders in next function doesn't work. Here is how I initialize scanner(code is written in the Kotlin language):
private fun initializeScanner() {
if (scanner == null) {
scanner = barcodeManager.getDevice(BarcodeManager.DeviceIdentifier.DEFAULT)// INTERNAL_IMAGER1) scanner?.addDataListener(this); scanner?.addStatusListener(this); scanner?.triggerType = Scanner.TriggerType.HARD setDecoders()
scanner?.enable()
scanner?.read()
startRead = true }
}
and setting the decoders for the scanner:
private fun setDecoders() {
if (scanner != null) {
try {
val config = scanner?.getConfig()
config?.decoderParams?.chinese2of5?.enabled = true config?.decoderParams?.matrix2of5?.enabled = true config?.decoderParams?.d2of5?.enabled = true config?.decoderParams?.i2of5?.enabled = true /* config?.decoderParams?.i2of5?.convertToEan13 = false*/ config?.decoderParams?.i2of5?.length1 = 0 config?.decoderParams?.i2of5?.length2 = 18 config?.decoderParams?.i2of5?.reducedQuietZone = false config?.decoderParams?.i2of5?.redundancy = true config?.decoderParams?.i2of5?.reportCheckDigit = false config?.decoderParams?.i2of5?.verifyCheckDigit = ScannerConfig.CheckDigitType.NO config?.decoderParams?.i2of5?.securityLevel = ScannerConfig.SecurityLevel.LEVEL_1 // Set EAN8 config?.decoderParams?.ean8?.enabled = true // Set EAN13 config?.decoderParams?.ean13?.enabled = true config?.decoderParams?.gs1QrCode?.enabled = true config?.decoderParams?.gs1Datamatrix?.enabled = true scanner?.setConfig(config)
} catch (e: ScannerException) {
updateStatus(e.message!!)
}
}
}
When I try to test the scanner on TC51, then scanning EAN8,13 and gs1 code works. Unfortunately, if I for example set ean8?.enabled = false, then after rebuild and rerun the application, I am still able to scan EAN8 codes. When I set the i2of5?.enabled to either true or false I am not able to scan Interleaved2of5 codes on the TC51 device.
I am running EMDK for Android 7.0.0
and TC 51 device with Android Nougat 7.1.2
What should I do to enable scanning of Interleaved2of5 codes and why setting up decoders doesn't have any effect on the device?
Can you help me please?
Thanks in advance.
1 Replies
Hi,
It sounds like something is wrong setting decoders as the app seems to be having problems with both I2of5 and Ean8 from your description.
I suggest trying with the official sample (I did the Kotlin conversion in a forked branch: samples-emdkforandroid-6_9/BarcodeSample1 at BarcodeSample1-Kotlin · darryncampbell/samples-emdkforandroid-6_9 · GitHub ). That should hopefully give you a known working baseline.