public interface IChannel
Modifier and Type | Interface and Description |
---|---|
static interface |
IChannel.OperationCallback
操作回调接口
|
Modifier and Type | Method and Description |
---|---|
boolean |
addGattCallback(IBluetoothGattCallback callback)
添加回调,用于监听
BluetoothGattCallback 事件 |
void |
close()
关闭channel
|
boolean |
enableIndication(boolean enable,
BluetoothGattCharacteristic characteristic,
IChannel.OperationCallback callback)
启用/禁用 notification
|
boolean |
enableNotification(boolean enable,
BluetoothGattCharacteristic characteristic,
IChannel.OperationCallback callback)
启用/禁用 indication
|
long |
getTimeout()
所有操作将在
getTimeout() 内完成,如果超过这个时间,将强制报错. |
boolean |
removeGattCallback(IBluetoothGattCallback callback)
删除用于监听
BluetoothGattCallback 事件的回调 |
boolean |
writeCharacteristic(BluetoothGattCharacteristic characteristic,
byte[] data,
IChannel.OperationCallback callback)
发送数据
|
boolean enableIndication(boolean enable, BluetoothGattCharacteristic characteristic, IChannel.OperationCallback callback)
enable
- true 启用;false 禁用characteristic
- 要操作的 characteristiccallback
- 操作接口回调boolean enableNotification(boolean enable, BluetoothGattCharacteristic characteristic, IChannel.OperationCallback callback)
enable
- true 启用;false 禁用characteristic
- 要操作的 characteristiccallback
- 操作接口回调boolean writeCharacteristic(BluetoothGattCharacteristic characteristic, byte[] data, IChannel.OperationCallback callback)
characteristic
- 要操作的 characteristiccallback
- 操作接口回调boolean addGattCallback(IBluetoothGattCallback callback)
BluetoothGattCallback
事件callback
- gatt 回调接口boolean removeGattCallback(IBluetoothGattCallback callback)
BluetoothGattCallback
事件的回调callback
- gatt 回调接口long getTimeout()
getTimeout()
内完成,如果超过这个时间,将强制报错.void close()