Android Question bt service priority level

MbedAndroid

Well-Known Member
Licensed User
Longtime User
i made a BT service, it works ok
but i noticed when that the received datapackage gets corrupted when i press some function, like setting a color or closing the file dialog
i think these operations blocks somehow the BT background service.

To make sure i made a checksum control and inserted it in the service. No other actions are done just checking the received package. And still this same issue, as soon i open the well know file dialog and close it, i got a "beep" a sign a corrupted package is received. To connect the "beep" into the BT service i made a special timer which starts as soon a corrupted package is received, the timer starts the beep for 1 cycle.

Is there a way to set the BT service to a higher level in the same way you can specify in atmel controllers, or is this something we have to deal with it.?
Yes i can cancel the package if it is non valid, but i'm looking more for the root of this problem
 
Are you using asyncstream? It might be a problem in your code for handling data in NewData. Data needs to be assembled in a buffer, it might arrive in more than one NewData.
 
Upvote 0
i use astream yes, and assemble the package in the newdata call
could try a different mode to check it helps
 
Upvote 0
solved by using astreamprefix
apparently something went wrong assembling the package...
thanks for the hint!
 
Upvote 0
Another possibility is asyncstreams text class. The code there helps understand assembling a packet.
 
Upvote 0
currently testing, looks like a takes longer to sync
textmode means double data, as all bytes has to converted to hex, but it's a good solution if prefix fails
 
Upvote 0
Back
Top