Skip to content

Commit

Permalink
make code conform for clang format check
Browse files Browse the repository at this point in the history
  • Loading branch information
JnsHndr committed Oct 15, 2024
1 parent a8be0da commit 5acae42
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 115 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ class HTTPInterface
HTTPInterface(std::string host, std::string path = "");

const Json::Value get(const std::string& command,
const std::initializer_list<param_type>& list = std::initializer_list<param_type>());
const std::initializer_list<param_type>& list = std::initializer_list<param_type>());

const Json::Value get(const std::string& command,
const param_map_type& params = param_map_type());
const Json::Value get(const std::string& command, const param_map_type& params = param_map_type());

private:
const Json::Value get_(CurlResource& res);
Expand Down
11 changes: 7 additions & 4 deletions src/pf_driver/include/pf_driver/pf/pf_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ class PFInterface
void pfsdp_reboot(int32_t& error_code, std::string& error_text);
void pfsdp_factory(int32_t& error_code, std::string& error_text);
void pfsdp_info(std::string& protocol_name, int32_t& version_major, int32_t& version_minor,
std::vector<std::string>& commands, int32_t& error_code, std::string& error_text);
void pfsdp_list(const char* cmd, const char* out, std::vector<std::string>& params, int32_t& error_code, std::string& error_text);
void pfsdp_get(const char* cmd, const std::string& name, std::string& value, int32_t& error_code, std::string& error_text);
void pfsdp_set(const char* cmd, const std::string& name, const std::string& value, int32_t& error_code, std::string& error_text);
std::vector<std::string>& commands, int32_t& error_code, std::string& error_text);
void pfsdp_list(const char* cmd, const char* out, std::vector<std::string>& params, int32_t& error_code,
std::string& error_text);
void pfsdp_get(const char* cmd, const std::string& name, std::string& value, int32_t& error_code,
std::string& error_text);
void pfsdp_set(const char* cmd, const std::string& name, const std::string& value, int32_t& error_code,
std::string& error_text);
void pfsdp_reset(const char* cmd, const std::string& name, int32_t& error_code, std::string& error_text);

std::vector<std::string> pfsdp_list_iq(void);
Expand Down
12 changes: 8 additions & 4 deletions src/pf_driver/include/pf_driver/pf/pfsdp_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,17 @@ class PFSDPBase

void set_connection_failure_cb(std::function<void()> callback);

void list_parameters(const char* cmd, const char* out, std::vector<std::string>& params, int32_t& error_code, std::string& error_text);
void get_parameter(const char* cmd, const std::string& name, std::string& value, int32_t& error_code, std::string& error_text);
void set_parameter(const char* cmd, const std::string& name, const std::string& value, int32_t& error_code, std::string& error_text);
void list_parameters(const char* cmd, const char* out, std::vector<std::string>& params, int32_t& error_code,
std::string& error_text);
void get_parameter(const char* cmd, const std::string& name, std::string& value, int32_t& error_code,
std::string& error_text);
void set_parameter(const char* cmd, const std::string& name, const std::string& value, int32_t& error_code,
std::string& error_text);
void reset_parameter(const char* cmd, const std::string& name, int32_t& error_code, std::string& error_text);
void reboot(int32_t& error_code, std::string& error_text);
void factory(int32_t& error_code, std::string& error_text);
void info(std::string& n, int32_t& major, int32_t&minor, std::vector<std::string>& cmds, int32_t& error_code, std::string& error_text);
void info(std::string& n, int32_t& major, int32_t& minor, std::vector<std::string>& cmds, int32_t& error_code,
std::string& error_text);

ProtocolInfo get_protocol_info();

Expand Down
45 changes: 25 additions & 20 deletions src/pf_driver/include/pf_driver/ros/pf_services.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,41 @@
#include "pf_interfaces/srv/pfsdp_list_iq_parameters.hpp"

void pfsdp_reboot_device(PFInterface* pf, const std::shared_ptr<pf_interfaces::srv::PfsdpRebootDevice::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpRebootDevice::Response> response);
std::shared_ptr<pf_interfaces::srv::PfsdpRebootDevice::Response> response);

