Android Question AsyncStreams and bluetooth

masky

Member
Licensed User
Longtime User
Hi!!!


I’m trying to connect two bluetooth devices: a mobile and an external device. I developed this app a few years ago for Windows Mobile and right now I’m programming the app for Android.

In order to develop my app I use:


· AsyncStreams in regular mode, because de buffer length is not fix.

· The function AsyncStreamsNewData to receive the data inputs.

· A Service Module for communications running in background.


¿Problems? When the app starts, New data event raises without problems, with buffer length between 1 and 125 bytes with a high frequency, but after some seconds, the communication is more and more slow, and suddenly the buffer length is 1008 bytes and AsyncStreamscrashs so the app doesn’t receive any more streams.


I have checked the app for Windows Mobile, and a 1008 buffer length never happens.
 

masky

Member
Licensed User
Longtime User
Hi Erel,

the code below. And logs, this is the issue, I don't get any error message.

Thank you in advance.

Sub AStream_NewData (buffer() As Byte)

Log(buffer.Length)

Dim dtrx As Byte
Dim dtrx_unsigned As Int
Dim buffer_int(10) As Int
Dim temp As String

'PC
Dim bytecount As Int = buffer.Length
Dim dti As Byte

If buffer.Length > 0 Then
For i = 0 To buffer.Length - 1
dti = buffer(i)
If ::::::::: Then ' recepción parte baja
:::::::::
Else ' recepción parte alta
If dtlrdy Then
::::
End If 'fin proceso C,CPI,CMC4,TCI etc.
End If 'fin recepción parte alta y proceso
Next ' Siguiente byte recibido
End If ' Buffer vacio
End Sub
 
Upvote 0
Top