bluetooth-lowenergybluetooth-peripheral

Hide a connectable peripheral device


I am going to program a Bluetooth Smart peripheral device, but I am not quite sure how to achieve it.

The peripheral shall only connect to one central device. Is it possible to tell during (general connectable) advertisement (using advertisement data) that this peripheral does not accept connections from everyone?

Obviously, the peripheral has to be "public" (visible and connectable for any central device) before its first connection, but after that it is only interested in connections to that central device. This is not a privacy or security concern; I just try to not pollute the scan results for other scanning central devices.

I am reading the book "Bluetooth Low Energy - the developers handbook" by Robin Heydon which covers general Bluetooth Smart. It mentions "Flags AD" advertisement data. Could this be what I am looking for? The book also mention "bonding" which I understand is just a long-term secure relationship. I don't need an encrypted link, private address or signed writes, but is it adviced to use bonding anyway in my case?


Solution

  • Since I have learned a lot more Bluetooth LE after writing this question, and nobody has answered it, I write an answer here.

    A long time relationship between two devices is done by bonding. Bonding causes two devices to exchange and save keys, and these keys will be used for further connections to verify each other. In addition, the keys are used to encrypt the line.

    If a general advertising peripheral wants to target a particular central, it does this with advertising data. The Core Specification Supplement (CSS) v6 has two datatypes that can be used for this purpose: Public Target Address (1.13) and Random Target Address (1.14). Or as a developer you can whatever you like into Manufacturer Specific Data in some way of yours.

    Since the advertising peripheral targets a particular device, it will probably prevent connections from other centrals. For this purpose use the Whitelist. Put the address of the central you are targeting into the Whitelist, set the filter policy to only allow connections from devices in the Whitelist, and start advertising. But there is a catch: The peripheral needs to resolve the address of the central to ensure it is the one previously bond. Prior to Bluetooth 4.2 this had to be done manually (in application). Instead the 4.2 specification does this automatically for you: Put the bond central into the Resolve List too, and the Link Layer will also do the resolving.