void pfsdp_factory_reset(PFInterface* pf, const std::shared_ptr<pf_interfaces::srv::PfsdpFactoryReset::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpFactoryReset::Response> response);
std::shared_ptr<pf_interfaces::srv::PfsdpFactoryReset::Response> response);

void pfsdp_get_protocol_info(PFInterface* pf, const std::shared_ptr<pf_interfaces::srv::PfsdpGetProtocolInfo::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpGetProtocolInfo::Response> response);
void pfsdp_get_protocol_info(PFInterface* pf,
const std::shared_ptr<pf_interfaces::srv::PfsdpGetProtocolInfo::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpGetProtocolInfo::Response> response);

void pfsdp_list_parameters(PFInterface* pf, const std::shared_ptr<pf_interfaces::srv::PfsdpListParameters::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpListParameters::Response> response);
void pfsdp_list_parameters(PFInterface* pf,
const std::shared_ptr<pf_interfaces::srv::PfsdpListParameters::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpListParameters::Response> response);

void pfsdp_get_parameter(PFInterface* pf, const std::shared_ptr<pf_interfaces::srv::PfsdpGetParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpGetParameter::Response> response);
std::shared_ptr<pf_interfaces::srv::PfsdpGetParameter::Response> response);

void pfsdp_set_parameter(PFInterface* pf, const std::shared_ptr<pf_interfaces::srv::PfsdpSetParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpSetParameter::Response> response);
std::shared_ptr<pf_interfaces::srv::PfsdpSetParameter::Response> response);

void pfsdp_reset_parameter(PFInterface* pf, const std::shared_ptr<pf_interfaces::srv::PfsdpResetParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpResetParameter::Response> response);
void pfsdp_reset_parameter(PFInterface* pf,
const std::shared_ptr<pf_interfaces::srv::PfsdpResetParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpResetParameter::Response> response);

void pfsdp_list_iq_parameters(PFInterface* pf, const std::shared_ptr<pf_interfaces::srv::PfsdpListIqParameters::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpListIqParameters::Response> response);
void pfsdp_list_iq_parameters(PFInterface* pf,
const std::shared_ptr<pf_interfaces::srv::PfsdpListIqParameters::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpListIqParameters::Response> response);

void pfsdp_get_iq_parameter(PFInterface* pf, const std::shared_ptr<pf_interfaces::srv::PfsdpGetIqParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpGetIqParameter::Response> response);

void pfsdp_set_iq_parameter(PFInterface* pf, const std::shared_ptr<pf_interfaces::srv::PfsdpSetIqParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpSetIqParameter::Response> response);

void pfsdp_reset_iq_parameter(PFInterface* pf, const std::shared_ptr<pf_interfaces::srv::PfsdpResetIqParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpResetIqParameter::Response> response);
void pfsdp_get_iq_parameter(PFInterface* pf,
const std::shared_ptr<pf_interfaces::srv::PfsdpGetIqParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpGetIqParameter::Response> response);

void pfsdp_set_iq_parameter(PFInterface* pf,
const std::shared_ptr<pf_interfaces::srv::PfsdpSetIqParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpSetIqParameter::Response> response);

