Public Access
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
45 lines
1.5 KiB
C++
45 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include "event_bus.h"
|
|
#include "service.h"
|
|
#include "services/clock_service.h"
|
|
#include "services/radio_service.h"
|
|
#include "services/storage_service.h"
|
|
|
|
namespace roro {
|
|
|
|
// A LoRa Sniffer Capture (CONTEXT.md: Capture; M3, Q97): every packet the radio receives, as pcap
|
|
// with LoRaTap headers, in /captures/lora/. Started and stopped by hand; keeps the radio listening
|
|
// and keeps recording whatever App is open (Q100).
|
|
class LoraCaptureService : public Service {
|
|
public:
|
|
LoraCaptureService(RadioService& radio, StorageService& storage, ClockService& clock, EventBus& bus)
|
|
: radio_(radio), storage_(storage), clock_(clock), bus_(bus) {}
|
|
const char* name() const override { return "lora-capture"; }
|
|
uint32_t tickIntervalMs() const override { return 200; }
|
|
void tick(uint32_t nowMs) override;
|
|
|
|
std::string start(uint32_t nowMs); // why it can't, or ""
|
|
void stop();
|
|
bool capturing() const { return !path_.empty(); }
|
|
const std::string& path() const { return path_; }
|
|
uint32_t packets() const { return packets_; }
|
|
|
|
private:
|
|
void notify(const std::string& text);
|
|
|
|
RadioService& radio_;
|
|
StorageService& storage_;
|
|
ClockService& clock_;
|
|
EventBus& bus_;
|
|
std::string path_;
|
|
uint32_t written_ = 0; // the radio's seq last written
|
|
uint32_t packets_ = 0;
|
|
int64_t startUtc_ = 0; // the Clock and millis() when it started: packet times follow from both
|
|
uint32_t startMs_ = 0;
|
|
};
|
|
|
|
} // namespace roro
|