Enhance USB serial plugin for Android and iPadOS with DriverKit support
- Updated README.md to reflect platform support for iPadOS. - Implemented isDriverAvailable method in FlutterUsbSerialPlugin for DriverKit readiness check. - Added DriverKitSerialClient C source and header files for iPadOS integration. - Created Swift Package for iPadOS support. - Updated pubspec.yaml and flutter_usb_serial.dart to clarify platform compatibility. - Enhanced tests to verify isDriverAvailable functionality. Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
@@ -1,18 +1,31 @@
|
||||
# flutter_usb_serial
|
||||
|
||||
A new Flutter plugin project.
|
||||
Flutter USB serial transport for Android and DriverKit-enabled iPadOS.
|
||||
|
||||
## Getting Started
|
||||
## Platforms
|
||||
|
||||
This project is a starting point for a Flutter
|
||||
[plug-in package](https://flutter.dev/to/develop-plugins),
|
||||
a specialized package that includes platform-specific implementation code for
|
||||
Android and/or iOS.
|
||||
- Android uses `usb-serial-for-android` and the normal Android USB permission
|
||||
flow.
|
||||
- iPadOS 16+ uses Swift Package Manager and a user client exposed by a
|
||||
USBDriverKit extension embedded in the host app. DriverKit USB support is
|
||||
available only on iPads with an M-series chip.
|
||||
|
||||
For help getting started with Flutter development, view the
|
||||
[online documentation](https://docs.flutter.dev), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
The package contains the SwiftPM client plugin, not a reusable pre-signed
|
||||
DriverKit extension. Apple provisions USB transport entitlements to the host
|
||||
app and driver for a specific USB vendor. The host app must:
|
||||
|
||||
The plugin project was generated without specifying the `--platforms` flag, no platforms are currently supported.
|
||||
To add platforms, run `flutter create -t plugin --platforms <platforms> .` in this directory.
|
||||
You can also find a detailed instruction on how to add platforms in the `pubspec.yaml` at https://flutter.dev/to/pubspec-plugin-platforms.
|
||||
1. Embed a DriverKit extension whose `IOUserClass` is
|
||||
`DaliMasterEspressifUsbDriver`, or adapt the client service name.
|
||||
2. Add `com.apple.developer.driverkit.communicates-with-drivers` to the app.
|
||||
3. Sign the extension with `com.apple.developer.driverkit` and a
|
||||
`com.apple.developer.driverkit.transport.usb` entitlement approved for its
|
||||
USB vendor ID.
|
||||
4. Enable Swift Package Manager integration for Flutter iOS plugins.
|
||||
|
||||
Call `FlutterUsbSerial.isDriverAvailable()` during startup before showing a USB
|
||||
transport. It returns `true` only when a compatible driver service is loaded.
|
||||
|
||||
The DaliMaster host implementation is deliberately restricted to Espressif
|
||||
vendor ID `0x303A` and the USB Serial/JTAG interface. Serial parameter and modem
|
||||
line methods are accepted for API compatibility; the ESP USB Serial/JTAG bulk
|
||||
transport does not use UART baud or line coding.
|
||||
|
||||
Reference in New Issue
Block a user