mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Expose wantAck in Mesh Packet (#1703)
* Expose wantAck in Mesh Packet * Update DataPacket.kt * Update DataPacket.kt * Update DataPacket.kt * Update DataPacket.kt * Refactor: Change wantAck field type in DataPacket - Changed the `wantAck` field in `DataPacket` from `Int` to `Boolean`. - Updated read/write and equals/hashcode functions accordingly. * Update MeshService.kt * Update MeshService.kt --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com> Co-authored-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
123b296b6c
commit
3bc4454c0e
2 changed files with 8 additions and 1 deletions
|
|
@ -58,6 +58,7 @@ data class DataPacket(
|
|||
var status: MessageStatus? = MessageStatus.UNKNOWN,
|
||||
var hopLimit: Int = 0,
|
||||
var channel: Int = 0, // channel index
|
||||
var wantAck: Boolean = true, // If true, the receiver should send an ack back
|
||||
) : Parcelable {
|
||||
|
||||
/**
|
||||
|
|
@ -118,6 +119,7 @@ data class DataPacket(
|
|||
parcel.readParcelableCompat(MessageStatus::class.java.classLoader),
|
||||
parcel.readInt(),
|
||||
parcel.readInt(),
|
||||
parcel.readInt() == 1,
|
||||
)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
|
|
@ -135,6 +137,7 @@ data class DataPacket(
|
|||
if (!bytes!!.contentEquals(other.bytes!!)) return false
|
||||
if (status != other.status) return false
|
||||
if (hopLimit != other.hopLimit) return false
|
||||
if (wantAck != other.wantAck) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
@ -149,6 +152,7 @@ data class DataPacket(
|
|||
result = 31 * result + status.hashCode()
|
||||
result = 31 * result + hopLimit
|
||||
result = 31 * result + channel
|
||||
result = 31 * result + wantAck.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
|
|
@ -162,6 +166,7 @@ data class DataPacket(
|
|||
parcel.writeParcelable(status, flags)
|
||||
parcel.writeInt(hopLimit)
|
||||
parcel.writeInt(channel)
|
||||
parcel.writeInt(if (wantAck) 1 else 0)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
|
|
@ -179,6 +184,7 @@ data class DataPacket(
|
|||
status = parcel.readParcelableCompat(MessageStatus::class.java.classLoader)
|
||||
hopLimit = parcel.readInt()
|
||||
channel = parcel.readInt()
|
||||
wantAck = parcel.readInt() == 1
|
||||
}
|
||||
|
||||
companion object CREATOR : Parcelable.Creator<DataPacket> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue