mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor(service): Add destination node number to remote admin commands (#4276)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
9b150bad42
commit
7f7d189958
7 changed files with 83 additions and 75 deletions
|
|
@ -203,9 +203,9 @@ constructor(
|
|||
commandSender.sendAdmin(myNodeNum, requestId) { removeByNodenum = nodeNum }
|
||||
}
|
||||
|
||||
fun handleSetRemoteOwner(id: Int, payload: ByteArray, myNodeNum: Int) {
|
||||
fun handleSetRemoteOwner(id: Int, destNum: Int, payload: ByteArray) {
|
||||
val u = MeshProtos.User.parseFrom(payload)
|
||||
commandSender.sendAdmin(myNodeNum, id) { setOwner = u }
|
||||
commandSender.sendAdmin(destNum, id) { setOwner = u }
|
||||
}
|
||||
|
||||
fun handleGetRemoteOwner(id: Int, destNum: Int) {
|
||||
|
|
@ -217,9 +217,9 @@ constructor(
|
|||
commandSender.sendAdmin(myNodeNum) { setConfig = c }
|
||||
}
|
||||
|
||||
fun handleSetRemoteConfig(id: Int, num: Int, payload: ByteArray) {
|
||||
fun handleSetRemoteConfig(id: Int, destNum: Int, payload: ByteArray) {
|
||||
val c = ConfigProtos.Config.parseFrom(payload)
|
||||
commandSender.sendAdmin(num, id) { setConfig = c }
|
||||
commandSender.sendAdmin(destNum, id) { setConfig = c }
|
||||
}
|
||||
|
||||
fun handleGetRemoteConfig(id: Int, destNum: Int, config: Int) {
|
||||
|
|
@ -232,9 +232,9 @@ constructor(
|
|||
}
|
||||
}
|
||||
|
||||
fun handleSetModuleConfig(id: Int, num: Int, payload: ByteArray) {
|
||||
fun handleSetModuleConfig(id: Int, destNum: Int, payload: ByteArray) {
|
||||
val c = ModuleConfigProtos.ModuleConfig.parseFrom(payload)
|
||||
commandSender.sendAdmin(num, id) { setModuleConfig = c }
|
||||
commandSender.sendAdmin(destNum, id) { setModuleConfig = c }
|
||||
}
|
||||
|
||||
fun handleGetModuleConfig(id: Int, destNum: Int, config: Int) {
|
||||
|
|
@ -264,10 +264,10 @@ constructor(
|
|||
}
|
||||
}
|
||||
|
||||
fun handleSetRemoteChannel(id: Int, num: Int, payload: ByteArray?) {
|
||||
fun handleSetRemoteChannel(id: Int, destNum: Int, payload: ByteArray?) {
|
||||
if (payload != null) {
|
||||
val c = ChannelProtos.Channel.parseFrom(payload)
|
||||
commandSender.sendAdmin(num, id) { setChannel = c }
|
||||
commandSender.sendAdmin(destNum, id) { setChannel = c }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -279,16 +279,16 @@ constructor(
|
|||
commandSender.requestNeighborInfo(requestId, destNum)
|
||||
}
|
||||
|
||||
fun handleBeginEditSettings(myNodeNum: Int) {
|
||||
commandSender.sendAdmin(myNodeNum) { beginEditSettings = true }
|
||||
fun handleBeginEditSettings(destNum: Int) {
|
||||
commandSender.sendAdmin(destNum) { beginEditSettings = true }
|
||||
}
|
||||
|
||||
fun handleCommitEditSettings(myNodeNum: Int) {
|
||||
commandSender.sendAdmin(myNodeNum) { commitEditSettings = true }
|
||||
fun handleCommitEditSettings(destNum: Int) {
|
||||
commandSender.sendAdmin(destNum) { commitEditSettings = true }
|
||||
}
|
||||
|
||||
fun handleRebootToDfu(myNodeNum: Int) {
|
||||
commandSender.sendAdmin(myNodeNum) { enterDfuModeRequest = true }
|
||||
fun handleRebootToDfu(destNum: Int) {
|
||||
commandSender.sendAdmin(destNum) { enterDfuModeRequest = true }
|
||||
}
|
||||
|
||||
fun handleRequestTelemetry(requestId: Int, destNum: Int, type: Int) {
|
||||
|
|
|
|||
|
|
@ -211,8 +211,8 @@ class MeshService : Service() {
|
|||
router.actionHandler.handleSetOwner(u, myNodeNum)
|
||||
}
|
||||
|
||||
override fun setRemoteOwner(id: Int, payload: ByteArray) = toRemoteExceptions {
|
||||
router.actionHandler.handleSetRemoteOwner(id, payload, myNodeNum)
|
||||
override fun setRemoteOwner(id: Int, destNum: Int, payload: ByteArray) = toRemoteExceptions {
|
||||
router.actionHandler.handleSetRemoteOwner(id, destNum, payload)
|
||||
}
|
||||
|
||||
override fun getRemoteOwner(id: Int, destNum: Int) = toRemoteExceptions {
|
||||
|
|
@ -275,12 +275,12 @@ class MeshService : Service() {
|
|||
router.actionHandler.handleGetRemoteChannel(id, destNum, index)
|
||||
}
|
||||
|
||||
override fun beginEditSettings() = toRemoteExceptions {
|
||||
router.actionHandler.handleBeginEditSettings(myNodeNum)
|
||||
override fun beginEditSettings(destNum: Int) = toRemoteExceptions {
|
||||
router.actionHandler.handleBeginEditSettings(destNum)
|
||||
}
|
||||
|
||||
override fun commitEditSettings() = toRemoteExceptions {
|
||||
router.actionHandler.handleCommitEditSettings(myNodeNum)
|
||||
override fun commitEditSettings(destNum: Int) = toRemoteExceptions {
|
||||
router.actionHandler.handleCommitEditSettings(destNum)
|
||||
}
|
||||
|
||||
override fun getChannelSet(): ByteArray = toRemoteExceptions {
|
||||
|
|
@ -333,7 +333,9 @@ class MeshService : Service() {
|
|||
router.actionHandler.handleRequestReboot(requestId, destNum)
|
||||
}
|
||||
|
||||
override fun rebootToDfu() = toRemoteExceptions { router.actionHandler.handleRebootToDfu(myNodeNum) }
|
||||
override fun rebootToDfu(destNum: Int) = toRemoteExceptions {
|
||||
router.actionHandler.handleRebootToDfu(destNum)
|
||||
}
|
||||
|
||||
override fun requestFactoryReset(requestId: Int, destNum: Int) = toRemoteExceptions {
|
||||
router.actionHandler.handleRequestFactoryReset(requestId, destNum)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue