Bluetooth: Automatically Pairing and Trusting New Devices

I have a Beaglebone Wireless with bluetooth, bluez, and python-bluez packages installed. Through the command line, I’m able to connect to my iPhone with the following commands:

bluetoothctl

discoverable on

scan on
pairable on
trust
pair

where is the address of my phone.

Afterward, I get a message on my phone that the bone is requesting to pair. Once I accept, I can then connect to the bone.

For my project, however, I need the user to be able to connect with their own phone without any intervention on the Beaglebone itself.

From what I understand, I believe I need a script that somehow automatically enables scanning and pairs and trusts any new devices within range at start-up.
Any advice into this matter would be greatly appreciated.

Thanks.
Tomas

On Mon, 2 Jul 2018 10:15:24 -0700 (PDT), Tomas Medina
<tomas@evatech.net> declaimed the following:

For my project, however, I need the user to be able to connect with their
own phone without any intervention on the Beaglebone itself.

  I know of NO device which is capable of initiating pairing with unknown
devices without explicit user interaction -- if only to tell one side of
the pair to allow pairing. After all, there may be half a dozen devices
nearby that might be putting out pairing requests and the user would have
to select from among them.

  Most devices will memorize successfully paired devices, and re-pair to
them when detected (My cell phone pairs to my landline base allowing me to
answer cell phone calls using any of the four wireless handsets).

http://blog.bluetooth.com/bluetooth-pairing-part-1-pairing-feature-exchange

I own a bluetooth speaker which allows me to connect to it with my phone immediately without having to set up anything on the speaker’s end. I imagine there is a way to get the Beaglebone to operate on a similar principle.

If its like my speakers you have to manually pair it once then it will
remember.

On Mon, 2 Jul 2018 10:50:01 -0700 (PDT), Tomas Medina
<tomas@evatech.net> declaimed the following:

I own a bluetooth speaker which allows me to connect to it with my phone
immediately without having to set up anything on the speaker's end. I
imagine there is a way to get the Beaglebone to operate on a similar
principle.

  Did you ever in the past have to approve pairing with it? Like I
mentioned, after the initial pairing, my cell-phone automatically re-pairs
with the landline base (takes a few minutes, they only scan for known
devices periodically).

  But the very first time I still had to initiate a scan for unknown
devices, select the device, and enter the security code.

I own a bluetooth speaker which allows me to connect to it with my phone
immediately without having to set up anything on the speaker's end. I
imagine there is a way to get the Beaglebone to operate on a similar
principle.

It should just work; I had it working with older bluez's. Requirement to pair
is determined by the remote end's security policy. Have you tried connecting
to a device that doesn't require pairing? In orderwords, a device with a known
security policy of not requiring it.

I just tried it with a different device and I was able to connect without any sort of manual set-up. I used an iPad and the speaker appeared under the ‘other devices’ in the Bluetooth settings. I was able to connect to it without any problems

Apple devices auto-pair..

Regards,

the speaker is a jam party not an apple speaker (https://www.walmart.com/ip/HMDX-HX-P730-Jam-Party-Wireless-Bluetooth-Stereo-Speaker/26011032).

Doesn't matter... In most cases Apple devices auto-connect to any
Bluetooth "Speaker" it see's..

Regards,