Hi to all!
I need to connect to a physical (with laser) barcode reader via bluetooth, and I receive the barcode read using the AsyncStreams object. I need a MsgboxAsync inside both the "AsyncStreamReader_NewText (strBuffer As String)" and "AsyncStreamReader_Error" events.
Since these are events not related to an user interaction (the barcde reader is always active, in an entrance door, but when it reads a barcode, an operator have to make a decision), how can I do to make "As Resumable" both the _NewText and _Error events? Thank you.
Current code:
I need to connect to a physical (with laser) barcode reader via bluetooth, and I receive the barcode read using the AsyncStreams object. I need a MsgboxAsync inside both the "AsyncStreamReader_NewText (strBuffer As String)" and "AsyncStreamReader_Error" events.
Since these are events not related to an user interaction (the barcde reader is always active, in an entrance door, but when it reads a barcode, an operator have to make a decision), how can I do to make "As Resumable" both the _NewText and _Error events? Thank you.
Current code:
B4X:
Sub BTSerialReader_Connected (Success As Boolean)
If Success=True Then
BTAsyncStreamReader.Initialize(Me,"BluetoothAsyncStreamReader",BTSerialReader.InputStream,BTSerialReader.OutputStream)
'etc
End Sub
Sub BluetoothAStreamReader_NewText (strBuffer As String)
Dim TipoMov As List
TipoMov.Initialize2(Array As String("In","Out"))
Dim ro As Object = InputListAsync(TipoMov,"Seleziona tipologia di...",-1,False)
Wait For (ro) InputList_Result (res As Int)
If res = 0 Then
'etc...
End Sub
Sub BluetoothAStreamReader_Error
MsgboxAsync("Reading error...","Attention")
Wait For Msgbox_Result (res As Int)
End Sub
Last edited: