new play store release

This commit is contained in:
geeksville 2020-02-18 20:19:40 -08:00
parent c568b04354
commit aab062b06f
6 changed files with 67 additions and 60 deletions

View file

@ -47,5 +47,5 @@ object NodeDB {
val nodes = mutableMapOf(* testNodes.map { it.user!!.id to it }.toTypedArray())
/// Could be null if we haven't received our node DB yet
val ourNodeInfo get() = nodes[myId.value!!]
val ourNodeInfo get() = nodes[myId.value]
}

View file

@ -532,6 +532,51 @@ class MeshService : Service(), Logging {
}
}
/// We are reconnecting to a radio, redownload the full state. This operation might take hundreds of milliseconds
private fun reinitFromRadio() {
// Read the MyNodeInfo object
val myInfo = MeshProtos.MyNodeInfo.parseFrom(
connectedRadio.readMyNode()
)
val mynodeinfo = MyNodeInfo(myInfo.myNodeNum, myInfo.hasGps)
myNodeInfo = mynodeinfo
// Ask for the current node DB
connectedRadio.restartNodeInfo()
// read all the infos until we get back null
var infoBytes = connectedRadio.readNodeInfo()
while (infoBytes != null) {
val info =
MeshProtos.NodeInfo.parseFrom(infoBytes)
debug("Received initial nodeinfo $info")
// Just replace/add any entry
updateNodeInfo(info.num) {
if (info.hasUser())
it.user =
MeshUser(
info.user.id,
info.user.longName,
info.user.shortName
)
if (info.hasPosition())
it.position = Position(
info.position.latitude,
info.position.longitude,
info.position.altitude
)
it.lastSeen = info.lastSeen
}
// advance to next
infoBytes = connectedRadio.readNodeInfo()
}
}
/// Called when we gain/lose connection to our radio
private fun onConnectionChanged(c: Boolean) {
@ -540,53 +585,10 @@ class MeshService : Service(), Logging {
if (c) {
// Do our startup init
try {
// FIXME - don't do this until after we see that the radio is connected to the phone
//val sim = SimRadio(this@MeshService)
//sim.start() // Fake up our node id info and some past packets from other nodes
val myInfo = MeshProtos.MyNodeInfo.parseFrom(
connectedRadio.readMyNode()
)
val mynodeinfo = MyNodeInfo(myInfo.myNodeNum, myInfo.hasGps)
myNodeInfo = mynodeinfo
// Ask for the current node DB
connectedRadio.restartNodeInfo()
// read all the infos until we get back null
var infoBytes = connectedRadio.readNodeInfo()
while (infoBytes != null) {
val info =
MeshProtos.NodeInfo.parseFrom(infoBytes)
debug("Received initial nodeinfo $info")
// Just replace/add any entry
updateNodeInfo(info.num) {
if (info.hasUser())
it.user =
MeshUser(
info.user.id,
info.user.longName,
info.user.shortName
)
if (info.hasPosition())
it.position = Position(
info.position.latitude,
info.position.longitude,
info.position.altitude
)
it.lastSeen = info.lastSeen
}
// advance to next
infoBytes = connectedRadio.readNodeInfo()
}
reinitFromRadio()
// we don't ask for GPS locations from android if our device has a built in GPS
if (!mynodeinfo.hasGPS)
if (!myNodeInfo!!.hasGPS)
startLocationRequests()
else
debug("Our radio has a built in GPS, so not reading GPS in phone")

View file

@ -20,7 +20,7 @@ object SettingsLog : Logging
@Composable
fun SettingsContent() {
val typography = MaterialTheme.typography()
//val typography = MaterialTheme.typography()
val context = ambient(ContextAmbient)
Column(modifier = LayoutSize.Fill + LayoutPadding(16.dp)) {

View file

@ -148,9 +148,6 @@ message MeshPacket {
/// Shared constants between device and phone
enum Constants {
Unused = 0; // First enum must be zero, and we are just using this enum to pass int constants between two very different environments
/// # of legal channels
NumChannels = 13;
}
// Full settings (center freq, spread factor, pre-shared secret key etc...) needed to configure a radio for speaking on a particlar channel
@ -267,6 +264,9 @@ message MyNodeInfo {
/// if false it would be great if the phone can help provide gps coordinates
bool has_gps = 2;
/// # of legal channels (set at build time in the device flash image)
int32 num_channels = 3;
/// FIXME - add useful debugging state (queue depths etc)
}
@ -295,10 +295,10 @@ message DeviceState {
/// We bump up the integer values in this enum to indicate minimum levels of encodings for saved files
/// if your file is below the Minimum you should discard it.
Minimum = 12;
Minimum = 13;
/// The current value we are using for saved files
Current = 12;
Current = 13;
};
/// A version integer used to invalidate old save files when we make incompatible changes