TAKServer

interface TAKServer(source)

Platform-agnostic contract for the Meshtastic TAK server.

The production implementation on Android / JVM runs a TLS (mTLS) listener on port DEFAULT_TAK_PORT (8089) using a per-install server identity issued by a private CA on first start (see TakCertificateProvider). The exported .zip data package carries that install's client identity and CA, so it is only valid against this install.

The interface deliberately hides the platform socket / TLS primitives so that commonMain code (TAKServerManagerImpl, DI, tests) can depend on it without pulling javax.net.ssl.* into the common source set.

Properties

Link copied to clipboard

The per-install certificates this listener authenticates with.

Link copied to clipboard
abstract val connectionCount: StateFlow<Int>

Observable count of currently-connected TAK clients (ATAK/iTAK).

Link copied to clipboard

Whether this platform provides a local TAK listener.

Link copied to clipboard
abstract var onClientConnected: () -> Unit?

Callback invoked when a TAK client connects. Use to drain queued messages.

Link copied to clipboard
abstract var onMessage: (CoTMessage, TAKClientInfo?) -> Unit?

Callback invoked on the IO dispatcher for every inbound CoT message from a client.

Link copied to clipboard
abstract val rejectedConnectionCount: StateFlow<Int>

Observable count of connections rejected since the listener started because the client did not present this install's certificate. Surfaces the "ATAK still has the old data package" migration state in the UI.

Functions

Link copied to clipboard
abstract suspend fun broadcast(cotMessage: CoTMessage)

Broadcast a CoT message to every currently-connected client.

Link copied to clipboard
abstract suspend fun broadcastRawXml(xml: String)

Broadcast raw CoT XML to every currently-connected client. Used for mesh-originated messages that should be forwarded verbatim without re-parsing through the app's CoTXmlParser (which strips shape detail elements like strokeColor, fillColor, vertices, etc.).

Link copied to clipboard
abstract suspend fun hasConnections(): Boolean

Returns true if at least one TAK client is currently connected.

Link copied to clipboard
abstract suspend fun start(scope: CoroutineScope): Result<Unit>

Bind the listener and begin accepting connections. Idempotent if already running.

Link copied to clipboard
abstract fun stop()

Stop the listener, close all client sockets, and release OS resources.