mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: simplify position requests
This commit is contained in:
parent
d7812c5777
commit
0187bc4c72
1 changed files with 7 additions and 2 deletions
|
|
@ -1894,7 +1894,13 @@ class MeshService : Service(), Logging {
|
||||||
override fun requestPosition(destNum: Int, position: Position) = toRemoteExceptions {
|
override fun requestPosition(destNum: Int, position: Position) = toRemoteExceptions {
|
||||||
if (destNum != myNodeNum) {
|
if (destNum != myNodeNum) {
|
||||||
// request position
|
// request position
|
||||||
sendPosition(destNum = destNum, wantResponse = true)
|
sendToRadio(newMeshPacketTo(destNum).buildMeshPacket(
|
||||||
|
channel = nodeDBbyNodeNum[destNum]?.channel ?: 0,
|
||||||
|
priority = MeshPacket.Priority.BACKGROUND,
|
||||||
|
) {
|
||||||
|
portnumValue = Portnums.PortNum.POSITION_APP_VALUE
|
||||||
|
wantResponse = true
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
// send fixed position (local only/no remote method, so we force destNum to null)
|
// send fixed position (local only/no remote method, so we force destNum to null)
|
||||||
val (lat, lon, alt) = position
|
val (lat, lon, alt) = position
|
||||||
|
|
@ -1924,7 +1930,6 @@ class MeshService : Service(), Logging {
|
||||||
channel = nodeDBbyNodeNum[destNum]?.channel ?: 0,
|
channel = nodeDBbyNodeNum[destNum]?.channel ?: 0,
|
||||||
) {
|
) {
|
||||||
portnumValue = Portnums.PortNum.TRACEROUTE_APP_VALUE
|
portnumValue = Portnums.PortNum.TRACEROUTE_APP_VALUE
|
||||||
payload = routeDiscovery {}.toByteString()
|
|
||||||
wantResponse = true
|
wantResponse = true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue