NodeManager

Interface for managing the in-memory node database and processing received node information.

Properties

Link copied to clipboard
abstract val allowNodeDbWrites: StateFlow<Boolean>

Whether node database writes are allowed.

Link copied to clipboard
abstract val isNodeDbReady: StateFlow<Boolean>

Whether the node database is ready.

Link copied to clipboard
abstract val myNodeNum: StateFlow<Int?>

The local node number as a thread-safe StateFlow.

Link copied to clipboard
abstract val nodeDBbyID: Map<String, Node>

Reactive map of all nodes by their ID string.

Link copied to clipboard
abstract val nodeDBbyNodeNum: Map<Int, Node>

Reactive map of all nodes by their number.

Functions

Link copied to clipboard
abstract fun clear()

Clears the in-memory node database.

Link copied to clipboard
abstract fun getMyId(): String

Returns the local node ID.

Link copied to clipboard
abstract fun getMyNodeInfo(): MyNodeInfo?

Returns information about the local node.

Link copied to clipboard
abstract fun getNodes(): List<NodeInfo>

Returns a list of all known nodes.

Link copied to clipboard
abstract fun handleReceivedNodeStatus(fromNum: Int, s: StatusMessage)

Processes a received node status message.

Link copied to clipboard
abstract fun handleReceivedPaxcounter(fromNum: Int, p: Paxcount)

Processes a received paxcounter packet.

Link copied to clipboard
abstract fun handleReceivedPosition(fromNum: Int, myNodeNum: Int, p: Position, defaultTime: Long)

Processes a received position packet.

Link copied to clipboard
abstract fun handleReceivedTelemetry(fromNum: Int, telemetry: Telemetry)

Processes a received telemetry packet.

Link copied to clipboard
abstract fun handleReceivedUser(fromNum: Int, p: User, channel: Int = 0, manuallyVerified: Boolean = false)

Processes a received user packet.

Link copied to clipboard
abstract fun insertMetadata(nodeNum: Int, metadata: DeviceMetadata)

Inserts hardware metadata for a node.

Link copied to clipboard
abstract fun installNodeInfo(info: NodeInfo, withBroadcast: Boolean = true)

Installs node information from a ProtoNodeInfo object.

Link copied to clipboard
abstract fun loadCachedNodeDB()

Loads the cached node database from the repository.

Link copied to clipboard
abstract fun removeByNodenum(nodeNum: Int)

Removes a node from the in-memory database by its number.

Link copied to clipboard
abstract fun setAllowNodeDbWrites(allowed: Boolean)

Sets whether node database writes are allowed.

Link copied to clipboard
abstract fun setMyNodeNum(num: Int?)

Sets the local node number.

Link copied to clipboard
abstract fun setNodeDbReady(ready: Boolean)

Sets whether the node database is ready.

Link copied to clipboard
abstract fun toNodeID(nodeNum: Int): String
Link copied to clipboard
abstract fun updateNode(nodeNum: Int, withBroadcast: Boolean = true, channel: Int = 0, transform: (Node) -> Node)

Updates a node using a transformation function.

Link copied to clipboard
abstract fun updateNodeStatus(nodeNum: Int, status: String?)

Updates the status string for a node.