bluetooth serial adapter disconnect time

mterveen

Member
Licensed User
Longtime User
i am using a roving networks bluetooth adapter that is paired with my phone. in my program i send commands to the adapter via the textwriter to reboot the adapter to change to new baud rates. i then close the serial streams and disconnect the serial connection (serial1.disconnect). subsequently i reconnect to the bluetooth adapter using serial1.connect3(".....",1).

my question is - is there any way to tell programmatically when the serial disconnect is "complete" before i attempt to reconnect? currently i use a loop to wait approximately 5 seconds. using a shorter time period usually results in a program hang/freeze.

also, the only way i was able to reconnect is to use the connect3 syntax. not quite sure why the simple connect method doesn't work. and, how do you know which port to use? i used "1" and it worked but "3" doesn't.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
is there any way to tell programmatically when the serial disconnect is "complete" before i attempt to reconnect?
There is no such API.
You should post the stack trace that appears when this error happens. Maybe it will include some useful information.

Connect3 is a workaround for a known issue with Android Bluetooth. You can read more information about this issue here: Issue 5427 - android - can't initiate SPP Communication without SDP - Android - An Open Handset Alliance Project - Google Project Hosting
 
Upvote 0
Top