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
androidMainandjvmMain(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-androidlibrary 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
- 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.)
- Connection — Establish link to selected radio
- Handshake — Exchange node info and configuration
- Active — Normal message exchange
- Disconnection — Clean teardown or error recovery
Adding a New Transport
- Implement
RadioTransportinterface - Register in platform-specific
RadioTransportFactory - Add connection UI in
feature:connections - Update DI bindings for the platform