WIFI connection support added
This commit is contained in:
@@ -5,6 +5,8 @@ import 'package:drift/native.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
import '../../transport/connection_type.dart';
|
||||
|
||||
part 'app_database.g.dart';
|
||||
|
||||
/// Persistenz fuer Missionen (Architektur-Doku 4.15): Drift statt Hive, weil
|
||||
@@ -61,6 +63,21 @@ class AppSettingsTable extends Table {
|
||||
BoolColumn get connectionAutoConnect =>
|
||||
boolean().withDefault(const Constant(true))();
|
||||
|
||||
/// Gewaehlte Verbindungsart (Doku 7: "Art: WLAN * USB (spaeter)"),
|
||||
/// gespeichert als [ConnectionType.name]. Standard bleibt Bluetooth, damit
|
||||
/// bestehende Installationen ihr bisheriges Verhalten behalten.
|
||||
TextColumn get connectionType =>
|
||||
text().withDefault(const Constant('bluetooth'))();
|
||||
|
||||
/// Vom Nutzer eingetragene Ziel-IP der mLRS-WLAN-Bruecke (Doku 3:
|
||||
/// "Zieladresse niemals fest eincodieren") - null, solange keine Vorgabe
|
||||
/// gesetzt ist und die Gegenstelle erst aus dem Verkehr gelernt wird.
|
||||
TextColumn get connectionWifiHost => text().nullable()();
|
||||
|
||||
/// Lokaler UDP-Port fuer die mLRS-WLAN-Bruecke (Doku 3), Standard 14550.
|
||||
IntColumn get connectionWifiPort =>
|
||||
integer().withDefault(const Constant(kDefaultWifiPort))();
|
||||
|
||||
@override
|
||||
Set<Column> get primaryKey => {id};
|
||||
}
|
||||
@@ -72,7 +89,7 @@ class AppDatabase extends _$AppDatabase {
|
||||
AppDatabase.forTesting(super.executor);
|
||||
|
||||
@override
|
||||
int get schemaVersion => 3;
|
||||
int get schemaVersion => 4;
|
||||
|
||||
@override
|
||||
MigrationStrategy get migration => MigrationStrategy(
|
||||
@@ -93,6 +110,17 @@ class AppDatabase extends _$AppDatabase {
|
||||
appSettingsTable.connectionAutoConnect,
|
||||
);
|
||||
}
|
||||
if (from < 4) {
|
||||
await m.addColumn(appSettingsTable, appSettingsTable.connectionType);
|
||||
await m.addColumn(
|
||||
appSettingsTable,
|
||||
appSettingsTable.connectionWifiHost,
|
||||
);
|
||||
await m.addColumn(
|
||||
appSettingsTable,
|
||||
appSettingsTable.connectionWifiPort,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user