Smart Bluetooth: GATT Vs. ATT - what are the diffe

2019-04-19 02:08发布

问题:

Can anyone please define for me what are the differences between GATT and ATT? I didn't manage to understand.
I know that they are both generic protocol to handle BLE services. but didn't really understand it. Please explain.
Thanks!

回答1:

ATT is a much lower level mechanism that basically defines how to transfer a unit of data (an attribute). GATT is built on top of ATT and defines how higher level services are composed and the framework for operating on those services.



回答2:

You can find the Bluetooth specifications here: Specification Adopted Documents

Check out Core Version 4.2, Specification Volume 3 - Core System Package [Host Volume]. ATT is defined in Part F, and GATT in Part G.

ATT (page 2160): "This specification defines the Attribute Protocol; a protocol for discovering, reading, and writing attributes on a peer device."

GATT (page 2207): "This specification defines the Generic Attribute Profile that describes a service framework using the Attribute Protocol for discovering services, and for reading and writing characteristic values on a peer device."

So yes, GATT uses ATT as its transport protocol to exchange data between devices, and the spec describes in detail how each of these protocols are defined. Most application developers are mostly concerned with GATT, which is also used to define the API for some BLE libraries.



回答3:

ATT is the building block for GATT. Services, characteristic and descriptors all are attributes in the end.

All have the same format: Handler, type/UUID and value.

Now, characteristic is also an attribute but a specific value format

GATT comes to say that this device has the xxx service with yyy and zzz characteristics, it's the upper level of ATT. For more information about Bluetooth Low Energy, have a look at this article

https://atadiat.com/en/e-bluetooth-low-energy-ble-101-tutorial-intensive-introduction/