ble_shield 0.3.0
ble_shield: ^0.3.0 copied to clipboard
Defensive BLE central for Flutter (Android, iOS, macOS): cached state, aggregated scan, serialized GATT, connect timeouts, managed auto-reconnect, typed errors.
0.3.0 #
- macOS is now a declared platform (10.15+), on the same shared Darwin
sources as iOS. Apps need
NSBluetoothAlwaysUsageDescriptionand thecom.apple.security.device.bluetoothentitlement. State restoration is iOS-only:configureRestorationreturns false on macOS. The README has a feature table per platform. - The README has a Roadmap: Windows, Web and Linux are planned, and the package reaches 1.0.0 when that rollout is complete.
0.2.3 #
- Documentation only: the README covers installation, runtime permissions (requested by the app, not by ble_shield), the constructor options and their defaults, GATT timeouts and capability getters, scan result fields, and the MTU and scan caveats per platform. No code change.
0.2.2 #
- Android:
ShieldDevice.connectionParametersnow works in minified release builds. The plugin ships a consumer ProGuard rule that keeps the hiddenonConnectionUpdatedcallback, which the code shrinker used to strip.
0.2.1 #
- Diagnostics (public API contract 3.1, additive):
BleShield.setNativeLogLevel(ShieldLogLevel)turns on the native layer's logs in any build mode (the upstream debug-only guard is gone);ShieldDevice.mtuNow/mtureport the ATT MTU the platform negotiated, requested or not (Android on every negotiation, Apple on connect);ShieldDevice.connectionParametersNow/connectionParametersreport the Android connection interval, latency and supervision timeout (Android 8+). - Native: new
onMtuChangedcallback on the Pigeon callback channel.
0.2.0 #
First published version.
- ble_shield is now a Flutter plugin with its own native layer for Android and
iOS, derived from universal_ble 3.2.0 (see
NOTICEandthird_party/UPSTREAM.md). The dependency on universal_ble and the path override to its fork are gone, and so arebluez,dbusandflutter_web_bluetoothfrom the resolution. - Own native identity: Android package
io.github.tganzerli.ble_shield, plugin classBleShieldPlugin, Pigeon channelsdev.flutter.pigeon.ble_shield.*, iOS moduleble_shield, own Android request codes. ble_shield can share an app with universal_ble or flutter_blue_plus. - iOS: no
CBCentralManageris created at plugin registration. State restoration is opt-in only throughconfigureRestoration; there is no default identifier and no Info.plist key. - iOS: the adapter state always comes from a real central manager, so the adapter stream keeps updating after the permission prompt.
- Breaking (tests only):
BleShield(platform:)now takes aBleShieldPlatformfrompackage:ble_shield/testing.dartand is@visibleForTesting. - Peripheral (GATT server) mode is not included.
- Breaking:
scanWatchdogis off by default, and when set it only addsscanFailedtoscanErrors: the scan keeps running. It used to end the session after 30 s without adverts, which killed healthy filtered scans. - Android: a scanner failure (
ScanCallback.onScanFailed, or a failure starting the scan) now ends the scan session and is reported onscanErrorsasscanFailed, with the platform code innativeCode. - Android: one GATT client per device.
connectreuses a pending auto-connect or closes the previous client before opening a new one, so auto-reconnects andsystemDevicesadoption no longer leave orphan clients. ShieldDevice.disconnecttakesrearm(defaulttrue, unchanged). Withrearm: false, auto-reconnect is not re-armed (by the drop or by the adapter coming back on) until the device connects again orsetAutoReconnectis called;autoReconnectstays on for drops of the next session.adapterStateno longer emits a transientunknownon a new engine: until the platform answers for the first time, the first event is held back (up to the newadapterStateTimeout, default 3 s), then the cached state is delivered.adapterStateNowis unchanged.- Breaking: a default
disconnect()on a device that is not connected no longer cancels a reconnection armed by a drop, a retry or the adapter coming back on, whileautoReconnectis on: the timer and a pending OS request are left alone and no native disconnect is issued. Usedisconnect(rearm: false), or turnautoReconnectoff first, to stop it. A kick is still cancelled.
0.1.0-dev #
Initial development version (not published).
BleShieldcentral with an inert constructor: adapter state cache with replay,isSupported, and aturnOnthat never hangs.- Scanning: aggregated results with
removeIfGone, a scan state kept by ble_shield,scanErrors, and a watchdog for silently dead scanners. ShieldDevice: connect with a 35 s timeout (cancelled natively on timeout), GATT release on failure,connectInProgress, and a global GATT lock that covers connect.- Auto-reconnect state machine (kick, drop, retry, adapter-on), whose failures
are reported on
reconnectEventsand never thrown. - GATT: per-connection discovery, read, write (with response by default),
setNotifychoosing notify or indicate, and per-characteristic values. - iOS restoration opt-in (
configureRestoration), restored ids kept by an injectable store, andsystemDeviceswith Dart-side filtering on Android. - A single
ShieldErrortype with typed codes.