feat: add sw_MachineHeartbeat with JSON-RPC passthrough support#440
Merged
LiuLikeQian merged 3 commits intoJun 5, 2026
Merged
Conversation
- Add sw_MachineHeartbeat WCP command for device heartbeat - Add async_machine_heartbeat passthrough to MoonRaker_Mqtt - Add passthrough flag to RequestCallback and add_response_target - Clean up on_response_arrived: remove logs, try-catch, Chinese comments - Clean up on_auth_arrived: remove logs, try-catch, Chinese comments - Clean up add_response_target and get_request_callback: remove logs
LiuLikeQian
reviewed
Jun 4, 2026
| wcp_loger.add_log("认证响应处理完成", false, "", "Moonraker_Mqtt", "info"); | ||
| cb(res); | ||
| int64_t id = body["id"].get<int64_t>(); | ||
| auto [cb, _] = get_request_callback(id); |
Collaborator
There was a problem hiding this comment.
auto cb = get_request_callback(id); only return one parameter, "_" do nothing.
LiuLikeQian
reviewed
Jun 4, 2026
LiuLikeQian
reviewed
Jun 4, 2026
| auto cb = get_request_callback(id); | ||
| delete_response_target(id); | ||
| int64_t id = body["id"].get<int64_t>(); | ||
| auto [cb, passthrough] = get_request_callback(id); |
LiuLikeQian
reviewed
Jun 4, 2026
…logs for null callbacks - on_auth_arrived: change auto [cb, _] to cb = .first() - on_auth_arrived: log error when callback not found - on_response_arrived: log error when callback not found
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.
Summary
sw_MachineHeartbeatWCP command for device heartbeat via MQTTRequestCallbackto support raw JSON-RPC request/responsesend_to_requestwrapping for heartbeat (raw params published directly)Changes
async_machine_heartbeatvirtual methodRequestCallback,add_response_target,get_request_callback; implement heartbeat bypassingsend_to_requestsw_MachineHeartbeathandler with pass-through logicon_response_arrivedandon_auth_arrived: remove logs, try-catch, Chinese comments