BlueNRG GATT Database
Winfred LU
AMG GCSA
STMicroelectronics
• Generic Attribute Profile (GATT)
• defines how to exchange user data (attributes) over a BLE connection
• Roles
• Client
• sends requests to a server
• performs Service Discovery
to know server’s attributes
• Server
• responds to requests
• stores user data
Generic Attribute Profile (GATT)
Request
Response
Client Server
• Handle
• 16-bit unique identifier
• 0x0001 – 0xFFFF
• Type
• UUID (Universal unique Identifier)
• 128-bit globally unique
• 32/16-bit SIG adopted
• xxxxxxxx-0000-1000-8000-00805F9B34FB
• Permission
• access rights: readable, writable, notifiable,
indicatable
• security level required to access: encryption,
authorization
• Value
• actual data content
• with variable length
• in format according to type
Attribute structure
Handle Type Permission Value
database / profile • Attribute
• There are 3 types of Attributes
• Primary Service
• Secondary Service
• Characteristic
• Attributes are grouped into Services
• Service Definition
• Service Declaration
• 0 or more Characteristics
• Characteristic Definition
• Characteristic Declaration
• Characteristic Value
• 0 or more Descriptors
• Extended Properties Descriptor
• Client Characteristic Configuration Descriptor (CCCD)
• Characteristic User Description Descriptor
Attribute data hierarchy
Characteristic
…
Descriptor
Service
Characteristic
…
Descriptor
Characteristic
…
Descriptor
Service
Characteristic
…
Descriptor
Characteristic
…
Descriptor
ATT database view
5
Handle Type Permissions Value
1 0x2800 (GATT Primary Service) Read 0x1801 (Generic Attribute)
2 0x2803 (Characteristic Declaration) UUID=0x2A05, Handle=0x0003, Properties=0x20
3 0x2a05 (Service Changed) Indicate 0xFFFF0000
4 0x2902 (Client Characteristic Configuration) Read, Write 0x0000
5 0x2800 (GATT Primary Service) Read 0x1800 (Generic Access Profile)
6 0x2803 (Characteristic Declaration) UUID=0x2A00, Handle=0x0007, Properties=0x4E
7 0x2a00 (Device Name) Read, Write wo Rsp, Wrie, S-
Writes
0x74736574 --> “test”
8 0x2803 (Characteristic Declaration) UUID=0x2A01, Handle=0x0009, Properties=0x4E
9 0x2a01 (Appearance) Read, Write wo Rsp, Wrie, S-
Writes
0x0000
A 0x2803 (Characteristic Declaration) UUID=0x2A04, Handle=0x000B, Properties=0x02
B 0x2a04 (Peripheral Preferred Connection
Parameters)
Read 0xFFFF0000 FFFFFFFF
ATT database view in BlueNRG GUI
6
https://www.st.com/en/embedded-software/stsw-bnrgui.html
Handle Value
1 0x1801
2 0x2A05 0003 20
3 0xFFFF0000
4 0x0000
5 0x1800
6 0x2A00 0007 4E
7 0x74736574
8 0x2A01 0009 4E
9 0x0000
A 0x2A04 000B 02
B 0xFFFF0000 FFFFFFFF
ACI_GATT_Read_Handle_Value
7
Bits Field
7:0 0: Broadcast
1: Read
2: Write without Response
3: Write
4: Notify
5: Indicate
6: Authenticated Signed Writes
7: Extended Properties
23:8 Characteristic Value Handle
39:24 Characteristic UUID
• Bluetooth SIG
• Core Spec, Profiles, Assign Numbers
• https://www.bluetooth.com/specifications/specs/
• Intro to Bluetooth Generic Attribute Profile
• Mohammad Afaneh @ Ellisys
• https://www.bluetooth.com/bluetooth-resources/intro-to-bluetooth-gap-gatt/
• Introduction to Bluetooth Low Energy – GATT
• Kevin Townsend @ Adafruit
• https://learn.adafruit.com/introduction-to-bluetooth-low-energy/gatt
• Getting Started with Bluetooth Low Energy – GATT (Services and Characteristics)
• Kevin Townsend, Carles Cufí, Akiba, Robert Davidson
• https://www.oreilly.com/library/view/getting-started-with/9781491900550/ch04.html
References

