public interface IChannel
限定符和类型 | 接口和说明 |
---|---|
static interface |
IChannel.OperationCallback
操作回调接口
操作结果(成功/失败)回调接口
|
限定符和类型 | 方法和说明 |
---|---|
boolean |
addGattCallback(com.aliyun.iot.ble.IBluetoothGattCallback callback)
添加回调,用于监听
BluetoothGattCallback 事件 |
void |
close()
关闭channel
|
boolean |
enableIndication(boolean enable,
android.bluetooth.BluetoothGattCharacteristic characteristic,
IChannel.OperationCallback callback)
启用/禁用 notification
|
boolean |
enableNotification(boolean enable,
android.bluetooth.BluetoothGattCharacteristic characteristic,
IChannel.OperationCallback callback)
启用/禁用 indication
|
long |
getTimeout()
所有操作将在
getTimeout() 内完成,如果超过这个时间,将强制报错. |
boolean |
removeGattCallback(com.aliyun.iot.ble.IBluetoothGattCallback callback)
删除用于监听
BluetoothGattCallback 事件的回调 |
boolean |
writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic characteristic,
byte[] data,
IChannel.OperationCallback callback)
发送数据
|
boolean enableIndication(boolean enable, android.bluetooth.BluetoothGattCharacteristic characteristic, IChannel.OperationCallback callback)
enable
- true 启用;false 禁用characteristic
- 要操作的 characteristiccallback
- 操作接口回调boolean enableNotification(boolean enable, android.bluetooth.BluetoothGattCharacteristic characteristic, IChannel.OperationCallback callback)
enable
- true 启用;false 禁用characteristic
- 要操作的 characteristiccallback
- 操作接口回调boolean writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic characteristic, byte[] data, IChannel.OperationCallback callback)
characteristic
- 要操作的 characteristiccallback
- 操作接口回调boolean addGattCallback(com.aliyun.iot.ble.IBluetoothGattCallback callback)
BluetoothGattCallback
事件callback
- gatt 回调接口boolean removeGattCallback(com.aliyun.iot.ble.IBluetoothGattCallback callback)
BluetoothGattCallback
事件的回调callback
- gatt 回调接口long getTimeout()
getTimeout()
内完成,如果超过这个时间,将强制报错.void close()