GATT协议

标签:
gattattbluetoothattribute |
分类: Bluetooth |
1.主要用于寻找和配置服务端的属性,其实就是寻找、配置和读写servcice端的各种attribute,使其按需要的方式工作。
The Attribute Handle is
an index corresponding to a specific Attribute. The Attribute Type
is a UUID that describes the Attribute Value. The Attribute Value
is the data described by the Attribute Type and indexed by the
Attribute Handle. The Attributes are ordered by increasing
Attribute Handle values.Attribute Permissions is part of the
Attribute that cannot be read from or written to using the
Attribute Protocol.
(2)INCLUDE DEFINITION
(3.2)Characteristic Value Declaration
Only one Characteristic Aggregate Format declaration
shall exist in a characteristic definition.The
Characteristic Aggregate Format value is composed of a list of
Attribute Handles of Characteristic Presentation Format
declarations, where each Attribute. Handle points to a
Characteristic Presentation Format declaration.
5.4 CHARACTERISTIC DISCOVERY
它有两个角色:Server和Client,一个实际的例子:
2.概述
GATT使用Attribute Protocol来传输data:
http://s13/bmiddle/001W1wvHgy6Ew9n40BS5c&690
Opcode表示该PDU的类型,包括command, request, response,
indication,notification or confirmation这六种。
Logical Attribute Representation:http://s16/bmiddle/001W1wvHgy6Ew9ytBfh5f&690
这是service端某个attribute的格式。
3.GATT的层次结构
http://s2/bmiddle/001W1wvHgy6EwapGKgFc1&690
多个service组成完整的profile,一个service可能包含几个referenced services, 一些mandatory characteristics 和optional characteristics.有两种类型的service:primary service and secondary service。A primary service can be included by another service,A secondary service is a service that is only intended to be referenced from a primary service or another secondary service or other higher layer specification.
多个service组成完整的profile,一个service可能包含几个referenced services, 一些mandatory characteristics 和optional characteristics.有两种类型的service:primary service and secondary service。A primary service can be included by another service,A secondary service is a service that is only intended to be referenced from a primary service or another secondary service or other higher layer specification.
4.service的组成
(1)SERVICE DEFINITION
A service definition shall contain a
service declaration and may contain include definitions and
characteristic definitions.
组织顺序:service declaration-->include
definitions-->characteristic definitions
Service Declaration:
(2)INCLUDE DEFINITION
A characteristic definition shall contain a characteristic
declaration, a Characteristic Value declaration and may contain
characteristic descriptor declarations.
The Characteristic Value declaration shall exist immediately
following the characteristic declaration
(3.1) Characteristic Declaration
(3.2)Characteristic Value Declaration
真正的data是保存在这个里面的
(3.3)Characteristic Descriptor Declarations
Used to contain related information
about the Characteristic Value.Only one Characteristic Extended
Properties.
declaration shall exist in a characteristic definition.
(3.3.1)Characteristic Extended Properties
(3.3.2)Characteristic User Description
(3.3.4)Server Characteristic Configuration
http://s6/bmiddle/001W1wvHgy6EwdEN9LT15&690
http://s12/bmiddle/001W1wvHgy6EwdGAODx3b&690
(3.3.5)Characteristic Presentation Format
http://s12/bmiddle/001W1wvHgy6EwdGAODx3b&690
(3.3.5)Characteristic Presentation Format
(3.3.6)Characteristic Aggregate Format
可以理解为是多个Characteristic Presentation
Format的集合,而且可以使用其他characteristic definition的characteristic
presentation。
3.4 GATT PROFILE ATTRIBUTE TYPES总结
5.GATT features
主要有以下11种:
一个sub-processdure:Exchange MTU
This sub-procedure is used by the client to set the ATT_MTU to
the maximum possible value that can be supported by both
devices.
5.2 PRIMARY SERVICE DISCOVERY
两个sub-procedures:Discover All Primary Services and Discover
Primary Services by Service UUID
This procedure is used by a client to discover primary
services on a server.
5.3 RELATIONSHIP DISCOVERY
一个sub-procedure:Find Included Services.
There is one sub-procedure that can be used for relationship
discovery: Find Included Services.
5.4 CHARACTERISTIC DISCOVERY
两个sub-procedures:Discover All
Characteristics of a Service and Discover Characteristics
by UUID.
This procedure is used by a client to discover service
characteristics on a server.
5.5 CHARACTERISTIC DESCRIPTOR DISCOVERY
一个sub-procedure:Discover All Characteristic Descriptors.
This procedure is used by a client to discover characteristic
descriptors of a characteristic.
5.6 CHARACTERISTIC VALUE READ
四个sub-procedures:Read Characteristic Value, Read Using
Characteristic UUID, Read Long CharacteristicValues, and Read
Multiple Characteristic Values.
This procedure is used to read a Characteristic Value from a
server.
5.7 CHARACTERISTIC VALUE WRITE
5个sub-procedures: Write Without Response, Signed Write Without
Response, Write Characteristic
Value, Write Long Characteristic Values and Reliable
Writes.
This procedure is used to write a Characteristic Value to a
server.
5.8 CHARACTERISTIC VALUE NOTIFICATION
1个sub-procedure:Notifications.
This procedure is used to notify a client of the value of a
Characteristic Value from a server.
5.9 CHARACTERISTIC VALUE INDICATIONS
1个sub-procedure:Indications
This procedure is used to indicate the Characteristic Value
from a server to a client.
5.10 CHARACTERISTIC DESCRIPTORS
两个sub-procedures: Read Characteristic
Descriptors and Write Characteristic Descriptors.
This procedure is used to read and write characteristic
descriptors on a server.
下图是GATT和ATT的相关processdure的mapping图:
6.其他
SERVICE CHANGED:一个重要的characteristic,be used to indicate to
connected devices that services have changed。
http://s1/bmiddle/001W1wvHgy6Ewqnbjck20&690
http://s1/bmiddle/001W1wvHgy6EwqnUjhS10&690
http://s1/bmiddle/001W1wvHgy6EwqnUjhS10&690
There is only one instance of the
Service Changed characteristic within the GATT service
definition.
GATT over BR/EDR: