From 334bc1c6809cd698b950e4d9a4781f460cbec197 Mon Sep 17 00:00:00 2001 From: Foti Dim Date: Wed, 19 Mar 2025 22:17:06 +0100 Subject: [PATCH] Improve docs for isPaired --- CHANGELOG.md | 3 +++ README.md | 5 ++++- lib/src/universal_ble.dart | 7 +++---- pubspec.yaml | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e424ce..57765ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.18.0 +* Improve docs for isPaired + ## 0.17.0 * Fix Windows crash when calling pair APIs with an unknown deviceId * Fix Windows crash when calling startScan again after some time diff --git a/README.md b/README.md index 5095823..6c70c25 100644 --- a/README.md +++ b/README.md @@ -209,7 +209,7 @@ bool? isPaired = await UniversalBle.pair(deviceId); // Returns true if successfu // For Apple and Web, you can optionally pass a pairingCommand if you know an encrypted read or write characteristic. // Not supported on Web/Windows -UniversalBle.pair(deviceId, pairingCommand: BleCommand(service:"SERVICE", characteristic:"ENCRYPTED_CHARACTERISTIC",)); +bool? isPaired = UniversalBle.pair(deviceId, pairingCommand: BleCommand(service:"SERVICE", characteristic:"ENCRYPTED_CHARACTERISTIC",)); // Receive pairing state changes UniversalBle.onPairingStateChange = (String deviceId, bool isPaired) { @@ -221,6 +221,9 @@ UniversalBle.unpair(deviceId); // Check current pairing state bool? isPaired = UniversalBle.isPaired(deviceId); + +// For `Apple` and `Web`, you have to pass a "pairingCommand" with an encrypted read or write characteristic. +bool? isPaired = await UniversalBle.isPaired(deviceId, pairingCommand: BleCommand(service:"SERVICE", characteristic:"ENCRYPTED_CHARACTERISTIC")); ``` ### Bluetooth Availability diff --git a/lib/src/universal_ble.dart b/lib/src/universal_ble.dart index 17e537c..874c6ba 100644 --- a/lib/src/universal_ble.dart +++ b/lib/src/universal_ble.dart @@ -219,11 +219,10 @@ class UniversalBle { /// Check if a device is paired. /// - /// For Apple and Web, you can optionally pass a pairingCommand if you know an encrypted read or write characteristic. - /// It will return true/false if it manages to execute the command. + /// For `Apple` and `Web`, you have to pass a "pairingCommand" with an encrypted read or write characteristic. + /// Returns true/false if it manages to execute the command. + /// Returns null when no `pairingCommand` is passed. /// Note that it will trigger pairing if the device is not already paired. - /// - /// Returns null on `Apple` and `Web` when no `bleCommand` is passed. static Future isPaired( String deviceId, { BleCommand? pairingCommand, diff --git a/pubspec.yaml b/pubspec.yaml index 64a09b6..7fca45a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: universal_ble description: A cross-platform (Android/iOS/macOS/Windows/Linux/Web) Bluetooth Low Energy (BLE) plugin for Flutter -version: 0.17.0 +version: 0.18.0 homepage: https://navideck.com repository: https://github.com/Navideck/universal_ble issue_tracker: https://github.com/Navideck/universal_ble/issues