fix: Propagate reply ID for DataPackets (#2177)

This commit is contained in:
James Rich 2025-06-19 23:20:07 +00:00 committed by GitHub
parent d66b7d5d0f
commit 38b949f9c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View file

@ -131,7 +131,7 @@ data class DataPacket(
parcel.readInt(),
parcel.readFloat(),
parcel.readInt(),
if (parcel.readInt() == 0) null else parcel.readInt()
parcel.readInt().let { if (it == 0) null else it }
)
@Suppress("CyclomaticComplexMethod")
@ -232,7 +232,8 @@ data class DataPacket(
const val PKC_CHANNEL_INDEX = 8
fun nodeNumToDefaultId(n: Int): String = "!%08x".format(n)
fun idToDefaultNodeNum(id: String?): Int? = runCatching { id?.toLong(16)?.toInt() }.getOrNull()
fun idToDefaultNodeNum(id: String?): Int? =
runCatching { id?.toLong(16)?.toInt() }.getOrNull()
override fun createFromParcel(parcel: Parcel): DataPacket {
return DataPacket(parcel)

View file

@ -692,6 +692,9 @@ class MeshService : Service(), Logging {
) {
portnumValue = p.dataType
payload = ByteString.copyFrom(p.bytes)
if (p.replyId != null && p.replyId != 0) {
this.replyId = p.replyId!!
}
}
}