diff --git a/src/ext/transport/SSMTransport/CMakeLists.txt b/src/ext/transport/SSMTransport/CMakeLists.txt index 89f1b98e0..b960b83f9 100644 --- a/src/ext/transport/SSMTransport/CMakeLists.txt +++ b/src/ext/transport/SSMTransport/CMakeLists.txt @@ -4,20 +4,32 @@ project (SSMTransport VERSION ${RTM_VERSION} LANGUAGES CXX) + +set(SSM_ROOT ${SSM_ROOT} CACHE PATH "set SSM_ROOT") + + + + +if(SSM_ROOT) + link_directories(${SSM_ROOT}/lib ${SSM_ROOT}/lib64) +endif() + +if(WIN32) + add_definitions(-DRTM_SKEL_IMPORT_SYMBOL) + add_definitions(-DNOGDI) + add_definitions(-DNOMINMAX) + add_definitions(-DTRANSPORT_PLUGIN) +endif() + + set(target SSMTransport) set(srcs SSMTransport.cpp SSMTransport.h SSMInPort.cpp SSMInPort.h SSMOutPort.cpp SSMOutPort.h) if(OpenRTM_aist_BINARY_DIR) - link_directories(${ORB_LINK_DIR}) - add_definitions(${ORB_C_FLAGS_LIST}) - - if(WIN32) - add_definitions(-DRTM_SKEL_IMPORT_SYMBOL) - add_definitions(-DNOGDI) - add_definitions(-DNOMINMAX) - add_definitions(-DTRANSPORT_PLUGIN) + if(SSM_ROOT) + target_include_directories(${target} SYSTEM PUBLIC ${SSM_ROOT}/include) endif() @@ -29,6 +41,9 @@ if(OpenRTM_aist_BINARY_DIR) openrtm_set_link_props_shared(${target}) openrtm_include_rtm(${target}) target_link_libraries(${target} ${libs} ssm) + if(SSM_ROOT) + target_include_directories(${target} SYSTEM PUBLIC ${SSM_ROOT}/include) + endif() install(TARGETS ${target} LIBRARY DESTINATION ${INSTALL_RTM_EXT_DIR}/transport ARCHIVE DESTINATION ${INSTALL_RTM_EXT_DIR}/transport @@ -43,6 +58,9 @@ if(OpenRTM_aist_BINARY_DIR) openrtm_include_rtm(${target}) openrtm_set_link_props_shared(${target}) target_link_libraries(${target} PRIVATE ${libs} ${RTM_LINKER_OPTION} ssm) + if(SSM_ROOT) + target_include_directories(${target} SYSTEM PUBLIC ${SSM_ROOT}/include) + endif() set_target_properties(${target} PROPERTIES PREFIX "") set_target_properties(${target} PROPERTIES @@ -107,6 +125,9 @@ else(OpenRTM_aist_BINARY_DIR) add_executable(${target} ${srcs}) target_link_libraries(${target} ${libs} ssm ${OPENRTM_LIBRARIES}) + if(SSM_ROOT) + target_include_directories(${target} SYSTEM PUBLIC ${SSM_ROOT}/include) + endif() set(SSM_TRANSPORT_INSTALL_DIR lib/openrtm-${OPENRTM_VERSION_MAJOR}.${OPENRTM_VERSION_MINOR}/transport) @@ -120,6 +141,9 @@ else(OpenRTM_aist_BINARY_DIR) add_library(${target} SHARED ${srcs}) target_link_libraries(${target} PRIVATE ${libs} ${RTM_LINKER_OPTION} ssm ${OPENRTM_LIBRARIES}) + if(SSM_ROOT) + target_include_directories(${target} SYSTEM PUBLIC ${SSM_ROOT}/include) + endif() set_target_properties(${target} PROPERTIES PREFIX "") set_target_properties(${target} PROPERTIES @@ -138,7 +162,7 @@ else(OpenRTM_aist_BINARY_DIR) ARCHIVE DESTINATION ${SSM_TRANSPORT_INSTALL_DIR} RUNTIME DESTINATION ${SSM_TRANSPORT_INSTALL_DIR} COMPONENT ext) - endif() +endif() endif(OpenRTM_aist_BINARY_DIR) @@ -149,3 +173,10 @@ if(VXWORKS) endif(RTP) endif(VXWORKS) +set(INSTALL_SSMTRANSPORT_DIR ${INSTALL_RTM_EXT_DIR}/transport) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/rtc.ssm.conf.in ${PROJECT_BINARY_DIR}/rtc.ssm.conf @ONLY) +install( + FILES ${PROJECT_BINARY_DIR}/rtc.ssm.conf + DESTINATION ${INSTALL_RTM_ETC_DIR}/transport + COMPONENT ext) diff --git a/src/ext/transport/SSMTransport/SSMInPort.cpp b/src/ext/transport/SSMTransport/SSMInPort.cpp index 1e58f229a..82c260d2e 100644 --- a/src/ext/transport/SSMTransport/SSMInPort.cpp +++ b/src/ext/transport/SSMTransport/SSMInPort.cpp @@ -80,6 +80,7 @@ namespace RTC if(!coil::stringTo(m_stream_id, stream_id_str.c_str())) { RTC_ERROR(("stream_id is invalid value")); + throw std::bad_alloc(); } } diff --git a/src/ext/transport/SSMTransport/SSMOutPort.cpp b/src/ext/transport/SSMTransport/SSMOutPort.cpp index 2a5ec249d..fce1c8b11 100644 --- a/src/ext/transport/SSMTransport/SSMOutPort.cpp +++ b/src/ext/transport/SSMTransport/SSMOutPort.cpp @@ -67,25 +67,29 @@ namespace RTC RTC_PARANOID(("SSMOutPort::init()")); m_stream_name = prop.getProperty("ssm.stream_name", "sensor_test"); - std::string stream_id_str = prop.getProperty("stream_id", "0"); + std::string stream_id_str = prop.getProperty("ssm.stream_id", "0"); if(!coil::stringTo(m_stream_id, stream_id_str.c_str())) { RTC_ERROR(("stream_id is invalid value")); + throw std::bad_alloc(); } std::string stream_size_str = prop.getProperty("ssm.stream_size", "0"); if(!coil::stringTo(m_stream_size, stream_size_str.c_str())) { RTC_ERROR(("stream_size is invalid value")); + throw std::bad_alloc(); } std::string life_ssm_time_str = prop.getProperty("ssm.life_ssm_time", "5.0"); if(!coil::stringTo(m_life_ssm_time, life_ssm_time_str.c_str())) { RTC_ERROR(("life_ssm_time is invalid value")); + throw std::bad_alloc(); } std::string cycle_ssm_time_str = prop.getProperty("ssm.cycle_ssm_time", "0.05"); if(!coil::stringTo(m_cycle_ssm_time, cycle_ssm_time_str.c_str())) { RTC_ERROR(("cycle_ssm_time is invalid value")); + throw std::bad_alloc(); } if(m_stream_size > 0) diff --git a/src/ext/transport/SSMTransport/SSMTransport.cpp b/src/ext/transport/SSMTransport/SSMTransport.cpp index 0f158d5ab..b3b1bc538 100644 --- a/src/ext/transport/SSMTransport/SSMTransport.cpp +++ b/src/ext/transport/SSMTransport/SSMTransport.cpp @@ -24,6 +24,34 @@ namespace SSMRTM { + static const char* const ssm_inport_option[] = + { + "stream_name.__value__", "sensor_test", + "stream_name.__widget__", "text", + "stream_id.__value__", "0", + "stream_id.__widget__", "spin", + "stream_id.__constraint__", "0 <= x <= 10000", + "" + }; + static const char* const ssm_outport_option[] = + { + "stream_name.__value__", "sensor_test", + "stream_name.__widget__", "text", + "stream_id.__value__", "0", + "stream_id.__widget__", "spin", + "stream_id.__constraint__", "0 <= x <= 10000", + "stream_size.__value__", "0", + "stream_size.__widget__", "spin", + "stream_size.__constraint__", "0 <= x <= 2147483647", + "life_ssm_time.__value__", "5.0", + "life_ssm_time.__widget__", "slider.0.01", + "life_ssm_time.__constraint__", "0.00 <= x <= 1000.00", + "cycle_ssm_time.__value__", "0.05", + "cycle_ssm_time.__widget__", "slider.0.01", + "cycle_ssm_time.__constraint__", "0.00 <= x <= 1000.00", + "" + }; + ManagerActionListener::ManagerActionListener() { @@ -69,25 +97,29 @@ extern "C" { if(!initSSM()) { - return; + throw; } { + coil::Properties prop(SSMRTM::ssm_inport_option); RTC::OutPortConsumerFactory& factory(RTC::OutPortConsumerFactory::instance()); factory.addFactory("ssm", ::coil::Creator< ::RTC::OutPortConsumer, ::RTC::SSMInPort>, ::coil::Destructor< ::RTC::OutPortConsumer, - ::RTC::SSMInPort>); + ::RTC::SSMInPort>, + prop); } { + coil::Properties prop(SSMRTM::ssm_outport_option); RTC::InPortConsumerFactory& factory(RTC::InPortConsumerFactory::instance()); factory.addFactory("ssm", ::coil::Creator< ::RTC::InPortConsumer, ::RTC::SSMOutPort>, ::coil::Destructor< ::RTC::InPortConsumer, - ::RTC::SSMOutPort>); + ::RTC::SSMOutPort>, + prop); } diff --git a/src/ext/transport/SSMTransport/rtc.ssm.conf.in b/src/ext/transport/SSMTransport/rtc.ssm.conf.in new file mode 100644 index 000000000..5eeec8bb3 --- /dev/null +++ b/src/ext/transport/SSMTransport/rtc.ssm.conf.in @@ -0,0 +1,10 @@ +logger.enable: YES +logger.log_level: DEBUG +#logger.file_name: stdout + +manager.modules.load_path: @CMAKE_INSTALL_PREFIX@/@INSTALL_SSMTRANSPORT_DIR@ +manager.preload.modules: SSMTransport@CMAKE_SHARED_LIBRARY_SUFFIX@ + +manager.components.preactivation: ConsoleOut0, ConsoleIn0 +manager.components.preconnect: ConsoleOut0.in?interface_type=ssm&ssm.stream_name=test_stream&dataflow_type=pull, ConsoleIn0.out?interface_type=ssm&ssm.stream_name=test_stream +