GnssService osztály és refraktorálás a app_drawer miatt, shellview bevezetés.
This commit is contained in:
@@ -6,6 +6,7 @@ import '../../gnss_sentences/gngga.dart';
|
||||
import 'gnss_connection.dart';
|
||||
import 'bt_serial_gnss_connection.dart';
|
||||
import 'ble_gnss_connection.dart';
|
||||
import 'gnss_device_service.dart';
|
||||
|
||||
class GnssService extends GetxService {
|
||||
static GnssService get to => Get.find();
|
||||
@@ -101,4 +102,24 @@ class GnssService extends GetxService {
|
||||
_disconnect();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
// ── Eszközváltás — a GnssDevicePickerDialog hívja ───────────────
|
||||
|
||||
Future<void> onDeviceChanged(GnssDevice device) async {
|
||||
switch (device.type) {
|
||||
case GnssConnectionType.btSerial:
|
||||
await connectBtSerial(device.address);
|
||||
|
||||
case GnssConnectionType.ble:
|
||||
await connectBle(device.address);
|
||||
|
||||
case GnssConnectionType.phoneGps:
|
||||
// Külső GPS kapcsolat lezárása ha volt
|
||||
await _disconnect();
|
||||
connectionState.value = GnssConnectionState.disconnected;
|
||||
activeConnectionType.value = GnssConnectionType.phoneGps;
|
||||
// A telefon GPS kezelése a map_controller _startPhoneGps()-ben van
|
||||
// itt csak jelezzük hogy phone módra váltottunk
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user