Android Question Read from an already connected bluetooth barcode reader

rosippc64a

Active Member
Licensed User
Longtime User
Hi All!
I have a BT barcode reader, Eyoyo-015. It is paired to my android device as an input device, works well.
If I have an edittext field, I can see in it the read data.
Sometimes I want to read QR codes also, what has more data, so it is not good to read into an edittext (doesn't need that user do see its content), I thought it would be good, if I could read directly from reader. I can see the reader in the paireddevices, but when I would connect directly:
device.Name = "Eyoyo-015"
device.Mac = "AA:FE:09:02:80:23"
then I got an error: java.io.IOException: read failed, socket might closed or timeout, read ret: -1, I think because it is connected.
Can I connect to reader somehow?

thanks in advance
Steven
 

Martin Domian

Member
Licensed User
Longtime User
Would you like to share the solution?
How to connect directly
I see SPP Mode, but after pairing it once, it pairs auto
 
Upvote 0

rosippc64a

Active Member
Licensed User
Longtime User
Hi, I seem to remember that the android settings had the spp mode and so it was seen as a keyboard by the android, not a programmatic solution.
 
Upvote 0

Martin Domian

Member
Licensed User
Longtime User
First thanks for fast replay!
Yes, i did that and found source how to use BlueTooth, but after scan "Connection is Broken Error"
Did you use SERIAL and AsyncStreams?
 
Upvote 0

Martin Domian

Member
Licensed User
Longtime User
i found this here

 
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
I implemented a Bluetooth SPP mode reader class a several years ago, the tablets showed the Bluetooth headphone icon for the device when they were in SPP mode and the class connected via Serial and AsyncStreams objects.

From what I remember the barcode class just automatically attempts to reconnect to the scanner every 1500ms. The scanners we were using automatically shut off after a minute or so and powered back up and then reconnected to the paired tablet when you hit the trigger on the scanner.

The barcode class was instantiated and controlled by the Starter class, which dispersed the events from the barcode class to the activities as needed.
 
Last edited:
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
why don't you simply make a very small textedit view? or put it behind something? then the user doesn't have to see it and you can continue to use the scanner in input mode (which is already working perfectly)?
 
Upvote 0

Heinz

Active Member
Licensed User
Longtime User
most bt-scanners works as keyboard wedge. you don't need the attached bt-usbstick. It is
only for PCs. Configure your scanner with an terminator (CR - Chr4(13)) and connect it.
in your SUB
B4X:
Private Sub EditText1_EnterPressed
your textfield will recognize the return-event and you can do something with the string.
it is verry usefull, if you have mor as one QR/EAN - codes. But you must set the cursor
of the editfield manuell before you scan the next code.
i have not found a automatic solution for setting the cursor.

B4X:
EditText1.Text = ""
EditText1.RequestFocus
don't work.
 
Upvote 0

Martin Domian

Member
Licensed User
Longtime User
I implemented a Bluetooth SPP mode reader class a several years ago, the tablets showed the Bluetooth headphone icon for the device when they were in SPP mode and the class connected via Serial and AsyncStreams objects.

From what I remember the barcode class just automatically attempts to reconnect to the scanner every 1500ms. The scanners we were using automatically shut off after a minute or so and powered back up and then reconnected to the paired tablet when you hit the trigger on the scanner.

The barcode class was instantiated and controlled by the Starter class, which dispersed the events from the barcode class to the activities as needed.
Thanks, i start creating something and have all this effects... include an Error aftser Scan... so we will see. I will try more the next days
 
Upvote 0

Martin Domian

Member
Licensed User
Longtime User
why don't you simply make a very small textedit view? or put it behind something? then the user doesn't have to see it and you can continue to use the scanner in input mode (which is already working perfectly)?
That is working good, but if the QRCode is longer, then it takes very long, also the user should not see the process... you see the letters comming in on the Textbox, that looks not proffesional for me and also, if the textbox as not the focus, then nice things happen ;-)
Speed is the task here ... Thanks
 
Upvote 0

Martin Domian

Member
Licensed User
Longtime User
most bt-scanners works as keyboard wedge. you don't need the attached bt-usbstick. It is
only for PCs. Configure your scanner with an terminator (CR - Chr4(13)) and connect it.
in your SUB
B4X:
Private Sub EditText1_EnterPressed
your textfield will recognize the return-event and you can do something with the string.
it is verry usefull, if you have mor as one QR/EAN - codes. But you must set the cursor
of the editfield manuell before you scan the next code.
i have not found a automatic solution for setting the cursor.

B4X:
EditText1.Text = ""
EditText1.RequestFocus
don't work.
Thanks for helping, i all ready did it, but the problem is the spped when the QRCode is long... The process with the Camera ist then faster.
 
Upvote 0
Top