本质上,本机Android BLE实现是同步的吗? [英] Is the native Android BLE implementation synchronous in nature?
问题描述
我记得在中阅读 -doc到三星BLE API (存档页面):
I remember reading in the "Guide and Hint"-doc to the Samsung BLE API (archived page):
三星F / W和堆栈最重要的概念之一是
其同步性质。也就是说,如果我们调用某个特定特征的
writeCharacteristic
,如果它返回
true
,对任何BluetoothGatt
或BluetoothGattServer
方法
的下一次调用应在<$之后接收到c $ c> onCharacteristicRead 回调。
这是因为堆栈旨在一次仅支持和处理一次
GATT调用,例如,如果您调用
writeCharacteristic
或readCharacteristic
在第一个特征之后很快出现
,它将被忽略。
One of the most important concepts of the Samsung F/W and stack is its synchronous nature. That is, if we call for example,
writeCharacteristic
for a particular characteristic, if it returnstrue
, the next call to anyBluetoothGatt
orBluetoothGattServer
method should be done after theonCharacteristicRead
callback is received. This is because the stack is designed to support and process only one GATT call at a time, and if, for example, you callwriteCharacteristic
orreadCharacteristic
on any characteristic soon after the first one, it is ignored.
- 是否也适用于BLE在Android 4.3中引入的
的本地实现? - 三星API也仅支持一次连接一个GATT设备。
原生API是否有此更改?
推荐答案
三星最近发布了迁移-我在问题中链接的同一页面上的文档。在将新的本机BLE API与三星BLE API进行比较时,他们确实回答了我的问题:
Samsung recently published a "migration"-document on the same page I linked in my question. They exactly answer my question while comparing the new native BLE API with the Samsung BLE API:
堆栈和F / W的同步特性并没有受到影响。
也就是说,例如,对于特定的
特征调用writeCharacteristic
,如果返回true,则对任何<$ c $的下一个调用c> BluetoothGatt
或BluetoothGattServer
方法应在onCharacteristicRead
回调之后完成收到。这是因为堆栈被设计为
一次仅支持和处理一个GATT调用,并且,例如,对于
,您调用writeCharacteristic
或第一个后不久的任何特征
中的readCharacteristic
,将被忽略。
The synchronous nature of the stack and F/W hasn’t been affected. That is, if we call for example,
writeCharacteristic
for a particular characteristic, if it returns true, the next call to anyBluetoothGatt
orBluetoothGattServer
method should be done after theonCharacteristicRead
callback is received. This is because the stack is designed to support and process only one GATT call at a time, and if, for example, you callwriteCharacteristic
orreadCharacteristic
of anycharacteristic
soon after the first one, it is ignored.
这篇关于本质上,本机Android BLE实现是同步的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!