mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-05-05 21:26:42 -04:00
feat(service): handle DeviceUIConfig and FileInfo packets (#2641)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
@@ -36,6 +36,7 @@ import com.geeksville.mesh.ChannelProtos
|
||||
import com.geeksville.mesh.ConfigProtos
|
||||
import com.geeksville.mesh.CoroutineDispatchers
|
||||
import com.geeksville.mesh.DataPacket
|
||||
import com.geeksville.mesh.DeviceUIProtos
|
||||
import com.geeksville.mesh.IMeshService
|
||||
import com.geeksville.mesh.LocalOnlyProtos.LocalConfig
|
||||
import com.geeksville.mesh.LocalOnlyProtos.LocalModuleConfig
|
||||
@@ -1479,6 +1480,10 @@ class MeshService :
|
||||
handleClientNotification(proto.clientNotification)
|
||||
}
|
||||
|
||||
MeshProtos.FromRadio.DEVICEUICONFIG_FIELD_NUMBER -> handleDevicUiConfig(proto.deviceuiConfig)
|
||||
|
||||
MeshProtos.FromRadio.FILEINFO_FIELD_NUMBER -> handleFileInfo(proto.fileInfo)
|
||||
|
||||
else -> errormsg("Unexpected FromRadio variant")
|
||||
}
|
||||
} catch (ex: InvalidProtocolBufferException) {
|
||||
@@ -1689,6 +1694,32 @@ class MeshService :
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleDevicUiConfig(deviceuiConfig: DeviceUIProtos.DeviceUIConfig) {
|
||||
debug("Received DeviceUIConfig ${deviceuiConfig.toOneLineString()}")
|
||||
val packetToSave =
|
||||
MeshLog(
|
||||
uuid = UUID.randomUUID().toString(),
|
||||
message_type = "DeviceUIConfig",
|
||||
received_date = System.currentTimeMillis(),
|
||||
raw_message = deviceuiConfig.toString(),
|
||||
fromRadio = fromRadio { this.deviceuiConfig = deviceuiConfig },
|
||||
)
|
||||
insertMeshLog(packetToSave)
|
||||
}
|
||||
|
||||
private fun handleFileInfo(fileInfo: MeshProtos.FileInfo) {
|
||||
debug("Received FileInfo ${fileInfo.toOneLineString()}")
|
||||
val packetToSave =
|
||||
MeshLog(
|
||||
uuid = UUID.randomUUID().toString(),
|
||||
message_type = "FileInfo",
|
||||
received_date = System.currentTimeMillis(),
|
||||
raw_message = fileInfo.toString(),
|
||||
fromRadio = fromRadio { this.fileInfo = fileInfo },
|
||||
)
|
||||
insertMeshLog(packetToSave)
|
||||
}
|
||||
|
||||
/** Update our DeviceMetadata */
|
||||
private fun handleMetadata(metadata: MeshProtos.DeviceMetadata) {
|
||||
debug("Received deviceMetadata ${metadata.toOneLineString()}")
|
||||
|
||||
Reference in New Issue
Block a user