Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nebula_hw_interfaces): handling http get post request exception #264

Merged
merged 16 commits into from
Feb 17, 2025
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define BOOST_ALLOW_DEPRECATED_HEADERS
#endif

#include "nebula_common/util/expected.hpp"
#include "nebula_hw_interfaces/nebula_hw_interfaces_common/nebula_hw_interface_base.hpp"

#include <boost_tcp_driver/http_client_driver.hpp>
Expand Down Expand Up @@ -69,8 +70,9 @@ class VelodyneHwInterface
std::string target_reset_{"/cgi/reset"};
void string_callback(const std::string & str);

std::string http_get_request(const std::string & endpoint);
std::string http_post_request(const std::string & endpoint, const std::string & body);
nebula::util::expected<std::string, Status> http_get_request(const std::string & endpoint);
nebula::util::expected<std::string, Status> http_post_request(
const std::string & endpoint, const std::string & body);

/// @brief Get a one-off HTTP client to communicate with the hardware
/// @param ctx IO Context
Expand Down Expand Up @@ -152,13 +154,13 @@ class VelodyneHwInterface
VelodyneStatus init_http_client();
/// @brief Getting the current operational state and parameters of the sensor (sync)
/// @return Resulting JSON string
std::string get_status();
nebula::util::expected<std::string, Status> get_status();
/// @brief Getting diagnostic information from the sensor (sync)
/// @return Resulting JSON string
std::string get_diag();
nebula::util::expected<std::string, Status> get_diag();
/// @brief Getting current sensor configuration and status data (sync)
/// @return Resulting JSON string
std::string get_snapshot();
nebula::util::expected<std::string, Status> get_snapshot();
/// @brief Setting Motor RPM (sync)
/// @param rpm the RPM of the motor
/// @return Resulting status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,79 @@
{
}

