From ba0508084244a2f226a6bdd42b02bbf83a7d7575 Mon Sep 17 00:00:00 2001 From: Juergen Gehring Date: Thu, 25 Jan 2018 00:40:02 -0800 Subject: [PATCH] vsomeip 2.8.0 --- CHANGES | 8 ++++ CMakeLists.txt | 4 +- .../runtime/include/application_impl.hpp | 5 ++- .../runtime/src/application_impl.cpp | 42 +++++++++++++++---- interface/vsomeip/application.hpp | 23 ++++++++++ 5 files changed, 70 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index 9305bf4fd..65e7a0382 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,14 @@ Changes ======= +v2.8.0 +- Change behaviour of register_subscription_status_handler method of + the application interface: Registered handlers will only be called + if the subscription was accepted by the remote side. +- Add 2nd register_subscription_status_handler method to application + interface with additional flag to enable calling of the registered + handler if the subscription is rejected by the remote side. + v.2.7.3 - Fix deadlock when stopping client endpoints to remote services - Fix deadlock during construction of Subscribe Eventgroup entries diff --git a/CMakeLists.txt b/CMakeLists.txt index 1440c33b5..a46f34a35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,8 +7,8 @@ cmake_minimum_required (VERSION 2.8.12) project (vsomeip) set (VSOMEIP_MAJOR_VERSION 2) -set (VSOMEIP_MINOR_VERSION 7) -set (VSOMEIP_PATCH_VERSION 3) +set (VSOMEIP_MINOR_VERSION 8) +set (VSOMEIP_PATCH_VERSION 0) set (VSOMEIP_VERSION ${VSOMEIP_MAJOR_VERSION}.${VSOMEIP_MINOR_VERSION}.${VSOMEIP_PATCH_VERSION}) set (PACKAGE_VERSION ${VSOMEIP_VERSION}) # Used in documentatin/doxygen.in set (CMAKE_VERBOSE_MAKEFILE off) diff --git a/implementation/runtime/include/application_impl.hpp b/implementation/runtime/include/application_impl.hpp index 45facc12c..b03c4977a 100644 --- a/implementation/runtime/include/application_impl.hpp +++ b/implementation/runtime/include/application_impl.hpp @@ -171,6 +171,9 @@ class application_impl: public application, VSOMEIP_EXPORT void clear_all_handler(); + VSOMEIP_EXPORT void register_subscription_status_handler(service_t _service, + instance_t _instance, eventgroup_t _eventgroup, event_t _event, + subscription_status_handler_t _handler, bool _is_selective); private: // // Types @@ -369,7 +372,7 @@ class application_impl: public application, bool stopped_called_; std::map > > > subscription_status_handlers_; + std::map > > > > subscription_status_handlers_; std::mutex subscription_status_handlers_mutex_; std::mutex subscriptions_state_mutex_; diff --git a/implementation/runtime/src/application_impl.cpp b/implementation/runtime/src/application_impl.cpp index bff1040a5..c776353a0 100644 --- a/implementation/runtime/src/application_impl.cpp +++ b/implementation/runtime/src/application_impl.cpp @@ -899,11 +899,15 @@ void application_impl::deliver_subscription_state(service_t _service, instance_t if (found_eventgroup != found_instance->second.end()) { auto found_event = found_eventgroup->second.find(_event); if (found_event != found_eventgroup->second.end()) { - handlers.push_back(found_event->second); + if (!_error || (_error && found_event->second.second)) { + handlers.push_back(found_event->second.first); + } } else { auto its_any_event = found_eventgroup->second.find(ANY_EVENT); if (its_any_event != found_eventgroup->second.end()) { - handlers.push_back(its_any_event->second); + if (!_error || (_error && found_event->second.second)) { + handlers.push_back(its_any_event->second.first); + } } } } @@ -914,11 +918,15 @@ void application_impl::deliver_subscription_state(service_t _service, instance_t if (found_eventgroup != found_instance->second.end()) { auto found_event = found_eventgroup->second.find(_event); if (found_event != found_eventgroup->second.end()) { - handlers.push_back(found_event->second); + if (!_error || (_error && found_event->second.second)) { + handlers.push_back(found_event->second.first); + } } else { auto its_any_event = found_eventgroup->second.find(ANY_EVENT); if (its_any_event != found_eventgroup->second.end()) { - handlers.push_back(its_any_event->second); + if (!_error || (_error && found_event->second.second)) { + handlers.push_back(its_any_event->second.first); + } } } } @@ -932,11 +940,15 @@ void application_impl::deliver_subscription_state(service_t _service, instance_t if (found_eventgroup != found_instance->second.end()) { auto found_event = found_eventgroup->second.find(_event); if (found_event != found_eventgroup->second.end()) { - handlers.push_back(found_event->second); + if (!_error || (_error && found_event->second.second)) { + handlers.push_back(found_event->second.first); + } } else { auto its_any_event = found_eventgroup->second.find(ANY_EVENT); if (its_any_event != found_eventgroup->second.end()) { - handlers.push_back(its_any_event->second); + if (!_error || (_error && found_event->second.second)) { + handlers.push_back(its_any_event->second.first); + } } } } @@ -947,11 +959,15 @@ void application_impl::deliver_subscription_state(service_t _service, instance_t if (found_eventgroup != found_instance->second.end()) { auto found_event = found_eventgroup->second.find(_event); if (found_event != found_eventgroup->second.end()) { - handlers.push_back(found_event->second); + if (!_error || (_error && found_event->second.second)) { + handlers.push_back(found_event->second.first); + } } else { auto its_any_event = found_eventgroup->second.find(ANY_EVENT); if (its_any_event != found_eventgroup->second.end()) { - handlers.push_back(its_any_event->second); + if (!_error || (_error && found_event->second.second)) { + handlers.push_back(its_any_event->second.first); + } } } } @@ -1017,9 +1033,17 @@ void application_impl::on_subscription_error(service_t _service, void application_impl::register_subscription_status_handler(service_t _service, instance_t _instance, eventgroup_t _eventgroup, event_t _event, subscription_status_handler_t _handler) { + register_subscription_status_handler(_service, _instance, _eventgroup, + _event, _handler, false); +} + +void application_impl::register_subscription_status_handler(service_t _service, + instance_t _instance, eventgroup_t _eventgroup, event_t _event, + subscription_status_handler_t _handler, bool _is_selective) { std::lock_guard its_lock(subscription_status_handlers_mutex_); if (_handler) { - subscription_status_handlers_[_service][_instance][_eventgroup][_event] = _handler; + subscription_status_handlers_[_service][_instance][_eventgroup][_event] = + std::make_pair(_handler, _is_selective); } else { auto its_service = subscription_status_handlers_.find(_service); if (its_service != subscription_status_handlers_.end()) { diff --git a/interface/vsomeip/application.hpp b/interface/vsomeip/application.hpp index f8591dfbf..280957c3d 100644 --- a/interface/vsomeip/application.hpp +++ b/interface/vsomeip/application.hpp @@ -861,6 +861,29 @@ class application { virtual void register_subscription_status_handler(service_t _service, instance_t _instance, eventgroup_t _eventgroup, event_t _event, subscription_status_handler_t _handler) = 0; + + /** + * + * \brief Registers a subscription status listener. + * + * When registered such a handler it will be called for + * every application::subscribe call. + * + * This method is intended to replace the application:: + * register_subscription_error_handler call in future releases. + * + * \param _service Service identifier of the service that is subscribed to. + * \param _instance Instance identifier of the service that is subscribed to. + * \param _eventgroup Eventgroup identifier of the eventgroup is subscribed to. + * \param _event Event indentifier of the event is subscribed to. + * \param _handler A subscription status handler which will be called by vSomeIP + * as a follow of application::subscribe. + * \param _is_selective Flag to enable calling the provided handler if the + * subscription is answered with a SUBSCRIBE_NACK. + */ + virtual void register_subscription_status_handler(service_t _service, + instance_t _instance, eventgroup_t _eventgroup, event_t _event, + subscription_status_handler_t _handler, bool _is_selective) = 0; }; /** @} */