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

Method init

examples/notify-sample.cpp:31–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29 }
30
31 bool init() {
32 std::scoped_lock its_lock(mutex_);
33
34 if (!app_->init()) {
35 std::cerr << "Couldn't initialize application" << std::endl;
36 return false;
37 }
38 app_->register_state_handler(std::bind(&service_sample::on_state, this, std::placeholders::_1));
39
40 app_->register_message_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_GET_METHOD_ID,
41 std::bind(&service_sample::on_get, this, std::placeholders::_1));
42
43 app_->register_message_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_SET_METHOD_ID,
44 std::bind(&service_sample::on_set, this, std::placeholders::_1));
45
46 std::set<vsomeip::eventgroup_t> its_groups;
47 its_groups.insert(SAMPLE_EVENTGROUP_ID);
48 app_->offer_event(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENT_ID, its_groups, vsomeip::event_type_e::ET_FIELD,
49 std::chrono::milliseconds::zero(), false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
50 {
51 std::scoped_lock its_lock(payload_mutex_);
52 payload_ = vsomeip::runtime::get()->create_payload();
53 }
54
55 blocked_ = true;
56 condition_.notify_one();
57 return true;
58 }
59
60 void start() { app_->start(); }
61

Callers 1

mainFunction · 0.45

Calls 6

insertMethod · 0.80
create_payloadMethod · 0.80
offer_eventMethod · 0.45
notify_oneMethod · 0.45

Tested by

no test coverage detected