SharedMapViewModel

class SharedMapViewModel(mapPrefs: MapPrefs, nodeRepository: NodeRepository, packetRepository: PacketRepository, radioController: RadioController, radioConfigRepository: RadioConfigRepository, notificationPrefs: NotificationPrefs, localeUnitsProvider: LocaleUnitsProvider, networkRepository: NetworkRepository) : BaseMapViewModel(source)

Constructors

Link copied to clipboard
constructor(mapPrefs: MapPrefs, nodeRepository: NodeRepository, packetRepository: PacketRepository, radioController: RadioController, radioConfigRepository: RadioConfigRepository, notificationPrefs: NotificationPrefs, localeUnitsProvider: LocaleUnitsProvider, networkRepository: NetworkRepository)

Properties

Link copied to clipboard
val channelSet: StateFlow<ChannelSet?>

Connected radio's channel set (primary-channel frequency + LoRa config); used to prefill a Site Planner estimate.

Link copied to clipboard

Display units (metric/imperial) for distance/altitude/speed formatting across map surfaces. Tracks locale changes and the in-app units setting, because this ViewModel survives the configuration change either triggers.

Link copied to clipboard
val geofenceAlertOptIns: StateFlow<Set<Int>>

Waypoint ids of foreign geofences the user opted in to crossing alerts for (see NotificationPrefs).

Link copied to clipboard
val isConnected: StateFlow<Boolean>
Link copied to clipboard
Link copied to clipboard

Whether the device currently has network connectivity, for the offline-basemap banner and (on the Google flavor) the auto-fallback in org.meshtastic.app.map.MapViewModel. Optimistically true until the first emission arrives, so the map never flashes an "offline" banner on cold start.

Link copied to clipboard
val myId: StateFlow<String?>
Link copied to clipboard
val myNodeInfo: StateFlow<MyNodeInfo?>
Link copied to clipboard
Link copied to clipboard
val nodes: StateFlow<List<Node>>
Link copied to clipboard
val nodesWithPosition: StateFlow<List<Node>>

The nodes the map draws from.

Link copied to clipboard
val ourNodeInfo: StateFlow<Node?>
Link copied to clipboard
val waypoints: StateFlow<Map<Int, DataPacket>>

Functions

Link copied to clipboard
expect open fun addCloseable(closeable: AutoCloseable)
expect fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard
Link copied to clipboard
fun deleteWaypoint(id: Int): Job
Link copied to clipboard
Link copied to clipboard
expect fun <T : AutoCloseable> getCloseable(key: String): T?
Link copied to clipboard
fun getNodeOrFallback(nodeNum: Int): Node
Link copied to clipboard
open fun getUser(userId: String?): User
Link copied to clipboard

True if the waypoint with id was created by this device (vs. received from another node over the mesh).

Link copied to clipboard

The standard wiring from a view model to MapFilterSheet.

Link copied to clipboard
fun sendWaypoint(wpt: Waypoint, contactKey: String = "0")
Link copied to clipboard
fun setGeofenceAlertOptIn(waypointId: Int, enabled: Boolean)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
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 toggleRoleExcluded(role: Config.DeviceConfig.Role)

Toggles by name rather than through decodeExcludedRoles, which drops names the current protobufs do not define. Decoding and re-encoding here would discard a role excluded by a newer build on every toggle.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun BaseMapViewModel.tracerouteNodeSelection(tracerouteOverlay: TracerouteOverlay?, tracerouteNodePositions: Map<Int, Position>, nodes: List<Node>): TracerouteNodeSelection

Convenience extension that delegates to tracerouteNodeSelection using the VM's getNodeOrFallback.