I have a control unit(microprocessor) connected via Bluetooth.
I am trying to create ALL possible error recovery procedure.
So Far success. If I use Asyncstream without prefix with the code I attached, it recovers properly.
1. if I turn off the unit, I get
2. if I turn OFF blue tooth on tablet, it turns the BT back on and recovers (data are coming from controlbox to android again.)
This should cover all lost signal, BT disabled problems.
NOW PROBLEM.
if I try to do the same thing with same code I just replace
with
I see strange behavior. My app tries to connects to box properly, then i manually turn off BT on android.
Log says
It enables BT etc.....
But I never get connection running again, and my app hangs. Android says app stopped working.
What is worst even if i close my application and run it again it never ever connects .
Only solution is to REBOOT the android.
Can you help me with that ?
How to properly recover from any AsyncStream_error in PREFIX mode?
e.g BT died, other side died but it will be turned on in minute after reboots, async size error, when I have some interference. ???
I enclose the WORKING version of code with NON-PREFIX, to make it PREFIX comment line 89 and uncomment line 90 in
I am trying to create ALL possible error recovery procedure.
So Far success. If I use Asyncstream without prefix with the code I attached, it recovers properly.
1. if I turn off the unit, I get
error and I am able to recover connectionjava.io.IOException: bt socket closed, read return: -1
2. if I turn OFF blue tooth on tablet, it turns the BT back on and recovers (data are coming from controlbox to android again.)
This should cover all lost signal, BT disabled problems.
NOW PROBLEM.
if I try to do the same thing with same code I just replace
B4X:
Asyx.Initialize(Ser.InputStream, Ser.OutputStream, "Asyx")
B4X:
Asyx.InitializePrefix(Ser.InputStream, False, Ser.OutputStream, "Asyx")
Log says
as before and app tries to connect again.java.io.IOException: bt socket closed, read return: -1
It enables BT etc.....
But I never get connection running again, and my app hangs. Android says app stopped working.
What is worst even if i close my application and run it again it never ever connects .
Only solution is to REBOOT the android.
Can you help me with that ?
How to properly recover from any AsyncStream_error in PREFIX mode?
e.g BT died, other side died but it will be turned on in minute after reboots, async size error, when I have some interference. ???
I enclose the WORKING version of code with NON-PREFIX, to make it PREFIX comment line 89 and uncomment line 90 in
serviceconnect