Initial commit: FieldLogger MAUI app with Maglink BLE support
Added Maglink RTK GNSS receiver integration with correct BLE UUIDs and device name filtering (ML-* prefix). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
52
FieldLogger/ViewModels/SettingsViewModel.cs
Normal file
52
FieldLogger/ViewModels/SettingsViewModel.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using FieldLogger.Models;
|
||||
using FieldLogger.Services;
|
||||
|
||||
namespace FieldLogger.ViewModels;
|
||||
|
||||
public sealed partial class SettingsViewModel : ObservableObject
|
||||
{
|
||||
private readonly DeviceConnectionManager _manager;
|
||||
private readonly SettingsService _settings;
|
||||
|
||||
public DeviceConnectionManager Manager => _manager;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _mapsApiKey = "";
|
||||
|
||||
public string AppVersion => AppInfo.Current.VersionString;
|
||||
|
||||
public SettingsViewModel(DeviceConnectionManager manager, SettingsService settings)
|
||||
{
|
||||
_manager = manager;
|
||||
_settings = settings;
|
||||
MapsApiKey = settings.GoogleMapsApiKey;
|
||||
}
|
||||
|
||||
partial void OnMapsApiKeyChanged(string value) => _settings.GoogleMapsApiKey = value.Trim();
|
||||
|
||||
[RelayCommand]
|
||||
private Task ChangeLocatorAsync() => Shell.Current.GoToAsync($"devicescan?kind={DeviceKind.Locator}");
|
||||
|
||||
[RelayCommand]
|
||||
private Task ChangeGpsAsync() => Shell.Current.GoToAsync($"devicescan?kind={DeviceKind.RtkGps}");
|
||||
|
||||
[RelayCommand]
|
||||
private async Task ForgetLocatorAsync()
|
||||
{
|
||||
if (await ConfirmForgetAsync(_manager.LocatorName ?? "locating receiver"))
|
||||
await _manager.ForgetDeviceAsync(DeviceKind.Locator);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task ForgetGpsAsync()
|
||||
{
|
||||
if (await ConfirmForgetAsync(_manager.GpsName ?? "RTK GPS receiver"))
|
||||
await _manager.ForgetDeviceAsync(DeviceKind.RtkGps);
|
||||
}
|
||||
|
||||
private static Task<bool> ConfirmForgetAsync(string name) =>
|
||||
Shell.Current.DisplayAlert("Forget Device",
|
||||
$"Forget \"{name}\"? The app will no longer auto-connect to it.", "Forget", "Cancel");
|
||||
}
|
||||
Reference in New Issue
Block a user