mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-20 20:03:47 +00:00
ENH: Optimization of File Transfer System Part1
jira: [STUDIO-11777] Change-Id: I733fd3532caa19546763ab8a72eb7667d5ffec53 (cherry picked from commit aa52c99076a78e2c8fd8d4e4b0b64de0bc761469)
This commit is contained in:
@@ -535,6 +535,13 @@ bool MachineObject::is_lan_mode_printer() const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string MachineObject::convertToIp(long long ip)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << ((ip >> 0) & 0xFF) << "." << ((ip >> 8) & 0xFF) << "." << ((ip >> 16) & 0xFF) << "." << ((ip >> 24) & 0xFF);
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
PrinterSeries MachineObject::get_printer_series() const
|
PrinterSeries MachineObject::get_printer_series() const
|
||||||
{
|
{
|
||||||
std::string series = DeviceManager::get_printer_series(printer_type);
|
std::string series = DeviceManager::get_printer_series(printer_type);
|
||||||
@@ -3423,8 +3430,24 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||||||
if (jj["net"].contains("conf")) {
|
if (jj["net"].contains("conf")) {
|
||||||
network_wired = (jj["net"]["conf"].get<int>() & (0x1)) != 0;
|
network_wired = (jj["net"]["conf"].get<int>() & (0x1)) != 0;
|
||||||
}
|
}
|
||||||
|
if (jj["net"].contains("info")) {
|
||||||
|
for (auto info_item = jj["net"]["info"].begin(); info_item != jj["net"]["info"].end(); info_item++) {
|
||||||
|
|
||||||
|
if (info_item->contains("ip")) {
|
||||||
|
auto tmp_dev_ip = (*info_item)["ip"].get<int64_t>();
|
||||||
|
if (tmp_dev_ip == 0)
|
||||||
|
continue ;
|
||||||
|
else {
|
||||||
|
set_dev_ip(convertToIp(tmp_dev_ip));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region online
|
#pragma region online
|
||||||
|
|||||||
@@ -509,6 +509,7 @@ public:
|
|||||||
int subscribe_counter{3};
|
int subscribe_counter{3};
|
||||||
std::string dev_connection_type; /* lan | cloud */
|
std::string dev_connection_type; /* lan | cloud */
|
||||||
std::string connection_type() { return dev_connection_type; }
|
std::string connection_type() { return dev_connection_type; }
|
||||||
|
|
||||||
std::string dev_connection_name; /* lan | eth */
|
std::string dev_connection_name; /* lan | eth */
|
||||||
void set_dev_ip(std::string ip) {dev_ip = ip;}
|
void set_dev_ip(std::string ip) {dev_ip = ip;}
|
||||||
std::string get_ftp_folder();
|
std::string get_ftp_folder();
|
||||||
@@ -520,6 +521,7 @@ public:
|
|||||||
void erase_user_access_code();
|
void erase_user_access_code();
|
||||||
std::string get_user_access_code() const;
|
std::string get_user_access_code() const;
|
||||||
bool is_lan_mode_printer() const;
|
bool is_lan_mode_printer() const;
|
||||||
|
std::string convertToIp(long long ip);
|
||||||
|
|
||||||
//PRINTER_TYPE printer_type = PRINTER_3DPrinter_UKNOWN;
|
//PRINTER_TYPE printer_type = PRINTER_3DPrinter_UKNOWN;
|
||||||
std::string printer_type; /* model_id */
|
std::string printer_type; /* model_id */
|
||||||
|
|||||||
@@ -1245,6 +1245,8 @@ void PrinterFileSystem::Reconnect(boost::unique_lock<boost::mutex> &l, int resul
|
|||||||
while (m_stopped) {
|
while (m_stopped) {
|
||||||
if (m_session.owner == nullptr)
|
if (m_session.owner == nullptr)
|
||||||
return;
|
return;
|
||||||
|
m_status = Status::Stopped;
|
||||||
|
SendChangedEvent(EVT_STATUS_CHANGED, m_status);
|
||||||
m_cond.wait(l);
|
m_cond.wait(l);
|
||||||
}
|
}
|
||||||
wxLogMessage("PrinterFileSystem::Reconnect Initializing");
|
wxLogMessage("PrinterFileSystem::Reconnect Initializing");
|
||||||
@@ -1271,6 +1273,7 @@ void PrinterFileSystem::Reconnect(boost::unique_lock<boost::mutex> &l, int resul
|
|||||||
Bambu_Tunnel tunnel = nullptr;
|
Bambu_Tunnel tunnel = nullptr;
|
||||||
int ret = Bambu_Create(&tunnel, url.c_str());
|
int ret = Bambu_Create(&tunnel, url.c_str());
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
|
|
||||||
Bambu_SetLogger(tunnel, DumpLog, this);
|
Bambu_SetLogger(tunnel, DumpLog, this);
|
||||||
ret = Bambu_Open(tunnel);
|
ret = Bambu_Open(tunnel);
|
||||||
}
|
}
|
||||||
@@ -1297,6 +1300,7 @@ void PrinterFileSystem::Reconnect(boost::unique_lock<boost::mutex> &l, int resul
|
|||||||
}
|
}
|
||||||
wxLogMessage("PrinterFileSystem::Reconnect Failed");
|
wxLogMessage("PrinterFileSystem::Reconnect Failed");
|
||||||
m_status = Status::Failed;
|
m_status = Status::Failed;
|
||||||
|
|
||||||
SendChangedEvent(EVT_STATUS_CHANGED, m_status, "", url.size() < 2 ? 1 : m_last_error);
|
SendChangedEvent(EVT_STATUS_CHANGED, m_status, "", url.size() < 2 ? 1 : m_last_error);
|
||||||
m_cond.timed_wait(l, boost::posix_time::seconds(10));
|
m_cond.timed_wait(l, boost::posix_time::seconds(10));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ public:
|
|||||||
ListSyncing,
|
ListSyncing,
|
||||||
ListReady,
|
ListReady,
|
||||||
Failed,
|
Failed,
|
||||||
|
Stopped,
|
||||||
};
|
};
|
||||||
|
|
||||||
Status GetStatus() const { return m_status; }
|
Status GetStatus() const { return m_status; }
|
||||||
|
|||||||
Reference in New Issue
Block a user