wip fix ack

This commit is contained in:
callebtc
2025-07-22 12:04:55 +02:00
parent 7417c651e3
commit 5cfc210060
2 changed files with 8 additions and 3 deletions
@@ -64,7 +64,7 @@ class BluetoothMeshService(private val context: Context) {
// Wire up PacketProcessor reference for recursive handling in MessageHandler // Wire up PacketProcessor reference for recursive handling in MessageHandler
messageHandler.packetProcessor = packetProcessor messageHandler.packetProcessor = packetProcessor
// startPeriodicDebugLogging() startPeriodicDebugLogging()
} }
/** /**
@@ -1,6 +1,7 @@
package com.bitchat.android.model package com.bitchat.android.model
import android.os.Parcelable import android.os.Parcelable
import com.google.gson.GsonBuilder
import kotlinx.parcelize.Parcelize import kotlinx.parcelize.Parcelize
import java.nio.ByteBuffer import java.nio.ByteBuffer
import java.nio.ByteOrder import java.nio.ByteOrder
@@ -351,12 +352,16 @@ data class DeliveryAck(
val recipientID: String, val recipientID: String,
val recipientNickname: String, val recipientNickname: String,
val timestamp: Date = Date(), val timestamp: Date = Date(),
val hopCount: UByte val hopCount: UInt
) : Parcelable { ) : Parcelable {
private val gson = GsonBuilder()
.setDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
.create()
fun encode(): ByteArray? { fun encode(): ByteArray? {
return try { return try {
com.google.gson.Gson().toJson(this).toByteArray(Charsets.UTF_8) gson.toJson(this).toByteArray(Charsets.UTF_8)
} catch (e: Exception) { } catch (e: Exception) {
null null
} }