mribbons / cordova-plugin-cipherlab-rs30

Apache Cordova Barcode Scanner Plugin for Cipherlab RS30
MIT License
6 stars 12 forks source link

Scanning South African Drivers License PDF417 not working #12

Closed deonvisser closed 6 years ago

deonvisser commented 6 years ago

This plugin works perfectly with various barcodes, it cannot scan the South African Drivers License, which is PDF417 format.

mribbons commented 6 years ago

Hi @deonvisser, The plugin should support all barcode types supported/enabled on the scanner.

A couple of obvious questions:

  1. Have you tried another application on the device to see if PDF417 works? You could try the sample android application provided by Cipherlab, or you could try enabling keyboard wedge mode and scanning into a text field.

Note that I am not officially endorsed by Cipherlab, so I can't provide the sample application.

  1. Does the scanner beep when a PDF417 is scanned? The confirmation beep is produced by the OS itself, so it doesn't matter which app you use for this test.

  2. Do other 2 dimensional barcodes work? Try generating a QR code here: https://www.qr-code-generator.com/

deonvisser commented 6 years ago

Hi mribbons Thank you for the reply.

It scans all barcodes. It scans the license disk fine, which is also PDF417 format. I have been told that the data drivers license is binary data. That explains why I am getting garbage.

mribbons commented 6 years ago

Thanks for letting me know.

Good luck @deonvisser!

deonvisser commented 6 years ago

Thank you but I am back :) Please can you point me in the right direction. As I said, I can scan all barcodes perfectly except for the South African Drivers License. Please can you point me in the right direction as I have no idea what to do next. The data returned are only 2 characters. I have tried decoding the data (those two characters) returned but to no avail. I am not sure why it is only returning 2 characters but should actually be receiving something like this.....

Am0WAwAyARaCWkLh4eFTQU5ERVJT4ErhWkHgWkHgMOHh4TYyMzQ1NjAwMDFBQuA4NjA5MTM1MTM5 MDEyAiAHAhmqoQoBGYYJEyASERQgFxIUAVdJBAD6AMhDLihAAChCNFWnQrzo0jDnNeVd2987O9NM 9v45zkHm/ll7Ivb5cBQx7vfrFr3e975/m97of/HDQKGCh/LRixwt8OqE5KhYXoNDmoVPDQKFWdbM IXtUo8+40zll0RmpShJw785Ys/luDajQ1gRRksEkr7FjiKHRMO4wpyFBGMJfagh7iuNxHOEMJFrG OBpRg5UETHrDTx0mx9RmWuHQjFA+Naa7abq64z0qL5B3ktR5oFuN4rtWXoZeql6MiPthbIY+vGEU N5mPczaChm0UvGwwkQckiCBP+LSAAVexEcEgAKywW4F+62PhksQeG6Zx/0fCjSQUBWD4fEwVwSnz 5ARYJAVimcsOERK2EkQ0kXYSqR2NGSxZ9JY1ADb8Y2aC1hQPh/F/NXq+j/IVV3ratkIa1ETAaPu9 1/FhMgl1MdUWp5yn8UVVm+wFiWW1IC/UsvkUOkKHhSYCaMqt5loAOXGqumWXwtoOK4QcqHboj8Rw AqatEPFrOGDu9ChjRI9HpjPpgvTsB3VGApj8Q8RXRPC8zi097mSBVqhNcGcO2vSTKjjIPC5yG+IS RwvFBBnEW9tarAR3lZ98IAMIQgu0VTRca4lsqeIB8xjXXuw1l24bRDiPYi5JEwAlWO09CP+G+6jY dgVLBYskCWGukFDX2g2NLBGjvYB47rCucJ8Yhgjdik1EAgNiKFN3KCCS6qCixBMkBqrbd0FnPWnX 3eYFjOWqLbVoEAUARFpF1RRFEBRZS4YgoqogABY7UAEAFFAFVVUBBEVAVVQQAAAAAAAAAAAAAAAA

Thank you

mribbons commented 6 years ago

Hi again, I don't have a 2D version on hand so can't assist you easily.

