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

Added rmw_event_type_is_supported #173

Open
wants to merge 3 commits into
base: rolling
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions rmw_connextdds/src/rmw_api_impl_ndds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ rmw_event_set_callback(
{
return rmw_api_connextdds_event_set_callback(event, callback, user_data);
}

bool
rmw_event_type_is_supported(rmw_event_type_t rmw_event_type)
{
return rmw_api_connextdds_event_type_is_supported(rmw_event_type);
}

/*****************************************************************************
* Info API
*****************************************************************************/
Expand Down
4 changes: 4 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 @@ -96,6 +96,10 @@ rmw_api_connextdds_event_set_callback(
const rmw_event_callback_t callback,
const void * const user_data);

RMW_CONNEXTDDS_PUBLIC
bool
rmw_api_connextdds_event_type_is_supported(rmw_event_type_t rmw_event_type);

/*****************************************************************************
* Info API
*****************************************************************************/
Expand Down
22 changes: 11 additions & 11 deletions rmw_connextdds_common/src/common/rmw_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@
/******************************************************************************
* Event functions
******************************************************************************/

static bool is_event_supported(const rmw_event_type_t event_type)
{
bool invalid = false;
ros_event_to_dds(event_type, &invalid);
return !invalid;
}


rmw_ret_t
rmw_api_connextdds_publisher_event_init(
rmw_event_t * rmw_event,
Expand All @@ -42,7 +33,7 @@ rmw_api_connextdds_publisher_event_init(
return RMW_RET_INVALID_ARGUMENT);
RMW_CHECK_ARGUMENT_FOR_NULL(rmw_event, RMW_RET_INVALID_ARGUMENT);

if (!is_event_supported(event_type)) {
if (!rmw_api_connextdds_event_type_is_supported(event_type)) {
RMW_CONNEXT_LOG_ERROR_SET("unsupported publisher event")
return RMW_RET_UNSUPPORTED;
}
Expand All @@ -64,6 +55,15 @@ rmw_api_connextdds_publisher_event_init(
}


bool
rmw_api_connextdds_event_type_is_supported(rmw_event_type_t rmw_event_type)
{
bool invalid = false;
ros_event_to_dds(rmw_event_type, &invalid);
return !invalid;
}


rmw_ret_t
rmw_api_connextdds_subscription_event_init(
rmw_event_t * rmw_event,
Expand All @@ -78,7 +78,7 @@ rmw_api_connextdds_subscription_event_init(
return RMW_RET_INVALID_ARGUMENT);
RMW_CHECK_ARGUMENT_FOR_NULL(rmw_event, RMW_RET_INVALID_ARGUMENT);

if (!is_event_supported(event_type)) {
if (!rmw_api_connextdds_event_type_is_supported(event_type)) {
RMW_CONNEXT_LOG_ERROR_SET("unsupported subscription event")
return RMW_RET_UNSUPPORTED;
}
Expand Down
6 changes: 6 additions & 0 deletions rmw_connextddsmicro/src/rmw_api_impl_rtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ rmw_event_set_callback(
return rmw_api_connextdds_event_set_callback(event, callback, user_data);
}

bool
rmw_event_type_is_supported(rmw_event_type_t rmw_event_type)
{
return rmw_api_connextdds_event_type_is_supported(rmw_event_type);
}

/*****************************************************************************
* Info API
*****************************************************************************/
Expand Down