DataPacket

@Serializable
data class DataPacket(var to: String? = NodeAddress.ID_BROADCAST, var bytes: ByteString?, var dataType: Int, var from: String? = NodeAddress.ID_LOCAL, var time: Long = nowMillis, var id: Int = 0, var status: MessageStatus? = MessageStatus.UNKNOWN, var hopLimit: Int = 0, var channel: Int = 0, var wantAck: Boolean = true, var hopStart: Int = 0, var snr: Float? = null, var rssi: Int? = null, var replyId: Int? = null, var relayNode: Int? = null, var relays: Int = 0, var viaMqtt: Boolean = false, var emoji: Int = 0, var sfppHash: ByteString? = null, var transportMechanism: Int = 0, var xeddsaSigned: Boolean = false, var ackProofStatus: Int = 0)(source)

A data class version of the protobuf MeshPacket + Data subpacket.

Constructors

Link copied to clipboard
constructor(to: String? = NodeAddress.ID_BROADCAST, bytes: ByteString?, dataType: Int, from: String? = NodeAddress.ID_LOCAL, time: Long = nowMillis, id: Int = 0, status: MessageStatus? = MessageStatus.UNKNOWN, hopLimit: Int = 0, channel: Int = 0, wantAck: Boolean = true, hopStart: Int = 0, snr: Float? = null, rssi: Int? = null, replyId: Int? = null, relayNode: Int? = null, relays: Int = 0, viaMqtt: Boolean = false, emoji: Int = 0, sfppHash: ByteString? = null, transportMechanism: Int = 0, xeddsaSigned: Boolean = false, ackProofStatus: Int = 0)
constructor(to: String?, channel: Int, text: String, replyId: Int? = null)

Syntactic sugar to make it easy to create text messages

constructor(to: String?, channel: Int, waypoint: Waypoint)

Properties

Link copied to clipboard

The radio's verdict on the ack that closed out this outgoing packet (see MeshPacket.AckProofStatus). Written when the ack arrives, not when the packet is sent, so it stays absent for anything still enroute.

Link copied to clipboard
Link copied to clipboard
@Serializable(with = ByteStringSerializer::class)
var bytes: ByteString?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Type-safe interpretation of DataPacket.to.

Link copied to clipboard
var emoji: Int
Link copied to clipboard

If there was an error with this message, this string describes what was wrong.

Link copied to clipboard
var from: String?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var id: Int
Link copied to clipboard

Checks whether this packet is addressed to the broadcast channel.

Link copied to clipboard
Link copied to clipboard
var relays: Int
Link copied to clipboard
var replyId: Int?
Link copied to clipboard
var rssi: Int?

Received signal strength, or null when the radio did not report one. 0 dBm is a valid reading.

Link copied to clipboard
@Serializable(with = ByteStringSerializer::class)
var sfppHash: ByteString?
Link copied to clipboard
var snr: Float?

Signal-to-noise ratio in dB, or null when the packet carried no measurement. 0 dB is a valid reading.

Link copied to clipboard

Type-safe interpretation of DataPacket.from.

Link copied to clipboard
Link copied to clipboard
val text: String?

If this is a text message, return the string, otherwise null

Link copied to clipboard
var time: Long
Link copied to clipboard
var to: String?
Link copied to clipboard

The transport mechanism this packet arrived over (see MeshPacket.TransportMechanism).

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val waypoint: Waypoint?
Link copied to clipboard

True when the radio verified this broadcast's XEdDSA signature (MeshPacket.xeddsa_signed).

Functions

Link copied to clipboard
fun DataPacket.isFromLocal(myNodeNum: Int? = null): Boolean

Checks whether this packet originated from the local device.