void pfsdp_reset_iq_parameter(PFInterface* pf,
const std::shared_ptr<pf_interfaces::srv::PfsdpResetIqParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpResetIqParameter::Response> response);
6 changes: 2 additions & 4 deletions src/pf_driver/src/pf/http_helpers/http_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ HTTPInterface::HTTPInterface(std::string host, std::string path) : host(std::mov
{
}

const Json::Value HTTPInterface::get(const std::string& command,
const std::initializer_list<param_type>& list)
const Json::Value HTTPInterface::get(const std::string& command, const std::initializer_list<param_type>& list)
{
CurlResource res(host);
res.append_path(base_path);
Expand All @@ -16,8 +15,7 @@ const Json::Value HTTPInterface::get(const std::string& command,
return get_(res);
}

const Json::Value HTTPInterface::get(const std::string& command,
const param_map_type& params)
const Json::Value HTTPInterface::get(const std::string& command, const param_map_type& params)
{
CurlResource res(host);
res.append_path(base_path);
Expand Down
64 changes: 32 additions & 32 deletions src/pf_driver/src/pf/pf_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,51 +285,50 @@ void PFInterface::add_pf_services(void)
std::string svcname;

svcname = basename + "get_protocol_info";
info_service_ = node_->create_service<pf_interfaces::srv::PfsdpGetProtocolInfo>(svcname.c_str(),
std::bind(&pfsdp_get_protocol_info, this, std::placeholders::_1, std::placeholders::_2));
info_service_ = node_->create_service<pf_interfaces::srv::PfsdpGetProtocolInfo>(
svcname.c_str(), std::bind(&pfsdp_get_protocol_info, this, std::placeholders::_1, std::placeholders::_2));

svcname = basename + "reboot_device";
reboot_service_ = node_->create_service<pf_interfaces::srv::PfsdpRebootDevice>(svcname.c_str(),
std::bind(&pfsdp_reboot_device, this, std::placeholders::_1, std::placeholders::_2));
reboot_service_ = node_->create_service<pf_interfaces::srv::PfsdpRebootDevice>(
svcname.c_str(), std::bind(&pfsdp_reboot_device, this, std::placeholders::_1, std::placeholders::_2));

svcname = basename + "factory_reset";
factory_service_ = node_->create_service<pf_interfaces::srv::PfsdpFactoryReset>(svcname.c_str(),
std::bind(&pfsdp_factory_reset, this, std::placeholders::_1, std::placeholders::_2));
factory_service_ = node_->create_service<pf_interfaces::srv::PfsdpFactoryReset>(
svcname.c_str(), std::bind(&pfsdp_factory_reset, this, std::placeholders::_1, std::placeholders::_2));

svcname = basename + "list_parameters";
listparams_service_ = node_->create_service<pf_interfaces::srv::PfsdpListParameters>(svcname.c_str(),
std::bind(&pfsdp_list_parameters, this, std::placeholders::_1, std::placeholders::_2));
listparams_service_ = node_->create_service<pf_interfaces::srv::PfsdpListParameters>(
svcname.c_str(), std::bind(&pfsdp_list_parameters, this, std::placeholders::_1, std::placeholders::_2));

svcname = basename + "get_parameter";
getparam_service_ = node_->create_service<pf_interfaces::srv::PfsdpGetParameter>(svcname.c_str(),
std::bind(&pfsdp_get_parameter, this, std::placeholders::_1, std::placeholders::_2));
getparam_service_ = node_->create_service<pf_interfaces::srv::PfsdpGetParameter>(
svcname.c_str(), std::bind(&pfsdp_get_parameter, this, std::placeholders::_1, std::placeholders::_2));

svcname = basename + "set_parameter";
setparam_service_ = node_->create_service<pf_interfaces::srv::PfsdpSetParameter>(svcname.c_str(),
std::bind(&pfsdp_set_parameter, this, std::placeholders::_1, std::placeholders::_2));
setparam_service_ = node_->create_service<pf_interfaces::srv::PfsdpSetParameter>(
svcname.c_str(), std::bind(&pfsdp_set_parameter, this, std::placeholders::_1, std::placeholders::_2));

svcname = basename + "reset_parameter";
resetparam_service_ = node_->create_service<pf_interfaces::srv::PfsdpResetParameter>(svcname.c_str(),
std::bind(&pfsdp_reset_parameter, this, std::placeholders::_1, std::placeholders::_2));

resetparam_service_ = node_->create_service<pf_interfaces::srv::PfsdpResetParameter>(
svcname.c_str(), std::bind(&pfsdp_reset_parameter, this, std::placeholders::_1, std::placeholders::_2));

if (has_iq_parameters_)
{
svcname = basename + "list_iq_parameters";
listiqparams_service_ = node_->create_service<pf_interfaces::srv::PfsdpListIqParameters>(svcname.c_str(),
std::bind(&pfsdp_list_iq_parameters, this, std::placeholders::_1, std::placeholders::_2));
listiqparams_service_ = node_->create_service<pf_interfaces::srv::PfsdpListIqParameters>(
svcname.c_str(), std::bind(&pfsdp_list_iq_parameters, this, std::placeholders::_1, std::placeholders::_2));

svcname = basename + "get_iq_parameter";
getiqparam_service_ = node_->create_service<pf_interfaces::srv::PfsdpGetIqParameter>(svcname.c_str(),
std::bind(&pfsdp_get_iq_parameter, this, std::placeholders::_1, std::placeholders::_2));
getiqparam_service_ = node_->create_service<pf_interfaces::srv::PfsdpGetIqParameter>(
svcname.c_str(), std::bind(&pfsdp_get_iq_parameter, this, std::placeholders::_1, std::placeholders::_2));

svcname = basename + "set_iq_parameter";
setiqparam_service_ = node_->create_service<pf_interfaces::srv::PfsdpSetIqParameter>(svcname.c_str(),
std::bind(&pfsdp_set_iq_parameter, this, std::placeholders::_1, std::placeholders::_2));
setiqparam_service_ = node_->create_service<pf_interfaces::srv::PfsdpSetIqParameter>(
svcname.c_str(), std::bind(&pfsdp_set_iq_parameter, this, std::placeholders::_1, std::placeholders::_2));

svcname = basename + "reset_iq_parameter";
resetiqparam_service_ = node_->create_service<pf_interfaces::srv::PfsdpResetIqParameter>(svcname.c_str(),
std::bind(&pfsdp_reset_iq_parameter, this, std::placeholders::_1, std::placeholders::_2));
resetiqparam_service_ = node_->create_service<pf_interfaces::srv::PfsdpResetIqParameter>(
svcname.c_str(), std::bind(&pfsdp_reset_iq_parameter, this, std::placeholders::_1, std::placeholders::_2));
}
}

Expand Down Expand Up @@ -382,22 +381,25 @@ void PFInterface::pfsdp_factory(int32_t& error_code, std::string& error_text)
}

void PFInterface::pfsdp_info(std::string& protocol_name, int32_t& version_major, int32_t& version_minor,
std::vector<std::string>& commands, int32_t& error_code, std::string& error_text)
std::vector<std::string>& commands, int32_t& error_code, std::string& error_text)
{
protocol_interface_->info(protocol_name, version_major, version_minor, commands, error_code, error_text);
}

