GATT协议

1.主要用于寻找和配置服务端的属性,其实就是寻找、配置和读写servcice端的各种attribute,使其按需要的方式工作。
它有两个角色:Server和Client,一个实际的例子:
GATT协议

2.概述
GATT使用Attribute Protocol来传输data:
GATT协议
Opcode表示该PDU的类型,包括command, request, response, indication,notification or confirmation这六种。
Logical Attribute Representation:GATT协议
这是service端某个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.

3.GATT的层次结构
GATT协议

多个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:
GATT协议

(2)INCLUDE DEFINITION
GATT协议

(3)CHARACTERISTIC 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
GATT协议

(3.2)Characteristic Value Declaration
真正的data是保存在这个里面的
GATT协议
(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
GATT协议
GATT协议

(3.3.2)Characteristic User Description
GATT协议
(3.3.3)Client Characteristic Configuration
GATT协议
GATT协议

(3.3.4)Server Characteristic Configuration
GATT协议
GATT协议

(3.3.5)Characteristic Presentation Format
GATT协议
GATT协议

(3.3.6)Characteristic Aggregate Format
    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.
可以理解为是多个Characteristic Presentation Format的集合,而且可以使用其他characteristic definition的characteristic presentation。
GATT协议

3.4 GATT PROFILE ATTRIBUTE TYPES总结
GATT协议
主要有以上几种GATT Attribute Type。

5.GATT features
主要有以下11种:
GATT协议
5.1 SERVER CONFIGURATION
一个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图:
GATT协议
GATT协议

6.其他
SERVICE CHANGED:一个重要的characteristic,be used to indicate to connected devices that services have changed。
GATT协议
GATT协议
There is only one instance of the Service Changed characteristic within the GATT service definition.
GATT over BR/EDR:
GATT协议
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值