summaryrefslogtreecommitdiff
path: root/CommonAPI-Examples/E06Unions
diff options
context:
space:
mode:
Diffstat (limited to 'CommonAPI-Examples/E06Unions')
-rw-r--r--CommonAPI-Examples/E06Unions/CMakeLists.txt40
-rw-r--r--CommonAPI-Examples/E06Unions/README20
-rw-r--r--CommonAPI-Examples/E06Unions/fidl/E06Unions.fdepl84
-rw-r--r--CommonAPI-Examples/E06Unions/fidl/E06Unions.fidl44
-rw-r--r--CommonAPI-Examples/E06Unions/src/E06UnionsClient.cpp156
-rw-r--r--CommonAPI-Examples/E06Unions/src/E06UnionsService.cpp40
-rw-r--r--CommonAPI-Examples/E06Unions/src/E06UnionsStubImpl.cpp8
-rw-r--r--CommonAPI-Examples/E06Unions/src/typeUtils.hpp4
-rw-r--r--CommonAPI-Examples/E06Unions/vsomeip-client.json48
-rw-r--r--CommonAPI-Examples/E06Unions/vsomeip-local.json152
-rw-r--r--CommonAPI-Examples/E06Unions/vsomeip-service.json144
11 files changed, 374 insertions, 366 deletions
diff --git a/CommonAPI-Examples/E06Unions/CMakeLists.txt b/CommonAPI-Examples/E06Unions/CMakeLists.txt
index 6f3f207..193f805 100644
--- a/CommonAPI-Examples/E06Unions/CMakeLists.txt
+++ b/CommonAPI-Examples/E06Unions/CMakeLists.txt
@@ -31,11 +31,11 @@ OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version
message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}")
if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
- FIND_PACKAGE(CommonAPI 3.1.3 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
- FIND_PACKAGE(CommonAPI-DBus 3.1.3 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+ FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+ FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
else()
- FIND_PACKAGE(CommonAPI 3.1.3 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
- FIND_PACKAGE(CommonAPI-DBus 3.1.3 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+ FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+ FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
endif()
message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
@@ -48,23 +48,23 @@ include(FindPkgConfig)
###############################################################################
# find DBus by using the 'pkg-config' tool
if (MSVC)
- #Not beautiful, but it works
- if (DBus_DIR)
- if (DBus_BUILD_DIR)
- set(DBus_INCLUDE_DIRS "${DBus_DIR};${DBus_BUILD_DIR};")
- else ()
- message (FATAL_ERROR "DBus_BUILD_DIR not set! Cannot continue.")
- endif ()
- else()
- message (FATAL_ERROR "DBus_DIR not set! Cannot continue.")
- endif ()
+ #Not beautiful, but it works
+ if (DBus_DIR)
+ if (DBus_BUILD_DIR)
+ set(DBus_INCLUDE_DIRS "${DBus_DIR};${DBus_BUILD_DIR};")
+ else ()
+ message (FATAL_ERROR "DBus_BUILD_DIR not set! Cannot continue.")
+ endif ()
+ else()
+ message (FATAL_ERROR "DBus_DIR not set! Cannot continue.")
+ endif ()
else()
- pkg_check_modules(DBus REQUIRED dbus-1>=1.4)
+ pkg_check_modules(DBus REQUIRED dbus-1>=1.4)
endif()
# SOME/IP
-find_package (CommonAPI-SomeIP 3.1.3 REQUIRED)
-find_package (vsomeip 1.3.0 REQUIRED)
+find_package (CommonAPI-SomeIP 3.1.4 REQUIRED)
+find_package (vsomeip 2.0.0 REQUIRED)
# Source Files
set(PRJ_SRC_PATH src)
@@ -100,7 +100,7 @@ message(STATUS "USE_INSTALLED_DBUS is set to value: ${USE_INSTALLED_DBUS}")
include_directories(
src-gen/core
- src-gen/dbus
+ src-gen/dbus
src-gen/someip
${COMMONAPI_INCLUDE_DIRS}
${COMMONAPI_DBUS_INCLUDE_DIRS}
@@ -114,7 +114,7 @@ link_directories(
${COMMONAPI_LIBDIR}
${COMMONAPI_DBUS_LIBDIR}
${COMMONAPI_SOMEIP_CMAKE_DIR}/build
- ${Boost_LIBRARY_DIR}
+ ${Boost_LIBRARY_DIR}
)
else()
link_directories(
@@ -122,7 +122,7 @@ link_directories(
${COMMONAPI_DBUS_LIBDIR}
${COMMONAPI_SOMEIP_CMAKE_DIR}/build
${DBus_INCLUDE_DIRS}/dbus/.libs
- ${Boost_LIBRARY_DIR}
+ ${Boost_LIBRARY_DIR}
)
endif()
diff --git a/CommonAPI-Examples/E06Unions/README b/CommonAPI-Examples/E06Unions/README
index c4f1884..5ea025c 100644
--- a/CommonAPI-Examples/E06Unions/README
+++ b/CommonAPI-Examples/E06Unions/README
@@ -141,15 +141,23 @@ int main() {
const std::string &domain = "local";
const std::string &instance = "commonapi.examples.Unions";
- std::shared_ptr<E06UnionsProxyDefault> myProxy =
- runtime->buildProxy<E06UnionsProxy>(domain, instance);
+ std::string connection = "client-sample";
- while (!myProxy->isAvailable()) { usleep(10); }
+ std::shared_ptr<E06UnionsProxy<>> myProxy = runtime->buildProxy<E06UnionsProxy>(domain, instance, connection);
- std::function<void (CommonTypes::SettingsUnion)> f = recv_msg;
- myProxy->getUAttribute().getChangedEvent().subscribe(f);
+ while (!myProxy->isAvailable()) {
+ usleep(10);
+ }
+
+ std::function<void (CommonTypes::SettingsUnion)> f = recv_msg;
+ myProxy->getUAttribute().getChangedEvent().subscribe(f);
- while (true) { usleep(10); }
+ std::function<void (std::shared_ptr<CommonTypes::SettingsStruct>)> f1 = recv_msg1;
+ myProxy->getXAttribute().getChangedEvent().subscribe(f1);
+
+ while (true) {
+ usleep(10);
+ }
return 0;
}
diff --git a/CommonAPI-Examples/E06Unions/fidl/E06Unions.fdepl b/CommonAPI-Examples/E06Unions/fidl/E06Unions.fdepl
index 67f27ed..f434ee7 100644
--- a/CommonAPI-Examples/E06Unions/fidl/E06Unions.fdepl
+++ b/CommonAPI-Examples/E06Unions/fidl/E06Unions.fdepl
@@ -7,67 +7,67 @@ import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP
import "E06Unions.fidl"
define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E06Unions {
- SomeIpServiceID = 4660
- SomeIpEventGroups = { 7000, 7001 }
+ SomeIpServiceID = 4660
+ SomeIpEventGroups = { 7000, 7001 }
- attribute u {
- SomeIpGetterID = 3000
- SomeIpSetterID = 3001
- SomeIpNotifierID = 33010
- SomeIpEventGroups = { 33010 }
- }
-
- attribute x {
- SomeIpGetterID = 3002
- SomeIpSetterID = 3003
- SomeIpNotifierID = 33011
- SomeIpEventGroups = { 33011 }
- }
+ attribute u {
+ SomeIpGetterID = 3000
+ SomeIpSetterID = 3001
+ SomeIpNotifierID = 33010
+ SomeIpEventGroups = { 33010 }
+ }
+
+ attribute x {
+ SomeIpGetterID = 3002
+ SomeIpSetterID = 3003
+ SomeIpNotifierID = 33011
+ SomeIpEventGroups = { 33011 }
+ }
}
define org.genivi.commonapi.someip.deployment for typeCollection commonapi.examples.CommonTypes {
-
- union SettingsUnion {
- id {
- }
- status {
- }
- channel {
- }
- name {
- }
- }
-
- struct SettingsStructMyTypedef {
- id {
- }
+
+ union SettingsUnion {
+ id {
+ }
+ status {
+ }
+ channel {
+ }
+ name {
+ }
+ }
+
+ struct SettingsStructMyTypedef {
+ id {
+ }
}
struct SettingsStructMyEnum {
- status {
- }
+ status {
+ }
}
struct SettingsStructUInt8 {
- channel {
- }
+ channel {
+ }
}
struct SettingsStructString {
- name {
- }
+ name {
+ }
}
}
define org.genivi.commonapi.someip.deployment for provider Service {
- instance commonapi.examples.E06Unions {
- InstanceId = "commonapi.examples.Unions"
+ instance commonapi.examples.E06Unions {
+ InstanceId = "commonapi.examples.Unions"
- SomeIpInstanceID = 22136
-
- SomeIpUnicastAddress = "192.168.0.2"
- SomeIpReliableUnicastPort = 30490
+ SomeIpInstanceID = 22136
+
+ SomeIpUnicastAddress = "192.168.0.2"
+ SomeIpReliableUnicastPort = 30490
SomeIpUnreliableUnicastPort = 30491
}
} \ No newline at end of file
diff --git a/CommonAPI-Examples/E06Unions/fidl/E06Unions.fidl b/CommonAPI-Examples/E06Unions/fidl/E06Unions.fidl
index 60dae9d..262d5eb 100644
--- a/CommonAPI-Examples/E06Unions/fidl/E06Unions.fidl
+++ b/CommonAPI-Examples/E06Unions/fidl/E06Unions.fidl
@@ -8,46 +8,46 @@
package commonapi.examples
interface E06Unions {
- version { major 0 minor 0 }
+ version { major 0 minor 0 }
- attribute CommonTypes.SettingsUnion u
- attribute CommonTypes.SettingsStruct x
+ attribute CommonTypes.SettingsUnion u
+ attribute CommonTypes.SettingsStruct x
}
typeCollection CommonTypes {
- version { major 0 minor 0 }
+ version { major 0 minor 0 }
- typedef MyTypedef is Int32
+ typedef MyTypedef is Int32
- enumeration MyEnum {
- DEFAULT
- ON
- OFF
- }
+ enumeration MyEnum {
+ DEFAULT
+ ON
+ OFF
+ }
- union SettingsUnion {
- MyTypedef id
- MyEnum status
- UInt8 channel
- String name
- }
-
- struct SettingsStruct polymorphic {
+ union SettingsUnion {
+ MyTypedef id
+ MyEnum status
+ UInt8 channel
+ String name
+ }
+
+ struct SettingsStruct polymorphic {
}
struct SettingsStructMyTypedef extends SettingsStruct {
- MyTypedef id
+ MyTypedef id
}
struct SettingsStructMyEnum extends SettingsStruct {
- MyEnum status
+ MyEnum status
}
struct SettingsStructUInt8 extends SettingsStruct {
- UInt8 channel
+ UInt8 channel
}
struct SettingsStructString extends SettingsStruct {
- String name
+ String name
}
} \ No newline at end of file
diff --git a/CommonAPI-Examples/E06Unions/src/E06UnionsClient.cpp b/CommonAPI-Examples/E06Unions/src/E06UnionsClient.cpp
index ea6618a..8998ac8 100644
--- a/CommonAPI-Examples/E06Unions/src/E06UnionsClient.cpp
+++ b/CommonAPI-Examples/E06Unions/src/E06UnionsClient.cpp
@@ -19,162 +19,162 @@ using namespace commonapi::examples;
struct MyVisitor {
- explicit inline MyVisitor() {
- }
+ explicit inline MyVisitor() {
+ }
- template<typename... T>
- inline void eval(const CommonAPI::Variant<T...>& v) {
- CommonAPI::ApplyVoidVisitor<MyVisitor, CommonAPI::Variant<T...>, T...>::visit(*this, v);
- }
+ template<typename... T>
+ inline void eval(const CommonAPI::Variant<T...>& v) {
+ CommonAPI::ApplyVoidVisitor<MyVisitor, CommonAPI::Variant<T...>, T...>::visit(*this, v);
+ }
- void operator()(CommonTypes::MyTypedef val) {
+ void operator()(CommonTypes::MyTypedef val) {
- std::cout << "Received (C) MyTypedef with value " << (int)val << std::endl;
- }
+ std::cout << "Received (C) MyTypedef with value " << (int)val << std::endl;
+ }
- void operator()(CommonTypes::MyEnum val) {
+ void operator()(CommonTypes::MyEnum val) {
- std::cout << "Received (C) MyEnum with value " << (int)val << std::endl;
- }
+ std::cout << "Received (C) MyEnum with value " << (int)val << std::endl;
+ }
- void operator()(uint8_t val) {
+ void operator()(uint8_t val) {
- std::cout << "Received (C) uint8_t with value " << (int)val << std::endl;
- }
+ std::cout << "Received (C) uint8_t with value " << (int)val << std::endl;
+ }
- void operator()(std::string val) {
+ void operator()(std::string val) {
- std::cout << "Received (C) string " << val << std::endl;
- }
+ std::cout << "Received (C) string " << val << std::endl;
+ }
- template<typename T>
- void operator()(const T&) {
+ template<typename T>
+ void operator()(const T&) {
- std::cout << "Received (C) change message with unknown type." << std::endl;
- }
+ std::cout << "Received (C) change message with unknown type." << std::endl;
+ }
- void operator()() {
+ void operator()() {
- std::cout << "NOOP." << std::endl;
- }
+ std::cout << "NOOP." << std::endl;
+ }
};
void evalA (const CommonTypes::SettingsUnion& v) {
- if ( v.isType<CommonTypes::MyTypedef>() ) {
+ if ( v.isType<CommonTypes::MyTypedef>() ) {
- std::cout << "Received (A) MyTypedef with value " << v.get<CommonTypes::MyTypedef>() << " at index " << (int)v.getValueType() << std::endl;
+ std::cout << "Received (A) MyTypedef with value " << v.get<CommonTypes::MyTypedef>() << " at index " << (int)v.getValueType() << std::endl;
- } else if ( v.isType<CommonTypes::MyEnum>() ) {
+ } else if ( v.isType<CommonTypes::MyEnum>() ) {
- std::cout << "Received (A) MyEnum with value " << (int) (v.get<CommonTypes::MyEnum>()) << " at index " << (int)v.getValueType() << std::endl;
+ std::cout << "Received (A) MyEnum with value " << (int) (v.get<CommonTypes::MyEnum>()) << " at index " << (int)v.getValueType() << std::endl;
- } else if ( v.isType<uint8_t>() ) {
+ } else if ( v.isType<uint8_t>() ) {
- std::cout << "Received (A) uint8_t with value " << (int) (v.get<uint8_t>()) << " at index " << (int)v.getValueType() << std::endl;
+ std::cout << "Received (A) uint8_t with value " << (int) (v.get<uint8_t>()) << " at index " << (int)v.getValueType() << std::endl;
- } else if ( v.isType<std::string>() ) {
+ } else if ( v.isType<std::string>() ) {
- std::cout << "Received (A) string " << v.get<std::string>() << " at index " << (int)v.getValueType() << std::endl;
+ std::cout << "Received (A) string " << v.get<std::string>() << " at index " << (int)v.getValueType() << std::endl;
- } else {
+ } else {
- std::cout << "Received (A) change message with unknown type." << std::endl;
- }
+ std::cout << "Received (A) change message with unknown type." << std::endl;
+ }
}
template <typename T1, typename... T>
void evalB (const CommonAPI::Variant<T1, T...>& v) {
- switch (v.getValueType()) {
+ switch (v.getValueType()) {
- case typeIdOf<CommonTypes::MyTypedef, T1, T...>::value:
+ case typeIdOf<CommonTypes::MyTypedef, T1, T...>::value:
- std::cout << "Received (B) MyTypedef with value " << (int)(v.template get<CommonTypes::MyTypedef>()) << " at index " << (int)v.getValueType() << std::endl;
- break;
+ std::cout << "Received (B) MyTypedef with value " << (int)(v.template get<CommonTypes::MyTypedef>()) << " at index " << (int)v.getValueType() << std::endl;
+ break;
- case typeIdOf<CommonTypes::MyEnum, T1, T...>::value:
+ case typeIdOf<CommonTypes::MyEnum, T1, T...>::value:
- std::cout << "Received (B) MyEnum with value " << (int)(v.template get<CommonTypes::MyEnum>()) << " at index " << (int)v.getValueType() << std::endl;
- break;
+ std::cout << "Received (B) MyEnum with value " << (int)(v.template get<CommonTypes::MyEnum>()) << " at index " << (int)v.getValueType() << std::endl;
+ break;
- case typeIdOf<uint8_t, T1, T...>::value:
+ case typeIdOf<uint8_t, T1, T...>::value:
- std::cout << "Received (B) uint8_t with value " << (int)(v.template get<uint8_t>()) << " at index " << (int)v.getValueType() << std::endl;
- break;
+ std::cout << "Received (B) uint8_t with value " << (int)(v.template get<uint8_t>()) << " at index " << (int)v.getValueType() << std::endl;
+ break;
- case typeIdOf<std::string, T1, T...>::value:
+ case typeIdOf<std::string, T1, T...>::value:
- std::cout << "Received (B) string " << v.template get<std::string>() << " at index " << (int)v.getValueType() << std::endl;
- break;
+ std::cout << "Received (B) string " << v.template get<std::string>() << " at index " << (int)v.getValueType() << std::endl;
+ break;
- default:
+ default:
- std::cout << "Received (B) change message with unknown type." << std::endl;
- break;
- }
+ std::cout << "Received (B) change message with unknown type." << std::endl;
+ break;
+ }
}
void evalC(const CommonTypes::SettingsUnion& v) {
- MyVisitor visitor;
- visitor.eval(v);
+ MyVisitor visitor;
+ visitor.eval(v);
}
void recv_msg(const CommonTypes::SettingsUnion& v) {
- evalA(v);
- evalB(v);
- evalC(v);
+ evalA(v);
+ evalB(v);
+ evalC(v);
}
void recv_msg1(std::shared_ptr<CommonTypes::SettingsStruct> x) {
- if ( std::shared_ptr<CommonTypes::SettingsStructMyTypedef> sp = std::dynamic_pointer_cast<CommonTypes::SettingsStructMyTypedef>(x) ) {
+ if ( std::shared_ptr<CommonTypes::SettingsStructMyTypedef> sp = std::dynamic_pointer_cast<CommonTypes::SettingsStructMyTypedef>(x) ) {
- std::cout << "Received (D) MyTypedef with value " << (int)sp->getId() << std::endl;
+ std::cout << "Received (D) MyTypedef with value " << (int)sp->getId() << std::endl;
- } else if ( std::shared_ptr<CommonTypes::SettingsStructMyEnum> sp = std::dynamic_pointer_cast<CommonTypes::SettingsStructMyEnum>(x) ) {
+ } else if ( std::shared_ptr<CommonTypes::SettingsStructMyEnum> sp = std::dynamic_pointer_cast<CommonTypes::SettingsStructMyEnum>(x) ) {
- std::cout << "Received (D) MyEnum with value " << (int)sp->getStatus() << std::endl;
+ std::cout << "Received (D) MyEnum with value " << (int)sp->getStatus() << std::endl;
- } else if ( std::shared_ptr<CommonTypes::SettingsStructUInt8> sp = std::dynamic_pointer_cast<CommonTypes::SettingsStructUInt8>(x) ) {
+ } else if ( std::shared_ptr<CommonTypes::SettingsStructUInt8> sp = std::dynamic_pointer_cast<CommonTypes::SettingsStructUInt8>(x) ) {
- std::cout << "Received (D) uint8_t with value " << (int)sp->getChannel() << std::endl;
+ std::cout << "Received (D) uint8_t with value " << (int)sp->getChannel() << std::endl;
- } else if ( std::shared_ptr<CommonTypes::SettingsStructString> sp = std::dynamic_pointer_cast<CommonTypes::SettingsStructString>(x) ) {
+ } else if ( std::shared_ptr<CommonTypes::SettingsStructString> sp = std::dynamic_pointer_cast<CommonTypes::SettingsStructString>(x) ) {
- std::cout << "Received (D) string " << sp->getName() << std::endl;
+ std::cout << "Received (D) string " << sp->getName() << std::endl;
- } else {
+ } else {
- std::cout << "Received (D) change message with unknown type." << std::endl;
- }
+ std::cout << "Received (D) change message with unknown type." << std::endl;
+ }
}
int main() {
- CommonAPI::Runtime::setProperty("LogContext", "E06C");
- CommonAPI::Runtime::setProperty("LibraryBase", "E06Unions");
+ CommonAPI::Runtime::setProperty("LogContext", "E06C");
+ CommonAPI::Runtime::setProperty("LibraryBase", "E06Unions");
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
const std::string &domain = "local";
- const std::string &instance = "commonapi.examples.Unions";
- std::string connection = "client-sample";
+ const std::string &instance = "commonapi.examples.Unions";
+ std::string connection = "client-sample";
- std::shared_ptr<E06UnionsProxy<>> myProxy = runtime->buildProxy<E06UnionsProxy>(domain, instance, connection);
+ std::shared_ptr<E06UnionsProxy<>> myProxy = runtime->buildProxy<E06UnionsProxy>(domain, instance, connection);
while (!myProxy->isAvailable()) {
usleep(10);
}
- std::function<void (CommonTypes::SettingsUnion)> f = recv_msg;
- myProxy->getUAttribute().getChangedEvent().subscribe(f);
+ std::function<void (CommonTypes::SettingsUnion)> f = recv_msg;
+ myProxy->getUAttribute().getChangedEvent().subscribe(f);
- std::function<void (std::shared_ptr<CommonTypes::SettingsStruct>)> f1 = recv_msg1;
- myProxy->getXAttribute().getChangedEvent().subscribe(f1);
+ std::function<void (std::shared_ptr<CommonTypes::SettingsStruct>)> f1 = recv_msg1;
+ myProxy->getXAttribute().getChangedEvent().subscribe(f1);
while (true) {
usleep(10);
diff --git a/CommonAPI-Examples/E06Unions/src/E06UnionsService.cpp b/CommonAPI-Examples/E06Unions/src/E06UnionsService.cpp
index 9fa72b6..906269d 100644
--- a/CommonAPI-Examples/E06Unions/src/E06UnionsService.cpp
+++ b/CommonAPI-Examples/E06Unions/src/E06UnionsService.cpp
@@ -12,37 +12,37 @@
#include "E06UnionsStubImpl.h"
int main() {
- CommonAPI::Runtime::setProperty("LogContext", "E06S");
- CommonAPI::Runtime::setProperty("LibraryBase", "E06Unions");
+ CommonAPI::Runtime::setProperty("LogContext", "E06S");
+ CommonAPI::Runtime::setProperty("LibraryBase", "E06Unions");
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
const std::string &domain = "local";
- const std::string &instance = "commonapi.examples.Unions";
- std::string connection = "service-sample";
+ const std::string &instance = "commonapi.examples.Unions";
+ std::string connection = "service-sample";
std::shared_ptr<E06UnionsStubImpl> myService = std::make_shared<E06UnionsStubImpl>();
- bool successfullyRegistered = runtime->registerService(domain, instance, myService, connection);
+ bool successfullyRegistered = runtime->registerService(domain, instance, myService, connection);
- while (!successfullyRegistered) {
- std::cout << "Register Service failed, trying again in 100 milliseconds..." << std::endl;
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- successfullyRegistered = runtime->registerService(domain, instance, myService);
- }
+ while (!successfullyRegistered) {
+ std::cout << "Register Service failed, trying again in 100 milliseconds..." << std::endl;
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ successfullyRegistered = runtime->registerService(domain, instance, myService);
+ }
- std::cout << "Successfully Registered Service!" << std::endl;
+ std::cout << "Successfully Registered Service!" << std::endl;
int n = 0;
- while (true) {
- std::cout << "Set value " << n << " for union u." << std::endl;
- myService->setMyValue(n);
- n++;
- if (n == 4) {
- n = 0;
- }
- std::this_thread::sleep_for(std::chrono::seconds(2));
- }
+ while (true) {
+ std::cout << "Set value " << n << " for union u." << std::endl;
+ myService->setMyValue(n);
+ n++;
+ if (n == 4) {
+ n = 0;
+ }
+ std::this_thread::sleep_for(std::chrono::seconds(2));
+ }
return 0;
}
diff --git a/CommonAPI-Examples/E06Unions/src/E06UnionsStubImpl.cpp b/CommonAPI-Examples/E06Unions/src/E06UnionsStubImpl.cpp
index 1cee610..5b28046 100644
--- a/CommonAPI-Examples/E06Unions/src/E06UnionsStubImpl.cpp
+++ b/CommonAPI-Examples/E06Unions/src/E06UnionsStubImpl.cpp
@@ -29,19 +29,19 @@ void E06UnionsStubImpl::setMyValue(int n) {
if (n == 0) {
CommonTypes::SettingsUnion v(t0);
setUAttribute(v);
- setXAttribute(std::make_shared<CommonTypes::SettingsStructMyTypedef>(t0));
+ setXAttribute(std::make_shared<CommonTypes::SettingsStructMyTypedef>(t0));
} else if (n == 1) {
CommonTypes::SettingsUnion v(t1);
setUAttribute(v);
- setXAttribute(std::make_shared<CommonTypes::SettingsStructMyEnum>(t1));
+ setXAttribute(std::make_shared<CommonTypes::SettingsStructMyEnum>(t1));
} else if (n == 2) {
CommonTypes::SettingsUnion v(t2);
setUAttribute(v);
- setXAttribute(std::make_shared<CommonTypes::SettingsStructUInt8>(t2));
+ setXAttribute(std::make_shared<CommonTypes::SettingsStructUInt8>(t2));
} else if (n == 3) {
CommonTypes::SettingsUnion v(t3);
setUAttribute(v);
- setXAttribute(std::make_shared<CommonTypes::SettingsStructString>(t3));
+ setXAttribute(std::make_shared<CommonTypes::SettingsStructString>(t3));
}
} else {
diff --git a/CommonAPI-Examples/E06Unions/src/typeUtils.hpp b/CommonAPI-Examples/E06Unions/src/typeUtils.hpp
index 0dfb0f2..a56f2b6 100644
--- a/CommonAPI-Examples/E06Unions/src/typeUtils.hpp
+++ b/CommonAPI-Examples/E06Unions/src/typeUtils.hpp
@@ -16,12 +16,12 @@ struct typeIdOf;
template <typename SearchT, typename T>
struct typeIdOf<SearchT, T> {
- static const int value = std::is_same<SearchT, T>::value ? 1 : -1;
+ static const int value = std::is_same<SearchT, T>::value ? 1 : -1;
};
template <typename SearchT, typename T1, typename... T>
struct typeIdOf<SearchT, T1, T...> {
- static const int value = std::is_same<SearchT, T1>::value ? sizeof...(T)+1 : typeIdOf<SearchT, T...>::value;
+ static const int value = std::is_same<SearchT, T1>::value ? sizeof...(T)+1 : typeIdOf<SearchT, T...>::value;
};
#endif // DE_BMW_EXAMPLES_TYPE_UTILS_H_
diff --git a/CommonAPI-Examples/E06Unions/vsomeip-client.json b/CommonAPI-Examples/E06Unions/vsomeip-client.json
index 731852a..584fdb1 100644
--- a/CommonAPI-Examples/E06Unions/vsomeip-client.json
+++ b/CommonAPI-Examples/E06Unions/vsomeip-client.json
@@ -1,26 +1,26 @@
{
- "unicast" : "192.168.56.102",
- "netmask" : "255.255.255.0",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "true", "path" : "/var/log/vsomeip.log" },
- "dlt" : "true"
- },
- "applications" :
- [
- {
- "name" : "client-sample",
- "id" : "0x1343"
- }
- ],
- "routing" : "client-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "port" : "30490",
- "protocol" : "udp"
- }
+ "unicast" : "192.168.56.102",
+ "netmask" : "255.255.255.0",
+ "logging" :
+ {
+ "level" : "debug",
+ "console" : "true",
+ "file" : { "enable" : "true", "path" : "/var/log/vsomeip.log" },
+ "dlt" : "true"
+ },
+ "applications" :
+ [
+ {
+ "name" : "client-sample",
+ "id" : "0x1343"
+ }
+ ],
+ "routing" : "client-sample",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
}
diff --git a/CommonAPI-Examples/E06Unions/vsomeip-local.json b/CommonAPI-Examples/E06Unions/vsomeip-local.json
index d26710c..6c30f65 100644
--- a/CommonAPI-Examples/E06Unions/vsomeip-local.json
+++ b/CommonAPI-Examples/E06Unions/vsomeip-local.json
@@ -1,78 +1,78 @@
{
- "unicast" : "192.168.56.101",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/var/log/vsomeip.log" },
- "dlt" : "false"
- },
- "applications" :
- [
- {
- "name" : "client-sample",
- "id" : "0x1343"
- },
- {
- "name" : "service-sample",
- "id" : "0x1277"
- }
- ],
- "servicegroups" :
- [
- {
- "name" : "default",
- "delays" :
- {
- "initial" : { "minimum" : "10", "maximum" : "100" },
- "repetition-base" : "200",
- "repetition-max" : "3",
- "cyclic-offer" : "2000",
- "cyclic-request" : "2001"
- },
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "reliable" : { "port" : "30509", "enable-magic-cookies" : "false" },
- "unreliable" : "31000",
- "events" :
- [
- {
- "event" : "0x80F2",
- "is_field" : "false",
- "is_reliable" : "false",
- "update-cycle" : 0
- },
- {
- "event" : "0x80F3",
- "is_field" : "true",
- "is_reliable" : "false",
- "update-cycle" : 0
- }
- ],
- "eventgroups" :
- [
- {
- "eventgroup" : "0x80F2",
- "events" : [ "0x80F2" ]
- },
- {
- "eventgroup" : "0x80F3",
- "events" : [ "0x80F3" ]
- }
- ]
- }
- ]
- }
- ],
- "routing" : "service-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "port" : "30490",
- "protocol" : "udp"
- }
+ "unicast" : "192.168.56.101",
+ "logging" :
+ {
+ "level" : "debug",
+ "console" : "true",
+ "file" : { "enable" : "false", "path" : "/var/log/vsomeip.log" },
+ "dlt" : "false"
+ },
+ "applications" :
+ [
+ {
+ "name" : "client-sample",
+ "id" : "0x1343"
+ },
+ {
+ "name" : "service-sample",
+ "id" : "0x1277"
+ }
+ ],
+ "servicegroups" :
+ [
+ {
+ "name" : "default",
+ "delays" :
+ {
+ "initial" : { "minimum" : "10", "maximum" : "100" },
+ "repetition-base" : "200",
+ "repetition-max" : "3",
+ "cyclic-offer" : "2000",
+ "cyclic-request" : "2001"
+ },
+ "services" :
+ [
+ {
+ "service" : "0x1234",
+ "instance" : "0x5678",
+ "reliable" : { "port" : "30509", "enable-magic-cookies" : "false" },
+ "unreliable" : "31000",
+ "events" :
+ [
+ {
+ "event" : "0x80F2",
+ "is_field" : "false",
+ "is_reliable" : "false",
+ "update-cycle" : 0
+ },
+ {
+ "event" : "0x80F3",
+ "is_field" : "true",
+ "is_reliable" : "false",
+ "update-cycle" : 0
+ }
+ ],
+ "eventgroups" :
+ [
+ {
+ "eventgroup" : "0x80F2",
+ "events" : [ "0x80F2" ]
+ },
+ {
+ "eventgroup" : "0x80F3",
+ "events" : [ "0x80F3" ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "routing" : "service-sample",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
}
diff --git a/CommonAPI-Examples/E06Unions/vsomeip-service.json b/CommonAPI-Examples/E06Unions/vsomeip-service.json
index 683f59f..e5d9018 100644
--- a/CommonAPI-Examples/E06Unions/vsomeip-service.json
+++ b/CommonAPI-Examples/E06Unions/vsomeip-service.json
@@ -1,74 +1,74 @@
{
- "unicast" : "192.168.56.101",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/var/log/vsomeip.log" },
- "dlt" : "false"
- },
- "applications" :
- [
- {
- "name" : "service-sample",
- "id" : "0x1277"
- }
- ],
- "servicegroups" :
- [
- {
- "name" : "default",
- "delays" :
- {
- "initial" : { "minimum" : "10", "maximum" : "100" },
- "repetition-base" : "200",
- "repetition-max" : "3",
- "cyclic-offer" : "2000",
- "cyclic-request" : "2001"
- },
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "reliable" : { "port" : "30509", "enable-magic-cookies" : "false" },
- "unreliable" : "31000",
- "events" :
- [
- {
- "event" : "0x80F2",
- "is_field" : "false",
- "is_reliable" : "false",
- "update-cycle" : 0
- },
- {
- "event" : "0x80F3",
- "is_field" : "true",
- "is_reliable" : "false",
- "update-cycle" : 0
- }
- ],
- "eventgroups" :
- [
- {
- "eventgroup" : "0x80F2",
- "events" : [ "0x80F2" ]
- },
- {
- "eventgroup" : "0x80F3",
- "events" : [ "0x80F3" ]
- }
- ]
- }
- ]
- }
- ],
- "routing" : "service-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "port" : "30490",
- "protocol" : "udp"
- }
+ "unicast" : "192.168.56.101",
+ "logging" :
+ {
+ "level" : "debug",
+ "console" : "true",
+ "file" : { "enable" : "false", "path" : "/var/log/vsomeip.log" },
+ "dlt" : "false"
+ },
+ "applications" :
+ [
+ {
+ "name" : "service-sample",
+ "id" : "0x1277"
+ }
+ ],
+ "servicegroups" :
+ [
+ {
+ "name" : "default",
+ "delays" :
+ {
+ "initial" : { "minimum" : "10", "maximum" : "100" },
+ "repetition-base" : "200",
+ "repetition-max" : "3",
+ "cyclic-offer" : "2000",
+ "cyclic-request" : "2001"
+ },
+ "services" :
+ [
+ {
+ "service" : "0x1234",
+ "instance" : "0x5678",
+ "reliable" : { "port" : "30509", "enable-magic-cookies" : "false" },
+ "unreliable" : "31000",
+ "events" :
+ [
+ {
+ "event" : "0x80F2",
+ "is_field" : "false",
+ "is_reliable" : "false",
+ "update-cycle" : 0
+ },
+ {
+ "event" : "0x80F3",
+ "is_field" : "true",
+ "is_reliable" : "false",
+ "update-cycle" : 0
+ }
+ ],
+ "eventgroups" :
+ [
+ {
+ "eventgroup" : "0x80F2",
+ "events" : [ "0x80F2" ]
+ },
+ {
+ "eventgroup" : "0x80F3",
+ "events" : [ "0x80F3" ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "routing" : "service-sample",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
}