std::string VelodyneHwInterface::http_get_request(const std::string & endpoint)
nebula::util::expected<std::string, Status> VelodyneHwInterface::http_get_request(

Check warning on line 20 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L20

Added line #L20 was not covered by tests
const std::string & endpoint)
{
std::lock_guard lock(mtx_inflight_request_);
if (!http_client_driver_->client()->isOpen()) {
http_client_driver_->client()->open();
constexpr int max_retries = 3;
constexpr int retry_delay_ms = 100;

for (int retry = 0; retry < max_retries; ++retry) {

Check warning on line 27 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L27

Added line #L27 was not covered by tests
try {
if (!http_client_driver_->client()->isOpen()) {
http_client_driver_->client()->open();

Check warning on line 30 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L30

Added line #L30 was not covered by tests
}

std::string response = http_client_driver_->get(endpoint);
http_client_driver_->client()->close();
return nebula::util::expected<std::string, Status>(response);
} catch (const std::exception & ex) {

Check warning on line 36 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L33-L36

Added lines #L33 - L36 were not covered by tests
if (retry == max_retries - 1) {
return nebula::util::expected<std::string, Status>(Status::HTTP_CONNECTION_ERROR);
}

if (http_client_driver_->client()->isOpen()) {
try {
http_client_driver_->client()->close();
} catch (const std::exception & ex) {

Check warning on line 44 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L43-L44

Added lines #L43 - L44 were not covered by tests
return nebula::util::expected<std::string, Status>(Status::HTTP_CONNECTION_ERROR);
}

Check warning on line 46 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L46

Added line #L46 was not covered by tests
}

std::this_thread::sleep_for(std::chrono::milliseconds(retry_delay_ms));
}

Check warning on line 50 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L49-L50

Added lines #L49 - L50 were not covered by tests
}

std::string response = http_client_driver_->get(endpoint);
http_client_driver_->client()->close();
return response;
return nebula::util::expected<std::string, Status>(Status::HTTP_CONNECTION_ERROR);
}

std::string VelodyneHwInterface::http_post_request(
nebula::util::expected<std::string, Status> VelodyneHwInterface::http_post_request(

Check warning on line 56 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L56

Added line #L56 was not covered by tests
const std::string & endpoint, const std::string & body)
{
std::lock_guard lock(mtx_inflight_request_);
if (!http_client_driver_->client()->isOpen()) {
http_client_driver_->client()->open();
constexpr int max_retries = 3;
constexpr int retry_delay_ms = 100;

for (int retry = 0; retry < max_retries; ++retry) {
try {
if (!http_client_driver_->client()->isOpen()) {
http_client_driver_->client()->open();

Check warning on line 66 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L66

Added line #L66 was not covered by tests
}

std::string response = http_client_driver_->post(endpoint, body);
http_client_driver_->client()->close();
return nebula::util::expected<std::string, Status>(response);
} catch (const std::exception & ex) {

Check warning on line 72 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L69-L72

Added lines #L69 - L72 were not covered by tests
if (retry == max_retries - 1) {
return nebula::util::expected<std::string, Status>(Status::HTTP_CONNECTION_ERROR);
}
print_debug(
"HTTP POST retry " + std::to_string(retry + 1) + "/" + std::to_string(max_retries) + ": " +
std::string(ex.what()));

Check warning on line 78 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L76-L78

Added lines #L76 - L78 were not covered by tests

if (http_client_driver_->client()->isOpen()) {
try {
http_client_driver_->client()->close();
} catch (const std::exception & ex) {

Check warning on line 83 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L82-L83

Added lines #L82 - L83 were not covered by tests
return nebula::util::expected<std::string, Status>(Status::HTTP_CONNECTION_ERROR);
}

Check warning on line 85 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L85

Added line #L85 was not covered by tests
}

std::this_thread::sleep_for(std::chrono::milliseconds(retry_delay_ms));
}

Check warning on line 89 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L88-L89

Added lines #L88 - L89 were not covered by tests
}

std::string response = http_client_driver_->post(endpoint, body);
http_client_driver_->client()->close();
return response;
return nebula::util::expected<std::string, Status>(Status::HTTP_CONNECTION_ERROR);
}

Status VelodyneHwInterface::initialize_sensor_configuration(
Expand All @@ -53,7 +103,10 @@
std::shared_ptr<const VelodyneSensorConfiguration> sensor_configuration)
{
auto snapshot = get_snapshot();
auto tree = parse_json(snapshot);
if (!snapshot.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 107 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L107

Added line #L107 was not covered by tests
}
auto tree = parse_json(snapshot.value());

Check warning on line 109 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L109

Added line #L109 was not covered by tests
VelodyneStatus status = check_and_set_config(sensor_configuration, tree);

return status;
Expand Down Expand Up @@ -102,7 +155,7 @@
std::stringstream ss;
ss << sensor_configuration;
print_debug(ss.str());
return Status::ERROR_1;
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 158 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L158

Added line #L158 was not covered by tests
}

VelodyneStatus VelodyneHwInterface::init_http_client()
Expand Down Expand Up @@ -243,19 +296,21 @@

// sync

std::string VelodyneHwInterface::get_status()
nebula::util::expected<std::string, Status> VelodyneHwInterface::get_status()

Check warning on line 299 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L299

Added line #L299 was not covered by tests
{
return http_get_request(target_status_);
}

std::string VelodyneHwInterface::get_diag()
nebula::util::expected<std::string, Status> VelodyneHwInterface::get_diag()

Check warning on line 304 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L304

Added line #L304 was not covered by tests
{
auto rt = http_get_request(target_diag_);
std::cout << "read_response: " << rt << std::endl;
return rt;
auto response = http_get_request(target_diag_);

Check warning on line 306 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L306

Added line #L306 was not covered by tests
if (response.has_value()) {
std::cout << "read_response: " << response.value() << std::endl;

Check warning on line 308 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L308

Added line #L308 was not covered by tests
}
return response;

Check warning on line 310 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L310

Added line #L310 was not covered by tests
}

std::string VelodyneHwInterface::get_snapshot()
nebula::util::expected<std::string, Status> VelodyneHwInterface::get_snapshot()

Check warning on line 313 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L313

Added line #L313 was not covered by tests
{
return http_get_request(target_snapshot_);
}
Expand All @@ -266,7 +321,10 @@
return VelodyneStatus::INVALID_RPM_ERROR;
}
auto rt = http_post_request(target_setting_, (boost::format("rpm=%d") % rpm).str());
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 325 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L325

Added line #L325 was not covered by tests
}
string_callback(rt.value());

Check warning on line 327 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L327

Added line #L327 was not covered by tests
return Status::OK;
}

Expand All @@ -276,7 +334,10 @@
return VelodyneStatus::INVALID_FOV_ERROR;
}
auto rt = http_post_request(target_fov_, (boost::format("start=%d") % fov_start).str());
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 338 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L338

Added line #L338 was not covered by tests
}
string_callback(rt.value());

Check warning on line 340 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L340

Added line #L340 was not covered by tests
return Status::OK;
}

Expand All @@ -286,7 +347,10 @@
return VelodyneStatus::INVALID_FOV_ERROR;
}
auto rt = http_post_request(target_fov_, (boost::format("end=%d") % fov_end).str());
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 351 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L351

Added line #L351 was not covered by tests
}
string_callback(rt.value());

Check warning on line 353 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L353

Added line #L353 was not covered by tests
return Status::OK;
}

Expand All @@ -307,97 +371,136 @@
return VelodyneStatus::INVALID_RETURN_MODE_ERROR;
}
auto rt = http_post_request(target_setting_, body_str);
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 375 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L375

