summaryrefslogtreecommitdiff
path: root/CommonAPI-Examples
diff options
context:
space:
mode:
Diffstat (limited to 'CommonAPI-Examples')
-rw-r--r--CommonAPI-Examples/E01HelloWorld/CMakeLists.txt44
-rw-r--r--CommonAPI-Examples/E01HelloWorld/README2
-rw-r--r--CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fdepl40
-rw-r--r--CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fidl18
-rw-r--r--CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldClient.cpp32
-rw-r--r--CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldService.cpp22
-rw-r--r--CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.cpp6
-rw-r--r--CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.hpp2
-rw-r--r--CommonAPI-Examples/E01HelloWorld/vsomeip-client.json48
-rw-r--r--CommonAPI-Examples/E01HelloWorld/vsomeip-local.json100
-rw-r--r--CommonAPI-Examples/E01HelloWorld/vsomeip-service.json92
-rw-r--r--CommonAPI-Examples/E02Attributes/CMakeLists.txt46
-rw-r--r--CommonAPI-Examples/E02Attributes/README91
-rw-r--r--CommonAPI-Examples/E02Attributes/fidl/E02Attributes-DBus.fdepl2
-rw-r--r--CommonAPI-Examples/E02Attributes/fidl/E02Attributes-SomeIP.fdepl68
-rw-r--r--CommonAPI-Examples/E02Attributes/fidl/E02Attributes.fidl28
-rw-r--r--CommonAPI-Examples/E02Attributes/src/E02AttributesClient.cpp37
-rw-r--r--CommonAPI-Examples/E02Attributes/src/E02AttributesService.cpp14
-rw-r--r--CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.cpp8
-rw-r--r--CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.hpp2
-rw-r--r--CommonAPI-Examples/E02Attributes/vsomeip-client.json48
-rw-r--r--CommonAPI-Examples/E02Attributes/vsomeip-local.json152
-rw-r--r--CommonAPI-Examples/E02Attributes/vsomeip-service.json150
-rw-r--r--CommonAPI-Examples/E03Methods/CMakeLists.txt46
-rw-r--r--CommonAPI-Examples/E03Methods/README103
-rw-r--r--CommonAPI-Examples/E03Methods/fidl/E03Methods-DBus.fdepl6
-rw-r--r--CommonAPI-Examples/E03Methods/fidl/E03Methods-SomeIP.fdepl72
-rw-r--r--CommonAPI-Examples/E03Methods/fidl/E03Methods.fidl42
-rw-r--r--CommonAPI-Examples/E03Methods/src/E03MethodsClient.cpp4
-rw-r--r--CommonAPI-Examples/E03Methods/src/E03MethodsService.cpp10
-rw-r--r--CommonAPI-Examples/E03Methods/src/E03MethodsStubImpl.cpp6
-rw-r--r--CommonAPI-Examples/E03Methods/src/E03MethodsStubImpl.hpp8
-rw-r--r--CommonAPI-Examples/E03Methods/vsomeip-client.json48
-rw-r--r--CommonAPI-Examples/E03Methods/vsomeip-local.json132
-rw-r--r--CommonAPI-Examples/E03Methods/vsomeip-service.json130
-rw-r--r--CommonAPI-Examples/E04PhoneBook/CMakeLists.txt40
-rw-r--r--CommonAPI-Examples/E04PhoneBook/README85
-rw-r--r--CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook-SomeIP.fdepl198
-rw-r--r--CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook.fidl162
-rw-r--r--CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp8
-rw-r--r--CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookService.cpp14
-rw-r--r--CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.cpp6
-rw-r--r--CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.h6
-rw-r--r--CommonAPI-Examples/E04PhoneBook/vsomeip-client.json56
-rw-r--r--CommonAPI-Examples/E04PhoneBook/vsomeip-local.json110
-rw-r--r--CommonAPI-Examples/E04PhoneBook/vsomeip-service.json98
-rw-r--r--CommonAPI-Examples/E05Manager/CMakeLists.txt20
-rw-r--r--CommonAPI-Examples/E05Manager/README31
-rw-r--r--CommonAPI-Examples/E05Manager/fidl/E05Manager.fdepl94
-rw-r--r--CommonAPI-Examples/E05Manager/fidl/E05Manager.fidl16
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.cpp5
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.h5
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp6
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05ManagerService.cpp14
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05ManagerStubImpl.h2
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.cpp5
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.h5
-rw-r--r--CommonAPI-Examples/E05Manager/vsomeip-client.json48
-rw-r--r--CommonAPI-Examples/E05Manager/vsomeip-local.json162
-rw-r--r--CommonAPI-Examples/E05Manager/vsomeip-service.json154
-rw-r--r--CommonAPI-Examples/E05Manager/vsomeip.json83
-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
-rw-r--r--CommonAPI-Examples/E07Mainloop/CMakeLists.txt92
-rw-r--r--CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fdepl52
-rw-r--r--CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fidl22
-rw-r--r--CommonAPI-Examples/E07Mainloop/src/E07MainloopClient.cpp120
-rw-r--r--CommonAPI-Examples/E07Mainloop/src/E07MainloopService.cpp86
-rw-r--r--CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.cpp16
-rw-r--r--CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.hpp2
-rw-r--r--CommonAPI-Examples/E07Mainloop/vsomeip-client.json48
-rw-r--r--CommonAPI-Examples/E07Mainloop/vsomeip-local.json90
-rw-r--r--CommonAPI-Examples/E07Mainloop/vsomeip-service.json92
-rw-r--r--CommonAPI-Examples/README2
83 files changed, 2339 insertions, 2115 deletions
diff --git a/CommonAPI-Examples/E01HelloWorld/CMakeLists.txt b/CommonAPI-Examples/E01HelloWorld/CMakeLists.txt
index 52e436a..1b2ef2b 100644
--- a/CommonAPI-Examples/E01HelloWorld/CMakeLists.txt
+++ b/CommonAPI-Examples/E01HelloWorld/CMakeLists.txt
@@ -29,11 +29,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}")
@@ -46,30 +46,30 @@ 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)
set(PRJ_SRC_GEN_PATH src-gen)
-set(PRJ_SRC_GEN_COMMONAPI_PATH ${PRJ_SRC_GEN_PATH}/core/v0_1/commonapi/examples)
-set(PRJ_SRC_GEN_COMMONAPI_DBUS_PATH ${PRJ_SRC_GEN_PATH}/dbus/v0_1/commonapi/examples)
-set(PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH ${PRJ_SRC_GEN_PATH}/someip/v0_1/commonapi/examples)
+set(PRJ_SRC_GEN_COMMONAPI_PATH ${PRJ_SRC_GEN_PATH}/core/v0/commonapi/examples)
+set(PRJ_SRC_GEN_COMMONAPI_DBUS_PATH ${PRJ_SRC_GEN_PATH}/dbus/v0/commonapi/examples)
+set(PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH ${PRJ_SRC_GEN_PATH}/someip/v0/commonapi/examples)
set(PRJ_NAME_CLIENT ${PRJ_NAME}Client)
set(PRJ_NAME_SERVICE ${PRJ_NAME}Service)
@@ -111,7 +111,7 @@ link_directories(
${COMMONAPI_LIBDIR}
${COMMONAPI_DBUS_LIBDIR}
${COMMONAPI_SOMEIP_CMAKE_DIR}/build
- ${Boost_LIBRARY_DIR}
+ ${Boost_LIBRARY_DIR}
)
else()
link_directories(
@@ -119,7 +119,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/E01HelloWorld/README b/CommonAPI-Examples/E01HelloWorld/README
index b48e6f2..f1ecf48 100644
--- a/CommonAPI-Examples/E01HelloWorld/README
+++ b/CommonAPI-Examples/E01HelloWorld/README
@@ -49,7 +49,7 @@ Here, you will need two includes in order to access the Common API client functi
#include <unistd.h>
#include <CommonAPI/CommonAPI.hpp>
-#include <v0_1/commonapi/examples/E01HelloWorldProxy.hpp>
+#include <v0/commonapi/examples/E01HelloWorldProxy.hpp>
----
Please note that you always have to include +CommonAPI.hpp+ for accessing the runtime part of CommonAPI and the generated proxy. If your defined interface has a version number then you will find the version in the namespace of your interface class and in the directory structure.
diff --git a/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fdepl b/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fdepl
index 0310e23..2475d8a 100644
--- a/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fdepl
+++ b/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fdepl
@@ -7,28 +7,28 @@ import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP
import "E01HelloWorld.fidl"
define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E01HelloWorld {
- SomeIpServiceID = 4660
+ SomeIpServiceID = 4660
- method sayHello {
- SomeIpMethodID = 33000
- SomeIpReliable = true
-
- in {
- name {
- SomeIpStringEncoding = utf16le
- }
- }
- }
+ method sayHello {
+ SomeIpMethodID = 33000
+ SomeIpReliable = true
+
+ in {
+ name {
+ SomeIpStringEncoding = utf16le
+ }
+ }
+ }
}
define org.genivi.commonapi.someip.deployment for provider Service {
- instance commonapi.examples.E01HelloWorld {
- InstanceId = "commonapi.examples.HelloWorld"
-
- SomeIpInstanceID = 22136
-
- SomeIpUnicastAddress = "192.168.0.2"
- SomeIpReliableUnicastPort = 30499
- SomeIpUnreliableUnicastPort = 30499
- }
+ instance commonapi.examples.E01HelloWorld {
+ InstanceId = "commonapi.examples.HelloWorld"
+
+ SomeIpInstanceID = 22136
+
+ SomeIpUnicastAddress = "192.168.0.2"
+ SomeIpReliableUnicastPort = 30499
+ SomeIpUnreliableUnicastPort = 30499
+ }
} \ No newline at end of file
diff --git a/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fidl b/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fidl
index d1360ba..fdb1231 100644
--- a/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fidl
+++ b/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fidl
@@ -6,14 +6,14 @@
package commonapi.examples
interface E01HelloWorld {
- version { major 0 minor 1 }
+ version { major 0 minor 1 }
- method sayHello {
- in {
- String name
- }
- out {
- String message
- }
- }
+ method sayHello {
+ in {
+ String name
+ }
+ out {
+ String message
+ }
+ }
} \ No newline at end of file
diff --git a/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldClient.cpp b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldClient.cpp
index 111fd5f..0b4622b 100644
--- a/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldClient.cpp
+++ b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldClient.cpp
@@ -11,13 +11,13 @@
#endif
#include <CommonAPI/CommonAPI.hpp>
-#include <v0_1/commonapi/examples/E01HelloWorldProxy.hpp>
+#include <v0/commonapi/examples/E01HelloWorldProxy.hpp>
-using namespace v0_1::commonapi::examples;
+using namespace v0::commonapi::examples;
int main() {
- CommonAPI::Runtime::setProperty("LogContext", "E01C");
- CommonAPI::Runtime::setProperty("LibraryBase", "E01HelloWorld");
+ CommonAPI::Runtime::setProperty("LogContext", "E01C");
+ CommonAPI::Runtime::setProperty("LibraryBase", "E01HelloWorld");
std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get();
@@ -25,12 +25,12 @@ int main() {
std::string instance = "commonapi.examples.HelloWorld";
std::string connection = "client-sample";
- std::shared_ptr<E01HelloWorldProxy<>> myProxy = runtime->buildProxy<E01HelloWorldProxy>(domain,
- instance, connection);
+ std::shared_ptr<E01HelloWorldProxy<>> myProxy = runtime->buildProxy<E01HelloWorldProxy>(domain,
+ instance, connection);
std::cout << "Checking availability!" << std::endl;
while (!myProxy->isAvailable())
- usleep(10);
+ usleep(10);
std::cout << "Available..." << std::endl;
const std::string name = "World";
@@ -41,15 +41,15 @@ int main() {
info.sender_ = 1234;
while (true) {
- myProxy->sayHello(name, callStatus, returnMessage, &info);
- if (callStatus != CommonAPI::CallStatus::SUCCESS) {
- std::cerr << "Remote call failed!\n";
- return -1;
- }
- info.timeout_ = info.timeout_ + 1000;
-
- std::cout << "Got message: '" << returnMessage << "'\n";
- std::this_thread::sleep_for(std::chrono::seconds(1));
+ myProxy->sayHello(name, callStatus, returnMessage, &info);
+ if (callStatus != CommonAPI::CallStatus::SUCCESS) {
+ std::cerr << "Remote call failed!\n";
+ return -1;
+ }
+ info.timeout_ = info.timeout_ + 1000;
+
+ std::cout << "Got message: '" << returnMessage << "'\n";
+ std::this_thread::sleep_for(std::chrono::seconds(1));
}
return 0;
diff --git a/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldService.cpp b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldService.cpp
index 2fb7918..bf6c94d 100644
--- a/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldService.cpp
+++ b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldService.cpp
@@ -12,25 +12,25 @@
using namespace std;
int main() {
- CommonAPI::Runtime::setProperty("LogContext", "E01S");
- CommonAPI::Runtime::setProperty("LibraryBase", "E01HelloWorld");
+ CommonAPI::Runtime::setProperty("LogContext", "E01S");
+ CommonAPI::Runtime::setProperty("LibraryBase", "E01HelloWorld");
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
std::string domain = "local";
- std::string instance = "commonapi.examples.HelloWorld";
- std::string connection = "service-sample";
+ std::string instance = "commonapi.examples.HelloWorld";
+ std::string connection = "service-sample";
- std::shared_ptr<E01HelloWorldStubImpl> myService = std::make_shared<E01HelloWorldStubImpl>();
+ std::shared_ptr<E01HelloWorldStubImpl> myService = std::make_shared<E01HelloWorldStubImpl>();
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, 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, connection);
+ }
- std::cout << "Successfully Registered Service!" << std::endl;
+ std::cout << "Successfully Registered Service!" << std::endl;
while (true) {
std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl;
diff --git a/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.cpp b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.cpp
index df13c01..7f02818 100644
--- a/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.cpp
+++ b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.cpp
@@ -12,10 +12,10 @@ E01HelloWorldStubImpl::~E01HelloWorldStubImpl() {
}
void E01HelloWorldStubImpl::sayHello(const std::shared_ptr<CommonAPI::ClientId> _client,
- std::string _name,
- sayHelloReply_t _reply) {
+ std::string _name,
+ sayHelloReply_t _reply) {
- std::stringstream messageStream;
+ std::stringstream messageStream;
messageStream << "Hello " << _name << "!";
std::cout << "sayHello('" << _name << "'): '" << messageStream.str() << "'\n";
diff --git a/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.hpp b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.hpp
index 83a4112..da5ee1f 100644
--- a/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.hpp
+++ b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.hpp
@@ -7,7 +7,7 @@
#define E01HELLOWORLDSTUBIMPL_H_
#include <CommonAPI/CommonAPI.hpp>
-#include <v0_1/commonapi/examples/E01HelloWorldStubDefault.hpp>
+#include <v0/commonapi/examples/E01HelloWorldStubDefault.hpp>
class E01HelloWorldStubImpl: public v0_1::commonapi::examples::E01HelloWorldStubDefault {
diff --git a/CommonAPI-Examples/E01HelloWorld/vsomeip-client.json b/CommonAPI-Examples/E01HelloWorld/vsomeip-client.json
index 731852a..584fdb1 100644
--- a/CommonAPI-Examples/E01HelloWorld/vsomeip-client.json
+++ b/CommonAPI-Examples/E01HelloWorld/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/E01HelloWorld/vsomeip-local.json b/CommonAPI-Examples/E01HelloWorld/vsomeip-local.json
index 2f4c823..07cd2f3 100644
--- a/CommonAPI-Examples/E01HelloWorld/vsomeip-local.json
+++ b/CommonAPI-Examples/E01HelloWorld/vsomeip-local.json
@@ -1,52 +1,52 @@
{
- "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"
- }
- ]
- }
- ],
- "routing" : "client-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"
+ }
+ ]
+ }
+ ],
+ "routing" : "client-sample",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
}
diff --git a/CommonAPI-Examples/E01HelloWorld/vsomeip-service.json b/CommonAPI-Examples/E01HelloWorld/vsomeip-service.json
index 371ecf7..7d2aba9 100644
--- a/CommonAPI-Examples/E01HelloWorld/vsomeip-service.json
+++ b/CommonAPI-Examples/E01HelloWorld/vsomeip-service.json
@@ -1,48 +1,48 @@
{
- "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"
- }
- ]
- }
- ],
- "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"
+ }
+ ]
+ }
+ ],
+ "routing" : "service-sample",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
}
diff --git a/CommonAPI-Examples/E02Attributes/CMakeLists.txt b/CommonAPI-Examples/E02Attributes/CMakeLists.txt
index 63eec7b..a3cd270 100644
--- a/CommonAPI-Examples/E02Attributes/CMakeLists.txt
+++ b/CommonAPI-Examples/E02Attributes/CMakeLists.txt
@@ -29,11 +29,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}")
@@ -46,30 +46,30 @@ 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)
set(PRJ_SRC_GEN_PATH src-gen)
-set(PRJ_SRC_GEN_COMMONAPI_PATH ${PRJ_SRC_GEN_PATH}/core/v1_0/commonapi/examples)
-set(PRJ_SRC_GEN_COMMONAPI_DBUS_PATH ${PRJ_SRC_GEN_PATH}/dbus/v1_0/commonapi/examples)
-set(PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH ${PRJ_SRC_GEN_PATH}/someip/v1_0/commonapi/examples)
+set(PRJ_SRC_GEN_COMMONAPI_PATH ${PRJ_SRC_GEN_PATH}/core/v1/commonapi/examples)
+set(PRJ_SRC_GEN_COMMONAPI_DBUS_PATH ${PRJ_SRC_GEN_PATH}/dbus/v1/commonapi/examples)
+set(PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH ${PRJ_SRC_GEN_PATH}/someip/v1/commonapi/examples)
set(PRJ_NAME_CLIENT ${PRJ_NAME}Client)
set(PRJ_NAME_SERVICE ${PRJ_NAME}Service)
@@ -79,7 +79,7 @@ FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_COMMONAPI_PATH}/*Proxy.cpp)
FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_COMMONAPI_PATH}/*Stub*.cpp)
FILE(GLOB PRJ_TYPES_GEN_SRCS ${PRJ_SRC_GEN_COMMONAPI_PATH}/CommonTypes.cpp)
FILE(GLOB PRJ_STUB_IMPL_SRCS ${PRJ_SRC_COMMONAPI_PATH}/*Stub*.cpp)
-set(PRJ_CLIENT_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_CLIENT}.cpp ${PRJ_PROXY_GEN_SRCS})
+set(PRJ_CLIENT_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_CLIENT}.cpp ${PRJ_PROXY_GEN_SRCS} ${PRJ_TYPES_GEN_SRCS})
set(PRJ_SERVICE_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_SERVICE}.cpp ${PRJ_SRC_PATH}/${PRJ_NAME}StubImpl.cpp ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_IMPL_SRCS} ${PRJ_TYPES_GEN_SRCS})
# Boost
@@ -112,7 +112,7 @@ link_directories(
${COMMONAPI_LIBDIR}
${COMMONAPI_DBUS_LIBDIR}
${COMMONAPI_SOMEIP_CMAKE_DIR}/build
- ${Boost_LIBRARY_DIR}
+ ${Boost_LIBRARY_DIR}
)
else()
link_directories(
@@ -120,7 +120,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/E02Attributes/README b/CommonAPI-Examples/E02Attributes/README
index 25c13ce..50f2ba0 100644
--- a/CommonAPI-Examples/E02Attributes/README
+++ b/CommonAPI-Examples/E02Attributes/README
@@ -67,49 +67,99 @@ Now see the implementation of the client. The simplest case is to get the curren
[source,{cppstr}]
----
-#include <iostream>
-#include <unistd.h>
-
#include <CommonAPI/CommonAPI.hpp>
-#include <v1_0/commonapi/examples/E02AttributesProxy.hpp>
+#include <CommonAPI/Extensions/AttributeCacheExtension.hpp>
+#include <v1/commonapi/examples/E02AttributesProxy.hpp>
+using namespace v1::commonapi::examples;
-#include "AttributeCacheExtension.hpp"
+template<typename _AttributeType>
+class AttrExt : public CommonAPI::Extensions::AttributeCacheExtension<_AttributeType>
+{
+public:
+ AttrExt(_AttributeType& baseAttribute) :
+ CommonAPI::Extensions::AttributeCacheExtension<_AttributeType>(baseAttribute) {
+ };
+};
+
+void recv_cb(const CommonAPI::CallStatus& callStatus, const int32_t& val) {
+ std::cout << "Receive callback: " << val << std::endl;
+}
-using namespace v1_0::commonapi::examples;
+void recv_cb_s(const CommonAPI::CallStatus& callStatus, const CommonTypes::a1Struct& valStruct) {
+ std::cout << "Receive callback for structure: a1.s = " << valStruct.getS()
+ << ", valStruct.a2.b = " << (valStruct.getA2().getB() ? "TRUE" : "FALSE")
+ << ", valStruct.a2.d = " << valStruct.getA2().getD()
+ << std::endl;
+}
int main() {
-
std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get();
- std::string domain = "local";
- std::string instance = "commonapi.examples.Attributes";
- std::shared_ptr<CommonAPI::DefaultAttributeProxyHelper<E02AttributesProxy,
- AttributeCacheExtension>::class_t> myProxy =
- runtime->buildProxyWithDefaultAttributeExtension<E02AttributesProxy,
- AttributeCacheExtension>(domain, instance);
+ std::string domain = "local";
+ std::string instance = "commonapi.examples.Attributes";
+ std::string connection = "client-sample";
+ auto myProxy = runtime->buildProxyWithDefaultAttributeExtension<E02AttributesProxy, AttrExt>(domain, instance, connection);
+ std::cout << "Waiting for service to become available." << std::endl;
while (!myProxy->isAvailable()) {
usleep(10);
}
-
CommonAPI::CallStatus callStatus;
int32_t value = 0;
- myProxy->getXAttribute().getValue(callStatus, value);
+
+ CommonAPI::CallInfo info(1000);
+ info.sender_ = 5678;
+
+ // Get actual attribute value from service
+ std::cout << "Getting attribute value: " << value << std::endl;
+ myProxy->getXAttribute().getValue(callStatus, value, &info);
+ if (callStatus != CommonAPI::CallStatus::SUCCESS) {
+ std::cerr << "Remote call A failed!\n";
+ return -1;
+ }
std::cout << "Got attribute value: " << value << std::endl;
+ // Subscribe for receiving values
myProxy->getXAttribute().getChangedEvent().subscribe([&](const int32_t& val) {
std::cout << "Received change message: " << val << std::endl;
});
+ myProxy->getA1Attribute().getChangedEvent().subscribe([&](const CommonTypes::a1Struct& val) {
+ std::cout << "Received change message for A1" << std::endl;
+ });
+
value = 100;
- std::function<void(const CommonAPI::CallStatus&, int32_t)> fcb = recv_cb;
- myProxy->getXAttribute().setValueAsync(value, fcb);
- while (true) { usleep(1000000); }
+ // Asynchronous call to set attribute of service
+ std::function<void(const CommonAPI::CallStatus&, int32_t)> fcb = recv_cb;
+ myProxy->getXAttribute().setValueAsync(value, fcb, &info);
+
+ // Asynchronous call to set attribute of type structure in service
+ CommonTypes::a1Struct valueStruct;
+
+ valueStruct.setS("abc");
+ CommonTypes::a2Struct a2Struct = valueStruct.getA2();
+ a2Struct.setA(123);
+ a2Struct.setB(true);
+ a2Struct.setD(1234);
+ valueStruct.setA2(a2Struct);
+
+ std::function<void(const CommonAPI::CallStatus&, CommonTypes::a1Struct)> fcb_s = recv_cb_s;
+ myProxy->getA1Attribute().setValueAsync(valueStruct, fcb_s, &info);
+
+ while (true) {
+ int32_t errorValue = -1;
+ int32_t valueCached = *myProxy->getXAttributeExtension().getCachedValue(errorValue);
+ if (valueCached != errorValue) {
+ std::cout << "Got cached attribute value[" << (int)valueCached << "]: " << valueCached << std::endl;
+ } else {
+ std::cout << "Got cached attribute error value[" << (int)valueCached << "]: " << valueCached << std::endl;
+ }
+ usleep(1000000);
+ }
}
----
-
The +getXAttribute+ method will deliver the type +XAttribute+ which has to be used for the access to +x+. Every access returns a flag named callStatus (please see the CommonAPI specification). Subscription requires in general the definition of a callback function which is called in case of an attribute change. The subscribe method of CommonAPI requires a function object; for a compact notation this function object can be defined as lambda function.
Of course it is also possible to define a separate callback function with an user-defined name (here recv_cb) as can be seen at the asynchronous set call for the attribute +x+:
@@ -123,8 +173,9 @@ void recv_cb(const CommonAPI::CallStatus& callStatus, const int32_t& val) {
.... // main method
value = 100;
+// Asynchronous call to set attribute of service
std::function<void(const CommonAPI::CallStatus&, int32_t)> fcb = recv_cb;
-myProxy->getXAttribute().setValueAsync(value, fcb);
+myProxy->getXAttribute().setValueAsync(value, fcb, &info);
----
This example uses a special feature of CommonAPI which is called _Attribute Extension_. This feature is described separately. At this point we do not want to go into more detail. Please see the source code of the example for a deeper insight.
diff --git a/CommonAPI-Examples/E02Attributes/fidl/E02Attributes-DBus.fdepl b/CommonAPI-Examples/E02Attributes/fidl/E02Attributes-DBus.fdepl
index 9cadf7d..8026593 100644
--- a/CommonAPI-Examples/E02Attributes/fidl/E02Attributes-DBus.fdepl
+++ b/CommonAPI-Examples/E02Attributes/fidl/E02Attributes-DBus.fdepl
@@ -7,5 +7,5 @@ import "platform:/plugin/org.genivi.commonapi.dbus/deployment/CommonAPI-DBus_dep
import "E02Attributes.fidl"
define org.genivi.commonapi.dbus.deployment for interface commonapi.examples.E02Attributes {
- DBusDefaultAttributeType = freedesktop
+ DBusDefaultAttributeType = freedesktop
} \ No newline at end of file
diff --git a/CommonAPI-Examples/E02Attributes/fidl/E02Attributes-SomeIP.fdepl b/CommonAPI-Examples/E02Attributes/fidl/E02Attributes-SomeIP.fdepl
index 0afbaf0..4cf165c 100644
--- a/CommonAPI-Examples/E02Attributes/fidl/E02Attributes-SomeIP.fdepl
+++ b/CommonAPI-Examples/E02Attributes/fidl/E02Attributes-SomeIP.fdepl
@@ -7,48 +7,48 @@ import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP
import "E02Attributes.fidl"
define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E02Attributes {
- SomeIpServiceID = 4660
-
- attribute x {
- SomeIpGetterID = 3000
- SomeIpSetterID = 3001
- SomeIpNotifierID = 33010
- SomeIpEventGroups = { 33010 }
-
- SomeIpGetterReliable = true
- SomeIpSetterReliable = true
- SomeIpNotifierReliable = true
- }
-
- attribute a1 {
- SomeIpGetterID = 3002
- SomeIpSetterID = 3003
- SomeIpNotifierID = 33011
- SomeIpEventGroups = { 33011 }
+ SomeIpServiceID = 4660
+
+ attribute x {
+ SomeIpGetterID = 3000
+ SomeIpSetterID = 3001
+ SomeIpNotifierID = 33010
+ SomeIpEventGroups = { 33010 }
+
+ SomeIpGetterReliable = true
+ SomeIpSetterReliable = true
+ SomeIpNotifierReliable = true
+ }
+
+ attribute a1 {
+ SomeIpGetterID = 3002
+ SomeIpSetterID = 3003
+ SomeIpNotifierID = 33011
+ SomeIpEventGroups = { 33011 }
SomeIpGetterReliable = true
SomeIpSetterReliable = true
SomeIpNotifierReliable = true
- }
+ }
}
define org.genivi.commonapi.someip.deployment for typeCollection commonapi.examples.CommonTypes {
- struct a1Struct {
- }
-
- struct a2Struct {
- }
-
+ struct a1Struct {
+ }
+
+ struct a2Struct {
+ }
+
}
define org.genivi.commonapi.someip.deployment for provider Service {
- instance commonapi.examples.E02Attributes {
- InstanceId = "commonapi.examples.Attributes"
-
- SomeIpInstanceID = 22136
-
- SomeIpUnicastAddress = "192.168.0.2"
- SomeIpReliableUnicastPort = 30499
- SomeIpUnreliableUnicastPort = 30500
- }
+ instance commonapi.examples.E02Attributes {
+ InstanceId = "commonapi.examples.Attributes"
+
+ SomeIpInstanceID = 22136
+
+ SomeIpUnicastAddress = "192.168.0.2"
+ SomeIpReliableUnicastPort = 30499
+ SomeIpUnreliableUnicastPort = 30500
+ }
} \ No newline at end of file
diff --git a/CommonAPI-Examples/E02Attributes/fidl/E02Attributes.fidl b/CommonAPI-Examples/E02Attributes/fidl/E02Attributes.fidl
index dd47949..e848a81 100644
--- a/CommonAPI-Examples/E02Attributes/fidl/E02Attributes.fidl
+++ b/CommonAPI-Examples/E02Attributes/fidl/E02Attributes.fidl
@@ -6,23 +6,23 @@
package commonapi.examples
interface E02Attributes {
- version { major 1 minor 0 }
+ version { major 1 minor 0 }
- attribute Int32 x
- attribute CommonTypes.a1Struct a1
+ attribute Int32 x
+ attribute CommonTypes.a1Struct a1
}
typeCollection CommonTypes {
- version { major 1 minor 0 }
-
- struct a1Struct {
- String s
- a2Struct a2
- }
+ version { major 1 minor 0 }
+
+ struct a1Struct {
+ String s
+ a2Struct a2
+ }
- struct a2Struct {
- Int32 a
- Boolean b
- Double d
- }
+ struct a2Struct {
+ Int32 a
+ Boolean b
+ Double d
+ }
} \ No newline at end of file
diff --git a/CommonAPI-Examples/E02Attributes/src/E02AttributesClient.cpp b/CommonAPI-Examples/E02Attributes/src/E02AttributesClient.cpp
index 0ecaa7b..dbecb96 100644
--- a/CommonAPI-Examples/E02Attributes/src/E02AttributesClient.cpp
+++ b/CommonAPI-Examples/E02Attributes/src/E02AttributesClient.cpp
@@ -10,11 +10,19 @@
#endif
#include <CommonAPI/CommonAPI.hpp>
-#include <v1_0/commonapi/examples/E02AttributesProxy.hpp>
+#include <CommonAPI/Extensions/AttributeCacheExtension.hpp>
+#include <v1/commonapi/examples/E02AttributesProxy.hpp>
-#include "AttributeCacheExtension.hpp"
+using namespace v1::commonapi::examples;
-using namespace v1_0::commonapi::examples;
+template<typename _AttributeType>
+class AttrExt : public CommonAPI::Extensions::AttributeCacheExtension<_AttributeType>
+{
+public:
+ AttrExt(_AttributeType& baseAttribute) :
+ CommonAPI::Extensions::AttributeCacheExtension<_AttributeType>(baseAttribute) {
+ };
+};
void recv_cb(const CommonAPI::CallStatus& callStatus, const int32_t& val) {
std::cout << "Receive callback: " << val << std::endl;
@@ -22,8 +30,8 @@ void recv_cb(const CommonAPI::CallStatus& callStatus, const int32_t& val) {
void recv_cb_s(const CommonAPI::CallStatus& callStatus, const CommonTypes::a1Struct& valStruct) {
std::cout << "Receive callback for structure: a1.s = " << valStruct.getS()
- << ", valStruct.a2.b = " << (valStruct.getA2().getB() ? "TRUE" : "FALSE")
- << ", valStruct.a2.d = " << valStruct.getA2().getD()
+ << ", valStruct.a2.b = " << (valStruct.getA2().getB() ? "TRUE" : "FALSE")
+ << ", valStruct.a2.d = " << valStruct.getA2().getD()
<< std::endl;
}
@@ -34,11 +42,10 @@ int main() {
std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get();
std::string domain = "local";
- std::string instance = "commonapi.examples.Attributes";
- std::string connection = "client-sample";
+ std::string instance = "commonapi.examples.Attributes";
+ std::string connection = "client-sample";
- std::shared_ptr<CommonAPI::DefaultAttributeProxyHelper<E02AttributesProxy, AttributeCacheExtension>::class_t> myProxy =
- runtime->buildProxyWithDefaultAttributeExtension<E02AttributesProxy, AttributeCacheExtension>(domain, instance, connection);
+ auto myProxy = runtime->buildProxyWithDefaultAttributeExtension<E02AttributesProxy, AttrExt>(domain, instance, connection);
std::cout << "Waiting for service to become available." << std::endl;
while (!myProxy->isAvailable()) {
@@ -90,9 +97,13 @@ int main() {
myProxy->getA1Attribute().setValueAsync(valueStruct, fcb_s, &info);
while (true) {
- int32_t valueCached = 0;
- bool r = myProxy->getXAttributeExtension().getCachedValue(valueCached);
- std::cout << "Got cached attribute value[" << (int)r << "]: " << valueCached << std::endl;
- usleep(1000000);
+ int32_t errorValue = -1;
+ int32_t valueCached = *myProxy->getXAttributeExtension().getCachedValue(errorValue);
+ if (valueCached != errorValue) {
+ std::cout << "Got cached attribute value[" << (int)valueCached << "]: " << valueCached << std::endl;
+ } else {
+ std::cout << "Got cached attribute error value[" << (int)valueCached << "]: " << valueCached << std::endl;
+ }
+ usleep(1000000);
}
}
diff --git a/CommonAPI-Examples/E02Attributes/src/E02AttributesService.cpp b/CommonAPI-Examples/E02Attributes/src/E02AttributesService.cpp
index 8947414..584611a 100644
--- a/CommonAPI-Examples/E02Attributes/src/E02AttributesService.cpp
+++ b/CommonAPI-Examples/E02Attributes/src/E02AttributesService.cpp
@@ -16,16 +16,16 @@ int main() {
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
std::string domain = "local";
- std::string instance = "commonapi.examples.Attributes";
- std::string connection = "service-sample";
+ std::string instance = "commonapi.examples.Attributes";
+ std::string connection = "service-sample";
std::shared_ptr<E02AttributesStubImpl> myService = std::make_shared<E02AttributesStubImpl>();
- while (!runtime->registerService(domain, instance, myService, connection)) {
- std::cout << "Register Service failed, trying again in 100 milliseconds..." << std::endl;
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
+ while (!runtime->registerService(domain, instance, myService, connection)) {
+ std::cout << "Register Service failed, trying again in 100 milliseconds..." << std::endl;
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ }
- std::cout << "Successfully Registered Service!" << std::endl;
+ std::cout << "Successfully Registered Service!" << std::endl;
while (true) {
myService->incCounter(); // Change value of attribute, see stub implementation
diff --git a/CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.cpp b/CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.cpp
index 2eb226c..5bed931 100644
--- a/CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.cpp
+++ b/CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.cpp
@@ -6,14 +6,14 @@
#include "E02AttributesStubImpl.hpp"
E02AttributesStubImpl::E02AttributesStubImpl() {
- cnt = 0;
+ cnt = 0;
}
E02AttributesStubImpl::~E02AttributesStubImpl() {
}
void E02AttributesStubImpl::incCounter() {
- cnt++;
- setXAttribute((int32_t)cnt);
- std::cout << "New counter value = " << cnt << "!" << std::endl;
+ cnt++;
+ setXAttribute((int32_t)cnt);
+ std::cout << "New counter value = " << cnt << "!" << std::endl;
}
diff --git a/CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.hpp b/CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.hpp
index 655a094..abb2959 100644
--- a/CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.hpp
+++ b/CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.hpp
@@ -7,7 +7,7 @@
#define E02ATTRIBUTESSTUBIMPL_H_
#include <CommonAPI/CommonAPI.hpp>
-#include <v1_0/commonapi/examples/E02AttributesStubDefault.hpp>
+#include <v1/commonapi/examples/E02AttributesStubDefault.hpp>
class E02AttributesStubImpl: public v1_0::commonapi::examples::E02AttributesStubDefault {
diff --git a/CommonAPI-Examples/E02Attributes/vsomeip-client.json b/CommonAPI-Examples/E02Attributes/vsomeip-client.json
index 731852a..584fdb1 100644
--- a/CommonAPI-Examples/E02Attributes/vsomeip-client.json
+++ b/CommonAPI-Examples/E02Attributes/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/E02Attributes/vsomeip-local.json b/CommonAPI-Examples/E02Attributes/vsomeip-local.json
index ac274e1..b96c1f6 100644
--- a/CommonAPI-Examples/E02Attributes/vsomeip-local.json
+++ b/CommonAPI-Examples/E02Attributes/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" : "true",
- "update-cycle" : 2000
- },
- {
- "event" : "0x80F3",
- "is_field" : "true",
- "is_reliable" : "true",
- "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" : "true",
+ "update-cycle" : 2000
+ },
+ {
+ "event" : "0x80F3",
+ "is_field" : "true",
+ "is_reliable" : "true",
+ "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/E02Attributes/vsomeip-service.json b/CommonAPI-Examples/E02Attributes/vsomeip-service.json
index 03d8979..199e954 100644
--- a/CommonAPI-Examples/E02Attributes/vsomeip-service.json
+++ b/CommonAPI-Examples/E02Attributes/vsomeip-service.json
@@ -1,77 +1,77 @@
{
- "unicast" : "192.168.56.101",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/tmp/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" },
- "events" :
- [
- {
- "event" : "0x80F2",
- "is_field" : "false",
- "is_reliable" : "true",
- "update-cycle" : 2000
- },
- {
- "event" : "0x80F3",
- "is_field" : "true",
- "is_reliable" : "true",
- "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" : "/tmp/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" },
+ "events" :
+ [
+ {
+ "event" : "0x80F2",
+ "is_field" : "false",
+ "is_reliable" : "true",
+ "update-cycle" : 2000
+ },
+ {
+ "event" : "0x80F3",
+ "is_field" : "true",
+ "is_reliable" : "true",
+ "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/E03Methods/CMakeLists.txt b/CommonAPI-Examples/E03Methods/CMakeLists.txt
index 98b8589..8d9c5bd 100644
--- a/CommonAPI-Examples/E03Methods/CMakeLists.txt
+++ b/CommonAPI-Examples/E03Methods/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,30 +48,30 @@ 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)
set(PRJ_SRC_GEN_PATH src-gen)
-set(PRJ_SRC_GEN_COMMONAPI_PATH ${PRJ_SRC_GEN_PATH}/core/v1_2/commonapi/examples)
-set(PRJ_SRC_GEN_COMMONAPI_DBUS_PATH ${PRJ_SRC_GEN_PATH}/dbus/v1_2/commonapi/examples)
-set(PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH ${PRJ_SRC_GEN_PATH}/someip/v1_2/commonapi/examples)
+set(PRJ_SRC_GEN_COMMONAPI_PATH ${PRJ_SRC_GEN_PATH}/core/v1/commonapi/examples)
+set(PRJ_SRC_GEN_COMMONAPI_DBUS_PATH ${PRJ_SRC_GEN_PATH}/dbus/v1/commonapi/examples)
+set(PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH ${PRJ_SRC_GEN_PATH}/someip/v1/commonapi/examples)
set(PRJ_NAME_CLIENT ${PRJ_NAME}Client)
set(PRJ_NAME_SERVICE ${PRJ_NAME}Service)
@@ -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/E03Methods/README b/CommonAPI-Examples/E03Methods/README
index 70488d3..94130de 100644
--- a/CommonAPI-Examples/E03Methods/README
+++ b/CommonAPI-Examples/E03Methods/README
@@ -71,6 +71,7 @@ In the example there is another function incCounter implemented which sends the
void E03MethodsStubImpl::incCounter() {
cnt++;
fireMyStatusEvent((int32_t) cnt);
+ std::cout << "New counter value = " << cnt << "!" << std::endl;
}
----
@@ -82,60 +83,78 @@ The subscription to the broadcast is nearly identical to the subscription to the
#include <unistd.h>
#include <CommonAPI/CommonAPI.hpp>
-#include <v1_2/commonapi/examples/E03MethodsProxy.hpp>
+#include <v1/commonapi/examples/E03MethodsProxy.hpp>
using namespace v1_2::commonapi::examples;
void recv_cb(const CommonAPI::CallStatus& callStatus,
- const E03Methods::fooError& methodError,
+ const E03Methods::stdErrorTypeEnum& methodError,
const int32_t& y1,
const std::string& y2) {
-
std::cout << "Result of asynchronous call of foo: " << std::endl;
-
- std::cout << " callStatus: "
- << ((callStatus == CommonAPI::CallStatus::SUCCESS) ? "SUCCESS" : "NO_SUCCESS")
- << std::endl;
-
+ std::cout << " callStatus: " << ((callStatus == CommonAPI::CallStatus::SUCCESS) ? "SUCCESS" : "NO_SUCCESS")
+ << std::endl;
std::cout << " error: "
- << ((methodError.stdErrorTypeEnum ==
- E03Methods::stdErrorTypeEnum::NO_FAULT) ? "NO_FAULT" : "MY_FAULT")
- << std::endl;
-
+ << ((methodError == E03Methods::stdErrorTypeEnum::NO_FAULT) ? "NO_FAULT" :
+ "MY_FAULT") << std::endl;
std::cout << " Output values: y1 = " << y1 << ", y2 = " << y2 << std::endl;
}
int main() {
-
- // Subscribe to broadcast
- myProxy->getMyStatusEvent().subscribe([&](const int32_t& val) {
- std::cout << "Received status event: " << val << std::endl;
- });
-
- while(true) {
-
- int32_t inX1 = 5;
- std::string inX2 = "abc";
- CommonAPI::CallStatus callStatus;
- E03Methods::fooError methodError;
- int32_t outY1;
- std::string outY2;
-
- // Synchronous call
- std::cout << "Call foo with synchronous semantics ..." << std::endl ;
- myProxy->foo(inX1, inX2, callStatus, methodError, outY1, outY2);
-
- // Asynchronous call
- std::cout << "Call foo with asynchronous semantics ..." << std::endl;
-
- std::function<void (const CommonAPI::CallStatus&,
- const E03Methods::fooError&, const int32_t&, const std::string&)> fcb = recv_cb;
-
- myProxy->fooAsync(inX1, inX2, recv_cb);
-
- std::this_thread::sleep_for(std::chrono::seconds(5));
- }
- return 0;
+ CommonAPI::Runtime::setProperty("LogContext", "E03C");
+ CommonAPI::Runtime::setProperty("LibraryBase", "E03Methods");
+
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
+
+ std::string domain = "local";
+ std::string instance = "commonapi.examples.Methods";
+
+ std::shared_ptr<E03MethodsProxy<>> myProxy = runtime->buildProxy < E03MethodsProxy > (domain, instance, "client-sample");
+
+ while (!myProxy->isAvailable()) {
+ usleep(10);
+ }
+
+ // Subscribe to broadcast
+ myProxy->getMyStatusEvent().subscribe([&](const int32_t& val) {
+ std::cout << "Received status event: " << val << std::endl;
+ });
+
+ while (true) {
+ int32_t inX1 = 5;
+ std::string inX2 = "abc";
+ CommonAPI::CallStatus callStatus;
+ E03Methods::stdErrorTypeEnum methodError;
+ int32_t outY1;
+ std::string outY2;
+
+ // Synchronous call
+ std::cout << "Call foo with synchronous semantics ..." << std::endl;
+ myProxy->foo(inX1, inX2, callStatus, methodError, outY1, outY2);
+
+ std::cout << "Result of synchronous call of foo: " << std::endl;
+ std::cout << " callStatus: " << ((callStatus == CommonAPI::CallStatus::SUCCESS) ? "SUCCESS" : "NO_SUCCESS")
+ << std::endl;
+ std::cout << " error: "
+ << ((methodError == E03Methods::stdErrorTypeEnum::NO_FAULT) ? "NO_FAULT" : "MY_FAULT")
+ << std::endl;
+ std::cout << " Input values: x1 = " << inX1 << ", x2 = " << inX2 << std::endl;
+ std::cout << " Output values: y1 = " << outY1 << ", y2 = " << outY2 << std::endl;
+
+ // Asynchronous call
+ std::cout << "Call foo with asynchronous semantics ..." << std::endl;
+
+ std::function<
+ void(const CommonAPI::CallStatus&,
+ const E03Methods::stdErrorTypeEnum&,
+ const int32_t&,
+ const std::string&)> fcb = recv_cb;
+ myProxy->fooAsync(inX1, inX2, recv_cb);
+
+ std::this_thread::sleep_for(std::chrono::seconds(5));
+ }
+
+ return 0;
}
----
diff --git a/CommonAPI-Examples/E03Methods/fidl/E03Methods-DBus.fdepl b/CommonAPI-Examples/E03Methods/fidl/E03Methods-DBus.fdepl
index 560f1a9..2729fea 100644
--- a/CommonAPI-Examples/E03Methods/fidl/E03Methods-DBus.fdepl
+++ b/CommonAPI-Examples/E03Methods/fidl/E03Methods-DBus.fdepl
@@ -2,7 +2,7 @@ import "platform:/plugin/org.genivi.commonapi.dbus/deployment/CommonAPI-DBus_dep
import "E03Methods.fidl"
define org.genivi.commonapi.dbus.deployment for interface commonapi.examples.E03Methods {
- method foo {
- Timeout = 1234
- }
+ method foo {
+ Timeout = 1234
+ }
} \ No newline at end of file
diff --git a/CommonAPI-Examples/E03Methods/fidl/E03Methods-SomeIP.fdepl b/CommonAPI-Examples/E03Methods/fidl/E03Methods-SomeIP.fdepl
index 6782105..2620684 100644
--- a/CommonAPI-Examples/E03Methods/fidl/E03Methods-SomeIP.fdepl
+++ b/CommonAPI-Examples/E03Methods/fidl/E03Methods-SomeIP.fdepl
@@ -7,47 +7,47 @@ import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP
import "E03Methods.fidl"
define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E03Methods {
- SomeIpServiceID = 4660
+ SomeIpServiceID = 4660
- method foo {
- SomeIpMethodID = 33000
- SomeIpReliable = false
-
- in {
- x2 {
- SomeIpStringEncoding = utf16le
- }
- }
- out {
- y2 {
- SomeIpStringEncoding = utf16le
- }
- }
- }
-
- broadcast myStatus {
- SomeIpEventID = 33010
- SomeIpEventGroups = { 33010 }
+ method foo {
+ SomeIpMethodID = 33000
+ SomeIpReliable = false
+
+ in {
+ x2 {
+ SomeIpStringEncoding = utf16le
+ }
+ }
+ out {
+ y2 {
+ SomeIpStringEncoding = utf16le
+ }
+ }
+ }
+
+ broadcast myStatus {
+ SomeIpEventID = 33010
+ SomeIpEventGroups = { 33010 }
- out {
- }
- }
-
- enumeration stdErrorTypeEnum {
- NO_FAULT {
- }
- MY_FAULT {
- }
- }
+ out {
+ }
+ }
+
+ enumeration stdErrorTypeEnum {
+ NO_FAULT {
+ }
+ MY_FAULT {
+ }
+ }
}
define org.genivi.commonapi.someip.deployment for provider Service {
- instance commonapi.examples.E03Methods {
- InstanceId = "commonapi.examples.Methods"
-
- SomeIpInstanceID = 22136
-
- SomeIpUnicastAddress = "192.168.0.2"
+ instance commonapi.examples.E03Methods {
+ InstanceId = "commonapi.examples.Methods"
+
+ SomeIpInstanceID = 22136
+
+ SomeIpUnicastAddress = "192.168.0.2"
SomeIpReliableUnicastPort = 30500
SomeIpUnreliableUnicastPort = 30501
}
diff --git a/CommonAPI-Examples/E03Methods/fidl/E03Methods.fidl b/CommonAPI-Examples/E03Methods/fidl/E03Methods.fidl
index f0963cd..1cb49d3 100644
--- a/CommonAPI-Examples/E03Methods/fidl/E03Methods.fidl
+++ b/CommonAPI-Examples/E03Methods/fidl/E03Methods.fidl
@@ -9,28 +9,28 @@ package commonapi.examples
interface E03Methods {
- version { major 1 minor 2 }
+ version { major 1 minor 2 }
- method foo {
- in {
- Int32 x1
- String x2
- }
- out {
- Int32 y1
- String y2
- }
- error stdErrorTypeEnum
- }
+ method foo {
+ in {
+ Int32 x1
+ String x2
+ }
+ out {
+ Int32 y1
+ String y2
+ }
+ error stdErrorTypeEnum
+ }
- broadcast myStatus {
- out {
- Int32 myCurrentValue
- }
- }
+ broadcast myStatus {
+ out {
+ Int32 myCurrentValue
+ }
+ }
- enumeration stdErrorTypeEnum {
- NO_FAULT
- MY_FAULT
- }
+ enumeration stdErrorTypeEnum {
+ NO_FAULT
+ MY_FAULT
+ }
}
diff --git a/CommonAPI-Examples/E03Methods/src/E03MethodsClient.cpp b/CommonAPI-Examples/E03Methods/src/E03MethodsClient.cpp
index 8d58060..0c9b558 100644
--- a/CommonAPI-Examples/E03Methods/src/E03MethodsClient.cpp
+++ b/CommonAPI-Examples/E03Methods/src/E03MethodsClient.cpp
@@ -12,7 +12,7 @@
#endif
#include <CommonAPI/CommonAPI.hpp>
-#include <v1_2/commonapi/examples/E03MethodsProxy.hpp>
+#include <v1/commonapi/examples/E03MethodsProxy.hpp>
using namespace v1_2::commonapi::examples;
@@ -36,7 +36,7 @@ int main() {
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
std::string domain = "local";
- std::string instance = "commonapi.examples.Methods";
+ std::string instance = "commonapi.examples.Methods";
std::shared_ptr<E03MethodsProxy<>> myProxy = runtime->buildProxy < E03MethodsProxy > (domain, instance, "client-sample");
diff --git a/CommonAPI-Examples/E03Methods/src/E03MethodsService.cpp b/CommonAPI-Examples/E03Methods/src/E03MethodsService.cpp
index a57e46b..f4be7e1 100644
--- a/CommonAPI-Examples/E03Methods/src/E03MethodsService.cpp
+++ b/CommonAPI-Examples/E03Methods/src/E03MethodsService.cpp
@@ -18,14 +18,14 @@ int main() {
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
std::string domain = "local";
- std::string instance = "commonapi.examples.Methods";
+ std::string instance = "commonapi.examples.Methods";
std::shared_ptr<E03MethodsStubImpl> myService = std::make_shared<E03MethodsStubImpl>();
- while (!runtime->registerService(domain, instance, myService, "service-sample")) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
+ while (!runtime->registerService(domain, instance, myService, "service-sample")) {
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ }
- std::cout << "Successfully Registered Service!" << std::endl;
+ std::cout << "Successfully Registered Service!" << std::endl;
while (true) {
myService->incCounter(); // Change value of attribute, see stub implementation
diff --git a/CommonAPI-Examples/E03Methods/src/E03MethodsStubImpl.cpp b/CommonAPI-Examples/E03Methods/src/E03MethodsStubImpl.cpp
index b3b0afa..1d0607d 100644
--- a/CommonAPI-Examples/E03Methods/src/E03MethodsStubImpl.cpp
+++ b/CommonAPI-Examples/E03Methods/src/E03MethodsStubImpl.cpp
@@ -24,9 +24,9 @@ void E03MethodsStubImpl::incCounter() {
;
void E03MethodsStubImpl::foo(const std::shared_ptr<CommonAPI::ClientId> _client,
- int32_t _x1,
- std::string _x2,
- fooReply_t _reply) {
+ int32_t _x1,
+ std::string _x2,
+ fooReply_t _reply) {
std::cout << "foo called, setting new values." << std::endl;
diff --git a/CommonAPI-Examples/E03Methods/src/E03MethodsStubImpl.hpp b/CommonAPI-Examples/E03Methods/src/E03MethodsStubImpl.hpp
index 3afdbe8..eba07fa 100644
--- a/CommonAPI-Examples/E03Methods/src/E03MethodsStubImpl.hpp
+++ b/CommonAPI-Examples/E03Methods/src/E03MethodsStubImpl.hpp
@@ -9,7 +9,7 @@
#define E03METHODSSTUBIMPL_H_
#include <CommonAPI/CommonAPI.hpp>
-#include <v1_2/commonapi/examples/E03MethodsStubDefault.hpp>
+#include <v1/commonapi/examples/E03MethodsStubDefault.hpp>
class E03MethodsStubImpl: public v1_2::commonapi::examples::E03MethodsStubDefault {
@@ -18,9 +18,9 @@ public:
virtual ~E03MethodsStubImpl();
virtual void incCounter();
virtual void foo(const std::shared_ptr<CommonAPI::ClientId> _client,
- int32_t _x1,
- std::string _x2,
- fooReply_t _reply);
+ int32_t _x1,
+ std::string _x2,
+ fooReply_t _reply);
private:
int cnt;
diff --git a/CommonAPI-Examples/E03Methods/vsomeip-client.json b/CommonAPI-Examples/E03Methods/vsomeip-client.json
index f6d7414..bd77149 100644
--- a/CommonAPI-Examples/E03Methods/vsomeip-client.json
+++ b/CommonAPI-Examples/E03Methods/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/E03MethodsClient.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/E03MethodsClient.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/E03Methods/vsomeip-local.json b/CommonAPI-Examples/E03Methods/vsomeip-local.json
index bda9e87..fbc1194 100644
--- a/CommonAPI-Examples/E03Methods/vsomeip-local.json
+++ b/CommonAPI-Examples/E03Methods/vsomeip-local.json
@@ -1,68 +1,68 @@
{
- "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" : 2000
- }
- ],
- "eventgroups" :
- [
- {
- "eventgroup" : "0x80F2",
- "events" : [ "0x80F2" ]
- }
- ]
- }
- ]
- }
- ],
- "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" : 2000
+ }
+ ],
+ "eventgroups" :
+ [
+ {
+ "eventgroup" : "0x80F2",
+ "events" : [ "0x80F2" ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "routing" : "service-sample",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
}
diff --git a/CommonAPI-Examples/E03Methods/vsomeip-service.json b/CommonAPI-Examples/E03Methods/vsomeip-service.json
index 1418e71..0f4996a 100644
--- a/CommonAPI-Examples/E03Methods/vsomeip-service.json
+++ b/CommonAPI-Examples/E03Methods/vsomeip-service.json
@@ -1,67 +1,67 @@
{
- "unicast" : "192.168.56.101",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/var/log/E03MethodsService.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",
- "unreliable" : "30509",
- "events" :
- [
- {
- "event" : "0x80F2",
- "is_field" : "false",
- "is_reliable" : "false",
- "update-cycle" : 2000
- }
- ],
- "eventgroups" :
- [
- {
- "eventgroup" : "0x80F2",
- "events" : [ "0x80F2" ]
- }
- ]
- }
- ]
- }
- ],
- "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/E03MethodsService.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",
+ "unreliable" : "30509",
+ "events" :
+ [
+ {
+ "event" : "0x80F2",
+ "is_field" : "false",
+ "is_reliable" : "false",
+ "update-cycle" : 2000
+ }
+ ],
+ "eventgroups" :
+ [
+ {
+ "eventgroup" : "0x80F2",
+ "events" : [ "0x80F2" ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "routing" : "service-sample",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
}
diff --git a/CommonAPI-Examples/E04PhoneBook/CMakeLists.txt b/CommonAPI-Examples/E04PhoneBook/CMakeLists.txt
index 78758de..750dec7 100644
--- a/CommonAPI-Examples/E04PhoneBook/CMakeLists.txt
+++ b/CommonAPI-Examples/E04PhoneBook/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/E04PhoneBook/README b/CommonAPI-Examples/E04PhoneBook/README
index 431351a..497af83 100644
--- a/CommonAPI-Examples/E04PhoneBook/README
+++ b/CommonAPI-Examples/E04PhoneBook/README
@@ -169,50 +169,83 @@ On client side we create two proxies which shall set different filters and get d
[source,{cppstr}]
----
int main() {
+ CommonAPI::Runtime::setProperty("LogContext", "E04C");
+ CommonAPI::Runtime::setProperty("LibraryBase", "E04PhoneBook");
+
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
const std::string &domain = "local";
const std::string &instance = "commonapi.examples.PhoneBook";
+ const std::string &connection = "client-sample";
- std::shared_ptr < E04PhoneBookProxyDefault > myProxyA =
- runtime->buildProxy < E04PhoneBookProxy > (domain, instance);
-
- while (!myProxyA->isAvailable()) { usleep(10); }
+ std::shared_ptr < E04PhoneBookProxy<> > myProxyA = runtime->buildProxy < E04PhoneBookProxy > (domain, instance, connection);
+ while (!myProxyA->isAvailable()) {
+ usleep(10);
+ }
+ std::cout << "Service for Proxy A is available!" << std::endl;
- const CommonAPI::ConnectionId_t otherConnectionId = "42";
+ const CommonAPI::ConnectionId_t otherConnection = "other-client-sample";
+ std::shared_ptr < E04PhoneBookProxy<> > myProxyB = runtime->buildProxy < E04PhoneBookProxy > (domain, instance, otherConnection);
+ while (!myProxyB->isAvailable()) {
+ usleep(10);
+ }
+ std::cout << "Service for Proxy B is available!" << std::endl;
- std::shared_ptr < E04PhoneBookProxyDefault > myProxyB =
- runtime->buildProxy < E04PhoneBookProxy > (domain, instance, otherConnectionId);
-
- while (!myProxyB->isAvailable()) { usleep(10); }
+ // Subscribe A to broadcast
+ myProxyA->getPhoneBookDataSetSelectiveEvent().subscribe(
+ [&](const std::vector<E04PhoneBook::phoneBookDataElementMap>& phoneBookDataSet) {
+ std::cout << "-- A --" << std::endl;
+ printFilterResult(phoneBookDataSet, "A");
+ std::cout << "-------" << std::endl;
+ });
- myProxyA->getPhoneBookDataSetSelectiveEvent().subscribe([&](
- const std::vector<E04PhoneBook::phoneBookDataElementMap>& phoneBookDataSet) {
- printFilterResult(phoneBookDataSet, "A");});
+ std::cout << "Subscribed A" << std::endl;
- myProxyB->getPhoneBookDataSetSelectiveEvent().subscribe([&](
- const std::vector<E04PhoneBook::phoneBookDataElementMap>& phoneBookDataSet) {
- printFilterResult(phoneBookDataSet, "B");});
+ // Subscribe B to broadcast
+ myProxyB->getPhoneBookDataSetSelectiveEvent().subscribe(
+ [&](const std::vector<E04PhoneBook::phoneBookDataElementMap>& phoneBookDataSet) {
+ std::cout << "-- B --" << std::endl;
+ printFilterResult(phoneBookDataSet, "B");
+ std::cout << "-------" << std::endl;
+ });
+ std::cout << "Subscribed B" << std::endl;
+
+ // Get actual phoneBook from service
CommonAPI::CallStatus myCallStatus;
std::vector<E04PhoneBook::phoneBookStruct> myValue;
myProxyA->getPhoneBookAttribute().getValue(myCallStatus, myValue);
- printPhoneBook (myValue);
+ if (myCallStatus != CommonAPI::CallStatus::SUCCESS)
+ std::cerr << "Remote call getPhoneBookAttribute failed!\n";
+ else
+ printPhoneBook (myValue);
+
+ // Synchronous call setPhoneBookDataFilter
+ std::cout << "Call setPhoneBookDataFilter A ..." << std::endl;
+ E04PhoneBook::elementFilterStruct lElementFilterA = {true, true, false, false, false, false};
+ std::vector<E04PhoneBook::contentFilterStruct> lContentFilterA = { {E04PhoneBook::phoneBookDataElementEnum::NAME, "*"}};
- E04PhoneBook::elementFilterStruct lElementFilterA =
- {true, true, false, false, false, false};
- std::vector<E04PhoneBook::contentFilterStruct> lContentFilterA =
- { {E04PhoneBook::phoneBookDataElementEnum::NAME, "*"}};
myProxyA->setPhoneBookDataFilter(lElementFilterA, lContentFilterA, myCallStatus);
+ if (myCallStatus != CommonAPI::CallStatus::SUCCESS)
+ std::cerr << "Remote call setPhoneBookDataFilter A failed: " << (int) myCallStatus << std::endl;
+ else
+ std::cout << "Remote call setPhoneBookDataFilter A succeeded." << std::endl;
- E04PhoneBook::elementFilterStruct lElementFilterB =
- {true, false, false, false, false, true};
- std::vector<E04PhoneBook::contentFilterStruct> lContentFilterB =
- { {E04PhoneBook::phoneBookDataElementEnum::NAME, "*"}};
- myProxyB->setPhoneBookDataFilter(lElementFilterB, lContentFilterB, myCallStatus);
+ std::cout << "Call setPhoneBookDataFilter B ..." << std::endl;
+ E04PhoneBook::elementFilterStruct lElementFilterB = {true, false, false, false, false, true};
+ std::vector<E04PhoneBook::contentFilterStruct> lContentFilterB = { {E04PhoneBook::phoneBookDataElementEnum::NAME, "*"}};
- while (true) { std::this_thread::sleep_for(std::chrono::seconds(5)); }
+ myProxyB->setPhoneBookDataFilter(lElementFilterB, lContentFilterB, myCallStatus);
+ if (myCallStatus != CommonAPI::CallStatus::SUCCESS)
+ std::cerr << "Remote call setPhoneBookDataFilter B failed: " << (int) myCallStatus << std::endl;
+ else
+ std::cout << "Remote call setPhoneBookDataFilter B succeeded." << std::endl;
+
+ while (true) {
+ std::cout << "Now I am going to sleep for 5 seconds..." << std::endl;
+ std::this_thread::sleep_for(std::chrono::seconds(5));
+ }
return 0;
}
----
diff --git a/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook-SomeIP.fdepl b/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook-SomeIP.fdepl
index 1ca64c2..472b585 100644
--- a/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook-SomeIP.fdepl
+++ b/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook-SomeIP.fdepl
@@ -7,110 +7,110 @@ import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP
import "E04PhoneBook.fidl"
define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E04PhoneBook {
- SomeIpServiceID = 4660
- SomeIpEventGroups = { 7000, 7001 }
-
- attribute phoneBook {
- SomeIpGetterID = 33000
- SomeIpSetterID = 33001
- SomeIpNotifierID = 8000
- SomeIpEventGroups = { 7000 }
- }
-
- method setPhoneBookDataFilter {
- SomeIpMethodID = 33002
- }
-
- broadcast phoneBookDataSet {
- SomeIpEventID = 8001
- SomeIpEventGroups = { 7001 }
- }
-
- enumeration phoneNumberEnum {
- WORK {
- }
- HOME {
- }
- MOBILE1 {
- }
- MOBILE2 {
- }
- }
-
- struct phoneBookStruct {
- name {
- }
- forename {
- }
- organisation {
- }
- address {
- }
- email {
- }
- phoneNumber {
- }
- }
-
- struct elementFilterStruct {
- addName {
- }
- addForename {
- }
- addOrganisation {
- }
- addAddress {
- }
- addEmail {
- }
- addPhoneNumber {
- }
- }
-
- struct contentFilterStruct {
- element {
- }
- expression {
- }
- }
-
- enumeration phoneBookDataElementEnum {
- NAME {
- }
- FORENAME {
- }
- ORGANISATION {
- }
- ADDRESS {
- }
- EMAIL {
- }
- PHONENUMBER {
- }
- }
-
- struct phoneBookDataElement {
- }
-
- struct phoneBookDataElementString {
- content {
- }
- }
-
- struct phoneBookDataElementPhoneNumber {
- content {
- }
- }
+ SomeIpServiceID = 4660
+ SomeIpEventGroups = { 7000, 7001 }
+
+ attribute phoneBook {
+ SomeIpGetterID = 33000
+ SomeIpSetterID = 33001
+ SomeIpNotifierID = 8000
+ SomeIpEventGroups = { 7000 }
+ }
+
+ method setPhoneBookDataFilter {
+ SomeIpMethodID = 33002
+ }
+
+ broadcast phoneBookDataSet {
+ SomeIpEventID = 8001
+ SomeIpEventGroups = { 7001 }
+ }
+
+ enumeration phoneNumberEnum {
+ WORK {
+ }
+ HOME {
+ }
+ MOBILE1 {
+ }
+ MOBILE2 {
+ }
+ }
+
+ struct phoneBookStruct {
+ name {
+ }
+ forename {
+ }
+ organisation {
+ }
+ address {
+ }
+ email {
+ }
+ phoneNumber {
+ }
+ }
+
+ struct elementFilterStruct {
+ addName {
+ }
+ addForename {
+ }
+ addOrganisation {
+ }
+ addAddress {
+ }
+ addEmail {
+ }
+ addPhoneNumber {
+ }
+ }
+
+ struct contentFilterStruct {
+ element {
+ }
+ expression {
+ }
+ }
+
+ enumeration phoneBookDataElementEnum {
+ NAME {
+ }
+ FORENAME {
+ }
+ ORGANISATION {
+ }
+ ADDRESS {
+ }
+ EMAIL {
+ }
+ PHONENUMBER {
+ }
+ }
+
+ struct phoneBookDataElement {
+ }
+
+ struct phoneBookDataElementString {
+ content {
+ }
+ }
+
+ struct phoneBookDataElementPhoneNumber {
+ content {
+ }
+ }
}
define org.genivi.commonapi.someip.deployment for provider Service {
- instance commonapi.examples.E04PhoneBook {
- InstanceId = "commonapi.examples.PhoneBook"
+ instance commonapi.examples.E04PhoneBook {
+ InstanceId = "commonapi.examples.PhoneBook"
- SomeIpInstanceID = 22136
-
- SomeIpUnicastAddress = "192.168.0.2"
+ SomeIpInstanceID = 22136
+
+ SomeIpUnicastAddress = "192.168.0.2"
SomeIpReliableUnicastPort = 30491
SomeIpUnreliableUnicastPort = 30492
}
diff --git a/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook.fidl b/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook.fidl
index c22fd77..06c57d0 100644
--- a/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook.fidl
+++ b/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook.fidl
@@ -8,85 +8,85 @@
package commonapi.examples
interface E04PhoneBook {
- version { major 0 minor 0 }
-
- <** @description : the phone book itself **>
- attribute phoneBookStruct [] phoneBook readonly
-
- <** @description : filter operations **>
- method setPhoneBookDataFilter {
- in {
- elementFilterStruct elementFilter
- contentFilterStruct [] contentFilter
- }
- }
-
- <** @description : filter result **>
- broadcast phoneBookDataSet selective {
- out {
- phoneBookDataElementMap [] phoneBookDataSet
- }
- }
-
- <** @description : Data types of the phone book itself **>
- enumeration phoneNumberEnum {
- WORK
- HOME
- MOBILE1
- MOBILE2
- }
-
- map phoneNumberMap {
- phoneNumberEnum to String
- }
-
- struct phoneBookStruct {
- String name
- String forename
- String organisation
- String address
- String email
- phoneNumberMap phoneNumber
- }
-
- <** @description : Data types for the filter operations **>
-
- struct elementFilterStruct {
- Boolean addName
- Boolean addForename
- Boolean addOrganisation
- Boolean addAddress
- Boolean addEmail
- Boolean addPhoneNumber
- }
-
- struct contentFilterStruct {
- phoneBookDataElementEnum element
- String expression
- }
-
- <** @description : Data types for the result of the phone book filter **>
- enumeration phoneBookDataElementEnum {
- NAME
- FORENAME
- ORGANISATION
- ADDRESS
- EMAIL
- PHONENUMBER
- }
-
- struct phoneBookDataElement polymorphic {
- }
-
- struct phoneBookDataElementString extends phoneBookDataElement {
- String content
- }
-
- struct phoneBookDataElementPhoneNumber extends phoneBookDataElement {
- phoneNumberMap content
- }
-
- map phoneBookDataElementMap {
- phoneBookDataElementEnum to phoneBookDataElement
- }
+ version { major 0 minor 0 }
+
+ <** @description : the phone book itself **>
+ attribute phoneBookStruct [] phoneBook readonly
+
+ <** @description : filter operations **>
+ method setPhoneBookDataFilter {
+ in {
+ elementFilterStruct elementFilter
+ contentFilterStruct [] contentFilter
+ }
+ }
+
+ <** @description : filter result **>
+ broadcast phoneBookDataSet selective {
+ out {
+ phoneBookDataElementMap [] phoneBookDataSet
+ }
+ }
+
+ <** @description : Data types of the phone book itself **>
+ enumeration phoneNumberEnum {
+ WORK
+ HOME
+ MOBILE1
+ MOBILE2
+ }
+
+ map phoneNumberMap {
+ phoneNumberEnum to String
+ }
+
+ struct phoneBookStruct {
+ String name
+ String forename
+ String organisation
+ String address
+ String email
+ phoneNumberMap phoneNumber
+ }
+
+ <** @description : Data types for the filter operations **>
+
+ struct elementFilterStruct {
+ Boolean addName
+ Boolean addForename
+ Boolean addOrganisation
+ Boolean addAddress
+ Boolean addEmail
+ Boolean addPhoneNumber
+ }
+
+ struct contentFilterStruct {
+ phoneBookDataElementEnum element
+ String expression
+ }
+
+ <** @description : Data types for the result of the phone book filter **>
+ enumeration phoneBookDataElementEnum {
+ NAME
+ FORENAME
+ ORGANISATION
+ ADDRESS
+ EMAIL
+ PHONENUMBER
+ }
+
+ struct phoneBookDataElement polymorphic {
+ }
+
+ struct phoneBookDataElementString extends phoneBookDataElement {
+ String content
+ }
+
+ struct phoneBookDataElementPhoneNumber extends phoneBookDataElement {
+ phoneNumberMap content
+ }
+
+ map phoneBookDataElementMap {
+ phoneBookDataElementEnum to phoneBookDataElement
+ }
} \ No newline at end of file
diff --git a/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp
index 7db3313..0a56ee5 100644
--- a/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp
+++ b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp
@@ -191,9 +191,9 @@ int main() {
if (myCallStatus != CommonAPI::CallStatus::SUCCESS)
std::cerr << "Remote call setPhoneBookDataFilter A failed: " << (int) myCallStatus << std::endl;
else
- std::cout << "Remote call setPhoneBookDataFilter A succeeded." << std::endl;
+ std::cout << "Remote call setPhoneBookDataFilter A succeeded." << std::endl;
- std::cout << "Call setPhoneBookDataFilter B ..." << std::endl;
+ std::cout << "Call setPhoneBookDataFilter B ..." << std::endl;
E04PhoneBook::elementFilterStruct lElementFilterB = {true, false, false, false, false, true};
std::vector<E04PhoneBook::contentFilterStruct> lContentFilterB = { {E04PhoneBook::phoneBookDataElementEnum::NAME, "*"}};
@@ -201,10 +201,10 @@ int main() {
if (myCallStatus != CommonAPI::CallStatus::SUCCESS)
std::cerr << "Remote call setPhoneBookDataFilter B failed: " << (int) myCallStatus << std::endl;
else
- std::cout << "Remote call setPhoneBookDataFilter B succeeded." << std::endl;
+ std::cout << "Remote call setPhoneBookDataFilter B succeeded." << std::endl;
while (true) {
- std::cout << "Now I am going to sleep for 5 seconds..." << std::endl;
+ std::cout << "Now I am going to sleep for 5 seconds..." << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(5));
}
return 0;
diff --git a/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookService.cpp b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookService.cpp
index 020209b..7decc7c 100644
--- a/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookService.cpp
+++ b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookService.cpp
@@ -24,15 +24,15 @@ int main() {
std::shared_ptr<E04PhoneBookStubImpl> myService = std::make_shared<E04PhoneBookStubImpl>();
myService->setPhoneBookAttribute(myService->createTestPhoneBook());
- 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;
while (true) {
std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl;
diff --git a/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.cpp b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.cpp
index bfd06bb..f4f11f3 100644
--- a/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.cpp
+++ b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.cpp
@@ -40,9 +40,9 @@ void E04PhoneBookStubImpl::onPhoneBookDataSetSelectiveSubscriptionChanged(const
}
void E04PhoneBookStubImpl::setPhoneBookDataFilter(const std::shared_ptr<CommonAPI::ClientId> _client,
- E04PhoneBook::elementFilterStruct _elementFilter,
- std::vector<E04PhoneBook::contentFilterStruct> _contentFilter,
- setPhoneBookDataFilterReply_t _reply) {
+ E04PhoneBook::elementFilterStruct _elementFilter,
+ std::vector<E04PhoneBook::contentFilterStruct> _contentFilter,
+ setPhoneBookDataFilterReply_t _reply) {
std::shared_ptr < CommonAPI::ClientIdList > clientList = getSubscribersForPhoneBookDataSetSelective();
std::cout << "setPhoneBookDataFilter called from client " << _client->hashCode() << " of ("
<< clientList->size() << ")" << std::endl;
diff --git a/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.h b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.h
index 38fce08..a7259aa 100644
--- a/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.h
+++ b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.h
@@ -26,9 +26,9 @@ public:
const CommonAPI::SelectiveBroadcastSubscriptionEvent);
void setPhoneBookDataFilter(const std::shared_ptr<CommonAPI::ClientId> _client,
- E04PhoneBook::elementFilterStruct _elementFilter,
- std::vector<E04PhoneBook::contentFilterStruct> _contentFilter,
- setPhoneBookDataFilterReply_t _reply);
+ E04PhoneBook::elementFilterStruct _elementFilter,
+ std::vector<E04PhoneBook::contentFilterStruct> _contentFilter,
+ setPhoneBookDataFilterReply_t _reply);
private:
std::unordered_map<std::shared_ptr<CommonAPI::ClientId>, std::vector<E04PhoneBook::phoneBookDataElementMap>> phoneBookClientData;
diff --git a/CommonAPI-Examples/E04PhoneBook/vsomeip-client.json b/CommonAPI-Examples/E04PhoneBook/vsomeip-client.json
index f3f9cd8..6ad0351 100644
--- a/CommonAPI-Examples/E04PhoneBook/vsomeip-client.json
+++ b/CommonAPI-Examples/E04PhoneBook/vsomeip-client.json
@@ -1,30 +1,30 @@
{
- "unicast" : "10.10.46.59",
- "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"
- },
- {
- "name" : "other-client-sample",
- "id" : "0x1344"
- }
- ],
- "routing" : "client-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "port" : "30490",
- "protocol" : "udp"
- }
+ "unicast" : "10.10.46.59",
+ "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"
+ },
+ {
+ "name" : "other-client-sample",
+ "id" : "0x1344"
+ }
+ ],
+ "routing" : "client-sample",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
}
diff --git a/CommonAPI-Examples/E04PhoneBook/vsomeip-local.json b/CommonAPI-Examples/E04PhoneBook/vsomeip-local.json
index d03051d..f7a08d2 100644
--- a/CommonAPI-Examples/E04PhoneBook/vsomeip-local.json
+++ b/CommonAPI-Examples/E04PhoneBook/vsomeip-local.json
@@ -1,47 +1,47 @@
{
- "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" : "other-client-sample",
- "id" : "0x1482"
- },
- {
- "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" :
+ "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" : "other-client-sample",
+ "id" : "0x1482"
+ },
+ {
+ "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" : "0x1F40",
@@ -65,16 +65,16 @@
"events" : [ "0x1F41" ]
}
]
- }
- ]
- }
- ],
- "routing" : "client-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "port" : "30490",
- "protocol" : "udp"
- }
+ }
+ ]
+ }
+ ],
+ "routing" : "client-sample",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
}
diff --git a/CommonAPI-Examples/E04PhoneBook/vsomeip-service.json b/CommonAPI-Examples/E04PhoneBook/vsomeip-service.json
index 3d05bb9..2cb2ef1 100644
--- a/CommonAPI-Examples/E04PhoneBook/vsomeip-service.json
+++ b/CommonAPI-Examples/E04PhoneBook/vsomeip-service.json
@@ -1,50 +1,50 @@
{
- "unicast" : "10.10.46.59",
- "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" :
+ "unicast" : "10.10.46.59",
+ "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" : "0x1F40",
"is_field" : "true",
- "is_reliable" : "true",
+ "is_reliable" : "true",
"update-cycle" : "0"
},
{
"event" : "0x1F41",
"is_field" : "false",
- "is_reliable" : "true",
+ "is_reliable" : "true",
"update-cycle" : "0"
}
],
@@ -59,16 +59,16 @@
"events" : [ "0x1F41" ]
}
]
- }
- ]
- }
- ],
- "routing" : "service-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "port" : "30490",
- "protocol" : "udp"
- }
+ }
+ ]
+ }
+ ],
+ "routing" : "service-sample",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
}
diff --git a/CommonAPI-Examples/E05Manager/CMakeLists.txt b/CommonAPI-Examples/E05Manager/CMakeLists.txt
index c3d2a88..1bad474 100644
--- a/CommonAPI-Examples/E05Manager/CMakeLists.txt
+++ b/CommonAPI-Examples/E05Manager/CMakeLists.txt
@@ -29,11 +29,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}")
@@ -61,15 +61,15 @@ else()
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)
set(PRJ_SRC_GEN_PATH src-gen)
-set(PRJ_SRC_GEN_COMMONAPI_PATH ${PRJ_SRC_GEN_PATH}/core/v1_0/commonapi/examples)
-set(PRJ_SRC_GEN_COMMONAPI_DBUS_PATH ${PRJ_SRC_GEN_PATH}/dbus/v1_0/commonapi/examples)
-set(PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH ${PRJ_SRC_GEN_PATH}/someip/v1_0/commonapi/examples)
+set(PRJ_SRC_GEN_COMMONAPI_PATH ${PRJ_SRC_GEN_PATH}/core/v1/commonapi/examples)
+set(PRJ_SRC_GEN_COMMONAPI_DBUS_PATH ${PRJ_SRC_GEN_PATH}/dbus/v1/commonapi/examples)
+set(PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH ${PRJ_SRC_GEN_PATH}/someip/v1/commonapi/examples)
set(PRJ_NAME_CLIENT ${PRJ_NAME}Client)
set(PRJ_NAME_SERVICE ${PRJ_NAME}Service)
@@ -119,7 +119,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/E05Manager/README b/CommonAPI-Examples/E05Manager/README
index 66bd9a0..9e96299 100644
--- a/CommonAPI-Examples/E05Manager/README
+++ b/CommonAPI-Examples/E05Manager/README
@@ -80,7 +80,7 @@ The functions for the special device has been omitted for clarity.The implementa
#include <iostream>
#include <CommonAPI/CommonAPI.hpp>
-#include <v1_0/commonapi/examples/E05ManagerProxy.hpp>
+#include <v1/commonapi/examples/E05ManagerProxy.hpp>
using namespace v1_0::commonapi::examples;
@@ -97,28 +97,35 @@ void newDeviceAvailable(const std::string address,
}
int main() {
+ CommonAPI::Runtime::setProperty("LogContext", "E05C");
+ CommonAPI::Runtime::setProperty("LibraryBase", "E05Manager");
+
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
const std::string &domain = "local";
const std::string &instance = "commonapi.examples.Manager";
-
- std::shared_ptr<E05ManagerProxyDefault> myProxy =
- runtime->buildProxy<E05ManagerProxy>(domain, instance);
-
- while (!myProxy->isAvailable()) { usleep(10); }
+ const std::string connectionIdClient = "client-sample";
+
+ std::shared_ptr<E05ManagerProxy<>> myProxy = runtime->buildProxy<E05ManagerProxy>(domain, instance, connectionIdClient);
+ while (!myProxy->isAvailable()) {
+ usleep(10);
+ }
+
+ std::cout << "Proxy available." << std::endl;
CommonAPI::ProxyManager::InstanceAvailabilityStatusChangedEvent& deviceEvent =
- myProxy->getProxyManagerE05Device().getInstanceAvailabilityStatusChangedEvent();
-
- /* special device analogously */
+ myProxy->getProxyManagerE05Device().getInstanceAvailabilityStatusChangedEvent();
+ CommonAPI::ProxyManager::InstanceAvailabilityStatusChangedEvent& specialDeviceEvent =
+ myProxy->getProxyManagerE05SpecialDevice().getInstanceAvailabilityStatusChangedEvent();
- std::function<void(const std::string, const CommonAPI::AvailabilityStatus)>
- newDeviceAvailableFunc = newDeviceAvailable;
+ std::function<void(const std::string, const CommonAPI::AvailabilityStatus)> newDeviceAvailableFunc = newDeviceAvailable;
deviceEvent.subscribe(newDeviceAvailableFunc);
specialDeviceEvent.subscribe(newDeviceAvailableFunc);
- while (true) { std::this_thread::sleep_for(std::chrono::seconds(5)); }
+ while (true) {
+ std::this_thread::sleep_for(std::chrono::seconds(5));
+ }
return 0;
}
----
diff --git a/CommonAPI-Examples/E05Manager/fidl/E05Manager.fdepl b/CommonAPI-Examples/E05Manager/fidl/E05Manager.fdepl
index 628f18a..92cc8f0 100644
--- a/CommonAPI-Examples/E05Manager/fidl/E05Manager.fdepl
+++ b/CommonAPI-Examples/E05Manager/fidl/E05Manager.fdepl
@@ -7,73 +7,73 @@ import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP
import "E05Manager.fidl"
define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E05Manager {
- SomeIpServiceID = 4660
+ SomeIpServiceID = 4660
- attribute myDevices {
- SomeIpGetterID = 3000
- SomeIpSetterID = 3001
- SomeIpNotifierID = 33000
- SomeIpEventGroups = { 17749 }
- }
+ attribute myDevices {
+ SomeIpGetterID = 3000
+ SomeIpSetterID = 3001
+ SomeIpNotifierID = 33000
+ SomeIpEventGroups = { 17749 }
+ }
}
define org.genivi.commonapi.someip.deployment for provider Service {
- instance commonapi.examples.E05Manager {
- InstanceId = "commonapi.examples.Manager"
-
- SomeIpInstanceID = 1000
-
- SomeIpUnicastAddress = "127.0.0.1"
- SomeIpReliableUnicastPort = 30499
- }
+ instance commonapi.examples.E05Manager {
+ InstanceId = "commonapi.examples.Manager"
+
+ SomeIpInstanceID = 1000
+
+ SomeIpUnicastAddress = "127.0.0.1"
+ SomeIpReliableUnicastPort = 30499
+ }
}
define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E05Device {
- SomeIpServiceID = 4661
+ SomeIpServiceID = 4661
- method doSomething {
- SomeIpMethodID = 33001
- }
+ method doSomething {
+ SomeIpMethodID = 33001
+ }
}
define org.genivi.commonapi.someip.deployment for provider Service {
- instance commonapi.examples.E05Device {
- InstanceId = "commonapi.examples.Manager.device01"
-
- SomeIpInstanceID = 2000
-
- SomeIpUnicastAddress = "127.0.0.1"
- SomeIpUnreliableUnicastPort = 30500
- }
+ instance commonapi.examples.E05Device {
+ InstanceId = "commonapi.examples.Manager.device01"
+
+ SomeIpInstanceID = 2000
+
+ SomeIpUnicastAddress = "127.0.0.1"
+ SomeIpUnreliableUnicastPort = 30500
+ }
}
define org.genivi.commonapi.someip.deployment for provider Service {
- instance commonapi.examples.E05Device {
- InstanceId = "commonapi.examples.Manager.device02"
-
- SomeIpInstanceID = 2001
-
- SomeIpUnicastAddress = "127.0.0.1"
- SomeIpUnreliableUnicastPort = 30501
- }
+ instance commonapi.examples.E05Device {
+ InstanceId = "commonapi.examples.Manager.device02"
+
+ SomeIpInstanceID = 2001
+
+ SomeIpUnicastAddress = "127.0.0.1"
+ SomeIpUnreliableUnicastPort = 30501
+ }
}
define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E05SpecialDevice {
- SomeIpServiceID = 4662
+ SomeIpServiceID = 4662
- method doSomethingSpecial {
- SomeIpMethodID = 33002
- }
+ method doSomethingSpecial {
+ SomeIpMethodID = 33002
+ }
}
define org.genivi.commonapi.someip.deployment for provider Service {
- instance commonapi.examples.E05SpecialDevice {
- InstanceId = "commonapi.examples.Manager.specialDevice00"
-
- SomeIpInstanceID = 3000
-
- SomeIpUnicastAddress = "127.0.0.1"
- SomeIpUnreliableUnicastPort = 30600
- }
+ instance commonapi.examples.E05SpecialDevice {
+ InstanceId = "commonapi.examples.Manager.specialDevice00"
+
+ SomeIpInstanceID = 3000
+
+ SomeIpUnicastAddress = "127.0.0.1"
+ SomeIpUnreliableUnicastPort = 30600
+ }
}
diff --git a/CommonAPI-Examples/E05Manager/fidl/E05Manager.fidl b/CommonAPI-Examples/E05Manager/fidl/E05Manager.fidl
index ff020b0..5e4fc43 100644
--- a/CommonAPI-Examples/E05Manager/fidl/E05Manager.fidl
+++ b/CommonAPI-Examples/E05Manager/fidl/E05Manager.fidl
@@ -8,22 +8,22 @@
package commonapi.examples
interface E05Manager manages E05Device, E05SpecialDevice {
- version { major 1 minor 0 }
+ version { major 1 minor 0 }
- attribute String [] myDevices
+ attribute String [] myDevices
}
interface E05Device {
- version { major 1 minor 0 }
+ version { major 1 minor 0 }
- method doSomething {
- }
+ method doSomething {
+ }
}
interface E05SpecialDevice extends E05Device {
- version { major 1 minor 0 }
+ version { major 1 minor 0 }
- method doSomethingSpecial {
- }
+ method doSomethingSpecial {
+ }
} \ No newline at end of file
diff --git a/CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.cpp b/CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.cpp
index 80bc2be..7100a1a 100644
--- a/CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.cpp
+++ b/CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.cpp
@@ -15,6 +15,9 @@ E05DeviceStubImpl::E05DeviceStubImpl() {
E05DeviceStubImpl::~E05DeviceStubImpl() {
}
-void E05DeviceStubImpl::doSomething() {
+void E05DeviceStubImpl::doSomething(
+ const std::shared_ptr<CommonAPI::ClientId> _client,
+ doSomethingReply_t _reply) {
std::cout << "E05DeviceStubImpl::doSomething() called." << std::endl;
+ _reply();
}
diff --git a/CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.h b/CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.h
index 7b1932f..da44f27 100644
--- a/CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.h
+++ b/CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.h
@@ -8,7 +8,7 @@
#ifndef E05DEVICESTUBIMPL_H_
#define E05DEVICESTUBIMPL_H_
-#include <v1_0/commonapi/examples/E05DeviceStubDefault.hpp>
+#include <v1/commonapi/examples/E05DeviceStubDefault.hpp>
using namespace v1_0::commonapi::examples;
@@ -16,7 +16,8 @@ class E05DeviceStubImpl: public E05DeviceStubDefault {
public:
E05DeviceStubImpl();
virtual ~E05DeviceStubImpl();
- void doSomething();
+ void doSomething(const std::shared_ptr<CommonAPI::ClientId> _client,
+ doSomethingReply_t _reply);
};
#endif /* E05DEVICESTUBIMPL_H_ */
diff --git a/CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp b/CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp
index 51c7d57..1266a6f 100644
--- a/CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp
+++ b/CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp
@@ -12,7 +12,7 @@
#include <iostream>
#include <CommonAPI/CommonAPI.hpp>
-#include <v1_0/commonapi/examples/E05ManagerProxy.hpp>
+#include <v1/commonapi/examples/E05ManagerProxy.hpp>
using namespace v1_0::commonapi::examples;
@@ -27,8 +27,8 @@ void newDeviceAvailable(const std::string address, const CommonAPI::Availability
}
int main() {
- CommonAPI::Runtime::setProperty("LogContext", "E05C");
- CommonAPI::Runtime::setProperty("LibraryBase", "E05Manager");
+ CommonAPI::Runtime::setProperty("LogContext", "E05C");
+ CommonAPI::Runtime::setProperty("LibraryBase", "E05Manager");
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
diff --git a/CommonAPI-Examples/E05Manager/src/E05ManagerService.cpp b/CommonAPI-Examples/E05Manager/src/E05ManagerService.cpp
index a1626c3..e9720c3 100644
--- a/CommonAPI-Examples/E05Manager/src/E05ManagerService.cpp
+++ b/CommonAPI-Examples/E05Manager/src/E05ManagerService.cpp
@@ -24,15 +24,15 @@ int main() {
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
std::shared_ptr<E05ManagerStubImpl> myService = std::make_shared < E05ManagerStubImpl > (managerInstanceName);
- bool successfullyRegistered = runtime->registerService("local", managerInstanceName, myService, connectionIdService);
+ bool successfullyRegistered = runtime->registerService("local", managerInstanceName, myService, connectionIdService);
- 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("local", managerInstanceName, myService, connectionIdService);
- }
+ 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("local", managerInstanceName, myService, connectionIdService);
+ }
- std::cout << "Successfully Registered Service!" << std::endl;
+ std::cout << "Successfully Registered Service!" << std::endl;
while (true) {
// Simulate external events
diff --git a/CommonAPI-Examples/E05Manager/src/E05ManagerStubImpl.h b/CommonAPI-Examples/E05Manager/src/E05ManagerStubImpl.h
index 94be54d..fd0605a 100644
--- a/CommonAPI-Examples/E05Manager/src/E05ManagerStubImpl.h
+++ b/CommonAPI-Examples/E05Manager/src/E05ManagerStubImpl.h
@@ -11,7 +11,7 @@
#include <map>
#include <CommonAPI/CommonAPI.hpp>
-#include <v1_0/commonapi/examples/E05ManagerStubDefault.hpp>
+#include <v1/commonapi/examples/E05ManagerStubDefault.hpp>
#include "E05DeviceStubImpl.h"
#include "E05SpecialDeviceStubImpl.h"
diff --git a/CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.cpp b/CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.cpp
index f31710c..34a62a0 100644
--- a/CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.cpp
+++ b/CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.cpp
@@ -15,6 +15,9 @@ E05SpecialDeviceStubImpl::E05SpecialDeviceStubImpl() {
E05SpecialDeviceStubImpl::~E05SpecialDeviceStubImpl() {
}
-void E05SpecialDeviceStubImpl::doSomethingSpecial() {
+void E05SpecialDeviceStubImpl::doSomethingSpecial(
+ const std::shared_ptr<CommonAPI::ClientId> _client,
+ doSomethingSpecialReply_t _reply) {
std::cout << "E05SpecialDeviceStubImpl::doSomethingSpecial() called." << std::endl;
+ _reply();
}
diff --git a/CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.h b/CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.h
index 0649ac5..3d89eaa 100644
--- a/CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.h
+++ b/CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.h
@@ -8,7 +8,7 @@
#ifndef E05SPECIALDEVICESTUBIMPL_H_
#define E05SPECIALDEVICESTUBIMPL_H_
-#include <v1_0/commonapi/examples/E05SpecialDeviceStubDefault.hpp>
+#include <v1/commonapi/examples/E05SpecialDeviceStubDefault.hpp>
using namespace v1_0::commonapi::examples;
@@ -17,7 +17,8 @@ public:
E05SpecialDeviceStubImpl();
virtual ~E05SpecialDeviceStubImpl();
- void doSomethingSpecial();
+ void doSomethingSpecial(const std::shared_ptr<CommonAPI::ClientId> _client,
+ doSomethingSpecialReply_t _reply);
};
#endif /* E05SPECIALDEVICESTUBIMPL_H_ */
diff --git a/CommonAPI-Examples/E05Manager/vsomeip-client.json b/CommonAPI-Examples/E05Manager/vsomeip-client.json
index 628509d..83a2b82 100644
--- a/CommonAPI-Examples/E05Manager/vsomeip-client.json
+++ b/CommonAPI-Examples/E05Manager/vsomeip-client.json
@@ -1,26 +1,26 @@
{
- "unicast" : "10.10.46.59",
- "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" : "10.10.46.59",
+ "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/E05Manager/vsomeip-local.json b/CommonAPI-Examples/E05Manager/vsomeip-local.json
index 9e94d50..1d3c80b 100644
--- a/CommonAPI-Examples/E05Manager/vsomeip-local.json
+++ b/CommonAPI-Examples/E05Manager/vsomeip-local.json
@@ -1,83 +1,83 @@
{
- "unicast" : "127.0.0.1",
- "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" : "0x03e8",
- "unreliable" : "30499",
- "events" :
- [
- {
- "event" : "0x80e8",
- "is_field" : "true"
- }
- ],
- "eventgroups" :
- [
- {
- "eventgroup" : "0x4555",
- "events" :
- [
- "0x80e8"
- ]
- }
- ]
- },
- {
- "service" : "0x1235",
- "instance" : "0x07d0",
- "unreliable" : "30500"
- },
- {
- "service" : "0x1235",
- "instance" : "0x07d1",
- "unreliable" : "30501"
- },
- {
- "service" : "0x1236",
- "instance" : "0x0bb8",
- "unreliable" : "30600"
- }
- ]
- }
- ],
- "routing" : "client-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "port" : "30490",
- "protocol" : "udp"
- }
+ "unicast" : "127.0.0.1",
+ "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" : "0x03e8",
+ "unreliable" : "30499",
+ "events" :
+ [
+ {
+ "event" : "0x80e8",
+ "is_field" : "true"
+ }
+ ],
+ "eventgroups" :
+ [
+ {
+ "eventgroup" : "0x4555",
+ "events" :
+ [
+ "0x80e8"
+ ]
+ }
+ ]
+ },
+ {
+ "service" : "0x1235",
+ "instance" : "0x07d0",
+ "unreliable" : "30500"
+ },
+ {
+ "service" : "0x1235",
+ "instance" : "0x07d1",
+ "unreliable" : "30501"
+ },
+ {
+ "service" : "0x1236",
+ "instance" : "0x0bb8",
+ "unreliable" : "30600"
+ }
+ ]
+ }
+ ],
+ "routing" : "client-sample",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
}
diff --git a/CommonAPI-Examples/E05Manager/vsomeip-service.json b/CommonAPI-Examples/E05Manager/vsomeip-service.json
index 5e1a4b0..3cdfae8 100644
--- a/CommonAPI-Examples/E05Manager/vsomeip-service.json
+++ b/CommonAPI-Examples/E05Manager/vsomeip-service.json
@@ -1,79 +1,79 @@
{
- "unicast" : "10.10.46.59",
- "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" : "0x03e8",
- "unreliable" : "30499",
- "events" :
- [
- {
- "event" : "0x80e8",
- "is_field" : "true"
- }
- ],
- "eventgroups" :
- [
- {
- "eventgroup" : "0x4555",
- "events" :
- [
- "0x80e8"
- ]
- }
- ]
- },
- {
- "service" : "0x1235",
- "instance" : "0x07d0",
- "unreliable" : "30500"
- },
- {
- "service" : "0x1235",
- "instance" : "0x07d1",
- "unreliable" : "30501"
- },
- {
- "service" : "0x1236",
- "instance" : "0x0bb8",
- "unreliable" : "30600"
- }
- ]
- }
- ],
- "routing" : "service-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "port" : "30490",
- "protocol" : "udp"
- }
+ "unicast" : "10.10.46.59",
+ "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" : "0x03e8",
+ "unreliable" : "30499",
+ "events" :
+ [
+ {
+ "event" : "0x80e8",
+ "is_field" : "true"
+ }
+ ],
+ "eventgroups" :
+ [
+ {
+ "eventgroup" : "0x4555",
+ "events" :
+ [
+ "0x80e8"
+ ]
+ }
+ ]
+ },
+ {
+ "service" : "0x1235",
+ "instance" : "0x07d0",
+ "unreliable" : "30500"
+ },
+ {
+ "service" : "0x1235",
+ "instance" : "0x07d1",
+ "unreliable" : "30501"
+ },
+ {
+ "service" : "0x1236",
+ "instance" : "0x0bb8",
+ "unreliable" : "30600"
+ }
+ ]
+ }
+ ],
+ "routing" : "service-sample",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
}
diff --git a/CommonAPI-Examples/E05Manager/vsomeip.json b/CommonAPI-Examples/E05Manager/vsomeip.json
new file mode 100644
index 0000000..1d3c80b
--- /dev/null
+++ b/CommonAPI-Examples/E05Manager/vsomeip.json
@@ -0,0 +1,83 @@
+{
+ "unicast" : "127.0.0.1",
+ "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" : "0x03e8",
+ "unreliable" : "30499",
+ "events" :
+ [
+ {
+ "event" : "0x80e8",
+ "is_field" : "true"
+ }
+ ],
+ "eventgroups" :
+ [
+ {
+ "eventgroup" : "0x4555",
+ "events" :
+ [
+ "0x80e8"
+ ]
+ }
+ ]
+ },
+ {
+ "service" : "0x1235",
+ "instance" : "0x07d0",
+ "unreliable" : "30500"
+ },
+ {
+ "service" : "0x1235",
+ "instance" : "0x07d1",
+ "unreliable" : "30501"
+ },
+ {
+ "service" : "0x1236",
+ "instance" : "0x0bb8",
+ "unreliable" : "30600"
+ }
+ ]
+ }
+ ],
+ "routing" : "client-sample",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
+}
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"
+ }
}
diff --git a/CommonAPI-Examples/E07Mainloop/CMakeLists.txt b/CommonAPI-Examples/E07Mainloop/CMakeLists.txt
index 3249b0b..2cb7923 100644
--- a/CommonAPI-Examples/E07Mainloop/CMakeLists.txt
+++ b/CommonAPI-Examples/E07Mainloop/CMakeLists.txt
@@ -30,11 +30,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}")
@@ -47,57 +47,61 @@ 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)
# GLib
if (MSVC)
- if (GLIB_INCLUDE_DIRS)
- if (GLIBCONFIG_INCLUDE_DIR)
- if (_GLIB_LIBRARY_DIR)
- include_directories(${GLIB_INCLUDE_DIRS} ${GLIBCONFIG_INCLUDE_DIR})
- link_directories(${_GLIB_LIBRARY_DIR})
- else ()
- message (FATAL_ERROR "_GLIB_LIBRARY_DIR not set! Cannot continue.")
- endif ()
- else()
- message (FATAL_ERROR "GLIBCONFIG_INCLUDE_DIR not set! Cannot continue.")
- endif ()
- else()
- message (FATAL_ERROR "GLIB_INCLUDE_DIRS not set! Cannot continue.")
- endif ()
+ if (GLIB_INCLUDE_DIRS)
+ if (GLIBCONFIG_INCLUDE_DIR)
+ if (_GLIB_LIBRARY_DIR)
+ include_directories(${GLIB_INCLUDE_DIRS} ${GLIBCONFIG_INCLUDE_DIR})
+ link_directories(${_GLIB_LIBRARY_DIR})
+ else ()
+ message (FATAL_ERROR "_GLIB_LIBRARY_DIR not set! Cannot continue.")
+ endif ()
+ else()
+ message (FATAL_ERROR "GLIBCONFIG_INCLUDE_DIR not set! Cannot continue.")
+ endif ()
+ else()
+ message (FATAL_ERROR "GLIB_INCLUDE_DIRS not set! Cannot continue.")
+ endif ()
else()
- FIND_PACKAGE(glib-2.0)
- if (GLIB_FOUND)
- message ( STATUS "Glib found: " ${GLIB_INCLUDE_DIRS} " " ${_GLIB_LIBRARY_DIR} " " ${GLIBCONFIG_INCLUDE_DIR} )
- include_directories(${GLIB_INCLUDE_DIRS} ${GLIBCONFIG_INCLUDE_DIR})
- #link_directories(${_GLIB_LIBRARY_DIR})
- else (GLIB_FOUND)
- message ( WARNING "Glib not found.")
- endif (GLIB_FOUND)
+ FIND_PACKAGE(glib-2.0)
+ if (NOT GLIB_FOUND)
+ message ("glib not found via cmake trying via pkg-config")
+ pkg_check_modules(GLIB REQUIRED glib-2.0)
+ endif()
+ if (GLIB_FOUND)
+ message ( STATUS "Glib found: " ${GLIB_INCLUDE_DIRS} " " ${_GLIB_LIBRARY_DIR} " " ${GLIBCONFIG_INCLUDE_DIR} )
+ include_directories(${GLIB_INCLUDE_DIRS} ${GLIBCONFIG_INCLUDE_DIR})
+ #link_directories(${_GLIB_LIBRARY_DIR})
+ else (GLIB_FOUND)
+ message ( WARNING "Glib not found.")
+ endif (GLIB_FOUND)
endif()
# Source Files
set(PRJ_SRC_PATH src)
set(PRJ_SRC_GEN_PATH src-gen)
-set(PRJ_SRC_GEN_COMMONAPI_PATH ${PRJ_SRC_GEN_PATH}/core/v1_0/commonapi/examples)
-set(PRJ_SRC_GEN_COMMONAPI_DBUS_PATH ${PRJ_SRC_GEN_PATH}/dbus/v1_0/commonapi/examples)
-set(PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH ${PRJ_SRC_GEN_PATH}/someip/v1_0/commonapi/examples)
+set(PRJ_SRC_GEN_COMMONAPI_PATH ${PRJ_SRC_GEN_PATH}/core/v1/commonapi/examples)
+set(PRJ_SRC_GEN_COMMONAPI_DBUS_PATH ${PRJ_SRC_GEN_PATH}/dbus/v1/commonapi/examples)
+set(PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH ${PRJ_SRC_GEN_PATH}/someip/v1/commonapi/examples)
set(PRJ_NAME_CLIENT ${PRJ_NAME}Client)
set(PRJ_NAME_SERVICE ${PRJ_NAME}Service)
@@ -139,7 +143,7 @@ link_directories(
${COMMONAPI_LIBDIR}
${COMMONAPI_DBUS_LIBDIR}
${COMMONAPI_SOMEIP_CMAKE_DIR}/build
- ${Boost_LIBRARY_DIR}
+ ${Boost_LIBRARY_DIR}
)
else()
link_directories(
@@ -147,7 +151,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/E07Mainloop/fidl/E07Mainloop.fdepl b/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fdepl
index d409861..d25e2b6 100644
--- a/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fdepl
+++ b/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fdepl
@@ -7,35 +7,35 @@ import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP
import "E07Mainloop.fidl"
define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E07Mainloop {
- SomeIpServiceID = 4660
+ SomeIpServiceID = 4660
- attribute x {
- SomeIpGetterID = 3000
- SomeIpSetterID = 3001
- SomeIpNotifierID = 33010
- SomeIpEventGroups = { 33010 }
- }
-
- method sayHello {
- SomeIpMethodID = 33000
-
- in {
- name {
- SomeIpStringEncoding = utf16le
- }
- }
- }
+ attribute x {
+ SomeIpGetterID = 3000
+ SomeIpSetterID = 3001
+ SomeIpNotifierID = 33010
+ SomeIpEventGroups = { 33010 }
+ }
+
+ method sayHello {
+ SomeIpMethodID = 33000
+
+ in {
+ name {
+ SomeIpStringEncoding = utf16le
+ }
+ }
+ }
}
define org.genivi.commonapi.someip.deployment for provider Service {
- instance commonapi.examples.E07Mainloop {
- InstanceId = "commonapi.examples.Mainloop"
-
- SomeIpInstanceID = 22136
-
- SomeIpUnicastAddress = "192.168.0.2"
- SomeIpReliableUnicastPort = 30499
- SomeIpUnreliableUnicastPort = 30499
- }
+ instance commonapi.examples.E07Mainloop {
+ InstanceId = "commonapi.examples.Mainloop"
+
+ SomeIpInstanceID = 22136
+
+ SomeIpUnicastAddress = "192.168.0.2"
+ SomeIpReliableUnicastPort = 30499
+ SomeIpUnreliableUnicastPort = 30499
+ }
} \ No newline at end of file
diff --git a/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fidl b/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fidl
index c835cd9..1892911 100644
--- a/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fidl
+++ b/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fidl
@@ -7,16 +7,16 @@
package commonapi.examples
interface E07Mainloop {
- version { major 1 minor 0 }
-
- attribute Int32 x
+ version { major 1 minor 0 }
+
+ attribute Int32 x
- method sayHello {
- in {
- String name
- }
- out {
- String message
- }
- }
+ method sayHello {
+ in {
+ String name
+ }
+ out {
+ String message
+ }
+ }
} \ No newline at end of file
diff --git a/CommonAPI-Examples/E07Mainloop/src/E07MainloopClient.cpp b/CommonAPI-Examples/E07Mainloop/src/E07MainloopClient.cpp
index 70873a8..8d2db12 100644
--- a/CommonAPI-Examples/E07Mainloop/src/E07MainloopClient.cpp
+++ b/CommonAPI-Examples/E07Mainloop/src/E07MainloopClient.cpp
@@ -16,7 +16,7 @@
#include <gio/gio.h>
#include <CommonAPI/CommonAPI.hpp>
-#include <v1_0/commonapi/examples/E07MainloopProxy.hpp>
+#include <v1/commonapi/examples/E07MainloopProxy.hpp>
using namespace v1_0::commonapi::examples;
@@ -34,48 +34,48 @@ void myAttrXCallback(const CommonAPI::CallStatus& callStatus, const int32_t& val
void mySayHelloCallback(const CommonAPI::CallStatus& _callStatus, const std::string& _returnMessage) {
- if (_callStatus != CommonAPI::CallStatus::SUCCESS) {
- std::cerr << "Remote call failed!\n";
- return;
- }
- std::cout << "Got message: '" << _returnMessage << "'\n";
+ if (_callStatus != CommonAPI::CallStatus::SUCCESS) {
+ std::cerr << "Remote call failed!\n";
+ return;
+ }
+ std::cout << "Got message: '" << _returnMessage << "'\n";
}
gboolean callSetAttrX(void* proxy) {
- std::cout << "callSetAttrX called ..." << std::endl;
+ std::cout << "callSetAttrX called ..." << std::endl;
- E07MainloopProxy<>* myProxy = static_cast<E07MainloopProxy<>*>(proxy);
- myProxy->getXAttribute().setValueAsync(gValueForX , myAttrXCallback);
+ E07MainloopProxy<>* myProxy = static_cast<E07MainloopProxy<>*>(proxy);
+ myProxy->getXAttribute().setValueAsync(gValueForX , myAttrXCallback);
- return false;
+ return false;
}
gboolean callGetAttrX(void* proxy) {
- std::cout << "callGetAttrX called ..." << std::endl;
+ std::cout << "callGetAttrX called ..." << std::endl;
- E07MainloopProxy<>* myProxy = static_cast<E07MainloopProxy<>*>(proxy);
- myProxy->getXAttribute().getValueAsync(myAttrXCallback);
+ E07MainloopProxy<>* myProxy = static_cast<E07MainloopProxy<>*>(proxy);
+ myProxy->getXAttribute().getValueAsync(myAttrXCallback);
- return false;
+ return false;
}
gboolean callSayHello(void* proxy) {
- std::cout << "callSayHello called ..." << std::endl;
+ std::cout << "callSayHello called ..." << std::endl;
- static int number = 1;
+ static int number = 1;
- std::stringstream stream;
- stream << "World (" << number << ")";
+ std::stringstream stream;
+ stream << "World (" << number << ")";
const std::string name = stream.str();
- E07MainloopProxy<>* myProxy = static_cast<E07MainloopProxy<>*>(proxy);
- gFutureCallStatus = myProxy->sayHelloAsync(name, mySayHelloCallback);
+ E07MainloopProxy<>* myProxy = static_cast<E07MainloopProxy<>*>(proxy);
+ gFutureCallStatus = myProxy->sayHelloAsync(name, mySayHelloCallback);
- number++;
+ number++;
return true;
}
@@ -88,60 +88,60 @@ class GDispatchWrapper: public GSource {
gboolean dispatchPrepare ( GSource* source, gint* timeout ) {
- bool result = false;
- int64_t eventTimeout;
+ bool result = false;
+ int64_t eventTimeout;
- result = static_cast<GDispatchWrapper*>(source)->dispatchSource_->prepare(eventTimeout);
+ result = static_cast<GDispatchWrapper*>(source)->dispatchSource_->prepare(eventTimeout);
- *timeout = eventTimeout;
+ *timeout = eventTimeout;
return result;
}
gboolean dispatchCheck ( GSource* source ) {
- return static_cast<GDispatchWrapper*>(source)->dispatchSource_->check();
+ return static_cast<GDispatchWrapper*>(source)->dispatchSource_->check();
}
gboolean dispatchExecute ( GSource* source, GSourceFunc callback, gpointer userData ) {
- static_cast<GDispatchWrapper*>(source)->dispatchSource_->dispatch();
+ static_cast<GDispatchWrapper*>(source)->dispatchSource_->dispatch();
return true;
}
static GSourceFuncs standardGLibSourceCallbackFuncs = {
- dispatchPrepare,
- dispatchCheck,
- dispatchExecute,
- NULL
+ dispatchPrepare,
+ dispatchCheck,
+ dispatchExecute,
+ NULL
};
gboolean gWatchDispatcher ( GIOChannel *source, GIOCondition condition, gpointer userData ) {
- CommonAPI::Watch* watch = static_cast<CommonAPI::Watch*>(userData);
+ CommonAPI::Watch* watch = static_cast<CommonAPI::Watch*>(userData);
#ifdef WIN32
- condition = static_cast<GIOCondition>(POLLIN);
+ condition = static_cast<GIOCondition>(POLLIN);
#endif
- watch->dispatch(condition);
+ watch->dispatch(condition);
return true;
}
gboolean gTimeoutDispatcher ( void* userData ) {
- return static_cast<CommonAPI::DispatchSource*>(userData)->dispatch();
+ return static_cast<CommonAPI::DispatchSource*>(userData)->dispatch();
}
void watchAddedCallback ( CommonAPI::Watch* watch, const CommonAPI::DispatchPriority dispatchPriority ) {
- const pollfd& fileDesc = watch->getAssociatedFileDescriptor();
+ const pollfd& fileDesc = watch->getAssociatedFileDescriptor();
#ifdef WIN32
- channel = g_io_channel_win32_new_socket(fileDesc.fd);
- GSource* gWatch = g_io_create_watch(channel, GIOCondition::G_IO_IN);
+ channel = g_io_channel_win32_new_socket(fileDesc.fd);
+ GSource* gWatch = g_io_create_watch(channel, GIOCondition::G_IO_IN);
#else
- channel = g_io_channel_unix_new(fileDesc.fd);
- GSource* gWatch = g_io_create_watch(channel, static_cast<GIOCondition>(fileDesc.events));
+ channel = g_io_channel_unix_new(fileDesc.fd);
+ GSource* gWatch = g_io_create_watch(channel, static_cast<GIOCondition>(fileDesc.events));
#endif
g_source_set_callback(gWatch, reinterpret_cast<GSourceFunc>(&gWatchDispatcher), watch, NULL);
@@ -161,7 +161,7 @@ void watchAddedCallback ( CommonAPI::Watch* watch, const CommonAPI::DispatchPrio
void watchRemovedCallback ( CommonAPI::Watch* watch ) {
- g_source_remove_by_user_data(watch);
+ g_source_remove_by_user_data(watch);
if(channel) {
g_io_channel_unref(channel);
@@ -170,8 +170,8 @@ void watchRemovedCallback ( CommonAPI::Watch* watch ) {
}
int main() {
- CommonAPI::Runtime::setProperty("LogContext", "E07C");
- CommonAPI::Runtime::setProperty("LibraryBase", "E07Mainloop");
+ CommonAPI::Runtime::setProperty("LogContext", "E07C");
+ CommonAPI::Runtime::setProperty("LibraryBase", "E07Mainloop");
std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get();
@@ -181,36 +181,36 @@ int main() {
std::shared_ptr<CommonAPI::MainLoopContext> mainloopContext = std::make_shared<CommonAPI::MainLoopContext>(connection);
- std::function<void(CommonAPI::Watch*, const CommonAPI::DispatchPriority)> f_watchAddedCallback = watchAddedCallback;
- std::function<void(CommonAPI::Watch*)> f_watchRemovedCallback = watchRemovedCallback;
- mainloopContext->subscribeForWatches(f_watchAddedCallback, f_watchRemovedCallback);
+ std::function<void(CommonAPI::Watch*, const CommonAPI::DispatchPriority)> f_watchAddedCallback = watchAddedCallback;
+ std::function<void(CommonAPI::Watch*)> f_watchRemovedCallback = watchRemovedCallback;
+ mainloopContext->subscribeForWatches(f_watchAddedCallback, f_watchRemovedCallback);
std::shared_ptr<E07MainloopProxy<>> myProxy = runtime->buildProxy<E07MainloopProxy>(domain,
- instance, mainloopContext);
+ instance, mainloopContext);
std::cout << "Checking availability" << std::flush;
static
- #ifndef WIN32
- constexpr
- #endif
- bool mayBlock = false;
-
+ #ifndef WIN32
+ constexpr
+ #endif
+ bool mayBlock = false;
+
int count = 0;
while (!myProxy->isAvailable()) {
- if (count % 10 == 0)
- std::cout << "." << std::flush;
- g_main_context_iteration(NULL, mayBlock);
- usleep(50000);
+ if (count % 10 == 0)
+ std::cout << "." << std::flush;
+ g_main_context_iteration(NULL, mayBlock);
+ usleep(50000);
}
std::cout << "done." << std::endl;
GMainLoop* mainloop = NULL;
mainloop = g_main_loop_new(NULL, FALSE);
- void *proxyPtr = (void*)myProxy.get();
- g_timeout_add(100, callSayHello, proxyPtr);
- g_timeout_add(5000, callGetAttrX, proxyPtr);
- g_timeout_add(9000, callSetAttrX, proxyPtr);
+ void *proxyPtr = (void*)myProxy.get();
+ g_timeout_add(100, callSayHello, proxyPtr);
+ g_timeout_add(5000, callGetAttrX, proxyPtr);
+ g_timeout_add(9000, callSetAttrX, proxyPtr);
g_main_loop_run (mainloop);
g_main_loop_unref (mainloop);
diff --git a/CommonAPI-Examples/E07Mainloop/src/E07MainloopService.cpp b/CommonAPI-Examples/E07Mainloop/src/E07MainloopService.cpp
index 86be1aa..72126c5 100644
--- a/CommonAPI-Examples/E07Mainloop/src/E07MainloopService.cpp
+++ b/CommonAPI-Examples/E07Mainloop/src/E07MainloopService.cpp
@@ -19,16 +19,16 @@ GIOChannel* channel;
gboolean callIncCounter(void* service) {
- E07MainloopStubImpl* myService = static_cast<E07MainloopStubImpl*>(service);
- myService->incAttrX();
+ E07MainloopStubImpl* myService = static_cast<E07MainloopStubImpl*>(service);
+ myService->incAttrX();
- return true;
+ return true;
}
gboolean callWaitingInfo(void* service) {
- std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl;
+ std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl;
- return true;
+ return true;
}
class GDispatchWrapper: public GSource {
@@ -39,60 +39,60 @@ class GDispatchWrapper: public GSource {
gboolean dispatchPrepare ( GSource* source, gint* timeout ) {
- bool result = false;
- int64_t eventTimeout;
+ bool result = false;
+ int64_t eventTimeout;
- result = static_cast<GDispatchWrapper*>(source)->dispatchSource_->prepare(eventTimeout);
+ result = static_cast<GDispatchWrapper*>(source)->dispatchSource_->prepare(eventTimeout);
- *timeout = eventTimeout;
+ *timeout = eventTimeout;
return result;
}
gboolean dispatchCheck ( GSource* source ) {
- return static_cast<GDispatchWrapper*>(source)->dispatchSource_->check();
+ return static_cast<GDispatchWrapper*>(source)->dispatchSource_->check();
}
gboolean dispatchExecute ( GSource* source, GSourceFunc callback, gpointer userData ) {
- static_cast<GDispatchWrapper*>(source)->dispatchSource_->dispatch();
+ static_cast<GDispatchWrapper*>(source)->dispatchSource_->dispatch();
return true;
}
static GSourceFuncs standardGLibSourceCallbackFuncs = {
- dispatchPrepare,
- dispatchCheck,
- dispatchExecute,
- NULL
+ dispatchPrepare,
+ dispatchCheck,
+ dispatchExecute,
+ NULL
};
gboolean gWatchDispatcher ( GIOChannel *source, GIOCondition condition, gpointer userData ) {
- CommonAPI::Watch* watch = static_cast<CommonAPI::Watch*>(userData);
+ CommonAPI::Watch* watch = static_cast<CommonAPI::Watch*>(userData);
#ifdef WIN32
- condition = static_cast<GIOCondition>(POLLIN);
+ condition = static_cast<GIOCondition>(POLLIN);
#endif
- watch->dispatch(condition);
+ watch->dispatch(condition);
return true;
}
gboolean gTimeoutDispatcher ( void* userData ) {
- return static_cast<CommonAPI::DispatchSource*>(userData)->dispatch();
+ return static_cast<CommonAPI::DispatchSource*>(userData)->dispatch();
}
void watchAddedCallback ( CommonAPI::Watch* watch, const CommonAPI::DispatchPriority dispatchPriority ) {
- const pollfd& fileDesc = watch->getAssociatedFileDescriptor();
+ const pollfd& fileDesc = watch->getAssociatedFileDescriptor();
#ifdef WIN32
- channel = g_io_channel_win32_new_socket(fileDesc.fd);
- GSource* gWatch = g_io_create_watch(channel, GIOCondition::G_IO_IN);
+ channel = g_io_channel_win32_new_socket(fileDesc.fd);
+ GSource* gWatch = g_io_create_watch(channel, GIOCondition::G_IO_IN);
#else
- channel = g_io_channel_unix_new(fileDesc.fd);
- GSource* gWatch = g_io_create_watch(channel, static_cast<GIOCondition>(fileDesc.events));
+ channel = g_io_channel_unix_new(fileDesc.fd);
+ GSource* gWatch = g_io_create_watch(channel, static_cast<GIOCondition>(fileDesc.events));
#endif
g_source_set_callback(gWatch, reinterpret_cast<GSourceFunc>(&gWatchDispatcher), watch, NULL);
@@ -107,12 +107,12 @@ void watchAddedCallback ( CommonAPI::Watch* watch, const CommonAPI::DispatchPrio
g_source_add_child_source(gWatch, gDispatchSource);
}
- int source = g_source_attach(gWatch, NULL);
+ int source = g_source_attach(gWatch, NULL);
}
void watchRemovedCallback ( CommonAPI::Watch* watch ) {
- g_source_remove_by_user_data(watch);
+ g_source_remove_by_user_data(watch);
if(channel) {
g_io_channel_unref(channel);
@@ -121,40 +121,40 @@ void watchRemovedCallback ( CommonAPI::Watch* watch ) {
}
int main() {
- CommonAPI::Runtime::setProperty("LogContext", "E07S");
- CommonAPI::Runtime::setProperty("LibraryBase", "E07Mainloop");
+ CommonAPI::Runtime::setProperty("LogContext", "E07S");
+ CommonAPI::Runtime::setProperty("LibraryBase", "E07Mainloop");
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
std::string domain = "local";
- std::string instance = "commonapi.examples.Mainloop";
- std::string connection = "service-sample";
+ std::string instance = "commonapi.examples.Mainloop";
+ std::string connection = "service-sample";
std::shared_ptr<CommonAPI::MainLoopContext> mainloopContext = std::make_shared<CommonAPI::MainLoopContext>(connection);
- std::function<void(CommonAPI::Watch*, const CommonAPI::DispatchPriority)> f_watchAddedCallback = watchAddedCallback;
- std::function<void(CommonAPI::Watch*)> f_watchRemovedCallback = watchRemovedCallback;
- mainloopContext->subscribeForWatches(f_watchAddedCallback, f_watchRemovedCallback);
+ std::function<void(CommonAPI::Watch*, const CommonAPI::DispatchPriority)> f_watchAddedCallback = watchAddedCallback;
+ std::function<void(CommonAPI::Watch*)> f_watchRemovedCallback = watchRemovedCallback;
+ mainloopContext->subscribeForWatches(f_watchAddedCallback, f_watchRemovedCallback);
- std::shared_ptr<E07MainloopStubImpl> myService = std::make_shared<E07MainloopStubImpl>();
+ std::shared_ptr<E07MainloopStubImpl> myService = std::make_shared<E07MainloopStubImpl>();
- bool successfullyRegistered = runtime->registerService(domain, instance, myService, mainloopContext);
+ bool successfullyRegistered = runtime->registerService(domain, instance, myService, mainloopContext);
- 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, mainloopContext);
- }
+ 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, mainloopContext);
+ }
- std::cout << "Successfully Registered Service!" << std::endl;
+ std::cout << "Successfully Registered Service!" << std::endl;
GMainLoop* mainloop = NULL;
mainloop = g_main_loop_new(NULL, FALSE);
void *servicePtr = (void*)myService.get();
- g_timeout_add_seconds(10, callWaitingInfo, servicePtr);
+ g_timeout_add_seconds(10, callWaitingInfo, servicePtr);
- g_timeout_add(2500, callIncCounter, servicePtr);
+ g_timeout_add(2500, callIncCounter, servicePtr);
g_main_loop_run (mainloop);
g_main_loop_unref (mainloop);
diff --git a/CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.cpp b/CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.cpp
index 53a2cd0..af000ff 100644
--- a/CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.cpp
+++ b/CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.cpp
@@ -7,17 +7,17 @@
#include "E07MainloopStubImpl.hpp"
E07MainloopStubImpl::E07MainloopStubImpl() {
- setXAttribute(0);
+ setXAttribute(0);
}
E07MainloopStubImpl::~E07MainloopStubImpl() {
}
void E07MainloopStubImpl::sayHello(const std::shared_ptr<CommonAPI::ClientId> _client,
- std::string _name,
- sayHelloReply_t _reply) {
+ std::string _name,
+ sayHelloReply_t _reply) {
- std::stringstream messageStream;
+ std::stringstream messageStream;
messageStream << "Hello " << _name << "!";
std::cout << "sayHello('" << _name << "'): '" << messageStream.str() << "'\n";
@@ -26,8 +26,8 @@ void E07MainloopStubImpl::sayHello(const std::shared_ptr<CommonAPI::ClientId> _c
}
void E07MainloopStubImpl::incAttrX() {
- int32_t xValue = getXAttribute();
- xValue++;
- setXAttribute((int32_t)xValue);
- std::cout << "New counter value = " << xValue << "!" << std::endl;
+ int32_t xValue = getXAttribute();
+ xValue++;
+ setXAttribute((int32_t)xValue);
+ std::cout << "New counter value = " << xValue << "!" << std::endl;
}
diff --git a/CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.hpp b/CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.hpp
index 1cd82b1..1427b31 100644
--- a/CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.hpp
+++ b/CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.hpp
@@ -8,7 +8,7 @@
#define E07MAINLOOPSTUBIMPL_H_
#include <CommonAPI/CommonAPI.hpp>
-#include <v1_0/commonapi/examples/E07MainloopStubDefault.hpp>
+#include <v1/commonapi/examples/E07MainloopStubDefault.hpp>
class E07MainloopStubImpl: public v1_0::commonapi::examples::E07MainloopStubDefault {
diff --git a/CommonAPI-Examples/E07Mainloop/vsomeip-client.json b/CommonAPI-Examples/E07Mainloop/vsomeip-client.json
index 731852a..584fdb1 100644
--- a/CommonAPI-Examples/E07Mainloop/vsomeip-client.json
+++ b/CommonAPI-Examples/E07Mainloop/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/E07Mainloop/vsomeip-local.json b/CommonAPI-Examples/E07Mainloop/vsomeip-local.json
index 641f13b..5701078 100644
--- a/CommonAPI-Examples/E07Mainloop/vsomeip-local.json
+++ b/CommonAPI-Examples/E07Mainloop/vsomeip-local.json
@@ -1,47 +1,47 @@
{
- "unicast" : "192.168.0.235",
- "logging" :
- {
- "level" : "info",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/var/log/vsomeip.log" },
- "dlt" : "false"
- },
- "applications" :
- [
- {
- "name" : "client-sample",
- "id" : "0x1343"
- },
- {
- "name" : "other-client-sample",
- "id" : "0x1344"
- },
- {
- "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"
- }
- }
- ],
- "routing" : "client-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "port" : "30490",
- "protocol" : "udp"
- }
+ "unicast" : "192.168.0.235",
+ "logging" :
+ {
+ "level" : "info",
+ "console" : "true",
+ "file" : { "enable" : "false", "path" : "/var/log/vsomeip.log" },
+ "dlt" : "false"
+ },
+ "applications" :
+ [
+ {
+ "name" : "client-sample",
+ "id" : "0x1343"
+ },
+ {
+ "name" : "other-client-sample",
+ "id" : "0x1344"
+ },
+ {
+ "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"
+ }
+ }
+ ],
+ "routing" : "client-sample",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
}
diff --git a/CommonAPI-Examples/E07Mainloop/vsomeip-service.json b/CommonAPI-Examples/E07Mainloop/vsomeip-service.json
index bd135f6..3cec46d 100644
--- a/CommonAPI-Examples/E07Mainloop/vsomeip-service.json
+++ b/CommonAPI-Examples/E07Mainloop/vsomeip-service.json
@@ -1,48 +1,48 @@
{
- "unicast" : "10.10.46.59",
- "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"
- }
- ]
- }
- ],
- "routing" : "service-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "port" : "30490",
- "protocol" : "udp"
- }
+ "unicast" : "10.10.46.59",
+ "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"
+ }
+ ]
+ }
+ ],
+ "routing" : "service-sample",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
}
diff --git a/CommonAPI-Examples/README b/CommonAPI-Examples/README
index 56f9b64..cbcf38e 100644
--- a/CommonAPI-Examples/README
+++ b/CommonAPI-Examples/README
@@ -28,7 +28,7 @@ If do not specify any configuration file it is assumed that you want to use the
* +LD_LIBRARY_PATH+ should contain the path to the _libdbus_ if you use the D-Bus binding with an uninstalled _libdbus_ and should contain the path to your gluecode libraries, e.g. +LD_LIBRARY_PATH=<path to libdbus>/dbus-1.8.20/dbus/.libs:<path to CommonAPI-Tools>/CommonAPI-Examples/E01HelloWorld/build+
-* +VSOMEIP_CONFIGURATION_FILE+ should contain the path to your vsomeip configuration file if you are using the SOME/IP binding, e.g. +VSOMEIP_CONFIGURATION_FILE=<path to CommonAPI-Tools>/CommonAPI-Examples/E01HelloWorld/vsomeip-local.json+
+* +VSOMEIP_CONFIGURATION+ should contain the path to your vsomeip configuration file if you are using the SOME/IP binding, e.g. +VSOMEIP_CONFIGURATION=<path to CommonAPI-Tools>/CommonAPI-Examples/E01HelloWorld/vsomeip-local.json+
Here are some hints if you want to configure your eclipse project for the CMake build: