DictionaryProvider

Loads and provides zstd compression dictionaries.

The raw dictionary bytes are fetched through the internal DictionaryLoader (a single commonMain object backed by the generated EmbeddedDictionaries, uniform across every target as of v0.6.0). This provider owns the canonical resource names, the dictionary-ID constants, and the aircraft-vs-non-aircraft selection rule.

Properties

Link copied to clipboard

Lazily-loaded bytes of the aircraft dictionary (DICT_ID_AIRCRAFT).

Link copied to clipboard
const val DICT_ID_AIRCRAFT: Int = 1

Dictionary ID for the 4 KB aircraft dictionary, used for Air-domain CoT types (3rd type atom = A). Encoded in flags-byte bits 0–5.

Link copied to clipboard
const val DICT_ID_NON_AIRCRAFT: Int = 0

Dictionary ID for the 512 KB non-aircraft, proto-trained dictionary — the default for PLI, chat, ground units, shapes, markers, routes, etc. Encoded in flags-byte bits 0–5 of the wire payload.

Link copied to clipboard
const val DICT_ID_UNCOMPRESSED: Int = 255

Reserved flags-byte value (0xFF) meaning the payload is raw, uncompressed TAKPacketV2 protobuf — no zstd, no dictionary. Emitted by the encoder's skip-compress path and by TAK_TRACKER firmware.

Link copied to clipboard

Lazily-loaded bytes of the non-aircraft dictionary (DICT_ID_NON_AIRCRAFT).

Functions

Link copied to clipboard
fun getDictionary(dictId: Int): ByteArray?

Return the dictionary bytes for a dictionary ID.

Link copied to clipboard
fun selectDictId(cotTypeId: Int, cotTypeStr: String?): Int

Pick the dictionary ID to compress a packet with, based on its CoT type.