From 0dccfc65b47ad06d6c090a4abd5bf53752c4ec6b Mon Sep 17 00:00:00 2001 From: Jacob Larsen Date: Thu, 26 Feb 2026 13:58:35 +0000 Subject: [PATCH 1/5] Add check to make sure that program name and save path is specified when downloading program. Also renamed the input parameter for clarity --- src/ur/dashboard_client_implementation_x.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ur/dashboard_client_implementation_x.cpp b/src/ur/dashboard_client_implementation_x.cpp index c5c9a8cc3..b61e433a8 100644 --- a/src/ur/dashboard_client_implementation_x.cpp +++ b/src/ur/dashboard_client_implementation_x.cpp @@ -480,7 +480,7 @@ DashboardResponse DashboardClientImplX::commandUpdateProgram(const std::string& file_path, [this](const std::string& e, const httplib::UploadFormDataItems& f) { return put(e, f); }); } -DashboardResponse DashboardClientImplX::commandDownloadProgram(const std::string& filename, +DashboardResponse DashboardClientImplX::commandDownloadProgram(const std::string& program_name, const std::string& save_path) { if (robot_api_version_ < VersionInformation::fromString("3.1.4")) @@ -488,7 +488,18 @@ DashboardResponse DashboardClientImplX::commandDownloadProgram(const std::string throw NotImplementedException("commandDownloadProgram is not implemented for Robot API version < 3.1.4. Please " "upgrade the robot to PolyScope 10.12.0 or higher to use this command."); } - auto response = get("/programs/v1/" + filename, false); // The json response is pretty long. Don't print it. + if (program_name.size() == 0 || save_path.size() == 0) + { + std::string error = "Both program_name and save_path parameters should be populated."; + error += program_name.size() == 0 ? " Program name is empty." : ""; + error += save_path.size() == 0 ? " Save path is empty." : ""; + URCL_LOG_ERROR(error.c_str()); + DashboardResponse response; + response.ok = false; + response.message = error; + return response; + } + auto response = get("/programs/v1/" + program_name, false); // The json response is pretty long. Don't print it. if (response.ok) { std::ofstream save_file(save_path, std::ios_base::out); From c49c6e9a3045eeaea20c80a215ba51726b8b2614 Mon Sep 17 00:00:00 2001 From: Jacob Larsen Date: Thu, 5 Mar 2026 08:38:39 +0000 Subject: [PATCH 2/5] Update parameter name in header files too --- include/ur_client_library/ur/dashboard_client_implementation.h | 2 +- .../ur_client_library/ur/dashboard_client_implementation_x.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ur_client_library/ur/dashboard_client_implementation.h b/include/ur_client_library/ur/dashboard_client_implementation.h index 9c7d10295..433ffd726 100644 --- a/include/ur_client_library/ur/dashboard_client_implementation.h +++ b/include/ur_client_library/ur/dashboard_client_implementation.h @@ -440,7 +440,7 @@ class DashboardClientImpl virtual DashboardResponse commandUpdateProgram(const std::string& file_path) = 0; - virtual DashboardResponse commandDownloadProgram(const std::string& filename, const std::string& save_path) = 0; + virtual DashboardResponse commandDownloadProgram(const std::string& program_name, const std::string& save_path) = 0; const VersionInformation& getPolyscopeVersion() const { diff --git a/include/ur_client_library/ur/dashboard_client_implementation_x.h b/include/ur_client_library/ur/dashboard_client_implementation_x.h index fd325c8ab..2db0afd88 100644 --- a/include/ur_client_library/ur/dashboard_client_implementation_x.h +++ b/include/ur_client_library/ur/dashboard_client_implementation_x.h @@ -160,7 +160,7 @@ class DashboardClientImplX : public DashboardClientImpl DashboardResponse commandGetProgramList() override; DashboardResponse commandUploadProgram(const std::string& file_path) override; DashboardResponse commandUpdateProgram(const std::string& file_path) override; - DashboardResponse commandDownloadProgram(const std::string& filename, const std::string& save_path) override; + DashboardResponse commandDownloadProgram(const std::string& program_name, const std::string& save_path) override; void setReceiveTimeout(const timeval& timeout) override { From 534f6579fc1832cb542fb9c1b2c642ff260d333d Mon Sep 17 00:00:00 2001 From: Jacob Larsen Date: Thu, 5 Mar 2026 08:52:26 +0000 Subject: [PATCH 3/5] So much duplication --- include/ur_client_library/ur/dashboard_client.h | 4 ++-- .../ur_client_library/ur/dashboard_client_implementation_g5.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ur_client_library/ur/dashboard_client.h b/include/ur_client_library/ur/dashboard_client.h index 342610ff9..8362ec9f2 100644 --- a/include/ur_client_library/ur/dashboard_client.h +++ b/include/ur_client_library/ur/dashboard_client.h @@ -758,12 +758,12 @@ class DashboardClient /*! * \brief Download a program from the robot * - * \param filename The name of the program file on the robot. This is the name as returned by + * \param program_name The name of the program file on the robot. This is the name as returned by * commandGetProgramListWithResponse. \param save_path The path where the program file should be saved on the machine * where the dashboard client is running. * */ - DashboardResponse commandDownloadProgramWithResponse(const std::string& filename, const std::string& save_path); + DashboardResponse commandDownloadProgramWithResponse(const std::string& program_name, const std::string& save_path); /*! * \brief Makes sure that the dashboard_server's version is above the required version diff --git a/include/ur_client_library/ur/dashboard_client_implementation_g5.h b/include/ur_client_library/ur/dashboard_client_implementation_g5.h index 063cce835..d62b89bf5 100644 --- a/include/ur_client_library/ur/dashboard_client_implementation_g5.h +++ b/include/ur_client_library/ur/dashboard_client_implementation_g5.h @@ -163,7 +163,7 @@ class DashboardClientImplG5 : public DashboardClientImpl, comm::TCPSocket DashboardResponse commandGetProgramList() override; DashboardResponse commandUploadProgram(const std::string& file_path) override; DashboardResponse commandUpdateProgram(const std::string& file_path) override; - DashboardResponse commandDownloadProgram(const std::string& filename, const std::string& save_path) override; + DashboardResponse commandDownloadProgram(const std::string& program_name, const std::string& save_path) override; void setReceiveTimeout(const timeval& timeout) override { From bc66e3e36fdbc20d47d7b4a43314c77c86c203e4 Mon Sep 17 00:00:00 2001 From: Jacob Larsen Date: Thu, 5 Mar 2026 08:57:40 +0000 Subject: [PATCH 4/5] one more --- src/ur/dashboard_client_implementation_g5.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ur/dashboard_client_implementation_g5.cpp b/src/ur/dashboard_client_implementation_g5.cpp index e462ac280..51d68ba09 100644 --- a/src/ur/dashboard_client_implementation_g5.cpp +++ b/src/ur/dashboard_client_implementation_g5.cpp @@ -1204,7 +1204,7 @@ DashboardResponse DashboardClientImplG5::commandUpdateProgram(const std::string& ". It is supported from PolyScope 10.12.0 onwards."); } -DashboardResponse DashboardClientImplG5::commandDownloadProgram(const std::string& program_file_name, +DashboardResponse DashboardClientImplG5::commandDownloadProgram(const std::string& program_name, const std::string& destination_path) { throw NotImplementedException("commandDownloadProgram is not available for PolyScope " + From 18df74e58721097e3d460e35b81bcbbb0ebc8570 Mon Sep 17 00:00:00 2001 From: Jacob Larsen Date: Thu, 5 Mar 2026 09:01:30 +0000 Subject: [PATCH 5/5] I think this has to be it --- src/ur/dashboard_client.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ur/dashboard_client.cpp b/src/ur/dashboard_client.cpp index 381ddd07b..a748b6c78 100644 --- a/src/ur/dashboard_client.cpp +++ b/src/ur/dashboard_client.cpp @@ -562,10 +562,10 @@ DashboardResponse DashboardClient::commandUpdateProgramWithResponse(const std::s return impl_->commandUpdateProgram(file_path); } -DashboardResponse DashboardClient::commandDownloadProgramWithResponse(const std::string& filename, +DashboardResponse DashboardClient::commandDownloadProgramWithResponse(const std::string& program_name, const std::string& save_path) { - return impl_->commandDownloadProgram(filename, save_path); + return impl_->commandDownloadProgram(program_name, save_path); } void DashboardClient::assertVersion(const std::string& e_series_min_ver, const std::string& cb3_min_ver,