Skip to content

Comments

Refactor Network Handling#79

Merged
k3ldar merged 2 commits intomainfrom
refactor/NetworkHandling
Dec 9, 2025
Merged

Refactor Network Handling#79
k3ldar merged 2 commits intomainfrom
refactor/NetworkHandling

Conversation

@k3ldar
Copy link
Owner

@k3ldar k3ldar commented Dec 9, 2025

No description provided.

Copilot AI review requested due to automatic review settings December 9, 2025 14:04
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 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 NetworkJsonVisitor interface with formatWifiStatusJson(WiFiClient*) method for direct streaming
  • Modified all network handlers to implement both NetworkJsonVisitor and maintain formatStatusJson() 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.

Copy link
Contributor

Copilot AI commented Dec 9, 2025

@k3ldar I've opened a new pull request, #81, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@k3ldar k3ldar merged commit 4203e63 into main Dec 9, 2025
@k3ldar k3ldar deleted the refactor/NetworkHandling branch December 9, 2025 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants