1 // Copyright (C) 2019 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
2 // This Source Code Form is subject to the terms of the Mozilla Public
3 // License, v. 2.0. If a copy of the MPL was not distributed with this
4 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
6 #include <vsomeip/application.hpp>
7 #include <vsomeip/runtime.hpp>
8 #include <compat/vsomeip/runtime.hpp>
9
10 #include <vsomeip/internal/logger.hpp>
11
12 #include "../include/application_impl.hpp"
13 #ifdef ANDROID
14 # include "../../../configuration/include/internal_android.hpp"
15 #else
16 # include "../../../configuration/include/internal.hpp"
17 #endif
18 #include "../../message/include/message_impl.hpp"
19 #include "../../message/include/payload_impl.hpp"
20
21 namespace vsomeip {
22
application_impl(const std::string & _name)23 application_impl::application_impl(const std::string &_name) {
24
25 impl_ = vsomeip_v3::runtime::get()->create_application(_name);
26 }
27
~application_impl()28 application_impl::~application_impl() {
29
30 vsomeip::runtime::get()->remove_application(impl_->get_name());
31 }
32
33 const std::string &
get_name() const34 application_impl::get_name() const {
35
36 return impl_->get_name();
37 }
38
39 client_t
get_client() const40 application_impl::get_client() const {
41
42 return impl_->get_client();
43 }
44
45 void
set_configuration(const std::shared_ptr<configuration> _configuration)46 application_impl::set_configuration(const std::shared_ptr<configuration> _configuration) {
47
48 (void)_configuration;
49 // Not implemented
50 }
51
52 bool
init()53 application_impl::init() {
54
55 return impl_->init();
56 }
57
58 void
start()59 application_impl::start() {
60
61 impl_->start();
62 }
63
64 void
stop()65 application_impl::stop() {
66
67 impl_->stop();
68 }
69
70 void
offer_service(service_t _service,instance_t _instance,major_version_t _major,minor_version_t _minor)71 application_impl::offer_service(service_t _service, instance_t _instance,
72 major_version_t _major, minor_version_t _minor) {
73
74 impl_->offer_service(_service, _instance, _major, _minor);
75 }
76
77 void
stop_offer_service(service_t _service,instance_t _instance,major_version_t _major,minor_version_t _minor)78 application_impl::stop_offer_service(service_t _service, instance_t _instance,
79 major_version_t _major, minor_version_t _minor) {
80
81 impl_->stop_offer_service(_service, _instance, _major, _minor);
82 }
83
84 void
offer_event(service_t _service,instance_t _instance,event_t _event,const std::set<eventgroup_t> & _eventgroups,bool _is_field)85 application_impl::offer_event(service_t _service, instance_t _instance,
86 event_t _event, const std::set<eventgroup_t> &_eventgroups,
87 bool _is_field) {
88
89 // Set event type
90 vsomeip_v3::event_type_e its_type(vsomeip_v3::event_type_e::ET_EVENT);
91 if (_is_field)
92 its_type = vsomeip_v3::event_type_e::ET_FIELD;
93 else {
94 // Find out whether the event is selective. Requires a preceding
95 // call to "register_subscription_handler".
96 // Note: The check can be done on the eventgroup(s) as selective
97 // events own an exclusive eventgroup.
98 const bool is_selective
99 = is_selective_event(_service, _instance, _eventgroups);
100
101 if (is_selective)
102 its_type = vsomeip_v3::event_type_e::ET_SELECTIVE_EVENT;
103 }
104
105 impl_->offer_event(_service, _instance, _event, _eventgroups, its_type);
106 }
107
108 void
stop_offer_event(service_t _service,instance_t _instance,event_t _event)109 application_impl::stop_offer_event(service_t _service, instance_t _instance,
110 event_t _event) {
111
112 impl_->stop_offer_event(_service, _instance, _event);
113 }
114
115 void
request_service(service_t _service,instance_t _instance,major_version_t _major,minor_version_t _minor,bool _use_exclusive_proxy)116 application_impl::request_service(service_t _service, instance_t _instance,
117 major_version_t _major, minor_version_t _minor,
118 bool _use_exclusive_proxy) {
119
120 (void)_use_exclusive_proxy;
121 impl_->request_service(_service, _instance, _major, _minor);
122 }
123
124 void
release_service(service_t _service,instance_t _instance)125 application_impl::release_service(service_t _service, instance_t _instance) {
126
127 impl_->release_service(_service, _instance);
128 }
129
130 void
request_event(service_t _service,instance_t _instance,event_t _event,const std::set<eventgroup_t> & _eventgroups,bool _is_field)131 application_impl::request_event(service_t _service, instance_t _instance,
132 event_t _event, const std::set<eventgroup_t> &_eventgroups,
133 bool _is_field) {
134
135 const vsomeip_v3::event_type_e its_type = (_is_field) ?
136 vsomeip_v3::event_type_e::ET_FIELD :
137 vsomeip_v3::event_type_e::ET_EVENT;
138 impl_->request_event(_service, _instance, _event, _eventgroups, its_type);
139 }
140
141 void
release_event(service_t _service,instance_t _instance,event_t _event)142 application_impl::release_event(service_t _service, instance_t _instance,
143 event_t _event) {
144
145 impl_->release_event(_service, _instance, _event);
146 }
147
148 void
subscribe(service_t _service,instance_t _instance,eventgroup_t _eventgroup,major_version_t _major,subscription_type_e _subscription_type,event_t _event)149 application_impl::subscribe(service_t _service, instance_t _instance,
150 eventgroup_t _eventgroup, major_version_t _major,
151 subscription_type_e _subscription_type, event_t _event) {
152
153 (void)_subscription_type; // unused in v3
154 impl_->subscribe(_service, _instance, _eventgroup, _major, _event);
155 }
156
157 void
unsubscribe(service_t _service,instance_t _instance,eventgroup_t _eventgroup)158 application_impl::unsubscribe(service_t _service, instance_t _instance,
159 eventgroup_t _eventgroup) {
160
161 impl_->unsubscribe(_service, _instance, _eventgroup);
162 }
163
164 bool
is_available(service_t _service,instance_t _instance,major_version_t _major,minor_version_t _minor) const165 application_impl::is_available(service_t _service, instance_t _instance,
166 major_version_t _major, minor_version_t _minor) const {
167
168 return impl_->is_available(_service, _instance, _major, _minor);
169 }
170
171 void
send(std::shared_ptr<message> _message,bool _flush=true)172 application_impl::send(std::shared_ptr<message> _message, bool _flush = true) {
173
174 (void)_flush; // unused in v3
175 if (_message) {
176 auto its_message = std::dynamic_pointer_cast<message_impl>(_message);
177 impl_->send(its_message->get_impl());
178 }
179 }
180
181 void
notify(service_t _service,instance_t _instance,event_t _event,std::shared_ptr<payload> _payload) const182 application_impl::notify(service_t _service, instance_t _instance,
183 event_t _event, std::shared_ptr<payload> _payload) const {
184
185 if (_payload) {
186 auto its_payload = std::dynamic_pointer_cast<payload_impl>(_payload);
187 impl_->notify(_service, _instance, _event, its_payload->get_impl());
188 } else {
189 impl_->notify(_service, _instance, _event, nullptr);
190 }
191 }
192
193 void
notify_one(service_t _service,instance_t _instance,event_t _event,std::shared_ptr<payload> _payload,client_t _client) const194 application_impl::notify_one(service_t _service, instance_t _instance,
195 event_t _event, std::shared_ptr<payload> _payload,
196 client_t _client) const {
197
198 if (_payload) {
199 auto its_payload = std::dynamic_pointer_cast<payload_impl>(_payload);
200 impl_->notify_one(_service, _instance, _event, its_payload->get_impl(), _client);
201 } else {
202 impl_->notify_one(_service, _instance, _event, nullptr, _client);
203 }
204 }
205
206 void
register_state_handler(state_handler_t _handler)207 application_impl::register_state_handler(state_handler_t _handler) {
208
209 impl_->register_state_handler(
210 [_handler](vsomeip_v3::state_type_e _state) {
211 _handler(static_cast<vsomeip::state_type_e>(_state));
212 }
213 );
214 }
215
216 void
unregister_state_handler()217 application_impl::unregister_state_handler() {
218
219 impl_->unregister_state_handler();
220 }
221
222 void
register_message_handler(service_t _service,instance_t _instance,method_t _method,message_handler_t _handler)223 application_impl::register_message_handler(
224 service_t _service, instance_t _instance, method_t _method,
225 message_handler_t _handler) {
226
227 impl_->register_message_handler(_service, _instance, _method,
228 [_handler](const std::shared_ptr<vsomeip_v3::message> &_message) {
229 auto its_message = std::make_shared<message_impl>(_message);
230 _handler(its_message);
231 }
232 );
233 }
234
235 void
unregister_message_handler(service_t _service,instance_t _instance,method_t _method)236 application_impl::unregister_message_handler(
237 service_t _service, instance_t _instance, method_t _method) {
238
239 impl_->unregister_message_handler(_service, _instance, _method);
240 }
241
242 void
register_availability_handler(service_t _service,instance_t _instance,availability_handler_t _handler,major_version_t _major,minor_version_t _minor)243 application_impl::register_availability_handler(
244 service_t _service, instance_t _instance,
245 availability_handler_t _handler,
246 major_version_t _major, minor_version_t _minor) {
247
248 impl_->register_availability_handler(_service, _instance, _handler,
249 _major, _minor);
250 }
251
252 void
unregister_availability_handler(service_t _service,instance_t _instance,major_version_t _major,minor_version_t _minor)253 application_impl::unregister_availability_handler(
254 service_t _service, instance_t _instance,
255 major_version_t _major, minor_version_t _minor) {
256
257 impl_->unregister_availability_handler(_service, _instance, _major, _minor);
258 }
259
260 void
register_subscription_handler(service_t _service,instance_t _instance,eventgroup_t _eventgroup,subscription_handler_t _handler)261 application_impl::register_subscription_handler(
262 service_t _service, instance_t _instance, eventgroup_t _eventgroup,
263 subscription_handler_t _handler) {
264 {
265 std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
266 eventgroups_[_service][_instance].insert(_eventgroup);
267 }
268
269 impl_->register_subscription_handler(_service, _instance, _eventgroup,
270 [_handler](client_t _client, vsomeip::uid_t _uid,
271 vsomeip::gid_t _gid, bool _accepted){
272 (void)_uid;
273 (void)_gid;
274 return _handler(_client, _accepted);
275 }
276 );
277 }
278
279 void
unregister_subscription_handler(service_t _service,instance_t _instance,eventgroup_t _eventgroup)280 application_impl::unregister_subscription_handler(
281 service_t _service, instance_t _instance, eventgroup_t _eventgroup) {
282
283 impl_->unregister_subscription_handler(_service, _instance, _eventgroup);
284 }
285
286
287 // subscription_error_handlers were exclusively used for selective events.
288 // As selective events use an exclusive eventgroup, the event identifier
289 // itself is not needed and we can use a dummy.
290 #define ERROR_HANDLER_DUMMY_EVENT 0xFFFE
291
292 void
register_subscription_error_handler(service_t _service,instance_t _instance,eventgroup_t _eventgroup,error_handler_t _handler)293 application_impl::register_subscription_error_handler(
294 service_t _service, instance_t _instance, eventgroup_t _eventgroup,
295 error_handler_t _handler) {
296
297 impl_->register_subscription_status_handler(
298 _service, _instance, _eventgroup, ERROR_HANDLER_DUMMY_EVENT,
299 [_handler](service_t _service, instance_t _instance,
300 eventgroup_t _eventgroup, event_t _event,
301 uint16_t _error) {
302 (void)_service;
303 (void)_instance;
304 (void)_eventgroup;
305 (void)_event;
306
307 _handler(_error);
308 },
309 true
310 );
311 }
312
313 void
unregister_subscription_error_handler(service_t _service,instance_t _instance,eventgroup_t _eventgroup)314 application_impl::unregister_subscription_error_handler(
315 service_t _service, instance_t _instance, eventgroup_t _eventgroup) {
316
317 impl_->unregister_subscription_status_handler(_service, _instance,
318 _eventgroup, ERROR_HANDLER_DUMMY_EVENT);
319 }
320
321 void
clear_all_handler()322 application_impl::clear_all_handler() {
323
324 impl_->clear_all_handler();
325 }
326
327 bool
is_routing() const328 application_impl::is_routing() const {
329
330 return impl_->is_routing();
331 }
332
333 void
offer_event(service_t _service,instance_t _instance,event_t _event,const std::set<eventgroup_t> & _eventgroups,bool _is_field,std::chrono::milliseconds _cycle,bool _change_resets_cycle,const epsilon_change_func_t & _epsilon_change_func)334 application_impl::offer_event(
335 service_t _service, instance_t _instance, event_t _event,
336 const std::set<eventgroup_t> &_eventgroups,
337 bool _is_field,
338 std::chrono::milliseconds _cycle,
339 bool _change_resets_cycle,
340 const epsilon_change_func_t &_epsilon_change_func) {
341
342 // Set event type
343 vsomeip_v3::event_type_e its_type(vsomeip_v3::event_type_e::ET_EVENT);
344 if (_is_field)
345 its_type = vsomeip_v3::event_type_e::ET_FIELD;
346 else {
347 // Find out whether the event is selective. Requires a preceding
348 // call to "register_subscription_handler".
349 // Note: The check can be done on the eventgroup(s) as selective
350 // events own an exclusive eventgroup.
351 const bool is_selective
352 = is_selective_event(_service, _instance, _eventgroups);
353
354 if (is_selective)
355 its_type = vsomeip_v3::event_type_e::ET_SELECTIVE_EVENT;
356 }
357
358 impl_->offer_event(_service, _instance, _event, _eventgroups,
359 its_type, _cycle, _change_resets_cycle, true,
360 [_epsilon_change_func](
361 const std::shared_ptr<vsomeip_v3::payload> &_lhs,
362 const std::shared_ptr<vsomeip_v3::payload> &_rhs) {
363 auto its_lhs = std::make_shared<payload_impl>(_lhs);
364 auto its_rhs = std::make_shared<payload_impl>(_rhs);
365 return _epsilon_change_func(its_lhs, its_rhs);
366 }
367 );
368 }
369
370 void
notify(service_t _service,instance_t _instance,event_t _event,std::shared_ptr<payload> _payload,bool _force) const371 application_impl::notify(service_t _service, instance_t _instance,
372 event_t _event, std::shared_ptr<payload> _payload, bool _force) const {
373
374 if (_payload) {
375 auto its_payload = std::dynamic_pointer_cast<payload_impl>(_payload);
376 impl_->notify(_service, _instance, _event, its_payload->get_impl(),
377 _force);
378 } else {
379 impl_->notify(_service, _instance, _event, nullptr, _force);
380 }
381 }
382
383 void
notify_one(service_t _service,instance_t _instance,event_t _event,std::shared_ptr<payload> _payload,client_t _client,bool _force) const384 application_impl::notify_one(service_t _service, instance_t _instance,
385 event_t _event, std::shared_ptr<payload> _payload,
386 client_t _client, bool _force) const {
387
388 if (_payload) {
389 auto its_payload = std::dynamic_pointer_cast<payload_impl>(_payload);
390 impl_->notify_one(_service, _instance, _event, its_payload->get_impl(),
391 _client, _force);
392 } else {
393 impl_->notify_one(_service, _instance, _event, nullptr, _client,
394 _force);
395 }
396 }
397
398 bool
are_available(available_t & _available,service_t _service,instance_t _instance,major_version_t _major,minor_version_t _minor) const399 application_impl::are_available(available_t &_available,
400 service_t _service, instance_t _instance,
401 major_version_t _major, minor_version_t _minor) const {
402
403 return impl_->are_available(_available, _service, _instance, _major,
404 _minor);
405 }
406
407 void
notify(service_t _service,instance_t _instance,event_t _event,std::shared_ptr<payload> _payload,bool _force,bool _flush) const408 application_impl::notify(service_t _service, instance_t _instance,
409 event_t _event, std::shared_ptr<payload> _payload,
410 bool _force, bool _flush) const {
411
412 (void)_flush; // unused in v3
413
414 if (_payload) {
415 auto its_payload = std::dynamic_pointer_cast<payload_impl>(_payload);
416 impl_->notify(_service, _instance, _event, its_payload->get_impl(),
417 _force);
418 } else {
419 impl_->notify(_service, _instance, _event, nullptr, _force);
420 }
421 }
422
423 void
notify_one(service_t _service,instance_t _instance,event_t _event,std::shared_ptr<payload> _payload,client_t _client,bool _force,bool _flush) const424 application_impl::notify_one(service_t _service, instance_t _instance,
425 event_t _event, std::shared_ptr<payload> _payload,
426 client_t _client, bool _force, bool _flush) const {
427
428 (void)_flush; // unused in v3
429
430 if (_payload) {
431 auto its_payload = std::dynamic_pointer_cast<payload_impl>(_payload);
432 impl_->notify_one(_service, _instance, _event, its_payload->get_impl(),
433 _client, _force);
434 } else {
435 impl_->notify_one(_service, _instance, _event, nullptr, _client,
436 _force);
437 }
438 }
439
440 void
set_routing_state(routing_state_e _routing_state)441 application_impl::set_routing_state(routing_state_e _routing_state) {
442
443 impl_->set_routing_state(
444 static_cast<vsomeip_v3::routing_state_e>(_routing_state));
445 }
446
447 void
unsubscribe(service_t _service,instance_t _instance,eventgroup_t _eventgroup,event_t _event)448 application_impl::unsubscribe(service_t _service, instance_t _instance,
449 eventgroup_t _eventgroup, event_t _event) {
450
451 impl_->unsubscribe(_service, _instance, _eventgroup, _event);
452 }
453
454 void
register_subscription_status_handler(service_t _service,instance_t _instance,eventgroup_t _eventgroup,event_t _event,subscription_status_handler_t _handler)455 application_impl::register_subscription_status_handler(service_t _service,
456 instance_t _instance, eventgroup_t _eventgroup, event_t _event,
457 subscription_status_handler_t _handler) {
458
459 register_subscription_status_handler(_service, _instance,
460 _eventgroup, _event, _handler, false);
461 }
462
463 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)464 application_impl::register_subscription_status_handler(service_t _service,
465 instance_t _instance, eventgroup_t _eventgroup, event_t _event,
466 subscription_status_handler_t _handler, bool _is_selective) {
467 if (_is_selective) {
468 std::set<vsomeip::eventgroup_t> its_eventgroups;
469 its_eventgroups.insert(_eventgroup);
470 // An application may call "register_event" before
471 // "register_subscription_status_handler". While the call to
472 // "register_subscription_status_handler" contains the information
473 // whether an event is selective, the call to "register_event" does
474 // not. Therefore, we re-register the event with correct event type
475 // here.
476 impl_->request_event(_service, _instance, _event, its_eventgroups,
477 vsomeip_v3::event_type_e::ET_SELECTIVE_EVENT);
478 }
479
480 impl_->register_subscription_status_handler(_service, _instance,
481 _eventgroup, _event,
482 [_handler](const vsomeip_v3::service_t _service,
483 const vsomeip_v3::instance_t _instance,
484 const vsomeip_v3::eventgroup_t _eventgroup,
485 const vsomeip_v3::event_t _event,
486 const uint16_t _error) {
487
488 if (_handler)
489 _handler(_service, _instance, _eventgroup, _event, _error);
490 },
491 _is_selective);
492 }
493
494 void
get_offered_services_async(offer_type_e _offer_type,offered_services_handler_t _handler)495 application_impl::get_offered_services_async(
496 offer_type_e _offer_type, offered_services_handler_t _handler) {
497
498 impl_->get_offered_services_async(
499 static_cast<vsomeip_v3::offer_type_e>(_offer_type), _handler);
500 }
501
502 void
set_watchdog_handler(watchdog_handler_t _handler,std::chrono::seconds _interval)503 application_impl::set_watchdog_handler(
504 watchdog_handler_t _handler, std::chrono::seconds _interval) {
505
506 impl_->set_watchdog_handler(_handler, _interval);
507 }
508
509 void
register_async_subscription_handler(service_t _service,instance_t _instance,eventgroup_t _eventgroup,async_subscription_handler_t _handler)510 application_impl::register_async_subscription_handler(
511 service_t _service, instance_t _instance, eventgroup_t _eventgroup,
512 async_subscription_handler_t _handler) {
513
514 {
515 std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
516 eventgroups_[_service][_instance].insert(_eventgroup);
517 }
518 impl_->register_async_subscription_handler(_service, _instance,
519 _eventgroup, [_handler](client_t _client,
520 vsomeip::uid_t _uid, vsomeip::gid_t _gid, bool _accepted,
521 std::function<void(const bool)> _handler2) {
522 (void)_uid;
523 (void)_gid;
524 _handler(_client, _accepted, _handler2);
525 });
526 }
527
528 ////////////////////////////////////////////////////////////////////////////////
529 // The following methods are not implemented as they should only be used by
530 // plugin implementations that are not intended to run in compatibility mode
531 ////////////////////////////////////////////////////////////////////////////////
532 void
set_offer_acceptance_required(ip_address_t _address,const std::string _path,bool _enable)533 application_impl::set_offer_acceptance_required(
534 ip_address_t _address, const std::string _path, bool _enable) {
535
536 (void)_address;
537 (void)_path;
538 (void)_enable;
539
540 VSOMEIP_ERROR << __func__ << ": Must not be called from compatibility layer.";
541 }
542
543 vsomeip::application::offer_acceptance_map_type_t
get_offer_acceptance_required()544 application_impl::get_offer_acceptance_required() {
545
546 VSOMEIP_ERROR << __func__ << ": Must not be called from compatibility layer.";
547 return vsomeip::application::offer_acceptance_map_type_t();
548 }
549
550 void
register_offer_acceptance_handler(offer_acceptance_handler_t _handler)551 application_impl::register_offer_acceptance_handler(
552 offer_acceptance_handler_t _handler) {
553
554 (void)_handler;
555 VSOMEIP_ERROR << __func__ << ": Must not be called from compatibility layer.";
556 }
557
558 void
register_reboot_notification_handler(reboot_notification_handler_t _handler)559 application_impl::register_reboot_notification_handler(
560 reboot_notification_handler_t _handler) {
561
562 (void)_handler;
563 VSOMEIP_ERROR << __func__ << ": Must not be called from compatibility layer.";
564 }
565
566 void
register_routing_ready_handler(routing_ready_handler_t _handler)567 application_impl::register_routing_ready_handler(
568 routing_ready_handler_t _handler) {
569
570 (void)_handler;
571 VSOMEIP_ERROR << __func__ << ": Must not be called from compatibility layer.";
572 }
573
574 void
register_routing_state_handler(routing_state_handler_t _handler)575 application_impl::register_routing_state_handler(
576 routing_state_handler_t _handler) {
577
578 (void)_handler;
579 VSOMEIP_ERROR << __func__ << ": Must not be called from compatibility layer.";
580 }
581
582 bool
update_service_configuration(service_t _service,instance_t _instance,std::uint16_t _port,bool _reliable,bool _magic_cookies_enabled,bool _offer)583 application_impl::update_service_configuration(
584 service_t _service, instance_t _instance,
585 std::uint16_t _port, bool _reliable,
586 bool _magic_cookies_enabled, bool _offer) {
587
588 (void)_service;
589 (void)_instance;
590 (void)_port;
591 (void)_reliable;
592 (void)_magic_cookies_enabled;
593 (void)_offer;
594
595 VSOMEIP_ERROR << __func__ << ": Must not be called from compatibility layer.";
596 return false;
597 }
598
599 void
update_security_policy_configuration(uint32_t _uid,uint32_t _gid,std::shared_ptr<policy> _policy,std::shared_ptr<payload> _payload,security_update_handler_t _handler)600 application_impl::update_security_policy_configuration(
601 uint32_t _uid, uint32_t _gid,
602 std::shared_ptr<policy> _policy, std::shared_ptr<payload> _payload,
603 security_update_handler_t _handler) {
604
605 (void)_uid;
606 (void)_gid;
607 (void)_policy;
608 (void)_payload;
609 (void)_handler;
610
611 VSOMEIP_ERROR << __func__ << ": Must not be called from compatibility layer.";
612 }
613
614 void
remove_security_policy_configuration(uint32_t _uid,uint32_t _gid,security_update_handler_t _handler)615 application_impl::remove_security_policy_configuration(
616 uint32_t _uid, uint32_t _gid, security_update_handler_t _handler) {
617
618 (void)_uid;
619 (void)_gid;
620 (void)_handler;
621
622 VSOMEIP_ERROR << __func__ << ": Must not be called from compatibility layer.";
623 }
624
625 ////////////////////////////////////////////////////////////////////////////////
626 // Private helper
627 ////////////////////////////////////////////////////////////////////////////////
628
629 bool
is_selective_event(vsomeip::service_t _service,vsomeip::instance_t _instance,const std::set<vsomeip::eventgroup_t> & _eventgroups)630 application_impl::is_selective_event(
631 vsomeip::service_t _service, vsomeip::instance_t _instance,
632 const std::set<vsomeip::eventgroup_t> &_eventgroups) {
633
634 bool is_selective(false);
635
636 std::lock_guard<std::mutex> its_events_lock(eventgroups_mutex_);
637 const auto its_service = eventgroups_.find(_service);
638 if (its_service != eventgroups_.end()) {
639 const auto its_instance = its_service->second.find(_instance);
640 if (its_instance != its_service->second.end()) {
641 for (const auto& eg : _eventgroups) {
642 const auto its_egrp = its_instance->second.find(eg);
643 if (its_egrp != its_instance->second.end()) {
644 is_selective = true;
645 break;
646 }
647 }
648 }
649 }
650
651 return is_selective;
652 }
653
654 } // namespace vsomeip
655