summaryrefslogtreecommitdiff
path: root/CommonAPI-Examples/E05Manager
diff options
context:
space:
mode:
Diffstat (limited to 'CommonAPI-Examples/E05Manager')
-rw-r--r--CommonAPI-Examples/E05Manager/CMakeLists.txt52
-rw-r--r--CommonAPI-Examples/E05Manager/commonapi4dbus.ini8
-rw-r--r--CommonAPI-Examples/E05Manager/commonapi4someip.ini8
-rw-r--r--CommonAPI-Examples/E05Manager/fidl/E05Manager.fdepl65
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp4
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05ManagerService.cpp10
-rw-r--r--CommonAPI-Examples/E05Manager/vsomeip-client.json26
-rw-r--r--CommonAPI-Examples/E05Manager/vsomeip-local.json83
-rw-r--r--CommonAPI-Examples/E05Manager/vsomeip-service.json79
9 files changed, 284 insertions, 51 deletions
diff --git a/CommonAPI-Examples/E05Manager/CMakeLists.txt b/CommonAPI-Examples/E05Manager/CMakeLists.txt
index ba18ba5..c3d2a88 100644
--- a/CommonAPI-Examples/E05Manager/CMakeLists.txt
+++ b/CommonAPI-Examples/E05Manager/CMakeLists.txt
@@ -1,6 +1,4 @@
-# Copyright (C) 2014, 2015 BMW Group
-# Author: Manfred Bathelt (manfred.bathelt@bmw.de)
-# Author: Juergen Gehring (juergen.gehring@bmw.de)
+# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
@@ -16,7 +14,7 @@ if (MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS /EHsc /wd\\\"4503\\\"")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS /wd\\\"4503\\\"")
else()
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wall -O0 -std=c++0x -D_GLIBCXX_USE_NANOSLEEP")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wall -O0 -std=c++0x -D_GLIBCXX_USE_NANOSLEEP -DLINUX")
endif()
message(STATUS "Compiler options: ${CMAKE_CXX_FLAGS}")
@@ -31,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.2 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
- FIND_PACKAGE(CommonAPI-DBus 3.1.2 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+ 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)
else()
- FIND_PACKAGE(CommonAPI 3.1.2 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
- FIND_PACKAGE(CommonAPI-DBus 3.1.2 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+ 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)
endif()
message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
@@ -48,23 +46,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.2 REQUIRED)
-find_package (vsomeip 1.2.0 REQUIRED)
+find_package (CommonAPI-SomeIP 3.1.3 REQUIRED)
+find_package (vsomeip 1.3.0 REQUIRED)
# Source Files
set(PRJ_SRC_PATH src)
@@ -81,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_STUB_IMPL_SRCS ${PRJ_SRC_PATH}/*Stub*.cpp)
set(PRJ_CLIENT_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_CLIENT}.cpp ${PRJ_PROXY_GEN_SRCS})
-set(PRJ_SERVICE_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_SERVICE}.cpp ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_IMPL_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})
# Boost
find_package( Boost 1.54 COMPONENTS system thread log REQUIRED )
@@ -99,7 +97,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}
@@ -113,7 +111,7 @@ link_directories(
${COMMONAPI_LIBDIR}
${COMMONAPI_DBUS_LIBDIR}
${COMMONAPI_SOMEIP_CMAKE_DIR}/build
- ${Boost_LIBRARY_DIR}
+ ${Boost_LIBRARY_DIR}
)
else()
link_directories(
@@ -125,7 +123,7 @@ link_directories(
)
endif()
-set(LINK_LIBRARIES -Wl,--no-as-needed CommonAPI-DBus -Wl,--as-needed CommonAPI ${DBUS_LIBRARIES})
+set(LINK_LIBRARIES -Wl,--as-needed CommonAPI)
# Build Client
add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS})
@@ -140,5 +138,5 @@ add_library (${PRJ_NAME}-dbus SHARED ${PRJ_DBUS_LIB_SRCS})
target_link_libraries(${PRJ_NAME}-dbus CommonAPI-DBus)
# Build SOME/IP library
-#add_library (${PRJ_NAME}-someip SHARED ${PRJ_SOMEIP_LIB_SRCS})
-#target_link_libraries(${PRJ_NAME}-someip CommonAPI-SomeIP)
+add_library (${PRJ_NAME}-someip SHARED ${PRJ_SOMEIP_LIB_SRCS})
+target_link_libraries(${PRJ_NAME}-someip CommonAPI-SomeIP)
diff --git a/CommonAPI-Examples/E05Manager/commonapi4dbus.ini b/CommonAPI-Examples/E05Manager/commonapi4dbus.ini
new file mode 100644
index 0000000..a1de883
--- /dev/null
+++ b/CommonAPI-Examples/E05Manager/commonapi4dbus.ini
@@ -0,0 +1,8 @@
+[default]
+binding=dbus
+
+[logging]
+console = true
+file = ./mylog.log
+dlt = false
+level = verbose
diff --git a/CommonAPI-Examples/E05Manager/commonapi4someip.ini b/CommonAPI-Examples/E05Manager/commonapi4someip.ini
new file mode 100644
index 0000000..53209ee
--- /dev/null
+++ b/CommonAPI-Examples/E05Manager/commonapi4someip.ini
@@ -0,0 +1,8 @@
+[default]
+binding=someip
+
+[logging]
+console = true
+file = ./mylog.log
+dlt = false
+level = verbose
diff --git a/CommonAPI-Examples/E05Manager/fidl/E05Manager.fdepl b/CommonAPI-Examples/E05Manager/fidl/E05Manager.fdepl
index 5befa32..628f18a 100644
--- a/CommonAPI-Examples/E05Manager/fidl/E05Manager.fdepl
+++ b/CommonAPI-Examples/E05Manager/fidl/E05Manager.fdepl
@@ -1,50 +1,79 @@
-/* Copyright (C) 2014 BMW Group
+/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
+
import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP_deployment_spec.fdepl"
import "E05Manager.fidl"
define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E05Manager {
SomeIpServiceID = 4660
- SomeIpEventGroups = { 7000, 7001 }
attribute myDevices {
- SomeIpGetterID = 7000
- SomeIpSetterID = 7004
+ 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
+ }
}
define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E05Device {
SomeIpServiceID = 4661
- SomeIpEventGroups = { 7000, 7001 }
method doSomething {
- SomeIpMethodID = 7001
+ 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
}
+}
+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
+ }
}
define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E05SpecialDevice {
SomeIpServiceID = 4662
- SomeIpEventGroups = { 7000, 7001 }
method doSomethingSpecial {
- SomeIpMethodID = 7002
+ SomeIpMethodID = 33002
}
-
}
define org.genivi.commonapi.someip.deployment for provider Service {
- instance commonapi.examples.E04PhoneBook {
- InstanceId = "commonapi.examples.PhoneBook"
-
- SomeIpInstanceID = 22136
+ instance commonapi.examples.E05SpecialDevice {
+ InstanceId = "commonapi.examples.Manager.specialDevice00"
+
+ SomeIpInstanceID = 3000
- SomeIpUnicastAddress = "192.168.0.2"
- SomeIpReliableUnicastPort = 30500
- SomeIpUnreliableUnicastPort = 30501
+ SomeIpUnicastAddress = "127.0.0.1"
+ SomeIpUnreliableUnicastPort = 30600
+ }
}
-} \ No newline at end of file
diff --git a/CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp b/CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp
index 983601c..51c7d57 100644
--- a/CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp
+++ b/CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp
@@ -34,7 +34,9 @@ int main() {
const std::string &domain = "local";
const std::string &instance = "commonapi.examples.Manager";
- std::shared_ptr<E05ManagerProxy<>> myProxy = runtime->buildProxy<E05ManagerProxy>(domain, instance);
+ const std::string connectionIdClient = "client-sample";
+
+ std::shared_ptr<E05ManagerProxy<>> myProxy = runtime->buildProxy<E05ManagerProxy>(domain, instance, connectionIdClient);
while (!myProxy->isAvailable()) {
usleep(10);
}
diff --git a/CommonAPI-Examples/E05Manager/src/E05ManagerService.cpp b/CommonAPI-Examples/E05Manager/src/E05ManagerService.cpp
index c32faa0..a1626c3 100644
--- a/CommonAPI-Examples/E05Manager/src/E05ManagerService.cpp
+++ b/CommonAPI-Examples/E05Manager/src/E05ManagerService.cpp
@@ -16,20 +16,20 @@ using namespace v1_0::commonapi::examples;
static unsigned int cnt = 0; // counter for simulating external events
const static unsigned int maxDeviceNumber = 3;
const static std::string managerInstanceName = "commonapi.examples.Manager";
+const std::string connectionIdService = "service-sample";
int main() {
- CommonAPI::Runtime::setProperty("LogContext", "E05S");
- CommonAPI::Runtime::setProperty("LibraryBase", "E05Manager");
-
+ CommonAPI::Runtime::setProperty("LogContext", "E05S");
+ CommonAPI::Runtime::setProperty("LibraryBase", "E05Manager");
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);
+ 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);
+ successfullyRegistered = runtime->registerService("local", managerInstanceName, myService, connectionIdService);
}
std::cout << "Successfully Registered Service!" << std::endl;
diff --git a/CommonAPI-Examples/E05Manager/vsomeip-client.json b/CommonAPI-Examples/E05Manager/vsomeip-client.json
new file mode 100644
index 0000000..628509d
--- /dev/null
+++ b/CommonAPI-Examples/E05Manager/vsomeip-client.json
@@ -0,0 +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"
+ }
+}
diff --git a/CommonAPI-Examples/E05Manager/vsomeip-local.json b/CommonAPI-Examples/E05Manager/vsomeip-local.json
new file mode 100644
index 0000000..9e94d50
--- /dev/null
+++ b/CommonAPI-Examples/E05Manager/vsomeip-local.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/E05Manager/vsomeip-service.json b/CommonAPI-Examples/E05Manager/vsomeip-service.json
new file mode 100644
index 0000000..5e1a4b0
--- /dev/null
+++ b/CommonAPI-Examples/E05Manager/vsomeip-service.json
@@ -0,0 +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"
+ }
+}