void PFInterface::pfsdp_list(const char* cmd, const char* out, std::vector<std::string>& params, int32_t& error_code, std::string& error_text)
void PFInterface::pfsdp_list(const char* cmd, const char* out, std::vector<std::string>& params, int32_t& error_code,
std::string& error_text)
{
protocol_interface_->list_parameters(cmd, out, params, error_code, error_text);
}

void PFInterface::pfsdp_get(const char* cmd, const std::string& name, std::string& value, int32_t& error_code, std::string& error_text)
void PFInterface::pfsdp_get(const char* cmd, const std::string& name, std::string& value, int32_t& error_code,
std::string& error_text)
{
protocol_interface_->get_parameter(cmd, name, value, error_code, error_text);
}

void PFInterface::pfsdp_set(const char* cmd, const std::string& name, const std::string& value, int32_t& error_code, std::string& error_text)
void PFInterface::pfsdp_set(const char* cmd, const std::string& name, const std::string& value, int32_t& error_code,
std::string& error_text)
{
protocol_interface_->set_parameter(cmd, name, value, error_code, error_text);
}
Expand All @@ -406,5 +408,3 @@ void PFInterface::pfsdp_reset(const char* cmd, const std::string& name, int32_t&
{
protocol_interface_->reset_parameter(cmd, name, error_code, error_text);
}


Loading

0 comments on commit 5acae42

Please sign in to comment.