Open smurfix opened 4 years ago
Yes, that would be possible! 🤔 I'm already wondering what the UI to configure that message should look like.
Would you want to provide a template for that JSON message or would if be enough if the JSON just contains the decoded data and some metadata (like the type of barcode, etc)?
Some barcodes may contain binary data in which case the content would have to be encoded for a JSON 😬
Of course, another alternative would be to just fork Binary Eye and implement the request just like you need it 😉
Well, Java is not my kind pf programming language … I'd rather code whatever is required to recognize the data on the receiving end, which is a GTK program written in Python. (It already listens to my USB barcode scanner but that's 1D only.)
I'd just send a type/encoding/data JSON object. Frankly I don't need a template, as I can easily teach the receiver to recognize whatever content you send. For HTTP, maybe add a field for an "Authorization:" header. MQTT would need username+password (and the topic of course). My HTTP server would simply re-encode the incoming JSON to msgpack and broadcast it to MQTT. ;-)
Easiest would probably be to use this app to forward MQTT: https://github.com/dc297/mqttclpro https://play.google.com/store/apps/details?id=in.dc297.mqttclpro I also looked at the Paho client library, but it has a heap of unresolved issues and was last updated two years ago. Ugh.
(what about webhooks)
I would like to see choose-what-this-object-is on the scanner side.
I had a scenario, where I had Dell, Lenovo, HP laptops with serial codes on the box. Having a selector on-screen, letting the user say 'it's this brand' after scanning or with a button (bottom right?) to quickly change the 'mode'.
I would very much like a feature where Binary Eye does a simple GET request against a URL with the scanned data. What the custom URL feature does currently is almost perfect for me, functionality-wise, but I need something where the moment a scan is done, a GET request gets submitted in the background, and you can just keep going.
This doesn't need anything fancy? "Just" a "Submit URL in background" flag or something like that.
This would be quite easy to add 🤔 And I suppose it would be a good match for the bulk mode, too.
So I really should finally tackle this thing.
Do you think you will have time for this soon? I'm writing a utility for myself to help me archive a bunch of old family documents and this is one of the blockers. It would take me a while to figure out app development. :D
I hope I'll be able to add the basic feature over the weekend.
@deliciouslytyped Version 1.33.0 does now have a setting to enter a custom URL that is called for every scan.
It should become available shortly in Beta (you can always go back to production): https://play.google.com/apps/testing/de.markusfisch.android.binaryeye
Or you can get it right from GitHub here: https://github.com/markusfisch/BinaryEye/releases/tag/1.33.0
The scanned code is appended to the URL like it's done with the Open With link. But this is just a first step. Actually, it would be better to send a POST request with all the data from the scan (including the metadata).
I agree with the POST idea, but a simple GET might be preferable for quick-and-dirty applications. So maybe add an option to choose between these?
@markusfisch Thanks! I'll take a look! How long does it take for updates to appear on fdroid?
This is the best scanner app! ;)
It might be nice to add a (generic?) error message at least? https://github.com/markusfisch/BinaryEye/blob/11c97cc4ef5cd93e5c51297ec68ac36a21d6cec2/app/src/main/kotlin/de/markusfisch/android/binaryeye/net/ScanSender.kt#L19
@smurfix Yes, an option to select between GET/POST would probably be best 👍
@deliciouslytyped Usually F-Droid updates overnight, but I don't know for sure 🤷♂️😉
And yes, there really should be a Toast when the request fails. It's just that in batch mode, there's already a Toast after each scan so this would interfere 🤔
Would it be possible to add a mode for BinaryEye to act as a simple remote scanner? i.e. each time a code is recognized it could send a MQTT message. Or perhaps access an URL (without going through the browser) and PUT a JSON message.
Dedicated 2D scanners are expensive …