Added line #L375 was not covered by tests
}
string_callback(rt.value());

Check warning on line 377 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L377

Added line #L377 was not covered by tests
return Status::OK;
}

VelodyneStatus VelodyneHwInterface::save_config()
{
std::string body_str = "submit";
auto rt = http_post_request(target_save_, body_str);
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 386 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L386

Added line #L386 was not covered by tests
}
string_callback(rt.value());

Check warning on line 388 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L388

Added line #L388 was not covered by tests
return Status::OK;
}

VelodyneStatus VelodyneHwInterface::reset_system()
{
std::string body_str = "reset_system";
auto rt = http_post_request(target_reset_, body_str);
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 397 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L397

Added line #L397 was not covered by tests
}
string_callback(rt.value());

Check warning on line 399 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L399

Added line #L399 was not covered by tests
return Status::OK;
}

VelodyneStatus VelodyneHwInterface::laser_on()
{
std::string body_str = "laser=on";
auto rt = http_post_request(target_setting_, body_str);
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 408 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L408

Added line #L408 was not covered by tests
}
string_callback(rt.value());

Check warning on line 410 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L410

Added line #L410 was not covered by tests
return Status::OK;
}

VelodyneStatus VelodyneHwInterface::laser_off()
{
std::string body_str = "laser=off";
auto rt = http_post_request(target_setting_, body_str);
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 419 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L419

Added line #L419 was not covered by tests
}
string_callback(rt.value());

Check warning on line 421 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L421

Added line #L421 was not covered by tests
return Status::OK;
}

VelodyneStatus VelodyneHwInterface::laser_on_off(bool on)
{
std::string body_str = (boost::format("laser=%s") % (on ? "on" : "off")).str();
auto rt = http_post_request(target_setting_, body_str);
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 430 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L430

Added line #L430 was not covered by tests
}
string_callback(rt.value());

Check warning on line 432 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L432

Added line #L432 was not covered by tests
return Status::OK;
}

VelodyneStatus VelodyneHwInterface::set_host_addr(std::string addr)
{
auto rt = http_post_request(target_host_, (boost::format("addr=%s") % addr).str());
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 440 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L440

Added line #L440 was not covered by tests
}
string_callback(rt.value());

Check warning on line 442 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L442

Added line #L442 was not covered by tests
return Status::OK;
}

VelodyneStatus VelodyneHwInterface::set_host_dport(uint16_t dport)
{
auto rt = http_post_request(target_host_, (boost::format("dport=%d") % dport).str());
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 450 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L450

Added line #L450 was not covered by tests
}
string_callback(rt.value());

Check warning on line 452 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L452

Added line #L452 was not covered by tests
return Status::OK;
}

VelodyneStatus VelodyneHwInterface::set_host_tport(uint16_t tport)
{
auto rt = http_post_request(target_host_, (boost::format("tport=%d") % tport).str());
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 460 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L460

Added line #L460 was not covered by tests
}
string_callback(rt.value());

Check warning on line 462 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L462

Added line #L462 was not covered by tests
return Status::OK;
}

VelodyneStatus VelodyneHwInterface::set_net_addr(std::string addr)
{
auto rt = http_post_request(target_net_, (boost::format("addr=%s") % addr).str());
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 470 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L470

Added line #L470 was not covered by tests
}
string_callback(rt.value());

Check warning on line 472 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L472

Added line #L472 was not covered by tests
return Status::OK;
}

VelodyneStatus VelodyneHwInterface::set_net_mask(std::string mask)
{
auto rt = http_post_request(target_net_, (boost::format("mask=%s") % mask).str());
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 480 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L480

Added line #L480 was not covered by tests
}
string_callback(rt.value());

Check warning on line 482 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L482

Added line #L482 was not covered by tests
return Status::OK;
}

VelodyneStatus VelodyneHwInterface::set_net_gateway(std::string gateway)
{
auto rt = http_post_request(target_net_, (boost::format("gateway=%s") % gateway).str());
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 490 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L490

Added line #L490 was not covered by tests
}
string_callback(rt.value());

Check warning on line 492 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L492

Added line #L492 was not covered by tests
return Status::OK;
}

VelodyneStatus VelodyneHwInterface::set_net_dhcp(bool use_dhcp)
{
auto rt =
http_post_request(target_net_, (boost::format("dhcp=%s") % (use_dhcp ? "on" : "off")).str());
string_callback(rt);
if (!rt.has_value()) {
return Status::HTTP_CONNECTION_ERROR;

Check warning on line 501 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L501

Added line #L501 was not covered by tests
}
string_callback(rt.value());

Check warning on line 503 in nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp#L503

Added line #L503 was not covered by tests
return Status::OK;
}

Expand Down
Loading