Skip to content

feat: add POST /api/trace endpoint for multi-hop trace diagnostics#91

Open
dmduran12 wants to merge 1 commit intorightup:devfrom
dmduran12:feat/api-trace
Open

feat: add POST /api/trace endpoint for multi-hop trace diagnostics#91
dmduran12 wants to merge 1 commit intorightup:devfrom
dmduran12:feat/api-trace

Conversation

@dmduran12
Copy link

Summary

Adds a dedicated POST /api/trace endpoint for multi-hop MeshCore TRACE diagnostics, separate from the existing single-hop ping_neighbor.

Changes

repeater/web/api_endpoints.py — new trace() method

  • Accepts {"path": ["AA", "BB", "CC"], "timeout": 30}
  • Validates each hop is a valid byte (0x00–0xFF)
  • Creates trace packet via PacketBuilder.create_trace(path=trace_path)
  • Same TraceHelper.register_ping() / router.inject_packet() / event-loop pattern as ping_neighbor
  • Returns path, per-hop SNR, RTT, RSSI, final SNR

repeater/handler_helpers/trace.py — per-hop SNR extraction

  • process_trace_packet() now extracts SNR values from packet.path[:packet.path_len] using snr_register_to_db()
  • Stored as hop_snrs in the ping result — available to both /api/trace and /api/ping_neighbor

Response shape

{
  "success": true,
  "data": {
    "path": ["0xaa", "0xbb", "0xcc"],
    "hop_snrs": [{"raw": 58, "db": 14.5}, {"raw": 33, "db": 8.2}],
    "rtt_ms": 3247.12,
    "snr_db": 12.1,
    "rssi": -87,
    "tag": 12345
  }
}

What's NOT changed

/api/ping_neighbor is untouched — single-hop ping stays semantically separate.

Co-Authored-By: Warp agent@warp.dev

Adds a dedicated /api/trace endpoint that sends a MeshCore TRACE packet
along a specified multi-hop path and returns per-hop signal quality data.

- New endpoint accepts {path: ["AA","BB","CC"], timeout: 30}
- Each hop in the path records its receive-SNR as the packet traverses
- Response includes hop_snrs array with raw register + dB values
- Existing /api/ping_neighbor is untouched (single-hop stays separate)

Co-Authored-By: Warp <agent@warp.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant