Skip to content

feat: add sw_MachineHeartbeat with JSON-RPC passthrough support#440

Merged
LiuLikeQian merged 3 commits into
Snapmaker:feature_wcp_0610from
SukiSunYuhang:feature_wcp_machineheartbeat
Jun 5, 2026
Merged

feat: add sw_MachineHeartbeat with JSON-RPC passthrough support#440
LiuLikeQian merged 3 commits into
Snapmaker:feature_wcp_0610from
SukiSunYuhang:feature_wcp_machineheartbeat

Conversation

@SukiSunYuhang
Copy link
Copy Markdown

  • 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

Summary

  • Add sw_MachineHeartbeat WCP command for device heartbeat via MQTT
  • Implement passthrough mechanism in RequestCallback to support raw JSON-RPC request/response
  • Bypass send_to_request wrapping for heartbeat (raw params published directly)

Changes

  • PrintHost.hpp: Add async_machine_heartbeat virtual method
  • MoonRaker.hpp/cpp: Add passthrough flag to RequestCallback, add_response_target, get_request_callback; implement heartbeat bypassing send_to_request
  • SSWCP.hpp/cpp: Add sw_MachineHeartbeat handler with pass-through logic
  • Clean up on_response_arrived and on_auth_arrived: remove logs, try-catch, Chinese comments

- 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
Comment thread src/slic3r/Utils/MoonRaker.cpp Outdated
wcp_loger.add_log("认证响应处理完成", false, "", "Moonraker_Mqtt", "info");
cb(res);
int64_t id = body["id"].get<int64_t>();
auto [cb, _] = get_request_callback(id);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    auto cb = get_request_callback(id); only return one parameter, "_" do nothing.

Comment thread src/slic3r/Utils/MoonRaker.cpp
Comment thread src/slic3r/Utils/MoonRaker.cpp Outdated
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);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned above

Comment thread src/slic3r/Utils/MoonRaker.cpp
…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
@LiuLikeQian LiuLikeQian merged commit c1adb4d into Snapmaker:feature_wcp_0610 Jun 5, 2026
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