Skip to content

Commit

Permalink
Add client/service QoS getters (#67)
Browse files Browse the repository at this point in the history
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
  • Loading branch information
mauropasse authored Nov 19, 2021
1 parent 944da9d commit 55c73c8
Show file tree
Hide file tree
Showing 6 changed files with 243 additions and 0 deletions.
40 changes: 40 additions & 0 deletions rmw_connextdds/src/rmw_api_impl_ndds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,26 @@ rmw_create_client(
}


rmw_ret_t
rmw_client_request_publisher_get_actual_qos(
const rmw_client_t * client,
rmw_qos_profile_t * qos)
{
return rmw_api_connextdds_client_request_publisher_get_actual_qos(
client, qos);
}


rmw_ret_t
rmw_client_response_subscription_get_actual_qos(
const rmw_client_t * client,
rmw_qos_profile_t * qos)
{
return rmw_api_connextdds_client_response_subscription_get_actual_qos(
client, qos);
}


rmw_ret_t
rmw_destroy_client(
rmw_node_t * node,
Expand All @@ -587,6 +607,26 @@ rmw_create_service(
}


rmw_ret_t
rmw_service_response_publisher_get_actual_qos(
const rmw_service_t * service,
rmw_qos_profile_t * qos)
{
return rmw_api_connextdds_service_response_publisher_get_actual_qos(
service, qos);
}


rmw_ret_t
rmw_service_request_subscription_get_actual_qos(
const rmw_service_t * service,
rmw_qos_profile_t * qos)
{
return rmw_api_connextdds_service_request_subscription_get_actual_qos(
service, qos);
}


rmw_ret_t
rmw_destroy_service(
rmw_node_t * node,
Expand Down
24 changes: 24 additions & 0 deletions rmw_connextdds_common/include/rmw_connextdds/rmw_api_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,18 @@ rmw_api_connextdds_create_client(
const char * service_name,
const rmw_qos_profile_t * qos_policies);

RMW_CONNEXTDDS_PUBLIC
rmw_ret_t
rmw_api_connextdds_client_request_publisher_get_actual_qos(
const rmw_client_t * client,
rmw_qos_profile_t * qos);

RMW_CONNEXTDDS_PUBLIC
rmw_ret_t
rmw_api_connextdds_client_response_subscription_get_actual_qos(
const rmw_client_t * client,
rmw_qos_profile_t * qos);

RMW_CONNEXTDDS_PUBLIC
rmw_ret_t
rmw_api_connextdds_destroy_client(
Expand All @@ -394,6 +406,18 @@ rmw_api_connextdds_create_service(
const char * service_name,
const rmw_qos_profile_t * qos_policies);

RMW_CONNEXTDDS_PUBLIC
rmw_ret_t
rmw_api_connextdds_service_response_publisher_get_actual_qos(
const rmw_service_t * service,
rmw_qos_profile_t * qos);

RMW_CONNEXTDDS_PUBLIC
rmw_ret_t
rmw_api_connextdds_service_request_subscription_get_actual_qos(
const rmw_service_t * service,
rmw_qos_profile_t * qos);

RMW_CONNEXTDDS_PUBLIC
rmw_ret_t
rmw_api_connextdds_destroy_service(
Expand Down
12 changes: 12 additions & 0 deletions rmw_connextdds_common/include/rmw_connextdds/rmw_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,12 @@ class RMW_Connext_Client

rmw_ret_t
enable();

rmw_ret_t
request_publisher_qos(rmw_qos_profile_t * const qos);

rmw_ret_t
response_subscription_qos(rmw_qos_profile_t * const qos);
};

class RMW_Connext_Service
Expand Down Expand Up @@ -629,6 +635,12 @@ class RMW_Connext_Service

rmw_ret_t
enable();

rmw_ret_t
response_publisher_qos(rmw_qos_profile_t * const qos);

rmw_ret_t
request_subscription_qos(rmw_qos_profile_t * const qos);
};

/******************************************************************************
Expand Down
44 changes: 44 additions & 0 deletions rmw_connextdds_common/src/common/rmw_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2622,6 +2622,28 @@ RMW_Connext_Client::send_request(
return rc;
}

rmw_ret_t
RMW_Connext_Client::request_publisher_qos(rmw_qos_profile_t * const qos)
{
rmw_ret_t rc = this->request_pub->qos(qos);
if (rc != RMW_RET_OK) {
RMW_SET_ERROR_MSG("coudn't get client's request publisher qos");
return rc;
}
return RMW_RET_OK;
}

rmw_ret_t
RMW_Connext_Client::response_subscription_qos(rmw_qos_profile_t * const qos)
{
rmw_ret_t rc = this->reply_sub->qos(qos);
if (rc != RMW_RET_OK) {
RMW_SET_ERROR_MSG("coudn't get client's response subscription qos");
return rc;
}
return RMW_RET_OK;
}

rmw_ret_t
RMW_Connext_Client::finalize()
{
Expand Down Expand Up @@ -2873,6 +2895,28 @@ RMW_Connext_Service::send_response(
return this->reply_pub->write(&rr_msg, false /* serialized */);
}

rmw_ret_t
RMW_Connext_Service::response_publisher_qos(rmw_qos_profile_t * const qos)
{
rmw_ret_t rc = this->reply_pub->qos(qos);
if (rc != RMW_RET_OK) {
RMW_SET_ERROR_MSG("coudn't get service's response publisher qos");
return rc;
}
return RMW_RET_OK;
}

rmw_ret_t
RMW_Connext_Service::request_subscription_qos(rmw_qos_profile_t * const qos)
{
rmw_ret_t rc = this->request_sub->qos(qos);
if (rc != RMW_RET_OK) {
RMW_SET_ERROR_MSG("coudn't get service's request subscription qos");
return rc;
}
return RMW_RET_OK;
}

rmw_ret_t
RMW_Connext_Service::finalize()
{
Expand Down
84 changes: 84 additions & 0 deletions rmw_connextdds_common/src/common/rmw_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,48 @@ rmw_api_connextdds_destroy_client(
}


rmw_ret_t
rmw_api_connextdds_client_request_publisher_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,
RMW_CONNEXTDDS_ID,
return RMW_RET_INCORRECT_RMW_IMPLEMENTATION);

RMW_CHECK_ARGUMENT_FOR_NULL(qos, RMW_RET_INVALID_ARGUMENT);

RMW_Connext_Client * const client_impl =
reinterpret_cast<RMW_Connext_Client *>(client->data);

return client_impl->request_publisher_qos(qos);
}


