feat: typed telemetry dispatch + MeshTopology service

- Replace magic int dispatch in requestTelemetry with TelemetryType enum
- Update DataRequester interface: remove requestId param, use TelemetryType directly
- Add HEALTH and TRAFFIC_MANAGEMENT to TelemetryType, remove stale PAX variant
- Create MeshTopologyService wrapping SDK's MeshTopology with thread-safe Mutex
- Wire NeighborInfo packet ingestion in SdkStateBridge → topology graph
- Clear topology on node snapshot (reconnect)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
James Rich
2026-05-06 12:04:07 -05:00
parent 3fb45e05bd
commit f4c6cee332
11 changed files with 147 additions and 22 deletions

View File

@@ -197,7 +197,7 @@ private fun rememberTelemetricFeatures(
TelemetricFeature(
titleRes = LogsType.PAX.titleRes,
icon = LogsType.PAX.icon,
requestAction = { NodeMenuAction.RequestTelemetry(it, TelemetryType.PAX) },
requestAction = { NodeMenuAction.RequestTelemetry(it, TelemetryType.DEVICE) },
logsType = LogsType.PAX,
),
TelemetricFeature(

View File

@@ -100,8 +100,7 @@ constructor(
scope.launch(ioDispatcher) {
runCatching {
Logger.i { "Requesting telemetry for '$destNum'" }
val packetId = messageSender.getPacketId()
dataRequester.requestTelemetry(packetId, destNum, type.ordinal)
dataRequester.requestTelemetry(destNum, type)
val typeRes =
when (type) {
@@ -110,8 +109,9 @@ constructor(
TelemetryType.AIR_QUALITY -> Res.string.request_air_quality_metrics
TelemetryType.POWER -> Res.string.request_power_metrics
TelemetryType.LOCAL_STATS -> Res.string.signal_quality
TelemetryType.HEALTH -> Res.string.request_device_metrics
TelemetryType.HOST -> Res.string.request_host_metrics
TelemetryType.PAX -> Res.string.request_pax_metrics
TelemetryType.TRAFFIC_MANAGEMENT -> Res.string.request_device_metrics
}
showFeedback(UiText.Resource(Res.string.requesting_from, typeRes, longName))

View File

@@ -191,12 +191,12 @@ fun PaxMetricsScreen(metricsViewModel: MetricsViewModel, onNavigateUp: () -> Uni
BaseMetricScreen(
onNavigateUp = onNavigateUp,
telemetryType = TelemetryType.PAX,
telemetryType = TelemetryType.DEVICE,
titleRes = Res.string.pax_metrics_log,
nodeName = state.node?.user?.long_name ?: "",
data = paxMetrics,
timeProvider = { (it.first.received_date / MS_PER_SEC).toDouble() },
onRequestTelemetry = { metricsViewModel.requestTelemetry(TelemetryType.PAX) },
onRequestTelemetry = { metricsViewModel.requestTelemetry(TelemetryType.DEVICE) },
controlPart = {
TimeFrameSelector(
selectedTimeFrame = timeFrame,