GAP roles - chegewara/esp32-snippets GitHub Wiki

From bluetooth core specification we can learn that every bluetooth LE device need to implement GAP layer.

Since all Bluetooth devices are required to implement GAP, any additional profiles implemented by a Bluetooth device become supersets of GAP. Depending on the complexity of an application or the ability to reuse common requirements of functionality of the Bluetooth system between many applications, additional generic profiles can be created that are both a superset of GAP as well as being a superset of another profile. A top level profile that describes application interoperability is called an Application Profile.

Because of that we will begin with cover basic knowledge about gap roles.

In LE, GAP defines four specific roles: Broadcaster, Observer, Peripheral, and Central. A device may support multiple LE GAP roles provided that the underlying Controller supports those roles or role combinations. Each role specifies the requirements for the underlying Controller. This allows for Controllers to be optimized for specific use cases.

The Broadcaster role is optimized for transmitter only applications. Devices supporting the broadcaster role use advertising to broadcast data. The broadcaster role does not support connections. The Observer role is optimized for receiver only applications. Devices supporting the observer role are the complementary device for a broadcaster and receives broadcast data contained in advertisements. The observer role does not support connections. The Peripheral role is optimized for devices that support a single connection and are less complex than central devices. Devices supporting the peripheral role only require Controllers that support the Controller’s slave role. The Central role supports multiple connections and is the initiator for all connections with devices in the peripheral role. Devices supporting the central role require a Controller that support the Controller’s master role and generally supports more complex functions compared to the other LE GAP roles.

But what this really means to us, users of esp32-snippets library. This mean that we should be able to write code that will allow us to build different types of device. Both, broadcaster and observer should be setup in Non-Connectable Mode:

While a device is in the Peripheral role the device shall support the nonconnectable mode. A device in the Broadcaster or Observer role cannot establish a connection, therefore the device is considered to support the nonconnectable mode. While a device is in the Peripheral role the device shall support the undirected connectable mode. While a device is only in the Broadcaster, Observer, or the Central role the device shall not support the undirected connectable mode.

  • broadcaster - device that will only advertise - simple example (iBeacon)
  • observer - device that will only scan, but no connect - simple example
  • peripheral or slave - device that will advertise and accept incoming connection requests, then will act as client or server - simple example
  • central or master - device that will scan and initialize connection requests, then will act as server or client - simple example

As for now everything seems to be pretty simple.