Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/ur_client_library/ur/dashboard_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions src/ur/dashboard_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/ur/dashboard_client_implementation_g5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 " +
Expand Down
15 changes: 13 additions & 2 deletions src/ur/dashboard_client_implementation_x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,15 +480,26 @@ 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"))
{
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);
Expand Down
Loading