Skip to content

Conversation

@jp-bennett
Copy link
Collaborator

Add an option to dump decoded packets to a local file, in JSON format.

Copy link
Contributor

Copilot AI left a 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 JSONFile and JSONFilter configuration 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.

@mdecourcy
Copy link

Should we handle log rotation/expiry?

@jp-bennett
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants