feat: migrate AT/SysEx protocol from Dart to Rust FFI#38
Merged
Conversation
Replace hand-written Dart AT command encoding/parsing and SysEx framing with FFI calls to the hexaTuneProto Rust library (v0.1.0). - Add lib/src/core/proto/ with FFI-backed ATCommand, ATResponse, ProtoService singleton, and Dart FFI binding - Bundle native libraries: Android .so (3 ABIs) + iOS xcframework - Update device.dart, device_service.dart, layout.dart imports - Replace SysEx.extractSysexPayload() + parseATResponse() with extractAndParseATResponse() using FFI pipeline - Delete old lib/src/core/at/at.dart and lib/src/core/sysex/sysex.dart - Add ffi ^2.1.0 dependency to pubspec.yaml Public API (ATCommand factories, ATResponse getters) is unchanged — no modifications needed in UI or service layer method signatures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add org.gradle.java.home=/usr/lib/jvm/java-21-openjdk to gradle.properties (system default JDK 25 is not supported by Gradle 8.12) - Update desugar_jdk_libs from 2.0.4 to 2.1.4 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate AT command encoding/parsing and SysEx framing from pure Dart implementation to Rust FFI via
hexaTuneProtoshared library (Option A: Pure FFI from PLANS.md).Changes
New Files
lib/src/core/proto/hexa_tune_proto_ffi.dart— Dart FFI binding (from hexaTuneProto v0.1.0)lib/src/core/proto/proto_service.dart— Singleton native library loader (Android .so / iOS static)lib/src/core/proto/at_command.dart— FFI-backed ATCommand (drop-in replacement)lib/src/core/proto/at_response.dart— FFI-backed ATResponse + parseATResponse() + extractAndParseATResponse()android/app/src/main/jniLibs/{arm64-v8a,armeabi-v7a,x86_64}/libhexa_tune_proto_ffi.so— Android native libsios/Frameworks/HexaTuneProto.xcframework/— iOS frameworkModified Files
pubspec.yaml— Addedffi: ^2.1.0lib/src/core/device/device.dart— Updated imports, replaced SysEx+AT parsing with FFIlib/src/core/service/device_service.dart— Updated importslib/src/pages/layout.dart— Updated importsandroid/gradle.properties— Set JDK 21 for Gradle (system JDK 25 incompatible)android/app/build.gradle.kts— Updated desugar_jdk_libs 2.0.4 → 2.1.4Deleted Files
lib/src/core/at/at.dart— Old Dart AT implementation (255 lines)lib/src/core/sysex/sysex.dart— Old Dart SysEx implementation (161 lines)Testing
flutter analyze— 0 errors