Skip to main content
Version: 2.8

Transport

The app talks to the radio over three transports — BLEBLE (Bluetooth Low Energy). The default wireless connection between a node and a phone client., USBUSB (Universal Serial Bus). The wired connection used to power a device, flash firmware onto it, and communicate with it over serial. serial, and TCPTCP (Transmission Control Protocol). One of the three ways a client reaches a node, alongside serial and Bluetooth. Clients connect over TCP on port 4403. — behind one abstraction.

Transport Abstraction​

The transport layer is abstracted through interfaces defined in core:repository (RadioTransport, RadioTransportFactory, RadioInterfaceService). Each transport's concrete implementation lives in core:network: BleRadioTransport (BLEBLE (Bluetooth Low Energy). The default wireless connection between a node and a phone client.), TcpRadioTransport (TCPTCP (Transmission Control Protocol). One of the three ways a client reaches a node, alongside serial and Bluetooth. Clients connect over TCP on port 4403.), and SerialRadioTransport (Android USBUSB (Universal Serial Bus). The wired connection used to power a device, flash firmware onto it, and communicate with it over serial. serial), alongside MockRadioTransport and ReplayRadioTransport for development. core:ble supplies the lower-level BLEBLE (Bluetooth Low Energy). The default wireless connection between a node and a phone client. connection primitives (scanning, GATT, Kable wiring) that BleRadioTransport builds on — it does not implement RadioTransport itself. This lets the app work identically regardless of the underlying connection type.

App ← RadioController → Transport (BLE | Serial | TCP)

Bluetooth Low Energy (BLE)​

Module: core:network (the BleRadioTransport implementation) built on core:ble (BLEBLE (Bluetooth Low Energy). The default wireless connection between a node and a phone client. connection primitives)
Platforms: Android, Desktop (JVM via Kable); code compiles for iOS, but no iOS app ships

The primary transport for mobile devices and also available on desktop:

  • Service discovery for Meshtastic GATT services
  • Characteristic-based read/write for protobufProtobuf (Protocol Buffers). A method developed by Google for serializing structured data, used in Meshtastic for efficient communication protocol between devices. packets
  • Connection state management and automatic reconnection
  • MTU negotiation for optimal packet sizes

Where the Code Lives​

  • BleRadioTransport (core:network) — the RadioTransport implementation for BLEBLE (Bluetooth Low Energy). The default wireless connection between a node and a phone client.
  • core:ble — BLEBLE (Bluetooth Low Energy). The default wireless connection between a node and a phone client. scanning, connection, and GATT operations (BleScanner, BluetoothRepository, KableBleConnection), which BleRadioTransport consumes
  • Platform-specific implementations in androidMain and jvmMain (Kable)

USB Serial​

Module: core:network
Platforms: Android (OTG), Desktop

Serial communication over USBUSB (Universal Serial Bus). The wired connection used to power a device, flash firmware onto it, and communicate with it over serial.:

  • Uses usb-serial-for-android library on Android
  • Direct serial port access on Desktop (JVM)
  • Probe table for supported USBUSB (Universal Serial Bus). The wired connection used to power a device, flash firmware onto it, and communicate with it over serial. vendor/product IDs
  • Automatic detection when USBUSB (Universal Serial Bus). The wired connection used to power a device, flash firmware onto it, and communicate with it over serial. device is connected

Where the Code Lives​

  • SerialRadioTransport (core:network, androidMain) — the Android RadioTransport implementation
  • SerialTransport (core:network, jvmMain) — the shared serial-port transport Desktop builds on
  • DesktopRadioTransportFactory (desktopApp) — wires Desktop's jSerialComm-based serial connection

TCP/IP​

Module: core:network
Platforms: Android, Desktop (iOS: code compiles, but there's no iOS app target or RadioTransportFactory — see Transport Factory)

Network-based transport for Wi-Fi-enabled radios:

  • TCPTCP (Transmission Control Protocol). One of the three ways a client reaches a node, alongside serial and Bluetooth. Clients connect over TCP on port 4403. socket connection to radio's IP address
  • Default port: 4403
  • Used for development with simulated radios
  • Available when BLEBLE (Bluetooth Low Energy). The default wireless connection between a node and a phone client./USBUSB (Universal Serial Bus). The wired connection used to power a device, flash firmware onto it, and communicate with it over serial. is impractical

Transport Factory​

The RadioTransportFactory interface abstracts transport creation:

interface RadioTransportFactory {
val supportedDeviceTypes: List<DeviceType>

/** Whether the virtual demo transports (`m` mock / `r` replay) may be offered right now. */
val mockTransportEnabled: StateFlow<Boolean>

/** Whether this build ships a packet capture to replay, rather than degrading to plain mock. */
val isReplayTransportAvailable: Boolean

fun createTransport(address: String, service: RadioInterfaceService): RadioTransport
fun isAddressValid(address: String?): Boolean
fun toInterfaceAddress(interfaceId: InterfaceId, rest: String): String
}

mockTransportEnabled is a flow, not a one-shot check: the Android Demo Mode gesture (five taps on the Settings app-version row) unlocks the demo transports mid-session, and the device list has to notice. Every consumer must read that one flow — the visibility path and the isAddressValid admission path have to agree, or the demo entry appears and then refuses to connect.

Platform-specific implementations:

  • Android: Supports BLEBLE (Bluetooth Low Energy). The default wireless connection between a node and a phone client. + USBUSB (Universal Serial Bus). The wired connection used to power a device, flash firmware onto it, and communicate with it over serial. + TCPTCP (Transmission Control Protocol). One of the three ways a client reaches a node, alongside serial and Bluetooth. Clients connect over TCP on port 4403.
  • Desktop: Supports BLEBLE (Bluetooth Low Energy). The default wireless connection between a node and a phone client. (Kable) + USBUSB (Universal Serial Bus). The wired connection used to power a device, flash firmware onto it, and communicate with it over serial. + TCPTCP (Transmission Control Protocol). One of the three ways a client reaches a node, alongside serial and Bluetooth. Clients connect over TCP on port 4403.
  • iOS: Code compiles for BLEBLE (Bluetooth Low Energy). The default wireless connection between a node and a phone client. and TCPTCP (Transmission Control Protocol). One of the three ways a client reaches a node, alongside serial and Bluetooth. Clients connect over TCP on port 4403., but no RadioTransportFactory implementation exists and no iOS app ships

Connection Lifecycle​

  1. Discovery — Scan for available radios (BLEBLE (Bluetooth Low Energy). The default wireless connection between a node and a phone client. scan / USBUSB (Universal Serial Bus). The wired connection used to power a device, flash firmware onto it, and communicate with it over serial. detect / manual TCPTCP (Transmission Control Protocol). One of the three ways a client reaches a node, alongside serial and Bluetooth. Clients connect over TCP on port 4403.)
  2. Connection — Establish link to selected radio
  3. Handshake — Exchange node info and configuration
  4. Active — Normal message exchange
  5. Disconnection — Clean teardown or error recovery

Adding a New Transport​

  1. Implement RadioTransport interface
  2. Register in platform-specific RadioTransportFactory
  3. Add connection UI in feature:connections
  4. Update DI bindings for the platform