Android Question AsyncStreamsText to read pdf417 data with bluetooth barcode scanner

GeoffT660

Active Member
Licensed User
I have been using AsyncStreamsText to read pdf417 data from a bluetooth barcode scanner using a suffix character without issue but am wondering if its possible to detect the end of the barcode read without a suffix character or if there is a better method to read drivers license data with a bluetooth barcode scanner as mentioned.
 

Erel

Administrator
Staff member
Licensed User
Here is a general way to find out when an operation has ended:
B4X:
Sub Update
OperationIndex = OperationIndex + 1 'global Int variable
Dim MyIndex As Int = OperationIndex
Sleep(300) '<-- change as needed
If MyIndex = OperationIndex Then
   Log("Operation ended")
End If
End Sub
It is based on the index pattern: [B4X] Resumable subs and the index pattern

In your case you need to call Update from the new text event.
 

GeoffT660

Active Member
Licensed User
Thanks Erel. This works fine but can see the sleep value is very critical and also slows down the operation. On a 1D barcode I can set sleep(0) or not use the update function at all but on the pdf417 I need to set sleep(400) minimum. Will this value need to be adjusted based on the speed of the scanner, Android device or BT connection? Are there any other options for reading a PDF417 with SPP?
 
Top