From c52932b3d38d412ca8c1673622dccd70880bb42f Mon Sep 17 00:00:00 2001 From: Matt Richard Date: Mon, 17 Feb 2020 10:23:52 -0800 Subject: [PATCH] Read action type support --- src/rcl_utilities.cpp | 15 +++++++++++++++ src/rcl_utilities.hpp | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/src/rcl_utilities.cpp b/src/rcl_utilities.cpp index 32a822ad..e7899ad8 100644 --- a/src/rcl_utilities.cpp +++ b/src/rcl_utilities.cpp @@ -18,6 +18,7 @@ #include #endif #include +#include #include #if defined(OS_WINDOWS) @@ -28,6 +29,7 @@ namespace rclnodejs { typedef const rosidl_message_type_support_t* (*GetMessageTypeSupportFunction)(); typedef const rosidl_service_type_support_t* (*GetServiceTypeSupportFunction)(); +typedef const rosidl_action_type_support_t* (*GetActionTypeSupportFunction)(); #if defined(OS_MACOS) const char* lib_prefix = "lib"; @@ -80,6 +82,19 @@ const rosidl_service_type_support_t* GetServiceTypeSupport( return nullptr; } +const rosidl_action_type_support_t* GetActionTypeSupport( + const std::string& package_name, + const std::string& action_name) { + void* function = GetTypeSupportFunctionByInterfaceSymbolName( + "rosidl_typesupport_c__get_action_type_support_handle__" + package_name + + "__action__" + action_name, + lib_prefix + package_name + "__rosidl_typesupport_c" + lib_ext); + if (function) + return reinterpret_cast(function)(); + else + return nullptr; +} + const char* GetErrorMessageAndClear() { return dlerror(); } diff --git a/src/rcl_utilities.hpp b/src/rcl_utilities.hpp index 42c172b1..641185ad 100644 --- a/src/rcl_utilities.hpp +++ b/src/rcl_utilities.hpp @@ -19,6 +19,7 @@ struct rosidl_message_type_support_t; struct rosidl_service_type_support_t; +struct rosidl_action_type_support_t; namespace rclnodejs { @@ -31,6 +32,10 @@ const rosidl_service_type_support_t* GetServiceTypeSupport( const std::string& package_name, const std::string& service_name); +const rosidl_action_type_support_t* GetActionTypeSupport( + const std::string& package_name, + const std::string& action_name); + const char* GetErrorMessageAndClear(); } // namespace rclnodejs