什么是"可靠的写入"在BLE? [英] What is "reliable write" in BLE?

查看:1686
本文介绍了什么是"可靠的写入"在BLE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android的BLE API( BluetoothGatt )有一些处理方法是可靠写

In Android's BLE API (BluetoothGatt) there are methods that deal with reliable writes:

public boolean beginReliableWrite ()

public void abortReliableWrite (BluetoothDevice mDevice)

public boolean executeReliableWrite ()

还有一个回调(在<一个href=\"https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback.html#onReliableWriteCompleted%28android.bluetooth.BluetoothGatt,%20int%29\"相对=nofollow> BluetoothGattCallback ):

public void onReliableWriteCompleted (BluetoothGatt gatt, int status)

我找不到任何文档。它是什么?它是如何从正常(不可靠?)写道不同?

I can't find any documentation on that. What is it? How is it different from "normal" (unreliable?) writes?

推荐答案

当你执行一个可靠写外设证实写入是否成功与否 - 您将通过回调接收状态。与正常的写有没有确认。

When you execute a reliable write the peripheral confirms whether the write was successful or not - you will receive the status via the callback. With a normal write there is no confirmation.

例如,考虑一个恒温器。它将具有用于设定温度的特性。针对该特性的可接受范围,可以说10到35(我说摄氏度)。如果尝试将其与可靠写设置为45,那么你会得到通过回调错误状态。随着'不可靠的'写你就没有通知。

Consider a thermostat for example. It would have a characteristic for temperature set point. The acceptable range for that characteristic may be say 10 to 35 (I am talking celsius). If you attempt to set it to 45 with a reliable write then you would get an error status via the callback. With an 'unreliable' write you would have no notification.

另一种情况可能是那里的蓝牙外设有多个控制点。当数据被写入特性的车库门控制器可能会关闭。如果试图向关闭门时保护光束被打破的状态回调可能表明。回调也表明,当门被成功关闭。

Another case may be where the Bluetooth peripheral had multiple control points. A garage door controller may close when a value is written to a characteristic. If an attempt is made to close the door when a protection beam is broken the status callback could indicate that. The callback could also indicate when the door was successfully closed.

这篇关于什么是&QUOT;可靠的写入&QUOT;在BLE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