BLE GATT Database

  • 1.
    BlueNRG GATT Database WinfredLU AMG GCSA STMicroelectronics
  • 2.
    • Generic AttributeProfile (GATT) • defines how to exchange user data (attributes) over a BLE connection • Roles • Client • sends requests to a server • performs Service Discovery to know server’s attributes • Server • responds to requests • stores user data Generic Attribute Profile (GATT) Request Response Client Server
  • 3.
    • Handle • 16-bitunique identifier • 0x0001 – 0xFFFF • Type • UUID (Universal unique Identifier) • 128-bit globally unique • 32/16-bit SIG adopted • xxxxxxxx-0000-1000-8000-00805F9B34FB • Permission • access rights: readable, writable, notifiable, indicatable • security level required to access: encryption, authorization • Value • actual data content • with variable length • in format according to type Attribute structure Handle Type Permission Value
  • 4.
    database / profile• Attribute • There are 3 types of Attributes • Primary Service • Secondary Service • Characteristic • Attributes are grouped into Services • Service Definition • Service Declaration • 0 or more Characteristics • Characteristic Definition • Characteristic Declaration • Characteristic Value • 0 or more Descriptors • Extended Properties Descriptor • Client Characteristic Configuration Descriptor (CCCD) • Characteristic User Description Descriptor Attribute data hierarchy Characteristic … Descriptor Service Characteristic … Descriptor Characteristic … Descriptor Service Characteristic … Descriptor Characteristic … Descriptor
  • 5.
    ATT database view 5 HandleType Permissions Value 1 0x2800 (GATT Primary Service) Read 0x1801 (Generic Attribute) 2 0x2803 (Characteristic Declaration) UUID=0x2A05, Handle=0x0003, Properties=0x20 3 0x2a05 (Service Changed) Indicate 0xFFFF0000 4 0x2902 (Client Characteristic Configuration) Read, Write 0x0000 5 0x2800 (GATT Primary Service) Read 0x1800 (Generic Access Profile) 6 0x2803 (Characteristic Declaration) UUID=0x2A00, Handle=0x0007, Properties=0x4E 7 0x2a00 (Device Name) Read, Write wo Rsp, Wrie, S- Writes 0x74736574 --> “test” 8 0x2803 (Characteristic Declaration) UUID=0x2A01, Handle=0x0009, Properties=0x4E 9 0x2a01 (Appearance) Read, Write wo Rsp, Wrie, S- Writes 0x0000 A 0x2803 (Characteristic Declaration) UUID=0x2A04, Handle=0x000B, Properties=0x02 B 0x2a04 (Peripheral Preferred Connection Parameters) Read 0xFFFF0000 FFFFFFFF
  • 6.
    ATT database viewin BlueNRG GUI 6 https://www.st.com/en/embedded-software/stsw-bnrgui.html
  • 7.
    Handle Value 1 0x1801 20x2A05 0003 20 3 0xFFFF0000 4 0x0000 5 0x1800 6 0x2A00 0007 4E 7 0x74736574 8 0x2A01 0009 4E 9 0x0000 A 0x2A04 000B 02 B 0xFFFF0000 FFFFFFFF ACI_GATT_Read_Handle_Value 7 Bits Field 7:0 0: Broadcast 1: Read 2: Write without Response 3: Write 4: Notify 5: Indicate 6: Authenticated Signed Writes 7: Extended Properties 23:8 Characteristic Value Handle 39:24 Characteristic UUID
  • 8.
    • Bluetooth SIG •Core Spec, Profiles, Assign Numbers • https://www.bluetooth.com/specifications/specs/ • Intro to Bluetooth Generic Attribute Profile • Mohammad Afaneh @ Ellisys • https://www.bluetooth.com/bluetooth-resources/intro-to-bluetooth-gap-gatt/ • Introduction to Bluetooth Low Energy – GATT • Kevin Townsend @ Adafruit • https://learn.adafruit.com/introduction-to-bluetooth-low-energy/gatt • Getting Started with Bluetooth Low Energy – GATT (Services and Characteristics) • Kevin Townsend, Carles Cufí, Akiba, Robert Davidson • https://www.oreilly.com/library/view/getting-started-with/9781491900550/ch04.html References