Skip to content

Commit

Permalink
Release 1.31.15
Browse files Browse the repository at this point in the history
  • Loading branch information
chipweinberger committed Feb 15, 2024
1 parent 4cb278e commit 9381858
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.31.15
* **[Feature]** support advertising `appearance` on Android

## 1.31.14
* **[Fix]** autoconnect could not disconnect if there are multiple devices

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1715,19 +1715,17 @@ private void disconnectAllDevices(String func)
}

int getAppearanceFromScanRecord(ScanRecord adv) {
if (Build.VERSION.SDK_INT >= 33) { // Android 13

if (Build.VERSION.SDK_INT >= 33) { // Android 13 (August 2022)
Map<Integer, byte[]> map = adv.getAdvertisingDataMap();
if (map.containsKey(ScanRecord.DATA_TYPE_APPEARANCE)) {
byte[] bytes = map.get(ScanRecord.DATA_TYPE_APPEARANCE);
if (bytes.length == 2) {
// The conversion from byte to int is crucial!
int loByte = bytes[0] & 0xFF;
int hiByte = bytes[1] & 0xFF;
return hiByte * 256 + loByte;
}
}

return 0;
}

Expand Down Expand Up @@ -1759,7 +1757,6 @@ int getAppearanceFromScanRecord(ScanRecord adv) {

// appearance type byte
if (dataType == 0x19 && fieldLen == 3) {
// The conversion from byte to int is crucial!
int loByte = bytes[n + 2] & 0xFF;
int hiByte = bytes[n + 3] & 0xFF;
return hiByte * 256 + loByte;
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, iOS, and MacOS.
version: 1.31.14
version: 1.31.15
homepage: https://github.com/boskokg/flutter_blue_plus

environment:
Expand Down

0 comments on commit 9381858

Please sign in to comment.