-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add JSON packet recording option to native #8930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new feature to the Portduino (native) platform that allows decoded mesh packets to be recorded to a local JSON file. Users can configure a file path and optionally filter packets by port number (e.g., only save position, telemetry, or text message packets).
- Adds
JSONFileandJSONFilterconfiguration options to the YAML config - Implements file opening and packet writing logic for JSON recording
- Supports filtering by packet type using port number enums
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/platform/portduino/PortduinoGlue.h | Adds extern declaration for JSONFile stream, new config fields (JSONFilename and JSONFilter), and YAML serialization logic for the new config options |
| src/platform/portduino/PortduinoGlue.cpp | Implements file opening logic for JSONFile with error handling, and config parsing with string-to-enum conversion for filter values |
| src/mesh/Router.cpp | Adds packet recording logic in the decode path that writes JSON-serialized packets to the file when filtering criteria are met |
| bin/config-dist.yaml | Documents the new JSONFile and JSONFilter configuration options with example usage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Should we handle log rotation/expiry? |
That would be a nice addition, yes. I think this could be merged without it, but some features around that idea would be nice. I even considered adding a way to get the timestamp in the file name. |
Add an option to dump decoded packets to a local file, in JSON format.