0

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?

telephone
  • 1,131
  • 1
  • 10
  • 29
  • 1
    It's possible to do "directed advertising". I haven't used it, but I think it specifies which device it's expecting to connect to it. So, you could start with regular advertising, and then further advertising would be directed after that initial connection. – Tim Tisdall Jan 25 '16 at 15:40
  • Hi! I have looked at _directed advertising_ and I think it serves a different purpose. Its advertisement data just consists of two addresses: the advertisers address and the address it wants to connect to. It is an aggresive form for advertisement that is only allowed for 1.28 seconds, according to Robin Heydon. So the central device needs to be continuously scanning to pick up the advertisements directed to it. As far as I understand, directed advertisements lets a peripherial disconnect to save power and then instantly tell the central to reconnect when something happens (seldom). – telephone Jan 25 '16 at 18:43
  • 1
    Well, then the only other way, and I'm not ever sure it's possible, is for the device to remain connectable but not advertise. So the central just tries the connection without receiving an advertising packet because it already knows it's there. – Tim Tisdall Jan 25 '16 at 19:01
  • I think that a peripheral can not be connected and do advertisements at the same time. My peripheral needs to be connectable which means it must do _general advertising_ (that is, _undirected advertising_). It also allows advertisement data, _AD_. Core Specification Supplement v6 gives some interesting fields for _AD_, which I am looking at now! – telephone Jan 25 '16 at 19:52

1 Answers1

1

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.

telephone
  • 1,131
  • 1
  • 10
  • 29