Skip to content

Commit

Permalink
Add apis to retrieve service/client QoS
Browse files Browse the repository at this point in the history
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
  • Loading branch information
Mauro Passerino committed Sep 20, 2021
1 parent e486ede commit 62a3edf
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 0 deletions.
16 changes: 16 additions & 0 deletions rmw_fastrtps_cpp/src/rmw_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,4 +505,20 @@ rmw_client_set_on_new_response_callback(
callback,
user_data);
}

rmw_ret_t
rmw_client_get_actual_qos(
const rmw_client_t * client,
rmw_qos_profile_t * qos)
{
RMW_CHECK_ARGUMENT_FOR_NULL(client, RMW_RET_INVALID_ARGUMENT);
RMW_CHECK_TYPE_IDENTIFIERS_MATCH(
client,
client->implementation_identifier,
eprosima_fastrtps_identifier,
return RMW_RET_INCORRECT_RMW_IMPLEMENTATION);
RMW_CHECK_ARGUMENT_FOR_NULL(qos, RMW_RET_INVALID_ARGUMENT);

return rmw_fastrtps_shared_cpp::__rmw_client_get_actual_qos(client, qos);
}
} // extern "C"
16 changes: 16 additions & 0 deletions rmw_fastrtps_cpp/src/rmw_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,4 +504,20 @@ rmw_service_set_on_new_request_callback(
callback,
user_data);
}

rmw_ret_t
rmw_service_get_actual_qos(
const rmw_service_t * service,
rmw_qos_profile_t * qos)
{
RMW_CHECK_ARGUMENT_FOR_NULL(service, RMW_RET_INVALID_ARGUMENT);
RMW_CHECK_TYPE_IDENTIFIERS_MATCH(
service,
service->implementation_identifier,
eprosima_fastrtps_identifier,
return RMW_RET_INCORRECT_RMW_IMPLEMENTATION);
RMW_CHECK_ARGUMENT_FOR_NULL(qos, RMW_RET_INVALID_ARGUMENT);

return rmw_fastrtps_shared_cpp::__rmw_service_get_actual_qos(service, qos);
}
} // extern "C"
Original file line number Diff line number Diff line change
Expand Up @@ -469,13 +469,25 @@ __rmw_service_set_on_new_request_callback(
rmw_event_callback_t callback,
const void * user_data);

RMW_FASTRTPS_SHARED_CPP_PUBLIC
rmw_ret_t
__rmw_service_get_actual_qos(
const rmw_service_t * service,
rmw_qos_profile_t * qos);

RMW_FASTRTPS_SHARED_CPP_PUBLIC
rmw_ret_t
__rmw_client_set_on_new_response_callback(
rmw_client_t * rmw_client,
rmw_event_callback_t callback,
const void * user_data);

RMW_FASTRTPS_SHARED_CPP_PUBLIC
rmw_ret_t
__rmw_client_get_actual_qos(
const rmw_client_t * client,
rmw_qos_profile_t * qos);

RMW_FASTRTPS_SHARED_CPP_PUBLIC
rmw_ret_t
__rmw_event_set_callback(
Expand Down
14 changes: 14 additions & 0 deletions rmw_fastrtps_shared_cpp/src/rmw_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,18 @@ __rmw_client_set_on_new_response_callback(
callback);
return RMW_RET_OK;
}

rmw_ret_t
__rmw_client_get_actual_qos(
const rmw_client_t * client,
rmw_qos_profile_t * qos)
{
auto info = static_cast<CustomClientInfo *>(client->data);

eprosima::fastdds::dds::DataReader * fastdds_dr = info->response_reader_;

dds_qos_to_rmw_qos(fastdds_dr->get_qos(), qos);

return RMW_RET_OK;
}
} // namespace rmw_fastrtps_shared_cpp
14 changes: 14 additions & 0 deletions rmw_fastrtps_shared_cpp/src/rmw_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,18 @@ __rmw_service_set_on_new_request_callback(
callback);
return RMW_RET_OK;
}

rmw_ret_t
__rmw_service_get_actual_qos(
const rmw_service_t * service,
rmw_qos_profile_t * qos)
{
auto info = static_cast<CustomServiceInfo *>(service->data);

eprosima::fastdds::dds::DataReader * fastdds_dr = info->request_reader_;

dds_qos_to_rmw_qos(fastdds_dr->get_qos(), qos);

return RMW_RET_OK;
}
} // namespace rmw_fastrtps_shared_cpp

0 comments on commit 62a3edf

Please sign in to comment.