diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index d25cadcc5..7e74f5664 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -2732,6 +2732,8 @@ int MachineObject::parse_json(std::string payload) uint64_t t_utc = j.value("t_utc", 0ULL); if (t_utc > 0) last_utc_time = std::chrono::system_clock::time_point(t_utc * 1ms); + else + last_utc_time = last_update_time; BOOST_LOG_TRIVIAL(trace) << "parse_json: dev_id=" << dev_id << ", playload=" << j.dump(4); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index b15d641f2..b067fdb25 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2800,7 +2800,7 @@ void GUI_App::copy_network_if_available() { if (app_config->get("update_network_plugin") != "true") return; - std::string network_library, player_library, network_library_dst, player_library_dst; + std::string network_library, player_library, live555_library, network_library_dst, player_library_dst, live555_library_dst; std::string data_dir_str = data_dir(); boost::filesystem::path data_dir_path(data_dir_str); auto plugin_folder = data_dir_path / "plugins"; @@ -2808,19 +2808,25 @@ void GUI_App::copy_network_if_available() std::string changelog_file = cache_folder.string() + "/network_plugins.json"; #if defined(_MSC_VER) || defined(_WIN32) network_library = cache_folder.string() + "/bambu_networking.dll"; - player_library = cache_folder.string() + "/BambuSource.dll"; + player_library = cache_folder.string() + "/BambuSource.dll"; + live555_library = cache_folder.string() + "/live555.dll"; network_library_dst = plugin_folder.string() + "/bambu_networking.dll"; - player_library_dst = plugin_folder.string() + "/BambuSource.dll"; + player_library_dst = plugin_folder.string() + "/BambuSource.dll"; + live555_library_dst = plugin_folder.string() + "/live555.dll"; #elif defined(__WXMAC__) network_library = cache_folder.string() + "/libbambu_networking.dylib"; player_library = cache_folder.string() + "/libBambuSource.dylib"; + live555_library = cache_folder.string() + "/liblive555.dylib"; network_library_dst = plugin_folder.string() + "/libbambu_networking.dylib"; player_library_dst = plugin_folder.string() + "/libBambuSource.dylib"; + live555_library_dst = plugin_folder.string() + "/liblive555.dylib"; #else network_library = cache_folder.string() + "/libbambu_networking.so"; - player_library = cache_folder.string() + "/libBambuSource.so"; + player_library = cache_folder.string() + "/libBambuSource.so"; + live555_library = cache_folder.string() + "/liblive555.so"; network_library_dst = plugin_folder.string() + "/libbambu_networking.so"; - player_library_dst = plugin_folder.string() + "/libBambuSource.so"; + player_library_dst = plugin_folder.string() + "/libBambuSource.so"; + live555_library_dst = plugin_folder.string() + "/liblive555.so"; #endif BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< ": checking network_library " << network_library << ", player_library " << player_library; @@ -2854,6 +2860,19 @@ void GUI_App::copy_network_if_available() fs::remove(player_library); BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< ": Copying player library from" << player_library << " to " << player_library_dst<<" successfully."; } + + if (boost::filesystem::exists(live555_library)) { + CopyFileResult cfr = copy_file(live555_library, live555_library_dst, error_message, false); + if (cfr != CopyFileResult::SUCCESS) { + BOOST_LOG_TRIVIAL(error) << __FUNCTION__<< ": Copying failed(" << cfr << "): " << error_message; + return; + } + + static constexpr const auto perms = fs::owner_read | fs::owner_write | fs::group_read | fs::others_read; + fs::permissions(live555_library_dst, perms); + fs::remove(live555_library); + BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< ": Copying live555 library from" << live555_library << " to " << live555_library_dst<<" successfully."; + } if (boost::filesystem::exists(changelog_file)) fs::remove(changelog_file); app_config->set("update_network_plugin", "false"); diff --git a/src/slic3r/GUI/MediaPlayCtrl.cpp b/src/slic3r/GUI/MediaPlayCtrl.cpp index 4e5f1aaec..d4e3b58b7 100644 --- a/src/slic3r/GUI/MediaPlayCtrl.cpp +++ b/src/slic3r/GUI/MediaPlayCtrl.cpp @@ -650,10 +650,14 @@ bool MediaPlayCtrl::start_stream_service(bool *need_install) boost::filesystem::path start_dir(boost::filesystem::path(data_dir()) / "plugins"); #ifdef __WXMSW__ start_dir = boost::filesystem::path(data_dir()) / "cameratools"; - std::string file_dll = data_dir() + "/cameratools/BambuSource.dll"; + std::string file_dll = data_dir() + "/cameratools/BambuSource.dll"; std::string file_dll2 = data_dir() + "/plugins/BambuSource.dll"; + std::string live555_dll = data_dir() + "/cameratools/live555.dll"; + std::string live555_dll2 = data_dir() + "/plugins/live555.dll"; if (!boost::filesystem::exists(file_dll) || boost::filesystem::last_write_time(file_dll) != boost::filesystem::last_write_time(file_dll2)) boost::filesystem::copy_file(file_dll2, file_dll, boost::filesystem::copy_option::overwrite_if_exists); + if (!boost::filesystem::exists(live555_dll) || boost::filesystem::last_write_time(live555_dll) != boost::filesystem::last_write_time(live555_dll2)) + boost::filesystem::copy_file(live555_dll2, live555_dll, boost::filesystem::copy_option::overwrite_if_exists); static std::locale tmp = std::locale(std::locale(), new boost::nowide::utf8_codecvt()); boost::process::imbue(tmp); boost::process::child process_source(file_source, into_u8(file_url2), boost::process::start_dir(start_dir), boost::process::windows::create_no_window, diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index d2213b6fa..9c1e44ae9 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -900,22 +900,26 @@ bool PresetUpdater::priv::get_cached_plugins_version(std::string& cached_version std::string data_dir_str = data_dir(); boost::filesystem::path data_dir_path(data_dir_str); auto cache_folder = data_dir_path / "ota"; - std::string network_library, player_library; + std::string network_library, player_library, live555_library; bool has_plugins = false; #if defined(_MSC_VER) || defined(_WIN32) network_library = cache_folder.string() + "/bambu_networking.dll"; - player_library = cache_folder.string() + "/BambuSource.dll"; + player_library = cache_folder.string() + "/BambuSource.dll"; + live555_library = cache_folder.string() + "/live555.dll"; #elif defined(__WXMAC__) network_library = cache_folder.string() + "/libbambu_networking.dylib"; - player_library = cache_folder.string() + "/libBambuSource.dylib"; + player_library = cache_folder.string() + "/libBambuSource.dylib"; + live555_library = cache_folder.string() + "/liblive555.dylib"; #else network_library = cache_folder.string() + "/libbambu_networking.so"; - player_library = cache_folder.string() + "/libBambuSource.so"; + player_library = cache_folder.string() + "/libBambuSource.so"; + live555_library = cache_folder.string() + "/liblive555.so"; #endif if (boost::filesystem::exists(network_library) - && boost::filesystem::exists(player_library)) + && boost::filesystem::exists(player_library) + && boost::filesystem::exists(live555_library)) { std::string changelog_file = cache_folder.string() + "/network_plugins.json"; has_plugins = true; @@ -977,13 +981,16 @@ void PresetUpdater::priv::sync_plugins(std::string http_url, std::string plugin_ #if defined(_MSC_VER) || defined(_WIN32) auto network_library = cache_folder / "bambu_networking.dll"; - auto player_library = cache_folder / "BambuSource.dll"; + auto player_library = cache_folder / "BambuSource.dll"; + auto live555_library = cache_folder / "live555.dll"; #elif defined(__WXMAC__) auto network_library = cache_folder / "libbambu_networking.dylib"; auto player_library = cache_folder / "libBambuSource.dylib"; + auto live555_library = cache_folder / "liblive555.dylib"; #else auto network_library = cache_folder / "libbambu_networking.so"; auto player_library = cache_folder / "libBambuSource.so"; + auto live555_library = cache_folder / "liblive555.so"; #endif auto changelog_file = cache_folder / "network_plugins.json"; @@ -1007,6 +1014,16 @@ void PresetUpdater::priv::sync_plugins(std::string http_url, std::string plugin_ BOOST_LOG_TRIVIAL(error) << "Failed removing the plugins file " << player_library.string(); } } + if (boost::filesystem::exists(live555_library)) + { + + BOOST_LOG_TRIVIAL(info) << "[remove_old_networking_plugins] remove the file " << live555_library.string(); + try { + fs::remove(live555_library); + } catch (...) { + BOOST_LOG_TRIVIAL(error) << "Failed removing the plugins file " << live555_library.string(); + } + } if (boost::filesystem::exists(changelog_file)) {