feat: add traceroute (#620)

This commit is contained in:
Andre K 2023-04-16 06:16:41 -03:00 committed by GitHub
parent 72c278c92c
commit da5f1d529d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 95 additions and 2 deletions

View file

@ -1734,13 +1734,21 @@ class MeshService : Service(), Logging {
override fun requestPosition(idNum: Int, position: Position) =
toRemoteExceptions {
val (lat, lon, alt) = with(position) { Triple(latitude, longitude, altitude) }
val (lat, lon, alt) = position
// request position
if (idNum != 0) sendPosition(time = 1, destNum = idNum, wantResponse = true)
// set local node's fixed position
else sendPosition(time = 0, destNum = null, lat = lat, lon = lon, alt = alt)
}
override fun requestTraceroute(requestId: Int, destNum: Int) = toRemoteExceptions {
sendToRadio(newMeshPacketTo(destNum).buildMeshPacket(id = requestId) {
portnumValue = Portnums.PortNum.TRACEROUTE_APP_VALUE
payload = routeDiscovery {}.toByteString()
wantResponse = true
})
}
override fun requestShutdown(idNum: Int) = toRemoteExceptions {
sendToRadio(newMeshPacketTo(idNum).buildAdminPacket {
shutdownSeconds = 5