kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
rodzic
425763627d
commit
391a8be499
|
@ -123,7 +123,10 @@ class RadioConfigViewModel @Inject constructor(
|
||||||
val total = maxOf(requestIds.value.size, state.responseState.total)
|
val total = maxOf(requestIds.value.size, state.responseState.total)
|
||||||
state.copy(responseState = state.responseState.copy(total = total))
|
state.copy(responseState = state.responseState.copy(total = total))
|
||||||
} else {
|
} else {
|
||||||
state.copy(responseState = ResponseState.Loading())
|
state.copy(
|
||||||
|
route = "", // setter (response is PortNum.ROUTING_APP)
|
||||||
|
responseState = ResponseState.Loading(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ex: RemoteException) {
|
} catch (ex: RemoteException) {
|
||||||
|
@ -410,7 +413,7 @@ class RadioConfigViewModel @Inject constructor(
|
||||||
private fun processPacketResponse(log: MeshLog?) {
|
private fun processPacketResponse(log: MeshLog?) {
|
||||||
val packet = log?.meshPacket ?: return
|
val packet = log?.meshPacket ?: return
|
||||||
val data = packet.decoded
|
val data = packet.decoded
|
||||||
requestIds.update { it.apply { put(data.requestId, true) } }
|
val route = radioConfigState.value.route
|
||||||
|
|
||||||
// val destNum = destNode.value?.num ?: return
|
// val destNum = destNode.value?.num ?: return
|
||||||
val debugMsg =
|
val debugMsg =
|
||||||
|
@ -421,7 +424,8 @@ class RadioConfigViewModel @Inject constructor(
|
||||||
debug(debugMsg.format(parsed.errorReason.name))
|
debug(debugMsg.format(parsed.errorReason.name))
|
||||||
if (parsed.errorReason != MeshProtos.Routing.Error.NONE) {
|
if (parsed.errorReason != MeshProtos.Routing.Error.NONE) {
|
||||||
setResponseStateError(parsed.errorReason.name)
|
setResponseStateError(parsed.errorReason.name)
|
||||||
} else if (packet.from == destNum) {
|
} else if (packet.from == destNum && route.isEmpty()) {
|
||||||
|
requestIds.update { it.apply { put(data.requestId, true) } }
|
||||||
if (requestIds.value.filterValues { !it }.isEmpty()) setResponseStateSuccess()
|
if (requestIds.value.filterValues { !it }.isEmpty()) setResponseStateSuccess()
|
||||||
else incrementCompleted()
|
else incrementCompleted()
|
||||||
}
|
}
|
||||||
|
@ -434,7 +438,7 @@ class RadioConfigViewModel @Inject constructor(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// check if destination is channel editor
|
// check if destination is channel editor
|
||||||
val goChannels = radioConfigState.value.route == ConfigRoute.CHANNELS.name
|
val goChannels = route == ConfigRoute.CHANNELS.name
|
||||||
when (parsed.payloadVariantCase) {
|
when (parsed.payloadVariantCase) {
|
||||||
AdminProtos.AdminMessage.PayloadVariantCase.GET_CHANNEL_RESPONSE -> {
|
AdminProtos.AdminMessage.PayloadVariantCase.GET_CHANNEL_RESPONSE -> {
|
||||||
val response = parsed.getChannelResponse
|
val response = parsed.getChannelResponse
|
||||||
|
@ -493,6 +497,7 @@ class RadioConfigViewModel @Inject constructor(
|
||||||
|
|
||||||
else -> TODO()
|
else -> TODO()
|
||||||
}
|
}
|
||||||
|
requestIds.update { it.apply { put(data.requestId, true) } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,7 +593,6 @@ class UIViewModel @Inject constructor(
|
||||||
private fun processPacketResponse(log: MeshLog?) {
|
private fun processPacketResponse(log: MeshLog?) {
|
||||||
val packet = log?.meshPacket ?: return
|
val packet = log?.meshPacket ?: return
|
||||||
val data = packet.decoded
|
val data = packet.decoded
|
||||||
requestIds.update { it.apply { put(data.requestId, true) } }
|
|
||||||
|
|
||||||
if (data?.portnumValue == Portnums.PortNum.TRACEROUTE_APP_VALUE) {
|
if (data?.portnumValue == Portnums.PortNum.TRACEROUTE_APP_VALUE) {
|
||||||
val parsed = MeshProtos.RouteDiscovery.parseFrom(data.payload)
|
val parsed = MeshProtos.RouteDiscovery.parseFrom(data.payload)
|
||||||
|
@ -605,6 +604,7 @@ class UIViewModel @Inject constructor(
|
||||||
parsed.routeList.forEach { num -> append("${nodeName(num)} --> ") }
|
parsed.routeList.forEach { num -> append("${nodeName(num)} --> ") }
|
||||||
append(nodeName(packet.from))
|
append(nodeName(packet.from))
|
||||||
}
|
}
|
||||||
|
requestIds.update { it.apply { put(data.requestId, true) } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue