mribbons / cordova-plugin-cipherlab-rs30

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

RS31 Support #16

Closed tomazkramberger closed 5 years ago

tomazkramberger commented 5 years ago

Does anyone tested this plugin with Cipherlab RS31 scanner type? Does it suppose to work with it? I am using it on RS30 device but now i got RS31 scanner in my hand and same application doesn't seem to get data from scanner even that init process went through just fine.

mribbons commented 5 years ago

Hi @tomazkramberger, It should work well on the RS31 as the intent codes are the same as on the RS30.

Your device should have a Reader Config app. Have a look in there, and make sure keyboard emulation is set to None then restart your cordova app.

If it still won't work then have a look in logcat for any exceptions.

mribbons commented 5 years ago

Hi @tomazkramberger, I reviewed some correspondence I had with my supplier and Cipherlab, this is what I came up with:

I worked out that there is a race condition bug which can occur in a more processor intensive app.

Basically Intent_READERSERVICE_CONNECTED can fire before ReaderManager.InitInstance() has returned.

So in our intent handler code, we need to use Thread.Sleep() to wait until we have a valid ReaderManager, then call the configuration code.

This is a very dirty solution. I don't think I implemented it for this plugin. The react-native plugin resolves the issue by sleeping until the reader manager is not null:

https://github.com/mribbons/react-native-cipherlab-scanner/blob/master/android/src/main/java/au/com/micropacific/DataReceiver.java#L113

tomazkramberger commented 5 years ago

Hi @mribbons,

yesterday i tried and i got GET_DATA intent back everytime i scanned barcode with function buttons but sadly that intent doesn't have any barcode information by the time it is triggered.

I saw that code you are talking about and i think that could be an issue here. Will try and implement it into your current solution since i can't afford to switch to react native.

I will report back to you once that is done and prepare pull request as part of this bugfix if it works.

Thanks for your support!

LukeRasMEL commented 5 years ago

Hi @tomazkramberger

Did you ever come right on this?
I'm getting some weird stuff on the RS31 - like a red light flashed before the instance and the hex code received is not correct compared to say Honeywell or similar.

Thanks,

mribbons commented 5 years ago

Hi @LukeRasMEL, The code will work with RS31, the issue might be caused by your BarcodeAPI.jar version. See #1, #3 and #6. Note that your problem might not look exactly the same but you still need to try updating BarcodeAPI.jar.

If not, can you open a new issue and post any exception info you can find from logcat. Also please provide details on what barcode you are scanning, what data you get, and what you are expecting.

LukeRasMEL commented 5 years ago

Hi @mribbons Thanks for the reply; I'm not getting a crash - just a strange operating procedure - its like it tries to initiate a data capture on the device before i press a scan button. I'm scanning PDF417 barcodes and used to receiving a fixed string HEX from that.

Will mess around with the api file and see if I can get it right. Thanks,

tomazkramberger commented 5 years ago

Hi @tomazkramberger

Did you ever come right on this? I'm getting some weird stuff on the RS31 - like a red light flashed before the instance and the hex code received is not correct compared to say Honeywell or similar.

Thanks,

Hi,

sorry for my late response on this. I would just like to add to the @mribbons answer that also pay attention to Scanner settings itself there is an app on device preinstalled. Cause in my case i needed to play with settings to get things right and stable.

mribbons commented 5 years ago

Thanks @tomazkramberger.

@LukeRasMEL, This answers your question about compatibility.

It sounds like you might be calling cordova.plugins.CipherlabRS30CordovaPlugin.requestScan() on startup instead of in an event handler for a button click.

If you are unable to resolve the issue, please create a new issue and post your code.