TakPacketV2Data

data class TakPacketV2Data(val cotTypeId: Int = CotTypeMapper.COTTYPE_OTHER, val cotTypeStr: String? = null, val how: Int = CotTypeMapper.COTHOW_UNSPECIFIED, val callsign: String = "", val team: Int = 0, val role: Int = 0, val latitudeI: Int = 0, val longitudeI: Int = 0, val altitude: Int = 0, val speed: Int = 0, val course: Int = 0, val battery: Int = 0, val geoSrc: Int = 0, val altSrc: Int = 0, val uid: String = "", val deviceCallsign: String = "", val staleSeconds: Int = 0, val takVersion: String = "", val takDevice: String = "", val takPlatform: String = "", val takOs: String = "", val endpoint: String = "", val phone: String = "", val remarks: String = "", val environment: TakPacketV2Data.EnvironmentData? = null, val sensorFov: TakPacketV2Data.SensorFovData? = null, val marti: List<String> = emptyList(), val payload: TakPacketV2Data.Payload = Payload.None)(source)

Platform-agnostic data model for a TAKPacketV2 — the SDK's internal representation, decoupled from any specific protobuf library.

The parser (CotXmlParser) produces it from CoT XML; the builder (CotXmlBuilder) renders it back; TakPacketV2Serializer converts it to/from protobuf wire bytes (each platform uses its native protobuf library).

Shape: 26 envelope fields (the always-present scalars below) plus a single payload of type Payload (a sealed hierarchy with one variant per oneof arm). Two optional top-level annotations — environment and sensorFov — attach to any payload variant. PLI is implicit: there is no bool pli field; a packet whose payload is Payload.None (modeled here as Payload.Pli) and whose cotTypeId is an a-f-* friendly type IS a PLI position report.

All numeric fields carry the wire units documented per-property below (degrees×1e7 coordinates, cm/s speed, degrees×100 course, meters-HAE altitude); the data model stores already-converted integers, not floats.

Constructors

Link copied to clipboard
constructor(cotTypeId: Int = CotTypeMapper.COTTYPE_OTHER, cotTypeStr: String? = null, how: Int = CotTypeMapper.COTHOW_UNSPECIFIED, callsign: String = "", team: Int = 0, role: Int = 0, latitudeI: Int = 0, longitudeI: Int = 0, altitude: Int = 0, speed: Int = 0, course: Int = 0, battery: Int = 0, geoSrc: Int = 0, altSrc: Int = 0, uid: String = "", deviceCallsign: String = "", staleSeconds: Int = 0, takVersion: String = "", takDevice: String = "", takPlatform: String = "", takOs: String = "", endpoint: String = "", phone: String = "", remarks: String = "", environment: TakPacketV2Data.EnvironmentData? = null, sensorFov: TakPacketV2Data.SensorFovData? = null, marti: List<String> = emptyList(), payload: TakPacketV2Data.Payload = Payload.None)

Types

Link copied to clipboard
data class EnvironmentData(val temperatureCelsius: Double? = null, val windDirectionDeg: Int? = null, val windSpeedMetersPerSec: Double? = null)

Weather annotation from a CoT <environment> detail element.

Link copied to clipboard
sealed class Payload

The packet's payload variant — the SDK-side model of the TAKPacketV2 payload_variant oneof. Exactly one subtype is present per packet.

Link copied to clipboard
data class SensorFovData(val type: TakPacketV2Data.SensorFovData.SensorType = SensorType.Unspecified, val azimuthDeg: Int = 270, val rangeMeters: Int? = null, val fovHorizontalDeg: Int = 45, val fovVerticalDeg: Int? = null, val elevationDeg: Int = 0, val rollDeg: Int? = null, val model: String? = null)

Sensor field-of-view cone from a CoT <sensor> detail element.

Properties

Link copied to clipboard

altitude in meters HAE (height above ellipsoid); may be negative.

Link copied to clipboard
val altSrc: Int

altitude source as a GeoPointSource enum int.

Link copied to clipboard

battery charge, 0–100 percent (0 = not reported).

Link copied to clipboard

the unit / operator callsign.

Link copied to clipboard

well-known CoT type as a CotType enum int (see CotTypeMapper); CotTypeMapper.COTTYPE_OTHER when the type is unknown.

Link copied to clipboard

raw CoT type string, set only when cotTypeId is CotTypeMapper.COTTYPE_OTHER so unknown types round-trip losslessly; null otherwise.

Link copied to clipboard
val course: Int

course over ground in degrees × 100 (0..36000); clamped to ≥ 0.

Link copied to clipboard

device identifier from <uid Droid="…"/>.

Link copied to clipboard

contact endpoint; not carried over the mesh (normalized to empty on parse, defaulted to the TAK server-reply form on build).

Link copied to clipboard

Observed weather annotation from <environment> CoT detail element. Attaches to any payload variant. null means the source XML had no <environment> element — preserved as proto3 optional on the wire.

Link copied to clipboard
val geoSrc: Int

position source as a GeoPointSource enum int (see the GEOSRC_* constants in CotXmlParser).

Link copied to clipboard
val how: Int

coordinate-generation method as a CotHow enum int (see CotTypeMapper).

Link copied to clipboard

latitude in degrees × 1e7 (sfixed32 wire convention).

Link copied to clipboard

longitude in degrees × 1e7 (sfixed32 wire convention).

Link copied to clipboard

Directed-routing recipient callsigns from <marti><dest callsign='…'/>…</marti>.

Link copied to clipboard
Link copied to clipboard

contact phone number.

Link copied to clipboard

optional free-text <remarks> for non-chat payload types; stripped by TakCompressor.compressWithRemarksFallback when over MTU.

Link copied to clipboard
val role: Int

MemberRole enum value, 0 = unspecified.

Link copied to clipboard

Sensor field-of-view cone from <sensor> CoT detail element. Attaches to any payload variant. null means the source XML had no <sensor> element.

Link copied to clipboard
val speed: Int

ground speed in cm/s (ATAK m/s × 100); clamped to ≥ 0.

Link copied to clipboard

seconds from the event's time to its stale timestamp; the builder floors this at 45 s on emit.

Link copied to clipboard

TAK device model string.

Link copied to clipboard

TAK client OS string.

Link copied to clipboard

TAK platform (ATAK-CIV, iTAK, WinTAK).

Link copied to clipboard

TAK client version string.

Link copied to clipboard
val team: Int

Team palette enum value (1..14; see AtakPalette), 0 = unspecified.

Link copied to clipboard
val uid: String

the CoT event UID (kept as a string — never packed to raw bytes).

Functions

Link copied to clipboard

Convenience: get the CoT type as a string, resolving enum or fallback.

Link copied to clipboard

Convenience: get the how as a string.