feat: implement AdminMessage `session_passkey` handling

pull/1222/head^2
andrekir 2024-09-04 09:31:15 -03:00
rodzic 3182fad723
commit 716b75c6be
1 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -378,6 +378,7 @@ class MeshService : Service(), Logging {
private val configTotal by lazy { ConfigProtos.Config.getDescriptor().fields.size }
private val moduleTotal by lazy { ModuleConfigProtos.ModuleConfig.getDescriptor().fields.size }
private var sessionPasskey: ByteString = ByteString.EMPTY
private var localConfig: LocalConfig = LocalConfig.getDefaultInstance()
private var moduleConfig: LocalModuleConfig = LocalModuleConfig.getDefaultInstance()
@ -559,6 +560,7 @@ class MeshService : Service(), Logging {
portnumValue = Portnums.PortNum.ADMIN_APP_VALUE
payload = AdminProtos.AdminMessage.newBuilder().also {
initFn(it)
it.sessionPasskey = sessionPasskey
}.build().toByteString()
}
@ -768,7 +770,6 @@ class MeshService : Service(), Logging {
}
private fun handleReceivedAdmin(fromNodeNum: Int, a: AdminProtos.AdminMessage) {
// For the time being we only care about admin messages from our local node
if (fromNodeNum == myNodeNum) {
when (a.payloadVariantCase) {
AdminProtos.AdminMessage.PayloadVariantCase.GET_CONFIG_RESPONSE -> {
@ -792,6 +793,9 @@ class MeshService : Service(), Logging {
warn("No special processing needed for ${a.payloadVariantCase}")
}
} else {
debug("Admin: Received session_passkey from $fromNodeNum")
sessionPasskey = a.sessionPasskey
}
}
@ -1373,7 +1377,6 @@ class MeshService : Service(), Logging {
radioConfigRepository.setStatusMessage("Nodes (${newNodes.size} / 100)")
}
private var rawMyNodeInfo: MeshProtos.MyNodeInfo? = null
private var rawDeviceMetadata: MeshProtos.DeviceMetadata? = null