Bluetooth connection basic connection

Basic Bluetooth connection question

How do advertisements usually work? So I have earbuds and a phone. When I pull the earbuds out of the case they auto connect to a bonded phone. When i push the button, they enter pairing mode and now a phone can see them and pair/bond to them at that point.

What is the difference in the advertisement that allows this. Is there some datatype or industry standard that lets the phone know you are looking for a partner? If i was making the phone AND the earbuds, no problem. I can program that interconnection and make it work. But they sell ear buds that work with any phone and any phone has to accept any earbud. 

Parents
  • A peripheral device that is advertising may or may not have bonded previsouly with the phone. Each advertisment packet contain some type of address, and the phone can based on the address know if it has been previously bonded or not, if previously bonded the phone typically will connect. It's also worth mentioning that a peripheral device that is advertising will typically have a list of previously bonded devices internally (e.g. whitelist), and typically the peripheral only allow phones that are in the list allow to connect, it's only if the user do an active choice that the peripheral allow other phones to connect and bond.

    Kenneth

Reply
  • A peripheral device that is advertising may or may not have bonded previsouly with the phone. Each advertisment packet contain some type of address, and the phone can based on the address know if it has been previously bonded or not, if previously bonded the phone typically will connect. It's also worth mentioning that a peripheral device that is advertising will typically have a list of previously bonded devices internally (e.g. whitelist), and typically the peripheral only allow phones that are in the list allow to connect, it's only if the user do an active choice that the peripheral allow other phones to connect and bond.

    Kenneth

Children
  • This is how i assume it functions. I believe there are 128bytes of data actually transmitted on a BLE packet and we can manipulate 31 of those bytes. Inside the non-manipulatable portion, contains a MAC address. And it is in this non-manipulated data where bonding and re-connection code can be automated. Is this correct?

    I have set up code and am able to establish a pair bond pair. I am sure I am bonded and paired as I will get a pairing_complete + security_changed callback the first pairing request and after that first initial pair and bond, subsequent connection result in only a security_changed callback feature.

    But if I simply advertise, the central does not automatically connect. I have to initiate the conneciton manually some way. Is there a type or some way of calling a bond check for auto connect when seeing an advertisement?

  • dmleone said:
    But if I simply advertise, the central does not automatically connect. I have to initiate the conneciton manually some way. Is there a type or some way of calling a bond check for auto connect when seeing an advertisement?

    I know that is the case for many OS, because the OS will autoconnect some peripheral devices that support specific features the OS use (e.g. HID devices), also I believe some heart rate sensors also will auto connect, but other non-standardized profiles may not auto connect unless the user actively do so.

    Kenneth

  • very helpful. Is there some built in functions that can either return true if and advertisement is showing itself to be a bonded device or is there some function I can call after I initially connect that can determine if the unit I am connected to has been previously bonded? I am not finding anything like an isBonded(struct bt_conn *conn) or isBonded(bt_addr_le_t addr) function of sorts. Something i could just test before i go attempt to change security levels

Related