Skip to content

Commit

Permalink
Merge pull request #2 from mauropasse/mauro/add-rmw-listener-apis
Browse files Browse the repository at this point in the history
Address PR suggestions
  • Loading branch information
iRobot ROS authored May 5, 2021
2 parents 11dca3f + b8e3317 commit 3bbdf0b
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 42 deletions.
30 changes: 9 additions & 21 deletions rmw_connextdds/src/rmw_api_impl_ndds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,7 @@ rmw_event_set_callback(
rmw_event_callback_t callback,
const void * user_data)
{
(void)event;
(void)callback;
(void)user_data;
RMW_SET_ERROR_MSG("rmw_event_set_callback not implemented");
return RMW_RET_UNSUPPORTED;
return rmw_api_connextdds_event_set_callback(event, callback, user_data);
}
/*****************************************************************************
* Info API
Expand Down Expand Up @@ -602,11 +598,8 @@ rmw_service_set_on_new_request_callback(
rmw_event_callback_t callback,
const void * user_data)
{
(void)rmw_service;
(void)callback;
(void)user_data;
RMW_SET_ERROR_MSG("rmw_service_set_on_new_request_callback not implemented");
return RMW_RET_UNSUPPORTED;
return rmw_api_connextdds_service_set_on_new_request_callback(
rmw_service, callback, user_data);
}

rmw_ret_t
Expand All @@ -615,11 +608,8 @@ rmw_client_set_on_new_response_callback(
rmw_event_callback_t callback,
const void * user_data)
{
(void)rmw_client;
(void)callback;
(void)user_data;
RMW_SET_ERROR_MSG("rmw_client_set_on_new_response_callback not implemented");
return RMW_RET_UNSUPPORTED;
return rmw_api_connextdds_client_set_on_new_response_callback(
rmw_client, callback, user_data);
}

/*****************************************************************************
Expand Down Expand Up @@ -782,16 +772,14 @@ rmw_return_loaned_message_from_subscription(
subscription, loaned_message);
}

rmw_ret_t rmw_subscription_set_on_new_message_callback(
rmw_ret_t
rmw_subscription_set_on_new_message_callback(
rmw_subscription_t * rmw_subscription,
rmw_event_callback_t callback,
const void * user_data)
{
(void)rmw_subscription;
(void)callback;
(void)user_data;
RMW_SET_ERROR_MSG("rmw_subscription_set_on_new_message_callback not implemented");
return RMW_RET_UNSUPPORTED;
return rmw_api_connextdds_subscription_set_on_new_message_callback(
rmw_subscription, callback, user_data);
}

/*****************************************************************************
Expand Down
1 change: 1 addition & 0 deletions rmw_connextdds_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ set(RMW_CONNEXT_COMMON_SOURCE_CPP
src/common/rmw_impl.cpp
src/common/rmw_impl_waitset_std.cpp
src/common/rmw_info.cpp
src/common/rmw_listener.cpp
src/common/rmw_node.cpp
src/common/rmw_publication.cpp
src/common/rmw_qos.cpp
Expand Down
29 changes: 29 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 @@ -86,6 +86,13 @@ rmw_api_connextdds_take_event(
void * event_info,
bool * taken);

RMW_CONNEXTDDS_PUBLIC
rmw_ret_t
rmw_api_connextdds_event_set_callback(
rmw_event_t * event,
rmw_event_callback_t callback,
const void * user_data);

/*****************************************************************************
* Info API
*****************************************************************************/
Expand Down Expand Up @@ -393,6 +400,21 @@ rmw_ret_t
rmw_api_connextdds_destroy_service(
rmw_node_t * node,
rmw_service_t * service);

RMW_CONNEXTDDS_PUBLIC
rmw_ret_t
rmw_api_connextdds_service_set_on_new_request_callback(
rmw_service_t * rmw_service,
rmw_event_callback_t callback,
const void * user_data);

RMW_CONNEXTDDS_PUBLIC
rmw_ret_t
rmw_api_connextdds_client_set_on_new_response_callback(
rmw_client_t * rmw_client,
rmw_event_callback_t callback,
const void * user_data);

/*****************************************************************************
* Subscription API
*****************************************************************************/
Expand Down Expand Up @@ -505,6 +527,13 @@ rmw_api_connextdds_return_loaned_message_from_subscription(
const rmw_subscription_t * subscription,
void * loaned_message);

RMW_CONNEXTDDS_PUBLIC
rmw_ret_t
rmw_api_connextdds_subscription_set_on_new_message_callback(
rmw_subscription_t * rmw_subscription,
rmw_event_callback_t callback,
const void * user_data);

