BlePeripheral class

从设备

Constructors

BlePeripheral()

Properties

connected bool
当前是否是已连接状态
no setter
connecting bool
是否在连接中
no setter
disconnected bool
是否已经断开连接
no setter
disposed bool
是否已释放
no setter
ensureConnectedFuture Future<void>?
getter/setter pair
fireConnectEvent bool
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
notifyMap Map<String, _NotifyData>
getter/setter pair
packageSize int
可发送的包的大小
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
suggestedMTU int
得到建议的mtu,-1表示为初始化
no setter
writing bool
getter/setter pair

Methods

addConnectedListener(ConnectionListener listener) → void
添加已连接的监听
addConnectErrorListener(ConnectionErrorListener listener) → void
添加连接错误的监听
addDisconnectedListener(ConnectionListener listener) → void
添加断开连接的监听
addLargeIndicateListener(Uuid service, Uuid characteristic, NotifyListener listener) → void
添加一个长数据的监听
addNotifyListener(Uuid service, Uuid characteristic, NotifyListener listener) → void
添加通知监听
checkConnected() → void
clearConnectedListener() → void
清空所有已连接监听
clearConnectErrorListener() → void
清空所有连接错误的监听
clearDisconnectedListener() → void
清空所有断开连接的监听
connect({int timeoutMilliseconds = 2000}) → void
连接
connectToAdvertisingDevice(Uuid service, {int timeoutMilliseconds = 2000}) → void
连接
disconnect() Future<void>
断开连接
dispose() Future<void>
释放
ensureConnected() Future<void>
确保已连接
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(Uuid service, Uuid characteristic) Future<Uint8List>
从指定的 characteristic 读取数据
removeConnectedListener(ConnectionListener listener) → void
移除已连接的监听
removeConnectErrorListener(ConnectionErrorListener listener) → void
移除连接错误的监听
removeDisconnectedListener(ConnectionListener listener) → void
移除断开连接的监听
removeLargeIndicateListener(Uuid service, Uuid characteristic, NotifyListener listener) Future<void>
移除一个长数据的监听
removeNotifyListener(Uuid service, Uuid characteristic, NotifyListener listener) Future<void>
移除通知监听
request(Uuid service, Uuid characteristic, Uint8List data) Future<Uint8List>
请求一个数据,受到mtu的限制
requestConnectionPriority(ConnectionPriority priority) Future<void>
请求优先级,仅在android上生效
requestLarge(Uuid service, Uuid characteristic, Uint8List data) Future<Uint8List>
请求一个数据,不受到mtu的限制
requestMtu(int mtu, {int timeout = 2000}) Future<int>
请求修改mtu
requestSuggestedMtu() Future<int>
请求建议的MTU大小
toString() String
A string representation of this object.
inherited
writeLarge(Uuid service, Uuid characteristic, Uint8List bytes) Future<void>
写数据,可以忽视mtu限制 前提是已经调用了 initRequestSuggestMtu 初始化了最佳mtu
writeWithoutResponse(Uuid service, Uuid characteristic, Uint8List data) Future<void>
向一个 characteristic 写入无应答数据数据
writeWithResponse(Uuid service, Uuid characteristic, Uint8List data) Future<void>
向一个 characteristic 写入数据数据

Operators

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