MCPcopy Create free account
hub / github.com/COVESA/vsomeip / on_message

Method on_message

implementation/runtime/src/application_impl.cpp:1546–1578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1544}
1545
1546void application_impl::on_message(std::shared_ptr<message>&& _message) {
1547 const service_t its_service = _message->get_service();
1548 const instance_t its_instance = _message->get_instance();
1549 const method_t its_method = _message->get_method();
1550
1551 if (_message->get_message_type() == message_type_e::MT_NOTIFICATION) {
1552 if (!check_for_active_subscription(its_service, its_instance, static_cast<event_t>(its_method))) {
1553 VSOMEIP_INFO_P << "[" << hex4(its_service) << "." << hex4(its_instance) << "." << hex4(its_method)
1554 << "]: blocked as the subscription is already inactive.";
1555 return;
1556 }
1557 }
1558
1559 {
1560 std::scoped_lock its_lock{members_mutex_};
1561
1562 const auto its_handlers = find_handlers(its_service, its_instance, its_method);
1563
1564 if (its_handlers.size()) {
1565 std::scoped_lock its_lock_inner{handlers_mutex_};
1566 for (const auto& handler : its_handlers) {
1567 auto its_sync_handler = std::make_shared<sync_handler>([handler, _message]() { handler(_message); });
1568 its_sync_handler->handler_type_ = handler_type_e::MESSAGE;
1569 its_sync_handler->service_id_ = _message->get_service();
1570 its_sync_handler->instance_id_ = _message->get_instance();
1571 its_sync_handler->method_id_ = _message->get_method();
1572 its_sync_handler->session_id_ = _message->get_session();
1573 handlers_.push_back(its_sync_handler);
1574 }
1575 dispatcher_condition_.notify_all();
1576 }
1577 }
1578}
1579
1580// Interface "service_discovery_host"
1581void application_impl::main_dispatch() {

Callers 5

receive_cbkMethod · 0.45
receive_cbkMethod · 0.45
processMethod · 0.45
receive_cbkMethod · 0.45

Calls 7

hex4Function · 0.85
get_methodMethod · 0.80
get_serviceMethod · 0.45
get_instanceMethod · 0.45
get_message_typeMethod · 0.45
sizeMethod · 0.45
get_sessionMethod · 0.45

Tested by

no test coverage detected