Hi, I have a bluetooth printer, and I use the AsyncStreams object to work with it. I request the id of printer, but in the _NewData event I get the result in the image attached. How can I handle this? Thanks to all.
If you tell us the brand and model of the printer, it will be easier to help you. However you will need the printer detailed manual where it should say what kind of replies you should get from it.
If you tell us the brand and model of the printer, it will be easier to help you. However you will need the printer detailed manual where it should say what kind of replies you should get from it.
Thanks for reply, I have sent to printer a command to retrieve its id. But the problem is the value of Buffer. The StringFromBytes method returns this:
B4X:
U��8�����
I'd like to know how to read correctly this response.
Sub btStream_NewData (Buffer() As Byte)
Try
tmpBuffer = tmpBuffer & Conv.HexFromBytes(Buffer)
Log(tmpBuffer)
If tmpBuffer.Length > 14 And tmpBuffer.StartsWith("51") Then
ShowResultsActivity(FindDataTypeAndParse(tmpBuffer))
tmpBuffer = ""
End If
Catch
ToastMessageShow("BT read response error",True)
End Try
End Sub
Sub btStream_NewData (Buffer() As Byte)
Try
tmpBuffer = tmpBuffer & Conv.HexFromBytes(Buffer)
Log(tmpBuffer)
If tmpBuffer.Length > 14 And tmpBuffer.StartsWith("51") Then
ShowResultsActivity(FindDataTypeAndParse(tmpBuffer))
tmpBuffer = ""
End If
Catch
ToastMessageShow("BT read response error",True)
End Try
End Sub