2020-02-17 13:34:52 -08:00
|
|
|
package com.geeksville.mesh.model
|
|
|
|
|
|
|
|
|
|
import androidx.compose.mutableStateOf
|
|
|
|
|
import com.geeksville.mesh.MeshUser
|
|
|
|
|
import com.geeksville.mesh.NodeInfo
|
|
|
|
|
import com.geeksville.mesh.Position
|
|
|
|
|
|
|
|
|
|
object NodeDB {
|
|
|
|
|
private val testPositions = arrayOf(
|
|
|
|
|
Position(32.776665, -96.796989, 35), // dallas
|
|
|
|
|
Position(32.960758, -96.733521, 35), // richardson
|
|
|
|
|
Position(
|
|
|
|
|
32.912901,
|
|
|
|
|
-96.781776,
|
|
|
|
|
35
|
|
|
|
|
) // north dallas
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
val testNodeNoPosition = NodeInfo(
|
|
|
|
|
8,
|
|
|
|
|
MeshUser(
|
|
|
|
|
"+16508765308".format(8),
|
|
|
|
|
"Kevin MesterNoLoc",
|
|
|
|
|
"KLO"
|
|
|
|
|
),
|
2020-02-19 10:53:36 -08:00
|
|
|
null
|
2020-02-17 13:34:52 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
val testNodes = testPositions.mapIndexed { index, it ->
|
|
|
|
|
NodeInfo(
|
|
|
|
|
9 + index,
|
|
|
|
|
MeshUser(
|
|
|
|
|
"+165087653%02d".format(9 + index),
|
|
|
|
|
"Kevin Mester$index",
|
|
|
|
|
"KM$index"
|
|
|
|
|
),
|
2020-02-19 10:53:36 -08:00
|
|
|
it
|
2020-02-17 13:34:52 -08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// The unique ID of our node
|
|
|
|
|
val myId = mutableStateOf("+16508765309")
|
|
|
|
|
|
|
|
|
|
/// A map from nodeid to to nodeinfo
|
2020-02-18 08:56:24 -08:00
|
|
|
val nodes = mutableMapOf(* testNodes.map { it.user!!.id to it }.toTypedArray())
|
2020-02-17 13:46:13 -08:00
|
|
|
|
2020-02-17 15:56:04 -08:00
|
|
|
/// Could be null if we haven't received our node DB yet
|
2020-02-18 20:19:40 -08:00
|
|
|
val ourNodeInfo get() = nodes[myId.value]
|
2020-02-17 13:34:52 -08:00
|
|
|
}
|