Understanding the Generic Access Profile (GAP)

Roles, Modes and Procedures in GAP

GAP allows BLE devices to interoperate with each other. It provides a set of rules or procedures so that devices can discover each other, broadcast data, establish secure connections, perform functional operations and set device configurations.

GAP defines three aspects of device actions: roles, modes and procedures.


Roles impose and enforce restrictions on how BLE devices communicate with each other. A device can operate in one or more roles at the same time. There are 4 different roles, split into two symmetrical pairs.

  • Broadcaster and Observer — A Broadcaster is a device that sends out advertisement packets but does not allow a connection to be established. An Observer is the device that looks for advertising packets but does not initiate a connection.
  • Central and Peripheral — A Central is a device that looks for advertising and initiates the connection. A Peripheral advertises to establish a connection.

Keep in mind that a single device can play multiple roles at the same time. For example, the QCA4020 Development Board Application can act as Central and Peripheral at the same time.


A mode is a state attained by a peripheral device for a certain amount of time to achieve a specific goal or to allow a peer to perform a procedure. Devices switch modes more frequently than they switch roles. Modes can be switched upon user interaction or automatically when required.

A Peripheral device wants to get discovered in case of a broadcaster and in other case it wants to get discovered and get connected. The Peripheral follows certain discoverability modes and connection establishment modes.

Discoverability modes

  • Non-discoverable mode — Other devices that are scanning cannot detect the presence of a peripheral in non-discoverable mode. A peripheral uses this mode to not get discovered by and connected to a peer device. For the same effect, the peripheral can advertise with the flags ADV_NONCONN_IND or ADV_SCAN_IND set in the Flag AD field in the advertising packet.
  • Limited discoverable mode — The Limited Discoverable Flag is set in the Flag AD field of the advertising packet and the device is discoverable for a limited time with lower priority. A Peripheral device in limited discoverable mode can be discovered only by a Central device that is following the limited discovery procedure.
  • General discoverable mode — In this mode, a Peripheral device can be seen by a Central device as long as it is advertising. Generally, the intention is to get discovered and establish a connection, so the General Discoverable Flag is set in the Flag AD field of the advertising packet.

Connection establishment modes

  1. Non-connectable mode — A device in this mode does not send the advertising packet or send the advertising packet with the flags ADV_NONCONN_IND or ADV_SCAN_IND set in Flag AD field. In this mode, a Peripheral device does not encourage establishing connection with the peer.
  2. Direct connectable mode — In this mode, a Peripheral device sends an ADV_DIRECT_IND advertising packet targeting a specific Central Bluetooth address. This provides a “fast connect” mode, with a blind assumption that the Central device is already trying to establish a connection.
  3. Undirected connectable mode — In this standard mode used for establishing a connection, the ADV_IND flag is set in the advertising packet.

This table summarizes the modes that Peripherals follow, with applicable peer procedures:

Mode Applicable Role(s) Applicable Peer Procedure(s)
Broadcast Broadcaster Observation
Non-discoverable Peripheral N/A
Limited discoverable Peripheral Limited and General discovery
General discoverable Peripheral General discovery
Non-connectable Peripheral, Broadcaster and Observer N/A
Any connectable Peripheral Any connection establishment


A procedure is a sequence of actions taken by the Central device to attain a specific goal. A procedure is usually associated with the mode of the peer device so that the two devices stay connected.

To discover the Peripheral device and establish the connection, the Central device needs to follow certain procedures:

Discovery procedures

  1. Limited discovery procedure — The Central device initiates the scanning without any whitelist filtering. If the Limited Discoverability Flag is set in Flag AD of the advertising packet, the Central device proceeds further for application to take the required action.
  2. General discovery procedure — The advertising packet received with either Limited Discoverable or General Discoverable flags on scanning are reported to the application for further action.

Connection establishment procedures

  1. Auto connection establishment procedure — The Central device populates the whitelist with known Peripheral devices, then instructs the controller to connect to the first detected one from the whitelist. This procedure is used if there is otherwise no preference for connecting to devices.
  2. General connection establishment procedure — This is the default procedure for the Central device. Without any whitelist, it scans for devices, accepts all incoming advertising packets and displays the list of connectable devices.
  3. Selective connection establishment procedure — In this procedure, the list of connectable devices is generated from all of the advertising packets received then filtered with a whitelist provided.
  4. Direct connection establishment procedure — A Central device uses the Link Layer to connect to a single device identified by its Bluetooth address, without knowing its presence. This attempt may fail if the specified Peripheral device is not available or is in non-connectable mode.

This table summarizes the procedures that Centrals follow, with applicable peer modes:

Procedure Applicable Role(s) Applicable Peer Mode(s)
Observation Broadcaster Broadcast
Limited discovery Central Limited discoverable
General discovery Central Limited & General discovery
Name discovery Peripheral, Central N/A
Any connection establishment Central Any connectable
Connection parameter update Peripheral, Central N/A
Terminate connection Peripheral, Central N/A

Modes and procedures need to be chosen carefully for their effects on power optimization. It is useful for a Central to follow two different ways to create a connection. The Home Automation Android Application, for example, uses the direct connection establishment procedure; upon failure, it uses the selective connection establishment procedure.