diff options
Diffstat (limited to 'CommonAPI-Examples')
37 files changed, 693 insertions, 273 deletions
diff --git a/CommonAPI-Examples/E01HelloWorld/CMakeLists.txt b/CommonAPI-Examples/E01HelloWorld/CMakeLists.txt index 9971079..52e436a 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.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}") @@ -61,8 +61,8 @@ else() 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) diff --git a/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fdepl b/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fdepl index 6d43ef0..0310e23 100644 --- a/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fdepl +++ b/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fdepl @@ -29,6 +29,6 @@ define org.genivi.commonapi.someip.deployment for provider Service { SomeIpUnicastAddress = "192.168.0.2" SomeIpReliableUnicastPort = 30499 - SomeIpUneliableUnicastPort = 30499 + SomeIpUnreliableUnicastPort = 30499 } }
\ No newline at end of file diff --git a/CommonAPI-Examples/E02Attributes/CMakeLists.txt b/CommonAPI-Examples/E02Attributes/CMakeLists.txt index fccec2c..63eec7b 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.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}") @@ -61,8 +61,8 @@ else() 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) @@ -140,4 +140,4 @@ 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) +target_link_libraries(${PRJ_NAME}-someip CommonAPI-SomeIP)
\ No newline at end of file diff --git a/CommonAPI-Examples/E02Attributes/fidl/E02Attributes.fdepl b/CommonAPI-Examples/E02Attributes/fidl/E02Attributes.fdepl deleted file mode 100644 index 6ff6efd..0000000 --- a/CommonAPI-Examples/E02Attributes/fidl/E02Attributes.fdepl +++ /dev/null @@ -1,11 +0,0 @@ -/* 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.dbus/deployment/CommonAPI-DBus_deployment.fdepl" -import "E02Attributes.fidl" - -define org.genivi.commonapi.dbus.deployment for interface commonapi.examples.E02Attributes { - PropertiesType = freedesktop -}
\ No newline at end of file diff --git a/CommonAPI-Examples/E02Attributes/vsomeip-local.json b/CommonAPI-Examples/E02Attributes/vsomeip-local.json index 2f4c823..ac274e1 100644 --- a/CommonAPI-Examples/E02Attributes/vsomeip-local.json +++ b/CommonAPI-Examples/E02Attributes/vsomeip-local.json @@ -36,12 +36,38 @@ "service" : "0x1234", "instance" : "0x5678", "reliable" : { "port" : "30509", "enable-magic-cookies" : "false" }, - "unreliable" : "31000" + "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" : "client-sample", + "routing" : "service-sample", "service-discovery" : { "enable" : "true", diff --git a/CommonAPI-Examples/E03Methods/CMakeLists.txt b/CommonAPI-Examples/E03Methods/CMakeLists.txt index 30d1eb2..98b8589 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.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}") @@ -63,8 +63,8 @@ else() 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) diff --git a/CommonAPI-Examples/E03Methods/fidl/E03Methods.fdepl b/CommonAPI-Examples/E03Methods/fidl/E03Methods.fdepl deleted file mode 100644 index eb5d918..0000000 --- a/CommonAPI-Examples/E03Methods/fidl/E03Methods.fdepl +++ /dev/null @@ -1,8 +0,0 @@ -import "platform:/plugin/org.genivi.commonapi.dbus/deployment/CommonAPI-DBus_deployment.fdepl" -import "E03Methods.fidl" - -define org.genivi.commonapi.dbus.deployment for interface commonapi.examples.E03Methods { - method foo { - Timeout = 1234 - } -}
\ No newline at end of file diff --git a/CommonAPI-Examples/E03Methods/vsomeip-local.json b/CommonAPI-Examples/E03Methods/vsomeip-local.json index 2f4c823..bda9e87 100644 --- a/CommonAPI-Examples/E03Methods/vsomeip-local.json +++ b/CommonAPI-Examples/E03Methods/vsomeip-local.json @@ -36,12 +36,28 @@ "service" : "0x1234", "instance" : "0x5678", "reliable" : { "port" : "30509", "enable-magic-cookies" : "false" }, - "unreliable" : "31000" + "unreliable" : "31000", + "events" : + [ + { + "event" : "0x80F2", + "is_field" : "false", + "is_reliable" : "false", + "update-cycle" : 2000 + } + ], + "eventgroups" : + [ + { + "eventgroup" : "0x80F2", + "events" : [ "0x80F2" ] + } + ] } ] } ], - "routing" : "client-sample", + "routing" : "service-sample", "service-discovery" : { "enable" : "true", diff --git a/CommonAPI-Examples/E03Methods/vsomeip-service.json b/CommonAPI-Examples/E03Methods/vsomeip-service.json index 2ab32df..1418e71 100644 --- a/CommonAPI-Examples/E03Methods/vsomeip-service.json +++ b/CommonAPI-Examples/E03Methods/vsomeip-service.json @@ -43,12 +43,6 @@ "is_field" : "false", "is_reliable" : "false", "update-cycle" : 2000 - }, - { - "event" : "0x80F3", - "is_field" : "true", - "is_reliable" : "false", - "update-cycle" : 0 } ], "eventgroups" : @@ -56,10 +50,6 @@ { "eventgroup" : "0x80F2", "events" : [ "0x80F2" ] - }, - { - "eventgroup" : "0x80F3", - "events" : [ "0x80F3" ] } ] } diff --git a/CommonAPI-Examples/E04PhoneBook/CMakeLists.txt b/CommonAPI-Examples/E04PhoneBook/CMakeLists.txt index 81cafd7..78758de 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.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}") @@ -63,8 +63,8 @@ else() 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 +81,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_COMMONAPI_PATH}/*Stub*.cpp) FILE(GLOB PRJ_TYPES_GEN_SRCS ${PRJ_SRC_GEN_COMMONAPI_PATH}/E04PhoneBook.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 @@ -92,7 +92,7 @@ include_directories( ${Boost_INCLUDE_DIR} ) FILE(GLOB PRJ_DBUS_LIB_SRCS ${PRJ_SRC_GEN_COMMONAPI_DBUS_PATH}/*cpp ${PRJ_TYPES_GEN_SRCS}) # SOME/IP library -FILE(GLOB PRJ_SOMEIP_LIB_SRCS ${PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH}/*cpp) +FILE(GLOB PRJ_SOMEIP_LIB_SRCS ${PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH}/*cpp ${PRJ_TYPES_GEN_SRCS}) # Paths OPTION(USE_INSTALLED_DBUS "Set to OFF to use the local (patched) version of dbus" ON) @@ -141,5 +141,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/E04PhoneBook/fidl/E04PhoneBook-SomeIP.fdepl b/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook-SomeIP.fdepl index af57abc..1ca64c2 100644 --- a/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook-SomeIP.fdepl +++ b/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook-SomeIP.fdepl @@ -11,15 +11,19 @@ define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E SomeIpEventGroups = { 7000, 7001 } attribute phoneBook { - SomeIpGetterID = 7000 + SomeIpGetterID = 33000 + SomeIpSetterID = 33001 + SomeIpNotifierID = 8000 + SomeIpEventGroups = { 7000 } } method setPhoneBookDataFilter { - SomeIpMethodID = 33000 + SomeIpMethodID = 33002 } broadcast phoneBookDataSet { - SomeIpEventID = 8000 + SomeIpEventID = 8001 + SomeIpEventGroups = { 7001 } } enumeration phoneNumberEnum { diff --git a/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook.fdepl b/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook.fdepl deleted file mode 100644 index 645b37e..0000000 --- a/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook.fdepl +++ /dev/null @@ -1,112 +0,0 @@ -import "platform:/plugin/org.genivi.commonapi.dbus/deployment/CommonAPI-DBus_deployment.fdepl" -import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP_deployment_spec.fdepl" -import "E04PhoneBook.fidl" - -define org.genivi.commonapi.dbus.deployment for interface commonapi.examples.E04PhoneBook { - PropertiesType = freedesktop -} - -define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E04PhoneBook { - SomeIpServiceID = 4660 - SomeIpEventGroups = { 7000, 7001 } - - attribute phoneBook { - SomeIpGetterID = 7000 - } - - method setPhoneBookDataFilter { - SomeIpMethodID = 33000 - } - - broadcast phoneBookDataSet { - SomeIpEventID = 8000 - } - - 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" - - SomeIpInstanceID = 22136 - - SomeIpUnicastAddress = "192.168.0.2" - SomeIpUnicastPort = 30499 - } -}
\ No newline at end of file diff --git a/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp index d1b9d84..7db3313 100644 --- a/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp +++ b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp @@ -137,31 +137,41 @@ int main() { const std::string &domain = "local"; const std::string &instance = "commonapi.examples.PhoneBook"; + const std::string &connection = "client-sample"; - std::shared_ptr < E04PhoneBookProxy<> > myProxyA = runtime->buildProxy < E04PhoneBookProxy > (domain, instance); + 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"; - - std::shared_ptr < E04PhoneBookProxy<> > myProxyB = runtime->buildProxy < E04PhoneBookProxy > (domain, instance, otherConnectionId); + 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; // 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; }); + std::cout << "Subscribed A" << std::endl; + // 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; diff --git a/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookService.cpp b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookService.cpp index bece39c..020209b 100644 --- a/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookService.cpp +++ b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookService.cpp @@ -19,10 +19,12 @@ int main() { const std::string &domain = "local"; const std::string &instance = "commonapi.examples.PhoneBook"; + const std::string &connection = "service-sample"; + std::shared_ptr<E04PhoneBookStubImpl> myService = std::make_shared<E04PhoneBookStubImpl>(); myService->setPhoneBookAttribute(myService->createTestPhoneBook()); - bool successfullyRegistered = runtime->registerService(domain, instance, myService); + bool successfullyRegistered = runtime->registerService(domain, instance, myService, connection); while (!successfullyRegistered) { std::cout << "Register Service failed, trying again in 100 milliseconds..." << std::endl; diff --git a/CommonAPI-Examples/E04PhoneBook/vsomeip-client.json b/CommonAPI-Examples/E04PhoneBook/vsomeip-client.json new file mode 100644 index 0000000..f3f9cd8 --- /dev/null +++ b/CommonAPI-Examples/E04PhoneBook/vsomeip-client.json @@ -0,0 +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" + } +} diff --git a/CommonAPI-Examples/E04PhoneBook/vsomeip-local.json b/CommonAPI-Examples/E04PhoneBook/vsomeip-local.json new file mode 100644 index 0000000..d03051d --- /dev/null +++ b/CommonAPI-Examples/E04PhoneBook/vsomeip-local.json @@ -0,0 +1,80 @@ +{ + "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", + "is_field" : "true", + "update-cycle" : "0" + }, + { + "event" : "0x1F41", + "is_field" : "false", + "update-cycle" : "0" + } + ], + "eventgroups" : + [ + { + "eventgroup" : "0x1B58", + "events" : [ "0x1F40" ] + }, + { + "eventgroup" : "0x1B59", + "events" : [ "0x1F41" ] + } + ] + } + ] + } + ], + "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 new file mode 100644 index 0000000..3d05bb9 --- /dev/null +++ b/CommonAPI-Examples/E04PhoneBook/vsomeip-service.json @@ -0,0 +1,74 @@ +{ + "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", + "update-cycle" : "0" + }, + { + "event" : "0x1F41", + "is_field" : "false", + "is_reliable" : "true", + "update-cycle" : "0" + } + ], + "eventgroups" : + [ + { + "eventgroup" : "0x1B58", + "events" : [ "0x1F40" ] + }, + { + "eventgroup" : "0x1B59", + "events" : [ "0x1F41" ] + } + ] + } + ] + } + ], + "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 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" + } +} diff --git a/CommonAPI-Examples/E06Unions/CMakeLists.txt b/CommonAPI-Examples/E06Unions/CMakeLists.txt index 1b342a3..6f3f207 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.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}") @@ -63,8 +63,8 @@ else() 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) diff --git a/CommonAPI-Examples/E06Unions/vsomeip-local.json b/CommonAPI-Examples/E06Unions/vsomeip-local.json index 2f4c823..d26710c 100644 --- a/CommonAPI-Examples/E06Unions/vsomeip-local.json +++ b/CommonAPI-Examples/E06Unions/vsomeip-local.json @@ -36,12 +36,38 @@ "service" : "0x1234", "instance" : "0x5678", "reliable" : { "port" : "30509", "enable-magic-cookies" : "false" }, - "unreliable" : "31000" + "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" : "client-sample", + "routing" : "service-sample", "service-discovery" : { "enable" : "true", diff --git a/CommonAPI-Examples/E06Unions/vsomeip-service.json b/CommonAPI-Examples/E06Unions/vsomeip-service.json index 371ecf7..683f59f 100644 --- a/CommonAPI-Examples/E06Unions/vsomeip-service.json +++ b/CommonAPI-Examples/E06Unions/vsomeip-service.json @@ -32,7 +32,33 @@ "service" : "0x1234", "instance" : "0x5678", "reliable" : { "port" : "30509", "enable-magic-cookies" : "false" }, - "unreliable" : "31000" + "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" ] + } + ] } ] } diff --git a/CommonAPI-Examples/E07Mainloop/CMakeLists.txt b/CommonAPI-Examples/E07Mainloop/CMakeLists.txt index 0f54006..3249b0b 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.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}") @@ -62,8 +62,8 @@ else() 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) # GLib if (MSVC) diff --git a/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fdepl b/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fdepl index c617777..d409861 100644 --- a/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fdepl +++ b/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fdepl @@ -35,6 +35,7 @@ define org.genivi.commonapi.someip.deployment for provider Service { SomeIpInstanceID = 22136 SomeIpUnicastAddress = "192.168.0.2" - SomeIpUnicastPort = 30499 + SomeIpReliableUnicastPort = 30499 + SomeIpUnreliableUnicastPort = 30499 } }
\ No newline at end of file diff --git a/CommonAPI-Examples/E07Mainloop/src/E07MainloopClient.cpp b/CommonAPI-Examples/E07Mainloop/src/E07MainloopClient.cpp index 304255f..70873a8 100644 --- a/CommonAPI-Examples/E07Mainloop/src/E07MainloopClient.cpp +++ b/CommonAPI-Examples/E07Mainloop/src/E07MainloopClient.cpp @@ -121,7 +121,7 @@ gboolean gWatchDispatcher ( GIOChannel *source, GIOCondition condition, gpointer CommonAPI::Watch* watch = static_cast<CommonAPI::Watch*>(userData); #ifdef WIN32 - condition = static_cast<GIOCondition>(7); + condition = static_cast<GIOCondition>(POLLIN); #endif watch->dispatch(condition); diff --git a/CommonAPI-Examples/E07Mainloop/src/E07MainloopService.cpp b/CommonAPI-Examples/E07Mainloop/src/E07MainloopService.cpp index 17e7eb7..86be1aa 100644 --- a/CommonAPI-Examples/E07Mainloop/src/E07MainloopService.cpp +++ b/CommonAPI-Examples/E07Mainloop/src/E07MainloopService.cpp @@ -72,7 +72,7 @@ gboolean gWatchDispatcher ( GIOChannel *source, GIOCondition condition, gpointer CommonAPI::Watch* watch = static_cast<CommonAPI::Watch*>(userData); #ifdef WIN32 - condition = static_cast<GIOCondition>(7); + condition = static_cast<GIOCondition>(POLLIN); #endif watch->dispatch(condition); diff --git a/CommonAPI-Examples/E07Mainloop/vsomeip-client.json b/CommonAPI-Examples/E07Mainloop/vsomeip-client.json new file mode 100644 index 0000000..731852a --- /dev/null +++ b/CommonAPI-Examples/E07Mainloop/vsomeip-client.json @@ -0,0 +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" + } +} diff --git a/CommonAPI-Examples/E07Mainloop/vsomeip.json b/CommonAPI-Examples/E07Mainloop/vsomeip-local.json index 641f13b..641f13b 100644 --- a/CommonAPI-Examples/E07Mainloop/vsomeip.json +++ b/CommonAPI-Examples/E07Mainloop/vsomeip-local.json diff --git a/CommonAPI-Examples/E01HelloWorld/vsomeip.json b/CommonAPI-Examples/E07Mainloop/vsomeip-service.json index 60c2f12..bd135f6 100644 --- a/CommonAPI-Examples/E01HelloWorld/vsomeip.json +++ b/CommonAPI-Examples/E07Mainloop/vsomeip-service.json @@ -1,5 +1,5 @@ { - "unicast" : "192.168.56.101", + "unicast" : "10.10.46.59", "logging" : { "level" : "debug", @@ -10,14 +10,6 @@ "applications" : [ { - "name" : "client-sample", - "id" : "0x1343" - }, - { - "name" : "other-client-sample", - "id" : "0x1344" - }, - { "name" : "service-sample", "id" : "0x1277" } @@ -41,17 +33,11 @@ "instance" : "0x5678", "reliable" : { "port" : "30509", "enable-magic-cookies" : "false" }, "unreliable" : "31000" - }, - { - "service" : "0x1235", - "instance" : "0x5678", - "reliable" : { "port" : "30506", "enable-magic-cookies" : false }, - "unreliable" : "31000" } ] } ], - "routing" : "client-sample", + "routing" : "service-sample", "service-discovery" : { "enable" : "true", diff --git a/CommonAPI-Examples/README b/CommonAPI-Examples/README index 8425ed4..56f9b64 100644 --- a/CommonAPI-Examples/README +++ b/CommonAPI-Examples/README @@ -6,24 +6,45 @@ The examples provide a more or less generic CMake file for building the executab ---- $ cd build -$ cmake -D USE_INSTALLED_COMMONAPI=ON/OFF .. +$ cmake -DUSE_INSTALLED_COMMONAPI=ON/OFF .. $ make ---- -Set USE_INSTALLED_COMMONAPI to ON if you use an installed version of CommonAPI; set it to OFF if you use working copy. +Set +USE_INSTALLED_COMMONAPI+ to +ON+ if you use an installed version of CommonAPI; set it to +OFF+ if you use the working copy. + +In case you are using the D-Bus binding and you have not installed the patched D-Bus library (_libdbus_) it might be necessary to set a D-Bus specific option: + +---- +cmake -DUSE_INSTALLED_COMMONAPI=OFF -DUSE_INSTALLED_DBUS=OFF .. +---- + +Please read also the chapters in the user guide about the configuration files. One possibility to specify the path to the CommonAPI configuration file is to set the environment variable: + +---- +export COMMONAPI_CONFIG=<path to CommonAPI-Examples>/E01HelloWorld/commonapi4dbus.ini +---- + +If do not specify any configuration file it is assumed that you want to use the D-Bus binding. Other environment variables you might need are: + +* +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+ Here are some hints if you want to configure your eclipse project for the CMake build: - Install the CMakeEd plug-in which provides an editor for CMake files (http://cmakeed.sourceforge.net/eclipse/). -- Create a build directory (eg /build) directly in the project directory. +- Create a build directory (e.g. /build) directly in the project directory. - Select the projects properties, then C/C++ build and set the Build Command to your make call: + ---- make -C ${ProjDirPath}/build VERBOSE=1 ---- -The Build Directory must be empty. Create a make target (eg via Window->Show View->Make Target). Set the build command to: +The build directory must be empty. Create a make target (e.g. via _Window->Show View->Make Target_). Set the build command to: ---- -cmake -E chdir build/ cmake .. +cmake -E chdir build/ cmake <options> .. ---- +The above described environment variables you could specify in the _Run Configuration_ of your executable files (cleint and service). + |