Skip to content

feat: add interface to get software basic info#289

Merged
womendoushihaoyin merged 2 commits intoSnapmaker:feature_wcp_softwareinfofrom
SukiSunYuhang:feature_wcp_softwareinfo
Apr 30, 2026
Merged

feat: add interface to get software basic info#289
womendoushihaoyin merged 2 commits intoSnapmaker:feature_wcp_softwareinfofrom
SukiSunYuhang:feature_wcp_softwareinfo

Conversation

@SukiSunYuhang
Copy link
Copy Markdown

@SukiSunYuhang SukiSunYuhang commented Apr 30, 2026

概述

新增 sw_GetSoftwareInfo 命令,供 Flutter Web 端获取软件基础信息。

改动内容

  • SSWCP.hpp: 声明 sw_GetSoftwareInfo() 方法
  • SSWCP.cpp: 在 process() 中添加命令分发,实现 sw_GetSoftwareInfo() 逻辑

接口说明

  • 命令: sw_GetSoftwareInfo
  • 参数: 无
  • 返回:
    • version: 软件版本号
    • http_host: 本地 HTTP 服务器地址

测试计划

  • Flutter Web 端调用接口确认返回数据正确
  • 版本号与 version.inc 一致
  • http_host 端口与 PAGE_HTTP_PORT 一致

Summary

Add sw_GetSoftwareInfo command to provide software basic information to the Flutter Web frontend.

Changes

  • SSWCP.hpp: Declare sw_GetSoftwareInfo() method
  • SSWCP.cpp: Add command dispatch in process() and implement sw_GetSoftwareInfo()

API

  • Command: sw_GetSoftwareInfo
  • Parameters: none
  • Response:
    • version: Software version string
    • http_host: Local HTTP server address

Test plan

  • Verify response data from Flutter Web side
  • Confirm version matches version.inc
  • Confirm http_host port matches PAGE_HTTP_PORT

Comment thread src/slic3r/GUI/SSWCP.cpp Outdated
m_res_data["version"] = std::string(Snapmaker_VERSION);

auto& server = wxGetApp().m_page_http_server;
m_res_data["http_host"] = std::string("127.0.0.1:") + std::to_string(server.get_port());
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.

Don't hardcode 127.0.0.1 directly; there is a macro named LOCALHOST_URL in the HTTP server module that you should use instead.

@womendoushihaoyin
Copy link
Copy Markdown
Collaborator

lgtm

@womendoushihaoyin womendoushihaoyin merged commit 351856b into Snapmaker:feature_wcp_softwareinfo Apr 30, 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