mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-21 10:42:35 +10:00
Use RemoteShell in protobufs
This commit is contained in:
+24
-24
@@ -459,7 +459,7 @@ class SessionState:
|
||||
self.replay_log_file = None
|
||||
|
||||
def remember_sent_frame(self, frame: SentShellFrame) -> None:
|
||||
if frame.seq == 0 or frame.op == self.pb2.mesh.DMShell.ACK:
|
||||
if frame.seq == 0 or frame.op == self.pb2.mesh.RemoteShell.ACK:
|
||||
return
|
||||
with self.tx_lock:
|
||||
self.tx_history.append(frame)
|
||||
@@ -508,7 +508,7 @@ def make_toradio_packet(pb2, state: SessionState, shell_msg) -> object:
|
||||
packet.channel = state.channel
|
||||
packet.hop_limit = DEFAULT_HOP_LIMIT
|
||||
packet.want_ack = False
|
||||
packet.decoded.portnum = pb2.portnums.DM_SHELL_APP
|
||||
packet.decoded.portnum = pb2.portnums.REMOTE_SHELL_APP
|
||||
packet.decoded.payload = shell_msg.SerializeToString()
|
||||
packet.decoded.want_response = False
|
||||
packet.decoded.dest = state.target
|
||||
@@ -534,13 +534,13 @@ def send_shell_frame(
|
||||
heartbeat: bool = False,
|
||||
) -> int:
|
||||
if seq is None:
|
||||
seq = 0 if op == state.pb2.mesh.DMShell.ACK else state.alloc_seq()
|
||||
seq = 0 if op == state.pb2.mesh.RemoteShell.ACK else state.alloc_seq()
|
||||
if ack_seq is None:
|
||||
ack_seq = state.current_ack_seq()
|
||||
if session_id is None:
|
||||
session_id = state.session_id
|
||||
|
||||
shell = state.pb2.mesh.DMShell()
|
||||
shell = state.pb2.mesh.RemoteShell()
|
||||
shell.op = op
|
||||
shell.session_id = session_id
|
||||
shell.seq = seq
|
||||
@@ -562,7 +562,7 @@ def send_shell_frame(
|
||||
|
||||
def send_ack_frame(transport, state: SessionState, replay_from: Optional[int] = None) -> None:
|
||||
payload = b"" if replay_from is None else encode_replay_request(replay_from)
|
||||
send_shell_frame(transport, state, state.pb2.mesh.DMShell.ACK, payload=payload, seq=0, remember=False)
|
||||
send_shell_frame(transport, state, state.pb2.mesh.RemoteShell.ACK, payload=payload, seq=0, remember=False)
|
||||
|
||||
|
||||
def replay_frames_from(transport, state: SessionState, start_seq: int) -> None:
|
||||
@@ -609,9 +609,9 @@ def wait_for_config_complete(transport, pb2, timeout: float, verbose: bool) -> N
|
||||
def decode_shell_packet(state: SessionState, packet) -> Optional[object]:
|
||||
if packet.WhichOneof("payload_variant") != "decoded":
|
||||
return None
|
||||
if packet.decoded.portnum != state.pb2.portnums.DM_SHELL_APP:
|
||||
if packet.decoded.portnum != state.pb2.portnums.REMOTE_SHELL_APP:
|
||||
return None
|
||||
shell = state.pb2.mesh.DMShell()
|
||||
shell = state.pb2.mesh.RemoteShell()
|
||||
shell.ParseFromString(packet.decoded.payload)
|
||||
return shell
|
||||
|
||||
@@ -619,7 +619,7 @@ def decode_shell_packet(state: SessionState, packet) -> Optional[object]:
|
||||
def reader_loop(transport, state: SessionState) -> None:
|
||||
def handle_in_order_shell(shell) -> bool:
|
||||
state.note_replayed_seq_received(shell.seq)
|
||||
if shell.op == state.pb2.mesh.DMShell.OPEN_OK:
|
||||
if shell.op == state.pb2.mesh.RemoteShell.OPEN_OK:
|
||||
state.session_id = shell.session_id
|
||||
state.open_replay_log(state.session_id)
|
||||
state.set_receive_cursor(shell.seq)
|
||||
@@ -631,20 +631,20 @@ def reader_loop(transport, state: SessionState) -> None:
|
||||
)
|
||||
if state.replay_log_path is not None:
|
||||
state.event_queue.put(f"replay log: {state.replay_log_path}")
|
||||
elif shell.op == state.pb2.mesh.DMShell.OUTPUT:
|
||||
elif shell.op == state.pb2.mesh.RemoteShell.OUTPUT:
|
||||
if shell.payload:
|
||||
sys.stdout.buffer.write(shell.payload)
|
||||
sys.stdout.buffer.flush()
|
||||
elif shell.op == state.pb2.mesh.DMShell.ERROR:
|
||||
elif shell.op == state.pb2.mesh.RemoteShell.ERROR:
|
||||
message = shell.payload.decode("utf-8", errors="replace")
|
||||
state.event_queue.put(f"remote error: {message}")
|
||||
elif shell.op == state.pb2.mesh.DMShell.CLOSED:
|
||||
elif shell.op == state.pb2.mesh.RemoteShell.CLOSED:
|
||||
message = shell.payload.decode("utf-8", errors="replace")
|
||||
state.event_queue.put(f"session closed: {message}")
|
||||
state.closed_event.set()
|
||||
state.active = False
|
||||
return True
|
||||
elif shell.op == state.pb2.mesh.DMShell.PONG:
|
||||
elif shell.op == state.pb2.mesh.RemoteShell.PONG:
|
||||
heartbeat_status = decode_heartbeat_status(shell.payload)
|
||||
if heartbeat_status is not None:
|
||||
remote_last_tx_seq, remote_last_rx_seq = heartbeat_status
|
||||
@@ -677,7 +677,7 @@ def reader_loop(transport, state: SessionState) -> None:
|
||||
continue
|
||||
state.note_inbound_packet()
|
||||
#state.prune_sent_frames(shell.ack_seq)
|
||||
if shell.op == state.pb2.mesh.DMShell.ACK:
|
||||
if shell.op == state.pb2.mesh.RemoteShell.ACK:
|
||||
#state.event_queue.put("peer requested replay")
|
||||
replay_from = decode_replay_request(shell.payload)
|
||||
if replay_from is not None:
|
||||
@@ -741,7 +741,7 @@ def heartbeat_loop(transport, state: SessionState) -> None:
|
||||
send_shell_frame(
|
||||
transport,
|
||||
state,
|
||||
state.pb2.mesh.DMShell.PING,
|
||||
state.pb2.mesh.RemoteShell.PING,
|
||||
payload=state.heartbeat_payload(),
|
||||
remember=True,
|
||||
heartbeat=True,
|
||||
@@ -756,9 +756,9 @@ def heartbeat_loop(transport, state: SessionState) -> None:
|
||||
|
||||
def run_command_mode(transport, state: SessionState, commands: list[str], close_after: float) -> None:
|
||||
for command in commands:
|
||||
send_shell_frame(transport, state, state.pb2.mesh.DMShell.INPUT, (command + "\n").encode("utf-8"))
|
||||
send_shell_frame(transport, state, state.pb2.mesh.RemoteShell.INPUT, (command + "\n").encode("utf-8"))
|
||||
time.sleep(close_after)
|
||||
send_shell_frame(transport, state, state.pb2.mesh.DMShell.CLOSE)
|
||||
send_shell_frame(transport, state, state.pb2.mesh.RemoteShell.CLOSE)
|
||||
state.closed_event.wait(timeout=close_after + 5.0)
|
||||
|
||||
|
||||
@@ -800,10 +800,10 @@ def run_interactive_mode(transport, state: SessionState) -> None:
|
||||
if cmd in ("", "resume"):
|
||||
return True
|
||||
if cmd == "close":
|
||||
send_shell_frame(transport, state, state.pb2.mesh.DMShell.CLOSE)
|
||||
send_shell_frame(transport, state, state.pb2.mesh.RemoteShell.CLOSE)
|
||||
return False
|
||||
if cmd == "ping":
|
||||
send_shell_frame(transport, state, state.pb2.mesh.DMShell.PING)
|
||||
send_shell_frame(transport, state, state.pb2.mesh.RemoteShell.PING)
|
||||
return True
|
||||
if cmd.startswith("resize "):
|
||||
parts = cmd.split()
|
||||
@@ -816,7 +816,7 @@ def run_interactive_mode(transport, state: SessionState) -> None:
|
||||
except ValueError:
|
||||
state.event_queue.put("usage: resize COLS ROWS")
|
||||
return True
|
||||
send_shell_frame(transport, state, state.pb2.mesh.DMShell.RESIZE, cols=cols, rows=rows)
|
||||
send_shell_frame(transport, state, state.pb2.mesh.RemoteShell.RESIZE, cols=cols, rows=rows)
|
||||
return True
|
||||
|
||||
state.event_queue.put(f"unknown local command: {cmd}")
|
||||
@@ -833,9 +833,9 @@ def run_interactive_mode(transport, state: SessionState) -> None:
|
||||
drain_events(state)
|
||||
data = sys.stdin.buffer.read(INPUT_BATCH_MAX_BYTES)
|
||||
if not data:
|
||||
send_shell_frame(transport, state, state.pb2.mesh.DMShell.CLOSE)
|
||||
send_shell_frame(transport, state, state.pb2.mesh.RemoteShell.CLOSE)
|
||||
break
|
||||
send_shell_frame(transport, state, state.pb2.mesh.DMShell.INPUT, data)
|
||||
send_shell_frame(transport, state, state.pb2.mesh.RemoteShell.INPUT, data)
|
||||
return
|
||||
|
||||
fd = sys.stdin.fileno()
|
||||
@@ -850,7 +850,7 @@ def run_interactive_mode(transport, state: SessionState) -> None:
|
||||
|
||||
data = os.read(fd, 1)
|
||||
if not data:
|
||||
send_shell_frame(transport, state, state.pb2.mesh.DMShell.CLOSE)
|
||||
send_shell_frame(transport, state, state.pb2.mesh.RemoteShell.CLOSE)
|
||||
break
|
||||
|
||||
if data == LOCAL_ESCAPE_BYTE:
|
||||
@@ -882,7 +882,7 @@ def run_interactive_mode(transport, state: SessionState) -> None:
|
||||
deadline = time.monotonic() + INPUT_BATCH_WINDOW_SEC
|
||||
|
||||
if batched:
|
||||
send_shell_frame(transport, state, state.pb2.mesh.DMShell.INPUT, bytes(batched))
|
||||
send_shell_frame(transport, state, state.pb2.mesh.RemoteShell.INPUT, bytes(batched))
|
||||
|
||||
if enter_local_command:
|
||||
keep_running = handle_local_command(read_local_command())
|
||||
@@ -912,7 +912,7 @@ def main() -> int:
|
||||
reader = threading.Thread(target=reader_loop, args=(transport, state), daemon=True)
|
||||
reader.start()
|
||||
|
||||
send_shell_frame(transport, state, pb2.mesh.DMShell.OPEN, cols=cols, rows=rows)
|
||||
send_shell_frame(transport, state, pb2.mesh.RemoteShell.OPEN, cols=cols, rows=rows)
|
||||
if not state.opened_event.wait(timeout=args.timeout):
|
||||
raise SystemExit("timed out waiting for OPEN_OK from remote DMShell")
|
||||
|
||||
|
||||
@@ -24,18 +24,6 @@ PB_BIND(meshtastic_Contact, meshtastic_Contact, AUTO)
|
||||
PB_BIND(meshtastic_PLI, meshtastic_PLI, AUTO)
|
||||
|
||||
|
||||
PB_BIND(meshtastic_AircraftTrack, meshtastic_AircraftTrack, AUTO)
|
||||
|
||||
|
||||
PB_BIND(meshtastic_TAKPacketV2, meshtastic_TAKPacketV2, 2)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -65,197 +65,6 @@ typedef enum _meshtastic_MemberRole {
|
||||
meshtastic_MemberRole_K9 = 8
|
||||
} meshtastic_MemberRole;
|
||||
|
||||
/* CoT how field values.
|
||||
Represents how the coordinates were generated. */
|
||||
typedef enum _meshtastic_CotHow {
|
||||
/* Unspecified */
|
||||
meshtastic_CotHow_CotHow_Unspecified = 0,
|
||||
/* Human entered */
|
||||
meshtastic_CotHow_CotHow_h_e = 1,
|
||||
/* Machine generated */
|
||||
meshtastic_CotHow_CotHow_m_g = 2,
|
||||
/* Human GPS/INS derived */
|
||||
meshtastic_CotHow_CotHow_h_g_i_g_o = 3,
|
||||
/* Machine relayed (imported from another system/gateway) */
|
||||
meshtastic_CotHow_CotHow_m_r = 4,
|
||||
/* Machine fused (corroborated from multiple sources) */
|
||||
meshtastic_CotHow_CotHow_m_f = 5,
|
||||
/* Machine predicted */
|
||||
meshtastic_CotHow_CotHow_m_p = 6,
|
||||
/* Machine simulated */
|
||||
meshtastic_CotHow_CotHow_m_s = 7
|
||||
} meshtastic_CotHow;
|
||||
|
||||
/* Well-known CoT event types.
|
||||
When the type is known, use the enum value for efficient encoding.
|
||||
For unknown types, set cot_type_id to CotType_Other and populate cot_type_str. */
|
||||
typedef enum _meshtastic_CotType {
|
||||
/* Unknown or unmapped type, use cot_type_str */
|
||||
meshtastic_CotType_CotType_Other = 0,
|
||||
/* a-f-G-U-C: Friendly ground unit combat */
|
||||
meshtastic_CotType_CotType_a_f_G_U_C = 1,
|
||||
/* a-f-G-U-C-I: Friendly ground unit combat infantry */
|
||||
meshtastic_CotType_CotType_a_f_G_U_C_I = 2,
|
||||
/* a-n-A-C-F: Neutral aircraft civilian fixed-wing */
|
||||
meshtastic_CotType_CotType_a_n_A_C_F = 3,
|
||||
/* a-n-A-C-H: Neutral aircraft civilian helicopter */
|
||||
meshtastic_CotType_CotType_a_n_A_C_H = 4,
|
||||
/* a-n-A-C: Neutral aircraft civilian */
|
||||
meshtastic_CotType_CotType_a_n_A_C = 5,
|
||||
/* a-f-A-M-H: Friendly aircraft military helicopter */
|
||||
meshtastic_CotType_CotType_a_f_A_M_H = 6,
|
||||
/* a-f-A-M: Friendly aircraft military */
|
||||
meshtastic_CotType_CotType_a_f_A_M = 7,
|
||||
/* a-f-A-M-F-F: Friendly aircraft military fixed-wing fighter */
|
||||
meshtastic_CotType_CotType_a_f_A_M_F_F = 8,
|
||||
/* a-f-A-M-H-A: Friendly aircraft military helicopter attack */
|
||||
meshtastic_CotType_CotType_a_f_A_M_H_A = 9,
|
||||
/* a-f-A-M-H-U-M: Friendly aircraft military helicopter utility medium */
|
||||
meshtastic_CotType_CotType_a_f_A_M_H_U_M = 10,
|
||||
/* a-h-A-M-F-F: Hostile aircraft military fixed-wing fighter */
|
||||
meshtastic_CotType_CotType_a_h_A_M_F_F = 11,
|
||||
/* a-h-A-M-H-A: Hostile aircraft military helicopter attack */
|
||||
meshtastic_CotType_CotType_a_h_A_M_H_A = 12,
|
||||
/* a-u-A-C: Unknown aircraft civilian */
|
||||
meshtastic_CotType_CotType_a_u_A_C = 13,
|
||||
/* t-x-d-d: Tasking delete/disconnect */
|
||||
meshtastic_CotType_CotType_t_x_d_d = 14,
|
||||
/* a-f-G-E-S-E: Friendly ground equipment sensor */
|
||||
meshtastic_CotType_CotType_a_f_G_E_S_E = 15,
|
||||
/* a-f-G-E-V-C: Friendly ground equipment vehicle */
|
||||
meshtastic_CotType_CotType_a_f_G_E_V_C = 16,
|
||||
/* a-f-S: Friendly sea */
|
||||
meshtastic_CotType_CotType_a_f_S = 17,
|
||||
/* a-f-A-M-F: Friendly aircraft military fixed-wing */
|
||||
meshtastic_CotType_CotType_a_f_A_M_F = 18,
|
||||
/* a-f-A-M-F-C-H: Friendly aircraft military fixed-wing cargo heavy */
|
||||
meshtastic_CotType_CotType_a_f_A_M_F_C_H = 19,
|
||||
/* a-f-A-M-F-U-L: Friendly aircraft military fixed-wing utility light */
|
||||
meshtastic_CotType_CotType_a_f_A_M_F_U_L = 20,
|
||||
/* a-f-A-M-F-L: Friendly aircraft military fixed-wing liaison */
|
||||
meshtastic_CotType_CotType_a_f_A_M_F_L = 21,
|
||||
/* a-f-A-M-F-P: Friendly aircraft military fixed-wing patrol */
|
||||
meshtastic_CotType_CotType_a_f_A_M_F_P = 22,
|
||||
/* a-f-A-C-H: Friendly aircraft civilian helicopter */
|
||||
meshtastic_CotType_CotType_a_f_A_C_H = 23,
|
||||
/* a-n-A-M-F-Q: Neutral aircraft military fixed-wing drone */
|
||||
meshtastic_CotType_CotType_a_n_A_M_F_Q = 24,
|
||||
/* b-t-f: GeoChat message */
|
||||
meshtastic_CotType_CotType_b_t_f = 25,
|
||||
/* b-r-f-h-c: CASEVAC/MEDEVAC report */
|
||||
meshtastic_CotType_CotType_b_r_f_h_c = 26,
|
||||
/* b-a-o-pan: Ring the bell / alert all */
|
||||
meshtastic_CotType_CotType_b_a_o_pan = 27,
|
||||
/* b-a-o-opn: Troops in contact */
|
||||
meshtastic_CotType_CotType_b_a_o_opn = 28,
|
||||
/* b-a-o-can: Cancel alert */
|
||||
meshtastic_CotType_CotType_b_a_o_can = 29,
|
||||
/* b-a-o-tbl: 911 alert */
|
||||
meshtastic_CotType_CotType_b_a_o_tbl = 30,
|
||||
/* b-a-g: Geofence breach alert */
|
||||
meshtastic_CotType_CotType_b_a_g = 31,
|
||||
/* a-f-G: Friendly ground (generic) */
|
||||
meshtastic_CotType_CotType_a_f_G = 32,
|
||||
/* a-f-G-U: Friendly ground unit (generic) */
|
||||
meshtastic_CotType_CotType_a_f_G_U = 33,
|
||||
/* a-h-G: Hostile ground (generic) */
|
||||
meshtastic_CotType_CotType_a_h_G = 34,
|
||||
/* a-u-G: Unknown ground (generic) */
|
||||
meshtastic_CotType_CotType_a_u_G = 35,
|
||||
/* a-n-G: Neutral ground (generic) */
|
||||
meshtastic_CotType_CotType_a_n_G = 36,
|
||||
/* b-m-r: Route */
|
||||
meshtastic_CotType_CotType_b_m_r = 37,
|
||||
/* b-m-p-w: Route waypoint */
|
||||
meshtastic_CotType_CotType_b_m_p_w = 38,
|
||||
/* b-m-p-s-p-i: Self-position marker */
|
||||
meshtastic_CotType_CotType_b_m_p_s_p_i = 39,
|
||||
/* u-d-f: Freeform shape (line/polygon) */
|
||||
meshtastic_CotType_CotType_u_d_f = 40,
|
||||
/* u-d-r: Rectangle */
|
||||
meshtastic_CotType_CotType_u_d_r = 41,
|
||||
/* u-d-c-c: Circle */
|
||||
meshtastic_CotType_CotType_u_d_c_c = 42,
|
||||
/* u-rb-a: Range/bearing line */
|
||||
meshtastic_CotType_CotType_u_rb_a = 43,
|
||||
/* a-h-A: Hostile aircraft (generic) */
|
||||
meshtastic_CotType_CotType_a_h_A = 44,
|
||||
/* a-u-A: Unknown aircraft (generic) */
|
||||
meshtastic_CotType_CotType_a_u_A = 45,
|
||||
/* a-f-A-M-H-Q: Friendly aircraft military helicopter observation */
|
||||
meshtastic_CotType_CotType_a_f_A_M_H_Q = 46,
|
||||
/* a-f-A-C-F: Friendly aircraft civilian fixed-wing */
|
||||
meshtastic_CotType_CotType_a_f_A_C_F = 47,
|
||||
/* a-f-A-C: Friendly aircraft civilian (generic) */
|
||||
meshtastic_CotType_CotType_a_f_A_C = 48,
|
||||
/* a-f-A-C-L: Friendly aircraft civilian lighter-than-air */
|
||||
meshtastic_CotType_CotType_a_f_A_C_L = 49,
|
||||
/* a-f-A: Friendly aircraft (generic) */
|
||||
meshtastic_CotType_CotType_a_f_A = 50,
|
||||
/* a-f-A-M-H-C: Friendly aircraft military helicopter cargo */
|
||||
meshtastic_CotType_CotType_a_f_A_M_H_C = 51,
|
||||
/* a-n-A-M-F-F: Neutral aircraft military fixed-wing fighter */
|
||||
meshtastic_CotType_CotType_a_n_A_M_F_F = 52,
|
||||
/* a-u-A-C-F: Unknown aircraft civilian fixed-wing */
|
||||
meshtastic_CotType_CotType_a_u_A_C_F = 53,
|
||||
/* a-f-G-U-C-F-T-A: Friendly ground unit combat forces theater aviation */
|
||||
meshtastic_CotType_CotType_a_f_G_U_C_F_T_A = 54,
|
||||
/* a-f-G-U-C-V-S: Friendly ground unit combat vehicle support */
|
||||
meshtastic_CotType_CotType_a_f_G_U_C_V_S = 55,
|
||||
/* a-f-G-U-C-R-X: Friendly ground unit combat reconnaissance exploitation */
|
||||
meshtastic_CotType_CotType_a_f_G_U_C_R_X = 56,
|
||||
/* a-f-G-U-C-I-Z: Friendly ground unit combat infantry mechanized */
|
||||
meshtastic_CotType_CotType_a_f_G_U_C_I_Z = 57,
|
||||
/* a-f-G-U-C-E-C-W: Friendly ground unit combat engineer construction wheeled */
|
||||
meshtastic_CotType_CotType_a_f_G_U_C_E_C_W = 58,
|
||||
/* a-f-G-U-C-I-L: Friendly ground unit combat infantry light */
|
||||
meshtastic_CotType_CotType_a_f_G_U_C_I_L = 59,
|
||||
/* a-f-G-U-C-R-O: Friendly ground unit combat reconnaissance other */
|
||||
meshtastic_CotType_CotType_a_f_G_U_C_R_O = 60,
|
||||
/* a-f-G-U-C-R-V: Friendly ground unit combat reconnaissance cavalry */
|
||||
meshtastic_CotType_CotType_a_f_G_U_C_R_V = 61,
|
||||
/* a-f-G-U-H: Friendly ground unit headquarters */
|
||||
meshtastic_CotType_CotType_a_f_G_U_H = 62,
|
||||
/* a-f-G-U-U-M-S-E: Friendly ground unit support medical surgical evacuation */
|
||||
meshtastic_CotType_CotType_a_f_G_U_U_M_S_E = 63,
|
||||
/* a-f-G-U-S-M-C: Friendly ground unit support maintenance collection */
|
||||
meshtastic_CotType_CotType_a_f_G_U_S_M_C = 64,
|
||||
/* a-f-G-E-S: Friendly ground equipment sensor (generic) */
|
||||
meshtastic_CotType_CotType_a_f_G_E_S = 65,
|
||||
/* a-f-G-E: Friendly ground equipment (generic) */
|
||||
meshtastic_CotType_CotType_a_f_G_E = 66,
|
||||
/* a-f-G-E-V-C-U: Friendly ground equipment vehicle utility */
|
||||
meshtastic_CotType_CotType_a_f_G_E_V_C_U = 67,
|
||||
/* a-f-G-E-V-C-ps: Friendly ground equipment vehicle public safety */
|
||||
meshtastic_CotType_CotType_a_f_G_E_V_C_ps = 68,
|
||||
/* a-u-G-E-V: Unknown ground equipment vehicle */
|
||||
meshtastic_CotType_CotType_a_u_G_E_V = 69,
|
||||
/* a-f-S-N-N-R: Friendly sea surface non-naval rescue */
|
||||
meshtastic_CotType_CotType_a_f_S_N_N_R = 70,
|
||||
/* a-f-F-B: Friendly force boundary */
|
||||
meshtastic_CotType_CotType_a_f_F_B = 71,
|
||||
/* b-m-p-s-p-loc: Self-position location marker */
|
||||
meshtastic_CotType_CotType_b_m_p_s_p_loc = 72,
|
||||
/* b-i-v: Imagery/video */
|
||||
meshtastic_CotType_CotType_b_i_v = 73,
|
||||
/* b-f-t-r: File transfer request */
|
||||
meshtastic_CotType_CotType_b_f_t_r = 74,
|
||||
/* b-f-t-a: File transfer acknowledgment */
|
||||
meshtastic_CotType_CotType_b_f_t_a = 75
|
||||
} meshtastic_CotType;
|
||||
|
||||
/* Geopoint and altitude source */
|
||||
typedef enum _meshtastic_GeoPointSource {
|
||||
/* Unspecified */
|
||||
meshtastic_GeoPointSource_GeoPointSource_Unspecified = 0,
|
||||
/* GPS derived */
|
||||
meshtastic_GeoPointSource_GeoPointSource_GPS = 1,
|
||||
/* User entered */
|
||||
meshtastic_GeoPointSource_GeoPointSource_USER = 2,
|
||||
/* Network/external */
|
||||
meshtastic_GeoPointSource_GeoPointSource_NETWORK = 3
|
||||
} meshtastic_GeoPointSource;
|
||||
|
||||
/* Struct definitions */
|
||||
/* ATAK GeoChat message */
|
||||
typedef struct _meshtastic_GeoChat {
|
||||
@@ -337,95 +146,6 @@ typedef struct _meshtastic_TAKPacket {
|
||||
} payload_variant;
|
||||
} meshtastic_TAKPacket;
|
||||
|
||||
/* Aircraft track information from ADS-B or military air tracking.
|
||||
Covers the majority of observed real-world CoT traffic. */
|
||||
typedef struct _meshtastic_AircraftTrack {
|
||||
/* ICAO hex identifier (e.g. "AD237C") */
|
||||
char icao[8];
|
||||
/* Aircraft registration (e.g. "N946AK") */
|
||||
char registration[16];
|
||||
/* Flight number/callsign (e.g. "ASA864") */
|
||||
char flight[16];
|
||||
/* ICAO aircraft type designator (e.g. "B39M") */
|
||||
char aircraft_type[8];
|
||||
/* Transponder squawk code (0-7777 octal) */
|
||||
uint16_t squawk;
|
||||
/* ADS-B emitter category (e.g. "A3") */
|
||||
char category[4];
|
||||
/* Received signal strength * 10 (e.g. -194 for -19.4 dBm) */
|
||||
int32_t rssi_x10;
|
||||
/* Whether receiver has GPS fix */
|
||||
bool gps;
|
||||
/* CoT host ID for source attribution */
|
||||
char cot_host_id[64];
|
||||
} meshtastic_AircraftTrack;
|
||||
|
||||
typedef PB_BYTES_ARRAY_T(220) meshtastic_TAKPacketV2_raw_detail_t;
|
||||
/* ATAK v2 packet with expanded CoT field support and zstd dictionary compression.
|
||||
Sent on ATAK_PLUGIN_V2 port. The wire payload is:
|
||||
[1 byte flags][zstd-compressed TAKPacketV2 protobuf]
|
||||
Flags byte: bits 0-5 = dictionary ID, bits 6-7 = reserved. */
|
||||
typedef struct _meshtastic_TAKPacketV2 {
|
||||
/* Well-known CoT event type enum.
|
||||
Use CotType_Other with cot_type_str for unknown types. */
|
||||
meshtastic_CotType cot_type_id;
|
||||
/* How the coordinates were generated */
|
||||
meshtastic_CotHow how;
|
||||
/* Callsign */
|
||||
char callsign[120];
|
||||
/* Team color assignment */
|
||||
meshtastic_Team team;
|
||||
/* Role of the group member */
|
||||
meshtastic_MemberRole role;
|
||||
/* Latitude, multiply by 1e-7 to get degrees in floating point */
|
||||
int32_t latitude_i;
|
||||
/* Longitude, multiply by 1e-7 to get degrees in floating point */
|
||||
int32_t longitude_i;
|
||||
/* Altitude in meters (HAE) */
|
||||
int32_t altitude;
|
||||
/* Speed in cm/s */
|
||||
uint32_t speed;
|
||||
/* Course in degrees * 100 (0-36000) */
|
||||
uint16_t course;
|
||||
/* Battery level 0-100 */
|
||||
uint8_t battery;
|
||||
/* Geopoint source */
|
||||
meshtastic_GeoPointSource geo_src;
|
||||
/* Altitude source */
|
||||
meshtastic_GeoPointSource alt_src;
|
||||
/* Device UID (UUID string or device ID like "ANDROID-xxxx") */
|
||||
char uid[48];
|
||||
/* Device callsign */
|
||||
char device_callsign[120];
|
||||
/* Stale time as seconds offset from event time */
|
||||
uint16_t stale_seconds;
|
||||
/* TAK client version string */
|
||||
char tak_version[64];
|
||||
/* TAK device model */
|
||||
char tak_device[32];
|
||||
/* TAK platform (ATAK-CIV, WebTAK, etc.) */
|
||||
char tak_platform[32];
|
||||
/* TAK OS version */
|
||||
char tak_os[16];
|
||||
/* Connection endpoint */
|
||||
char endpoint[32];
|
||||
/* Phone number */
|
||||
char phone[20];
|
||||
/* CoT event type string, only populated when cot_type_id is CotType_Other */
|
||||
char cot_type_str[32];
|
||||
pb_size_t which_payload_variant;
|
||||
union {
|
||||
/* Position report (true = PLI, no extra fields beyond the common ones above) */
|
||||
bool pli;
|
||||
/* ATAK GeoChat message */
|
||||
meshtastic_GeoChat chat;
|
||||
/* Aircraft track data (ADS-B, military air) */
|
||||
meshtastic_AircraftTrack aircraft;
|
||||
/* Generic CoT detail XML for unmapped types */
|
||||
meshtastic_TAKPacketV2_raw_detail_t raw_detail;
|
||||
} payload_variant;
|
||||
} meshtastic_TAKPacketV2;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -440,18 +160,6 @@ extern "C" {
|
||||
#define _meshtastic_MemberRole_MAX meshtastic_MemberRole_K9
|
||||
#define _meshtastic_MemberRole_ARRAYSIZE ((meshtastic_MemberRole)(meshtastic_MemberRole_K9+1))
|
||||
|
||||
#define _meshtastic_CotHow_MIN meshtastic_CotHow_CotHow_Unspecified
|
||||
#define _meshtastic_CotHow_MAX meshtastic_CotHow_CotHow_m_s
|
||||
#define _meshtastic_CotHow_ARRAYSIZE ((meshtastic_CotHow)(meshtastic_CotHow_CotHow_m_s+1))
|
||||
|
||||
#define _meshtastic_CotType_MIN meshtastic_CotType_CotType_Other
|
||||
#define _meshtastic_CotType_MAX meshtastic_CotType_CotType_b_f_t_a
|
||||
#define _meshtastic_CotType_ARRAYSIZE ((meshtastic_CotType)(meshtastic_CotType_CotType_b_f_t_a+1))
|
||||
|
||||
#define _meshtastic_GeoPointSource_MIN meshtastic_GeoPointSource_GeoPointSource_Unspecified
|
||||
#define _meshtastic_GeoPointSource_MAX meshtastic_GeoPointSource_GeoPointSource_NETWORK
|
||||
#define _meshtastic_GeoPointSource_ARRAYSIZE ((meshtastic_GeoPointSource)(meshtastic_GeoPointSource_GeoPointSource_NETWORK+1))
|
||||
|
||||
|
||||
|
||||
#define meshtastic_Group_role_ENUMTYPE meshtastic_MemberRole
|
||||
@@ -461,14 +169,6 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
#define meshtastic_TAKPacketV2_cot_type_id_ENUMTYPE meshtastic_CotType
|
||||
#define meshtastic_TAKPacketV2_how_ENUMTYPE meshtastic_CotHow
|
||||
#define meshtastic_TAKPacketV2_team_ENUMTYPE meshtastic_Team
|
||||
#define meshtastic_TAKPacketV2_role_ENUMTYPE meshtastic_MemberRole
|
||||
#define meshtastic_TAKPacketV2_geo_src_ENUMTYPE meshtastic_GeoPointSource
|
||||
#define meshtastic_TAKPacketV2_alt_src_ENUMTYPE meshtastic_GeoPointSource
|
||||
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define meshtastic_TAKPacket_init_default {0, false, meshtastic_Contact_init_default, false, meshtastic_Group_init_default, false, meshtastic_Status_init_default, 0, {meshtastic_PLI_init_default}}
|
||||
#define meshtastic_GeoChat_init_default {"", false, "", false, ""}
|
||||
@@ -476,16 +176,12 @@ extern "C" {
|
||||
#define meshtastic_Status_init_default {0}
|
||||
#define meshtastic_Contact_init_default {"", ""}
|
||||
#define meshtastic_PLI_init_default {0, 0, 0, 0, 0}
|
||||
#define meshtastic_AircraftTrack_init_default {"", "", "", "", 0, "", 0, 0, ""}
|
||||
#define meshtastic_TAKPacketV2_init_default {_meshtastic_CotType_MIN, _meshtastic_CotHow_MIN, "", _meshtastic_Team_MIN, _meshtastic_MemberRole_MIN, 0, 0, 0, 0, 0, 0, _meshtastic_GeoPointSource_MIN, _meshtastic_GeoPointSource_MIN, "", "", 0, "", "", "", "", "", "", "", 0, {0}}
|
||||
#define meshtastic_TAKPacket_init_zero {0, false, meshtastic_Contact_init_zero, false, meshtastic_Group_init_zero, false, meshtastic_Status_init_zero, 0, {meshtastic_PLI_init_zero}}
|
||||
#define meshtastic_GeoChat_init_zero {"", false, "", false, ""}
|
||||
#define meshtastic_Group_init_zero {_meshtastic_MemberRole_MIN, _meshtastic_Team_MIN}
|
||||
#define meshtastic_Status_init_zero {0}
|
||||
#define meshtastic_Contact_init_zero {"", ""}
|
||||
#define meshtastic_PLI_init_zero {0, 0, 0, 0, 0}
|
||||
#define meshtastic_AircraftTrack_init_zero {"", "", "", "", 0, "", 0, 0, ""}
|
||||
#define meshtastic_TAKPacketV2_init_zero {_meshtastic_CotType_MIN, _meshtastic_CotHow_MIN, "", _meshtastic_Team_MIN, _meshtastic_MemberRole_MIN, 0, 0, 0, 0, 0, 0, _meshtastic_GeoPointSource_MIN, _meshtastic_GeoPointSource_MIN, "", "", 0, "", "", "", "", "", "", "", 0, {0}}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define meshtastic_GeoChat_message_tag 1
|
||||
@@ -508,42 +204,6 @@ extern "C" {
|
||||
#define meshtastic_TAKPacket_pli_tag 5
|
||||
#define meshtastic_TAKPacket_chat_tag 6
|
||||
#define meshtastic_TAKPacket_detail_tag 7
|
||||
#define meshtastic_AircraftTrack_icao_tag 1
|
||||
#define meshtastic_AircraftTrack_registration_tag 2
|
||||
#define meshtastic_AircraftTrack_flight_tag 3
|
||||
#define meshtastic_AircraftTrack_aircraft_type_tag 4
|
||||
#define meshtastic_AircraftTrack_squawk_tag 5
|
||||
#define meshtastic_AircraftTrack_category_tag 6
|
||||
#define meshtastic_AircraftTrack_rssi_x10_tag 7
|
||||
#define meshtastic_AircraftTrack_gps_tag 8
|
||||
#define meshtastic_AircraftTrack_cot_host_id_tag 9
|
||||
#define meshtastic_TAKPacketV2_cot_type_id_tag 1
|
||||
#define meshtastic_TAKPacketV2_how_tag 2
|
||||
#define meshtastic_TAKPacketV2_callsign_tag 3
|
||||
#define meshtastic_TAKPacketV2_team_tag 4
|
||||
#define meshtastic_TAKPacketV2_role_tag 5
|
||||
#define meshtastic_TAKPacketV2_latitude_i_tag 6
|
||||
#define meshtastic_TAKPacketV2_longitude_i_tag 7
|
||||
#define meshtastic_TAKPacketV2_altitude_tag 8
|
||||
#define meshtastic_TAKPacketV2_speed_tag 9
|
||||
#define meshtastic_TAKPacketV2_course_tag 10
|
||||
#define meshtastic_TAKPacketV2_battery_tag 11
|
||||
#define meshtastic_TAKPacketV2_geo_src_tag 12
|
||||
#define meshtastic_TAKPacketV2_alt_src_tag 13
|
||||
#define meshtastic_TAKPacketV2_uid_tag 14
|
||||
#define meshtastic_TAKPacketV2_device_callsign_tag 15
|
||||
#define meshtastic_TAKPacketV2_stale_seconds_tag 16
|
||||
#define meshtastic_TAKPacketV2_tak_version_tag 17
|
||||
#define meshtastic_TAKPacketV2_tak_device_tag 18
|
||||
#define meshtastic_TAKPacketV2_tak_platform_tag 19
|
||||
#define meshtastic_TAKPacketV2_tak_os_tag 20
|
||||
#define meshtastic_TAKPacketV2_endpoint_tag 21
|
||||
#define meshtastic_TAKPacketV2_phone_tag 22
|
||||
#define meshtastic_TAKPacketV2_cot_type_str_tag 23
|
||||
#define meshtastic_TAKPacketV2_pli_tag 30
|
||||
#define meshtastic_TAKPacketV2_chat_tag 31
|
||||
#define meshtastic_TAKPacketV2_aircraft_tag 32
|
||||
#define meshtastic_TAKPacketV2_raw_detail_tag 33
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define meshtastic_TAKPacket_FIELDLIST(X, a) \
|
||||
@@ -595,60 +255,12 @@ X(a, STATIC, SINGULAR, UINT32, course, 5)
|
||||
#define meshtastic_PLI_CALLBACK NULL
|
||||
#define meshtastic_PLI_DEFAULT NULL
|
||||
|
||||
#define meshtastic_AircraftTrack_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, STRING, icao, 1) \
|
||||
X(a, STATIC, SINGULAR, STRING, registration, 2) \
|
||||
X(a, STATIC, SINGULAR, STRING, flight, 3) \
|
||||
X(a, STATIC, SINGULAR, STRING, aircraft_type, 4) \
|
||||
X(a, STATIC, SINGULAR, UINT32, squawk, 5) \
|
||||
X(a, STATIC, SINGULAR, STRING, category, 6) \
|
||||
X(a, STATIC, SINGULAR, SINT32, rssi_x10, 7) \
|
||||
X(a, STATIC, SINGULAR, BOOL, gps, 8) \
|
||||
X(a, STATIC, SINGULAR, STRING, cot_host_id, 9)
|
||||
#define meshtastic_AircraftTrack_CALLBACK NULL
|
||||
#define meshtastic_AircraftTrack_DEFAULT NULL
|
||||
|
||||
#define meshtastic_TAKPacketV2_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UENUM, cot_type_id, 1) \
|
||||
X(a, STATIC, SINGULAR, UENUM, how, 2) \
|
||||
X(a, STATIC, SINGULAR, STRING, callsign, 3) \
|
||||
X(a, STATIC, SINGULAR, UENUM, team, 4) \
|
||||
X(a, STATIC, SINGULAR, UENUM, role, 5) \
|
||||
X(a, STATIC, SINGULAR, SFIXED32, latitude_i, 6) \
|
||||
X(a, STATIC, SINGULAR, SFIXED32, longitude_i, 7) \
|
||||
X(a, STATIC, SINGULAR, SINT32, altitude, 8) \
|
||||
X(a, STATIC, SINGULAR, UINT32, speed, 9) \
|
||||
X(a, STATIC, SINGULAR, UINT32, course, 10) \
|
||||
X(a, STATIC, SINGULAR, UINT32, battery, 11) \
|
||||
X(a, STATIC, SINGULAR, UENUM, geo_src, 12) \
|
||||
X(a, STATIC, SINGULAR, UENUM, alt_src, 13) \
|
||||
X(a, STATIC, SINGULAR, STRING, uid, 14) \
|
||||
X(a, STATIC, SINGULAR, STRING, device_callsign, 15) \
|
||||
X(a, STATIC, SINGULAR, UINT32, stale_seconds, 16) \
|
||||
X(a, STATIC, SINGULAR, STRING, tak_version, 17) \
|
||||
X(a, STATIC, SINGULAR, STRING, tak_device, 18) \
|
||||
X(a, STATIC, SINGULAR, STRING, tak_platform, 19) \
|
||||
X(a, STATIC, SINGULAR, STRING, tak_os, 20) \
|
||||
X(a, STATIC, SINGULAR, STRING, endpoint, 21) \
|
||||
X(a, STATIC, SINGULAR, STRING, phone, 22) \
|
||||
X(a, STATIC, SINGULAR, STRING, cot_type_str, 23) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,pli,payload_variant.pli), 30) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,chat,payload_variant.chat), 31) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,aircraft,payload_variant.aircraft), 32) \
|
||||
X(a, STATIC, ONEOF, BYTES, (payload_variant,raw_detail,payload_variant.raw_detail), 33)
|
||||
#define meshtastic_TAKPacketV2_CALLBACK NULL
|
||||
#define meshtastic_TAKPacketV2_DEFAULT NULL
|
||||
#define meshtastic_TAKPacketV2_payload_variant_chat_MSGTYPE meshtastic_GeoChat
|
||||
#define meshtastic_TAKPacketV2_payload_variant_aircraft_MSGTYPE meshtastic_AircraftTrack
|
||||
|
||||
extern const pb_msgdesc_t meshtastic_TAKPacket_msg;
|
||||
extern const pb_msgdesc_t meshtastic_GeoChat_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Group_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Status_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Contact_msg;
|
||||
extern const pb_msgdesc_t meshtastic_PLI_msg;
|
||||
extern const pb_msgdesc_t meshtastic_AircraftTrack_msg;
|
||||
extern const pb_msgdesc_t meshtastic_TAKPacketV2_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define meshtastic_TAKPacket_fields &meshtastic_TAKPacket_msg
|
||||
@@ -657,18 +269,14 @@ extern const pb_msgdesc_t meshtastic_TAKPacketV2_msg;
|
||||
#define meshtastic_Status_fields &meshtastic_Status_msg
|
||||
#define meshtastic_Contact_fields &meshtastic_Contact_msg
|
||||
#define meshtastic_PLI_fields &meshtastic_PLI_msg
|
||||
#define meshtastic_AircraftTrack_fields &meshtastic_AircraftTrack_msg
|
||||
#define meshtastic_TAKPacketV2_fields &meshtastic_TAKPacketV2_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define MESHTASTIC_MESHTASTIC_ATAK_PB_H_MAX_SIZE meshtastic_TAKPacketV2_size
|
||||
#define meshtastic_AircraftTrack_size 134
|
||||
#define MESHTASTIC_MESHTASTIC_ATAK_PB_H_MAX_SIZE meshtastic_TAKPacket_size
|
||||
#define meshtastic_Contact_size 242
|
||||
#define meshtastic_GeoChat_size 444
|
||||
#define meshtastic_Group_size 4
|
||||
#define meshtastic_PLI_size 31
|
||||
#define meshtastic_Status_size 3
|
||||
#define meshtastic_TAKPacketV2_size 1027
|
||||
#define meshtastic_TAKPacket_size 705
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -27,7 +27,7 @@ PB_BIND(meshtastic_KeyVerification, meshtastic_KeyVerification, AUTO)
|
||||
PB_BIND(meshtastic_StoreForwardPlusPlus, meshtastic_StoreForwardPlusPlus, 2)
|
||||
|
||||
|
||||
PB_BIND(meshtastic_DMShell, meshtastic_DMShell, AUTO)
|
||||
PB_BIND(meshtastic_RemoteShell, meshtastic_RemoteShell, AUTO)
|
||||
|
||||
|
||||
PB_BIND(meshtastic_Waypoint, meshtastic_Waypoint, AUTO)
|
||||
|
||||
@@ -517,22 +517,22 @@ typedef enum _meshtastic_StoreForwardPlusPlus_SFPP_message_type {
|
||||
|
||||
Values 1-63 are client->server requests.
|
||||
Values 64-127 are server->client responses/events. */
|
||||
typedef enum _meshtastic_DMShell_OpCode {
|
||||
meshtastic_DMShell_OpCode_OP_UNSET = 0,
|
||||
typedef enum _meshtastic_RemoteShell_OpCode {
|
||||
meshtastic_RemoteShell_OpCode_OP_UNSET = 0,
|
||||
/* Client -> server */
|
||||
meshtastic_DMShell_OpCode_OPEN = 1,
|
||||
meshtastic_DMShell_OpCode_INPUT = 2,
|
||||
meshtastic_DMShell_OpCode_RESIZE = 3,
|
||||
meshtastic_DMShell_OpCode_CLOSE = 4,
|
||||
meshtastic_DMShell_OpCode_PING = 5,
|
||||
meshtastic_DMShell_OpCode_ACK = 6,
|
||||
meshtastic_RemoteShell_OpCode_OPEN = 1,
|
||||
meshtastic_RemoteShell_OpCode_INPUT = 2,
|
||||
meshtastic_RemoteShell_OpCode_RESIZE = 3,
|
||||
meshtastic_RemoteShell_OpCode_CLOSE = 4,
|
||||
meshtastic_RemoteShell_OpCode_PING = 5,
|
||||
meshtastic_RemoteShell_OpCode_ACK = 6,
|
||||
/* Server -> client */
|
||||
meshtastic_DMShell_OpCode_OPEN_OK = 64,
|
||||
meshtastic_DMShell_OpCode_OUTPUT = 65,
|
||||
meshtastic_DMShell_OpCode_CLOSED = 66,
|
||||
meshtastic_DMShell_OpCode_ERROR = 67,
|
||||
meshtastic_DMShell_OpCode_PONG = 68
|
||||
} meshtastic_DMShell_OpCode;
|
||||
meshtastic_RemoteShell_OpCode_OPEN_OK = 64,
|
||||
meshtastic_RemoteShell_OpCode_OUTPUT = 65,
|
||||
meshtastic_RemoteShell_OpCode_CLOSED = 66,
|
||||
meshtastic_RemoteShell_OpCode_ERROR = 67,
|
||||
meshtastic_RemoteShell_OpCode_PONG = 68
|
||||
} meshtastic_RemoteShell_OpCode;
|
||||
|
||||
/* The priority of this message for sending.
|
||||
Higher priorities are sent first (when managing the transmit queue).
|
||||
@@ -866,11 +866,11 @@ typedef struct _meshtastic_StoreForwardPlusPlus {
|
||||
uint32_t chain_count;
|
||||
} meshtastic_StoreForwardPlusPlus;
|
||||
|
||||
typedef PB_BYTES_ARRAY_T(200) meshtastic_DMShell_payload_t;
|
||||
/* The actual over-the-mesh message doing DMShell */
|
||||
typedef struct _meshtastic_DMShell {
|
||||
typedef PB_BYTES_ARRAY_T(200) meshtastic_RemoteShell_payload_t;
|
||||
/* The actual over-the-mesh message doing RemoteShell */
|
||||
typedef struct _meshtastic_RemoteShell {
|
||||
/* Structured frame operation. */
|
||||
meshtastic_DMShell_OpCode op;
|
||||
meshtastic_RemoteShell_OpCode op;
|
||||
/* Logical PTY session identifier. */
|
||||
uint32_t session_id;
|
||||
/* Monotonic sequence number for this frame. */
|
||||
@@ -878,14 +878,14 @@ typedef struct _meshtastic_DMShell {
|
||||
/* Cumulative ack sequence number. */
|
||||
uint32_t ack_seq;
|
||||
/* Opaque bytes payload for INPUT/OUTPUT/ERROR and other frame bodies. */
|
||||
meshtastic_DMShell_payload_t payload;
|
||||
meshtastic_RemoteShell_payload_t payload;
|
||||
/* Terminal size columns used for OPEN/RESIZE signaling. */
|
||||
uint32_t cols;
|
||||
/* Terminal size rows used for OPEN/RESIZE signaling. */
|
||||
uint32_t rows;
|
||||
/* Bit flags for protocol extensions. */
|
||||
uint32_t flags;
|
||||
} meshtastic_DMShell;
|
||||
} meshtastic_RemoteShell;
|
||||
|
||||
/* Waypoint message, used to share arbitrary locations across the mesh */
|
||||
typedef struct _meshtastic_Waypoint {
|
||||
@@ -1427,9 +1427,9 @@ extern "C" {
|
||||
#define _meshtastic_StoreForwardPlusPlus_SFPP_message_type_MAX meshtastic_StoreForwardPlusPlus_SFPP_message_type_LINK_PROVIDE_SECONDHALF
|
||||
#define _meshtastic_StoreForwardPlusPlus_SFPP_message_type_ARRAYSIZE ((meshtastic_StoreForwardPlusPlus_SFPP_message_type)(meshtastic_StoreForwardPlusPlus_SFPP_message_type_LINK_PROVIDE_SECONDHALF+1))
|
||||
|
||||
#define _meshtastic_DMShell_OpCode_MIN meshtastic_DMShell_OpCode_OP_UNSET
|
||||
#define _meshtastic_DMShell_OpCode_MAX meshtastic_DMShell_OpCode_PONG
|
||||
#define _meshtastic_DMShell_OpCode_ARRAYSIZE ((meshtastic_DMShell_OpCode)(meshtastic_DMShell_OpCode_PONG+1))
|
||||
#define _meshtastic_RemoteShell_OpCode_MIN meshtastic_RemoteShell_OpCode_OP_UNSET
|
||||
#define _meshtastic_RemoteShell_OpCode_MAX meshtastic_RemoteShell_OpCode_PONG
|
||||
#define _meshtastic_RemoteShell_OpCode_ARRAYSIZE ((meshtastic_RemoteShell_OpCode)(meshtastic_RemoteShell_OpCode_PONG+1))
|
||||
|
||||
#define _meshtastic_MeshPacket_Priority_MIN meshtastic_MeshPacket_Priority_UNSET
|
||||
#define _meshtastic_MeshPacket_Priority_MAX meshtastic_MeshPacket_Priority_MAX
|
||||
@@ -1461,7 +1461,7 @@ extern "C" {
|
||||
|
||||
#define meshtastic_StoreForwardPlusPlus_sfpp_message_type_ENUMTYPE meshtastic_StoreForwardPlusPlus_SFPP_message_type
|
||||
|
||||
#define meshtastic_DMShell_op_ENUMTYPE meshtastic_DMShell_OpCode
|
||||
#define meshtastic_RemoteShell_op_ENUMTYPE meshtastic_RemoteShell_OpCode
|
||||
|
||||
|
||||
|
||||
@@ -1507,7 +1507,7 @@ extern "C" {
|
||||
#define meshtastic_Data_init_default {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, 0}
|
||||
#define meshtastic_KeyVerification_init_default {0, {0, {0}}, {0, {0}}}
|
||||
#define meshtastic_StoreForwardPlusPlus_init_default {_meshtastic_StoreForwardPlusPlus_SFPP_message_type_MIN, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, 0, 0, 0, 0, 0}
|
||||
#define meshtastic_DMShell_init_default {_meshtastic_DMShell_OpCode_MIN, 0, 0, 0, {0, {0}}, 0, 0, 0}
|
||||
#define meshtastic_RemoteShell_init_default {_meshtastic_RemoteShell_OpCode_MIN, 0, 0, 0, {0, {0}}, 0, 0, 0}
|
||||
#define meshtastic_Waypoint_init_default {0, false, 0, false, 0, 0, 0, "", "", 0}
|
||||
#define meshtastic_StatusMessage_init_default {""}
|
||||
#define meshtastic_MqttClientProxyMessage_init_default {"", 0, {{0, {0}}}, 0}
|
||||
@@ -1541,7 +1541,7 @@ extern "C" {
|
||||
#define meshtastic_Data_init_zero {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, 0}
|
||||
#define meshtastic_KeyVerification_init_zero {0, {0, {0}}, {0, {0}}}
|
||||
#define meshtastic_StoreForwardPlusPlus_init_zero {_meshtastic_StoreForwardPlusPlus_SFPP_message_type_MIN, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, 0, 0, 0, 0, 0}
|
||||
#define meshtastic_DMShell_init_zero {_meshtastic_DMShell_OpCode_MIN, 0, 0, 0, {0, {0}}, 0, 0, 0}
|
||||
#define meshtastic_RemoteShell_init_zero {_meshtastic_RemoteShell_OpCode_MIN, 0, 0, 0, {0, {0}}, 0, 0, 0}
|
||||
#define meshtastic_Waypoint_init_zero {0, false, 0, false, 0, 0, 0, "", "", 0}
|
||||
#define meshtastic_StatusMessage_init_zero {""}
|
||||
#define meshtastic_MqttClientProxyMessage_init_zero {"", 0, {{0, {0}}}, 0}
|
||||
@@ -1631,14 +1631,14 @@ extern "C" {
|
||||
#define meshtastic_StoreForwardPlusPlus_encapsulated_from_tag 8
|
||||
#define meshtastic_StoreForwardPlusPlus_encapsulated_rxtime_tag 9
|
||||
#define meshtastic_StoreForwardPlusPlus_chain_count_tag 10
|
||||
#define meshtastic_DMShell_op_tag 1
|
||||
#define meshtastic_DMShell_session_id_tag 2
|
||||
#define meshtastic_DMShell_seq_tag 3
|
||||
#define meshtastic_DMShell_ack_seq_tag 4
|
||||
#define meshtastic_DMShell_payload_tag 5
|
||||
#define meshtastic_DMShell_cols_tag 6
|
||||
#define meshtastic_DMShell_rows_tag 7
|
||||
#define meshtastic_DMShell_flags_tag 8
|
||||
#define meshtastic_RemoteShell_op_tag 1
|
||||
#define meshtastic_RemoteShell_session_id_tag 2
|
||||
#define meshtastic_RemoteShell_seq_tag 3
|
||||
#define meshtastic_RemoteShell_ack_seq_tag 4
|
||||
#define meshtastic_RemoteShell_payload_tag 5
|
||||
#define meshtastic_RemoteShell_cols_tag 6
|
||||
#define meshtastic_RemoteShell_rows_tag 7
|
||||
#define meshtastic_RemoteShell_flags_tag 8
|
||||
#define meshtastic_Waypoint_id_tag 1
|
||||
#define meshtastic_Waypoint_latitude_i_tag 2
|
||||
#define meshtastic_Waypoint_longitude_i_tag 3
|
||||
@@ -1871,7 +1871,7 @@ X(a, STATIC, SINGULAR, UINT32, chain_count, 10)
|
||||
#define meshtastic_StoreForwardPlusPlus_CALLBACK NULL
|
||||
#define meshtastic_StoreForwardPlusPlus_DEFAULT NULL
|
||||
|
||||
#define meshtastic_DMShell_FIELDLIST(X, a) \
|
||||
#define meshtastic_RemoteShell_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UENUM, op, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, session_id, 2) \
|
||||
X(a, STATIC, SINGULAR, UINT32, seq, 3) \
|
||||
@@ -1880,8 +1880,8 @@ X(a, STATIC, SINGULAR, BYTES, payload, 5) \
|
||||
X(a, STATIC, SINGULAR, UINT32, cols, 6) \
|
||||
X(a, STATIC, SINGULAR, UINT32, rows, 7) \
|
||||
X(a, STATIC, SINGULAR, UINT32, flags, 8)
|
||||
#define meshtastic_DMShell_CALLBACK NULL
|
||||
#define meshtastic_DMShell_DEFAULT NULL
|
||||
#define meshtastic_RemoteShell_CALLBACK NULL
|
||||
#define meshtastic_RemoteShell_DEFAULT NULL
|
||||
|
||||
#define meshtastic_Waypoint_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, id, 1) \
|
||||
@@ -2165,7 +2165,7 @@ extern const pb_msgdesc_t meshtastic_Routing_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Data_msg;
|
||||
extern const pb_msgdesc_t meshtastic_KeyVerification_msg;
|
||||
extern const pb_msgdesc_t meshtastic_StoreForwardPlusPlus_msg;
|
||||
extern const pb_msgdesc_t meshtastic_DMShell_msg;
|
||||
extern const pb_msgdesc_t meshtastic_RemoteShell_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Waypoint_msg;
|
||||
extern const pb_msgdesc_t meshtastic_StatusMessage_msg;
|
||||
extern const pb_msgdesc_t meshtastic_MqttClientProxyMessage_msg;
|
||||
@@ -2201,7 +2201,7 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg;
|
||||
#define meshtastic_Data_fields &meshtastic_Data_msg
|
||||
#define meshtastic_KeyVerification_fields &meshtastic_KeyVerification_msg
|
||||
#define meshtastic_StoreForwardPlusPlus_fields &meshtastic_StoreForwardPlusPlus_msg
|
||||
#define meshtastic_DMShell_fields &meshtastic_DMShell_msg
|
||||
#define meshtastic_RemoteShell_fields &meshtastic_RemoteShell_msg
|
||||
#define meshtastic_Waypoint_fields &meshtastic_Waypoint_msg
|
||||
#define meshtastic_StatusMessage_fields &meshtastic_StatusMessage_msg
|
||||
#define meshtastic_MqttClientProxyMessage_fields &meshtastic_MqttClientProxyMessage_msg
|
||||
@@ -2236,7 +2236,6 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg;
|
||||
#define meshtastic_ChunkedPayload_size 245
|
||||
#define meshtastic_ClientNotification_size 482
|
||||
#define meshtastic_Compressed_size 239
|
||||
#define meshtastic_DMShell_size 241
|
||||
#define meshtastic_Data_size 269
|
||||
#define meshtastic_DeviceMetadata_size 54
|
||||
#define meshtastic_DuplicatedPublicKey_size 0
|
||||
@@ -2258,6 +2257,7 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg;
|
||||
#define meshtastic_NodeRemoteHardwarePin_size 29
|
||||
#define meshtastic_Position_size 144
|
||||
#define meshtastic_QueueStatus_size 23
|
||||
#define meshtastic_RemoteShell_size 241
|
||||
#define meshtastic_RouteDiscovery_size 256
|
||||
#define meshtastic_Routing_size 259
|
||||
#define meshtastic_StatusMessage_size 81
|
||||
|
||||
@@ -77,7 +77,7 @@ typedef enum _meshtastic_PortNum {
|
||||
/* Module/port for handling key verification requests. */
|
||||
meshtastic_PortNum_KEY_VERIFICATION_APP = 12,
|
||||
/* Module/port for handling key verification requests. */
|
||||
meshtastic_PortNum_DM_SHELL_APP = 13,
|
||||
meshtastic_PortNum_REMOTE_SHELL_APP = 13,
|
||||
/* Provides a 'ping' service that replies to any packet it receives.
|
||||
Also serves as a small example module.
|
||||
ENCODING: ASCII Plaintext */
|
||||
@@ -152,10 +152,6 @@ typedef enum _meshtastic_PortNum {
|
||||
arbitrary telemetry over meshtastic that is not covered by telemetry.proto
|
||||
ENCODING: CayenneLLP */
|
||||
meshtastic_PortNum_CAYENNE_APP = 77,
|
||||
/* ATAK Plugin V2
|
||||
Portnum for payloads from the official Meshtastic ATAK plugin using
|
||||
TAKPacketV2 with zstd dictionary compression. */
|
||||
meshtastic_PortNum_ATAK_PLUGIN_V2 = 78,
|
||||
/* GroupAlarm integration
|
||||
Used for transporting GroupAlarm-related messages between Meshtastic nodes
|
||||
and companion applications/services. */
|
||||
|
||||
+28
-28
@@ -64,7 +64,7 @@ bool decodeHeartbeatStatus(const uint8_t *src, size_t len, uint32_t &lastTxSeq,
|
||||
} // namespace
|
||||
|
||||
DMShellModule::DMShellModule()
|
||||
: SinglePortModule("DMShellModule", meshtastic_PortNum_DM_SHELL_APP), concurrency::OSThread("DMShell", 100)
|
||||
: SinglePortModule("DMShellModule", meshtastic_PortNum_REMOTE_SHELL_APP), concurrency::OSThread("DMShell", 100)
|
||||
{
|
||||
LOG_WARN("DMShell enabled on Portduino: remote shell access is dangerous and intended for trusted debugging only");
|
||||
}
|
||||
@@ -83,7 +83,7 @@ ProcessMessage DMShellModule::handleReceived(const meshtastic_MeshPacket &mp)
|
||||
}
|
||||
|
||||
// TODO: double-check the sender is the same as the one we have an active session with before processing ACKs
|
||||
if (frame.op == meshtastic_DMShell_OpCode_ACK) {
|
||||
if (frame.op == meshtastic_RemoteShell_OpCode_ACK) {
|
||||
if (session.active && frame.sessionId == session.sessionId && getFrom(&mp) == session.peer) {
|
||||
handleAckFrame(frame);
|
||||
}
|
||||
@@ -101,11 +101,11 @@ ProcessMessage DMShellModule::handleReceived(const meshtastic_MeshPacket &mp)
|
||||
return ProcessMessage::STOP;
|
||||
}
|
||||
|
||||
if (frame.op == meshtastic_DMShell_OpCode_OPEN) {
|
||||
if (frame.op == meshtastic_RemoteShell_OpCode_OPEN) {
|
||||
LOG_WARN("DMShell: received OPEN from 0x%x sessionId=0x%x", mp.from, frame.sessionId);
|
||||
if (!openSession(mp, frame)) {
|
||||
const char *msg = "open_failed";
|
||||
sendFrameToPeer(getFrom(&mp), mp.channel, meshtastic_DMShell_OpCode_ERROR, frame.sessionId, 0,
|
||||
sendFrameToPeer(getFrom(&mp), mp.channel, meshtastic_RemoteShell_OpCode_ERROR, frame.sessionId, 0,
|
||||
reinterpret_cast<const uint8_t *>(msg), strlen(msg), 0, 0, frame.seq);
|
||||
}
|
||||
return ProcessMessage::STOP;
|
||||
@@ -113,7 +113,7 @@ ProcessMessage DMShellModule::handleReceived(const meshtastic_MeshPacket &mp)
|
||||
|
||||
if (!session.active || frame.sessionId != session.sessionId || getFrom(&mp) != session.peer) {
|
||||
const char *msg = "invalid_session";
|
||||
sendFrameToPeer(getFrom(&mp), mp.channel, meshtastic_DMShell_OpCode_ERROR, frame.sessionId, 0,
|
||||
sendFrameToPeer(getFrom(&mp), mp.channel, meshtastic_RemoteShell_OpCode_ERROR, frame.sessionId, 0,
|
||||
reinterpret_cast<const uint8_t *>(msg), strlen(msg), 0, 0, frame.seq);
|
||||
return ProcessMessage::STOP;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ ProcessMessage DMShellModule::handleReceived(const meshtastic_MeshPacket &mp)
|
||||
session.lastActivityMs = millis();
|
||||
|
||||
switch (frame.op) {
|
||||
case meshtastic_DMShell_OpCode_INPUT:
|
||||
case meshtastic_RemoteShell_OpCode_INPUT:
|
||||
if (!writeSessionInput(frame)) {
|
||||
sendError("input_write_failed");
|
||||
} else {
|
||||
@@ -133,12 +133,12 @@ ProcessMessage DMShellModule::handleReceived(const meshtastic_MeshPacket &mp)
|
||||
const ssize_t bytesRead = read(session.masterFd, outBuf, sizeof(outBuf));
|
||||
if (bytesRead > 0) {
|
||||
LOG_WARN("DMShell: read %d bytes from PTY", bytesRead);
|
||||
sendControl(meshtastic_DMShell_OpCode_OUTPUT, outBuf, static_cast<size_t>(bytesRead));
|
||||
sendControl(meshtastic_RemoteShell_OpCode_OUTPUT, outBuf, static_cast<size_t>(bytesRead));
|
||||
session.lastActivityMs = millis();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case meshtastic_DMShell_OpCode_RESIZE:
|
||||
case meshtastic_RemoteShell_OpCode_RESIZE:
|
||||
if (frame.rows > 0 && frame.cols > 0) {
|
||||
struct winsize ws = {};
|
||||
ws.ws_row = frame.rows;
|
||||
@@ -148,7 +148,7 @@ ProcessMessage DMShellModule::handleReceived(const meshtastic_MeshPacket &mp)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case meshtastic_DMShell_OpCode_PING: {
|
||||
case meshtastic_RemoteShell_OpCode_PING: {
|
||||
uint32_t peerLastTxSeq = 0;
|
||||
uint32_t peerLastRxSeq = frame.ackSeq;
|
||||
if (decodeHeartbeatStatus(frame.payload, frame.payloadLen, peerLastTxSeq, peerLastRxSeq)) {
|
||||
@@ -160,10 +160,10 @@ ProcessMessage DMShellModule::handleReceived(const meshtastic_MeshPacket &mp)
|
||||
|
||||
uint8_t heartbeatPayload[HEARTBEAT_STATUS_SIZE] = {0};
|
||||
encodeHeartbeatStatus(heartbeatPayload, session.nextTxSeq > 0 ? session.nextTxSeq - 1 : 0, session.lastAckedRxSeq);
|
||||
sendControl(meshtastic_DMShell_OpCode_PONG, heartbeatPayload, sizeof(heartbeatPayload));
|
||||
sendControl(meshtastic_RemoteShell_OpCode_PONG, heartbeatPayload, sizeof(heartbeatPayload));
|
||||
break;
|
||||
}
|
||||
case meshtastic_DMShell_OpCode_CLOSE:
|
||||
case meshtastic_RemoteShell_OpCode_CLOSE:
|
||||
closeSession("peer_close", true);
|
||||
break;
|
||||
default:
|
||||
@@ -199,7 +199,7 @@ int32_t DMShellModule::runOnce()
|
||||
const ssize_t bytesRead = read(session.masterFd, outBuf, sizeof(outBuf));
|
||||
if (bytesRead > 0) {
|
||||
LOG_WARN("DMShell: read %d bytes from PTY", bytesRead);
|
||||
sendControl(meshtastic_DMShell_OpCode_OUTPUT, outBuf, static_cast<size_t>(bytesRead));
|
||||
sendControl(meshtastic_RemoteShell_OpCode_OUTPUT, outBuf, static_cast<size_t>(bytesRead));
|
||||
session.lastActivityMs = millis();
|
||||
// continue;
|
||||
// do we want to ack every data message, and only send the next on ack?
|
||||
@@ -230,8 +230,8 @@ bool DMShellModule::parseFrame(const meshtastic_MeshPacket &mp, DMShellFrame &ou
|
||||
return false;
|
||||
}
|
||||
|
||||
meshtastic_DMShell decodedMsg = meshtastic_DMShell_init_zero;
|
||||
if (pb_decode_from_bytes(mp.decoded.payload.bytes, mp.decoded.payload.size, meshtastic_DMShell_fields, &decodedMsg)) {
|
||||
meshtastic_RemoteShell decodedMsg = meshtastic_RemoteShell_init_zero;
|
||||
if (pb_decode_from_bytes(mp.decoded.payload.bytes, mp.decoded.payload.size, meshtastic_RemoteShell_fields, &decodedMsg)) {
|
||||
LOG_INFO("Received a DMShell message");
|
||||
} else {
|
||||
LOG_ERROR("Error decoding DMShell message!");
|
||||
@@ -329,7 +329,7 @@ bool DMShellModule::openSession(const meshtastic_MeshPacket &mp, const DMShellFr
|
||||
((static_cast<uint32_t>(session.childPid) << 8) & 0xff0000) |
|
||||
(static_cast<uint32_t>(session.childPid) >> 24);
|
||||
memcpy(payload, &pidBE, sizeof(payload));
|
||||
sendFrameToPeer(session.peer, session.channel, meshtastic_DMShell_OpCode_OPEN_OK, session.sessionId, session.nextTxSeq++,
|
||||
sendFrameToPeer(session.peer, session.channel, meshtastic_RemoteShell_OpCode_OPEN_OK, session.sessionId, session.nextTxSeq++,
|
||||
payload, sizeof(payload), ws.ws_col, ws.ws_row, frame.seq);
|
||||
|
||||
LOG_INFO("DMShell: opened session=0x%x peer=0x%x pid=%d", session.sessionId, session.peer, session.childPid);
|
||||
@@ -357,7 +357,7 @@ void DMShellModule::closeSession(const char *reason, bool notifyPeer)
|
||||
|
||||
if (notifyPeer) {
|
||||
const size_t reasonLen = strnlen(reason, 256);
|
||||
sendControl(meshtastic_DMShell_OpCode_CLOSED, reinterpret_cast<const uint8_t *>(reason), reasonLen);
|
||||
sendControl(meshtastic_RemoteShell_OpCode_CLOSED, reinterpret_cast<const uint8_t *>(reason), reasonLen);
|
||||
}
|
||||
|
||||
if (session.masterFd >= 0) {
|
||||
@@ -389,10 +389,10 @@ void DMShellModule::reapChildIfExited()
|
||||
}
|
||||
}
|
||||
|
||||
void DMShellModule::rememberSentFrame(meshtastic_DMShell_OpCode op, uint32_t sessionId, uint32_t seq, const uint8_t *payload,
|
||||
void DMShellModule::rememberSentFrame(meshtastic_RemoteShell_OpCode op, uint32_t sessionId, uint32_t seq, const uint8_t *payload,
|
||||
size_t payloadLen, uint32_t cols, uint32_t rows, uint32_t ackSeq, uint32_t flags)
|
||||
{
|
||||
if (seq == 0 || op == meshtastic_DMShell_OpCode_ACK) {
|
||||
if (seq == 0 || op == meshtastic_RemoteShell_OpCode_ACK) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -450,11 +450,11 @@ void DMShellModule::sendAck(uint32_t replayFromSeq)
|
||||
LOG_WARN("DMShell: requesting replay from seq=%u", replayFromSeq);
|
||||
}
|
||||
|
||||
sendFrameToPeer(session.peer, session.channel, meshtastic_DMShell_OpCode_ACK, session.sessionId, 0, payloadPtr, payloadLen, 0,
|
||||
0, session.lastAckedRxSeq, 0, false);
|
||||
sendFrameToPeer(session.peer, session.channel, meshtastic_RemoteShell_OpCode_ACK, session.sessionId, 0, payloadPtr,
|
||||
payloadLen, 0, 0, session.lastAckedRxSeq, 0, false);
|
||||
}
|
||||
|
||||
void DMShellModule::sendControl(meshtastic_DMShell_OpCode op, const uint8_t *payload, size_t payloadLen)
|
||||
void DMShellModule::sendControl(meshtastic_RemoteShell_OpCode op, const uint8_t *payload, size_t payloadLen)
|
||||
{
|
||||
sendFrameToPeer(session.peer, session.channel, op, session.sessionId, session.nextTxSeq++, payload, payloadLen, 0, 0,
|
||||
session.lastAckedRxSeq);
|
||||
@@ -505,9 +505,9 @@ bool DMShellModule::shouldProcessIncomingFrame(const DMShellFrame &frame)
|
||||
return true;
|
||||
}
|
||||
|
||||
void DMShellModule::sendFrameToPeer(NodeNum peer, uint8_t channel, meshtastic_DMShell_OpCode op, uint32_t sessionId, uint32_t seq,
|
||||
const uint8_t *payload, size_t payloadLen, uint32_t cols, uint32_t rows, uint32_t ackSeq,
|
||||
uint32_t flags, bool remember)
|
||||
void DMShellModule::sendFrameToPeer(NodeNum peer, uint8_t channel, meshtastic_RemoteShell_OpCode op, uint32_t sessionId,
|
||||
uint32_t seq, const uint8_t *payload, size_t payloadLen, uint32_t cols, uint32_t rows,
|
||||
uint32_t ackSeq, uint32_t flags, bool remember)
|
||||
{
|
||||
meshtastic_MeshPacket *packet = buildFramePacket(op, sessionId, seq, payload, payloadLen, cols, rows, ackSeq, flags);
|
||||
if (!packet) {
|
||||
@@ -529,14 +529,14 @@ void DMShellModule::sendFrameToPeer(NodeNum peer, uint8_t channel, meshtastic_DM
|
||||
void DMShellModule::sendError(const char *message)
|
||||
{
|
||||
const size_t len = strnlen(message, meshtastic_Constants_DATA_PAYLOAD_LEN);
|
||||
sendControl(meshtastic_DMShell_OpCode_ERROR, reinterpret_cast<const uint8_t *>(message), len);
|
||||
sendControl(meshtastic_RemoteShell_OpCode_ERROR, reinterpret_cast<const uint8_t *>(message), len);
|
||||
}
|
||||
|
||||
meshtastic_MeshPacket *DMShellModule::buildFramePacket(meshtastic_DMShell_OpCode op, uint32_t sessionId, uint32_t seq,
|
||||
meshtastic_MeshPacket *DMShellModule::buildFramePacket(meshtastic_RemoteShell_OpCode op, uint32_t sessionId, uint32_t seq,
|
||||
const uint8_t *payload, size_t payloadLen, uint32_t cols, uint32_t rows,
|
||||
uint32_t ackSeq, uint32_t flags)
|
||||
{
|
||||
meshtastic_DMShell frame = meshtastic_DMShell_init_zero;
|
||||
meshtastic_RemoteShell frame = meshtastic_RemoteShell_init_zero;
|
||||
frame.op = op;
|
||||
frame.session_id = sessionId;
|
||||
frame.seq = seq;
|
||||
@@ -556,7 +556,7 @@ meshtastic_MeshPacket *DMShellModule::buildFramePacket(meshtastic_DMShell_OpCode
|
||||
}
|
||||
LOG_WARN("DMShell: building packet op=%d session=0x%x seq=%d payloadLen=%d", op, sessionId, seq, payloadLen);
|
||||
const size_t encoded = pb_encode_to_bytes(packet->decoded.payload.bytes, sizeof(packet->decoded.payload.bytes),
|
||||
meshtastic_DMShell_fields, &frame);
|
||||
meshtastic_RemoteShell_fields, &frame);
|
||||
if (encoded == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#if defined(ARCH_PORTDUINO)
|
||||
|
||||
struct DMShellFrame {
|
||||
meshtastic_DMShell_OpCode op = meshtastic_DMShell_OpCode_ERROR;
|
||||
meshtastic_RemoteShell_OpCode op = meshtastic_RemoteShell_OpCode_ERROR;
|
||||
uint32_t sessionId = 0;
|
||||
uint32_t seq = 0;
|
||||
uint32_t ackSeq = 0;
|
||||
@@ -38,7 +38,7 @@ struct DMShellSession {
|
||||
uint32_t lastActivityMs = 0;
|
||||
struct SentFrame {
|
||||
bool valid = false;
|
||||
meshtastic_DMShell_OpCode op = meshtastic_DMShell_OpCode_ERROR;
|
||||
meshtastic_RemoteShell_OpCode op = meshtastic_RemoteShell_OpCode_ERROR;
|
||||
uint32_t sessionId = 0;
|
||||
uint32_t seq = 0;
|
||||
uint32_t ackSeq = 0;
|
||||
@@ -76,17 +76,17 @@ class DMShellModule : private concurrency::OSThread, public SinglePortModule
|
||||
void closeSession(const char *reason, bool notifyPeer);
|
||||
void reapChildIfExited();
|
||||
|
||||
void rememberSentFrame(meshtastic_DMShell_OpCode op, uint32_t sessionId, uint32_t seq, const uint8_t *payload,
|
||||
void rememberSentFrame(meshtastic_RemoteShell_OpCode op, uint32_t sessionId, uint32_t seq, const uint8_t *payload,
|
||||
size_t payloadLen, uint32_t cols, uint32_t rows, uint32_t ackSeq, uint32_t flags);
|
||||
void pruneSentFrames(uint32_t ackSeq);
|
||||
void resendFramesFrom(uint32_t startSeq);
|
||||
void sendAck(uint32_t replayFromSeq = 0);
|
||||
void sendControl(meshtastic_DMShell_OpCode op, const uint8_t *payload, size_t payloadLen);
|
||||
void sendFrameToPeer(NodeNum peer, uint8_t channel, meshtastic_DMShell_OpCode op, uint32_t sessionId, uint32_t seq,
|
||||
void sendControl(meshtastic_RemoteShell_OpCode op, const uint8_t *payload, size_t payloadLen);
|
||||
void sendFrameToPeer(NodeNum peer, uint8_t channel, meshtastic_RemoteShell_OpCode op, uint32_t sessionId, uint32_t seq,
|
||||
const uint8_t *payload, size_t payloadLen, uint32_t cols = 0, uint32_t rows = 0, uint32_t ackSeq = 0,
|
||||
uint32_t flags = 0, bool remember = true);
|
||||
void sendError(const char *message);
|
||||
meshtastic_MeshPacket *buildFramePacket(meshtastic_DMShell_OpCode op, uint32_t sessionId, uint32_t seq,
|
||||
meshtastic_MeshPacket *buildFramePacket(meshtastic_RemoteShell_OpCode op, uint32_t sessionId, uint32_t seq,
|
||||
const uint8_t *payload, size_t payloadLen, uint32_t cols, uint32_t rows,
|
||||
uint32_t ackSeq, uint32_t flags);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user