Files
Meshtastic-Android/core/network
James Rich b708b2ff76 feat: implement batched NodeInfo delivery in handshake protocol
This commit introduces support for `NodeInfoBatch` messages, allowing the application to receive and process multiple node records efficiently during the second stage of the device handshake. This replaces the legacy approach of sending node information individually, improving synchronization performance.

Key changes include:

- **Handshake Protocol:**
    - Added `BATCH_NODE_INFO_NONCE` to `HandshakeConstants`.
    - Updated `MeshConnectionManagerImpl` to request batched node information by default during the handshake process.
    - Updated `MeshConfigFlowManagerImpl` to handle the batch-specific completion nonce, ensuring Stage 2 of the handshake finalizes correctly.

- **Packet Handling:**
    - Enhanced `FromRadioPacketHandlerImpl` to detect `node_info_batch` packets.
    - Implemented logic to iterate through batched items and process each `NodeInfo` record via the `MeshConfigFlowManager`.
    - Updated connection progress reporting to reflect the count of nodes received within a batch.

- **Testing and Simulation:**
    - Updated `MockInterface` to simulate batched node delivery, refactoring the mock response logic into distinct Stage 1 (config) and Stage 2 (node info) phases.
    - Added a unit test in `FromRadioPacketHandlerImplTest` to verify that batched items are correctly routed and that the UI connection status is updated.

Specific changes:
- Modified `HandshakeConstants` to document the transition to batched NodeInfo delivery in Stage 2.
- Updated `MeshConnectionManagerImpl.startNodeInfoOnly()` to use the new batch nonce.
- Added `nodeInfoBatch` processing branch to the `handleFromRadio` logic.
2026-04-03 10:51:17 -05:00
..

:core:network

Overview

The :core:network module handles all internet-based communication, including fetching firmware metadata, device hardware definitions, and map tiles (in the fdroid flavor). It also provides the shared radio transport layer (TCPInterface, SerialTransport, BleRadioInterface).

Key Components

1. Ktor Client

The module uses Ktor as its primary HTTP client for high-performance, asynchronous networking.

2. Remote Data Sources

  • FirmwareReleaseRemoteDataSource: Fetches the latest firmware versions from GitHub or Meshtastic's metadata servers.
  • DeviceHardwareRemoteDataSource: Fetches definitions for supported Meshtastic hardware devices.

3. Shared Transports

  • BleRadioInterface: Multiplatform BLE transport powered by Kable.
  • TCPInterface: Multiplatform TCP transport.
  • SerialTransport: JVM-shared USB/Serial transport powered by jSerialComm.
  • BaseRadioTransportFactory: Common factory for instantiating the KMP transports.

Module dependency graph

graph TB
  :core:network[network]:::kmp-library

classDef android-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef android-application-compose fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef compose-desktop-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef android-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
classDef android-library fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
classDef android-library-compose fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
classDef android-test fill:#A0C4FF,stroke:#000,stroke-width:2px,color:#000;
classDef jvm-library fill:#BDB2FF,stroke:#000,stroke-width:2px,color:#000;
classDef kmp-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
classDef kmp-library-compose fill:#FFC1CC,stroke:#000,stroke-width:2px,color:#000;
classDef kmp-library fill:#FFC1CC,stroke:#000,stroke-width:2px,color:#000;
classDef unknown fill:#FFADAD,stroke:#000,stroke-width:2px,color:#000;