Here would be my next steps:

  1. Use the sample java application, see if it gets all the data.

  2. Check the log cat output of your cordova app to see if all of the data is received by the Java side of the plugin, each scan should be logged from this line of code: https://github.com/mribbons/cordova-plugin-cipherlab-rs30/blob/master/src/android/au/com/micropacific/cordova/DataReceiver.java#L72

  3. If you are able to generate PDF417 barcodes, print one with a very small amount of data and see if your cordova app can receive it in full.

If the data is just a string, then it "should work". You need to determine if the problem lies with the plugin, or your code. It is conceivable that the data is being chunked into multiple intents which the plugin isn't handling properly, or your code is ignoring - Are the two characters you are getting from the start or end of the real data? If they are at the end, it might mean your the initial barcode scan events are being overwritten.

deonvisser commented 6 years ago

Thank you Mike. I will provide feedback as soon as I have tried your suggestions. Thank you for your assistance. Appreciated.

zkrige commented 6 years ago

Just a comment here. The SA drivers license has all ascii codes (0-255) in it. Some PDF417 Readers have not implemented byte mode reading (https://en.wikipedia.org/wiki/PDF417#Encoding) and therefore dont correctly handle the SA drivers license.

In order to fix this, the reader needs to implement byte mode as well as numeric and text mode

deonvisser commented 6 years ago

Thanks zkrige. Mike, any comments on this?

mribbons commented 6 years ago

Thanks for the info @zkrige.

@deonvisser, my initial advice still applies, 1 and 2 especially. I'd really like to see the log cat extract.

deonvisser commented 6 years ago

Hi Mike I have now used the barcode scanner software that comes with the device. I get the same result as with your plugin. Just two ASCII characters. When I collected the device, they demoed their test device and it pulled all the data just fine.

in terms of the logCat. I cant seem to find such a log file anywhere on the device. I have also installed a logcat plugin in the hope that this would help but had to uninstall it because of clashes.

Thanks

mribbons commented 6 years ago

adb shell logcat > log.txt

read up on how it works.

Also check the ReaderConfig app - You might find an option in there specific to PDF 417.

Changing the delimiter might help, but if the data really can contain any byte then any delimiter based system isn't going to work.

Failing that - If you saw it working on a demo device, call the vendor you purchased it from, they should be willing to help if there is potential for more sales.

deonvisser commented 6 years ago

Thanks for your help Mike. This is the reason I am using a Cordova plugin so that I dont have to mess around at that level else I would go straight for a native Java solution.

ReaderConfig App also only spits out same to ASCII characters.

Anyway, thanks for your help. I have spent too much time on this. Manatee seems to work perfectly on any android device with a 5mb pixel camera or higher. Its not free but at least its of the shelf.

mribbons commented 6 years ago

Hi @deonvisser, I currently have an RS31 with 2D support on hand.

If you can upload a high quality sample of the barcode section of the drivers license I can take a look at the problem.

deonvisser commented 6 years ago

Hi Mike Thank you very much. I went through some tests with the S31 supplier. It seems there is a problem with the S31 that I have, as their demo S31 is scanning the license fine. I will be be seeing them next week to investigate further and will revert back to you.

I appreciate your assistance and will be in touch shortly. Thank you.

mribbons commented 6 years ago

Thanks @zkrige.

I can confirm that the data is read. In order to receive it, the plugin needs to use

byte [] b = intent.getByteArrayExtra(GeneralString.BcReaderDataArray);

// instead of 
String data = intent.getStringExtra(GeneralString.BcReaderData);

This needs to be implemented as an option.

deonvisser commented 6 years ago

I will revert back earliest.

deonvisser commented 6 years ago

Hi Ok, after taking my device in and comparing it with the tech manager who's device automatically scans the drivers license as as bytes (we are still puzzled how his does and mine does not. We only seem to be running different OS versions. Anyway, to cut a long story short, I forked your code and now have a solution for scanning SA Drivers Licenses. Still need to do some housekeeping and update the index.js file but it seems to work perfectly. Thank you for creating this plugin, in the first place. Much appreciated.

mribbons commented 6 years ago

Hi @deonvisser, That's great, I look forward to seeing a PR.

Although, it looks as though you forked a fork, rather than forking my repo directly...