GATT协议介绍_月亮弯弯2013的博客-程序员秘密

技术标签: Bluetooth  

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协议
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/u011467537/article/details/50349777

智能推荐

Python中排序方法sort、函数sorted的key参数的作用分析_python列表sort中的key参数_LaoYuanPython的博客-程序员秘密

从Python2.4开始,list.sort方法 和 sorted方法 都增加了一个 ‘key’ 参数用来在进行比较之前指定每个列表元素上要调用的函数,将函数的返回值作为比较的依据。那么怎么使用这个key参数呢?有2种办法:1、使用一个函数,这个函数的操作对象就是要比较的数据元素,返回结果就是某个可以用来比较的Python类型的数据;2、使用匿名函数lambda,通过简单表达式返回某个可以...

《北漂的京城巡回礼》_weixin_30258027的博客-程序员秘密

本文地址原文地址2017-08-15微信号wozhuzaisi程序员的文娱情怀引子京城-北京的地铁大图 说起来,京城待了也有些年头了,去过了不少地方,想起来这些或明艳,或清爽,或古朴,或奢华的地方,我就禁不住想要分享给大家这些个美丽,带给我欢乐的地方。京城-美丽的景色...

64点FFT的verilog 代码 TESTBENCH.v_64点fft csdn_soldier520的博客-程序员秘密

// TESTBENCH// test serial 64 bit FFTmodule TESTBENCH();begin reg signed [7:0] InputData [63:0][1:0];reg signed [19:0] CalData [63:0][1:0];reg signed [19:0] TempDataR;reg signed [19:0] Te...

老师给我们总结的在linux下安装源代码的方法_zhangmn的博客-程序员秘密

1.把你的程序移动到/usr/local/src ------------ 这一步你也可以不做,但是这方便以后对源代码程序的管理与升级,如果乱放,时间长了就不好管理了2.cd /usr/local/src  ---------进入源代码所在的目录3.tar xzvf mtools-3.9.9.9.tar.gz   ----------解压缩文件 如果是是以bz2结尾的用tar xjvf

史上最全的maven pom.xml文件教程详解_唯忆你心的博客-程序员秘密

原文地址:http://blog.csdn.net/yaerfeng/article/details/26448417代码下载地址:http://www.zuidaima.com/share/1781583829978112.htm[java] view plain copy"http://maven.apache.org/POM/4

随便推点

程序使用微软雅黑作为默认字体在xp下的问题_半斗的博客-程序员秘密

1、微软雅黑是 Vista 及更高版本 Windows 的标配中文字体,但不是 XP 的标配字体,XP 的任何一个 SP 或更新包都没有包含它。2、XP系统默认中文字体是宋体,在电脑上的显示效果不如微软雅黑好看。3、程序如果在XP下使用微软雅黑,但系统又没有该字体时,会使用XP默认字体。4、XP 系统上的微软雅黑字体,通常有两种来源:用户主动下载安装或安装 Of

RN学习笔记01:概述、特点与环境搭建_rn特点_howard2005的博客-程序员秘密

RN学习笔记01:概述、特点与环境搭建一、RN概述React Native(简称RN)是Facebook于2015年4月开源的跨平台移动应用开发框架,是Facebook早先开源的JS框架 React 在原生移动应用平台的衍生产物,目前支持iOS和安卓两大平台。RN使用Javascript语言,类似于HTML的JSX,以及CSS来开发移动应用,因此熟悉Web前端开发的技术人员只需很少的学习就...

求助关于atom编译python程序_第九日饕餮的博客-程序员秘密

刚开始使用atom,想用atom来编写python的程序,按照教程装了script,但运行程序后总显示一堆乱码,如图:该如何解决?

ant design pro表格排序(可以点击三次)_hideinform_旭旭1998的博客-程序员秘密

1、首先在column属性中添加sorter: true{ title: '流量计编码', dataIndex: 'flowmeterCode', hideInForm: true, ellipsis: true, sorter: true }点三次需要再加一个tablechange:tableChange如下,当表格排序有变化是重新加载表格: const tableChange = (pagination: any, fil

第九届蓝桥杯省赛C++B组 日志统计(双指针滑动窗口巧妙)_c++ 统计日志_小王子y的博客-程序员秘密

小明维护着一个程序员论坛。现在他收集了一份”点赞”日志,日志共有 NN 行。其中每一行的格式是:ts id表示在 ts 时刻编号 id 的帖子收到一个”赞”。现在小明想统计有哪些帖子曾经是”热帖”。如果一个帖子曾在任意一个长度为 DD 的时间段内收到不少于 KK 个赞,小明就认为这个帖子曾是”热帖”。具体来说,如果存在某个时刻 TT 满足该帖在 [T,T+D) 这段时间内(注意是左闭右开区间)收到不少于 K 个赞,该帖就曾是”热帖”。给定日志,请你帮助小明统计出所有曾是”热帖”的帖子编号。输

IP: 169.254.0.0/16 地址用途_微风--轻许--的博客-程序员秘密

1. 一直困惑169.254.0.0/16是干嘛的,每次笔记本dhcp获取地址失败后,就会随机在这个B类地址段获取一个地址;在rfc5735里面有对所有特殊网络地址说明;以下引用rfc5735:169.254.0.0/16 - This is the "link local" block. As described in[RFC3927], it is allocated for...