move admin messages to nodes tab

This commit is contained in:
andrekir 2022-09-30 15:57:04 -03:00
parent a60013e2dd
commit b401c8bac3
9 changed files with 189 additions and 116 deletions

View file

@ -1341,7 +1341,7 @@ class MeshService : Service(), Logging {
else {
discardNodeDB()
debug("Installing new node DB")
myNodeInfo = newMyNodeInfo// Install myNodeInfo as current
myNodeInfo = newMyNodeInfo // Install myNodeInfo as current
newNodes.forEach(::installNodeInfo)
newNodes.clear() // Just to save RAM ;-)
@ -1383,24 +1383,30 @@ class MeshService : Service(), Logging {
})
}
private fun requestShutdown(nodeId: String) {
sendToRadio(newMeshPacketTo(toNodeNum(nodeId)).buildAdminPacket {
private fun requestShutdown(idNum: Int) {
sendToRadio(newMeshPacketTo(idNum).buildAdminPacket {
shutdownSeconds = 5
})
}
private fun requestReboot(nodeId: String) {
sendToRadio(newMeshPacketTo(toNodeNum(nodeId)).buildAdminPacket {
private fun requestReboot(idNum: Int) {
sendToRadio(newMeshPacketTo(idNum).buildAdminPacket {
rebootSeconds = 5
})
}
private fun requestFactoryReset(nodeId: String) {
sendToRadio(newMeshPacketTo(toNodeNum(nodeId)).buildAdminPacket {
private fun requestFactoryReset(idNum: Int) {
sendToRadio(newMeshPacketTo(idNum).buildAdminPacket {
factoryReset = 1
})
}
private fun requestNodedbReset(idNum: Int) {
sendToRadio(newMeshPacketTo(idNum).buildAdminPacket {
nodedbReset = 1
})
}
/**
* Start the modern (REV2) API configuration flow
*/
@ -1721,16 +1727,20 @@ class MeshService : Service(), Logging {
stopLocationRequests()
}
override fun requestShutdown(nodeId: String) = toRemoteExceptions {
this@MeshService.requestShutdown(nodeId)
override fun requestShutdown(idNum: Int) = toRemoteExceptions {
this@MeshService.requestShutdown(idNum)
}
override fun requestReboot(nodeId: String) = toRemoteExceptions {
this@MeshService.requestReboot(nodeId)
override fun requestReboot(idNum: Int) = toRemoteExceptions {
this@MeshService.requestReboot(idNum)
}
override fun requestFactoryReset(nodeId: String) = toRemoteExceptions {
this@MeshService.requestFactoryReset(nodeId)
override fun requestFactoryReset(idNum: Int) = toRemoteExceptions {
this@MeshService.requestFactoryReset(idNum)
}
override fun requestNodedbReset(idNum: Int) = toRemoteExceptions {
this@MeshService.requestNodedbReset(idNum)
}
}
}