|
| 1 | +namespace NETworkManager.Models.Cloudflare; |
| 2 | + |
| 3 | +/// <summary> |
| 4 | +/// Phase of a Cloudflare speed test run, reported by |
| 5 | +/// <see cref="SpeedTestService"/> via <see cref="System.IProgress{T}"/>. |
| 6 | +/// </summary> |
| 7 | +public enum SpeedTestPhase |
| 8 | +{ |
| 9 | + FetchingMetadata, |
| 10 | + MeasuringLatency, |
| 11 | + MeasuringDownload, |
| 12 | + MeasuringUpload |
| 13 | +} |
| 14 | + |
| 15 | +/// <summary> |
| 16 | +/// Progress event passed by <see cref="SpeedTestService"/> to update the UI |
| 17 | +/// with the currently running measurement phase and the latest live estimate |
| 18 | +/// of each metric. Values are <c>null</c> until the first sample for that |
| 19 | +/// metric has been collected. |
| 20 | +/// </summary> |
| 21 | +/// <param name="Phase">Current measurement phase.</param> |
| 22 | +/// <param name="DownloadMbps">Live download throughput estimate (Mbps).</param> |
| 23 | +/// <param name="UploadMbps">Live upload throughput estimate (Mbps).</param> |
| 24 | +/// <param name="LatencyMs">Live latency estimate (50th percentile of probes).</param> |
| 25 | +/// <param name="JitterMs">Live jitter estimate (average consecutive delta).</param> |
| 26 | +/// <param name="NewDownloadSampleMbps"> |
| 27 | +/// Set when this emission marks a freshly completed download sample (one HTTP |
| 28 | +/// request finished). Mid-stream live updates leave this <c>null</c>. |
| 29 | +/// </param> |
| 30 | +/// <param name="NewUploadSampleMbps"> |
| 31 | +/// Set when this emission marks a freshly completed upload sample. |
| 32 | +/// </param> |
| 33 | +/// <param name="Meta"> |
| 34 | +/// Cloudflare <c>/meta</c> response, emitted once after metadata is fetched |
| 35 | +/// so ISP / location / server details can be displayed before the bandwidth |
| 36 | +/// measurements complete. |
| 37 | +/// </param> |
| 38 | +public record SpeedTestProgress( |
| 39 | + SpeedTestPhase Phase, |
| 40 | + double? DownloadMbps = null, |
| 41 | + double? UploadMbps = null, |
| 42 | + double? LatencyMs = null, |
| 43 | + double? JitterMs = null, |
| 44 | + double? NewDownloadSampleMbps = null, |
| 45 | + double? NewUploadSampleMbps = null, |
| 46 | + SpeedTestMetaInfo Meta = null); |
0 commit comments