diff --git a/lib/src/models/ble_capabilities.dart b/lib/src/models/ble_capabilities.dart index 4b48bd0..9b37657 100644 --- a/lib/src/models/ble_capabilities.dart +++ b/lib/src/models/ble_capabilities.dart @@ -2,26 +2,25 @@ import 'package:flutter/foundation.dart'; class BleCapabilities { /// Returns true if in-app pairing is possible either by API or by encrypted characteristic - /// using any kind of pairing method (JustWorks, Numeric Comparison or Passkey Entry). + /// using any kind of pairing method (Just Works, Numeric Comparison or Passkey Entry). /// /// All platforms return true except Web/Windows and Web/Linux which return false /// because they only support "Numeric Comparison" and "Passkey Entry". /// - /// For more fine-grained control it is recommended to use `triggersJustWorksPairingWithEncryptedChar` + /// For more fine-grained control it is recommended to use `triggersConfirmOnlyPairing` /// in conjunction with the pairing method of your peripheral, - /// e.g. if (!BleCapabilities.triggersJustWorksPairingWithEncryptedChar && peripheralUsesJustWorksPairing) throw "In-app pairing not supported"; + /// e.g. if (!BleCapabilities.triggersConfirmOnlyPairing && peripheralUsesConfirmOnlyPairing) throw "In-app pairing not supported"; static final bool supportsAllPairingKinds = - triggersJustWorksPairingWithEncryptedChar || hasSystemPairingApi; + triggersConfirmOnlyPairing || hasSystemPairingApi; - /// Returns true if the platform triggers JustWorks pairing when trying to read or write - /// to an encrypted characteristic. + /// Returns true if the platform triggers pairing for devices that use only confirmation pairing + /// (a.k.a. "Just Works" or legacy pairing) when trying to read or write to an encrypted characteristic. /// - /// Pairing methods such as "Numeric Comparison" or "Passkey Entry" - /// trigger pairing on all platforms. + /// The "Numeric Comparison" and "Passkey Entry" pairing methods trigger pairing on all platforms. /// /// `Web/Linux` could also, under certain conditions, trigger "Just Works" pairing /// but it very unreliable, therefore we return false. - static final triggersJustWorksPairingWithEncryptedChar = + static final triggersConfirmOnlyPairing = defaultTargetPlatform != TargetPlatform.windows && defaultTargetPlatform != TargetPlatform.linux; diff --git a/lib/src/universal_ble.dart b/lib/src/universal_ble.dart index 0fd2b1f..67337b0 100644 --- a/lib/src/universal_ble.dart +++ b/lib/src/universal_ble.dart @@ -236,7 +236,7 @@ class UniversalBle { /// You can optionally pass a pairingCommand if you know an encrypted read or write characteristic. /// If you do, it returns true if it can successfully execute the command after pairing. /// - /// On `Web/Windows` and `Web/Linux` it does not work for devices that use "Just Works" pairing. + /// On `Web/Windows` and `Web/Linux`, it does not work for devices where `BleCapabilities.triggersConfirmOnlyPairing` is false. static Future pair( String deviceId, { BleCommand? pairingCommand,