bluetooth_connection_plugin 1.5.0
bluetooth_connection_plugin: ^1.5.0 copied to clipboard
A Flutter plugin for connecting to Bluetooth devices, Supports device discovery, connection, data reading, and real-time data monitoring.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.5.0 20254-12-19 #
Added #
- ✅ iOS Platform Support - Complete iOS implementation using Core Bluetooth
- ✅ iOS Bluetooth Low Energy (BLE) device scanning and discovery
- ✅ iOS device connection and disconnection management
- ✅ iOS data reading and real-time listening capabilities
- ✅ iOS Bluetooth permission handling with proper Info.plist configuration
- ✅ Cross-platform compatibility for both Android and iOS
- ✅ iOS-specific Bluetooth manager with CBCentralManager integration
- ✅ iOS characteristic discovery and notification support
Technical Details #
- iOS Implementation: Native Swift implementation using Core Bluetooth framework
- BLE Focus: iOS implementation primarily supports Bluetooth Low Energy devices
- Device Discovery: iOS uses active scanning instead of paired device access
- Permissions: Automatic permission handling with proper usage descriptions
[1.5.0] - 2024-12-19 #
Added #
- ✅ Initial release of Bluetooth Connection Plugin
- ✅ Complete Bluetooth device discovery and pairing support
- ✅ Robust connection management with automatic retry mechanisms
- ✅ Real-time data reading with multiple UUID support (SPP, Weight Scale Service, etc.)
- ✅ Intelligent weight value extraction from raw device data
- ✅ Background data listening with coroutine-based implementation
- ✅ Comprehensive error handling with custom BluetoothException
- ✅ Android 12+ permission handling (BLUETOOTH_CONNECT, BLUETOOTH_SCAN)
- ✅ Legacy Android support (API 21+) with backward compatibility
- ✅ Data models: BluetoothData, BluetoothDeviceInfo, BluetoothException
- ✅ Complete example app demonstrating all features
- ✅ Extensive documentation and usage examples
- ✅ Universal compatibility with weighing machines and IoT devices
Supported Features #
- Device discovery (paired devices)
- Connection/disconnection management
- Data reading with retry mechanisms
- Real-time data listening
- Weight value extraction
- Permission handling
- Error management
- Multiple Bluetooth protocol support
Platform Support #
- ✅ Android (API 21+)
- 🚧 iOS (Coming in future releases)
API Methods #
BluetoothConnectionPlugin.initialize()
BluetoothConnectionPlugin.getPairedDevices()
BluetoothConnectionPlugin.connectToDevice(String address)
BluetoothConnectionPlugin.disconnectDevice()
BluetoothConnectionPlugin.isConnected()
BluetoothConnectionPlugin.readData()
BluetoothConnectionPlugin.sendData(String data)
BluetoothConnectionPlugin.startDataStreaming()
BluetoothConnectionPlugin.stopDataStreaming()
Dependencies #
- Flutter SDK: >=3.3.0
- Dart SDK: ^3.6.1
- plugin_platform_interface: ^2.0.2
Testing #
- ✅ Verified with multiple weighing machine brands
- ✅ Tested on Android 8-14 (API 26-34)
- ✅ Permission handling tested on Android 12+
- ✅ Background listening functionality verified
- ✅ Data extraction algorithms tested with various data formats
[Unreleased] #
Planned Features #
- 🚧 iOS platform support
- 🚧 Device scanning (non-paired devices)
- 🚧 Bluetooth Low Energy (BLE) support
- 🚧 Custom data parsers for specific device brands
- 🚧 Connection state monitoring stream
- 🚧 Automatic reconnection on connection loss
- 🚧 Device characteristic discovery
- 🚧 Multiple device connection support
Future Enhancements #
- Enhanced error reporting
- Performance optimizations
- Additional data validation
- Custom timeout configurations
- Device-specific protocol implementations