diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..6dd053e --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,83 @@ +# Drone Mission Control (DMC) + +Mobile App zur Missionsplanung und Flugsteuerung für einen Fixed-Wing-Drohnen-Aufbau +(Heewing T1 Ranger, iNAV-Firmware). Wegpunkt-Missionen, Live-Fly-Modus, Point-and-Fly +(PnF)-Einzelziel-Anflug. + +**Vollständige Architektur- und Design-Entscheidungen:** [DMC_Architektur_und_Design.md](DMC_Architektur_und_Design.md) +— vor jeder größeren Änderung lesen, insbesondere Abschnitt 4 (Entscheidungen inkl. +Begründung), Abschnitt 5 (verworfene Alternativen) und Abschnitt 6 (offene Fragen). + +## Sprachregelung + +Konversation und Dokumentation auf Deutsch, Code und UI-Texte auf Englisch. + +## Projektstruktur + +- `Drone Mission Control.html` — lauffähiger Vanilla-JS/Leaflet-Demonstrator, dient als + Referenz für UI-Verhalten und bereits gelöste Probleme (Wind-Interpolation, + Terrain-Sampling, Fillet-Geometrie, swipe-adjustierbare Wegpunkt-Chips, ...). Bei + Unklarheiten über gewünschtes Verhalten zuerst hier nachsehen, bevor neu entschieden + wird. +- `design/` — Logo-Assets (SVG-Varianten) und Icon-Sketches. Aktuell verwendetes + App-Icon: `design/Y2_pink_dark.svg`. +- `app/` — Flutter-Zielarchitektur (Einzelpaket, kein Melos-Monorepo). Siehe unten. +- `test/` — Altlast/Sandbox, nicht Teil der aktiven Entwicklung. + +## Flutter-App (`app/`) + +Fünf-Schichten-Architektur (Doku Abschnitt 2): + +``` +lib/ + ui/ Screens (plan, fly, settings, library) + geteilte Widgets + app_mode/ App-Mode State Machine (Plan → Connect → Upload → Fly) + domain/ Mission-Domain-Layer (Strategy Pattern: TrackMission, ...) + + protokollneutrale FlatWaypointList + services/ MissionSyncService, TelemetryService, Drift-Datenbank + transport/ FlightControllerLink-Abstraktion (msp/, mavlink/, mock/) +``` + +**MVP-Scope (Doku 4.1):** nur Android, nur iNAV via MSP, nur WiFi/TCP. MAVLink, +USB-Seriell und iOS sind bewusst zurückgestellt. + +**Kernprinzip:** Die Domain-Schicht kennt nur `FlatWaypointList`, protokollneutral. +Divergenz zu MSP/MAVLink findet ausschließlich im Encoder statt. `FlightControllerLink` +ist die zentrale Abstraktion; `MockFlightControllerLink` erlaubt UI-Arbeit ohne +Hardware. `MspFlightControllerLink` ist aktuell nur ein Gerüst (`UnimplementedError`) +— die eigentliche MSP-Protokoll-Implementierung (Framing, `MSP_SET_WP`, +`MSP_NAV_STATUS`) ist noch offen. + +**Ready-to-Fly-Gate (Doku 2.2/4.5):** Upload + verifiziert + disarmed. Wird in +`AppModeCubit.toFly()` technisch erzwungen (wirft `StateError`), nicht nur als +UI-Konvention behandelt. + +**Persistenz:** Drift (SQLite), nicht Hive — siehe Begründung 4.15. Schema in +`lib/services/database/app_database.dart`. Nach Schema-Änderungen: +``` +dart run build_runner build +``` +(im `app/`-Verzeichnis; `--delete-conflicting-outputs` wird von der installierten +build_runner-Version ignoriert und ist nicht nötig). + +**Entschiedene Pakete** (siehe Doku Abschnitt 8): `flutter_map` + `flutter_map_tile_caching` +(nicht `google_maps_flutter`), `drift`, `flutter_bloc` + `flutter_riverpod` (kombiniert: +Bloc für die App-Mode State Machine, Riverpod für reaktive Einzelwerte wie Telemetrie), +`go_router`. + +**Noch nicht umgesetzt / bewusst zurückgestellt:** +- Eigener MSP-Encoder/Decoder in Dart (4.19) — kein fertiges Paket verfügbar. +- Telemetrie-Verarbeitung in eigenem Isolate (4.21) — erst sinnvoll mit echtem + Protokoll-Adapter zu verifizieren. +- `SurveyAreaMission`/`SearchAreaMission` (Strategy-Pattern vorgesehen, Details offen). +- Foreground Service (Android) für Hintergrund-Telemetrie (4.20). +- `flutter_launcher_icons` ist konfiguriert für Android; iOS ist aus MVP-Gründen + deaktiviert (`ios: false` in der `flutter_launcher_icons`-Sektion der `pubspec.yaml`). + +## Verifikation nach Änderungen + +Im `app/`-Verzeichnis: +``` +flutter analyze +flutter test +``` diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..3820a95 --- /dev/null +++ b/app/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ +/coverage/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/app/.metadata b/app/.metadata new file mode 100644 index 0000000..d312f63 --- /dev/null +++ b/app/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "058e0af2c2b57e369d905a03ac9748b0ebf543c6" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 058e0af2c2b57e369d905a03ac9748b0ebf543c6 + base_revision: 058e0af2c2b57e369d905a03ac9748b0ebf543c6 + - platform: android + create_revision: 058e0af2c2b57e369d905a03ac9748b0ebf543c6 + base_revision: 058e0af2c2b57e369d905a03ac9748b0ebf543c6 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/app/README.md b/app/README.md new file mode 100644 index 0000000..b4885b7 --- /dev/null +++ b/app/README.md @@ -0,0 +1,17 @@ +# dmc_app + +Drone Mission Control - Missionsplanung und Flugsteuerung f\u00fcr Fixed-Wing-Drohnen + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Learn Flutter](https://docs.flutter.dev/get-started/learn-flutter) +- [Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Flutter learning resources](https://docs.flutter.dev/reference/learning-resources) + +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. diff --git a/app/analysis_options.yaml b/app/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/app/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/app/android/.gitignore b/app/android/.gitignore new file mode 100644 index 0000000..be3943c --- /dev/null +++ b/app/android/.gitignore @@ -0,0 +1,14 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java +.cxx/ + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/app/android/app/build.gradle.kts b/app/android/app/build.gradle.kts new file mode 100644 index 0000000..89f0886 --- /dev/null +++ b/app/android/app/build.gradle.kts @@ -0,0 +1,45 @@ +plugins { + id("com.android.application") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.dmc.dmc_app" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.dmc.dmc_app" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + } + } +} + +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + } +} + +flutter { + source = "../.." +} diff --git a/app/android/app/src/debug/AndroidManifest.xml b/app/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/app/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/app/android/app/src/main/AndroidManifest.xml b/app/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..74403a7 --- /dev/null +++ b/app/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/app/android/app/src/main/kotlin/com/dmc/dmc_app/MainActivity.kt b/app/android/app/src/main/kotlin/com/dmc/dmc_app/MainActivity.kt new file mode 100644 index 0000000..e0a086d --- /dev/null +++ b/app/android/app/src/main/kotlin/com/dmc/dmc_app/MainActivity.kt @@ -0,0 +1,5 @@ +package com.dmc.dmc_app + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/app/android/app/src/main/res/drawable-v21/launch_background.xml b/app/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/app/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/app/android/app/src/main/res/drawable/launch_background.xml b/app/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/app/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..fc4b0ae Binary files /dev/null and b/app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..f2230fd Binary files /dev/null and b/app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..afa694d Binary files /dev/null and b/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..af09890 Binary files /dev/null and b/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..8045f1c Binary files /dev/null and b/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/android/app/src/main/res/values-night/styles.xml b/app/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/app/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/app/android/app/src/main/res/values/styles.xml b/app/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/app/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/app/android/app/src/profile/AndroidManifest.xml b/app/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/app/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/app/android/build.gradle.kts b/app/android/build.gradle.kts new file mode 100644 index 0000000..dbee657 --- /dev/null +++ b/app/android/build.gradle.kts @@ -0,0 +1,24 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/app/android/gradle.properties b/app/android/gradle.properties new file mode 100644 index 0000000..e96108c --- /dev/null +++ b/app/android/gradle.properties @@ -0,0 +1,6 @@ +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +# This newDsl flag was added by the Flutter template +android.newDsl=false +# This builtInKotlin flag was added by the Flutter template +android.builtInKotlin=false diff --git a/app/android/gradle/wrapper/gradle-wrapper.properties b/app/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..2d428bf --- /dev/null +++ b/app/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip diff --git a/app/android/settings.gradle.kts b/app/android/settings.gradle.kts new file mode 100644 index 0000000..c21f0c5 --- /dev/null +++ b/app/android/settings.gradle.kts @@ -0,0 +1,26 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "9.0.1" apply false + id("org.jetbrains.kotlin.android") version "2.3.20" apply false +} + +include(":app") diff --git a/app/assets/icon/icon.png b/app/assets/icon/icon.png new file mode 100644 index 0000000..27a3faf Binary files /dev/null and b/app/assets/icon/icon.png differ diff --git a/app/lib/app_mode/app_mode_cubit.dart b/app/lib/app_mode/app_mode_cubit.dart new file mode 100644 index 0000000..a37c4db --- /dev/null +++ b/app/lib/app_mode/app_mode_cubit.dart @@ -0,0 +1,65 @@ +import 'package:flutter_bloc/flutter_bloc.dart'; + +/// Explizite Zustandsfolge Plan -> Connect -> Upload -> Fly +/// (Architektur-Doku 2.2). +enum AppMode { plan, connect, upload, fly } + +class AppModeState { + const AppModeState({ + this.mode = AppMode.plan, + this.missionUploaded = false, + this.missionVerified = false, + this.droneArmed = false, + }); + + final AppMode mode; + final bool missionUploaded; + final bool missionVerified; + final bool droneArmed; + + /// Ready-to-Fly-Gate (Doku 2.2 / 4.5): Upload + verifiziert + disarmed. + /// Muss technisch erzwungen werden, nicht nur als UI-Konvention gelten. + bool get readyToFly => missionUploaded && missionVerified && !droneArmed; + + AppModeState copyWith({ + AppMode? mode, + bool? missionUploaded, + bool? missionVerified, + bool? droneArmed, + }) { + return AppModeState( + mode: mode ?? this.mode, + missionUploaded: missionUploaded ?? this.missionUploaded, + missionVerified: missionVerified ?? this.missionVerified, + droneArmed: droneArmed ?? this.droneArmed, + ); + } +} + +class AppModeCubit extends Cubit { + AppModeCubit() : super(const AppModeState()); + + void toConnect() => emit(state.copyWith(mode: AppMode.connect)); + + void toUpload() => emit(state.copyWith(mode: AppMode.upload)); + + void missionUploadConfirmed() => + emit(state.copyWith(missionUploaded: true)); + + void missionVerifiedConfirmed() => + emit(state.copyWith(missionVerified: true)); + + void droneArmedChanged(bool armed) => + emit(state.copyWith(droneArmed: armed)); + + /// Wirft, wenn das Ready-to-Fly-Gate nicht erfuellt ist (Doku 4.5). + void toFly() { + if (!state.readyToFly) { + throw StateError('Ready-to-Fly-Gate nicht erfuellt.'); + } + emit(state.copyWith(mode: AppMode.fly)); + } + + /// Verlassen des Fly-Modus setzt den kompletten Handover-Status zurueck. + void toPlan() => emit(const AppModeState()); +} diff --git a/app/lib/domain/mission/mission.dart b/app/lib/domain/mission/mission.dart new file mode 100644 index 0000000..97ff75d --- /dev/null +++ b/app/lib/domain/mission/mission.dart @@ -0,0 +1,24 @@ +import '../waypoint/flat_waypoint_list.dart'; + +/// Strategy-Pattern fuer erweiterbare Missionstypen (Architektur-Doku 3.2). +abstract class Mission { + String get name; + + FlatWaypointList toFlatWaypointList(); +} + +/// Wegpunkt-Streckenmission - aktuell einziger implementierter Missionstyp. +class TrackMission implements Mission { + const TrackMission({required this.name, required this.waypoints}); + + @override + final String name; + + final List waypoints; + + @override + FlatWaypointList toFlatWaypointList() => FlatWaypointList(waypoints); +} + +// SurveyAreaMission (Flaechenabflug) und SearchAreaMission (Suchmuster) sind +// im Strategy-Pattern vorgesehen, aber noch nicht spezifiziert (Doku 6). diff --git a/app/lib/domain/waypoint/flat_waypoint_list.dart b/app/lib/domain/waypoint/flat_waypoint_list.dart new file mode 100644 index 0000000..19efd06 --- /dev/null +++ b/app/lib/domain/waypoint/flat_waypoint_list.dart @@ -0,0 +1,61 @@ +/// Protokollneutrales Wegpunkt-Modell (Architektur-Doku 3.2). +/// Divergenz zu MSP/MAVLink findet ausschliesslich im Encoder-Schritt statt +/// (MspWaypointEncoder / MavlinkMissionEncoder), nicht in diesem Modell. +library; + +enum WaypointAction { none, loiter, landing, jump } + +class Waypoint { + const Waypoint({ + required this.lat, + required this.lon, + required this.altitudeM, + required this.speedMs, + required this.catchRadiusM, + this.action = WaypointAction.none, + this.jumpTargetIndex, + this.jumpRepeatCount, + }); + + final double lat; + final double lon; + final double altitudeM; + final double speedMs; + final double catchRadiusM; + final WaypointAction action; + + /// Nur bei action == jump gesetzt (iNAV Action-Code 6, Doku 7.1). + final int? jumpTargetIndex; + + /// Nur bei action == jump gesetzt; null bedeutet Endlos-Wiederholung. + final int? jumpRepeatCount; + + Waypoint copyWith({ + double? lat, + double? lon, + double? altitudeM, + double? speedMs, + double? catchRadiusM, + WaypointAction? action, + int? jumpTargetIndex, + int? jumpRepeatCount, + }) { + return Waypoint( + lat: lat ?? this.lat, + lon: lon ?? this.lon, + altitudeM: altitudeM ?? this.altitudeM, + speedMs: speedMs ?? this.speedMs, + catchRadiusM: catchRadiusM ?? this.catchRadiusM, + action: action ?? this.action, + jumpTargetIndex: jumpTargetIndex ?? this.jumpTargetIndex, + jumpRepeatCount: jumpRepeatCount ?? this.jumpRepeatCount, + ); + } +} + +/// Gemeinsame, protokollunabhaengige Datenstruktur aller Missionstypen. +class FlatWaypointList { + const FlatWaypointList(this.waypoints); + + final List waypoints; +} diff --git a/app/lib/main.dart b/app/lib/main.dart new file mode 100644 index 0000000..fd1dc32 --- /dev/null +++ b/app/lib/main.dart @@ -0,0 +1,55 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; + +import 'app_mode/app_mode_cubit.dart'; +import 'ui/app_shell.dart'; +import 'ui/dmc_colors.dart'; +import 'ui/screens/library/library_screen.dart'; +import 'ui/screens/settings/settings_screen.dart'; + +void main() { + runApp(const DmcApp()); +} + +final _router = GoRouter( + routes: [ + GoRoute(path: '/', builder: (context, state) => const AppShell()), + GoRoute( + path: '/settings', + builder: (context, state) => const SettingsScreen(), + ), + GoRoute( + path: '/library', + builder: (context, state) => const LibraryScreen(), + ), + ], +); + +class DmcApp extends StatelessWidget { + const DmcApp({super.key}); + + @override + Widget build(BuildContext context) { + return ProviderScope( + child: BlocProvider( + create: (_) => AppModeCubit(), + child: MaterialApp.router( + title: 'Drone Mission Control', + debugShowCheckedModeBanner: false, + theme: ThemeData( + useMaterial3: true, + brightness: Brightness.dark, + scaffoldBackgroundColor: const Color(0xFF0F0F0F), + colorScheme: ColorScheme.fromSeed( + seedColor: DmcColors.setBlue, + brightness: Brightness.dark, + ), + ), + routerConfig: _router, + ), + ), + ); + } +} diff --git a/app/lib/services/database/app_database.dart b/app/lib/services/database/app_database.dart new file mode 100644 index 0000000..96874ce --- /dev/null +++ b/app/lib/services/database/app_database.dart @@ -0,0 +1,39 @@ +import 'dart:io'; + +import 'package:drift/drift.dart'; +import 'package:drift/native.dart'; +import 'package:path/path.dart' as p; +import 'package:path_provider/path_provider.dart'; + +part 'app_database.g.dart'; + +/// Persistenz fuer Missionen (Architektur-Doku 4.15): Drift statt Hive, weil +/// indexierte Abfragen (Suche nach Name/Ort/Datum) benoetigt werden und das +/// Schema kompatibel zu einem kuenftigen lokal-first Server-Sync-Muster +/// (Dirty-Flags, Server-IDs) bleiben soll. +class Missions extends Table { + IntColumn get id => integer().autoIncrement()(); + TextColumn get name => text()(); + TextColumn get location => text().nullable()(); + DateTimeColumn get createdAt => + dateTime().withDefault(currentDateAndTime)(); + TextColumn get waypointsJson => text()(); + BoolColumn get isDirty => boolean().withDefault(const Constant(true))(); + TextColumn get serverId => text().nullable()(); +} + +@DriftDatabase(tables: [Missions]) +class AppDatabase extends _$AppDatabase { + AppDatabase() : super(_openConnection()); + + @override + int get schemaVersion => 1; + + static LazyDatabase _openConnection() { + return LazyDatabase(() async { + final dbFolder = await getApplicationDocumentsDirectory(); + final file = File(p.join(dbFolder.path, 'dmc_missions.sqlite')); + return NativeDatabase.createInBackground(file); + }); + } +} diff --git a/app/lib/services/database/app_database.g.dart b/app/lib/services/database/app_database.g.dart new file mode 100644 index 0000000..fb01165 --- /dev/null +++ b/app/lib/services/database/app_database.g.dart @@ -0,0 +1,708 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'app_database.dart'; + +// ignore_for_file: type=lint +class $MissionsTable extends Missions with TableInfo<$MissionsTable, Mission> { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + $MissionsTable(this.attachedDatabase, [this._alias]); + static const VerificationMeta _idMeta = const VerificationMeta('id'); + @override + late final GeneratedColumn id = GeneratedColumn( + 'id', + aliasedName, + false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); + static const VerificationMeta _nameMeta = const VerificationMeta('name'); + @override + late final GeneratedColumn name = GeneratedColumn( + 'name', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _locationMeta = const VerificationMeta( + 'location', + ); + @override + late final GeneratedColumn location = GeneratedColumn( + 'location', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + static const VerificationMeta _createdAtMeta = const VerificationMeta( + 'createdAt', + ); + @override + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + static const VerificationMeta _waypointsJsonMeta = const VerificationMeta( + 'waypointsJson', + ); + @override + late final GeneratedColumn waypointsJson = GeneratedColumn( + 'waypoints_json', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _isDirtyMeta = const VerificationMeta( + 'isDirty', + ); + @override + late final GeneratedColumn isDirty = GeneratedColumn( + 'is_dirty', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_dirty" IN (0, 1))', + ), + defaultValue: const Constant(true), + ); + static const VerificationMeta _serverIdMeta = const VerificationMeta( + 'serverId', + ); + @override + late final GeneratedColumn serverId = GeneratedColumn( + 'server_id', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + @override + List get $columns => [ + id, + name, + location, + createdAt, + waypointsJson, + isDirty, + serverId, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'missions'; + @override + VerificationContext validateIntegrity( + Insertable instance, { + bool isInserting = false, + }) { + final context = VerificationContext(); + final data = instance.toColumns(true); + if (data.containsKey('id')) { + context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); + } + if (data.containsKey('name')) { + context.handle( + _nameMeta, + name.isAcceptableOrUnknown(data['name']!, _nameMeta), + ); + } else if (isInserting) { + context.missing(_nameMeta); + } + if (data.containsKey('location')) { + context.handle( + _locationMeta, + location.isAcceptableOrUnknown(data['location']!, _locationMeta), + ); + } + if (data.containsKey('created_at')) { + context.handle( + _createdAtMeta, + createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta), + ); + } + if (data.containsKey('waypoints_json')) { + context.handle( + _waypointsJsonMeta, + waypointsJson.isAcceptableOrUnknown( + data['waypoints_json']!, + _waypointsJsonMeta, + ), + ); + } else if (isInserting) { + context.missing(_waypointsJsonMeta); + } + if (data.containsKey('is_dirty')) { + context.handle( + _isDirtyMeta, + isDirty.isAcceptableOrUnknown(data['is_dirty']!, _isDirtyMeta), + ); + } + if (data.containsKey('server_id')) { + context.handle( + _serverIdMeta, + serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta), + ); + } + return context; + } + + @override + Set get $primaryKey => {id}; + @override + Mission map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return Mission( + id: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}id'], + )!, + name: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}name'], + )!, + location: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}location'], + ), + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + waypointsJson: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}waypoints_json'], + )!, + isDirty: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}is_dirty'], + )!, + serverId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}server_id'], + ), + ); + } + + @override + $MissionsTable createAlias(String alias) { + return $MissionsTable(attachedDatabase, alias); + } +} + +class Mission extends DataClass implements Insertable { + final int id; + final String name; + final String? location; + final DateTime createdAt; + final String waypointsJson; + final bool isDirty; + final String? serverId; + const Mission({ + required this.id, + required this.name, + this.location, + required this.createdAt, + required this.waypointsJson, + required this.isDirty, + this.serverId, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['name'] = Variable(name); + if (!nullToAbsent || location != null) { + map['location'] = Variable(location); + } + map['created_at'] = Variable(createdAt); + map['waypoints_json'] = Variable(waypointsJson); + map['is_dirty'] = Variable(isDirty); + if (!nullToAbsent || serverId != null) { + map['server_id'] = Variable(serverId); + } + return map; + } + + MissionsCompanion toCompanion(bool nullToAbsent) { + return MissionsCompanion( + id: Value(id), + name: Value(name), + location: location == null && nullToAbsent + ? const Value.absent() + : Value(location), + createdAt: Value(createdAt), + waypointsJson: Value(waypointsJson), + isDirty: Value(isDirty), + serverId: serverId == null && nullToAbsent + ? const Value.absent() + : Value(serverId), + ); + } + + factory Mission.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return Mission( + id: serializer.fromJson(json['id']), + name: serializer.fromJson(json['name']), + location: serializer.fromJson(json['location']), + createdAt: serializer.fromJson(json['createdAt']), + waypointsJson: serializer.fromJson(json['waypointsJson']), + isDirty: serializer.fromJson(json['isDirty']), + serverId: serializer.fromJson(json['serverId']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'name': serializer.toJson(name), + 'location': serializer.toJson(location), + 'createdAt': serializer.toJson(createdAt), + 'waypointsJson': serializer.toJson(waypointsJson), + 'isDirty': serializer.toJson(isDirty), + 'serverId': serializer.toJson(serverId), + }; + } + + Mission copyWith({ + int? id, + String? name, + Value location = const Value.absent(), + DateTime? createdAt, + String? waypointsJson, + bool? isDirty, + Value serverId = const Value.absent(), + }) => Mission( + id: id ?? this.id, + name: name ?? this.name, + location: location.present ? location.value : this.location, + createdAt: createdAt ?? this.createdAt, + waypointsJson: waypointsJson ?? this.waypointsJson, + isDirty: isDirty ?? this.isDirty, + serverId: serverId.present ? serverId.value : this.serverId, + ); + Mission copyWithCompanion(MissionsCompanion data) { + return Mission( + id: data.id.present ? data.id.value : this.id, + name: data.name.present ? data.name.value : this.name, + location: data.location.present ? data.location.value : this.location, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + waypointsJson: data.waypointsJson.present + ? data.waypointsJson.value + : this.waypointsJson, + isDirty: data.isDirty.present ? data.isDirty.value : this.isDirty, + serverId: data.serverId.present ? data.serverId.value : this.serverId, + ); + } + + @override + String toString() { + return (StringBuffer('Mission(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('location: $location, ') + ..write('createdAt: $createdAt, ') + ..write('waypointsJson: $waypointsJson, ') + ..write('isDirty: $isDirty, ') + ..write('serverId: $serverId') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + name, + location, + createdAt, + waypointsJson, + isDirty, + serverId, + ); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is Mission && + other.id == this.id && + other.name == this.name && + other.location == this.location && + other.createdAt == this.createdAt && + other.waypointsJson == this.waypointsJson && + other.isDirty == this.isDirty && + other.serverId == this.serverId); +} + +class MissionsCompanion extends UpdateCompanion { + final Value id; + final Value name; + final Value location; + final Value createdAt; + final Value waypointsJson; + final Value isDirty; + final Value serverId; + const MissionsCompanion({ + this.id = const Value.absent(), + this.name = const Value.absent(), + this.location = const Value.absent(), + this.createdAt = const Value.absent(), + this.waypointsJson = const Value.absent(), + this.isDirty = const Value.absent(), + this.serverId = const Value.absent(), + }); + MissionsCompanion.insert({ + this.id = const Value.absent(), + required String name, + this.location = const Value.absent(), + this.createdAt = const Value.absent(), + required String waypointsJson, + this.isDirty = const Value.absent(), + this.serverId = const Value.absent(), + }) : name = Value(name), + waypointsJson = Value(waypointsJson); + static Insertable custom({ + Expression? id, + Expression? name, + Expression? location, + Expression? createdAt, + Expression? waypointsJson, + Expression? isDirty, + Expression? serverId, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (name != null) 'name': name, + if (location != null) 'location': location, + if (createdAt != null) 'created_at': createdAt, + if (waypointsJson != null) 'waypoints_json': waypointsJson, + if (isDirty != null) 'is_dirty': isDirty, + if (serverId != null) 'server_id': serverId, + }); + } + + MissionsCompanion copyWith({ + Value? id, + Value? name, + Value? location, + Value? createdAt, + Value? waypointsJson, + Value? isDirty, + Value? serverId, + }) { + return MissionsCompanion( + id: id ?? this.id, + name: name ?? this.name, + location: location ?? this.location, + createdAt: createdAt ?? this.createdAt, + waypointsJson: waypointsJson ?? this.waypointsJson, + isDirty: isDirty ?? this.isDirty, + serverId: serverId ?? this.serverId, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (name.present) { + map['name'] = Variable(name.value); + } + if (location.present) { + map['location'] = Variable(location.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (waypointsJson.present) { + map['waypoints_json'] = Variable(waypointsJson.value); + } + if (isDirty.present) { + map['is_dirty'] = Variable(isDirty.value); + } + if (serverId.present) { + map['server_id'] = Variable(serverId.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MissionsCompanion(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('location: $location, ') + ..write('createdAt: $createdAt, ') + ..write('waypointsJson: $waypointsJson, ') + ..write('isDirty: $isDirty, ') + ..write('serverId: $serverId') + ..write(')')) + .toString(); + } +} + +abstract class _$AppDatabase extends GeneratedDatabase { + _$AppDatabase(QueryExecutor e) : super(e); + $AppDatabaseManager get managers => $AppDatabaseManager(this); + late final $MissionsTable missions = $MissionsTable(this); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [missions]; +} + +typedef $$MissionsTableCreateCompanionBuilder = + MissionsCompanion Function({ + Value id, + required String name, + Value location, + Value createdAt, + required String waypointsJson, + Value isDirty, + Value serverId, + }); +typedef $$MissionsTableUpdateCompanionBuilder = + MissionsCompanion Function({ + Value id, + Value name, + Value location, + Value createdAt, + Value waypointsJson, + Value isDirty, + Value serverId, + }); + +class $$MissionsTableFilterComposer + extends Composer<_$AppDatabase, $MissionsTable> { + $$MissionsTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get name => $composableBuilder( + column: $table.name, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get location => $composableBuilder( + column: $table.location, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get waypointsJson => $composableBuilder( + column: $table.waypointsJson, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get isDirty => $composableBuilder( + column: $table.isDirty, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get serverId => $composableBuilder( + column: $table.serverId, + builder: (column) => ColumnFilters(column), + ); +} + +class $$MissionsTableOrderingComposer + extends Composer<_$AppDatabase, $MissionsTable> { + $$MissionsTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get name => $composableBuilder( + column: $table.name, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get location => $composableBuilder( + column: $table.location, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get waypointsJson => $composableBuilder( + column: $table.waypointsJson, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get isDirty => $composableBuilder( + column: $table.isDirty, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get serverId => $composableBuilder( + column: $table.serverId, + builder: (column) => ColumnOrderings(column), + ); +} + +class $$MissionsTableAnnotationComposer + extends Composer<_$AppDatabase, $MissionsTable> { + $$MissionsTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get name => + $composableBuilder(column: $table.name, builder: (column) => column); + + GeneratedColumn get location => + $composableBuilder(column: $table.location, builder: (column) => column); + + GeneratedColumn get createdAt => + $composableBuilder(column: $table.createdAt, builder: (column) => column); + + GeneratedColumn get waypointsJson => $composableBuilder( + column: $table.waypointsJson, + builder: (column) => column, + ); + + GeneratedColumn get isDirty => + $composableBuilder(column: $table.isDirty, builder: (column) => column); + + GeneratedColumn get serverId => + $composableBuilder(column: $table.serverId, builder: (column) => column); +} + +class $$MissionsTableTableManager + extends + RootTableManager< + _$AppDatabase, + $MissionsTable, + Mission, + $$MissionsTableFilterComposer, + $$MissionsTableOrderingComposer, + $$MissionsTableAnnotationComposer, + $$MissionsTableCreateCompanionBuilder, + $$MissionsTableUpdateCompanionBuilder, + (Mission, BaseReferences<_$AppDatabase, $MissionsTable, Mission>), + Mission, + PrefetchHooks Function() + > { + $$MissionsTableTableManager(_$AppDatabase db, $MissionsTable table) + : super( + TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + $$MissionsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$MissionsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$MissionsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: + ({ + Value id = const Value.absent(), + Value name = const Value.absent(), + Value location = const Value.absent(), + Value createdAt = const Value.absent(), + Value waypointsJson = const Value.absent(), + Value isDirty = const Value.absent(), + Value serverId = const Value.absent(), + }) => MissionsCompanion( + id: id, + name: name, + location: location, + createdAt: createdAt, + waypointsJson: waypointsJson, + isDirty: isDirty, + serverId: serverId, + ), + createCompanionCallback: + ({ + Value id = const Value.absent(), + required String name, + Value location = const Value.absent(), + Value createdAt = const Value.absent(), + required String waypointsJson, + Value isDirty = const Value.absent(), + Value serverId = const Value.absent(), + }) => MissionsCompanion.insert( + id: id, + name: name, + location: location, + createdAt: createdAt, + waypointsJson: waypointsJson, + isDirty: isDirty, + serverId: serverId, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + ), + ); +} + +typedef $$MissionsTableProcessedTableManager = + ProcessedTableManager< + _$AppDatabase, + $MissionsTable, + Mission, + $$MissionsTableFilterComposer, + $$MissionsTableOrderingComposer, + $$MissionsTableAnnotationComposer, + $$MissionsTableCreateCompanionBuilder, + $$MissionsTableUpdateCompanionBuilder, + (Mission, BaseReferences<_$AppDatabase, $MissionsTable, Mission>), + Mission, + PrefetchHooks Function() + >; + +class $AppDatabaseManager { + final _$AppDatabase _db; + $AppDatabaseManager(this._db); + $$MissionsTableTableManager get missions => + $$MissionsTableTableManager(_db, _db.missions); +} diff --git a/app/lib/services/mission_sync_service.dart b/app/lib/services/mission_sync_service.dart new file mode 100644 index 0000000..b4b0cc0 --- /dev/null +++ b/app/lib/services/mission_sync_service.dart @@ -0,0 +1,26 @@ +import '../app_mode/app_mode_cubit.dart'; +import '../domain/waypoint/flat_waypoint_list.dart'; +import '../transport/flight_controller_link.dart'; + +/// Orchestriert Connect -> Verify -> Upload -> Ready-to-Fly und erzwingt das +/// Ready-to-Fly-Gate (Architektur-Doku 3.3 / 4.5). +class MissionSyncService { + MissionSyncService(this._link, this._appMode); + + final FlightControllerLink _link; + final AppModeCubit _appMode; + + Future syncAndUpload(FlatWaypointList mission) async { + await _link.connect(); + // uploadMission() der jeweiligen FlightControllerLink-Implementierung + // verweigert den Upload selbst, falls die Drohne armed ist (Doku 4.5) - + // dieser Service verlaesst sich bewusst nicht zusaetzlich auf einen + // eigenen Telemetrie-Vorab-Check, um keine zwei Wahrheitsquellen zu haben. + await _link.uploadMission(mission); + _appMode.missionUploadConfirmed(); + + // TODO: echte Verifikation gegen FC-Rueckmeldung, sobald ein + // Protokoll-Adapter (MSP/MAVLink) eine Upload-Bestaetigung liefert. + _appMode.missionVerifiedConfirmed(); + } +} diff --git a/app/lib/services/telemetry_service.dart b/app/lib/services/telemetry_service.dart new file mode 100644 index 0000000..b23a6bf --- /dev/null +++ b/app/lib/services/telemetry_service.dart @@ -0,0 +1,15 @@ +import '../transport/flight_controller_link.dart'; + +/// Abonniert Live-Telemetrie vom FC und reicht normalisierte Frames an die +/// UI weiter (Architektur-Doku 3.4). +/// +/// Laeuft im MVP noch synchron auf dem UI-Isolate. Die Auslagerung in ein +/// eigenes Dart-Isolate (Doku 4.21) ist erst sinnvoll zu verifizieren, sobald +/// ein echter Protokoll-Adapter reale Telemetrie-Raten liefert. +class TelemetryService { + TelemetryService(this._link); + + final FlightControllerLink _link; + + Stream get frames => _link.subscribeTelemetry(); +} diff --git a/app/lib/transport/flight_controller_link.dart b/app/lib/transport/flight_controller_link.dart new file mode 100644 index 0000000..d121bdc --- /dev/null +++ b/app/lib/transport/flight_controller_link.dart @@ -0,0 +1,57 @@ +import '../domain/waypoint/flat_waypoint_list.dart'; + +/// Abstrakte Flugmodi, protokollunabhaengig (Architektur-Doku 3.1). +enum FlightMode { missionRun, guidedPoint, returnHome, hold } + +/// Feature-Flags des angebundenen Flightcontrollers (Doku 3.1). +class FcCapabilities { + const FcCapabilities({ + required this.supportsMultiMission, + required this.supportsInFlightUpload, + required this.maxWaypoints, + }); + + final bool supportsMultiMission; + final bool supportsInFlightUpload; + final int maxWaypoints; +} + +/// Normalisiertes Telemetrie-Frame, das an die UI weitergereicht wird (Doku 3.4). +class TelemetryFrame { + const TelemetryFrame({ + required this.lat, + required this.lon, + required this.altitudeM, + required this.speedMs, + required this.armed, + this.activeWaypointIndex, + }); + + final double lat; + final double lon; + final double altitudeM; + final double speedMs; + final bool armed; + final int? activeWaypointIndex; +} + +/// Zentrale Abstraktion fuer alle Flightcontroller-Interaktionen (Doku 3.1). +/// Implementierungen: MspFlightControllerLink (iNAV), MavlinkFlightControllerLink +/// (ArduPilot, Post-MVP), MockFlightControllerLink (Tests ohne Hardware). +abstract class FlightControllerLink { + FcCapabilities get capabilities; + + Future connect(); + + Future disconnect(); + + Future uploadMission(FlatWaypointList mission); + + Future setFlightMode(FlightMode mode); + + Future arm(); + + Stream subscribeTelemetry(); + + Future readActiveWaypointIndex(); +} diff --git a/app/lib/transport/mock/mock_flight_controller_link.dart b/app/lib/transport/mock/mock_flight_controller_link.dart new file mode 100644 index 0000000..4c66281 --- /dev/null +++ b/app/lib/transport/mock/mock_flight_controller_link.dart @@ -0,0 +1,71 @@ +import 'dart:async'; + +import '../../domain/waypoint/flat_waypoint_list.dart'; +import '../flight_controller_link.dart'; + +/// Synthetische Telemetrie fuer UI-Entwicklung/Tests ohne Hardware oder SITL +/// (Architektur-Doku 3.1). +class MockFlightControllerLink implements FlightControllerLink { + bool _armed = false; + int? _activeWaypointIndex; + StreamController? _telemetryController; + Timer? _ticker; + + @override + FcCapabilities get capabilities => const FcCapabilities( + supportsMultiMission: true, + supportsInFlightUpload: false, + maxWaypoints: 60, + ); + + @override + Future connect() async { + _telemetryController = StreamController.broadcast(); + _ticker = Timer.periodic(const Duration(seconds: 1), (_) { + _telemetryController?.add(TelemetryFrame( + lat: 52.5, + lon: 13.4, + altitudeM: 120, + speedMs: 18, + armed: _armed, + activeWaypointIndex: _activeWaypointIndex, + )); + }); + } + + @override + Future disconnect() async { + _ticker?.cancel(); + await _telemetryController?.close(); + _telemetryController = null; + } + + @override + Future uploadMission(FlatWaypointList mission) async { + // iNAV/MAVLink erlauben Mission-Upload nur im unarmed-Zustand (Doku 4.5). + if (_armed) { + throw StateError('Mission-Upload verweigert: Drohne ist armed.'); + } + _activeWaypointIndex = mission.waypoints.isEmpty ? null : 0; + } + + @override + Future setFlightMode(FlightMode mode) async {} + + @override + Future arm() async { + _armed = true; + } + + @override + Stream subscribeTelemetry() { + final controller = _telemetryController; + if (controller == null) { + throw StateError('subscribeTelemetry() vor connect() aufgerufen.'); + } + return controller.stream; + } + + @override + Future readActiveWaypointIndex() async => _activeWaypointIndex; +} diff --git a/app/lib/transport/msp/msp_flight_controller_link.dart b/app/lib/transport/msp/msp_flight_controller_link.dart new file mode 100644 index 0000000..0b3e2c7 --- /dev/null +++ b/app/lib/transport/msp/msp_flight_controller_link.dart @@ -0,0 +1,39 @@ +import '../../domain/waypoint/flat_waypoint_list.dart'; +import '../flight_controller_link.dart'; + +/// iNAV-Anbindung via MSP (Architektur-Doku 3.1). Eigenstaendiger Adapter, +/// da kein fertiges Dart-Paket fuer MSP verfuegbar ist (Doku 4.19). +/// +/// Protokoll-Implementierung (Framing, MSP_SET_WP, MSP_NAV_STATUS, ...) ist +/// noch offen - dies ist bewusst nur das Geruest fuer die Abstraktion. +class MspFlightControllerLink implements FlightControllerLink { + MspFlightControllerLink({required this.host, required this.port}); + + final String host; + final int port; + + @override + FcCapabilities get capabilities => throw UnimplementedError(); + + @override + Future connect() => throw UnimplementedError(); + + @override + Future disconnect() => throw UnimplementedError(); + + @override + Future uploadMission(FlatWaypointList mission) => + throw UnimplementedError(); + + @override + Future setFlightMode(FlightMode mode) => throw UnimplementedError(); + + @override + Future arm() => throw UnimplementedError(); + + @override + Stream subscribeTelemetry() => throw UnimplementedError(); + + @override + Future readActiveWaypointIndex() => throw UnimplementedError(); +} diff --git a/app/lib/ui/app_shell.dart b/app/lib/ui/app_shell.dart new file mode 100644 index 0000000..2c7f940 --- /dev/null +++ b/app/lib/ui/app_shell.dart @@ -0,0 +1,19 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +import '../app_mode/app_mode_cubit.dart'; +import 'screens/fly/fly_screen.dart'; +import 'screens/plan/plan_screen.dart'; + +/// Schaltet zwischen Plan- und Fly-Screen um, gesteuert von der +/// App-Mode State Machine (Architektur-Doku 2.2). Connect/Upload sind +/// Uebergangszustaende innerhalb des Plan-Screens (Handover-Prozess). +class AppShell extends StatelessWidget { + const AppShell({super.key}); + + @override + Widget build(BuildContext context) { + final mode = context.select((AppModeCubit c) => c.state.mode); + return mode == AppMode.fly ? const FlyScreen() : const PlanScreen(); + } +} diff --git a/app/lib/ui/dmc_colors.dart b/app/lib/ui/dmc_colors.dart new file mode 100644 index 0000000..988a836 --- /dev/null +++ b/app/lib/ui/dmc_colors.dart @@ -0,0 +1,14 @@ +import 'package:flutter/material.dart'; + +/// Markenfarben, uebernommen aus dem HTML-Demonstrator +/// ("Drone Mission Control.html"), damit Flutter-UI und Prototyp konsistent +/// bleiben. +abstract final class DmcColors { + static const setBlue = Color(0xFF4D9DFF); + static const setBlueLight = Color(0xFF8FD0FF); + static const liveGreen = Color(0xFF3ECF8E); + static const warnRed = Color(0xFFE2574A); + static const pafAmber = Color(0xFFF0C86E); + static const editModeGreen = Color(0xFF50C878); + static const flyModeRed = Color(0xFFE2574A); +} diff --git a/app/lib/ui/screens/fly/fly_screen.dart b/app/lib/ui/screens/fly/fly_screen.dart new file mode 100644 index 0000000..bbeb62a --- /dev/null +++ b/app/lib/ui/screens/fly/fly_screen.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +/// Fly-Modus: Telemetrie, Draeder, Point-and-Fly-Fadenkreuz +/// (Architektur-Doku 3.10/3.11). Platzhalter bis Telemetry-Service und +/// FlightControllerLink verdrahtet sind. +class FlyScreen extends StatelessWidget { + const FlyScreen({super.key}); + + @override + Widget build(BuildContext context) { + return const Scaffold( + body: Center(child: Text('Fly')), + ); + } +} diff --git a/app/lib/ui/screens/library/library_screen.dart b/app/lib/ui/screens/library/library_screen.dart new file mode 100644 index 0000000..087ad40 --- /dev/null +++ b/app/lib/ui/screens/library/library_screen.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +/// Missionsuebersicht (Architektur-Doku 3.5/7.5): Suche nach Name/Ort/Datum +/// ueber Drift, sobald AppDatabase verdrahtet ist. +class LibraryScreen extends StatelessWidget { + const LibraryScreen({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('Missions')), + body: const Center(child: Text('Library')), + ); + } +} diff --git a/app/lib/ui/screens/plan/plan_screen.dart b/app/lib/ui/screens/plan/plan_screen.dart new file mode 100644 index 0000000..fd98865 --- /dev/null +++ b/app/lib/ui/screens/plan/plan_screen.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +/// Missionsplanung: Karte + Wegpunktliste (Architektur-Doku 3.6/3.7). +/// Kartenintegration (flutter_map) und Fillet-Geometrie folgen als naechster +/// Schritt - dies ist bewusst nur der Screen-Platzhalter. +class PlanScreen extends StatelessWidget { + const PlanScreen({super.key}); + + @override + Widget build(BuildContext context) { + return const Scaffold( + body: Center(child: Text('Plan')), + ); + } +} diff --git a/app/lib/ui/screens/settings/settings_screen.dart b/app/lib/ui/screens/settings/settings_screen.dart new file mode 100644 index 0000000..e7716ff --- /dev/null +++ b/app/lib/ui/screens/settings/settings_screen.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +/// Drohnen-Profile: FC-Typ, Flugleistungsdaten, Standardprofil T1 Ranger +/// (Architektur-Doku 3.5). +class SettingsScreen extends StatelessWidget { + const SettingsScreen({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('Drone Profiles')), + body: const Center(child: Text('Settings')), + ); + } +} diff --git a/app/pubspec.lock b/app/pubspec.lock new file mode 100644 index 0000000..bbe2346 --- /dev/null +++ b/app/pubspec.lock @@ -0,0 +1,1050 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: a49d6cf99e8d8e7a8e93668d09ced0bbdb954d0b4fccc2f5f9241c6b87fad95c + url: "https://pub.dev" + source: hosted + version: "99.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "663efa951fb8a45e06f491223a604c93820598f20e6a99c25617a1576065e8b7" + url: "https://pub.dev" + source: hosted + version: "12.1.0" + archive: + dependency: transitive + description: + name: archive + sha256: a96e8b390886ee8abb49b7bd3ac8df6f451c621619f52a26e815fdcf568959ff + url: "https://pub.dev" + source: hosted + version: "4.0.9" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + bloc: + dependency: transitive + description: + name: bloc + sha256: e03b235924e4f509c27b5d6b2f949200e0a91149a9818b4f65eeb56662b75413 + url: "https://pub.dev" + source: hosted + version: "9.2.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + build: + dependency: transitive + description: + name: build + sha256: "45d14a0fb23e018d8287c32fc98d726ce466b231928ed9b9200f29bd3ccd39ae" + url: "https://pub.dev" + source: hosted + version: "4.0.7" + build_config: + dependency: transitive + description: + name: build_config + sha256: f2c223156a26eea323e6244b85141d76413a80aeee9fe0b380773789fabaf8ae + url: "https://pub.dev" + source: hosted + version: "1.3.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: fd754058c342243718d5171a95f352cfc9fcf0cba8cfa26df67cb13a5836db78 + url: "https://pub.dev" + source: hosted + version: "4.1.2" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "5367e521935b102bdf1e735d2aab461e36b2edca6517662d088dd04cc39f8d16" + url: "https://pub.dev" + source: hosted + version: "2.15.1" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: "34e4067d30ce212937df995f03b69992eea683539ceeac7f679a1f1eba055b56" + url: "https://pub.dev" + source: hosted + version: "8.12.6" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + charcode: + dependency: transitive + description: + name: charcode + sha256: fb0f1107cac15a5ea6ef0a6ef71a807b9e4267c713bb93e00e92d737cc8dbd8a + url: "https://pub.dev" + source: hosted + version: "1.4.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" + url: "https://pub.dev" + source: hosted + version: "2.0.4" + cli_config: + dependency: transitive + description: + name: cli_config + sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec + url: "https://pub.dev" + source: hosted + version: "0.2.0" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + code_assets: + dependency: transitive + description: + name: code_assets + sha256: bf394f466ba9205f1812a0433b392d6af280f155f56651eda7c18cc32ed493b8 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + coverage: + dependency: transitive + description: + name: coverage + sha256: "956a3de0725ca232ad353565a8290d3357592bf4250f6f298a185e2d949c5d3d" + url: "https://pub.dev" + source: hosted + version: "1.15.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: "41e005c33bd814be4d3096aff55b1908d419fde52ca656c8c47719ec745873cd" + url: "https://pub.dev" + source: hosted + version: "1.0.9" + dart_earcut: + dependency: transitive + description: + name: dart_earcut + sha256: e485001bfc05dcbc437d7bfb666316182e3522d4c3f9668048e004d0eb2ce43b + url: "https://pub.dev" + source: hosted + version: "1.2.0" + dart_polylabel2: + dependency: transitive + description: + name: dart_polylabel2 + sha256: "7eeab15ce72894e4bdba6a8765712231fc81be0bd95247de4ad9966abc57adc6" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: a4c1ccfee44c7e75ed80484071a5c142a385345e658fd8bd7c4b5c97e7198f98 + url: "https://pub.dev" + source: hosted + version: "3.1.8" + drift: + dependency: "direct main" + description: + name: drift + sha256: "84688491040b0ceb26575709a84d701c84ad4df4d8aff020adf6d85f155fb0dd" + url: "https://pub.dev" + source: hosted + version: "2.34.2" + drift_dev: + dependency: "direct dev" + description: + name: drift_dev + sha256: "9cfff1576b49725da0d32c040651a41ae195e8c4af8d8da301593e41d7abc2f7" + url: "https://pub.dev" + source: hosted + version: "2.34.0" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flat_buffers: + dependency: transitive + description: + name: flat_buffers + sha256: "380bdcba5664a718bfd4ea20a45d39e13684f5318fcd8883066a55e21f37f4c3" + url: "https://pub.dev" + source: hosted + version: "23.5.26" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_bloc: + dependency: "direct main" + description: + name: flutter_bloc + sha256: cf51747952201a455a1c840f8171d273be009b932c75093020f9af64f2123e38 + url: "https://pub.dev" + source: hosted + version: "9.1.1" + flutter_launcher_icons: + dependency: "direct dev" + description: + name: flutter_launcher_icons + sha256: "10f13781741a2e3972126fae08393d3c4e01fa4cd7473326b94b72cf594195e7" + url: "https://pub.dev" + source: hosted + version: "0.14.4" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_map: + dependency: "direct main" + description: + name: flutter_map + sha256: ce1debbb29cade61964334b2a19c7c76e5bb2ef7dacf126c6424ee44036232f8 + url: "https://pub.dev" + source: hosted + version: "8.3.1" + flutter_map_tile_caching: + dependency: "direct main" + description: + name: flutter_map_tile_caching + sha256: "90e097223d8ab74425cf15b449a03adfa4d4c28406dc757e1c396aff0f9beba7" + url: "https://pub.dev" + source: hosted + version: "10.1.1" + flutter_riverpod: + dependency: "direct main" + description: + name: flutter_riverpod + sha256: a441fd079f11969f526ec04556ba9819fee7d981bdf50fab858066807b36cff9 + url: "https://pub.dev" + source: hosted + version: "3.4.1" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de + url: "https://pub.dev" + source: hosted + version: "2.1.3" + go_router: + dependency: "direct main" + description: + name: go_router + sha256: "5922b2861e2235a3504896f0d6fa07d84141b480cf52eecd2f42cd25585a9e8a" + url: "https://pub.dev" + source: hosted + version: "17.3.0" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + hooks: + dependency: transitive + description: + name: hooks + sha256: "9a62a50b50b769a737bc0a8ff381f333529df3ab746b2f6b02e83760231455ba" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + http: + dependency: "direct main" + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + image: + dependency: transitive + description: + name: image + sha256: "6300175e00616bbc832e2fc91bfa4d776af5402c81c7151bee6905bb08473c52" + url: "https://pub.dev" + source: hosted + version: "4.9.1" + intl: + dependency: transitive + description: + name: intl + sha256: "1ca20c894b1717686a2319b8548763d812bc0aabdac580420a44c5178c57a867" + url: "https://pub.dev" + source: hosted + version: "0.20.3" + io: + dependency: transitive + description: + name: io + sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b + url: "https://pub.dev" + source: hosted + version: "1.0.5" + jni: + dependency: transitive + description: + name: jni + sha256: c2230682d5bc2362c1c9e8d3c7f406d9cbba23ab3f2e203a025dd47e0fb2e68f + url: "https://pub.dev" + source: hosted + version: "1.0.0" + jni_flutter: + dependency: transitive + description: + name: jni_flutter + sha256: "8b59e590786050b1cd866677dddaf76b1ade5e7bc751abe04b86e84d379d3ba6" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "2a743920d81b7910627f68ee2c9ac1fc0bfee32b9fc3403587d7c6791ca12f80" + url: "https://pub.dev" + source: hosted + version: "4.12.0" + latlong2: + dependency: "direct main" + description: + name: latlong2 + sha256: "98227922caf49e6056f91b6c56945ea1c7b166f28ffcd5fb8e72fc0b453cc8fe" + url: "https://pub.dev" + source: hosted + version: "0.9.1" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + listen: + dependency: transitive + description: + name: listen + sha256: cb0ad74d7453d8f83a7c1fae401828681ef5df21d41a3a26a04af590c985d085 + url: "https://pub.dev" + source: hosted + version: "1.0.0-beta.4" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861 + url: "https://pub.dev" + source: hosted + version: "0.12.19" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: transitive + description: + name: meta + sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349" + url: "https://pub.dev" + source: hosted + version: "1.18.0" + mgrs_dart: + dependency: transitive + description: + name: mgrs_dart + sha256: "385e7168ecc77eb545220223c49eef8ab249da7bf57f22781c40a04d23fb196f" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + native_toolchain_c: + dependency: transitive + description: + name: native_toolchain_c + sha256: f9c168717100ae6d9fee9ffb0be379bf1f8b26b0f6bcbd4fdddcd931993a6a72 + url: "https://pub.dev" + source: hosted + version: "0.19.2" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + objectbox: + dependency: transitive + description: + name: objectbox + sha256: "3cc186749178a3556e1020c9082d0897d0f9ecbdefcc27320e65c5bc650f0e57" + url: "https://pub.dev" + source: hosted + version: "4.3.1" + objectbox_flutter_libs: + dependency: transitive + description: + name: objectbox_flutter_libs + sha256: cd754766e04229a4f51250f121813d9a3c1a74fc21cd68e48b3c6085cbcd6c85 + url: "https://pub.dev" + source: hosted + version: "4.3.1" + objective_c: + dependency: transitive + description: + name: objective_c + sha256: "6cb691c686fa2838c6deb34980d426145c2a5d537491cb83d463c33cdbc726ed" + url: "https://pub.dev" + source: hosted + version: "9.4.1" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.dev" + source: hosted + version: "2.2.0" + path: + dependency: "direct main" + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path_provider: + dependency: "direct main" + description: + name: path_provider + sha256: a7f4874f987173da295a61c181b8ee71dab59b332a486b391babf26a1b884825 + url: "https://pub.dev" + source: hosted + version: "2.1.6" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "69cbd515a62b94d32a7944f086b2f82b4ac40a1d45bebfc00813a430ab2dabcd" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "2a376b7d6392d80cd3705782d2caa734ca4727776db0b6ec36ef3f1855197699" + url: "https://pub.dev" + source: hosted + version: "2.6.0" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: "58c2005f147315b11e9b4a7bc889cd5203e250cba8e3f012dae259b4972b5c16" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "484838772624c3a4b94f1e44a3e19897fee738f2d5c4ce448443b0417f7c9dda" + url: "https://pub.dev" + source: hosted + version: "2.1.3" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675" + url: "https://pub.dev" + source: hosted + version: "7.0.2" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pool: + dependency: transitive + description: + name: pool + sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d" + url: "https://pub.dev" + source: hosted + version: "1.5.2" + posix: + dependency: transitive + description: + name: posix + sha256: bc1bad54ad2b735816e31f8d4600cfde6c7839975085ddfbca48b6c9f7c4044e + url: "https://pub.dev" + source: hosted + version: "6.5.2" + proj4dart: + dependency: transitive + description: + name: proj4dart + sha256: ddcedc1f7876e62717de43ab3491e2829bdad0b028261805f94aa080967e5859 + url: "https://pub.dev" + source: hosted + version: "3.0.0" + provider: + dependency: transitive + description: + name: provider + sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272" + url: "https://pub.dev" + source: hosted + version: "6.1.5+1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + recase: + dependency: transitive + description: + name: recase + sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 + url: "https://pub.dev" + source: hosted + version: "4.1.0" + record_use: + dependency: transitive + description: + name: record_use + sha256: "2551bd8eecfe95d14ae75f6021ad0248be5c27f138c2ec12fcb52b500b3ba1ed" + url: "https://pub.dev" + source: hosted + version: "0.6.0" + riverpod: + dependency: transitive + description: + name: riverpod + sha256: ccd1d45f07d20f894a975eeaa64d14a0dbbcfd0825bb59c3cd89837c2c21b436 + url: "https://pub.dev" + source: hosted + version: "3.4.1" + shelf: + dependency: transitive + description: + name: shelf + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 + url: "https://pub.dev" + source: hosted + version: "1.4.2" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 + url: "https://pub.dev" + source: hosted + version: "1.1.3" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + simple_sparse_list: + dependency: transitive + description: + name: simple_sparse_list + sha256: aa648fd240fa39b49dcd11c19c266990006006de6699a412de485695910fbc1f + url: "https://pub.dev" + source: hosted + version: "0.1.4" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: a603f1fb984a7391ae5978d1b92bfaaa08b350dca5c825256f925818f7943bf5 + url: "https://pub.dev" + source: hosted + version: "4.2.4" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812" + url: "https://pub.dev" + source: hosted + version: "0.10.13" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + sqlite3: + dependency: transitive + description: + name: sqlite3 + sha256: c73fd75df1332d76a6257f4823ae4df9c791f522b97e4a60cbcad214de1becf4 + url: "https://pub.dev" + source: hosted + version: "3.5.0" + sqlite3_flutter_libs: + dependency: "direct main" + description: + name: sqlite3_flutter_libs + sha256: "3ed7553eee7bb368f8950f58ba29f634e06e813c029aff6a0d60862b96de8454" + url: "https://pub.dev" + source: hosted + version: "0.6.0+eol" + sqlparser: + dependency: transitive + description: + name: sqlparser + sha256: "40bdddb306a727be9ce510bd2d2b9a6c9db6c586d846ef7b22e3990a2b24f02d" + url: "https://pub.dev" + source: hosted + version: "0.44.5" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + state_notifier: + dependency: transitive + description: + name: state_notifier + sha256: b8677376aa54f2d7c58280d5a007f9e8774f1968d1fb1c096adcb4792fba29bb + url: "https://pub.dev" + source: hosted + version: "1.0.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" + source: hosted + version: "2.1.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test: + dependency: transitive + description: + name: test + sha256: "8d9ceddbab833f180fbefed08afa76d7c03513dfdba87ffcec2718b02bbcbf20" + url: "https://pub.dev" + source: hosted + version: "1.31.0" + test_api: + dependency: transitive + description: + name: test_api + sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e" + url: "https://pub.dev" + source: hosted + version: "0.7.11" + test_core: + dependency: transitive + description: + name: test_core + sha256: "1991d4cfe85d5043241acac92962c3977c8d2f2add1ee73130c7b286417d1d34" + url: "https://pub.dev" + source: hosted + version: "0.6.17" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + unicode: + dependency: transitive + description: + name: unicode + sha256: a6f7bcfc8ea1d5ce1f6c0b1c39117a9919f4953edd9fd7a64090a9796c499b57 + url: "https://pub.dev" + source: hosted + version: "1.1.9" + uuid: + dependency: transitive + description: + name: uuid + sha256: "9b129329f58692f6e6578329498a8fe9fbe98f090beb764ffbb8ee2eadd01dcd" + url: "https://pub.dev" + source: hosted + version: "4.6.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + url: "https://pub.dev" + source: hosted + version: "2.2.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "0016aef94fc66495ac78af5859181e3f3bf2026bd8eecc72b9565601e19ab360" + url: "https://pub.dev" + source: hosted + version: "15.2.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 + url: "https://pub.dev" + source: hosted + version: "3.0.3" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + wkt_parser: + dependency: transitive + description: + name: wkt_parser + sha256: "8a555fc60de3116c00aad67891bcab20f81a958e4219cc106e3c037aa3937f13" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: "67f0aff7be013d107995e9b75bf4e7f2c3ef2dfdb2c8e68024bba0a7fd5756a4" + url: "https://pub.dev" + source: hosted + version: "7.0.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" +sdks: + dart: ">=3.12.2 <4.0.0" + flutter: ">=3.38.4" diff --git a/app/pubspec.yaml b/app/pubspec.yaml new file mode 100644 index 0000000..c9d895e --- /dev/null +++ b/app/pubspec.yaml @@ -0,0 +1,112 @@ +name: dmc_app +description: "Drone Mission Control - Missionsplanung und Flugsteuerung f\\u00fcr Fixed-Wing-Drohnen" +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +flutter_launcher_icons: + android: true + ios: false + image_path: "assets/icon/icon.png" + min_sdk_android: 21 + +environment: + sdk: ^3.12.2 + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + flutter_map: ^8.3.1 + latlong2: ^0.9.1 + flutter_map_tile_caching: ^10.1.1 + drift: ^2.34.2 + sqlite3_flutter_libs: ^0.6.0+eol + path_provider: ^2.1.6 + path: ^1.9.1 + http: ^1.6.0 + flutter_bloc: ^9.1.1 + flutter_riverpod: ^3.4.1 + go_router: ^17.3.0 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^6.0.0 + drift_dev: ^2.34.0 + build_runner: ^2.15.1 + flutter_launcher_icons: ^0.14.4 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + assets: + - assets/icon/icon.png + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package diff --git a/app/test/widget_test.dart b/app/test/widget_test.dart new file mode 100644 index 0000000..ca17604 --- /dev/null +++ b/app/test/widget_test.dart @@ -0,0 +1,22 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:dmc_app/app_mode/app_mode_cubit.dart'; +import 'package:dmc_app/ui/app_shell.dart'; + +void main() { + testWidgets('AppShell zeigt Plan-Screen im Startzustand', (tester) async { + await tester.pumpWidget( + ProviderScope( + child: BlocProvider( + create: (_) => AppModeCubit(), + child: const MaterialApp(home: AppShell()), + ), + ), + ); + + expect(find.text('Plan'), findsOneWidget); + }); +}