Transport
Meshtastic communicates between the app and radio hardware through multiple transport mechanisms.
Transport Abstraction
The transport layer is abstracted through interfaces in core/network and core/ble, allowing the app to 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 protobuf packets
- Connection state management and automatic reconnection
- MTU negotiation for optimal packet sizes
Key Classes
core/ble/β BLE scanning, connection, and GATT operations- Platform-specific implementations in
androidMainandjvmMain(Kable)
USB Serial
Module: core:network
Platforms: Android (OTG), Desktop
Serial communication over USB:
- Uses
usb-serial-for-androidlibrary on Android - Direct serial port access on Desktop (JVM)
- Probe table for supported USB vendor/product IDs
- Automatic detection when USB 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
Network-based transport for WiFi-enabled radios:
- TCP socket connection to radioβs IP address
- Default port: 4403
- Used for development with simulated radios
- Available when BLE/USB 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 BLE + USB + TCP
- Desktop: Supports BLE (Kable) + USB + TCP
- iOS: Planned BLE + TCP
Connection Lifecycle
- Discovery β Scan for available radios (BLE scan / USB detect / manual TCP)
- 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