Skip to content

Commit

Permalink
Release 1.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chipweinberger committed Jul 22, 2023
1 parent b507147 commit 7a1b62e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 27 deletions.
19 changes: 14 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
35 changes: 19 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
});
```
Expand Down Expand Up @@ -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**.
10 changes: 5 additions & 5 deletions lib/src/bluetooth_descriptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ class BluetoothDescriptor {

List<int> 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<List<int>> get lastValueStream => onDescriptorReceived.newStreamWithInitialValue(lastValue);
Stream<List<int>> get lastValueStream => onValueReceived.newStreamWithInitialValue(lastValue);

// this stream is pushed to whenever:
// 1. the descriptor is successfully read
// 2. the descriptor is successfully written
Stream<List<int>> get onDescriptorReceived => FlutterBluePlus.instance._methodStream
Stream<List<int>> get onValueReceived => FlutterBluePlus.instance._methodStream
.where((m) => m.method == "OnDescriptorResponse")
.map((m) => m.arguments)
.map((buffer) => BmOnDescriptorResponse.fromMap(buffer))
Expand Down Expand Up @@ -141,8 +141,8 @@ class BluetoothDescriptor {
'}';
}

@Deprecated('Use onDescriptorReceived instead')
Stream<List<int>> get value => onDescriptorReceived;
@Deprecated('Use onValueReceived instead')
Stream<List<int>> get value => onValueReceived;

@Deprecated('Use remoteId instead')
DeviceIdentifier get deviceId => remoteId;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 7a1b62e

Please sign in to comment.