mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix(release): fixes to prep for release (#4546)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
c5f2b1bbea
commit
80d9a2e0aa
30 changed files with 2324 additions and 312 deletions
|
|
@ -162,7 +162,7 @@ constructor(
|
|||
val spinner: StateFlow<Boolean> = bluetoothRepository.isScanning
|
||||
|
||||
init {
|
||||
serviceRepository.statusMessage.onEach { errorText.value = it }.launchIn(viewModelScope)
|
||||
serviceRepository.connectionProgress.onEach { errorText.value = it }.launchIn(viewModelScope)
|
||||
Logger.d { "BTScanModel created" }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ constructor(
|
|||
metadata != null -> router.configFlowManager.handleLocalMetadata(metadata)
|
||||
nodeInfo != null -> {
|
||||
router.configFlowManager.handleNodeInfo(nodeInfo)
|
||||
serviceRepository.setStatusMessage("Nodes (${router.configFlowManager.newNodeCount})")
|
||||
serviceRepository.setConnectionProgress("Nodes (${router.configFlowManager.newNodeCount})")
|
||||
}
|
||||
configCompleteId != null -> router.configFlowManager.handleConfigComplete(configCompleteId)
|
||||
mqttProxyMessage != null -> mqttManager.handleMqttProxyMessage(mqttProxyMessage)
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ constructor(
|
|||
fun handleSetRemoteOwner(id: Int, destNum: Int, payload: ByteArray) {
|
||||
val u = User.ADAPTER.decode(payload)
|
||||
commandSender.sendAdmin(destNum, id) { AdminMessage(set_owner = u) }
|
||||
nodeManager.handleReceivedUser(destNum, u)
|
||||
}
|
||||
|
||||
fun handleGetRemoteOwner(id: Int, destNum: Int) {
|
||||
|
|
@ -237,6 +238,7 @@ constructor(
|
|||
fun handleSetModuleConfig(id: Int, destNum: Int, payload: ByteArray) {
|
||||
val c = ModuleConfig.ADAPTER.decode(payload)
|
||||
commandSender.sendAdmin(destNum, id) { AdminMessage(set_module_config = c) }
|
||||
c.statusmessage?.node_status?.let { status -> nodeManager.updateNodeStatus(destNum, status) }
|
||||
}
|
||||
|
||||
fun handleGetModuleConfig(id: Int, destNum: Int, config: Int) {
|
||||
|
|
|
|||
|
|
@ -59,12 +59,16 @@ constructor(
|
|||
|
||||
fun handleDeviceConfig(config: Config) {
|
||||
scope.handledLaunch { radioConfigRepository.setLocalConfig(config) }
|
||||
serviceRepository.setStatusMessage("Device config received")
|
||||
serviceRepository.setConnectionProgress("Device config received")
|
||||
}
|
||||
|
||||
fun handleModuleConfig(config: ModuleConfig) {
|
||||
scope.handledLaunch { radioConfigRepository.setLocalModuleConfig(config) }
|
||||
serviceRepository.setStatusMessage("Module config received")
|
||||
serviceRepository.setConnectionProgress("Module config received")
|
||||
|
||||
config.statusmessage?.node_status?.let { status ->
|
||||
nodeManager.myNodeNum?.let { num -> nodeManager.updateNodeStatus(num, status) }
|
||||
}
|
||||
}
|
||||
|
||||
fun handleChannel(ch: Channel) {
|
||||
|
|
@ -75,9 +79,9 @@ constructor(
|
|||
val mi = nodeManager.getMyNodeInfo()
|
||||
val index = ch.index ?: 0
|
||||
if (mi != null) {
|
||||
serviceRepository.setStatusMessage("Channels (${index + 1} / ${mi.maxChannels})")
|
||||
serviceRepository.setConnectionProgress("Channels (${index + 1} / ${mi.maxChannels})")
|
||||
} else {
|
||||
serviceRepository.setStatusMessage("Channels (${index + 1})")
|
||||
serviceRepository.setConnectionProgress("Channels (${index + 1})")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -335,6 +335,14 @@ constructor(
|
|||
u.session_passkey.let { commandSender.setSessionPasskey(it) }
|
||||
|
||||
val fromNum = packet.from
|
||||
u.get_module_config_response?.let { config ->
|
||||
if (fromNum == myNodeNum) {
|
||||
configHandler.handleModuleConfig(config)
|
||||
} else {
|
||||
config.statusmessage?.node_status?.let { nodeManager.updateNodeStatus(fromNum, it) }
|
||||
}
|
||||
}
|
||||
|
||||
if (fromNum == myNodeNum) {
|
||||
u.get_config_response?.let { configHandler.handleDeviceConfig(it) }
|
||||
u.get_channel_response?.let { configHandler.handleChannel(it) }
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ class MeshDataMapper @Inject constructor(private val nodeManager: MeshNodeManage
|
|||
relayNode = packet.relay_node,
|
||||
viaMqtt = packet.via_mqtt == true,
|
||||
emoji = decoded.emoji,
|
||||
transportMechanism = packet.transport_mechanism.value,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import kotlinx.coroutines.flow.launchIn
|
|||
import kotlinx.coroutines.flow.onEach
|
||||
import org.meshtastic.core.data.repository.MeshLogRepository
|
||||
import org.meshtastic.core.database.entity.MeshLog
|
||||
import org.meshtastic.core.model.util.isLora
|
||||
import org.meshtastic.core.service.ServiceRepository
|
||||
import org.meshtastic.proto.FromRadio
|
||||
import org.meshtastic.proto.LogRecord
|
||||
|
|
@ -205,11 +206,20 @@ constructor(
|
|||
}
|
||||
nodeManager.updateNodeInfo(from, withBroadcast = false, channel = packet.channel) {
|
||||
it.lastHeard = packet.rx_time
|
||||
it.snr = packet.rx_snr
|
||||
it.rssi = packet.rx_rssi
|
||||
it.viaMqtt = packet.via_mqtt == true
|
||||
it.lastTransport = packet.transport_mechanism.value
|
||||
|
||||
val isDirect = packet.hop_start == packet.hop_limit
|
||||
if (isDirect && packet.isLora() && !it.viaMqtt) {
|
||||
it.snr = packet.rx_snr
|
||||
it.rssi = packet.rx_rssi
|
||||
}
|
||||
|
||||
it.hopsAway =
|
||||
if (decoded.portnum == PortNum.RANGE_TEST_APP) {
|
||||
0
|
||||
} else if (it.viaMqtt) {
|
||||
-1
|
||||
} else if (packet.hop_start == 0 && (decoded.bitfield ?: 0) == 0) {
|
||||
-1
|
||||
} else if (packet.hop_limit > packet.hop_start) {
|
||||
|
|
|
|||
|
|
@ -214,7 +214,11 @@ constructor(
|
|||
}
|
||||
|
||||
fun handleReceivedNodeStatus(fromNum: Int, s: StatusMessage) {
|
||||
updateNodeInfo(fromNum) { it.nodeStatus = s.status }
|
||||
updateNodeStatus(fromNum, s.status)
|
||||
}
|
||||
|
||||
fun updateNodeStatus(nodeNum: Int, status: String) {
|
||||
updateNodeInfo(nodeNum) { it.nodeStatus = status }
|
||||
}
|
||||
|
||||
fun installNodeInfo(info: ProtoNodeInfo, withBroadcast: Boolean = true) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue