Cot Xml Builder
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: the time / start / stale timestamps are regenerated from the wall clock at build time (the wire carries only stale_seconds), and a few elements ATAK requires for rendering (e.g. route <strokeColor>/<contact>) are synthesized from defaults rather than echoed from the source.
Functions
Build a complete CoT XML <event> document from packet.