mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-09-12 21:30:02 -04:00
chore(discovery): remove the scan state nothing ever enters (#6971)
This commit is contained in:
1 parent
a0760d0ea1
commit
08e3673797
6 files changed
+5
-20
No files matched your search
Generated
-1
@@ -442,7 +442,6 @@ discovery_lora_presets_description
|
||||
discovery_map
|
||||
discovery_not_connected
|
||||
discovery_not_connected_description
|
||||
discovery_paused
|
||||
discovery_preparing
|
||||
discovery_preset_home_label
|
||||
discovery_reconnecting
|
||||
|
||||
@@ -472,7 +472,6 @@
|
||||
<string name="discovery_map">Discovery Map</string>
|
||||
<string name="discovery_not_connected">Not Connected</string>
|
||||
<string name="discovery_not_connected_description">Connect to a Meshtastic device to start scanning.</string>
|
||||
<string name="discovery_paused">Paused: %1$s</string>
|
||||
<string name="discovery_preparing">Preparing scan</string>
|
||||
<string name="discovery_preset_home_label">%1$s (Home)</string>
|
||||
<string name="discovery_reconnecting">Reconnecting on %1$s</string>
|
||||
|
||||
@@ -9,7 +9,7 @@ The `:feature:discovery` module implements **Local Mesh Discovery**: the app cyc
|
||||
## Scan Workflow
|
||||
|
||||
- `DiscoveryScanEngine` — core scan engine. Cycles through a queue of `ScanTarget`s, dwells on each while collecting packets, and persists aggregated results via `DiscoveryDao`.
|
||||
- `DiscoveryScanState` — state machine for the scan lifecycle: `Idle → Preparing → Shifting → [Reconnecting] → Dwell → … → Analysis → Complete`, with `Cancelling`/`Restoring`/`Failed`/`Paused` side paths.
|
||||
- `DiscoveryScanState` — state machine for the scan lifecycle: `Idle → Preparing → Shifting → [Reconnecting] → Dwell → … → Analysis → Complete`, with `Cancelling`/`Restoring`/`Failed` side paths.
|
||||
- `ScanTarget` — one queue entry. `channel == null` is a public-preset target; a non-null channel is a beacon-advertised custom channel: the engine tunes the radio's primary channel to that name+PSK (and region) for the dwell, then restores it.
|
||||
- `DiscoveryRankingEngine` (`scan/`) — ranks preset results by unique node count, neighbor diversity, non-duplicate packet count, and SNR.
|
||||
- `Check24GhzCapability` (`scan/`) — layered heuristic that determines whether the connected radio supports 2.4 GHz LoRa (SX1280), returning `Supported` / `Unsupported` / `Unknown`.
|
||||
|
||||
+4
-7
@@ -20,10 +20,10 @@ package org.meshtastic.feature.discovery
|
||||
* State machine for a discovery scan lifecycle.
|
||||
*
|
||||
* ```
|
||||
* Idle → Preparing → Shifting → [Reconnecting] → Dwell → Shifting (loop) → Analysis → Complete(Success)
|
||||
* Any scanning → Cancelling → Restoring → Complete(Cancelled)
|
||||
* Any scanning → Failed(reason) → Restoring → Complete(Failed)
|
||||
* Reconnecting timeout → Paused
|
||||
* Idle → Preparing → Shifting → Reconnecting → Dwell → Shifting (loop) → Analysis → Complete(Success)
|
||||
* Refused at start → Failed(reason)
|
||||
* Shift error, reconnect timeout, or aborted dwell → Analysis → Complete(Failed)
|
||||
* Any scanning → Cancelling → Complete(Cancelled)
|
||||
* ```
|
||||
*/
|
||||
sealed interface DiscoveryScanState {
|
||||
@@ -48,9 +48,6 @@ sealed interface DiscoveryScanState {
|
||||
/** Scan finished and results are persisted. */
|
||||
data class Complete(val outcome: CompletionOutcome = CompletionOutcome.Success) : DiscoveryScanState
|
||||
|
||||
/** Scan paused due to an unrecoverable transient condition (e.g. reconnect timeout). */
|
||||
data class Paused(val reason: String) : DiscoveryScanState
|
||||
|
||||
/** User-initiated cancellation in progress; persisting partial results before restoring home preset. */
|
||||
data object Cancelling : DiscoveryScanState
|
||||
|
||||
|
||||
-9
@@ -75,7 +75,6 @@ import org.meshtastic.core.resources.discovery_keep_screen_awake_description
|
||||
import org.meshtastic.core.resources.discovery_local_mesh
|
||||
import org.meshtastic.core.resources.discovery_not_connected
|
||||
import org.meshtastic.core.resources.discovery_not_connected_description
|
||||
import org.meshtastic.core.resources.discovery_paused
|
||||
import org.meshtastic.core.resources.discovery_preparing
|
||||
import org.meshtastic.core.resources.discovery_reconnecting
|
||||
import org.meshtastic.core.resources.discovery_restoring_preset
|
||||
@@ -496,14 +495,6 @@ private fun ScanProgressSection(scanState: DiscoveryScanState, modifier: Modifie
|
||||
)
|
||||
}
|
||||
|
||||
is DiscoveryScanState.Paused -> {
|
||||
Text(
|
||||
text = stringResource(Res.string.discovery_paused, scanState.reason),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.error,
|
||||
)
|
||||
}
|
||||
|
||||
is DiscoveryScanState.Failed -> {
|
||||
Text(
|
||||
text = stringResource(Res.string.discovery_scan_failed, scanState.reason),
|
||||
|
||||
@@ -423,7 +423,6 @@ These features were added during implementation for safety, reliability, and cro
|
||||
| Feature | Description | File(s) |
|
||||
|---|---|---|
|
||||
| Interrupted session recovery | `markInterruptedSessions()` DAO query on ViewModel init marks any lingering `in_progress` sessions as `interrupted`. Handles app process death mid-scan. | `DiscoveryDao.kt`, `DiscoveryViewModel.kt` |
|
||||
| Paused scan state | `DiscoveryScanState.Paused` provides a recoverable grace period during BLE reconnect before transitioning to `Failed`. Original spec only had direct `WaitingForReconnect → Failed`. | `DiscoveryScanState.kt` |
|
||||
| Infrastructure node classification | Nodes with `ROUTER`, `ROUTER_LATE`, or `CLIENT_BASE` roles flagged via `isInfrastructure` on entity. `infrastructureNodeCount` aggregated per preset result. Aligns with Apple's relay/infrastructure tracking. | `DiscoveryScanEngine.kt`, `DiscoveredNodeEntity.kt`, `DiscoveryPresetResultEntity.kt` |
|
||||
| Active NeighborInfo request | Engine actively requests `NeighborInfo` at dwell start and mid-dwell via `radioController.requestNeighborInfo()`. Original spec mentioned only passive collection. | `DiscoveryScanEngine.kt` |
|
||||
| Deprecated preset filtering | `VERY_LONG_SLOW` and `LONG_SLOW` presets hidden from picker per meshtastic/design standards deprecation. | `PresetPickerCard.kt` |
|
||||
|
||||
Reference in new issue
Block a user