Skip to main content
Version: 2.8

Transport

Meshtastic communicates between the app and radio hardware through multiple transport mechanisms.

Transport Abstraction​

The transport layer is abstracted through interfaces defined in core:repository (RadioTransport, RadioTransportFactory, RadioInterfaceService), with the concrete transports implemented in core:network (BleRadioTransport, 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., mock/replay) and core:ble. This lets the app work identically regardless of the underlying connection type.

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

Bluetooth Low Energy (BLE)​

Module: core:ble
Platforms: Android, Desktop (JVM via Kable), iOS (planned)

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

Key Classes​

  • core/ble/ — BLEBLE (Bluetooth Low Energy). The default wireless connection between a node and a phone client. scanning, connection, and GATT operations
  • 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

Key Classes​

  • Serial prober and transport factory in core/network
  • Desktop-specific serial in desktopApp/src/main/kotlin/.../radio/

TCP/IP​

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

Network-based transport for WiFi-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>
fun createTransport(address: String, service: RadioInterfaceService): RadioTransport
fun isMockTransport(): Boolean
fun isAddressValid(address: String?): Boolean
fun toInterfaceAddress(interfaceId: InterfaceId, rest: String): String
}

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: Planned BLEBLE (Bluetooth Low Energy). The default wireless connection between a node and a phone client. + 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.

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