mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat(remote-shell): PTY-over-mesh terminal with retro-CRT UI
Adds a full RemoteShell (portnum=13) implementation matching Jonathan's dmshell_client.py protocol: Protocol layer: - Seq/ack reliability: incrementing seq on every non-ACK frame, piggybacked ack_seq, out-of-order frame buffering, gap detection and replay requests - TX history ring buffer (last 50 frames) for retransmission on request - ACK frames carry optional 4-byte big-endian REPLAY_REQUEST payload - PING/PONG heartbeat with 8-byte status payload (lastTxSeq, lastRxSeq); PONG handler triggers replay if peer is behind - PKI: DataPacket.PKC_CHANNEL_INDEX so CommandSenderImpl applies Curve25519 encryption (firmware rejects non-PKI DMShell packets) - Input batching: 500ms debounce (matches Python client), immediate flush on \r, \t, buffer-full (64 bytes), or Enter Terminal UI: - Retro-CRT composables: TerminalCanvas (phosphor glow, two-pass bloom), ScanlinesOverlay, FlickerEffect (animated brightness variation), CrtCurvatureModifier (AGSL barrel distortion on Android 12+, no-op on JVM) - PhosphorPreset enum: GREEN (P1), AMBER (P3), WHITE (P4) - Pending-input rendered inline in preset.dim colour; snaps to confirmed on flush - Hidden zero-size BasicTextField captures soft and hardware keyboard input - Phosphor colour picker dropdown in top bar Capabilities gate: - supportsRemoteShell gated to UNRELEASED (9.9.9) - Entry only visible in AdministrationSection when node.capabilities.supportsRemoteShell
This commit is contained in:
parent
0f900fe7d7
commit
8701b8645d
18 changed files with 1563 additions and 0 deletions
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (c) 2025-2026 Meshtastic LLC
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.meshtastic.core.repository
|
||||
|
||||
import kotlinx.coroutines.flow.SharedFlow
|
||||
import org.meshtastic.proto.MeshPacket
|
||||
import org.meshtastic.proto.RemoteShell
|
||||
|
||||
/**
|
||||
* A decoded [RemoteShell] frame together with the node number that sent it.
|
||||
*
|
||||
* Propagating [from] allows downstream consumers (e.g. the ViewModel) to verify that a frame
|
||||
* actually originated from the expected peer rather than relying solely on [RemoteShell.session_id].
|
||||
*/
|
||||
data class ReceivedShellFrame(
|
||||
val from: Int,
|
||||
val frame: RemoteShell,
|
||||
)
|
||||
|
||||
/**
|
||||
* Interface for handling RemoteShell packets (REMOTE_SHELL_APP portnum = 13).
|
||||
*
|
||||
* RemoteShell is a PTY-over-mesh feature that relays a shell session across the mesh network. The firmware-side
|
||||
* implementation is currently unreleased (gated to [Capabilities.supportsRemoteShell]).
|
||||
*/
|
||||
interface RemoteShellHandler {
|
||||
/**
|
||||
* The most recently received [ReceivedShellFrame], emitted to collectors.
|
||||
*
|
||||
* Uses [SharedFlow] (not `StateFlow`) so that rapid or identical frames are never silently dropped.
|
||||
*/
|
||||
val lastFrame: SharedFlow<ReceivedShellFrame>
|
||||
|
||||
/**
|
||||
* Processes an incoming RemoteShell packet.
|
||||
*
|
||||
* @param packet The received mesh packet carrying a [RemoteShell] payload.
|
||||
*/
|
||||
fun handleRemoteShell(packet: MeshPacket)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue