Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors network handling by introducing a new NetworkJsonVisitor interface that separates network-specific JSON formatting from general JSON formatting. The key changes consolidate sensor reporting and modify the JSON output mechanism to stream directly to WiFi clients instead of using intermediate buffers.
Key changes:
- Introduced
NetworkJsonVisitorinterface withformatWifiStatusJson(WiFiClient*)method for direct streaming - Modified all network handlers to implement both
NetworkJsonVisitorand maintainformatStatusJson()for serial/other uses - Consolidated sensor JSON visitors into a single
SensorNetworkHandler - Modified
formatJsonResponse()to return unwrapped JSON properties instead of complete objects
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| NetworkJsonVisitor.h | New interface for WiFi-specific JSON formatting with direct client streaming |
| INetworkCommandHandler.h | Changed base class to NetworkJsonVisitor; modified formatJsonResponse to return unwrapped JSON |
| WifiServer.h/cpp | Updated to use NetworkJsonVisitor and stream JSON directly to clients |
| WifiController.h | Updated type references from JsonVisitor to NetworkJsonVisitor |
| *NetworkHandler.h/cpp | All handlers now implement formatWifiStatusJson() alongside formatStatusJson() |
| BaseSensor.h | Added getSensorName() method for JSON property naming |
| SensorNetworkHandler.cpp | Improved JSON formatting with proper error handling and restructured output format |
| SmartFuseBox.ino | Removed individual sensor JSON visitors, now handled by SensorNetworkHandler |
| SystemDefinitions.h | Added buffer status constants (BufferSuccess, BufferInvalid, BufferOverflow) |
| SmartFuseBox.vcxproj.filters | Added NetworkJsonVisitor.h and SensorController.h entries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.