/*****************************************************************************
* WaitSet API
*****************************************************************************/
Expand Down
77 changes: 77 additions & 0 deletions rmw_connextdds_common/src/common/rmw_listener.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Copyright 2021 Real-Time Innovations, Inc. (RTI)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "rmw_connextdds/rmw_impl.hpp"

/******************************************************************************
* Event Listener API
******************************************************************************/
rmw_ret_t
rmw_api_connextdds_event_set_callback(
rmw_event_t * event,
rmw_event_callback_t callback,
const void * user_data)
{
UNUSED_ARG(event);
UNUSED_ARG(callback);
UNUSED_ARG(user_data);
RMW_CONNEXT_LOG_ERROR_SET("rmw_event_set_callback not implemented")
return RMW_RET_UNSUPPORTED;
}

/******************************************************************************
* Service Listener API
******************************************************************************/
rmw_ret_t
rmw_api_connextdds_service_set_on_new_request_callback(
rmw_service_t * rmw_service,
rmw_event_callback_t callback,
const void * user_data)
{
UNUSED_ARG(rmw_service);
UNUSED_ARG(callback);
UNUSED_ARG(user_data);
RMW_CONNEXT_LOG_ERROR_SET("rmw_service_set_on_new_request_callback not implemented")
return RMW_RET_UNSUPPORTED;
}

rmw_ret_t
rmw_api_connextdds_client_set_on_new_response_callback(
rmw_client_t * rmw_client,
rmw_event_callback_t callback,
const void * user_data)
{
UNUSED_ARG(rmw_client);
UNUSED_ARG(callback);
UNUSED_ARG(user_data);
RMW_CONNEXT_LOG_ERROR_SET("rmw_client_set_on_new_response_callback not implemented")
return RMW_RET_UNSUPPORTED;
}

/******************************************************************************
* Subscription Listener API
******************************************************************************/
rmw_ret_t
rmw_api_connextdds_subscription_set_on_new_message_callback(
rmw_subscription_t * rmw_subscription,
rmw_event_callback_t callback,
const void * user_data)
{
UNUSED_ARG(rmw_subscription);
UNUSED_ARG(callback);
UNUSED_ARG(user_data);
RMW_CONNEXT_LOG_ERROR_SET("rmw_subscription_set_on_new_message_callback not implemented")
return RMW_RET_UNSUPPORTED;
}

31 changes: 10 additions & 21 deletions rmw_connextddsmicro/src/rmw_api_impl_rtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,7 @@ rmw_event_set_callback(
rmw_event_callback_t callback,
const void * user_data)
{
(void)event;
(void)callback;
(void)user_data;
RMW_SET_ERROR_MSG("rmw_event_set_callback not implemented");
return RMW_RET_UNSUPPORTED;
return rmw_api_connextdds_event_set_callback(event, callback, user_data);
}

/*****************************************************************************
Expand Down Expand Up @@ -603,11 +599,8 @@ rmw_service_set_on_new_request_callback(
rmw_event_callback_t callback,
const void * user_data)
{
(void)rmw_service;
(void)callback;
(void)user_data;
RMW_SET_ERROR_MSG("rmw_service_set_on_new_request_callback not implemented");
return RMW_RET_UNSUPPORTED;
return rmw_api_connextdds_service_set_on_new_request_callback(
rmw_service, callback, user_data);
}

rmw_ret_t
Expand All @@ -616,11 +609,8 @@ rmw_client_set_on_new_response_callback(
rmw_event_callback_t callback,
const void * user_data)
{
(void)rmw_client;
(void)callback;
(void)user_data;
RMW_SET_ERROR_MSG("rmw_client_set_on_new_response_callback not implemented");
return RMW_RET_UNSUPPORTED;
return rmw_api_connextdds_client_set_on_new_response_callback(
rmw_client, callback, user_data);
}

/*****************************************************************************
Expand Down Expand Up @@ -783,17 +773,16 @@ rmw_return_loaned_message_from_subscription(
subscription, loaned_message);
}

rmw_ret_t rmw_subscription_set_on_new_message_callback(
rmw_ret_t
rmw_subscription_set_on_new_message_callback(
rmw_subscription_t * rmw_subscription,
rmw_event_callback_t callback,
const void * user_data)
{
(void)rmw_subscription;
(void)callback;
(void)user_data;
RMW_SET_ERROR_MSG("rmw_subscription_set_on_new_message_callback not implemented");
return RMW_RET_UNSUPPORTED;
return rmw_api_connextdds_subscription_set_on_new_message_callback(
rmw_subscription, callback, user_data);
}

/*****************************************************************************
* WaitSet API
*****************************************************************************/
Expand Down

0 comments on commit 3bbdf0b

Please sign in to comment.