TrafficSparkline-Breite 50pt→200pt, Zeitfenster 10s→30s, Poll-Intervall 3s→0,1s. Traffic-Anzeige von auto-skaliertem kbps/Mbps/Gbps auf festes MB/s umgestellt. Alles per Nutzeranfrage iterativ angepasst, noch nicht live gegen echten Router getestet (siehe found.md Fund 4). Manual.md + Manual.pdf mit aktualisiert (build-manual.py). Fund 5 (App-Settings/ Preferences-Bereich) als offene Feature-Idee in found.md notiert, noch nicht umgesetzt. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
25 lines
1.1 KiB
Swift
25 lines
1.1 KiB
Swift
import Foundation
|
|
|
|
/// A single live throughput sample for one interface, from RouterOS' `/interface monitor-traffic
|
|
/// <name> once` — used to distinguish "link up" (`NetworkInterface.running`, already shown) from
|
|
/// "actually carrying data right now", which `running` alone can't: a port stays `running` as soon
|
|
/// as its link is up/negotiated, even sitting completely idle.
|
|
struct InterfaceTraffic: Equatable {
|
|
let rxBitsPerSecond: Int
|
|
let txBitsPerSecond: Int
|
|
|
|
var isActive: Bool { rxBitsPerSecond > 0 || txBitsPerSecond > 0 }
|
|
}
|
|
|
|
/// One timestamped throughput reading, kept in a short rolling per-port history so the
|
|
/// LAN-Scanner's port headers can show a small sparkline of the last few seconds, not just the
|
|
/// current instantaneous value (Nutzerwunsch: "ein kleines Liniendiagramm der letzten 10 Sekunden
|
|
/// ... pro port", window later widened to 30s). Timestamped (not just appended in order) so
|
|
/// trimming to a fixed window stays correct even if a poll tick is ever delayed or skipped,
|
|
/// rather than assuming a fixed cadence.
|
|
struct TrafficSample: Identifiable {
|
|
let id = UUID()
|
|
let timestamp: Date
|
|
let totalBitsPerSecond: Int
|
|
}
|