CotXmlBuilder

Reconstructs a CoT (Cursor-on-Target) XML event string from a TakPacketV2Data.

The inverse of CotXmlParser: it walks the decoded data model and emits a standards-compliant <event>…</event> document that ATAK / iTAK / WinTAK and other CoT-compatible systems consume directly. Per-payload when branches write the matching <detail> children (chat, aircraft, shapes, markers, routes, casevac, emergency, task, TAK-Talk), and the dual color encoding is resolved back to a single ARGB int via AtakPalette.

Multiplatform: built only on kotlin.time and StringBuilder, so it runs on every KMP target. Stateless and safe to reuse across calls.

Lossy by design where CoT carries fields the wire format drops: stale is regenerated from the wall clock at build time (the wire carries stale_seconds, a duration), time / start come from the sender's start_epoch_lo14 when it supplied one and it reconstructs plausibly and are otherwise regenerated too, and a few elements ATAK requires for rendering (e.g. route <strokeColor>/<contact>) are synthesized from defaults rather than echoed from the source.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard

Build a complete CoT XML <event> document from packet.

Link copied to clipboard
fun buildWithOrigin(packet: TakPacketV2Data, now: Instant = Clock.System.now()): BuiltCot

As build, but also reports what became of the packet's start.