diff --git a/rosidl_typesupport_fastrtps_c/resource/msg__type_support_c.cpp.em b/rosidl_typesupport_fastrtps_c/resource/msg__type_support_c.cpp.em index fd32c70..fa1fe38 100644 --- a/rosidl_typesupport_fastrtps_c/resource/msg__type_support_c.cpp.em +++ b/rosidl_typesupport_fastrtps_c/resource/msg__type_support_c.cpp.em @@ -8,6 +8,9 @@ from rosidl_parser.definition import AbstractWString from rosidl_parser.definition import ACTION_FEEDBACK_SUFFIX from rosidl_parser.definition import ACTION_GOAL_SUFFIX from rosidl_parser.definition import ACTION_RESULT_SUFFIX +from rosidl_parser.definition import SERVICE_REQUEST_MESSAGE_SUFFIX +from rosidl_parser.definition import SERVICE_RESPONSE_MESSAGE_SUFFIX +from rosidl_parser.definition import SERVICE_EVENT_MESSAGE_SUFFIX from rosidl_parser.definition import Array from rosidl_parser.definition import BasicType from rosidl_parser.definition import BoundedSequence @@ -18,6 +21,7 @@ include_parts = [package_name] + list(interface_path.parents[0].parts) + [ 'detail', convert_camel_case_to_lower_case_underscore(interface_path.stem)] include_base = '/'.join(include_parts) + header_files = [ 'cassert', 'limits', @@ -84,6 +88,12 @@ for member in message.structure.members: keys.add('rosidl_runtime_c/u16string.h') keys.add('rosidl_runtime_c/u16string_functions.h') elif isinstance(type_, NamespacedType): + import sys + if ( + type_.name.endswith(SERVICE_REQUEST_MESSAGE_SUFFIX) or + type_.name.endswith(SERVICE_RESPONSE_MESSAGE_SUFFIX) + ): + continue if ( type_.name.endswith(ACTION_GOAL_SUFFIX) or type_.name.endswith(ACTION_RESULT_SUFFIX) or diff --git a/rosidl_typesupport_fastrtps_c/resource/srv__rosidl_typesupport_fastrtps_c.h.em b/rosidl_typesupport_fastrtps_c/resource/srv__rosidl_typesupport_fastrtps_c.h.em index 666f0d1..69b56c2 100644 --- a/rosidl_typesupport_fastrtps_c/resource/srv__rosidl_typesupport_fastrtps_c.h.em +++ b/rosidl_typesupport_fastrtps_c/resource/srv__rosidl_typesupport_fastrtps_c.h.em @@ -13,6 +13,13 @@ TEMPLATE( include_directives=include_directives) }@ +@{ +TEMPLATE( + 'msg__rosidl_typesupport_fastrtps_c.h.em', + package_name=package_name, interface_path=interface_path, message=service.event_message, + include_directives=include_directives) +}@ + @{ header_files = [ 'rosidl_runtime_c/service_type_support_struct.h', diff --git a/rosidl_typesupport_fastrtps_c/resource/srv__type_support_c.cpp.em b/rosidl_typesupport_fastrtps_c/resource/srv__type_support_c.cpp.em index c80aa57..f07eeaf 100644 --- a/rosidl_typesupport_fastrtps_c/resource/srv__type_support_c.cpp.em +++ b/rosidl_typesupport_fastrtps_c/resource/srv__type_support_c.cpp.em @@ -13,6 +13,13 @@ TEMPLATE( include_directives=include_directives) }@ +@{ +TEMPLATE( + 'msg__type_support_c.cpp.em', + package_name=package_name, interface_path=interface_path, message=service.event_message, + include_directives=include_directives) +}@ + @{ from rosidl_pycommon import convert_camel_case_to_lower_case_underscore @@ -55,6 +62,15 @@ static rosidl_service_type_support_t @(service.namespaced_type.name)__handle = { rosidl_typesupport_fastrtps_c__identifier, &@(service.namespaced_type.name)__callbacks, get_service_typesupport_handle_function, + ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_CREATE_EVENT_MESSAGE_SYMBOL_NAME( + rosidl_typesupport_c, + @(',\n '.join(service.namespaced_type.namespaced_name())) + ), + ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_DESTROY_EVENT_MESSAGE_SYMBOL_NAME( + rosidl_typesupport_c, + @(',\n '.join(service.namespaced_type.namespaced_name())) + ), + &_@(service.namespaced_type.name)_Event__type_support }; const rosidl_service_type_support_t * diff --git a/rosidl_typesupport_fastrtps_cpp/resource/srv__rosidl_typesupport_fastrtps_cpp.hpp.em b/rosidl_typesupport_fastrtps_cpp/resource/srv__rosidl_typesupport_fastrtps_cpp.hpp.em index 38a3247..936ba75 100644 --- a/rosidl_typesupport_fastrtps_cpp/resource/srv__rosidl_typesupport_fastrtps_cpp.hpp.em +++ b/rosidl_typesupport_fastrtps_cpp/resource/srv__rosidl_typesupport_fastrtps_cpp.hpp.em @@ -13,6 +13,13 @@ TEMPLATE( include_directives=include_directives) }@ +@{ +TEMPLATE( + 'msg__rosidl_typesupport_fastrtps_cpp.hpp.em', + package_name=package_name, interface_path=interface_path, message=service.event_message, + include_directives=include_directives) +}@ + @{ header_files = [ 'rmw/types.h', diff --git a/rosidl_typesupport_fastrtps_cpp/resource/srv__type_support.cpp.em b/rosidl_typesupport_fastrtps_cpp/resource/srv__type_support.cpp.em index 7e0c646..b8f668f 100644 --- a/rosidl_typesupport_fastrtps_cpp/resource/srv__type_support.cpp.em +++ b/rosidl_typesupport_fastrtps_cpp/resource/srv__type_support.cpp.em @@ -1,6 +1,8 @@ @# Included from rosidl_typesupport_fastrtps_cpp/resource/idl__type_support.cpp.em @{ from rosidl_pycommon import convert_camel_case_to_lower_case_underscore +from rosidl_parser.definition import SERVICE_REQUEST_MESSAGE_SUFFIX +from rosidl_parser.definition import SERVICE_RESPONSE_MESSAGE_SUFFIX include_parts = [package_name] + list(interface_path.parents[0].parts) + [ 'detail', convert_camel_case_to_lower_case_underscore(interface_path.stem)] @@ -20,9 +22,17 @@ TEMPLATE( include_directives=include_directives) }@ +@{ +TEMPLATE( + 'msg__type_support.cpp.em', + package_name=package_name, interface_path=interface_path, message=service.event_message, + include_directives=include_directives) +}@ + @{ header_files = [ 'rmw/error_handling.h', + 'rosidl_typesupport_cpp/service_type_support.hpp', 'rosidl_typesupport_fastrtps_cpp/identifier.hpp', 'rosidl_typesupport_fastrtps_cpp/service_type_support.h', 'rosidl_typesupport_fastrtps_cpp/service_type_support_decl.hpp', @@ -49,16 +59,28 @@ namespace typesupport_fastrtps_cpp static service_type_support_callbacks_t _@(service.namespaced_type.name)__callbacks = { "@('::'.join([package_name] + list(interface_path.parents[0].parts)))", "@(service.namespaced_type.name)", - ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_fastrtps_cpp, @(', '.join([package_name] + list(interface_path.parents[0].parts))), @(service.namespaced_type.name)_Request)(), - ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_fastrtps_cpp, @(', '.join([package_name] + list(interface_path.parents[0].parts))), @(service.namespaced_type.name)_Response)(), + ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_fastrtps_cpp, @(', '.join([package_name] + list(interface_path.parents[0].parts))), @(service.namespaced_type.name + SERVICE_REQUEST_MESSAGE_SUFFIX))(), + ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_fastrtps_cpp, @(', '.join([package_name] + list(interface_path.parents[0].parts))), @(service.namespaced_type.name + SERVICE_RESPONSE_MESSAGE_SUFFIX))(), }; -static rosidl_service_type_support_t _@(service.namespaced_type.name)__handle = { +#ifdef __cplusplus +extern "C" +{ +#endif + +static const rosidl_service_type_support_t _@(service.namespaced_type.name)__handle{ rosidl_typesupport_fastrtps_cpp::typesupport_identifier, &_@(service.namespaced_type.name)__callbacks, get_service_typesupport_handle_function, + &::rosidl_typesupport_cpp::service_create_event_message<@('::'.join([package_name, *interface_path.parents[0].parts, service.namespaced_type.name]))>, + &::rosidl_typesupport_cpp::service_destroy_event_message<@('::'.join([package_name, *interface_path.parents[0].parts, service.namespaced_type.name]))>, + ::rosidl_typesupport_fastrtps_cpp::get_message_type_support_handle<@('::'.join([package_name, *interface_path.parents[0].parts, service.namespaced_type.name]))_Event>(), }; +#ifdef __cplusplus +} +#endif + } // namespace typesupport_fastrtps_cpp @[ for ns in reversed(service.namespaced_type.namespaces)]@