4

I was trying to understand basics of Bluetooth. I have few queries regarding the scanning and advertising of classic and low energy Bluetooth.

  1. Is EIR data (classic Bluetooth extended inquiry response) and AD data (Bluetooth low energy scan response) read from GAP profile. Where is data from GAP profile stored? Is it on host or controller?

  2. Is there a different GAP profile for classic and different GAP profile for LE ?

  3. When we enable advertising (low energy) using hcitool cmd or enable discoverable mode (classic Bluetooth), how does controller get all the advertisement information (scan response/ extended inquiry response)? Is it stored on controller?

  4. As mentioned in Bluetooth Specification 4.2 section 7.8.8 LE Set Scan Response Data command can be used to provide data for scanning packets. Is this different than GAP ?

  5. Is Gatt Server running before connection is formed ? If not, then how is GAP profile (used for advertising) relevant before connection ?

  6. Can same fields (e.g. device name) from EIR data and AD data be different ?

Tejas Pawar
  • 690
  • 8
  • 16
  • None of these are a programming question, and I would expect someone with 608 points to know, how to use stackoverflow.com. – Mr. Panda Sep 15 '21 at 15:05

1 Answers1

3
  1. Yes, both EIR and AD elements are defined by the GAP profile. This is managed in the host.

  2. No, the same GAP profile is applicable to both classic and BLE. However, a device can support either one or both. What I mean by this is that if you have a Classic-only device, then the qualification will be against the classic GAP profile, while if you have and LE-only device, then the qualification will be against an LE-only GAP profile. In other words, in terms of Bluetooth qualification both the GAP profiles appear to be separate, but on the device itself it is one GAP profile.

  3. Theoretically, GAP-related information is managed on the host layer, and this is then passed to/from the lower layers (see figure from Bluetooth Core Specification below). The controller then takes the information and sends it out in the packet format specified for EIR/AD data by the Bluetooth specification.

enter image description here

  1. This depends on what you mean by GAP? To avoid confusion, GAP can be a service sitting in your GATT table, but this is not exactly the same as the GAP profile. The GAP service that sits in the GATT table is a subset of the GAP profile in that it contains some information about the GAP profile but is not a 1:1 direct reflection. The Scan Response data itself is defined by the GAP profile, but it is usually not included in the GAP service. Below is a list of all of the mandatory/optional fields for the Scan Response Data (SRD). You can find this and more information in the Supplement to the Core Specification.

enter image description here

  1. Yes, the GATT server (also known as GATT table) should be formed before a connection is made. However, the GATT table can be updated when a connection has already been made. Again in this case I believe you are referring to the GAP service which is slightly different from the GAP profile.

  2. No, fields that are the same in the EIR/AD data should have the same value. This is reflected in the description of the device name in Core Bluetooth Specification v5.3, Vol 3, Part C, Section 3.2.2.1.1:-

A BR/EDR/LE device type shall have a single Bluetooth Device Name which shall be identical irrespective of the physical channel used to perform the name discovery procedure.

If you haven't done so already, I highly recommend reading the Bluetooth Core Specification v5.3, Vol 3, Part C (page 1230) - GENERIC ACCESS PROFILE, as it will have answers to all of these questions and more.

Below are some additional useful resources:-

Youssif Saeed
  • 11,789
  • 4
  • 44
  • 72
  • Regarding point 3: We can set advertising data using hcitool cmd and then the advertising data will be set in controller from hci layer. But theoretically GAP profile is above HCI layer in host. So won't that make GAP profile data on host and controller different ? – Tejas Pawar Sep 21 '21 at 07:30
  • You are correct - with hcitool cmd you have direct access to the HCI layer that is underneath the GAP layer. However, by changing the advertising data in the HCI layer, you are changing the GAP profile. This is because the GAP profile is a collection of data that includes the advertising data. If you meant the GAP service that sits in the GATT table, then I am not sure how this works, but theoretically the GAP service should have data that match what is in the GAP profile (i.e. the device name on advertising data and GAP service should be the same) otherwise the BT qualification fails. – Youssif Saeed Sep 22 '21 at 11:06
  • I meant GAP profile. Core spec 5.2 Vol4 part E section 7.3.56 OGF=0x03 OCF=0x0052 describes hci command to write EIR and section 7.8.7 OGF=0x08 OCF=0x0008 describes hci command to set le advertising data. These commands can write different advertisement data for classic and le devices. But as you said there is only 1 GAP profile in host and should contain same field value for both classic and le. But with these 2 commands it looks like it can write different data. – Tejas Pawar Sep 23 '21 at 07:25
  • `The same GAP profile is applicable to both classic and BLE` Is this specified in core spec document somewhere or any other reference ? – Tejas Pawar Sep 23 '21 at 07:55