Commit d20b02e1 authored by Alexander David Hellwig's avatar Alexander David Hellwig

Merge branch '16-add-basic-adapter-generation' into 'master'

Resolve "Add basic Adapter Generation"

See merge request !2
parents 508982a2 998c4a13
Pipeline #160489 passed with stages
in 1 minute and 33 seconds
stages: stages:
- linux - project
- adapter
BranchJobLinux: BranchJobProject:
stage: linux stage: project
image: registry.git.rwth-aachen.de/monticore/embeddedmontiarc/generators/emam2someip image: registry.git.rwth-aachen.de/monticore/embeddedmontiarc/generators/emam2someip
script: script:
- mvn clean install -s settings.xml - mvn clean install -s settings.xml
except: except:
- master - master
BranchJobAdapter:
stage: adapter
image: registry.git.rwth-aachen.de/monticore/embeddedmontiarc/generators/emam2someip
script:
- cd someip_adapter
- cmake .
- make
except:
- master
# Use an official Python runtime as a parent image # Use an official Python runtime as a parent image
FROM ubuntu:16.04 FROM ubuntu:16.04
RUN apt-get update
RUN apt-get -y install build-essential
RUN apt-get -y install cmake
RUN apt-get -y install libboost-system1.58-dev libboost-thread1.58-dev libboost-log1.58-dev
RUN apt-get update \ RUN apt-get update \
&& apt-get -y install openjdk-8-jdk \ && apt-get -y install openjdk-8-jdk \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
...@@ -17,25 +9,20 @@ ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64 ...@@ -17,25 +9,20 @@ ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
ENV PATH $JAVA_HOME/bin:$PATH ENV PATH $JAVA_HOME/bin:$PATH
RUN apt-get update RUN apt-get update && apt-get -y install \
build-essential \
RUN apt-get -y install maven cmake \
libboost-system1.58-dev libboost-thread1.58-dev libboost-log1.58-dev \
RUN apt-get -y install git maven \
git
RUN mkdir /usr/src/emam2someip
WORKDIR /usr/src/emam2someip WORKDIR /usr/src/emam2someip
#clone and build vsomeip
RUN git clone https://github.com/GENIVI/vsomeip.git RUN git clone https://github.com/GENIVI/vsomeip.git
#copy example
COPY . /usr/src/emam2someip
WORKDIR /usr/src/emam2someip/vsomeip WORKDIR /usr/src/emam2someip/vsomeip
RUN mkdir /usr/src/emam2someip/vsomeip/build
WORKDIR /usr/src/emam2someip/vsomeip/build WORKDIR /usr/src/emam2someip/vsomeip/build
RUN cmake .. RUN cmake ..
...@@ -48,10 +35,14 @@ WORKDIR /usr/src/emam2someip/vsomeip ...@@ -48,10 +35,14 @@ WORKDIR /usr/src/emam2someip/vsomeip
RUN rm -rf build RUN rm -rf build
#copy example and adapter
COPY . /usr/src/emam2someip
#build example
WORKDIR /usr/src/emam2someip/example/build WORKDIR /usr/src/emam2someip/example/build
RUN cmake .. RUN cmake ..
RUN make RUN make
WORKDIR /usr/src/emam2someip/
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#define SAMPLE_SERVICE_ID 0x1234 #define SAMPLE_SERVICE_ID 0x1234
#define SAMPLE_INSTANCE_ID 0x5678 #define SAMPLE_INSTANCE_ID 0x5678
#define SAMPLE_METHOD_ID 0x0421 #define SAMPLE_METHOD_ID 0x0421
#define SAMPLE_EVENT_ID 0x2345
#define SAMPLE_EVENTGROUP_ID 0x1456
std::shared_ptr< vsomeip::application > app; std::shared_ptr< vsomeip::application > app;
std::mutex mutex; std::mutex mutex;
...@@ -19,39 +21,24 @@ void run() { ...@@ -19,39 +21,24 @@ void run() {
std::unique_lock<std::mutex> its_lock(mutex); std::unique_lock<std::mutex> its_lock(mutex);
condition.wait(its_lock); condition.wait(its_lock);
std::shared_ptr< vsomeip::message > request; std::set<vsomeip::eventgroup_t> its_groups;
request = vsomeip::runtime::get()->create_request(); its_groups.insert(SAMPLE_EVENTGROUP_ID);
request->set_service(SAMPLE_SERVICE_ID); app->request_event(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENT_ID, its_groups, true);
request->set_instance(SAMPLE_INSTANCE_ID); app->subscribe(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENTGROUP_ID);
request->set_method(SAMPLE_METHOD_ID);
double d = 2.5;
uint8_t *byteArray = (uint8_t*)&d;
vsomeip::byte_t *p;
p = byteArray;
std::shared_ptr< vsomeip::payload > its_payload = vsomeip::runtime::get()->create_payload(p,8);
request->set_payload(its_payload);
app->send(request, true);
} }
void on_message(const std::shared_ptr<vsomeip::message> &_response) { void on_message(const std::shared_ptr<vsomeip::message> &_request) {
std::shared_ptr<vsomeip::payload> its_payload = _response->get_payload(); std::shared_ptr<vsomeip::payload> its_payload = _request->get_payload();
vsomeip::length_t l = its_payload->get_length(); vsomeip::length_t l = its_payload->get_length();
double final = *((double*)its_payload->get_data());
// Get payload std::cout << "SERVICE: Received message from ["
std::stringstream ss; << std::setw(4) << std::setfill('0') << std::hex << _request->get_client() << "/"
for (vsomeip::length_t i=0; i<l; i++) { << std::setw(4) << std::setfill('0') << std::hex << _request->get_session() << "]: "
ss << std::setw(2) << std::setfill('0') << std::hex << final << std::endl;
<< (int)*(its_payload->get_data()+i) << " ";
}
std::cout << "CLIENT: Received message with Client/Session ["
<< std::setw(4) << std::setfill('0') << std::hex << _response->get_client() << "/"
<< std::setw(4) << std::setfill('0') << std::hex << _response->get_session() << "] "
<< ss.str() << std::endl;
} }
void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) {
...@@ -65,11 +52,14 @@ void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, ...@@ -65,11 +52,14 @@ void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance,
int main() { int main() {
app = vsomeip::runtime::get()->create_application("Subscriber");
app = vsomeip::runtime::get()->create_application("Hello");
app->init(); app->init();
app->register_availability_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, on_availability); app->register_availability_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, on_availability);
app->request_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID); app->request_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID);
app->register_message_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_METHOD_ID, on_message);
app->register_message_handler(vsomeip::ANY_SERVICE, vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD, on_message);
std::thread sender(run); std::thread sender(run);
app->start(); app->start();
} }
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#define SAMPLE_SERVICE_ID 0x1234 #define SAMPLE_SERVICE_ID 0x1234
#define SAMPLE_INSTANCE_ID 0x5678 #define SAMPLE_INSTANCE_ID 0x5678
#define SAMPLE_METHOD_ID 0x0421 #define SAMPLE_METHOD_ID 0x0421
#define SAMPLE_EVENT_ID 0x2345
#define SAMPLE_EVENTGROUP_ID 0x1456
std::shared_ptr<vsomeip::application> app; std::shared_ptr<vsomeip::application> app;
...@@ -17,7 +19,7 @@ void on_message(const std::shared_ptr<vsomeip::message> &_request) { ...@@ -17,7 +19,7 @@ void on_message(const std::shared_ptr<vsomeip::message> &_request) {
double final = *((double*)its_payload->get_data()); double final = *((double*)its_payload->get_data());
std::cout << "SERVICE: Received message with Client/Session [" std::cout << "SERVICE: Received message from ["
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_client() << "/" << std::setw(4) << std::setfill('0') << std::hex << _request->get_client() << "/"
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_session() << "]: " << std::setw(4) << std::setfill('0') << std::hex << _request->get_session() << "]: "
<< final << std::endl; << final << std::endl;
...@@ -28,6 +30,21 @@ int main() { ...@@ -28,6 +30,21 @@ int main() {
app = vsomeip::runtime::get()->create_application("Publisher"); app = vsomeip::runtime::get()->create_application("Publisher");
app->init(); app->init();
app->register_message_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_METHOD_ID, on_message); app->register_message_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_METHOD_ID, on_message);
double d = 2.5;
uint8_t *byteArray = (uint8_t*)&d;
vsomeip::byte_t *p;
p = byteArray;
std::shared_ptr< vsomeip::payload > its_payload = vsomeip::runtime::get()->create_payload(p,8);
std::set<vsomeip::eventgroup_t> its_groups;
its_groups.insert(SAMPLE_EVENTGROUP_ID);
app->offer_event(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENT_ID, its_groups, true);
app->notify(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENT_ID, its_payload);
app->offer_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID); app->offer_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID);
app->start(); app->start();
} }
# Setting cmake version
cmake_minimum_required (VERSION 2.8)
# Using C++ version 11 with threads for compiling
set (CMAKE_CXX_FLAGS "-g -std=c++0x")
# Find packages and include directories
find_package (vsomeip 2.10.0 REQUIRED)
find_package( Boost 1.55 COMPONENTS system thread log REQUIRED )
include_directories (
${Boost_INCLUDE_DIR}
${VSOMEIP_INCLUDE_DIRS}
)
# Linking libraries to target
add_library(SomeipAdapter_tests_a_compA SomeipAdapter_tests_a_compA.cpp)
target_link_libraries(SomeipAdapter_tests_a_compA vsomeip ${Boost_LIBRARIES})
# Export target to a cmake module file for outside usage
export(TARGETS SomeipAdapter_tests_a_compA FILE SomeipAdapter_tests_a_compA.cmake)
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#define SAMPLE_EVENT_ID 0x2345 #define SAMPLE_EVENT_ID 0x2345
#define SAMPLE_EVENTGROUP_ID 0x1456 #define SAMPLE_EVENTGROUP_ID 0x1456
tests_a_compA* component;
std::shared_ptr<vsomeip::application> _clockSubscriber; std::shared_ptr<vsomeip::application> _clockSubscriber;
std::shared_ptr<vsomeip::application> _echoPublisher; std::shared_ptr<vsomeip::application> _echoPublisher;
...@@ -14,14 +16,15 @@ SomeipAdapter_tests_a_compA::SomeipAdapter_tests_a_compA() {} ...@@ -14,14 +16,15 @@ SomeipAdapter_tests_a_compA::SomeipAdapter_tests_a_compA() {}
void SomeipAdapter_tests_a_compA::init(tests_a_compA *comp) void SomeipAdapter_tests_a_compA::init(tests_a_compA *comp)
{ {
this->component = comp;
_clockSubscriber = vsomeip::runtime::get()->create_application("Subscriber"); _clockSubscriber = vsomeip::runtime::get()->create_application("Subscriber");
_clockSubscriber->init(); _clockSubscriber->init();
_clockSubscriber->register_availability_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, on_availability); //_clockSubscriber->register_availability_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, on_availability);
_clockSubscriber->request_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID); _clockSubscriber->request_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID);
_clockSubscriber->register_message_handler(vsomeip::ANY_SERVICE, vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD, on_message); _clockSubscriber->register_message_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_METHOD_ID, std::bind(&SomeipAdapter_tests_a_compA::on_message, this, std::placeholders::_1));
//_clockSubscriber->register_message_handler(vsomeip::ANY_SERVICE, vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD, std::bind(&SomeipAdapter_tests_a_compA::on_message, this, std::placeholders::_1));
std::unique_lock<std::mutex> its_lock(mutex);
std::set<vsomeip::eventgroup_t> its_groups; std::set<vsomeip::eventgroup_t> its_groups;
its_groups.insert(SAMPLE_EVENTGROUP_ID); its_groups.insert(SAMPLE_EVENTGROUP_ID);
...@@ -29,6 +32,13 @@ void SomeipAdapter_tests_a_compA::init(tests_a_compA *comp) ...@@ -29,6 +32,13 @@ void SomeipAdapter_tests_a_compA::init(tests_a_compA *comp)
_clockSubscriber->subscribe(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENTGROUP_ID); _clockSubscriber->subscribe(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENTGROUP_ID);
_clockSubscriber->start(); _clockSubscriber->start();
_echoPublisher = vsomeip::runtime::get()->create_application("Publisher");
_echoPublisher->init();
//_echoPublisher->register_message_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_METHOD_ID, on_message);
_echoPublisher->offer_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID);
_echoPublisher->start();
} }
void SomeipAdapter_tests_a_compA::on_message(const std::shared_ptr<vsomeip::message> &_request) { void SomeipAdapter_tests_a_compA::on_message(const std::shared_ptr<vsomeip::message> &_request) {
...@@ -36,46 +46,38 @@ void SomeipAdapter_tests_a_compA::on_message(const std::shared_ptr<vsomeip::mess ...@@ -36,46 +46,38 @@ void SomeipAdapter_tests_a_compA::on_message(const std::shared_ptr<vsomeip::mess
std::shared_ptr<vsomeip::payload> its_payload = _request->get_payload(); std::shared_ptr<vsomeip::payload> its_payload = _request->get_payload();
vsomeip::length_t l = its_payload->get_length(); vsomeip::length_t l = its_payload->get_length();
double final = *((double*)its_payload->get_data()); double dataFromMessage = *((double*)its_payload->get_data());
component->rosIn = dataFromMessage;
std::cout << "SERVICE: Received message with Client/Session [" std::cout << "SERVICE: Received message from ["
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_client() << "/" << std::setw(4) << std::setfill('0') << std::hex << _request->get_client() << "/"
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_session() << "]: " << std::setw(4) << std::setfill('0') << std::hex << _request->get_session() << "]: "
<< final << std::endl; << dataFromMessage << std::endl;
}
void SomeipAdapter_tests_a_compA::on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) {
std::cout << "CLIENT: Service ["
<< std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
<< "] is "
<< (_is_available ? "available." : "NOT available.")
<< std::endl;
} }
void SomeipAdapter_tests_a_compA::publish_echoPublisher() void SomeipAdapter_tests_a_compA::publish_echoPublisher()
{ {
_echoPublisher = vsomeip::runtime::get()->create_application("Publisher"); double d = component->rosOut;
_echoPublisher->init(); uint8_t *byteArray = (uint8_t*)&d;
//app->register_message_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_METHOD_ID, on_message);
vsomeip::byte_t *p;
p = byteArray;
std::shared_ptr< vsomeip::payload > payload = vsomeip::runtime::get()->create_payload(p,8);
double d = 2.5; //const vsomeip::byte_t its_data[] = component->rosOut; //component->rosOut
uint8_t *byteArray = (uint8_t*)&d; //std::shared_ptr< vsomeip::payload > payload = vsomeip::runtime::get()->create_payload();
//payload->set_data(its_data, sizeof(its_data));
vsomeip::byte_t *p;
p = byteArray;
std::shared_ptr< vsomeip::payload > its_payload = vsomeip::runtime::get()->create_payload(p,8);
std::set<vsomeip::eventgroup_t> its_groups; std::set<vsomeip::eventgroup_t> its_groups;
its_groups.insert(SAMPLE_EVENTGROUP_ID); its_groups.insert(SAMPLE_EVENTGROUP_ID);
_echoPublisher->offer_event(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENT_ID, its_groups, true); _echoPublisher->offer_event(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENT_ID, its_groups, true);
_echoPublisher->notify(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENT_ID, its_payload); _echoPublisher->notify(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENT_ID, payload);
_echoPublisher->offer_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID);
_echoPublisher->start();
} }
void SomeipAdapter_tests_a_compA::tick() void SomeipAdapter_tests_a_compA::tick()
{ {
publish_echoPublisher(); publish_echoPublisher();
} }
...@@ -23,9 +23,7 @@ public: ...@@ -23,9 +23,7 @@ public:
void tick(); void tick();
static void on_message(const std::shared_ptr<vsomeip::message> &_response); void on_message(const std::shared_ptr<vsomeip::message> &_response);
static void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available);
private: private:
......
#ifndef tests_a_compA_h
#define tests_a_compA_h
#include <iostream>
using namespace std;
class tests_a_compA {
public:
double rosIn = 2.5;
double rosOut = 3.14;
};
#endif /* tests_a_compA_h */
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<name>emam2someip</name> <name>emam2someip</name>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.source>1.7</maven.compiler.source>
...@@ -46,6 +46,13 @@ ...@@ -46,6 +46,13 @@
<dependencies> <dependencies>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc</artifactId>
<!-- or newer version -->
<version>0.1.11-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>de.se_rwth.commons</groupId> <groupId>de.se_rwth.commons</groupId>
<artifactId>se-commons-logging</artifactId> <artifactId>se-commons-logging</artifactId>
...@@ -117,7 +124,7 @@ ...@@ -117,7 +124,7 @@
<target>${java.version}</target> <target>${java.version}</target>
</configuration> </configuration>
</plugin> </plugin>
<!-- Test coverage --> <!-- Test coverage -->
<plugin> <plugin>
<groupId>org.jacoco</groupId> <groupId>org.jacoco</groupId>
...@@ -203,5 +210,5 @@ ...@@ -203,5 +210,5 @@
<url>https://nexus.se.rwth-aachen.de/content/repositories/embeddedmontiarc-snapshots/</url> <url>https://nexus.se.rwth-aachen.de/content/repositories/embeddedmontiarc-snapshots/</url>
</snapshotRepository> </snapshotRepository>
</distributionManagement> </distributionManagement>
</project> </project>
# Setting cmake version # Setting cmake version
cmake_minimum_required (VERSION 3.12) cmake_minimum_required (VERSION 2.8)
# Using C++ version 11 with threads for compiling # Using C++ with flags
set (CMAKE_CXX_FLAGS "-g -std=c++0x") set (CMAKE_CXX_FLAGS "-g -std=c++0x")
# Setting project name and description # Find vsomeip and boost packages
project(SomeipAdapter VERSION 1.0
DESCRIPTION "Someip adapter"
LANGUAGES CXX)
# Find packages and include directories
find_package (vsomeip 2.10.0 REQUIRED) find_package (vsomeip 2.10.0 REQUIRED)
find_package( Boost 1.55 COMPONENTS system thread log REQUIRED ) find_package( Boost 1.55 COMPONENTS system thread log REQUIRED )
#include vsomeip and boost directories
include_directories ( include_directories (
${Boost_INCLUDE_DIR} ${Boost_INCLUDE_DIR}
${VSOMEIP_INCLUDE_DIRS} ${VSOMEIP_INCLUDE_DIRS}
) )
# Linking libraries to target # Linking libraries to target
add_library(SomeipAdapter_tests_a_compA SomeipAdapter_tests_a_compA.cpp) add_library(SomeIPAdapter_tests_a_compA SomeIPAdapter_tests_a_compA.cpp)
target_link_libraries(SomeipAdapter_tests_a_compA vsomeip ${Boost_LIBRARIES}) target_link_libraries(SomeIPAdapter_tests_a_compA vsomeip ${Boost_LIBRARIES})
# Export target to a cmake module file for outside usage # Export target to a cmake module file for outside usage
export(TARGETS SomeipAdapter_tests_a_compA FILE SomeipAdapter_tests_a_compA.cmake) export(TARGETS SomeIPAdapter_tests_a_compA FILE SomeIPAdapter_tests_a_compA.cmake)
#include "SomeIPAdapter_tests_a_compA.h"
SomeIPAdapter_tests_a_compA::SomeIPAdapter_tests_a_compA() {
//choose random ids
service_id = 1;
instance_id = 2;
method_id = 3;
event_id = 4;
eventgroup_id = 5;
}
SomeIPAdapter_tests_a_compA::SomeIPAdapter_tests_a_compA(int service_id, int instance_id, int method_id, int event_id, int eventgroup_id) {
this->service_id = service_id;
this->instance_id = instance_id;
this->method_id = method_id;
this->event_id = event_id;
this->eventgroup_id = eventgroup_id;
}
void SomeIPAdapter_tests_a_compA::init(tests_a_compA *comp) {
// Initialize component
this->component = comp;
// Intitialize subscriber
_clockSubscriber = vsomeip::runtime::get()->create_application("Subscriber");
_clockSubscriber->init();
_clockSubscriber->request_service(service_id, instance_id);
_clockSubscriber->register_message_handler(service_id, instance_id, method_id, std::bind(&SomeIPAdapter_tests_a_compA::on_message, this, std::placeholders::_1));
// Subscribe
std::set<vsomeip::eventgroup_t> event_group;
event_group.insert(eventgroup_id);
_clockSubscriber->request_event(service_id, instance_id, event_id, event_group, true);
_clockSubscriber->subscribe(service_id, instance_id, eventgroup_id);
_clockSubscriber->start();
// Intitialize Publisher
_echoPublisher = vsomeip::runtime::get()->create_application("Publisher");
_echoPublisher->init();
_echoPublisher->offer_service(service_id, instance_id);
_echoPublisher->start();
}
void SomeIPAdapter_tests_a_compA::on_message(const std::shared_ptr<vsomeip::message> &_request) {
//read received message
std::shared_ptr<vsomeip::payload> its_payload = _request->get_payload();
vsomeip::length_t l = its_payload->get_length();
double dataFromMessage = *((double*)its_payload->get_data());
component->someIPIn = dataFromMessage;
//print data to std out
std::cout << "SERVICE: Received message from ["
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_client() << "/"
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_session() << "]: "
<< dataFromMessage << std::endl;
}
void SomeIPAdapter_tests_a_compA::publish_echoPublisher()