# GeoVLogMon
**WPF cockpit monitor for real‑time survey‑sensor status**
GeoVLogMon runs *next to* the background logger (**GeoVLogSvc**).
It is **optional:** closing GeoVLogMon never affects data capture.
Primary goals:
* Give the survey operator an at‑a‑glance view of sensor health and live measurements.
* Provide simple flight controls (Start Flight, Pause Logging, Enter Crew).
* Surface warnings early (disk full, serial dropouts).
---
## 1 · Architecture
```
GeoVLogMon (WPF, MVVM)
│ gRPC (named pipe)
▼
GeoVLogSvc ⇐⇐ captured sensor frames
```
* Endpoint: `net.pipe://./GeoVLog/monitor`
* Protobuf contracts generated in **GeoVLog.Core** (`monitor.proto`).
* Mon uses read‑only calls; only “Start Flight” and “Stop Flight” mutate state.
---
## 2 · Current status
| File | State |
|--------------------|-------|
| `App.xaml` | Bootstraps DI, theme resources |
| `MainWindow.xaml` | DockPanel with placeholder *“Live charts coming soon”* |
| `Services/GrpcMonitorClient.cs` | Connects to local pipe, subscribes to `StatusStream` |
| `ViewModels/MainVM.cs` | Exposes `DiskFree`, `RowsPerSec`, `Warnings` |
The window already updates disk‑free % and flight timer every second when GeoVLogSvc is running ≥ v1.0.
---
## 3 · Feature roadmap
| Phase | Feature | Notes / dependencies |
|-------|---------|----------------------|
| **MVP** | • Live strip‑chart (counts, nT)
• COM port LEDs
• Disk & SSD SMART health bar | Use *LiveChartsCore.SkiaSharp*. |
| **α** | • Start / Stop flight buttons (call `BeginFlight` RPC)
• Flight‑ID + crew entry form (writes manifest) | Validation & disable if service busy. |
| **β** | • Alarm overlay & audible alert (disk < 10 %, queue overflow, PPS drop).
• Theme: day / night. | Maintain two `ResourceDictionary`. |
| **γ** | • Simple map (tail → lead path + sensor dots)
• Summary stats panel (duration, rows/sec, min/max by sensor) | GPS from `/measurements` where `sensor == "gps"` |
| **δ** | • Calibration wizard (zero‑mag, gamma background) | Saves YAML patch into manifest. |
---
## 4 · Building & running
```powershell
cd GeoVLog/src/GeoVLogMon
dotnet run # dev mode, connects to local service
```
Publish:
```powershell
dotnet publish -c Release -r win-x64 `
/p:PublishSingleFile=true /p:PublishTrimmed=true
```
Bundle the EXE + `GeoVLogMon.exe.config` (for pipe name) into the aircraft PC installer or simply copy into `C:\Program Files\GeoVLog\`.
---
## 5 · Command‑line switches
| Option | Default | Description |
|--------|---------|-------------|
| `--pipe ` | `GeoVLog` | Override gRPC named‑pipe root. |
| `--demomode` | off | Runs with synthetic data if the service isn’t present. |
| `--theme dark|light` | system | Force UI theme on startup. |
---
## 6 · Development guidelines
* **MVVM** – use CommunityToolkit.Mvvm; keep code‑behind empty.
* **Always mock `IMonitorClient`** in design‑time previews (`DesignData/`).
* **No logging to disk** – UI logs go to `EventLog: Application` (source *GeoVLogMon*).
* **All margin/padding** units in XAML via `StaticResource SpacingM` etc.
* Keep proto versions in sync with GeoVLogSvc; run `protoc --csharp_out` when changing contracts.
---
## 7 · Testing
* `GeoVLog.Tests/MonitorClientTests.cs` – verifies reconnect logic and heartbeat timeout.
* Manual: `dotnet run --demomode` for striped sine‑wave sensor demo.
---
## 8 · Operator quick‑reference
| Widget | Meaning | Actions |
|--------|---------|---------|
| **Green COM LED** | Port open, checksum OK | — |
| **Yellow COM LED** | Frames missing (<1 %) | Check antenna / cable |
| **Red COM LED** | Port closed or buffer overrun | Land ASAP, contact tech |
| **Disk bar** | < 10 % triggers red | Swap SSD after landing |
| **Alarm list** | Click row to mute | Logs to EventID 3001 |
A laminated version lives in the kneeboard / ops binder.
---
## 9 · License
GeoVLogMon © 2025 Your Company Name – MIT.
---
*Questions?* File an issue with label **monitor** or call the on‑call software engineer.