一篇搞懂 ATT 支持的东西都有什么。
READ_BY_GROUP_TYPE_REQ/RSP
如下是 Spec 内容:
The attributes returned shall be the attributes with the lowest handles within the handle
range. These are known as the requested attributes.
If the attributes with the requested type within the handle range have attribute
values that have the same length, then these attributes can all be read in a
single request. However, if those attributes have different lengths, then multiple
ATT_READ_BY_GROUP_TYPE_REQ PDUs must be issued.
The ATT Server shall include as many attributes as possible in the response in order to
minimize the number of PDUs required to read attributes of the same type.
翻译一下:
不是逐字逐句的翻译哈,将其表达的意思说明清楚:
按照查找的范围,找到符合type的所有attibute 的 handle + value + group_end_handle;
因为 value 的长度可能会各有区别,每个 RSP packet 需要将相同长度的放在一起才可以;
但是考虑到 MTU 的限制,有时必须要进行多次请求回应才可以拿到所需范围内的attibutes;
实际中,往往是这样来实现:这些找到的attributes按照handle从小打到排列,例如 group_end_handle<=20的,其value都是同样长度,那么就先回应出去;然后对方下一个请求的起始handle就会从21开始,Server收到后,发现21 ~ group_end_handle 为80 的attributes 的 value都是同样的长度,那么就再回应出去,以此类推。
READ_BY_TYPE/RSP
来自于 Spec:
The attributes returned shall be the attributes with the lowest handles within the handle
range. These are known a