rob-bb
Posts: 4
Joined: Thu Jan 03, 2019 9:31 pm

Connect to BT device after it is turned on, or reconnect if it goes off then on

Sat Aug 31, 2019 6:38 am

Hi

How do I use rfcomm to connect to a BT device with it comes in to range or gets turned on? I tried "sudo rfcomm watch hci0" but it never seems to notice the device is turned on, but using the connect option does work.

User avatar
Douglas6
Posts: 4760
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Connect to BT device after it is turned on, or reconnect if it goes off then on

Sat Aug 31, 2019 11:41 am

Rfcomm will only connect when told to, via 'rfcomm connect'. You could put that command in a loop, and try to connect periodically, until successful.

rob-bb
Posts: 4
Joined: Thu Jan 03, 2019 9:31 pm

Re: Connect to BT device after it is turned on, or reconnect if it goes off then on

Sun Sep 01, 2019 6:50 am

IS that the best way to reconnect to a bluetooth device, just constantly poll it? That seems realyl clunky, and then how to handle it going out of range and coming back? There must be a more elegant method to handle bluetooth

User avatar
Douglas6
Posts: 4760
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Connect to BT device after it is turned on, or reconnect if it goes off then on

Sun Sep 01, 2019 12:27 pm

Not that I am aware of. There is nothing magic about Bluetooth; such that two devices intrinsically know when they are close and active. If one device goes out of range, start looping again.

Return to “Troubleshooting”