How to detect bluetooth connectoin exist or not?

B

bokiteam

Hi All,
we can initial/close a Bluetooth connection, if user pause my
program to do other work and then back to my program, how can I detect
the bluetooth connection exist or not?

Should I add check routine in run()?

Best regards,
Boki.
 
C

Christian

(e-mail address removed) wrote:

Hi!

Hi All,
we can initial/close a Bluetooth connection, if user pause my
program to do other work and then back to my program, how can I detect
the bluetooth connection exist or not?

Well, how does one usually solve the lost connection problem? *g*
If you connect to a server and then you don't send data for an extended
period of time, the server will kick you.
Usually one should have a timer mechanism that continuosly sends packets
from the sender to show the counterpart that you are still there. This
doesn't have to be done every 10ms, once every 5 min or so should be
enough, provided you don't move your bluetooth stuff too much in and out
of the reception area.

Should I add check routine in run()?

Either that or you have a separate thread the accesses the then
shared(!) file pointer, sends a short ping and sleeps for 5min.
Closing and opening connections for every send would be another option,
but it depends among other things on what characteristics your traffic has.


HTH
Chris
 
B

bokiteam

Hi,
If I want to disconnect it... how can I do ?

Thank you very mcuh!

Best regards,
Boki.
 
B

boki

1. If Sony Ericsson devices, try to hang up it.
2. Tell your Bluetooth firmware.

Best regards,
Boki.
 
B

bokiteam

public boolean processEvents(InputStream is, OutputStream os) {
try {

int bytesToRead = is.available();
....
}


Throws:
IOException - if an I/O error occurs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top