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, bool forceRefresh = false})
→ Future<List<BleCharacteristic>>
-
discoverCharacteristics will return a list of BleCharacteristic
-
discoverServices(dynamic address, {bool forceRefresh = false})
→ Future<List<String>>
-
discoverServices will return a list of services List
-
dispose()
→ void
-
call dispose method to close all resources
-
getBluetoothState()
→ Future<BleState>
-
To get ble radio state
-
getMaxMtuSize(String address)
→ Future
-
To get max MtuSize
-
initialize({required String serverPath, bool enableLog = false})
→ Future<void>
-
make sure to initialize WinBle once before using it
call dispose when Done
-
isPaired(String address, {bool forceRefresh = false})
→ Future<bool>
-
isPaired will return a boolean
forceRefresh
will get the latest pair status of this device
-
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
-
updateBluetoothState(bool turnOn)
→ Future<BleState>
-
To turn on/off ble radio
-
version()
→ Future<String>
-
To get ble server version
-
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