universal_bluetooth_classic 1.3.1
universal_bluetooth_classic: ^1.3.1 copied to clipboard
Bluetooth Classic & External Accessory for Flutter
1.3.1 #
- Windows: include
<winrt/Windows.Foundation.h>and<winrt/Windows.Foundation.Collections.h>inbluetooth_serial_manager.hso the WinRT coroutine operators (co_await),IClosable::Close, andIVectorViewcollections compile cleanly with MSVC.
1.3.0 #
- macOS: keep a requested scan running.
IOBluetoothDeviceInquiryonly runs forinquiryLengthseconds, so the plugin restarts it after a short delay untilstopScanis called. Restarts that macOS throttles are retried, andisScanningreports whether a scan was requested, including the restart delay. - macOS: resolve device names after an inquiry stops. macOS can report a found device with its address as the name; the plugin now issues remote name requests between inquiry rounds and re-emits the device when the name arrives, instead of relying on the system name cache.
- macOS: report each device once per scan and again only when its name
changes, instead of re-emitting every device on every inquiry round. Pending
name requests are dropped by
stopScan, so no discovery events arrive after a scan is stopped. - macOS: pair with a longer page timeout and up to three attempts. Classic
openConnectioncan returnI/O Timeouton the first page after discovery, especially when the device just switched from BLE to classic discoverable mode. Only timeouts are retried, so a rejected pairing or an unreachable device fails immediately instead of prompting again. - macOS: propagate
IOBluetoothDeviceInquiry.start()failures fromstartScaninstead of silently doing nothing.
1.2.0 #
- Add a generic serial (SPP/RFCOMM) transport on Android, macOS, and Windows.
connecttakes an optionalBluetoothTransportand an optionalserviceUuid; bytes are exchanged through the existingsend/onDataAPI. TheBluetoothTransportenum hashid,spp, andexternalAccessorymembers; omittingtransportselects the platform default — HID on Android and macOS, serial (SPP/RFCOMM) on Windows, and an External Accessory session on iOS. Windows gains data-transport support (connect/send/onData/disconnect) through this transport; Bluetooth HID remains unimplemented there, so the default resolves to the serial transport on Windows. - Connection state events for the serial transport carry the new
BluetoothConnectionSource.sppvalue. connectrejects a second concurrent connection to the same device with aStateErrorinstead of overwriting the transport the first one recorded, anddisconnectwaits for an in-flight connect so the connection it opens is actually closed.closeSdpnow throwsUnsupportedErroron platforms without SDP registration (Windows) instead of reaching an unregistered channel.- Add an optional
bluezdependency lower bound of^0.9.0for the Linux implementation. - Note that adding the optional
transportandserviceUuidparameters toconnectis a source-breaking change for customUniversalBluetoothInterfaceimplementations. - Migrate the Pigeon definitions and generated bindings to Pigeon 29.0.10.
Because this plugin targets long-established platform APIs, the host and
callback methods use Pigeon's
@asyncCallbackstyle: the native side stays callback-based, so no Kotlin coroutines dependency and no Swift concurrency (and no iOS deployment-target bump) are required. - Replace the
staticcallback fields onUniversalBluetoothInterfacewith a per-implementationUniversalBluetoothCallbacksregistry. TheUniversalBluetooth.onXxxsetters are unchanged, but a customUniversalBluetoothInterfaceimplementation must now forward its events tocallbacksinstead of the removed statics. This is a source-breaking change for custom implementations. - Give Android and macOS SDP registration their own Pigeon channels
(
AndroidSdpChannel,MacSdpChannel) so each platform's generated code carries only its own config. The publicSdpConfig/MacSdpConfig/AndroidSdpConfigAPI is unchanged. - Add a
metadependency, which the Pigeon 29 generated Dart bindings import for their@immutable/@protected/@visibleForTestingannotations.
1.1.0 #
- Add a unified byte-stream API.
connect,send, and the newonDatacallback exchange bytes with a connected device. The HIDsendReportmethod is replaced bysend. - Add iOS External Accessory data support.
connect(protocolString)opens anEASession,sendwrites to its output stream, andonDatareceives bytes from its input stream. - Deliver
onDataon Android and macOS by forwarding the bytes the connected HID device already sends. - Fix iOS
disconnecthanging until the accessory physically disconnected. It now closes the session and completes immediately, and closes every open session when the protocol string is omitted. - Fix iOS External Accessory connect/disconnect events never firing. The Pigeon
EAAccessorystruct shadowed the framework class, so the notification handlers always failed to cast and returned early.
1.0.0 #
- Fix
showBluetoothAccessoryPickernot presenting on iOS apps that use theUIScenelifecycle (iOS 13–26.4). The plugin now presents the External Accessory picker from the active scene. - Fix the iOS example app's scene manifest key so it runs under the
UIScenelifecycle.
0.2.0 #
- Replace the iOS-only
closeEASessionAPI with the unifieddisconnectAPI. The identifier is optional for iOS External Accessory sessions. - Replace the iOS-only
accessoryConnectedandaccessoryDisconnectedcallbacks with typed, cross-platformBluetoothConnectionEventvalues fromonConnectionStateChanged. - Add iOS External Accessory and Linux BlueZ connection events.
0.1.0 #
- Initial release as
universal_bluetooth.