How do I make Raspberry Pi 3 discoverable for iOS and CoreBluetooth?

After much research and some help from a Twitter friend, to enable the LE broadcast you have to use one of the following commands.

sudo hciconfig hci0 leadv 0
sudo hciconfig hci0 leadv 3

The 0 indicates connectable.

The 3 indicates non connectable.


For those having issue connection to Iphone, the only way I found to make the RPi visible in the Bluetooth Scanning screen is to set the raspberry PI role/profile as audio sink as per below in addition to the posted in @Jeremiah Jessel answer:

sudo /bin/hciconfighci0 inqdata "0c097261737062657272797069020a00091002006b1d460217050d03001801180e110c1115110b1100"

all in one line, the long string is the enquiry data, in this string we are setting the bluetooth name and the profiles supported by our raspberry PI


For anyone that was helped by HubuN and was wondering the same thing as Manuel Otto, you can change the name by editing the hex data after 0c09 and before 020a. I don't have the reputation to add a comment, which is why I'm adding a separate answer.

Using HubuN's example:

sudo /bin/hciconfig hci0 inqdata "0c097261737062657272797069020a00091002006b1d460217050d03001801180e110c1115110b1100"

"raspberrypi" is 7261737062657272797069

So let's say you wanted to change it to "MyName"

You would get the hex for "MyName" and fill the remaining empty data with 0's

4d794e616d65 = "MyName"

7261737062657272797069 = "raspberrypi"

4d794e616d650000000000 = "MyName     "

Which gives you:

sudo /bin/hciconfig hci0 inqdata "0c094d794e616d650000000000020a00091002006b1d460217050d03001801180e110c1115110b1100"

I'm not super familiar with the rest of the hex code, so if someone else wants to explain it, or even provide an easier solution, feel free.

(Note: you can use a tool like this one to convert from text to HEX)