Skip to content

Add JSON packet recording option to native#8930

Merged
jp-bennett merged 4 commits into
masterfrom
native-json-logging
Dec 13, 2025
Merged

Add JSON packet recording option to native#8930
jp-bennett merged 4 commits into
masterfrom
native-json-logging

Conversation

@jp-bennett

Copy link
Copy Markdown
Collaborator

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread src/platform/portduino/PortduinoGlue.cpp
Comment thread src/platform/portduino/PortduinoGlue.cpp
Comment thread src/mesh/Router.cpp
Comment thread src/platform/portduino/PortduinoGlue.cpp
@mdecourcy

Copy link
Copy Markdown

Should we handle log rotation/expiry?

@jp-bennett

Copy link
Copy Markdown
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.

@jp-bennett jp-bennett merged commit b742381 into master Dec 13, 2025
78 checks passed
@jp-bennett jp-bennett deleted the native-json-logging branch December 13, 2025 00:30
horrible-knots pushed a commit to horrible-knots/firmware that referenced this pull request Dec 13, 2025
scobert969 pushed a commit to zeropt/meshtastic-firmware that referenced this pull request Dec 22, 2025
jeek pushed a commit to jeek/Meshtastic-Exploiteers-Hacker-Pager that referenced this pull request Jun 30, 2026
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