MetricsViewModel

open class MetricsViewModel(val destNum: Int, dispatchers: CoroutineDispatchers, meshLogRepository: MeshLogRepository, serviceRepository: ServiceRepository, nodeRepository: NodeRepository, tracerouteSnapshotRepository: TracerouteSnapshotRepository, nodeRequestActions: NodeRequestActions, alertManager: AlertManager, getNodeDetailsUseCase: GetNodeDetailsUseCase, fileService: FileService) : ViewModel(source)

ViewModel responsible for managing and graphing metrics (telemetry, signal strength, paxcount) for a specific node.

Constructors

Link copied to clipboard
constructor(destNum: Int, dispatchers: CoroutineDispatchers, meshLogRepository: MeshLogRepository, serviceRepository: ServiceRepository, nodeRepository: NodeRepository, tracerouteSnapshotRepository: TracerouteSnapshotRepository, nodeRequestActions: NodeRequestActions, alertManager: AlertManager, getNodeDetailsUseCase: GetNodeDetailsUseCase, fileService: FileService)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Returns the list of time frames that are actually available based on the oldest data point.

Link copied to clipboard
Link copied to clipboard

Exposes graphing data specifically for the filtered environment metrics.

Link copied to clipboard
val filteredEnvironmentMetrics: StateFlow<List<Telemetry>>

Exposes filtered and unit-converted environment metrics for the UI.

Link copied to clipboard
val filteredPaxMetrics: StateFlow<List<Pair<MeshLog, Paxcount>>>

Exposes filtered and decoded pax metrics for the UI.

Link copied to clipboard
Link copied to clipboard
val lastTraceRouteTime: StateFlow<Long?>
Link copied to clipboard
val state: StateFlow<MetricsState>
Link copied to clipboard
val timeFrame: StateFlow<TimeFrame>

The active time window for filtering graphed data.

Functions

Link copied to clipboard
expect open fun addCloseable(closeable: AutoCloseable)
expect fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard
fun clearPosition(): Job
Link copied to clipboard
Link copied to clipboard
fun decodePaxFromLog(log: MeshLog): Paxcount?
Link copied to clipboard
fun deleteLog(uuid: String): Job
Link copied to clipboard
expect fun <T : AutoCloseable> getCloseable(key: String): T?
Link copied to clipboard
Link copied to clipboard
fun getUser(nodeNum: Int): User
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun saveDeviceMetricsCSV(uri: CommonUri, data: List<Telemetry>)
Link copied to clipboard
fun saveEnvironmentMetricsCSV(uri: CommonUri, data: List<Telemetry>)
Link copied to clipboard
fun savePositionCSV(uri: CommonUri, data: List<Position>)
Link copied to clipboard
fun savePowerMetricsCSV(uri: CommonUri, data: List<Telemetry>)
Link copied to clipboard
fun saveSignalMetricsCSV(uri: CommonUri, data: List<MeshPacket>)
Link copied to clipboard
fun setNodeId(id: Int)
Link copied to clipboard
fun setTimeFrame(timeFrame: TimeFrame)
Link copied to clipboard
fun showLogDetail(titleRes: StringResource, annotatedMessage: AnnotatedString)
Link copied to clipboard
fun showTracerouteDetail(annotatedMessage: AnnotatedString, requestId: Int, responseLogUuid: String, overlay: TracerouteOverlay?, onViewOnMap: (Int, String) -> Unit)
Link copied to clipboard
fun tracerouteSnapshotPositions(logUuid: String): Flow<Map<Int, Position>>