转载 2015年07月09日 10:07:22


Generic Attribute Profile (GATT) is built on top of the Attribute Protocol (ATT) and establishes common operations and a framework for the data transported and stored by the Attribute Protocol. GATT defines two roles: Server and Client. The GATT roles are not necessarily tied to specific GAP roles and may be specified by higher layer profiles. GATT and ATT are not transport specific and can be used in both BR/EDR and LE. However, GATT and ATT are mandatory to implement in LE since it is used for discovering services.

The GATT server stores the data transported over the Attribute Protocol and accepts Attribute Protocol requests, commands and confirmations from the GATT client. The GATT server sends responses to requests and when configured, sends indication and notifications asynchronously to the GATT client when specified events occur on the GATT server. GATT also specifies the format of data contained on the GATT server.

Attributes, as transported by the Attribute Protocol, are formatted as services and characteristics. Services may contain a collection of characteristics. Characteristics contain a single value and any number of descriptors describing the characteristic value.

With the defined structure of services, characteristics and characteristic descriptors a GATT client that is not specific to a profile can still traverse the GATT server and display characteristic values to the user. The characteristic descriptors can be used to display descriptions of the characteristic values that may make the value understandable by the user.

GATT-based Profile Hierarchy 
The GATT Profile specifies the structure in which profile data is exchanged. This structure defines basic elements such as services and characteristics, used in a profile. The top level of the hierarchy is a profile. A profile is composed of one or more services necessary to fulfill a use case. A service is composed of characteristics or references to other services. Each characteristic contains a value and may contain optional information about the value. The service and characteristic and the components of the characteristic (i.e., value and descriptors) contain the profile data and are all stored in attributes on the server.
GATT profiles.png 
 GATT profile hierarchy


A service is a collection of data and associated behaviors to accomplish a particular function or feature of a device or portions of a device. A service may reference other primary or secondary services and/or a set of characteristics that make up the service.
There are two types of services: primary and secondary. A primary service provides the primary functionality of a device. A secondary service provides auxiliary functionality of a device and is referenced from at least one primary service on the device.
To maintain backward compatibility with earlier clients, later revisions of a service definition can only add new referenced services or optional characteristics. Later revisions of a service definition are also forbidden from changing behaviors from previous revision of the service definition. Services may be used in one or more profiles to fulfill a particular use case.

Referenced Services

A referenced service is a method incorporating another service definition on the server as part of the service referencing it. When a service references another service, the entire referenced service becomes part of the new service including any nested referenced services and characteristics. The referenced service still exists as an independent service. There are no limits to the depth of nested references.


A characteristic is a value used in a service along with properties and configuration information about how the value is accessed and information about how the value is displayed or represented. A characteristic definition contains a characteristic declaration, characteristic properties, and a value. It may also contain descriptors that describe the value or permit configuration of the server with respect to the characteristic value.

通用属性配置文件(Generic Attribute profile,GATT)

1. 角色        除了GAP定义了角色之外,BLE还定义了另外2种角色:GATT服务器和GATT客户端,它们完全独立于GAP的角色。提供数据的设备称为GATT服务器,访问GATT服务器而获得...
  • zhaoshuzhaoshu
  • zhaoshuzhaoshu
  • 2016年08月29日 15:46
  • 1019

蓝牙BLE GATT完全分析和运用

  • yueqian_scut
  • yueqian_scut
  • 2016年02月26日 20:34
  • 6801

蓝牙知识【协议栈简图】 【 UUID解析 】 【属性、Characteris、描述符和Service以及profile的关系】【蓝牙无线通道】【INTER FRAME SPACE】【MTU】【缩写词】

Notification与Indication的区别 GATT_Indication:从机通知主机后,主机需要调用simpleprofile_writeattrcb,读取从机的数据。 GATT_No...
  • chengdong1314
  • chengdong1314
  • 2016年10月12日 12:53
  • 3914

通用属性配置文件(Generic Attribute profile,GATT)

1. 角色        除了GAP定义了角色之外,BLE还定义了另外2种角色:GATT服务器和GATT客户端,它们完全独立于GAP的角色。提供数据的设备称为GATT,访问GATT服务器而获得数...
  • qinrenzhi
  • qinrenzhi
  • 2017年07月18日 17:24
  • 121

Generic Attribute Profile (GATT) 通用属性协议

•Designed for use by the application or a profile, so that an attribute client can communicate with ...
  • yinghuihong
  • yinghuihong
  • 2013年06月26日 14:33
  • 5578

Bluetooth Generic Attribute Profile - Heart Rate Service

  • 2014年08月26日 15:11
  • 104KB
  • 下载

基于低耗蓝牙的GATT Profile以及BLE中的回调

一;先介绍GATT Profile的相关理论知识,接下来再讨论具体代码实现。 1;先了解一些关键词的含义; ——porfile;一种规范,一种标准的通信协议。每个profile中会包含多个serv...
  • zw1996
  • zw1996
  • 2017年06月30日 17:20
  • 297

bluetooth LE HOGP profile的代码大致实现流程(HOGP+GATT)

之前一段时间学习了HOGP profile。Specification写得很简单,主要是说明它的
  • utadalight
  • utadalight
  • 2014年10月19日 20:20
  • 14339

Silicon Lab Ember zigbee学习杂谈----profile、cluster、attribute、command

  • wangchongttg
  • wangchongttg
  • 2016年03月28日 18:39
  • 1031


ZIGBEE中Profile、Cluster和Attribute关系 在zigbee规范中,引入了profile, cluster的概念。具体说来,假设规范一个profile(可以理解成一套规定),...
  • mengzhuicanyang
  • mengzhuicanyang
  • 2014年05月01日 11:26
  • 3893