diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e09d7b1..03d40e58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,20 @@ ## 1.9.0 + +This release marks the end of major work to improve reliability and +simplicity of the FlutterBluePlus codebase. Please submit bug reports. + +* Adroid/iOS: fix mtu check minus 3 issue (reggression in 1.8.3) +* deprecated: BluetoothCharacteristic.value -> lastValueStream +* deprecated: BluetoothDescriptor.value -> lastValueStream +* deprecated: BluetoothCharacteristic.onValueChangedStream -> onValueReceived +* deprecated: BluetoothDescriptor.onValueChangedStream -> onValueReceived +* dart: fix deprecated BluetoothCharacteristic.state variable not working (bug introduced 1.8.6) +* dart: fix deprecated FlutterBluePlus.instance.state variable not working (bug introduced 1.8.6) * internal: refactor adapterState to use methodChannel -* internal: refactor BmReadCharacteristicResponse & BmWriteCharacteristicResponse to have simpler structure -* internal: refactor BmReadDescriptorResponse & BmWriteDescriptorResponse to have simpler structure -* internal: refactor BmSetNotificationResponse, replaced by BmWriteDescriptorResponse -* internal: refactor secondaryServiceUuid code its own getServicePair() function +* internal: refactor various 'bm' message schemas to use simpler characteristic structure +* internal: refactor BmSetNotificationResponse removed. It is simpler to reuse BmWriteDescriptorResponse +* internal: refactor move secondaryServiceUuid code its own getServicePair() function * internal: refactor android MessageMaker to be a bit more legible -* deprecated: BluetoothCharacteristic.onValueChangedStream replaced by value ## 1.8.8 * android & iOS: fix connectionState not being updated (regression in 1.8.6) diff --git a/README.md b/README.md index 84b976a0..688221cc 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,11 @@ then in `pubspec.yaml` add the repo by path: Now you can edit FlutterBluePlus code and debug issues yourself. +### When I scan using a service UUID filter, it doesn't find any devices. + +Make sure the device is advertising which service UUID's it supports. This is found in the advertisement +packet as **UUID 16 bit complete list** or **UUID 128 bit complete list**. + ## Usage ### Obtain an instance @@ -119,7 +124,7 @@ await d.write([0x12, 0x34]) ```dart await characteristic.setNotifyValue(true); -characteristic.value.listen((value) { +characteristic.onValueReceived.listen((value) { // do something with new value }); ``` @@ -226,23 +231,21 @@ For location permissions on iOS see more at: [https://developer.apple.com/docume ### BluetoothCharacteristic API -| | Android | iOS | Description | -| :------------- | :----------------: | :----------------: | :------------------------------------------------------- | -| read | :white_check_mark: | :white_check_mark: | Retrieves the value of the characteristic. | -| write | :white_check_mark: | :white_check_mark: | Writes the value of the characteristic. | -| setNotifyValue | :white_check_mark: | :white_check_mark: | Sets notifications or indications on the characteristic. | -| value | :white_check_mark: | :white_check_mark: | Stream of characteristic's value when changed. | +| | Android | iOS | Description | +| :------------- | :----------------: | :----------------: | :------------------------------------------------------- | +| read | :white_check_mark: | :white_check_mark: | Retrieves the value of the characteristic. | +| write | :white_check_mark: | :white_check_mark: | Writes the value of the characteristic. | +| setNotifyValue | :white_check_mark: | :white_check_mark: | Sets notifications or indications on the characteristic. | +| onValueReceived | :white_check_mark: | :white_check_mark: | Stream of characteristic value changes | +| lastValueStream | :white_check_mark: | :white_check_mark: | Stream of lastValue + characteristic value changes | ### BluetoothDescriptor API -| | Android | iOS | Description | -| :---- | :----------------: | :----------------: | :------------------------------------- | -| read | :white_check_mark: | :white_check_mark: | Retrieves the value of the descriptor. | -| write | :white_check_mark: | :white_check_mark: | Writes the value of the descriptor. | +| | Android | iOS | Description | +| :---- | :----------------: | :----------------: | :------------------------------------- | +| read | :white_check_mark: | :white_check_mark: | Retrieves the value of the descriptor. | +| write | :white_check_mark: | :white_check_mark: | Writes the value of the descriptor. | +| onValueReceived | :white_check_mark: | :white_check_mark: | Stream of descriptor value changes | +| lastValueStream | :white_check_mark: | :white_check_mark: | Stream of lastValue + descriptor value changes | -## Troubleshooting - -### When I scan using a service UUID filter, it doesn't find any devices. -Make sure the device is advertising which service UUID's it supports. This is found in the advertisement -packet as **UUID 16 bit complete list** or **UUID 128 bit complete list**. diff --git a/lib/src/bluetooth_descriptor.dart b/lib/src/bluetooth_descriptor.dart index 7384bcbd..6d0abd44 100644 --- a/lib/src/bluetooth_descriptor.dart +++ b/lib/src/bluetooth_descriptor.dart @@ -16,14 +16,14 @@ class BluetoothDescriptor { List lastValue = []; - // same as onDescriptorReceived, but the stream starts + // same as onValueReceived, but the stream starts // with lastValue as its first value (so to not cause delay) - Stream> get lastValueStream => onDescriptorReceived.newStreamWithInitialValue(lastValue); + Stream> get lastValueStream => onValueReceived.newStreamWithInitialValue(lastValue); // this stream is pushed to whenever: // 1. the descriptor is successfully read // 2. the descriptor is successfully written - Stream> get onDescriptorReceived => FlutterBluePlus.instance._methodStream + Stream> get onValueReceived => FlutterBluePlus.instance._methodStream .where((m) => m.method == "OnDescriptorResponse") .map((m) => m.arguments) .map((buffer) => BmOnDescriptorResponse.fromMap(buffer)) @@ -141,8 +141,8 @@ class BluetoothDescriptor { '}'; } - @Deprecated('Use onDescriptorReceived instead') - Stream> get value => onDescriptorReceived; + @Deprecated('Use onValueReceived instead') + Stream> get value => onValueReceived; @Deprecated('Use remoteId instead') DeviceIdentifier get deviceId => remoteId; diff --git a/pubspec.yaml b/pubspec.yaml index 2af68f67..70da737b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_blue_plus description: Flutter plugin for connecting and communicationg with Bluetooth Low Energy devices, on Android and iOS -version: 1.8.8 +version: 1.9.0 homepage: https://github.com/boskokg/flutter_blue_plus environment: