Aufgrund einer Wartung wird GitLab am 26.10. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 26.10. between 8:00 and 9:00 am.

Commit 86174607 authored by Alexander David Hellwig's avatar Alexander David Hellwig
Browse files

Merge branch '18-fix-subscribers-publishers-someip-2' into 'master'

Resolve "Fix Subscribers/Publishers(SomeIP)"

Closes #18

See merge request !7
parents 00c16ca6 abafe36a
Pipeline #188875 passed with stages
in 1 minute and 49 seconds
...@@ -49,6 +49,66 @@ public class SomeIPAdapterModel { ...@@ -49,6 +49,66 @@ public class SomeIPAdapterModel {
outgoing = outgoing.stream().filter(fc -> fc.isSomeIPPort()).filter(fc -> fc.isOutgoing()).collect(Collectors.toList()); outgoing = outgoing.stream().filter(fc -> fc.isSomeIPPort()).filter(fc -> fc.isOutgoing()).collect(Collectors.toList());
} }
public int getServiceId(EMAPortInstanceSymbol p)
{
Optional<MiddlewareSymbol> symbol = p.getMiddlewareSymbol();
if(symbol.isPresent() && symbol.get().isKindOf(SomeIPConnectionKind.INSTANCE))
{
SomeIPConnectionSymbol sym = (SomeIPConnectionSymbol) symbol.get();
int serviceID = sym.getserviceID().isPresent()?sym.getserviceID().get():-1;
return serviceID;
}
return -1;
}
public int getInstanceId(EMAPortInstanceSymbol p)
{
Optional<MiddlewareSymbol> symbol = p.getMiddlewareSymbol();
if(symbol.isPresent() && symbol.get().isKindOf(SomeIPConnectionKind.INSTANCE))
{
SomeIPConnectionSymbol sym = (SomeIPConnectionSymbol) symbol.get();
int instanceID = sym.getinstanceID().isPresent()?sym.getinstanceID().get():-1;
return instanceID;
}
return -1;
}
public int getEventGroupId(EMAPortInstanceSymbol p)
{
Optional<MiddlewareSymbol> symbol = p.getMiddlewareSymbol();
if(symbol.isPresent() && symbol.get().isKindOf(SomeIPConnectionKind.INSTANCE))
{
SomeIPConnectionSymbol sym = (SomeIPConnectionSymbol) symbol.get();
int eventgroupID = sym.geteventgroupID().isPresent()?sym.geteventgroupID().get():-1;
return eventgroupID;
}
return -1;
}
public int getEventId(EMAPortInstanceSymbol p)
{
Optional<MiddlewareSymbol> symbol = p.getMiddlewareSymbol();
if(symbol.isPresent() && symbol.get().isKindOf(SomeIPConnectionKind.INSTANCE))
{
SomeIPConnectionSymbol sym = (SomeIPConnectionSymbol) symbol.get();
int eventID = 0;//sym.geteventID().isPresent()?sym.geteventID().get():-1;
return eventID;
}
return -1;
}
public int getMethodId(EMAPortInstanceSymbol p)
{
Optional<MiddlewareSymbol> symbol = p.getMiddlewareSymbol();
if(symbol.isPresent() && symbol.get().isKindOf(SomeIPConnectionKind.INSTANCE))
{
SomeIPConnectionSymbol sym = (SomeIPConnectionSymbol) symbol.get();
int methodID = 0;//sym.getmethodID().isPresent()?sym.getmethodID().get():-1;
return methodID;
}
return -1;
}
// Parse through component to find information about its ports // Parse through component to find information about its ports
public void addPortsDesc(Collection<EMAPortInstanceSymbol> ports) public void addPortsDesc(Collection<EMAPortInstanceSymbol> ports)
{ {
......
...@@ -3,141 +3,138 @@ ...@@ -3,141 +3,138 @@
#include "<@m.mwIdent/>Adapter_${model.getEscapedCompName()}.h" #include "<@m.mwIdent/>Adapter_${model.getEscapedCompName()}.h"
<@m.mwIdent/>Adapter_${model.getEscapedCompName()}::<@m.mwIdent/>Adapter_${model.getEscapedCompName()}() : public IAdapter_${model.getEscapedCompName()} { <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::<@m.mwIdent/>Adapter_${model.getEscapedCompName()}() : public IAdapter_${model.getEscapedCompName()} {
//choose random ids
in1_service_id = 11;
in1_instance_id = 12;
in1_method_id = 13;
in1_event_id = 14;
in1_eventgroup_id = 15;
in2_service_id = 21;
in2_instance_id = 22;
in2_method_id = 23;
in2_event_id = 24;
in2_eventgroup_id = 25;
out1_service_id = 111;
out1_instance_id = 112;
out1_method_id = 113;
out1_event_id = 114;
out1_eventgroup_id = 115;
out2_service_id = 121;
out2_instance_id = 122;
out2_method_id = 123;
out2_event_id = 124;
out2_eventgroup_id = 125;
} }
void <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::init(${model.getEscapedCompName()} *comp) { void <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::init(${model.getEscapedCompName()} *comp) {
// Initialize component // Initialize component
this->component = comp; this->component = comp;
// Intitialize subscriber for in1
in1_Subscriber = vsomeip::runtime::get()->create_application("Subscriber"); // Intitialize Subscriber
in1_Subscriber->init(); <#list model.getIncomingPorts() as sub>
in1_Subscriber->request_service(in1_service_id, in1_instance_id); ${sub.getName()}_Subscriber = vsomeip::runtime::get()->create_application("Subscriber ${sub.getName()}");
in1_Subscriber->register_message_handler(in1_service_id, in1_instance_id, in1_method_id, std::bind(&SomeIPAdapter_${model.getEscapedCompName()}::on_message_in1, this, std::placeholders::_1)); if (!${sub.getName()}_Subscriber->init()) {
std::cerr << "Couldn't initialize Subscriber ${sub.getName()}" << std::endl;
// Subscribe }
std::set<vsomeip::eventgroup_t> in1_event_group;
in1_event_group.insert(in1_eventgroup_id); ${sub.getName()}_Subscriber->register_availability_handler(${model.getServiceId(sub)}, ${model.getInstanceId(sub)}, std::bind(&SomeIPAdapter_${model.getEscapedCompName()}::on_availability_${sub.getName()}, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
in1_Subscriber->request_event(in1_service_id, in1_instance_id, in1_event_id, in1_event_group, true); ${sub.getName()}_Subscriber->request_service(${model.getServiceId(sub)}, ${model.getInstanceId(sub)});
in1_Subscriber->subscribe(in1_service_id, in1_instance_id, in1_eventgroup_id); ${sub.getName()}_Subscriber->register_message_handler(${model.getServiceId(sub)}, ${model.getInstanceId(sub)}, ${model.getMethodId(sub)}, std::bind(&SomeIPAdapter_${model.getEscapedCompName()}::on_message_${sub.getName()}, this, std::placeholders::_1));
in1_Subscriber->start();
std::thread sender_${sub.getName()}(std::bind(&SomeIPAdapter_${model.getEscapedCompName()}::run_${sub.getName()}, this));
${sub.getName()}_Subscriber->start();
// Intitialize subscriber for in2 </#list>
in2_Subscriber = vsomeip::runtime::get()->create_application("Subscriber");
in2_Subscriber->init();
in2_Subscriber->request_service(in2_service_id, in2_instance_id); // Intitialize Publisher
in2_Subscriber->register_message_handler(in2_service_id, in2_instance_id, in2_method_id, std::bind(&SomeIPAdapter_${model.getEscapedCompName()}::on_message_in2, this, std::placeholders::_1)); <#list model.getOutgoingPorts() as pub>
${pub.getName()}_Publisher = vsomeip::runtime::get()->create_application("Publisher ${pub.getName()}");
// Subscribe if (!${pub.getName()}_Publisher->init()) {
std::set<vsomeip::eventgroup_t> in2_event_group; std::cerr << "Couldn't initialize Publisher ${pub.getName()}" << std::endl;
in2_event_group.insert(in2_eventgroup_id); }
in2_Subscriber->request_event(in2_service_id, in2_instance_id, in2_event_id, in2_event_group, true); ${pub.getName()}_Publisher->offer_service(${model.getServiceId(pub)}, ${model.getInstanceId(pub)});
in2_Subscriber->subscribe(in2_service_id, in2_instance_id, in2_eventgroup_id); ${pub.getName()}_Publisher->start();
in2_Subscriber->start(); </#list>
// Intitialize Publisher for out1
out1_Publisher = vsomeip::runtime::get()->create_application("Publisher");
out1_Publisher->init();
out1_Publisher->offer_service(out1_service_id, out1_instance_id);
out1_Publisher->start();
// Intitialize Publisher for out2
out2_Publisher = vsomeip::runtime::get()->create_application("Publisher");
out2_Publisher->init();
out2_Publisher->offer_service(out2_service_id, out2_instance_id);
out2_Publisher->start();
} }
void <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::on_message_in1(const std::shared_ptr<vsomeip::message> &_request) { <#list model.getIncomingPorts() as sub>
//read received message void <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::run_${sub.getName()}() {
std::shared_ptr<vsomeip::payload> its_payload = _request->get_payload(); std::unique_lock<std::mutex> its_lock(mutex_${sub.getName()});
vsomeip::length_t l = its_payload->get_length(); condition_${sub.getName()}.wait(its_lock);
double dataFromMessage = *((double*)its_payload->get_data());
component->in1 = dataFromMessage; std::set<vsomeip::eventgroup_t> event_group;
//print data to std out event_group.insert(${model.getEventGroupId(sub)});
std::cout << "SERVICE: Received message from [" ${sub.getName()}_Subscriber->request_event(${model.getServiceId(sub)}, ${model.getInstanceId(sub)}, ${model.getEventId(sub)}, event_group, true);
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_client() << "/" ${sub.getName()}_Subscriber->subscribe(${model.getServiceId(sub)}, ${model.getInstanceId(sub)}, ${model.getEventGroupId(sub)});
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_session() << "]: "
<< dataFromMessage << std::endl;
} }
void <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::on_message_in2(const std::shared_ptr<vsomeip::message> &_request) { void <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::on_message_${sub.getName()}(const std::shared_ptr<vsomeip::message> &_message) {
//read received message //read received message
std::shared_ptr<vsomeip::payload> its_payload = _request->get_payload(); std::shared_ptr<vsomeip::payload> its_payload = _message->get_payload();
vsomeip::length_t l = its_payload->get_length(); vsomeip::length_t l = its_payload->get_length();
double dataFromMessage = *((double*)its_payload->get_data()); double dataFromMessage = *((double*)its_payload->get_data());
component->in2 = dataFromMessage;
<#switch sub.getTypeReference().getName()>
<#case "Q">
// double
component->${sub.getName()} = dataFromMessage;
<#break>
<#case "N">
//int
component->${sub.getName()} = (int) round(dataFromMessage);
<#break>
<#case "Z">
//int
component->${sub.getName()} = (int) round(dataFromMessage);
<#break>
<#case "B">
//bool
component->${sub.getName()} = (dataFromMessage > 1.0e-10);
<#break>
<#default>
//error
</#switch>
//print data to std out //print data to std out
std::cout << "SERVICE: Received message from [" std::cout << "SERVICE ${sub.getName()}: Received message from ["
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_client() << "/" << std::setw(4) << std::setfill('0') << std::hex << _message->get_client() << "/"
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_session() << "]: " << std::setw(4) << std::setfill('0') << std::hex << _message->get_session() << "]: "
<< dataFromMessage << std::endl; << dataFromMessage << std::endl;
} }
void <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::publishout1_Publisher() void <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::on_availability_${sub.getName()}(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) {
{ std::cout << "Service ["
//Read data from component << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
double d = component->out1; << "] is "
<< (_is_available ? "available." : "NOT available.")
//Create message << std::endl;
uint8_t *byteArray = (uint8_t*)&d; condition_${sub.getName()}.notify_one();
vsomeip::byte_t *p;
p = byteArray;
std::shared_ptr< vsomeip::payload > payload = vsomeip::runtime::get()->create_payload(p,8);
//Publish
std::set<vsomeip::eventgroup_t> out1_event_group;
out1_event_group.insert(out1_eventgroup_id);
out1_Publisher->offer_event(out1_service_id, out1_instance_id, out1_event_id, out1_event_group, true);
out1_Publisher->notify(out1_service_id, out1_instance_id, out1_event_id, payload);
} }
</#list>
void <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::publishout2_Publisher()
{
//Read data from component
double d = component->out2;
//Create message <#list model.getOutgoingPorts() as pub>
uint8_t *byteArray = (uint8_t*)&d; void <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::publish${pub.getName()}_Publisher()
vsomeip::byte_t *p; {
p = byteArray; //Read data from component
std::shared_ptr< vsomeip::payload > payload = vsomeip::runtime::get()->create_payload(p,8); <#switch pub.getTypeReference().getName()>
<#case "Q">
// double
double d = component->${pub.getName()};
<#break>
<#case "N">
//int
double d = 1.0 * component->${pub.getName()};
<#break>
<#case "Z">
//int
double d = 1.0 * component->${pub.getName()};
<#break>
<#case "B">
//bool
double d = component->${pub.getName()} ? 1.0 : 0.0;
<#break>
<#default>
//error
</#switch>
const vsomeip::byte_t its_data[] = { (uint8_t) d };
std::shared_ptr<vsomeip::payload> payload = vsomeip::runtime::get()->create_payload();
payload->set_data(its_data, sizeof(its_data));
//Publish //Publish
std::set<vsomeip::eventgroup_t> out2_event_group; std::set<vsomeip::eventgroup_t> event_group;
out2_event_group.insert(out2_eventgroup_id); event_group.insert(${model.getEventGroupId(pub)});
out2_Publisher->offer_event(out2_service_id, out2_instance_id, out2_event_id, out2_event_group, true); ${pub.getName()}_Publisher->offer_event(${model.getServiceId(pub)}, ${model.getInstanceId(pub)}, ${model.getEventId(pub)}, event_group, true);
out2_Publisher->notify(out2_service_id, out2_instance_id, out2_event_id, payload); ${pub.getName()}_Publisher->notify(${model.getServiceId(pub)}, ${model.getInstanceId(pub)}, ${model.getEventId(pub)}, payload);
} }
</#list>
void <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::tick() void <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::tick()
{ {
publishout1_Publisher(); <#list model.getOutgoingPorts() as pub>
publishout2_Publisher(); publish${pub.getName()}_Publisher();
</#list>
} }
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#pragma once #pragma once
#include "${model.getEscapedCompName()}.h" #include "${model.getEscapedCompName()}.h"
#include "IAdapter_${model.getEscapedCompName()}.h" #include "IAdapter_${model.getEscapedCompName()}.h"
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
...@@ -12,6 +11,7 @@ ...@@ -12,6 +11,7 @@
#include <thread> #include <thread>
#include <vsomeip/vsomeip.hpp> #include <vsomeip/vsomeip.hpp>
#include <math.h>
using namespace std; using namespace std;
...@@ -23,14 +23,6 @@ public: ...@@ -23,14 +23,6 @@ public:
void init(${model.getEscapedCompName()} *comp); void init(${model.getEscapedCompName()} *comp);
void on_message_in1(const std::shared_ptr<vsomeip::message> &_request);
void on_message_in2(const std::shared_ptr<vsomeip::message> &_request);
void publishout1_Publisher();
void publishout2_Publisher();
void tick(); void tick();
...@@ -38,35 +30,19 @@ private: ...@@ -38,35 +30,19 @@ private:
${model.getEscapedCompName()}* component = nullptr; ${model.getEscapedCompName()}* component = nullptr;
std::shared_ptr<vsomeip::application> in1_Subscriber; <#list model.getIncomingPorts() as sub>
std::shared_ptr<vsomeip::application> ${sub.getName()}_Subscriber;
std::shared_ptr<vsomeip::application> in2_Subscriber; std::mutex mutex_${sub.getName()};
std::condition_variable condition_${sub.getName()};
std::shared_ptr<vsomeip::application> out1_Publisher;
std::shared_ptr<vsomeip::application> out2_Publisher;
int in1_service_id;
int in1_instance_id;
int in1_method_id;
int in1_event_id;
int in1_eventgroup_id;
int in2_service_id; void run_${sub.getName()}();
int in2_instance_id; void on_message_${sub.getName()}(const std::shared_ptr<vsomeip::message> &_message);
int in2_method_id; void on_availability_${sub.getName()}(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available);
int in2_event_id; </#list>
int in2_eventgroup_id;
int out1_service_id; <#list model.getOutgoingPorts() as pub>
int out1_instance_id; std::shared_ptr<vsomeip::application> ${pub.getName()}_Publisher;
int out1_method_id;
int out1_event_id;
int out1_eventgroup_id;
int out2_service_id; void publish${pub.getName()}_Publisher();
int out2_instance_id; </#list>
int out2_method_id;
int out2_event_id;
int out2_eventgroup_id;
}; };
...@@ -34,7 +34,10 @@ public class AdapterGenerationTest extends AbstractSymtabTest { ...@@ -34,7 +34,10 @@ public class AdapterGenerationTest extends AbstractSymtabTest {
generatorSomeIP.setGenerationTargetPath("./target/generated-sources/"); generatorSomeIP.setGenerationTargetPath("./target/generated-sources/");
// Connect component's ports to topics // Connect component's ports to topics
componentInstanceSymbol.getPortInstance("in1").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(1,2,3)); componentInstanceSymbol.getPortInstance("in1").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(11,12,13/*,14,15*/));
componentInstanceSymbol.getPortInstance("in2").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(21,22,23/*,24,25*/));
componentInstanceSymbol.getPortInstance("out1").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(111,112,113/*,114,115*/));
componentInstanceSymbol.getPortInstance("out2").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(121,122,123/*,124,125*/));
List<File> files = generatorSomeIP.generateSomeIPAdapter(componentInstanceSymbol); List<File> files = generatorSomeIP.generateSomeIPAdapter(componentInstanceSymbol);
......
...@@ -2,142 +2,152 @@ ...@@ -2,142 +2,152 @@
#include "SomeIPAdapter_tests_a_compA.h" #include "SomeIPAdapter_tests_a_compA.h"
SomeIPAdapter_tests_a_compA::SomeIPAdapter_tests_a_compA() : public IAdapter_tests_a_compA { SomeIPAdapter_tests_a_compA::SomeIPAdapter_tests_a_compA() : public IAdapter_tests_a_compA {
//choose random ids
in1_service_id = 11;
in1_instance_id = 12;
in1_method_id = 13;
in1_event_id = 14;
in1_eventgroup_id = 15;
in2_service_id = 21;
in2_instance_id = 22;
in2_method_id = 23;
in2_event_id = 24;
in2_eventgroup_id = 25;
out1_service_id = 111;
out1_instance_id = 112;
out1_method_id = 113;
out1_event_id = 114;
out1_eventgroup_id = 115;
out2_service_id = 121;
out2_instance_id = 122;
out2_method_id = 123;
out2_event_id = 124;
out2_eventgroup_id = 125;
} }
void SomeIPAdapter_tests_a_compA::init(tests_a_compA *comp) { void SomeIPAdapter_tests_a_compA::init(tests_a_compA *comp) {
// Initialize component // Initialize component
this->component = comp; this->component = comp;
// Intitialize subscriber for in1
in1_Subscriber = vsomeip::runtime::get()->create_application("Subscriber"); // Intitialize Subscriber
in1_Subscriber->init(); in1_Subscriber = vsomeip::runtime::get()->create_application("Subscriber in1");
in1_Subscriber->request_service(in1_service_id, in1_instance_id); if (!in1_Subscriber->init()) {
in1_Subscriber->register_message_handler(in1_service_id, in1_instance_id, in1_method_id, std::bind(&SomeIPAdapter_tests_a_compA::on_message_in1, this, std::placeholders::_1)); std::cerr << "Couldn't initialize Subscriber in1" << std::endl;
}
// Subscribe
std::set<vsomeip::eventgroup_t> in1_event_group; in1_Subscriber->register_availability_handler(11, 12, std::bind(&SomeIPAdapter_tests_a_compA::on_availability_in1, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
in1_event_group.insert(in1_eventgroup_id); in1_Subscriber->request_service(11, 12);
in1_Subscriber->request_event(in1_service_id, in1_instance_id, in1_event_id, in1_event_group, true); in1_Subscriber->register_message_handler(11, 12, 0, std::bind(&SomeIPAdapter_tests_a_compA::on_message_in1, this, std::placeholders::_1));
in1_Subscriber->subscribe(in1_service_id, in1_instance_id, in1_eventgroup_id);
in1_Subscriber->start(); std::thread sender_in1(std::bind(&SomeIPAdapter_tests_a_compA::run_in1, this));
in1_Subscriber->start();
in2_Subscriber = vsomeip::runtime::get()->create_application("Subscriber in2");
// Intitialize subscriber for in2 if (!in2_Subscriber->init()) {
in2_Subscriber = vsomeip::runtime::get()->create_application("Subscriber"); std::cerr << "Couldn't initialize Subscriber in2" << std::endl;
in2_Subscriber->init(); }
in2_Subscriber->request_service(in2_service_id, in2_instance_id);
in2_Subscriber->register_message_handler(in2_service_id, in2_instance_id, in2_method_id, std::bind(&SomeIPAdapter_tests_a_compA::on_message_in2, this, std::placeholders::_1)); in2_Subscriber->register_availability_handler(21, 22, std::bind(&SomeIPAdapter_tests_a_compA::on_availability_in2, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
in2_Subscriber->request_service(21, 22);
// Subscribe in2_Subscriber->register_message_handler(21, 22, 0, std::bind(&SomeIPAdapter_tests_a_compA::on_message_in2, this, std::placeholders::_1));
std::set<vsomeip::eventgroup_t> in2_event_group;
in2_event_group.insert(in2_eventgroup_id); std::thread sender_in2(std::bind(&SomeIPAdapter_tests_a_compA::run_in2, this));
in2_Subscriber->request_event(in2_service_id, in2_instance_id, in2_event_id, in2_event_group, true); in2_Subscriber->start();
in2_Subscriber->subscribe(in2_service_id, in2_instance_id, in2_eventgroup_id);
in2_Subscriber->start();
// Intitialize Publisher
out1_Publisher = vsomeip::runtime::get()->create_application("Publisher out1");
// Intitialize Publisher for out1 if (!out1_Publisher->init()) {
out1_Publisher = vsomeip::runtime::get()->create_application("Publisher"); std::cerr << "Couldn't initialize Publisher out1" << std::endl;
out1_Publisher->init(); }
out1_Publisher->offer_service(out1_service_id, out1_instance_id); out1_Publisher->offer_service(111, 112);
out1_Publisher->start(); out1_Publisher->start();
out2_Publisher = vsomeip::runtime::get()->create_application("Publisher out2");
// Intitialize Publisher for out2 if (!out2_Publisher->init()) {
out2_Publisher = vsomeip::runtime::get()->create_application("Publisher"); std::cerr << "Couldn't initialize Publisher out2" << std::endl;
out2_Publisher->init(); }
out2_Publisher->offer_service(out2_service_id, out2_instance_id); out2_Publisher->offer_service(121, 122);
out2_Publisher->start(); out2_Publisher->start();
}
void SomeIPAdapter_tests_a_compA::run_in1() {
std::unique_lock<std::mutex> its_lock(mutex_in1);
condition_in1.wait(its_lock);
std::set<vsomeip::eventgroup_t> event_group;
event_group.insert(13);
in1_Subscriber->request_event(11, 12, 0, event_group, true);
in1_Subscriber->subscribe(11, 12, 13);
} }
void SomeIPAdapter_tests_a_compA::on_message_in1(const std::shared_ptr<vsomeip::message> &_request) { void SomeIPAdapter_tests_a_compA::on_message_in1(const std::shared_ptr<vsomeip::message> &_message) {
//read received message