[英]When/How is a BLE GATT Notify/Indicate is send on physical layer
I read the bluetooth core spec. 我阅读了蓝牙核心规格。 V4.2 /BLE (..)
V4.2 / BLE(..)
The communication in connection state is always master initiated, slave returns data afterwards. 连接状态下的通信始终由主机发起,从机随后返回数据。 The master here is a GATT client talking to GATT server (peripheral device).
此处的主机是与GATT服务器(外围设备)通信的GATT客户端。
I do not understand the GATT Feature "notify" respectively how it works via the lower layers when the master always has to request before sending data. 当主机始终必须在发送数据之前请求时,我不了解GATT功能“通知”它们如何分别通过较低的层工作。
Someone knows how it works ? 有人知道它是如何工作的吗?
BLE is timeslotted. BLE已时隙化。 In connected state, there are connection events that happen periodically, with an interval called connectionInterval .
在连接状态下,会定期发生连接事件 ,间隔时间称为connectionInterval 。
Each connection event is master initiated, which means the master sends the first packet within the connection event. 每个连接事件都是由主机发起的,这意味着主机会在连接事件内发送第一个数据包。
In order to keep the connection alive, slave has to send a packet (and get it acknowledged) at least once every supervisionTimeout . 为了使连接保持活动状态,从属服务器必须每个监管超时至少发送一次数据包(并使其得到确认)。 There are other timeouts that make the slave respond before that anyway, one of which is the slaveLatency , ie the number of connection events a slave can ignore before having to respond to master (even if not responding is not a cause for disconnection, it can cause other problems in the protocol, and thus disconnections).
无论如何,还有其他超时会使从属服务器在此之前做出响应,其中之一是slaveLatency ,即从属服务器在必须响应主服务器之前可以忽略的连接事件数(即使不响应不是断开连接的原因,它也可以导致协议中出现其他问题,从而断开连接)。 On the other hand, master should send a packet on each connection event.
另一方面,主机应在每个连接事件上发送一个数据包。
connectionInterval , slaveLatency and supervisionTimeout are the timing part of the connection parameters in the spec. connectionInterval , slaveLatency和supervisoringTimeout是规范中连接参数的计时部分。 Connection interval ranges from 7.5 ms to 4 seconds, slaveLatency from 0 (then slave should respond on every connection event) to the number of connection events corresponding to supervisionTimeout / 2. (See 6.B.4.5.1 for the full definition)
连接间隔的范围是7.5 ms到4秒, slaveLatency从0(然后,slave应在每个连接事件上响应)到对应于supervisoringTimeout / 2的连接事件数。(有关完整定义,请参见6.B.4.5.1)
So, basically, any payload (including GATT notifications) is queued in the slave or master's stack buffers until the next connection event happens. 因此,基本上,任何有效负载(包括GATT通知)都会在从属或主控的堆栈缓冲区中排队,直到发生下一个连接事件为止。 Whatever the direction (slave to master or master to slave), party has to wait for the next connection event to sends its packets.
无论方向是什么(从站到主站或从主站到从站),参与方都必须等待下一个连接事件才能发送其数据包。
Inside a given connection event, each party sends a packet in turn, optionally without any useful payload, until nobody has nothing to send any more. 在给定的连接事件内,各方依次发送一个数据包(可选地,没有任何有用的有效负载),直到没有人可以发送更多信息为止。 (See 6.B.4.5.6)
(见6.B.4.5.6)
That means a notification is queued at most for connectionInterval , if radio gets the packet transmitted on the first try. 这意味着,如果radio第一次尝试发送发送的数据包,则通知最多会在connectionInterval队列中排队。
That's why connection parameters have to be negotiated properly, and that's also why they are different depending on the device type. 这就是为什么必须正确协商连接参数的原因,也是它们根据设备类型而有所不同的原因。 For instance, a HID (mouse, keyboard, remote control) is generally allowed to connect with a connection interval under 10 ms, while heart rate monitor usually gets a connection interval over a second.
例如,通常允许HID(鼠标,键盘,遥控器)以10毫秒以下的连接间隔进行连接,而心率监测器通常以一秒为单位进行连接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.