Major changes: - Added Debug tab with real-time message logging and hex viewer - Implemented timed data logging ($UMTDL command) per API v1.3 - Fixed BLE message parsing to handle notifications without line endings - Added Schema 2 support (22-field timed logging packets) - Updated Maglink BLE UUIDs (fff0/fff1/fff2) - Added connection timeout (10s) to prevent hanging on unavailable devices - Added connection status display and manual push-button logging trigger - Improved retry logging with attempt numbers and delays - Added console window allocation for Windows debug output - Added BLE disconnect on app close Bug fixes: - Fixed device name filtering for Maglink (ML-* prefix) - Fixed RtkGps enum reference in DeviceScanViewModel - Fixed DebugMessage namespace (moved to Models) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
57 lines
1.4 KiB
C#
57 lines
1.4 KiB
C#
using FieldLogger.Services;
|
|
|
|
namespace FieldLogger;
|
|
|
|
public partial class App : Application
|
|
{
|
|
private readonly DeviceConnectionManager _connectionManager;
|
|
|
|
public App(DeviceConnectionManager connectionManager)
|
|
{
|
|
InitializeComponent();
|
|
_connectionManager = connectionManager;
|
|
|
|
Console.WriteLine("===== FIELD LOGGER APP STARTING =====");
|
|
Console.WriteLine($"Console output is working! Time: {DateTime.Now:HH:mm:ss}");
|
|
}
|
|
|
|
protected override Window CreateWindow(IActivationState? activationState)
|
|
{
|
|
var window = new Window(new AppShell());
|
|
|
|
// Disconnect BLE devices when window is closing
|
|
window.Destroying += async (s, e) =>
|
|
{
|
|
Console.WriteLine("App: Window closing, disconnecting devices...");
|
|
await DisconnectAllDevicesAsync();
|
|
};
|
|
|
|
return window;
|
|
}
|
|
|
|
private async Task DisconnectAllDevicesAsync()
|
|
{
|
|
try
|
|
{
|
|
// Disconnect locator
|
|
if (_connectionManager.Locator.IsConnected)
|
|
{
|
|
Console.WriteLine("App: Disconnecting locator...");
|
|
await _connectionManager.Locator.DisconnectAsync();
|
|
}
|
|
|
|
// Disconnect GPS
|
|
if (_connectionManager.Gps.IsConnected)
|
|
{
|
|
Console.WriteLine("App: Disconnecting GPS...");
|
|
await _connectionManager.Gps.DisconnectAsync();
|
|
}
|
|
|
|
Console.WriteLine("App: All devices disconnected");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine($"App: Error disconnecting devices: {ex.Message}");
|
|
}
|
|
}
|
|
} |