Device class

蓝牙设备对象,封装了与蓝牙交互的方法

Properties

deviceSignalResultStream Stream<DeviceSignalResult>
获取设备返回数据的结果广播流
no setter
hashCode int
The hash code for this object.
no setterinherited
isWatchingRssi bool
获取当前是否正在监听rssi的变化
no setter
mtu int
获取当前设备的mtu,默认是23
no setter
rssi int
获取当前设备的rssi
no setter
rssiStream Stream<int>
获取设备rssi监听流
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serviceDiscoveryStream Stream<BleService>
获取设备蓝牙服务发现流
no setter
state DeviceState
获取当前设备连接状态
no setter
stateStream Stream<DeviceState>
获取设备状态变化流
no setter

Methods

androidRequestMtu(int newMtu, dynamic callback(bool isSuccess, int newMtu)) → void
修改设备的mtu,只有android 21 以上才能用
connect({dynamic connectTimeout = 0}) → void
连接设备
destroy() → void
销毁设备对象,不然可能会存在重复的设备对象,当
disConnect() → void
与设备断开连接
discoveryService() → void
发现设备服务
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readData(String serviceUuid, String characteristicUuid) → void
使用设备的read特征值去向设备读取数据
readDescriptorData(String serviceUuid, String characteristicUuid, String descriptorUuid) → void
使用设备特征值的描述去向设备读取数据
setNotify(String serviceUuid, String characteristicUuid, bool isEnable) Future<bool>
设置对应的notify特征值的通知 返回true代表设置成功,false代表设置失败
startWatchRssi() Future<bool>
开始监听设备rssi
stopWatchRssi() Future<bool>
停止监听设备rssi
toString() String
A string representation of this object.
inherited
writeData(String serviceUuid, String characteristicUuid, bool isNoResponse, Uint8List data) → void
使用设备的write特征值去向设备发送数据
writeDescriptorData(String serviceUuid, String characteristicUuid, String descriptorUuid, Uint8List data) → void
使用设备特征值描述去向设备发送数据

Operators

operator ==(Object other) bool
The equality operator.
inherited