Skip to content

Commit

Permalink
-give service function a 3rd parameter (<rmw_request_id_t> request_he…
Browse files Browse the repository at this point in the history
…ader)

-revert workflow file main.yaml
  • Loading branch information
JnsHndr committed Oct 15, 2024
1 parent ebf13c2 commit fc2ab5a
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 23 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ jobs:
strategy:
matrix:
env:
# - {ROS_DISTRO: foxy, ROS_REPO: testing}
# - {ROS_DISTRO: foxy, CATKIN_LINT: true}
# - {ROS_DISTRO: foxy, CLANG_FORMAT_CHECK: file}
- {ROS_DISTRO: foxy, ROS_REPO: testing}
- {ROS_DISTRO: foxy, CATKIN_LINT: true}
- {ROS_DISTRO: foxy, CLANG_FORMAT_CHECK: file}
- {ROS_DISTRO: galactic}
- {ROS_DISTRO: humble}
- {ROS_DISTRO: iron}
- {ROS_DISTRO: jazzy}
env:
CCACHE_DIR: /github/home/.ccache # Directory for ccache (and how we enable ccache in industrial_ci)
runs-on: ubuntu-latest
Expand Down
23 changes: 19 additions & 4 deletions src/pf_driver/include/pf_driver/ros/pf_services.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,57 @@
#include "pf_interfaces/srv/pfsdp_reset_iq_parameter.hpp"
#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,
void pfsdp_reboot_device(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpRebootDevice::Request> request,
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,
void pfsdp_factory_reset(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpFactoryReset::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpFactoryReset::Response> response);

void pfsdp_get_protocol_info(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
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<rmw_request_id_t> request_header,
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,
void pfsdp_get_parameter(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpGetParameter::Request> request,
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,
void pfsdp_set_parameter(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpSetParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpSetParameter::Response> response);

void pfsdp_reset_parameter(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
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<rmw_request_id_t> request_header,
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<rmw_request_id_t> request_header,
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<rmw_request_id_t> request_header,
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<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpResetIqParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpResetIqParameter::Response> response);
33 changes: 22 additions & 11 deletions src/pf_driver/src/pf/pf_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,49 +286,60 @@ void PFInterface::add_pf_services(void)

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));
svcname.c_str(), std::bind(&pfsdp_get_protocol_info, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3));

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));
svcname.c_str(), std::bind(&pfsdp_reboot_device, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3));

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));
svcname.c_str(), std::bind(&pfsdp_factory_reset, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3));

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));
svcname.c_str(), std::bind(&pfsdp_list_parameters, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3));

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));
svcname.c_str(), std::bind(&pfsdp_get_parameter, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3));

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));
svcname.c_str(), std::bind(&pfsdp_set_parameter, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3));

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));
svcname.c_str(), std::bind(&pfsdp_reset_parameter, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3));

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));
svcname.c_str(), std::bind(&pfsdp_list_iq_parameters, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3));

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));
svcname.c_str(), std::bind(&pfsdp_get_iq_parameter, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3));

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));
svcname.c_str(), std::bind(&pfsdp_set_iq_parameter, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3));

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));
svcname.c_str(), std::bind(&pfsdp_reset_iq_parameter, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3));
}
}

Expand Down
23 changes: 19 additions & 4 deletions src/pf_driver/src/ros/pf_services.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@
#include "pf_driver/ros/pf_services.h"
#include "pf_driver/pf/pf_interface.h"

void pfsdp_reboot_device(PFInterface* pf, const std::shared_ptr<pf_interfaces::srv::PfsdpRebootDevice::Request> request,
void pfsdp_reboot_device(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpRebootDevice::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpRebootDevice::Response> response)
{
pf->pfsdp_reboot(response->error_code, response->error_text);
}

void pfsdp_factory_reset(PFInterface* pf, const std::shared_ptr<pf_interfaces::srv::PfsdpFactoryReset::Request> request,
void pfsdp_factory_reset(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpFactoryReset::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpFactoryReset::Response> response)
{
pf->pfsdp_factory(response->error_code, response->error_text);
}

void pfsdp_get_protocol_info(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpGetProtocolInfo::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpGetProtocolInfo::Response> response)
{
Expand All @@ -26,32 +31,39 @@ void pfsdp_get_protocol_info(PFInterface* pf,
}

void pfsdp_list_parameters(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpListParameters::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpListParameters::Response> response)
{
pf->pfsdp_list("list_parameters", "parameters", response->parameters, response->error_code, response->error_text);
}

void pfsdp_get_parameter(PFInterface* pf, const std::shared_ptr<pf_interfaces::srv::PfsdpGetParameter::Request> request,
void pfsdp_get_parameter(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpGetParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpGetParameter::Response> response)
{
pf->pfsdp_get("get_parameter", request->name, response->value, response->error_code, response->error_text);
}

void pfsdp_set_parameter(PFInterface* pf, const std::shared_ptr<pf_interfaces::srv::PfsdpSetParameter::Request> request,
void pfsdp_set_parameter(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpSetParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpSetParameter::Response> response)
{
pf->pfsdp_set("set_parameter", request->name, request->value, response->error_code, response->error_text);
}

void pfsdp_reset_parameter(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpResetParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpResetParameter::Response> response)
{
pf->pfsdp_reset("reset_parameter", request->name, response->error_code, response->error_text);
}

void pfsdp_list_iq_parameters(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpListIqParameters::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpListIqParameters::Response> response)
{
Expand All @@ -60,20 +72,23 @@ void pfsdp_list_iq_parameters(PFInterface* pf,
}

void pfsdp_get_iq_parameter(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpGetIqParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpGetIqParameter::Response> response)
{
pf->pfsdp_get("get_iq_parameter", request->name, response->value, response->error_code, response->error_text);
}

void pfsdp_set_iq_parameter(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpSetIqParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpSetIqParameter::Response> response)
{
pf->pfsdp_set("set_iq_parameter", request->name, request->value, response->error_code, response->error_text);
}

void pfsdp_reset_iq_parameter(PFInterface* pf,
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<pf_interfaces::srv::PfsdpResetIqParameter::Request> request,
std::shared_ptr<pf_interfaces::srv::PfsdpResetIqParameter::Response> response)
{
Expand Down

0 comments on commit fc2ab5a

Please sign in to comment.