mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
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.
This commit is contained in:
parent
fda96e2f8c
commit
b708b2ff76
6 changed files with 95 additions and 42 deletions
|
|
@ -19,8 +19,8 @@ package org.meshtastic.core.repository
|
|||
/**
|
||||
* Shared constants for the two-stage mesh handshake protocol.
|
||||
*
|
||||
* Stage 1 (`CONFIG_NONCE`): requests device config, module config, and channels. Stage 2 (`NODE_INFO_NONCE`): requests
|
||||
* the full node database.
|
||||
* Stage 1 (`CONFIG_NONCE`): requests device config, module config, and channels. Stage 2 (`BATCH_NODE_INFO_NONCE`):
|
||||
* requests the full node database with batched NodeInfo delivery.
|
||||
*
|
||||
* Both [MeshConfigFlowManager] (consumer) and [MeshConnectionManager] (sender) reference these.
|
||||
*/
|
||||
|
|
@ -28,6 +28,9 @@ object HandshakeConstants {
|
|||
/** Nonce sent in `want_config_id` to request config-only (Stage 1). */
|
||||
const val CONFIG_NONCE = 69420
|
||||
|
||||
/** Nonce sent in `want_config_id` to request node info only (Stage 2). */
|
||||
/** Nonce sent in `want_config_id` to request node info only — unbatched legacy (Stage 2). */
|
||||
const val NODE_INFO_NONCE = 69421
|
||||
|
||||
/** Nonce sent in `want_config_id` to request node info only — batched (Stage 2). */
|
||||
const val BATCH_NODE_INFO_NONCE = 69423
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue