TetherExtension

A feature added on top of the link without changing the core apps (protocol §7, docs/EXTENDING.md).

The registry calls an extension only for its own message types, never for a core one, and catches everything it throws: a failing extension cannot break calls, texts or the session. Calls arrive on the host's extension thread (one thread, in order); status may be called from another thread and must be quick.

Inheritors

Properties

Link copied to clipboard
abstract val id: String

x.<reverse-dns>, for example x.com.example.battery; x.tether.* is reserved for this repository.

Link copied to clipboard
open val types: Set<String>

The message types it handles and sends: id itself or <id>.<name>.

Link copied to clipboard
open val versions: List<Int>

Major versions this build speaks; announced as <id>/<major> in caps.

Functions

Link copied to clipboard
open fun onLink(session: ExtensionSession, up: Boolean)

A peer that speaks a common version came (up) or went (link down, version withdrawn, extension switched off). A change between two common versions is no new up: ExtensionSession.version always tells the agreed one.

Link copied to clipboard
abstract fun onMessage(session: ExtensionSession, message: Message)

A message of one of types from the peer, or an error answering a request this extension sent. A request carries id (answer with ExtensionSession.reply); an answer carries re.

Link copied to clipboard
open fun start(host: ExtensionHost)
Link copied to clipboard
open fun status(): JSONObject?

Optional fields for the Android phone's status.ext[id] (≤ 1 KiB encoded), or null. Phone only.

Link copied to clipboard
open fun stop()