bluetooth_rfcomm 0.1.1
bluetooth_rfcomm: ^0.1.1 copied to clipboard
Cross-platform Bluetooth Classic RFCOMM serial for Dart and Flutter — one package for CLI and Flutter on Windows, macOS, Linux, Android and iOS.
Changelog #
0.1.1 #
- Windows: fix rare RFCOMM disconnects under fast send/receive bursts. A blocking
recv()can returnSOCKET_ERRORwhileWSAGetLastError()reads back 0 — the thread's last-error gets clobbered by the Dart VM's safepoint/GC between the two separate FFI calls (dart-lang/sdk#38832), not a real error. The reader now classifies fail-closed onrecv()'s return value (graceful closen==0and real error codes still disconnect immediately; a clobberedwsa==0is tolerated but bounded), so a live link is no longer torn down by a benign timeout whose code was lost. A failed send is surfaced at theWARNINGlog level. - Windows: added connection diagnostics under the
bluetooth_rfcomm.connectionlogger (FINE = disconnect reason with the WSA code; FINER = per-message rx/tx idle gaps and send timing) to make link-level behaviour observable.
0.1.0 #
Initial release.
- Cross-platform Bluetooth Classic RFCOMM serial: Windows, Linux, macOS, Android, iOS.
- Pure-Dart, Flutter-free, pub.dev-publishable — works from a CLI and a Flutter
app via
dart:ffi(+package:dbuson Linux); native code behind a C ABI. The Flutter-plugin native builds (Android Gradle/JNI; Apple via native-assets) ship in the companionbluetooth_rfcomm_flutterpackage. BluetoothRfcommfacade: adapter state, bonded devices, discovery,bondedAndDiscovered, SDP service discovery, RFCOMM connect with channel selection, pair/unpair.BluetoothConnection:Stream<Uint8List>input (closes on disconnect), non-blockingadd,write/flush, state stream,close/finish.- Domain exception hierarchy;
FakeBluetoothRfcommPlatformfor tests. - Structured logging via
package:loggingunder namespaced loggers (bluetooth_rfcomm.{connection,data,discovery,adapter,native}), with raw bytes at FINEST and lifecycle at FINE. No handler is installed by default; see the README "Logging" section for per-namespace level control. - All five backends implemented (incl. Linux RFCOMM
Profile1fd stream). Only macOS and Windows have been manually verified against real hardware so far (works well enough for the author, not guaranteed perfect); the other backends are implemented but unverified and will be verified on hardware over time. See the README support table. - Does not expose
connectionState(device)— it is only implementable on Linux and would be a silent no-op elsewhere. UseBluetoothConnection.stateChanges(all platforms) orbondedDevices().isConnected.