1
This commit is contained in:
104
.planning/codebase/STACK.md
Normal file
104
.planning/codebase/STACK.md
Normal file
@@ -0,0 +1,104 @@
|
||||
# Technology Stack
|
||||
|
||||
**Analysis Date:** 2026-04-16
|
||||
|
||||
## Languages
|
||||
|
||||
**Primary:**
|
||||
- **Dart** >=3.4.3 - Flutter plugin Dart-side code (`lib/`, `test/`)
|
||||
- **Java** 8 - Android native plugin implementation (`android/src/main/java/`)
|
||||
|
||||
**Secondary:**
|
||||
- **Kotlin** 1.7.10 - Declared in example app Gradle plugins (`example/android/settings.gradle`) but not actively used in plugin code
|
||||
|
||||
## Runtime
|
||||
|
||||
**Environment:**
|
||||
- **Flutter** >=3.3.0
|
||||
- **Android SDK** - compileSdk 34, minSdk 21
|
||||
|
||||
**Package Manager:**
|
||||
- **pub** (Dart) - Lockfile: `pubspec.lock` present
|
||||
- **Gradle** 7.3.0 - Android build system
|
||||
|
||||
## Frameworks
|
||||
|
||||
**Core:**
|
||||
- **Flutter** >=3.3.0 - Cross-platform plugin framework
|
||||
- **Flutter Plugin API** - `FlutterPlugin`, `MethodCallHandler`, `MethodChannel`, `EventChannel`
|
||||
|
||||
**Testing:**
|
||||
- **flutter_test** (Flutter SDK) - Unit testing framework
|
||||
- **JUnit** 4.13.2 - Android native unit testing
|
||||
- **Mockito** 5.0.0 - Java mocking for Android tests
|
||||
- **integration_test** (Flutter SDK) - Integration testing
|
||||
|
||||
**Build/Dev:**
|
||||
- **flutter_lints** ^3.0.0 - Lint rules
|
||||
- **Gradle** 7.3.0 - Android build automation
|
||||
|
||||
## Key Dependencies
|
||||
|
||||
**Critical:**
|
||||
- **plugin_platform_interface** ^2.0.2 - Federated plugin platform interface pattern (`Ch34Platform` extends `PlatformInterface`)
|
||||
- **CH34XUARTDriver** (local JAR, 140KB) - WCH official UART library, located at `android/libs/CH34XUARTDriver.jar`. Provides `WCHUARTManager`, `ChipType2`, `IDataCallback`, `IModemStatus`, `GPIO_Status` etc.
|
||||
|
||||
**Infrastructure:**
|
||||
- **cupertino_icons** ^1.0.6 - Example app only, Material/Cupertino icon support
|
||||
|
||||
**Android Native Dependencies (WCH SDK):**
|
||||
- `cn.wch.uartlib.WCHUARTManager` - Core manager singleton
|
||||
- `cn.wch.uartlib.chipImpl.type.ChipType2` - Chip type identification
|
||||
- `cn.wch.uartlib.callback.IDataCallback` - Serial data callback interface
|
||||
- `cn.wch.uartlib.callback.IModemStatus` - Modem status callback interface
|
||||
- `cn.wch.uartlib.callback.IUsbStateChange` - USB state change callback
|
||||
- `cn.wch.uartlib.exception.*` - Exception classes (ChipException, NoPermissionException, UartLibException)
|
||||
|
||||
## Configuration
|
||||
|
||||
**Environment:**
|
||||
- `analysis_options.yaml` - Includes `package:flutter_lints/flutter.yaml`
|
||||
- No `.env` or environment variable configuration required
|
||||
- Secrets stored in example `local.properties` (flutter.sdk path)
|
||||
|
||||
**Build:**
|
||||
- `pubspec.yaml` - Main plugin manifest, package: `ch34`, version `1.0.0`
|
||||
- `pubspec.lock` - Dependency lockfile
|
||||
- `android/build.gradle` - Android library build config (namespace: `com.example.ch34`)
|
||||
- `android/settings.gradle` - Project name: `ch34`
|
||||
- `example/android/build.gradle` - Example app root build
|
||||
- `example/android/app/build.gradle` - Example app module (namespace: `com.example.ch34_example`)
|
||||
- `example/android/settings.gradle` - Gradle plugins including dev.flutter.flutter-plugin-loader
|
||||
|
||||
## Platform Requirements
|
||||
|
||||
**Development:**
|
||||
- Flutter SDK >=3.3.0
|
||||
- Dart SDK >=3.4.3
|
||||
- Android SDK compileSdk 34
|
||||
- Java 8+ (sourceCompatibility/targetCompatibility = JavaVersion.VERSION_1_8)
|
||||
|
||||
**Production:**
|
||||
- Android device with USB Host support (`android.hardware.usb.host` feature declared in `android/src/main/AndroidManifest.xml`)
|
||||
- Android minSdk 21 (Android 5.0 Lollipop)
|
||||
- Physical CH34X series USB-to-serial hardware connected via USB OTG
|
||||
|
||||
## Supported Chip Models
|
||||
|
||||
CH340, CH341, CH342, CH343, CH344, CH347, CH9101, CH9102, CH9103, CH9104, CH9143
|
||||
|
||||
## Build System
|
||||
|
||||
**Flutter Plugin:** Standard Flutter plugin structure with Android platform implementation.
|
||||
|
||||
**Communication Pattern:**
|
||||
- `MethodChannel('ch34')` - 33 method calls for device control
|
||||
- `EventChannel('ch34/data')` - Serial data streaming
|
||||
- `EventChannel('ch34/modem')` - Modem status streaming
|
||||
- `EventChannel('ch34/usb_state')` - USB plug/unplug events
|
||||
|
||||
**Architecture Pattern:** Federated plugin with platform interface (`Ch34Platform`), method channel implementation (`MethodChannelCh34`), and manager facade (`Ch34Manager`).
|
||||
|
||||
---
|
||||
|
||||
*Stack analysis: 2026-04-16*
|
||||
Reference in New Issue
Block a user