feature add function for cmd forwarding on web.

This commit is contained in:
alves
2026-01-20 17:45:29 +08:00
parent 2085ac9bcc
commit d2f4ece715
3 changed files with 40 additions and 2 deletions

View File

@@ -330,6 +330,7 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
m_button_download->SetSize(wxSize(FromDIP(58), FromDIP(24)));
m_button_download->SetMinSize(wxSize(FromDIP(58), FromDIP(24)));
m_button_download->SetCornerRadius(FromDIP(12));
m_button_download->SetCursor(wxCURSOR_HAND);
m_button_download->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
EndModal(wxID_YES);
@@ -342,6 +343,7 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
m_button_skip_version->SetSize(wxSize(FromDIP(58), FromDIP(24)));
m_button_skip_version->SetMinSize(wxSize(FromDIP(58), FromDIP(24)));
m_button_skip_version->SetCornerRadius(FromDIP(12));
m_button_skip_version->SetCursor(wxCURSOR_HAND);
m_button_skip_version->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
wxGetApp().set_skip_version(true);
@@ -372,6 +374,7 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
m_button_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24)));
m_button_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24)));
m_button_cancel->SetCornerRadius(FromDIP(12));
m_button_cancel->SetCursor(wxCURSOR_HAND);
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
EndModal(wxID_NO);

View File

@@ -2081,8 +2081,12 @@ void SSWCP_MachineOption_Instance::process()
sw_ServerClientManagerSetUserinfo();
} else if (m_cmd == "sw_DefectDetactionConfig"){
sw_DefectDetactionConfig();
} else if (m_cmd == GETCAMERA_TIMELAPSE_INSTANCE) {
CmdForwarding();
}
else if (m_cmd == GET_DEVICEDATA_STORAGESPACE) {
CmdForwarding();
}
else {
handle_general_fail();
}
@@ -3691,6 +3695,28 @@ void SSWCP_MachineOption_Instance::sw_GetTimelapseInstance()
handle_general_fail();
}
}
void SSWCP_MachineOption_Instance::CmdForwarding() {
try {
std::shared_ptr<PrintHost> host = nullptr;
wxGetApp().get_connect_host(host);
if (!host) {
handle_general_fail(-1, "Connection lost!");
return;
}
auto weak_self = std::weak_ptr<SSWCP_Instance>(shared_from_this());
host->async_delete_camera_timelapse(m_param_data, [weak_self](const json& response) {
auto self = weak_self.lock();
if (self) {
SSWCP_Instance::on_mqtt_msg_arrived(self, response);
}
});
} catch (std::exception& e) {
handle_general_fail();
}
}
void SSWCP_MachineOption_Instance::sw_DeleteCameraTimelapse()
{
@@ -5779,7 +5805,9 @@ std::unordered_set<std::string> SSWCP::m_machine_option_cmd_list = {
"sw_DeleteCameraTimelapse",
"sw_GetTimelapseInstance",
"sw_ServerClientManagerSetUserinfo",
"sw_DefectDetactionConfig"
"sw_DefectDetactionConfig",
GETCAMERA_TIMELAPSE_INSTANCE,
GET_DEVICEDATA_STORAGESPACE
};
std::unordered_set<std::string> SSWCP::m_machine_connect_cmd_list = {

View File

@@ -23,7 +23,13 @@ using namespace nlohmann;
namespace asio = boost::asio;
using tcp = asio::ip::tcp;
//WCP Interface definition
#define UPDATE_PRIVACY_STATUS "sw_SubUserUpdatePrivacy"
#define UPLOAD_CAMERA_TIMELAPSE "sw_UploadCameraTimelapse"
#define DELETE_CAMERA_TIMELAPSE "sw_DeleteCameraTimelapse"
#define GETCAMERA_TIMELAPSE_INSTANCE "sw_GetCameraTimelapseInstance"
#define GET_DEVICEDATA_STORAGESPACE "sw_GetDeviceDataStorageSpace"
namespace Slic3r { namespace GUI {
@@ -422,6 +428,7 @@ private:
void sw_DefectDetactionConfig();
void CmdForwarding();
// Download machine file
void sw_DownloadMachineFile();