rmw_ret_t
rmw_api_connextdds_client_response_subscription_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,
RMW_CONNEXTDDS_ID,
return RMW_RET_INCORRECT_RMW_IMPLEMENTATION);

RMW_CHECK_ARGUMENT_FOR_NULL(qos, RMW_RET_INVALID_ARGUMENT);

RMW_Connext_Client * const client_impl =
reinterpret_cast<RMW_Connext_Client *>(client->data);

return client_impl->response_subscription_qos(qos);
}


rmw_service_t *
rmw_api_connextdds_create_service(
const rmw_node_t * node,
Expand Down Expand Up @@ -374,6 +416,48 @@ rmw_api_connextdds_create_service(
}


rmw_ret_t
rmw_api_connextdds_service_response_publisher_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,
RMW_CONNEXTDDS_ID,
return RMW_RET_INCORRECT_RMW_IMPLEMENTATION);

RMW_CHECK_ARGUMENT_FOR_NULL(qos, RMW_RET_INVALID_ARGUMENT);

RMW_Connext_Service * const svc_impl =
reinterpret_cast<RMW_Connext_Service *>(service->data);

return svc_impl->response_publisher_qos(qos);
}


rmw_ret_t
rmw_api_connextdds_service_request_subscription_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,
RMW_CONNEXTDDS_ID,
return RMW_RET_INCORRECT_RMW_IMPLEMENTATION);

RMW_CHECK_ARGUMENT_FOR_NULL(qos, RMW_RET_INVALID_ARGUMENT);

RMW_Connext_Service * const svc_impl =
reinterpret_cast<RMW_Connext_Service *>(service->data);

return svc_impl->request_subscription_qos(qos);
}


rmw_ret_t
rmw_api_connextdds_destroy_service(
rmw_node_t * node,
Expand Down
39 changes: 39 additions & 0 deletions rmw_connextddsmicro/src/rmw_api_impl_rtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,25 @@ rmw_create_client(
}


rmw_ret_t
rmw_client_request_publisher_get_actual_qos(
const rmw_client_t * client,
rmw_qos_profile_t * qos)
{
return rmw_api_connextdds_client_request_publisher_get_actual_qos(
client, qos);
}


rmw_ret_t
rmw_client_response_subscription_get_actual_qos(
const rmw_client_t * client,
rmw_qos_profile_t * qos)
{
return rmw_api_connextdds_client_response_subscription_get_actual_qos(
client, qos);
}

rmw_ret_t
rmw_destroy_client(
rmw_node_t * node,
Expand All @@ -587,6 +606,26 @@ rmw_create_service(
}


rmw_ret_t
rmw_service_response_publisher_get_actual_qos(
const rmw_service_t * service,
rmw_qos_profile_t * qos)
{
return rmw_api_connextdds_service_response_publisher_get_actual_qos(
service, qos);
}


rmw_ret_t
rmw_service_request_subscription_get_actual_qos(
const rmw_service_t * service,
rmw_qos_profile_t * qos)
{
return rmw_api_connextdds_service_request_subscription_get_actual_qos(
service, qos);
}


rmw_ret_t
rmw_destroy_service(
rmw_node_t * node,
Expand Down

0 comments on commit 55c73c8

Please sign in to comment.