Public Access
M3 step 4: the LoRa Scanner App, Sniffer and Captures
The Sniffer lists packets newest first (time, RSSI, SNR, and for Meshtastic the sender, receiver and hops), with the clear header and a hex dump on Enter (Q96); `p` picks an EU868 preset, kept in Settings (Q95). `c` starts a Capture: pcap with LoRaTap in /captures/lora, its own Clean-up category, recorded by a small Service so it carries on with the App closed (Q97, Q100). The Status Bar shows L while listening, bright on each packet, and CAP while capturing (Q101). StorageService gains raw appends for binary files. Debug Builds get `lora inject` to test all of this with no transmitter in range: a Capture made on the device reads back in TShark field for field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "app.h"
|
||||
#include "list_model.h"
|
||||
#include "services/clock_service.h"
|
||||
#include "services/lora_capture_service.h"
|
||||
#include "services/radio_service.h"
|
||||
#include "settings.h"
|
||||
#include "ui/theme.h"
|
||||
|
||||
namespace roro {
|
||||
|
||||
// The LoRa Scanner (docs/milestones/M3.md). Sniffer: the packets the radio hears, newest first,
|
||||
// with the Meshtastic header read (Q96) and a hex dump on Enter; p picks the preset (Q95), c starts
|
||||
// or stops a Capture (Q97). The radio listens while the App is open (Q100).
|
||||
class LoraScannerApp : public App {
|
||||
public:
|
||||
LoraScannerApp(RadioService& radio, LoraCaptureService& capture, Settings& settings, ClockService& clock)
|
||||
: radio_(radio), capture_(capture), settings_(settings), clock_(clock) {}
|
||||
void onEnter() override;
|
||||
void onExit() override;
|
||||
bool onKey(const KeyEvent& e) override;
|
||||
void update(uint32_t nowMs) override;
|
||||
void draw(Canvas& c) override;
|
||||
|
||||
private:
|
||||
enum class View { Packets, Details, Presets };
|
||||
static constexpr int kListRows = 7;
|
||||
|
||||
void drawPackets(Canvas& c);
|
||||
void drawDetails(Canvas& c);
|
||||
void drawPresets(Canvas& c);
|
||||
void openDetails();
|
||||
std::string timeOf(const RadioPacket& p) const;
|
||||
bool meshtasticSettings() const;
|
||||
void say(const std::string& text); // a line in the footer for a few seconds
|
||||
|
||||
RadioService& radio_;
|
||||
LoraCaptureService& capture_;
|
||||
Settings& settings_;
|
||||
ClockService& clock_;
|
||||
View view_ = View::Packets;
|
||||
ListModel packets_{kListRows};
|
||||
ListModel presets_{kListRows + 1};
|
||||
uint32_t shownSeq_ = 0; // the newest packet at the last redraw
|
||||
uint32_t selectedSeq_ = 0; // what the selection points at, kept as packets arrive
|
||||
bool followNewest_ = true; // until the user moves the selection off the top
|
||||
std::vector<std::string> details_;
|
||||
int detailsTop_ = 0;
|
||||
uint32_t lastDrawMs_ = 0;
|
||||
std::string message_;
|
||||
uint32_t messageMs_ = 0;
|
||||
};
|
||||
|
||||
} // namespace roro
|
||||
Reference in New Issue
Block a user