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:
James Rich 2026-01-21 08:27:20 -06:00 committed by GitHub
parent 9b150bad42
commit 7f7d189958
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 83 additions and 75 deletions

View file

@ -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) {

View file

@ -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)