WinBle class
Properties
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
toString()
→ String
-
A string representation of this object.
inherited
Static Methods
-
canPair(String address)
→ Future<bool>
-
canPair will return a boolean
-
characteristicValueStreamOf({required String address, required String serviceId, required String characteristicId})
→ Stream
-
to get update of a
specific characteristic
-
connect(String address)
→ Future<void>
-
connect will update a Stream of boolean
getConnectionStream
true if connected
false if disconnected
-
connectionStreamOf(String address)
→ Stream<bool>
-
to get
connection update
for a specific device
-
disconnect(dynamic address)
→ Future<void>
-
disconnect will update a Stream of boolean
getConnectionStream
and also ignore if that device is already disconnected
-
discoverCharacteristics({required String address, required String serviceId})
→ Future<List<BleCharacteristic>>
-
discoverCharacteristics will return a list of BleCharacteristic
-
discoverServices(dynamic address)
→ Future<List<String>>
-
discoverServices will return a list of services List
-
dispose()
→ void
-
call dispose method to close all resources
-
initialize({bool enableLog = false})
→ dynamic
-
initialize WinBle with
showLog
: if true, print logs to console
call dispose when Done
-
isPaired(String address)
→ Future<bool>
-
isPaired will return a boolean
-
pair(String address)
→ Future<void>
-
pair will send a pairing command
it will be completed on Successful Pairing
or it will throw Error on Unsuccessful Pairing
-
read({required String address, required String serviceId, required String characteristicId})
→ Future<List<int>>
-
read will read characteristic value and returns a List
-
startScanning()
→ void
-
To
Start Scanning
-
stopScanning()
→ void
-
To
Stop Scanning
-
subscribeToCharacteristic({required String address, required String serviceId, required String characteristicId})
→ Future<void>
-
subscribeToCharacteristic will subscribe to characteristic and
we can get update on connectionStream
call connectionStreamOf to get value of specific characteristic
-
unPair(String address)
→ Future<void>
-
unPair will try to Un-pair
-
unSubscribeFromCharacteristic({required String address, required String serviceId, required String characteristicId})
→ Future<void>
-
unsubscribeFromCharacteristic
will unsubscribe from characteristic , throws error if this characteristic is not subscribed
-
write({required String address, required String service, required String characteristic, required Uint8List data, required bool writeWithResponse})
→ Future<void>
-
write will write characteristic value and returns error if something is wrong
wrap in try catch to capture error