summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürgen Gehring <juergen.gehring@bmw.de>2015-06-02 03:18:57 -0700
committerJürgen Gehring <juergen.gehring@bmw.de>2015-06-02 03:18:57 -0700
commit1d9ae05afdc4341622d1720138d2bc781ee78144 (patch)
tree57262885d7c2822a493d0c5f13b0ec60efc15ce3
parent31f1941b5e8c115dfc11a1a17ce8bcb156e7b751 (diff)
downloadgenivi-common-api-runtime-1d9ae05afdc4341622d1720138d2bc781ee78144.tar.gz
CommonAPI-Tools 3.1.13.1.1
-rw-r--r--.gitignore6
-rw-r--r--AUTHORS1
-rw-r--r--CommonAPI-Examples/.cproject42
-rw-r--r--CommonAPI-Examples/.gitignore5
-rw-r--r--CommonAPI-Examples/.project33
-rw-r--r--CommonAPI-Examples/AUTHORS2
-rw-r--r--CommonAPI-Examples/E01HelloWorld/.cproject71
-rw-r--r--CommonAPI-Examples/E01HelloWorld/.gitignore2
-rw-r--r--CommonAPI-Examples/E01HelloWorld/.project33
-rw-r--r--CommonAPI-Examples/E01HelloWorld/CMakeLists.txt141
-rw-r--r--CommonAPI-Examples/E01HelloWorld/README150
-rw-r--r--CommonAPI-Examples/E01HelloWorld/commonapi4dbus.ini8
-rw-r--r--CommonAPI-Examples/E01HelloWorld/commonapi4someip.ini8
-rw-r--r--CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fdepl32
-rw-r--r--CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fidl (renamed from CommonAPI-Examples/e01HelloWorld/fidl/E01HelloWorld.fidl)4
-rw-r--r--CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldClient.cpp56
-rw-r--r--CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldService.cpp33
-rw-r--r--CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.cpp24
-rw-r--r--CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.hpp (renamed from CommonAPI-Examples/e01HelloWorld/src/E01HelloWorldStubImpl.h)13
-rw-r--r--CommonAPI-Examples/E01HelloWorld/vsomeip.json62
-rw-r--r--CommonAPI-Examples/E02Attributes/.cproject66
-rw-r--r--CommonAPI-Examples/E02Attributes/.gitignore (renamed from CommonAPI-Examples/e01HelloWorld/.gitignore)0
-rw-r--r--CommonAPI-Examples/E02Attributes/.project33
-rw-r--r--CommonAPI-Examples/E02Attributes/CMakeLists.txt103
-rw-r--r--CommonAPI-Examples/E02Attributes/README131
-rw-r--r--CommonAPI-Examples/E02Attributes/fidl/E02Attributes.fdepl11
-rw-r--r--CommonAPI-Examples/E02Attributes/fidl/E02Attributes.fidl (renamed from CommonAPI-Examples/e02Attributes/fidl/E02Attributes.fidl)9
-rw-r--r--CommonAPI-Examples/E02Attributes/src/AttributeCacheExtension.hpp (renamed from CommonAPI-Examples/e02Attributes/src/AttributeCacheExtension.hpp)6
-rw-r--r--CommonAPI-Examples/E02Attributes/src/E02AttributesClient.cpp (renamed from CommonAPI-Examples/e02Attributes/src/e02AttributesClient.cpp)63
-rw-r--r--CommonAPI-Examples/E02Attributes/src/E02AttributesService.cpp (renamed from CommonAPI-Examples/e02Attributes/src/e02AttributesService.cpp)19
-rw-r--r--CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.cpp (renamed from CommonAPI-Examples/e02Attributes/src/E02AttributesStubImpl.cpp)6
-rw-r--r--CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.hpp (renamed from CommonAPI-Examples/e02Attributes/src/E02AttributesStubImpl.h)10
-rw-r--r--CommonAPI-Examples/E03Methods/.cproject66
-rw-r--r--CommonAPI-Examples/E03Methods/.gitignore (renamed from CommonAPI-Examples/e02Attributes/.gitignore)0
-rw-r--r--CommonAPI-Examples/E03Methods/.project33
-rw-r--r--CommonAPI-Examples/E03Methods/CMakeLists.txt105
-rw-r--r--CommonAPI-Examples/E03Methods/README (renamed from CommonAPI-Examples/e03Methods/README)85
-rw-r--r--CommonAPI-Examples/E03Methods/fidl/E03Methods.fdepl8
-rw-r--r--CommonAPI-Examples/E03Methods/fidl/E03Methods.fidl (renamed from CommonAPI-Examples/e03Methods/fidl/E03Methods.fidl)2
-rw-r--r--CommonAPI-Examples/E03Methods/src/E03MethodsClient.cpp (renamed from CommonAPI-Examples/e03Methods/src/e03MethodsClient.cpp)25
-rw-r--r--CommonAPI-Examples/E03Methods/src/E03MethodsService.cpp (renamed from CommonAPI-Examples/e03Methods/src/e03MethodsService.cpp)16
-rw-r--r--CommonAPI-Examples/E03Methods/src/E03MethodsStubImpl.cpp (renamed from CommonAPI-Examples/e03Methods/src/E03MethodsStubImpl.cpp)22
-rw-r--r--CommonAPI-Examples/E03Methods/src/E03MethodsStubImpl.hpp (renamed from CommonAPI-Examples/e03Methods/src/E03MethodsStubImpl.h)17
-rw-r--r--CommonAPI-Examples/E04PhoneBook/.cproject70
-rw-r--r--CommonAPI-Examples/E04PhoneBook/.gitignore (renamed from CommonAPI-Examples/e03Methods/.gitignore)0
-rw-r--r--CommonAPI-Examples/E04PhoneBook/.project33
-rw-r--r--CommonAPI-Examples/E04PhoneBook/CMakeLists.txt90
-rw-r--r--CommonAPI-Examples/E04PhoneBook/README219
-rw-r--r--CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook.fdepl112
-rw-r--r--CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook.fidl (renamed from CommonAPI-Examples/e04PhoneBook/fidl/E04PhoneBook.fidl)3
-rw-r--r--CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp (renamed from CommonAPI-Examples/e04PhoneBook/src/e04PhoneBookClient.cpp)59
-rw-r--r--CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookService.cpp (renamed from CommonAPI-Examples/e04PhoneBook/src/e04PhoneBookService.cpp)14
-rw-r--r--CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.cpp (renamed from CommonAPI-Examples/e04PhoneBook/src/E04PhoneBookStubImpl.cpp)112
-rw-r--r--CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.h (renamed from CommonAPI-Examples/e04PhoneBook/src/E04PhoneBookStubImpl.h)15
-rw-r--r--CommonAPI-Examples/E05Manager/.cproject66
-rw-r--r--CommonAPI-Examples/E05Manager/.gitignore (renamed from CommonAPI-Examples/e04PhoneBook/.gitignore)0
-rw-r--r--CommonAPI-Examples/E05Manager/.project27
-rw-r--r--CommonAPI-Examples/E05Manager/CMakeLists.txt90
-rw-r--r--CommonAPI-Examples/E05Manager/README125
-rw-r--r--CommonAPI-Examples/E05Manager/fidl/E05Manager.fidl (renamed from CommonAPI-Examples/e05Manager/fidl/E05Manager.fidl)0
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.cpp (renamed from CommonAPI-Examples/e05Manager/src/E05DeviceStubImpl.cpp)2
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.h (renamed from CommonAPI-Examples/e05Manager/src/E05DeviceStubImpl.h)4
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp (renamed from CommonAPI-Examples/e05Manager/src/e05ManagerClient.cpp)17
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05ManagerService.cpp (renamed from CommonAPI-Examples/e05Manager/src/e05ManagerService.cpp)13
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05ManagerStubImpl.cpp (renamed from CommonAPI-Examples/e05Manager/src/E05ManagerStubImpl.cpp)2
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05ManagerStubImpl.h (renamed from CommonAPI-Examples/e05Manager/src/E05ManagerStubImpl.h)6
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.cpp (renamed from CommonAPI-Examples/e05Manager/src/E05SpecialDeviceStubImpl.cpp)2
-rw-r--r--CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.h (renamed from CommonAPI-Examples/e05Manager/src/E05SpecialDeviceStubImpl.h)4
-rw-r--r--CommonAPI-Examples/E06Unions/.cproject66
-rw-r--r--CommonAPI-Examples/E06Unions/.gitignore (renamed from CommonAPI-Examples/e05Manager/.gitignore)0
-rw-r--r--CommonAPI-Examples/E06Unions/.project33
-rw-r--r--CommonAPI-Examples/E06Unions/CMakeLists.txt90
-rw-r--r--CommonAPI-Examples/E06Unions/README (renamed from CommonAPI-Examples/e06Unions/README)84
-rw-r--r--CommonAPI-Examples/E06Unions/fidl/E06Unions.fidl (renamed from CommonAPI-Examples/e06Unions/fidl/E06Unions.fidl)3
-rw-r--r--CommonAPI-Examples/E06Unions/src/E06UnionsClient.cpp (renamed from CommonAPI-Examples/e06Unions/src/e06UnionsClient.cpp)24
-rw-r--r--CommonAPI-Examples/E06Unions/src/E06UnionsService.cpp34
-rw-r--r--CommonAPI-Examples/E06Unions/src/E06UnionsStubImpl.cpp (renamed from CommonAPI-Examples/e06Unions/src/E06UnionsStubImpl.cpp)3
-rw-r--r--CommonAPI-Examples/E06Unions/src/E06UnionsStubImpl.h (renamed from CommonAPI-Examples/e06Unions/src/E06UnionsStubImpl.h)5
-rw-r--r--CommonAPI-Examples/E06Unions/src/typeUtils.hpp (renamed from CommonAPI-Examples/e06Unions/src/typeUtils.hpp)0
-rw-r--r--CommonAPI-Examples/E07Mainloop/.cproject71
-rw-r--r--CommonAPI-Examples/E07Mainloop/.gitignore2
-rw-r--r--CommonAPI-Examples/E07Mainloop/.project33
-rw-r--r--CommonAPI-Examples/E07Mainloop/CMakeLists.txt125
-rw-r--r--CommonAPI-Examples/E07Mainloop/README6
-rw-r--r--CommonAPI-Examples/E07Mainloop/commonapi4dbus.ini8
-rw-r--r--CommonAPI-Examples/E07Mainloop/commonapi4someip.ini8
-rw-r--r--CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fdepl40
-rw-r--r--CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fidl22
-rw-r--r--CommonAPI-Examples/E07Mainloop/src/E07MainloopClient.cpp196
-rw-r--r--CommonAPI-Examples/E07Mainloop/src/E07MainloopService.cpp140
-rw-r--r--CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.cpp33
-rw-r--r--CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.hpp24
-rw-r--r--CommonAPI-Examples/E07Mainloop/vsomeip.json47
-rw-r--r--CommonAPI-Examples/README26
-rw-r--r--CommonAPI-Examples/e01HelloWorld/CMakeLists.txt71
-rw-r--r--CommonAPI-Examples/e01HelloWorld/README5
-rw-r--r--CommonAPI-Examples/e01HelloWorld/src/E01HelloWorldStubImpl.cpp25
-rw-r--r--CommonAPI-Examples/e01HelloWorld/src/e01HelloWorldClient.cpp39
-rw-r--r--CommonAPI-Examples/e01HelloWorld/src/e01HelloWorldService.cpp31
-rw-r--r--CommonAPI-Examples/e02Attributes/CMakeLists.txt71
-rw-r--r--CommonAPI-Examples/e02Attributes/README170
-rw-r--r--CommonAPI-Examples/e03Methods/CMakeLists.txt71
-rw-r--r--CommonAPI-Examples/e04PhoneBook/CMakeLists.txt72
-rw-r--r--CommonAPI-Examples/e04PhoneBook/README237
-rw-r--r--CommonAPI-Examples/e05Manager/CMakeLists.txt72
-rw-r--r--CommonAPI-Examples/e05Manager/README135
-rw-r--r--CommonAPI-Examples/e06Unions/.gitignore2
-rw-r--r--CommonAPI-Examples/e06Unions/CMakeLists.txt71
-rw-r--r--CommonAPI-Examples/e06Unions/src/e06UnionsService.cpp37
-rw-r--r--CommonAPI-Ping/.gitignore26
-rw-r--r--CommonAPI-Ping/Makefile.am71
-rw-r--r--CommonAPI-Ping/configure.ac40
-rw-r--r--CommonAPI-Ping/m4/ax_cxx_compile_stdcxx_11.m4107
-rw-r--r--CommonAPI-Ping/src/Benchmark.cpp261
-rw-r--r--CommonAPI-Ping/src/Benchmark.h69
-rw-r--r--CommonAPI-Ping/src/BenchmarkStats.cpp119
-rw-r--r--CommonAPI-Ping/src/BenchmarkStats.h70
-rw-r--r--CommonAPI-Ping/src/Ping.fidl34
-rw-r--r--CommonAPI-Ping/src/PingClient.cpp112
-rw-r--r--CommonAPI-Ping/src/PingService.cpp44
-rw-r--r--INSTALL34
-rw-r--r--LICENSE (renamed from CommonAPI-Ping/LICENSE)0
-rw-r--r--NEWS23
-rw-r--r--README138
-rw-r--r--docx/.cproject42
-rw-r--r--docx/.gitignore1
-rw-r--r--docx/.project27
-rw-r--r--docx/CommonAPICppSpecification1152
-rw-r--r--docx/CommonAPICppUserGuide903
-rw-r--r--docx/CommonAPISpecification1080
-rw-r--r--docx/Makefile26
-rw-r--r--docx/Tutorial705
-rwxr-xr-xdocx/images/AsynchronousStubs.pngbin0 -> 11385 bytes
-rwxr-xr-xdocx/images/CommonAPIOverview01.pngbin0 -> 19741 bytes
-rwxr-xr-xdocx/images/CommonAPIOverview02.pngbin0 -> 33677 bytes
-rwxr-xr-xdocx/images/CommonAPIStructuringLibraries.pngbin0 -> 29780 bytes
-rwxr-xr-xdocx/images/CommonAPIWorkflow.pngbin0 -> 26383 bytes
-rwxr-xr-xdocx/images/Diag_Attributes.pngbin18429 -> 21779 bytes
-rwxr-xr-xdocx/images/Diag_GeneratedProxy.pngbin16965 -> 17713 bytes
-rwxr-xr-xdocx/images/Diag_GeneratedStub.pngbin66369 -> 55589 bytes
-rwxr-xr-xdocx/images/EclipseBuildToolsSettings.pngbin0 -> 109885 bytes
-rw-r--r--docx/images/EclipseCommonAPISettings01.pngbin0 -> 87881 bytes
-rw-r--r--docx/mainpagetests/01_mainpage.dox5
-rw-r--r--org.genivi.commonapi.cli.product/.project2
-rw-r--r--org.genivi.commonapi.cli.product/commonapi_cli.product155
-rw-r--r--org.genivi.commonapi.cli.product/commonapi_console.product47
-rw-r--r--org.genivi.commonapi.cli.product/pom.xml205
-rw-r--r--org.genivi.commonapi.console.feature/.gitignore (renamed from org.genivi.commonapi.cli.product/.gitignore)1
-rw-r--r--org.genivi.commonapi.console.feature/.project17
-rw-r--r--org.genivi.commonapi.console.feature/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.genivi.commonapi.console.feature/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.genivi.commonapi.console.feature/build.properties2
-rw-r--r--org.genivi.commonapi.console.feature/feature.xml94
-rw-r--r--org.genivi.commonapi.console.feature/pom.xml (renamed from org.genivi.commonapi.updatesite/pom.xml)6
-rw-r--r--org.genivi.commonapi.console.franca.feature/.gitignore (renamed from org.genivi.commonapi.updatesite/.gitignore)1
-rw-r--r--org.genivi.commonapi.console.franca.feature/.project17
-rw-r--r--org.genivi.commonapi.console.franca.feature/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.genivi.commonapi.console.franca.feature/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.genivi.commonapi.console.franca.feature/build.properties2
-rw-r--r--org.genivi.commonapi.console.franca.feature/feature.xml287
-rw-r--r--org.genivi.commonapi.console.franca.feature/pom.xml (renamed from org.genivi.commonapi.target/pom.xml)6
-rw-r--r--org.genivi.commonapi.console/.classpath7
-rw-r--r--org.genivi.commonapi.console/.gitignore2
-rw-r--r--org.genivi.commonapi.console/.project28
-rw-r--r--org.genivi.commonapi.console/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.genivi.commonapi.console/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.genivi.commonapi.console/.settings/org.eclipse.jdt.core.prefs13
-rw-r--r--org.genivi.commonapi.console/.settings/org.eclipse.jdt.launching.prefs2
-rw-r--r--org.genivi.commonapi.console/META-INF/MANIFEST.MF16
-rw-r--r--org.genivi.commonapi.console/about.mappings3
-rw-r--r--org.genivi.commonapi.console/build.properties8
-rw-r--r--org.genivi.commonapi.console/plugin.xml85
-rw-r--r--org.genivi.commonapi.console/pom.xml15
-rw-r--r--org.genivi.commonapi.console/schema/commands.exsd181
-rw-r--r--org.genivi.commonapi.console/schema/optionGroups.exsd134
-rw-r--r--org.genivi.commonapi.console/schema/options.exsd394
-rw-r--r--org.genivi.commonapi.console/src/org/genivi/commonapi/console/AbstractCommandLineHandler.java66
-rw-r--r--org.genivi.commonapi.console/src/org/genivi/commonapi/console/CommandExecuter.java611
-rw-r--r--org.genivi.commonapi.console/src/org/genivi/commonapi/console/ConsoleLogger.java43
-rw-r--r--org.genivi.commonapi.console/src/org/genivi/commonapi/console/ICommandLineHandler.java21
-rw-r--r--org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/Activator.java150
-rw-r--r--org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/Application.java51
-rw-r--r--org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/HelpCommandHandler.java23
-rw-r--r--org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/VersionCommandHandler.java91
-rw-r--r--org.genivi.commonapi.core.cli.feature/.gitignore1
-rw-r--r--org.genivi.commonapi.core.cli.feature/.project2
-rw-r--r--org.genivi.commonapi.core.cli.feature/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.genivi.commonapi.core.cli.feature/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.genivi.commonapi.core.cli.feature/build.properties1
-rw-r--r--org.genivi.commonapi.core.cli.feature/feature.xml481
-rw-r--r--org.genivi.commonapi.core.cli.feature/pom.xml8
-rw-r--r--org.genivi.commonapi.core.cli.product/.gitignore2
-rw-r--r--org.genivi.commonapi.core.cli.product/.project11
-rw-r--r--org.genivi.commonapi.core.cli.product/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.genivi.commonapi.core.cli.product/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.genivi.commonapi.core.cli.product/category.xml14
-rw-r--r--org.genivi.commonapi.core.cli.product/commonapi_console.product47
-rw-r--r--org.genivi.commonapi.core.cli.product/pom.xml131
-rw-r--r--org.genivi.commonapi.core.cli.product/zip.excludes5
-rw-r--r--org.genivi.commonapi.core.cli/.classpath8
-rw-r--r--org.genivi.commonapi.core.cli/.gitignore11
-rw-r--r--org.genivi.commonapi.core.cli/.project2
-rw-r--r--org.genivi.commonapi.core.cli/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.genivi.commonapi.core.cli/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.genivi.commonapi.core.cli/META-INF/MANIFEST.MF21
-rw-r--r--org.genivi.commonapi.core.cli/plugin.xml118
-rw-r--r--org.genivi.commonapi.core.cli/pom.xml8
-rw-r--r--org.genivi.commonapi.core.cli/src/.gitignore1
-rw-r--r--org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/Application.java54
-rw-r--r--org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandExecutableExtensionFactory.java51
-rw-r--r--org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandLineHandler.java124
-rw-r--r--org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandlineToolMain.java1041
-rw-r--r--org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/DBusCommandExecutableExtensionFactory.java28
-rw-r--r--org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/DeployStandaloneSetup.java40
-rw-r--r--org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/FrancaResourceFactory.java48
-rw-r--r--org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/MyProviderXtext.java28
-rw-r--r--org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/MyURIConverter.java36
-rw-r--r--org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/StandaloneSetup.java43
-rw-r--r--org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/TestModule.java29
-rw-r--r--org.genivi.commonapi.core.feature/.gitignore1
-rw-r--r--org.genivi.commonapi.core.feature/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.genivi.commonapi.core.feature/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.genivi.commonapi.core.feature/build.properties1
-rw-r--r--org.genivi.commonapi.core.feature/feature.xml21
-rw-r--r--org.genivi.commonapi.core.feature/pom.xml8
-rw-r--r--org.genivi.commonapi.core.releng/.gitignore1
-rw-r--r--org.genivi.commonapi.core.releng/.project (renamed from org.genivi.commonapi.target/.project)2
-rw-r--r--org.genivi.commonapi.core.releng/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.genivi.commonapi.core.releng/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.genivi.commonapi.core.releng/pom.xml28
-rw-r--r--org.genivi.commonapi.core.target/.gitignore1
-rw-r--r--org.genivi.commonapi.core.target/.project (renamed from org.genivi.commonapi.updatesite/.project)2
-rw-r--r--org.genivi.commonapi.core.target/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.genivi.commonapi.core.target/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.genivi.commonapi.core.target/org.genivi.commonapi.core.target.target24
-rw-r--r--org.genivi.commonapi.core.target/pom.xml13
-rw-r--r--org.genivi.commonapi.core.tests/.gitignore22
-rw-r--r--org.genivi.commonapi.core.tests/LICENSE373
-rw-r--r--org.genivi.commonapi.core.tests/Makefile.am61
-rw-r--r--org.genivi.commonapi.core.tests/configure.ac88
-rw-r--r--org.genivi.commonapi.core.tests/m4/ax_cxx_compile_stdcxx_11.m4107
-rw-r--r--org.genivi.commonapi.core.tests/src/commonapi-mock.h27
-rw-r--r--org.genivi.commonapi.core.tests/src/gmock.h113
-rw-r--r--org.genivi.commonapi.core.tests/src/test-derived-types.cpp15
-rw-r--r--org.genivi.commonapi.core.tests/src/test-derived-types.fidl71
-rw-r--r--org.genivi.commonapi.core.tests/src/test-interface-proxy.cpp240
-rw-r--r--org.genivi.commonapi.core.tests/src/test-interface-proxy.fidl70
-rw-r--r--org.genivi.commonapi.core.tests/src/test-interface-proxy.h90
-rw-r--r--org.genivi.commonapi.core.tests/src/test-interface-stub.cpp13
-rw-r--r--org.genivi.commonapi.core.tests/src/test-predefined-types.cpp100
-rw-r--r--org.genivi.commonapi.core.tests/src/test-predefined-types.fidl25
-rw-r--r--org.genivi.commonapi.core.ui/.classpath2
-rw-r--r--org.genivi.commonapi.core.ui/.gitignore2
-rw-r--r--org.genivi.commonapi.core.ui/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.genivi.commonapi.core.ui/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.genivi.commonapi.core.ui/.settings/org.eclipse.jdt.core.prefs11
-rw-r--r--org.genivi.commonapi.core.ui/LICENSE373
-rw-r--r--org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF37
-rw-r--r--org.genivi.commonapi.core.ui/build.properties1
-rw-r--r--org.genivi.commonapi.core.ui/plugin.xml17
-rw-r--r--org.genivi.commonapi.core.ui/pom.xml8
-rw-r--r--org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/CommonApiUiPlugin.java6
-rw-r--r--org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/handler/GenerationCommand.java538
-rw-r--r--org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/CommonAPIPreferencePage.java92
-rwxr-xr-xorg.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/FieldEditorOverlayPage.java320
-rwxr-xr-xorg.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/Messages.properties14
-rw-r--r--org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/MultiLineTextField.java37
-rw-r--r--org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/PreferenceInitializer.java6
-rwxr-xr-xorg.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/PropertyStore.java13
-rw-r--r--org.genivi.commonapi.core.updatesite/.gitignore2
-rw-r--r--org.genivi.commonapi.core.updatesite/.project (renamed from org.genivi.commonapi.parent.releng/.project)2
-rw-r--r--org.genivi.commonapi.core.updatesite/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.genivi.commonapi.core.updatesite/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.genivi.commonapi.core.updatesite/category.xml14
-rw-r--r--org.genivi.commonapi.core.updatesite/pom.xml13
-rw-r--r--org.genivi.commonapi.core.validator.feature/.gitignore1
-rw-r--r--org.genivi.commonapi.core.validator.feature/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.genivi.commonapi.core.validator.feature/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.genivi.commonapi.core.validator.feature/build.properties1
-rw-r--r--org.genivi.commonapi.core.validator.feature/feature.xml4
-rw-r--r--org.genivi.commonapi.core.validator.feature/pom.xml8
-rw-r--r--org.genivi.commonapi.core.validator/.classpath2
-rw-r--r--org.genivi.commonapi.core.validator/.gitignore2
-rw-r--r--org.genivi.commonapi.core.validator/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.genivi.commonapi.core.validator/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.genivi.commonapi.core.validator/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--org.genivi.commonapi.core.validator/META-INF/MANIFEST.MF22
-rw-r--r--org.genivi.commonapi.core.validator/build.properties1
-rw-r--r--org.genivi.commonapi.core.validator/plugin.xml2
-rw-r--r--org.genivi.commonapi.core.validator/pom.xml8
-rw-r--r--org.genivi.commonapi.core.validator/src/org/genivi/commonapi/core/validator/ValidatorCoreUi.java207
-rw-r--r--org.genivi.commonapi.core.verification/.gitignore19
-rw-r--r--org.genivi.commonapi.core.verification/AUTHORS1
-rw-r--r--org.genivi.commonapi.core.verification/CMakeLists.txt383
-rw-r--r--org.genivi.commonapi.core.verification/COPYING674
-rw-r--r--org.genivi.commonapi.core.verification/CommunicationVerification.conf.in5
-rw-r--r--org.genivi.commonapi.core.verification/DynamicLoadingVerification.conf.in5
-rw-r--r--org.genivi.commonapi.core.verification/LICENSE373
-rw-r--r--org.genivi.commonapi.core.verification/Makefile.am47
-rw-r--r--org.genivi.commonapi.core.verification/README86
-rw-r--r--org.genivi.commonapi.core.verification/configure.ac189
-rw-r--r--org.genivi.commonapi.core.verification/fidl/ti_communication.fidl23
-rw-r--r--org.genivi.commonapi.core.verification/fidl/ti_datatypes_advanced.fidl70
-rw-r--r--org.genivi.commonapi.core.verification/fidl/ti_datatypes_combined.fidl249
-rw-r--r--org.genivi.commonapi.core.verification/fidl/ti_datatypes_derived.fidl74
-rw-r--r--org.genivi.commonapi.core.verification/fidl/ti_datatypes_primitive.fidl73
-rw-r--r--org.genivi.commonapi.core.verification/fidl/ti_performance_complex.fidl38
-rw-r--r--org.genivi.commonapi.core.verification/fidl/ti_performance_primitive.fidl19
-rw-r--r--org.genivi.commonapi.core.verification/fidl/ti_runtime.fidl11
-rw-r--r--org.genivi.commonapi.core.verification/fidl/ti_stability_mp.fidl46
-rw-r--r--org.genivi.commonapi.core.verification/fidl/ti_stability_sp.fidl28
-rw-r--r--org.genivi.commonapi.core.verification/fidl/ti_threading.fidl23
-rw-r--r--org.genivi.commonapi.core.verification/m4/.gitignore5
-rw-r--r--org.genivi.commonapi.core.verification/m4/ax_cxx_compile_stdcxx_11.m4107
-rw-r--r--org.genivi.commonapi.core.verification/src/CMAttributeSubscription.cpp401
-rw-r--r--org.genivi.commonapi.core.verification/src/CMAttributes.cpp271
-rw-r--r--org.genivi.commonapi.core.verification/src/CMMethodCalls.cpp116
-rw-r--r--org.genivi.commonapi.core.verification/src/CommunicationVerification.cpp.in125
-rw-r--r--org.genivi.commonapi.core.verification/src/DTAdvanced.cpp300
-rw-r--r--org.genivi.commonapi.core.verification/src/DTCombined.cpp232
-rw-r--r--org.genivi.commonapi.core.verification/src/DTDerived.cpp259
-rw-r--r--org.genivi.commonapi.core.verification/src/DTPrimitive.cpp355
-rw-r--r--org.genivi.commonapi.core.verification/src/DynamicLoadingVerification.cpp.in197
-rw-r--r--org.genivi.commonapi.core.verification/src/MainLoopVerification.cpp496
-rw-r--r--org.genivi.commonapi.core.verification/src/PFComplex.cpp224
-rw-r--r--org.genivi.commonapi.core.verification/src/PFPrimitive.cpp196
-rw-r--r--org.genivi.commonapi.core.verification/src/RTBuildProxiesAndStubs.cpp78
-rw-r--r--org.genivi.commonapi.core.verification/src/RTLoadingRuntime.cpp52
-rw-r--r--org.genivi.commonapi.core.verification/src/StabilityMP.cpp648
-rw-r--r--org.genivi.commonapi.core.verification/src/StabilitySP.cpp617
-rw-r--r--org.genivi.commonapi.core.verification/src/THMainLoopIndependence.cpp276
-rw-r--r--org.genivi.commonapi.core.verification/src/THMainLoopIntegration.cpp244
-rw-r--r--org.genivi.commonapi.core.verification/src/conf/commonapi4dbus.ini.in44
-rw-r--r--org.genivi.commonapi.core.verification/src/conf/commonapi4someip.ini.in121
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/CMAttributesStub.cpp31
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/CMAttributesStub.h27
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/CMMethodCallsStub.cpp32
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/CMMethodCallsStub.h29
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/DTAdvancedStub.cpp55
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/DTAdvancedStub.h39
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/DTCombinedStub.cpp31
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/DTCombinedStub.h35
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/DTDerivedStub.cpp48
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/DTDerivedStub.h38
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.cpp67
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.h29
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/PFComplexStub.cpp37
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/PFComplexStub.h30
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.cpp39
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.h30
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/StabControlStub.cpp55
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/StabControlStub.h45
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/StabilityMPStub.cpp45
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/StabilityMPStub.h35
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.cpp49
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.h35
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/THMainLoopIntegrationStub.cpp43
-rw-r--r--org.genivi.commonapi.core.verification/src/stub/THMainLoopIntegrationStub.h30
-rw-r--r--org.genivi.commonapi.core.verification/src/test-derived-types.fidl60
-rw-r--r--org.genivi.commonapi.core.verification/src/test-interface-proxy.fidl61
-rw-r--r--org.genivi.commonapi.core.verification/src/test-predefined-types.fidl22
-rw-r--r--org.genivi.commonapi.core.verification/src/utils/StopWatch.cpp (renamed from CommonAPI-Ping/src/StopWatch.cpp)0
-rw-r--r--org.genivi.commonapi.core.verification/src/utils/StopWatch.h (renamed from CommonAPI-Ping/src/StopWatch.h)0
-rw-r--r--org.genivi.commonapi.core.verification/src/utils/VerificationMainLoop.h73
-rw-r--r--org.genivi.commonapi.core.verification/src/utils/VerificationTestStub.cpp45
-rw-r--r--org.genivi.commonapi.core.verification/src/utils/VerificationTestStub.h41
-rw-r--r--org.genivi.commonapi.core/.classpath7
-rw-r--r--org.genivi.commonapi.core/.gitignore5
-rw-r--r--org.genivi.commonapi.core/.settings/.gitignore1
-rw-r--r--org.genivi.commonapi.core/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.genivi.commonapi.core/LICENSE373
-rw-r--r--org.genivi.commonapi.core/META-INF/MANIFEST.MF31
-rw-r--r--org.genivi.commonapi.core/README4
-rw-r--r--org.genivi.commonapi.core/build.properties3
-rw-r--r--org.genivi.commonapi.core/deployment/CommonAPI_deployment.fdepl9
-rw-r--r--org.genivi.commonapi.core/deployment/CommonAPI_deployment_spec.fdepl79
-rw-r--r--org.genivi.commonapi.core/pom.xml8
-rw-r--r--org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentInterfacePropertyAccessor.java (renamed from org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/deployment/DeploymentInterfacePropertyAccessor.java)17
-rw-r--r--org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentProviderPropertyAccessor.java47
-rw-r--r--org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentTypeCollectionPropertyAccessor.java80
-rw-r--r--org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/deployment/.gitignore2
-rw-r--r--org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/deployment/DeploymentProviderPropertyAccessor.java22
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/deployment/DeploymentInterfacePropertyAccessorWrapper.java36
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/deployment/PropertyAccessor.java255
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FDeployManager.java99
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceGenerator.xtend80
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceProxyGenerator.xtend155
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend233
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeCollectionGenerator.xtend42
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeCommonAreaGenerator.xtend107
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeGenerator.xtend576
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGenerator.xtend157
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend862
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/MyFrancaPersistenceManager.java68
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/MyModelPersistenceHandler.java82
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/preferences/FPreferences.java253
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/preferences/PreferenceConstants.java30
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/CppKeywords.java (renamed from org.genivi.commonapi.core.validator/src/org/genivi/commonapi/core/validator/CppKeywords.java)2
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/ValidatorCore.java (renamed from org.genivi.commonapi.core.validator/src/org/genivi/commonapi/core/validator/ValidatorCore.java)278
-rw-r--r--org.genivi.commonapi.parent.releng/pom.xml158
-rw-r--r--org.genivi.commonapi.releng/.project2
-rw-r--r--org.genivi.commonapi.releng/pom.xml118
-rw-r--r--org.genivi.commonapi.target/org.genivi.commonapi.target.target25
-rw-r--r--org.genivi.commonapi.updatesite/category.xml20
404 files changed, 18802 insertions, 13052 deletions
diff --git a/.gitignore b/.gitignore
index 70ac68b..5ff9c22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,2 @@
+CommonAPI-Examples/src-gen
doc
-*/bin
-*/doc-gen
-*/xtend-gen
-.DS_Store
-*~
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..632e479
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Bayerische Motoren Werke Aktiengesellschaft (BMW AG) \ No newline at end of file
diff --git a/CommonAPI-Examples/.cproject b/CommonAPI-Examples/.cproject
new file mode 100644
index 0000000..90d8045
--- /dev/null
+++ b/CommonAPI-Examples/.cproject
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="cdt.managedbuild.toolchain.gnu.base.1795347564">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.1795347564" moduleId="org.eclipse.cdt.core.settings" name="Default">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration buildProperties="" id="cdt.managedbuild.toolchain.gnu.base.1795347564" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="cdt.managedbuild.toolchain.gnu.base.1795347564.2114763938" name="/" resourcePath="">
+ <toolChain id="cdt.managedbuild.toolchain.gnu.base.212284046" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
+ <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.1511046083" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
+ <builder id="cdt.managedbuild.target.gnu.builder.base.592340197" managedBuildOn="false" name="Gnu Make Builder.Default" superClass="cdt.managedbuild.target.gnu.builder.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.archiver.base.190940641" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.1354756355" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.c.compiler.base.1924407065" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.c.linker.base.2096802586" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.1887025592" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.assembler.base.1110106674" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base"/>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="CommonAPI-Examples.null.1362575265" name="CommonAPI-Examples"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+</cproject>
diff --git a/CommonAPI-Examples/.gitignore b/CommonAPI-Examples/.gitignore
index 7a50484..0e61d95 100644
--- a/CommonAPI-Examples/.gitignore
+++ b/CommonAPI-Examples/.gitignore
@@ -1,5 +1,4 @@
-.cproject
-.project
+*~
.settings
*/src-gen
-*/build \ No newline at end of file
+*/build
diff --git a/CommonAPI-Examples/.project b/CommonAPI-Examples/.project
new file mode 100644
index 0000000..efb06ea
--- /dev/null
+++ b/CommonAPI-Examples/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>CommonAPI-Examples</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ </natures>
+</projectDescription>
diff --git a/CommonAPI-Examples/AUTHORS b/CommonAPI-Examples/AUTHORS
index 2708c9d..632e479 100644
--- a/CommonAPI-Examples/AUTHORS
+++ b/CommonAPI-Examples/AUTHORS
@@ -1 +1 @@
-BMW Group \ No newline at end of file
+Bayerische Motoren Werke Aktiengesellschaft (BMW AG) \ No newline at end of file
diff --git a/CommonAPI-Examples/E01HelloWorld/.cproject b/CommonAPI-Examples/E01HelloWorld/.cproject
new file mode 100644
index 0000000..fc8a4e4
--- /dev/null
+++ b/CommonAPI-Examples/E01HelloWorld/.cproject
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="0.416559588">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.416559588" moduleId="org.eclipse.cdt.core.settings" name="Default">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildProperties="" description="" id="0.416559588" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
+ <folderInfo id="0.416559588." name="/" resourcePath="">
+ <toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1038958730" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
+ <targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1038958730.2115115764" name=""/>
+ <builder arguments="-C ${ProjDirPath}/build VERBOSE=0" buildPath="" command="make" id="org.eclipse.cdt.build.core.settings.default.builder.1812880292" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.libs.1019901481" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.259363632" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.840421715" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.1212471744" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <option id="org.eclipse.cdt.build.core.settings.holder.incpaths.427233418" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/ascgit017.CommonAPI/include}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/E01HelloWorld/src-gen}&quot;"/>
+ <listOptionValue builtIn="false" value="/usr/include/c++/4.8.2"/>
+ </option>
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1678702299" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.291757453" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1117944646" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="e01HelloWorld.null.741055877" name="e01HelloWorld"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ <scannerConfigBuildInfo instanceId="0.416559588">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="refreshScope" versionNumber="2">
+ <configuration configurationName="Default">
+ <resource resourceType="PROJECT" workspacePath="/e01HelloWorld"/>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
+ <buildTargets>
+ <target name="Run cmake" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
+ <buildCommand>cmake</buildCommand>
+ <buildArguments>-E chdir build/ cmake -D CMAKE_BUILD_TYPE=Debug -DUSE_INSTALLED_COMMONAPI=OFF -DUSE_INSTALLED_DBUS=OFF ../</buildArguments>
+ <buildTarget/>
+ <stopOnError>true</stopOnError>
+ <useDefaultCommand>false</useDefaultCommand>
+ <runAllBuilders>true</runAllBuilders>
+ </target>
+ </buildTargets>
+ </storageModule>
+</cproject>
diff --git a/CommonAPI-Examples/E01HelloWorld/.gitignore b/CommonAPI-Examples/E01HelloWorld/.gitignore
new file mode 100644
index 0000000..5fb7e99
--- /dev/null
+++ b/CommonAPI-Examples/E01HelloWorld/.gitignore
@@ -0,0 +1,2 @@
+build
+src-gen
diff --git a/CommonAPI-Examples/E01HelloWorld/.project b/CommonAPI-Examples/E01HelloWorld/.project
new file mode 100644
index 0000000..06979a8
--- /dev/null
+++ b/CommonAPI-Examples/E01HelloWorld/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>E01HelloWorld</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ </natures>
+</projectDescription>
diff --git a/CommonAPI-Examples/E01HelloWorld/CMakeLists.txt b/CommonAPI-Examples/E01HelloWorld/CMakeLists.txt
new file mode 100644
index 0000000..b250e4d
--- /dev/null
+++ b/CommonAPI-Examples/E01HelloWorld/CMakeLists.txt
@@ -0,0 +1,141 @@
+# 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/.
+
+cmake_minimum_required(VERSION 2.8)
+
+set(PRJ_NAME E01HelloWorld)
+
+set(CMAKE_VERBOSE_MAKEFILE on)
+
+if (MSVC)
+# Visual C++ is not always sure whether he is really C++
+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 -DLINUX")
+endif()
+
+message(STATUS "Compiler options: ${CMAKE_CXX_FLAGS}")
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
+ "Choose the type of build, options are: Debug Release." FORCE)
+endif(NOT CMAKE_BUILD_TYPE)
+message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
+
+OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version of CommonAPI" ON)
+message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}")
+
+if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+else()
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+endif()
+
+message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_INCLUDE_DIRS: ${COMMONAPI_INCLUDE_DIRS}")
+message(STATUS "CommonAPI-DBus_CONSIDERED_CONFIGS: ${CommonAPI-DBus_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_DBUS_INCLUDE_DIRS: ${COMMONAPI_DBUS_INCLUDE_DIRS}")
+
+# CommonAPI
+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 ()
+else()
+ pkg_check_modules(DBus REQUIRED dbus-1>=1.4)
+endif()
+
+# SOME/IP
+find_package (CommonAPI-SomeIP 3.1.1 REQUIRED)
+find_package (vsomeip 1.1.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_NAME_CLIENT ${PRJ_NAME}Client)
+set(PRJ_NAME_SERVICE ${PRJ_NAME}Service)
+
+# Application
+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)
+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_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 )
+include_directories( ${Boost_INCLUDE_DIR} )
+
+# DBus library
+FILE(GLOB PRJ_DBUS_LIB_SRCS ${PRJ_SRC_GEN_COMMONAPI_DBUS_PATH}/*cpp)
+
+# SOME/IP library
+FILE(GLOB PRJ_SOMEIP_LIB_SRCS ${PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH}/*cpp)
+
+# Paths
+OPTION(USE_INSTALLED_DBUS "Set to OFF to use the local (patched) version of dbus" ON)
+message(STATUS "USE_INSTALLED_DBUS is set to value: ${USE_INSTALLED_DBUS}")
+
+include_directories(
+ src-gen/core
+ src-gen/dbus
+ src-gen/someip
+ ${COMMONAPI_INCLUDE_DIRS}
+ ${COMMONAPI_DBUS_INCLUDE_DIRS}
+ ${COMMONAPI_SOMEIP_INCLUDE_DIRS}
+ ${DBus_INCLUDE_DIRS}
+ ${VSOMEIP_INCLUDE_DIRS}
+)
+
+if ("${USE_INSTALLED_DBUS}" STREQUAL "ON")
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${COMMONAPI_SOMEIP_CMAKE_DIR}/build
+ ${Boost_LIBRARY_DIR}
+)
+else()
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${COMMONAPI_SOMEIP_CMAKE_DIR}/build
+ ${DBus_INCLUDE_DIRS}/dbus/.libs
+)
+endif()
+
+set(LINK_LIBRARIES -Wl,--as-needed CommonAPI)
+
+# Build Client
+add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS})
+target_link_libraries(${PRJ_NAME_CLIENT} ${LINK_LIBRARIES})
+
+# Build service
+add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS})
+target_link_libraries(${PRJ_NAME_SERVICE} ${LINK_LIBRARIES})
+
+# Build DBus library
+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)
diff --git a/CommonAPI-Examples/E01HelloWorld/README b/CommonAPI-Examples/E01HelloWorld/README
new file mode 100644
index 0000000..b48e6f2
--- /dev/null
+++ b/CommonAPI-Examples/E01HelloWorld/README
@@ -0,0 +1,150 @@
+=== Example 01: Hello World
+
+This example contains step-by-step instructions how to create the code for the +Hello World+ introductory example of CommonAPI C++. Even this is a CommonAPI tutorial with no references to any special bindings, we give here some hints concerning existing bindings. For a deeper insight please refer to the binding specific tutorials. We assume that you use the Eclipse tool chain and that everything is properly installed as described in the Integration Guide of this tutorial.
+
+The first step in developing a CommonAPI application likely will be the definition of the RMI interface the client will use to communicate with the server. In the context of CommonAPI, the definition of this interface always happens via the Franca IDL, regardless of which communication mechanism you intend to use in the end.
+
+For this tutorial, create an arbitrarily named file ending in _.fidl_ in your Eclipse project (in this case _E01HelloWorld.fidl_). It is not relevant where in your project you have placed this file, as the code generated from this file will always be put in the automatically created src-gen folder at the top level of the project hierarchy.
+
+Open your newly created _E01HelloWorld.fidl_-file, and type the following lines:
+
+[source,java]
+----
+package commonapi.examples
+
+interface E01HelloWorld {
+ version { major 0 minor 1 }
+
+ method sayHello {
+ in {
+ String name
+ }
+ out {
+ String message
+ }
+ }
+}
+----
+
+Now, save the _.fidl_ file and right click it. As you have installed the CommonAPI code generator and further generators for the bindings, you will see a menu item saying _Common API_, with sub menu items for generating the Common API level code only (_Generate C\++ Code_) and for generating the required glue code (e.g. for D-Bus you find _Generate D-Bus C++ Code_).
+
+Now start the code generators. You will find the generated code in the sub-directory +src-gen+.
+
+All files that have a the name of your binding (e.g. _DBus_) in their name are glue code required by the binding and are not relevant while developing your application, they only need to be compiled with your application.
+
+All other files that have a _Proxy_ in their name are relevant for you if you develop a client, all other files that have a _Stub_ in their name are relevant for you if you develop a service. A proxy is a class that provides method calls that will result in remote method invocations on the service, plus registration methods for events that can be broadcasted by the service.
+
+A stub is the part of the service that will be called when a remote method invocation from a client arrives. It also contains methods to fire events (broadcasts) to several or all clients. The stub comes in two flavors: one default stub that contains empty implementations of all methods, thereby allowing you to implement only the ones you are interested in, and a Stub skeleton where you have to implement everything yourself before you can use it. A service will have to implement a subclass of either of the two in order to make itself available to the outside world (or just use the default stub if your service should not be able to do anything except firing events).
+
+In this tutorial, we will create both a client and a service in order to be able to see some communication going on.
+
+Start by implementing the client by creating a new +.cpp+ source file in your project (e.g. _e01HelloWorldClient.cpp_). Make sure you have a main method in order to start the client application.
+
+Here, you will need two includes in order to access the Common API client functionality:
+
+[source,{cppstr}]
+----
+#include <iostream>
+#include <string>
+#include <unistd.h>
+
+#include <CommonAPI/CommonAPI.hpp>
+#include <v0_1/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.
+
+One of the first things each and every CommonAPI application will do is to get a pointer to the runtime object:
+
+[source,{cppstr}]
+----
+std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get();
+----
+
+Please ignore for this introduction the +CommonAPI::Runtime::setProperty+ calls (refer to the Integration Guide of this tutorial).
+
+In order to be able to communicate with a specific service, we need a proxy:
+
+[source,{cppstr}]
+----
+std::string domain = "local";
+std::string instance = "commonapi.examples.HelloWorld";
+std::string connection = "client-sample";
+
+std::shared_ptr<E01HelloWorldProxyDefault> myProxy = runtime->buildProxy<E01HelloWorldProxy>(domain, instance, connection);
+----
+
+The domain and the instance name determine explicitly together with the generated proxy class as template parameter which stub will be addressed by this proxy. The _connection_ is an optional argument. This argument allows to group several proxies in a so-called connection. Internally a connection corresponds to one receiver thread if there is no mainloop integration.
+
+With the instantiation of the proxy, the client is set up and ready to use. In this example we wait for the service to be available, then we start issuing calls:
+
+[source,{cppstr}]
+----
+while (!myProxy->isAvailable())
+ usleep(10);
+
+
+const std::string name = "World";
+CommonAPI::CallStatus callStatus;
+std::string returnMessage;
+
+while (true) {
+ myProxy->sayHello(name, callStatus, returnMessage);
+ if (callStatus != CommonAPI::CallStatus::SUCCESS) {
+ std::cerr << "Remote call failed!\n";
+ return -1;
+ }
+ std::cout << "Got message: '" << returnMessage << "'\n";
+ std::this_thread::sleep_for(std::chrono::seconds(1));
+}
+----
+
+The implementation of the service works about the same way as implementing the client. The includes that are required are the following:
+
+[source,{cppstr}]
+----
+#include <iostream>
+#include <thread>
+
+#include <CommonAPI/CommonAPI.hpp>
+#include "E01HelloWorldStubImpl.hpp"
+----
+
+In the main function of the service one of the first things to do is to get the runtime object. After that we have to instantiate our stub implementation (here +E01HelloWorldStubImpl+) and then to register it:
+
+[source,{cppstr}]
+----
+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::shared_ptr<E01HelloWorldStubImpl> myService = std::make_shared<E01HelloWorldStubImpl>();
+runtime->registerService(domain, instance, myService, connection);
+
+while (true) {
+ std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl;
+ std::this_thread::sleep_for(std::chrono::seconds(60));
+}
+----
+
+The implementation of the generated stub method +sayHello+ looks like:
+
+[source,{cppstr}]
+----
+void E01HelloWorldStubImpl::sayHello(const std::shared_ptr<CommonAPI::ClientId> _client,
+ std::string _name,
+ sayHelloReply_t _reply) {
+
+ std::stringstream messageStream;
+
+ messageStream << "Hello " << _name << "!";
+ std::cout << "sayHello('" << _name << "'): '" << messageStream.str() << "'\n";
+
+ _reply(messageStream.str());
+};
+----
+
+Build the two applications using your favourite build system (e.g. see the CMake files in the example folder). If all worked well, you should see communication ongoing (e.g. via dbus-monitor), and you should get output from your client.
+
diff --git a/CommonAPI-Examples/E01HelloWorld/commonapi4dbus.ini b/CommonAPI-Examples/E01HelloWorld/commonapi4dbus.ini
new file mode 100644
index 0000000..ba5224f
--- /dev/null
+++ b/CommonAPI-Examples/E01HelloWorld/commonapi4dbus.ini
@@ -0,0 +1,8 @@
+[default]
+binding=dbus
+
+[logging]
+console = true
+file = ./mylog.log
+dlt = true
+level = verbose
diff --git a/CommonAPI-Examples/E01HelloWorld/commonapi4someip.ini b/CommonAPI-Examples/E01HelloWorld/commonapi4someip.ini
new file mode 100644
index 0000000..9d2e519
--- /dev/null
+++ b/CommonAPI-Examples/E01HelloWorld/commonapi4someip.ini
@@ -0,0 +1,8 @@
+[default]
+binding=someip
+
+[logging]
+console = true
+file = ./mylog.log
+dlt = true
+level = verbose
diff --git a/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fdepl b/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fdepl
new file mode 100644
index 0000000..4872a22
--- /dev/null
+++ b/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fdepl
@@ -0,0 +1,32 @@
+/* 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 "E01HelloWorld.fidl"
+
+define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E01HelloWorld {
+ SomeIpServiceID = 4660
+
+ method sayHello {
+ SomeIpMethodID = 33000
+
+ 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"
+ SomeIpUnicastPort = 30499
+ }
+} \ No newline at end of file
diff --git a/CommonAPI-Examples/e01HelloWorld/fidl/E01HelloWorld.fidl b/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fidl
index bb48cc3..d1360ba 100644
--- a/CommonAPI-Examples/e01HelloWorld/fidl/E01HelloWorld.fidl
+++ b/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld.fidl
@@ -1,6 +1,4 @@
-/* Copyright (C) 2014 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/. */
diff --git a/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldClient.cpp b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldClient.cpp
new file mode 100644
index 0000000..111fd5f
--- /dev/null
+++ b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldClient.cpp
@@ -0,0 +1,56 @@
+/* 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/. */
+
+#include <iostream>
+#include <string>
+
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
+#include <CommonAPI/CommonAPI.hpp>
+#include <v0_1/commonapi/examples/E01HelloWorldProxy.hpp>
+
+using namespace v0_1::commonapi::examples;
+
+int main() {
+ CommonAPI::Runtime::setProperty("LogContext", "E01C");
+ 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 = "client-sample";
+
+ std::shared_ptr<E01HelloWorldProxy<>> myProxy = runtime->buildProxy<E01HelloWorldProxy>(domain,
+ instance, connection);
+
+ std::cout << "Checking availability!" << std::endl;
+ while (!myProxy->isAvailable())
+ usleep(10);
+ std::cout << "Available..." << std::endl;
+
+ const std::string name = "World";
+ CommonAPI::CallStatus callStatus;
+ std::string returnMessage;
+
+ CommonAPI::CallInfo info(1000);
+ 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));
+ }
+
+ return 0;
+}
diff --git a/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldService.cpp b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldService.cpp
new file mode 100644
index 0000000..f92ae81
--- /dev/null
+++ b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldService.cpp
@@ -0,0 +1,33 @@
+/* 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/. */
+
+#include <iostream>
+#include <thread>
+
+#include <CommonAPI/CommonAPI.hpp>
+#include "E01HelloWorldStubImpl.hpp"
+
+using namespace std;
+
+int main() {
+ 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::shared_ptr<E01HelloWorldStubImpl> myService = std::make_shared<E01HelloWorldStubImpl>();
+ runtime->registerService(domain, instance, myService, connection);
+
+ while (true) {
+ std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl;
+ std::this_thread::sleep_for(std::chrono::seconds(60));
+ }
+
+ return 0;
+}
diff --git a/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.cpp b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.cpp
new file mode 100644
index 0000000..df13c01
--- /dev/null
+++ b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.cpp
@@ -0,0 +1,24 @@
+/* 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/. */
+
+#include "E01HelloWorldStubImpl.hpp"
+
+E01HelloWorldStubImpl::E01HelloWorldStubImpl() {
+}
+
+E01HelloWorldStubImpl::~E01HelloWorldStubImpl() {
+}
+
+void E01HelloWorldStubImpl::sayHello(const std::shared_ptr<CommonAPI::ClientId> _client,
+ std::string _name,
+ sayHelloReply_t _reply) {
+
+ std::stringstream messageStream;
+
+ messageStream << "Hello " << _name << "!";
+ std::cout << "sayHello('" << _name << "'): '" << messageStream.str() << "'\n";
+
+ _reply(messageStream.str());
+};
diff --git a/CommonAPI-Examples/e01HelloWorld/src/E01HelloWorldStubImpl.h b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.hpp
index 1079949..83a4112 100644
--- a/CommonAPI-Examples/e01HelloWorld/src/E01HelloWorldStubImpl.h
+++ b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldStubImpl.hpp
@@ -1,6 +1,4 @@
-/* Copyright (C) 2014 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/. */
@@ -8,15 +6,16 @@
#ifndef E01HELLOWORLDSTUBIMPL_H_
#define E01HELLOWORLDSTUBIMPL_H_
-#include <CommonAPI/CommonAPI.h>
-#include <commonapi/examples/E01HelloWorldStubDefault.h>
+#include <CommonAPI/CommonAPI.hpp>
+#include <v0_1/commonapi/examples/E01HelloWorldStubDefault.hpp>
-class E01HelloWorldStubImpl: public commonapi::examples::E01HelloWorldStubDefault {
+class E01HelloWorldStubImpl: public v0_1::commonapi::examples::E01HelloWorldStubDefault {
public:
E01HelloWorldStubImpl();
virtual ~E01HelloWorldStubImpl();
- virtual void sayHello(const std::shared_ptr<CommonAPI::ClientId> clientId, std::string name, std::string& message);
+
+ virtual void sayHello(const std::shared_ptr<CommonAPI::ClientId> _client, std::string _name, sayHelloReply_t _return);
};
diff --git a/CommonAPI-Examples/E01HelloWorld/vsomeip.json b/CommonAPI-Examples/E01HelloWorld/vsomeip.json
new file mode 100644
index 0000000..60c2f12
--- /dev/null
+++ b/CommonAPI-Examples/E01HelloWorld/vsomeip.json
@@ -0,0 +1,62 @@
+{
+ "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" : "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"
+ },
+ "services" :
+ [
+ {
+ "service" : "0x1234",
+ "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",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "multicast" : "224.244.224.245",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
+}
diff --git a/CommonAPI-Examples/E02Attributes/.cproject b/CommonAPI-Examples/E02Attributes/.cproject
new file mode 100644
index 0000000..298f904
--- /dev/null
+++ b/CommonAPI-Examples/E02Attributes/.cproject
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="0.1746289517">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1746289517" moduleId="org.eclipse.cdt.core.settings" name="Default">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildProperties="" description="" id="0.1746289517" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
+ <folderInfo id="0.1746289517." name="/" resourcePath="">
+ <toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1278268694" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
+ <targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1278268694.1620791179" name=""/>
+ <builder arguments="-C ${ProjDirPath}/build VERBOSE=0" buildPath="" command="make" id="org.eclipse.cdt.build.core.settings.default.builder.539726246" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.libs.1439841201" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.1972152184" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.181323032" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.564325780" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.249714743" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.562188488" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1928601009" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="e02Attributes.null.774516289" name="e02Attributes"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ <scannerConfigBuildInfo instanceId="0.1746289517">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="refreshScope" versionNumber="2">
+ <configuration configurationName="Default">
+ <resource resourceType="PROJECT" workspacePath="/e02Attributes"/>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
+ <buildTargets>
+ <target name="Run cmake" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
+ <buildCommand>cmake</buildCommand>
+ <buildArguments>-E chdir build/ cmake -D CMAKE_BUILD_TYPE=Debug -DUSE_INSTALLED_COMMONAPI=OFF -DUSE_INSTALLED_DBUS=OFF ../</buildArguments>
+ <buildTarget/>
+ <stopOnError>true</stopOnError>
+ <useDefaultCommand>false</useDefaultCommand>
+ <runAllBuilders>true</runAllBuilders>
+ </target>
+ </buildTargets>
+ </storageModule>
+</cproject>
diff --git a/CommonAPI-Examples/e01HelloWorld/.gitignore b/CommonAPI-Examples/E02Attributes/.gitignore
index 5897208..5897208 100644
--- a/CommonAPI-Examples/e01HelloWorld/.gitignore
+++ b/CommonAPI-Examples/E02Attributes/.gitignore
diff --git a/CommonAPI-Examples/E02Attributes/.project b/CommonAPI-Examples/E02Attributes/.project
new file mode 100644
index 0000000..851b8a1
--- /dev/null
+++ b/CommonAPI-Examples/E02Attributes/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>E02Attributes</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ </natures>
+</projectDescription>
diff --git a/CommonAPI-Examples/E02Attributes/CMakeLists.txt b/CommonAPI-Examples/E02Attributes/CMakeLists.txt
new file mode 100644
index 0000000..7da893e
--- /dev/null
+++ b/CommonAPI-Examples/E02Attributes/CMakeLists.txt
@@ -0,0 +1,103 @@
+# 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/.
+
+cmake_minimum_required(VERSION 2.8)
+
+set(PRJ_NAME E02Attributes)
+
+set(CMAKE_VERBOSE_MAKEFILE on)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O0 -std=c++0x -D_GLIBCXX_USE_NANOSLEEP")
+
+message(STATUS "Compiler options: ${CMAKE_CXX_FLAGS}")
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
+ "Choose the type of build, options are: Debug Release." FORCE)
+endif(NOT CMAKE_BUILD_TYPE)
+message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
+
+OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version of CommonAPI" ON)
+message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}")
+
+if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+else()
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+endif()
+
+message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_INCLUDE_DIRS: ${COMMONAPI_INCLUDE_DIRS}")
+message(STATUS "CommonAPI-DBus_CONSIDERED_CONFIGS: ${CommonAPI-DBus_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_DBUS_INCLUDE_DIRS: ${COMMONAPI_DBUS_INCLUDE_DIRS}")
+
+# CommonAPI
+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 ()
+else()
+ pkg_check_modules(DBus REQUIRED dbus-1>=1.4)
+endif()
+
+# Source Files
+set(PRJ_SRC_PATH src)
+set(PRJ_SRC_GEN_PATH src-gen/v1_0/commonapi/examples)
+
+set(PRJ_NAME_CLIENT ${PRJ_NAME}Client)
+set(PRJ_NAME_SERVICE ${PRJ_NAME}Service)
+
+FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Proxy.cpp)
+FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Stub*.cpp ${PRJ_SRC_GEN_PATH}/CommonTypes.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})
+
+# Paths
+OPTION(USE_INSTALLED_DBUS "Set to OFF to use the local (patched) version of dbus" ON)
+message(STATUS "USE_INSTALLED_DBUS is set to value: ${USE_INSTALLED_DBUS}")
+
+include_directories(
+ src-gen
+ ${COMMONAPI_INCLUDE_DIRS}
+ ${COMMONAPI_DBUS_INCLUDE_DIRS}
+ ${DBUS_INCLUDE_DIRS}
+)
+
+if ("${USE_INSTALLED_DBUS}" STREQUAL "ON")
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${DBUS_LIBDIR}
+)
+else()
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${DBUS_INCLUDE_DIRS}/dbus/.libs
+)
+endif()
+
+set(LINK_LIBRARIES -Wl,--no-as-needed CommonAPI-DBus -Wl,--as-needed CommonAPI ${DBUS_LIBRARIES})
+
+# Build Client
+add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS})
+target_link_libraries(${PRJ_NAME_CLIENT} ${LINK_LIBRARIES})
+
+# Build service
+add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS})
+target_link_libraries(${PRJ_NAME_SERVICE} ${LINK_LIBRARIES})
diff --git a/CommonAPI-Examples/E02Attributes/README b/CommonAPI-Examples/E02Attributes/README
new file mode 100644
index 0000000..25c13ce
--- /dev/null
+++ b/CommonAPI-Examples/E02Attributes/README
@@ -0,0 +1,131 @@
+=== Example 02: Attributes
+
+Consider the Franca IDL specification of example 2:
+
+[source,java]
+----
+package commonapi.examples
+
+interface E02Attributes {
+ version { major 1 minor 0 }
+
+ attribute Int32 x
+ attribute CommonTypes.a1Struct a1
+}
+
+typeCollection CommonTypes {
+ version { major 1 minor 0 }
+
+ struct a1Struct {
+ String s
+ a2Struct a2
+ }
+
+ struct a2Struct {
+ Int32 a
+ Boolean b
+ Double d
+ }
+}
+----
+
+Modelling attributes in interfaces means in general that the service that implements this interface has an internal state which shall be visible for external clients like a HMI (Human Machine Interface). A developer of a client would normally expect that he can set and get the attribute and that he can notify or subscribe to changes of the value of the attribute. We will see below in the implementation how exactly this is realized by CommonAPI. Franca offers two key words that indicate exactly how the attribute can be accessed: +readonly+ and +noSubscriptions+. The default setting is that everything is allowed; with these two additional key words these possibilities can be limited (e.g. if someone tries to call a set method and the attribute is +readonly+ he will get an error at compile time).
+
+The nested structure +a1Struct+ is defined in a type collection +CommonTypes+. Structures can be defined just like other type definitions within an interface definition or outside in a type collection. Since Franca 0.8.9 type collections can also be anonymous (without name). A type collection is transferred by the CommonAPI code generator in an additional namespace.
+
+The Franca interface specification of attributes does not contain any information about whether the access from client side is synchronous or asynchronous or whether the attribute is cached by the proxy. CommonAPI provides always methods for synchronous and asynchronous setter and getter methods; caching can be realized via an API extension.
+
+Now let's have a look to the CommonAPI code on the service side. The default implementation of the stub which is generated by the CommonAPI code generator defines the attribute as private attribute of the stub class. This attribute can be accessed from the stub implementation via getter and setter functions. Additionally the API for the stub implementation provides some callbacks (the following code snippet shows parts of the generated header of the stub class which refer to the attribute x):
+
+[source,{cppstr}]
+----
+class E02AttributesStubDefault : public virtual E02AttributesStub {
+public:
+ /* some other code here */
+ virtual const int32_t& getXAttribute();
+ virtual const int32_t& getXAttribute(const std::shared_ptr<CommonAPI::ClientId> _client);
+ virtual void setXAttribute(int32_t _value);
+ virtual void setXAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _value);
+
+protected:
+ /* some other code here */
+ virtual bool trySetXAttribute(int32_t _value);
+ virtual bool validateXAttributeRequestedValue(const int32_t &_value);
+ virtual void onRemoteXAttributeChanged();
+
+private:
+ /* some other code here */
+ int32_t xAttributeValue_;
+};
+----
+
+If the implementation of the stub has to change the value of the attribute +x+, let's say in a class +E02AttributesStubImpl+ that is derived from +E02AttributesStubDefault+, then it can call +setXAttribute+ (analog the usage of +getXAttribute+). The callback +onRemoteXAttributeChanged+ informs that a change of the attribute +x+ has been completed. The other callbacks can prevent the set of the attribute (+validateXAttributeRequestedValue+) or change the given value from the client (+trySetXAttribute+).
+
+In the example the service increments a counter every 2 seconds and publishes the counter value via the interface attribute +x+.
+
+Now see the implementation of the client. The simplest case is to get the current value of +x+. The following extract shows one part of the main function:
+
+[source,{cppstr}]
+----
+#include <iostream>
+#include <unistd.h>
+
+#include <CommonAPI/CommonAPI.hpp>
+#include <v1_0/commonapi/examples/E02AttributesProxy.hpp>
+
+#include "AttributeCacheExtension.hpp"
+
+using namespace v1_0::commonapi::examples;
+
+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);
+
+ while (!myProxy->isAvailable()) {
+ usleep(10);
+ }
+
+ CommonAPI::CallStatus callStatus;
+
+ int32_t value = 0;
+ myProxy->getXAttribute().getValue(callStatus, value);
+ std::cout << "Got attribute value: " << value << std::endl;
+
+ myProxy->getXAttribute().getChangedEvent().subscribe([&](const int32_t& val) {
+ std::cout << "Received change message: " << val << std::endl;
+ });
+
+ value = 100;
+ std::function<void(const CommonAPI::CallStatus&, int32_t)> fcb = recv_cb;
+ myProxy->getXAttribute().setValueAsync(value, fcb);
+
+ while (true) { 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+:
+
+[source,{cppstr}]
+----
+void recv_cb(const CommonAPI::CallStatus& callStatus, const int32_t& val) {
+ std::cout << "Receive callback: " << val << std::endl;
+}
+
+.... // main method
+
+value = 100;
+std::function<void(const CommonAPI::CallStatus&, int32_t)> fcb = recv_cb;
+myProxy->getXAttribute().setValueAsync(value, fcb);
+----
+
+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.fdepl b/CommonAPI-Examples/E02Attributes/fidl/E02Attributes.fdepl
new file mode 100644
index 0000000..6ff6efd
--- /dev/null
+++ b/CommonAPI-Examples/E02Attributes/fidl/E02Attributes.fdepl
@@ -0,0 +1,11 @@
+/* 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/fidl/E02Attributes.fidl b/CommonAPI-Examples/E02Attributes/fidl/E02Attributes.fidl
index ff2ad7d..dd47949 100644
--- a/CommonAPI-Examples/e02Attributes/fidl/E02Attributes.fidl
+++ b/CommonAPI-Examples/E02Attributes/fidl/E02Attributes.fidl
@@ -1,6 +1,4 @@
-/* Copyright (C) 2014 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/. */
@@ -11,18 +9,19 @@ interface E02Attributes {
version { major 1 minor 0 }
attribute Int32 x
-
attribute CommonTypes.a1Struct a1
}
typeCollection CommonTypes {
-
+ version { major 1 minor 0 }
+
struct a1Struct {
String s
a2Struct a2
}
struct a2Struct {
+ Int32 a
Boolean b
Double d
}
diff --git a/CommonAPI-Examples/e02Attributes/src/AttributeCacheExtension.hpp b/CommonAPI-Examples/E02Attributes/src/AttributeCacheExtension.hpp
index d9a7870..85e414a 100644
--- a/CommonAPI-Examples/e02Attributes/src/AttributeCacheExtension.hpp
+++ b/CommonAPI-Examples/E02Attributes/src/AttributeCacheExtension.hpp
@@ -1,11 +1,9 @@
-/* Copyright (C) 2014 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/. */
-#include <CommonAPI/CommonAPI.h>
+#include <CommonAPI/CommonAPI.hpp>
template<typename _AttributeType>
class AttributeCacheExtension: public CommonAPI::AttributeExtension<_AttributeType> {
diff --git a/CommonAPI-Examples/e02Attributes/src/e02AttributesClient.cpp b/CommonAPI-Examples/E02Attributes/src/E02AttributesClient.cpp
index a8ac509..e51eea7 100644
--- a/CommonAPI-Examples/e02Attributes/src/e02AttributesClient.cpp
+++ b/CommonAPI-Examples/E02Attributes/src/E02AttributesClient.cpp
@@ -1,37 +1,37 @@
-/* Copyright (C) 2014 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/. */
#include <iostream>
+#include <unistd.h>
-#include <CommonAPI/CommonAPI.h>
-#include <commonapi/examples/E02AttributesProxy.h>
+#include <CommonAPI/CommonAPI.hpp>
+#include <v1_0/commonapi/examples/E02AttributesProxy.hpp>
#include "AttributeCacheExtension.hpp"
-using namespace commonapi::examples;
+using namespace v1_0::commonapi::examples;
void recv_cb(const CommonAPI::CallStatus& callStatus, const int32_t& val) {
std::cout << "Receive callback: " << val << std::endl;
}
void recv_cb_s(const CommonAPI::CallStatus& callStatus, const CommonTypes::a1Struct& valStruct) {
- std::cout << "Receive callback for structure: a1.s = " << valStruct.s << ", valStruct.a2.d = " << valStruct.a2.d
- << std::endl;
+ 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::load();
+ std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get();
- std::shared_ptr < CommonAPI::Factory > factory = runtime->createFactory();
- const std::string& serviceAddress = "local:commonapi.examples.Attributes:commonapi.examples.Attributes";
- //std::shared_ptr < E02AttributesProxyDefault > myProxy = factory->buildProxy < E02AttributesProxy > (serviceAddress);
- std::shared_ptr<CommonAPI::DefaultAttributeProxyFactoryHelper<E02AttributesProxy, AttributeCacheExtension>::class_t> myProxy =
- factory->buildProxyWithDefaultAttributeExtension<E02AttributesProxy, AttributeCacheExtension>(serviceAddress);
+ 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);
while (!myProxy->isAvailable()) {
usleep(10);
@@ -41,8 +41,12 @@ int main() {
int32_t value = 0;
+ CommonAPI::CallInfo info(1000);
+ info.sender_ = 5678;
+
// Get actual attribute value from service
- myProxy->getXAttribute().getValue(callStatus, value);
+ 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;
@@ -54,35 +58,32 @@ int main() {
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;
// Asynchronous call to set attribute of service
std::function<void(const CommonAPI::CallStatus&, int32_t)> fcb = recv_cb;
- myProxy->getXAttribute().setValueAsync(value, fcb);
- if (callStatus != CommonAPI::CallStatus::SUCCESS) {
- std::cerr << "Remote call failed!\n";
- return -1;
- }
+ myProxy->getXAttribute().setValueAsync(value, fcb, &info);
// Asynchronous call to set attribute of type structure in service
CommonTypes::a1Struct valueStruct;
- valueStruct.s = "abc";
- valueStruct.a2.b = true;
- valueStruct.a2.d = 1234;
+ 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);
- if (callStatus != CommonAPI::CallStatus::SUCCESS) {
- std::cerr << "Remote set of structure failed!\n";
- return -1;
- }
+ myProxy->getA1Attribute().setValueAsync(valueStruct, fcb_s, &info);
while (true) {
-
int32_t valueCached = 0;
- bool r;
- r = myProxy->getXAttributeExtension().getCachedValue(valueCached);
+ bool r = myProxy->getXAttributeExtension().getCachedValue(valueCached);
std::cout << "Got cached attribute value[" << (int)r << "]: " << valueCached << std::endl;
usleep(1000000);
}
diff --git a/CommonAPI-Examples/e02Attributes/src/e02AttributesService.cpp b/CommonAPI-Examples/E02Attributes/src/E02AttributesService.cpp
index 8636a6e..60c743d 100644
--- a/CommonAPI-Examples/e02Attributes/src/e02AttributesService.cpp
+++ b/CommonAPI-Examples/E02Attributes/src/E02AttributesService.cpp
@@ -1,6 +1,4 @@
-/* Copyright (C) 2014 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/. */
@@ -8,23 +6,22 @@
#include <thread>
#include <iostream>
-#include <CommonAPI/CommonAPI.h>
-#include "E02AttributesStubImpl.h"
+#include <CommonAPI/CommonAPI.hpp>
+#include "E02AttributesStubImpl.hpp"
int main() {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
+
+ std::string domain = "local";
+ std::string instance = "commonapi.examples.Attributes";
- const std::string& serviceAddress = "local:commonapi.examples.Attributes:commonapi.examples.Attributes";
std::shared_ptr<E02AttributesStubImpl> myService = std::make_shared<E02AttributesStubImpl>();
- servicePublisher->registerService(myService, serviceAddress, factory);
+ runtime->registerService(domain, instance, myService);
while (true) {
myService->incCounter(); // Change value of attribute, see stub implementation
std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(2));
}
-
return 0;
}
diff --git a/CommonAPI-Examples/e02Attributes/src/E02AttributesStubImpl.cpp b/CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.cpp
index b43d92d..2eb226c 100644
--- a/CommonAPI-Examples/e02Attributes/src/E02AttributesStubImpl.cpp
+++ b/CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.cpp
@@ -1,11 +1,9 @@
-/* Copyright (C) 2014 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/. */
-#include "E02AttributesStubImpl.h"
+#include "E02AttributesStubImpl.hpp"
E02AttributesStubImpl::E02AttributesStubImpl() {
cnt = 0;
diff --git a/CommonAPI-Examples/e02Attributes/src/E02AttributesStubImpl.h b/CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.hpp
index d415e77..655a094 100644
--- a/CommonAPI-Examples/e02Attributes/src/E02AttributesStubImpl.h
+++ b/CommonAPI-Examples/E02Attributes/src/E02AttributesStubImpl.hpp
@@ -1,6 +1,4 @@
-/* Copyright (C) 2014 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/. */
@@ -8,10 +6,10 @@
#ifndef E02ATTRIBUTESSTUBIMPL_H_
#define E02ATTRIBUTESSTUBIMPL_H_
-#include <CommonAPI/CommonAPI.h>
-#include <commonapi/examples/E02AttributesStubDefault.h>
+#include <CommonAPI/CommonAPI.hpp>
+#include <v1_0/commonapi/examples/E02AttributesStubDefault.hpp>
-class E02AttributesStubImpl: public commonapi::examples::E02AttributesStubDefault {
+class E02AttributesStubImpl: public v1_0::commonapi::examples::E02AttributesStubDefault {
public:
E02AttributesStubImpl();
diff --git a/CommonAPI-Examples/E03Methods/.cproject b/CommonAPI-Examples/E03Methods/.cproject
new file mode 100644
index 0000000..531d398
--- /dev/null
+++ b/CommonAPI-Examples/E03Methods/.cproject
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="0.1261797899">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1261797899" moduleId="org.eclipse.cdt.core.settings" name="Default">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildProperties="" description="" id="0.1261797899" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
+ <folderInfo id="0.1261797899." name="/" resourcePath="">
+ <toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.916883626" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
+ <targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.916883626.1691131813" name=""/>
+ <builder arguments="-C ${ProjDirPath}/build VERBOSE=0" buildPath="" command="make" id="org.eclipse.cdt.build.core.settings.default.builder.139656539" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.libs.1226446792" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.1436039019" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.995571325" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.702818460" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1872641988" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.538650938" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1863646962" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="e03Methods.null.1943542015" name="e03Methods"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ <scannerConfigBuildInfo instanceId="0.1261797899">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="refreshScope" versionNumber="2">
+ <configuration configurationName="Default">
+ <resource resourceType="PROJECT" workspacePath="/e03Methods"/>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
+ <buildTargets>
+ <target name="Run cmake" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
+ <buildCommand>cmake</buildCommand>
+ <buildArguments>-E chdir build/ cmake -D CMAKE_BUILD_TYPE=Debug -DUSE_INSTALLED_COMMONAPI=OFF -DUSE_INSTALLED_DBUS=OFF ../</buildArguments>
+ <buildTarget/>
+ <stopOnError>true</stopOnError>
+ <useDefaultCommand>false</useDefaultCommand>
+ <runAllBuilders>true</runAllBuilders>
+ </target>
+ </buildTargets>
+ </storageModule>
+</cproject>
diff --git a/CommonAPI-Examples/e02Attributes/.gitignore b/CommonAPI-Examples/E03Methods/.gitignore
index 5897208..5897208 100644
--- a/CommonAPI-Examples/e02Attributes/.gitignore
+++ b/CommonAPI-Examples/E03Methods/.gitignore
diff --git a/CommonAPI-Examples/E03Methods/.project b/CommonAPI-Examples/E03Methods/.project
new file mode 100644
index 0000000..fe125d0
--- /dev/null
+++ b/CommonAPI-Examples/E03Methods/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>E03Methods</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ </natures>
+</projectDescription>
diff --git a/CommonAPI-Examples/E03Methods/CMakeLists.txt b/CommonAPI-Examples/E03Methods/CMakeLists.txt
new file mode 100644
index 0000000..5640fea
--- /dev/null
+++ b/CommonAPI-Examples/E03Methods/CMakeLists.txt
@@ -0,0 +1,105 @@
+# Copyright (C) 2014, 2015 BMW Group
+# 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/.
+
+cmake_minimum_required(VERSION 2.8)
+
+set(PRJ_NAME E03Methods)
+
+set(CMAKE_VERBOSE_MAKEFILE on)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O0 -std=c++0x -D_GLIBCXX_USE_NANOSLEEP")
+
+message(STATUS "Compiler options: ${CMAKE_CXX_FLAGS}")
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
+ "Choose the type of build, options are: Debug Release." FORCE)
+endif(NOT CMAKE_BUILD_TYPE)
+message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
+
+OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version of CommonAPI" ON)
+message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}")
+
+if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+else()
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+endif()
+
+message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_INCLUDE_DIRS: ${COMMONAPI_INCLUDE_DIRS}")
+message(STATUS "CommonAPI-DBus_CONSIDERED_CONFIGS: ${CommonAPI-DBus_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_DBUS_INCLUDE_DIRS: ${COMMONAPI_DBUS_INCLUDE_DIRS}")
+
+# CommonAPI
+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 ()
+else()
+ pkg_check_modules(DBus REQUIRED dbus-1>=1.4)
+endif()
+
+# Source Files
+set(PRJ_SRC_PATH src)
+set(PRJ_SRC_GEN_PATH src-gen/core/v1_2/commonapi/examples)
+set(PRJ_DBUS_SRC_GEN_PATH src-gen/dbus/v1_2/commonapi/examples)
+
+set(PRJ_NAME_CLIENT ${PRJ_NAME}Client)
+set(PRJ_NAME_SERVICE ${PRJ_NAME}Service)
+
+FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Proxy.cpp ${PRJ_DBUS_SRC_GEN_PATH}/*Proxy.cpp)
+FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Stub*.cpp ${PRJ_DBUS_SRC_GEN_PATH}/*Stub*.cpp ${PRJ_SRC_GEN_PATH}/${PRJ_NAME}.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})
+
+# Paths
+OPTION(USE_INSTALLED_DBUS "Set to OFF to use the local (patched) version of dbus" ON)
+message(STATUS "USE_INSTALLED_DBUS is set to value: ${USE_INSTALLED_DBUS}")
+
+include_directories(
+ src-gen/core
+ src-gen/dbus
+ ${COMMONAPI_INCLUDE_DIRS}
+ ${COMMONAPI_DBUS_INCLUDE_DIRS}
+ ${DBUS_INCLUDE_DIRS}
+)
+
+if ("${USE_INSTALLED_DBUS}" STREQUAL "ON")
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${DBUS_LIBDIR}
+)
+else()
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${DBUS_INCLUDE_DIRS}/dbus/.libs
+)
+endif()
+
+set(LINK_LIBRARIES -Wl,--no-as-needed CommonAPI-DBus -Wl,--as-needed CommonAPI ${DBUS_LIBRARIES})
+
+# Build Client
+add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS})
+target_link_libraries(${PRJ_NAME_CLIENT} ${LINK_LIBRARIES})
+
+# Build service
+add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS})
+target_link_libraries(${PRJ_NAME_SERVICE} ${LINK_LIBRARIES})
diff --git a/CommonAPI-Examples/e03Methods/README b/CommonAPI-Examples/E03Methods/README
index 1216224..70488d3 100644
--- a/CommonAPI-Examples/e03Methods/README
+++ b/CommonAPI-Examples/E03Methods/README
@@ -1,7 +1,6 @@
-Example 3: Methods
-~~~~~~~~~~~~~~~~~~
+=== Example 03: Methods
-Franca attributes represent status variables or data sets of services which shall be accessible by the clients of the service. In contrast, methods can be used for example to start a process in the service or to query for certain information (eg, from a database). See the following example 3:
+Franca attributes represent status variables or data sets of services which shall be accessible by the clients of the service. In contrast, methods can be used for example to start a process in the service or to query for certain information (e.g., from a database). See the following example 3:
[source,java]
----
@@ -9,7 +8,7 @@ package commonapi.examples
interface E03Methods {
- version { major 1 minor 0 }
+ version { major 1 minor 2 }
method foo {
in {
@@ -22,7 +21,7 @@ interface E03Methods {
}
error {
stdErrorTypeEnum
- }
+ }
}
broadcast myStatus {
@@ -38,7 +37,7 @@ interface E03Methods {
}
----
-Basically Franca methods have input parameters and output parameters and can return an optional application error which reports for example if the started process in the sevice could be finished successfully or not. Input and output parameters can have arbitrarily complex types, a separate definition of so-called InOut arguments of functions was not considered necessary.
+Basically Franca methods have input parameters and output parameters and can return an optional application error which reports for example if the started process in the service could be finished successfully or not. Input and output parameters can have arbitrarily complex types, a separate definition of so-called InOut arguments of functions was not considered necessary.
A special case are broadcasts. They can be used like readonly attributes. But there are several output parameters allowed (and no input parameters). Another difference is the additional optional keyword selective, which indicates that only selected clients can register on the broadcast see example 4).
@@ -48,48 +47,62 @@ The implementation of the service class is straight:
[source,{cppstr}]
----
-#include "E03MethodsStubImpl.h"
-
-using namespace commonapi::examples;
-
-... // Additional code
-
-void E03MethodsStubImpl::foo(int32_t x1, std::string x2,
- E03Methods::fooError& methodError, int32_t& y1, std::string& y2) {
-
- std::cout << "foo called, setting new values." << std::endl;
-
- methodError = (E03Methods::fooError)E03Methods::stdErrorTypeEnum::MY_FAULT;
- y1 = 42;
- y2 = "xyz";
+void E03MethodsStubImpl::foo(const std::shared_ptr<CommonAPI::ClientId> _client,
+ int32_t _x1,
+ std::string _x2,
+ fooReply_t _reply) {
+
+
+ E03Methods::fooError methodError = (E03Methods::fooError)
+
+ E03Methods::stdErrorTypeEnum::MY_FAULT;
+ int32_t y1 = 42;
+ std::string y2 = "xyz";
+ _reply(methodError, y1, y2);
}
----
-The input parameters are available as values, the output parameter as references. The standard name for the application error is methodError. In the example there is another function incCounter implemented which sends the broadcast myStatus via the generated method fireMyStatusEvent:
+The input parameters are available as values, the output parameter are wrapped in a generated reply object with the type fooReply_t. This is slightly different to earlier versions of CommonAPI where the return values were passed as references.
+
+In the example there is another function incCounter implemented which sends the broadcast myStatus via the generated method fireMyStatusEvent:
[source,{cppstr}]
----
void E03MethodsStubImpl::incCounter() {
- cnt++;
- fireMyStatusEvent((int32_t)cnt);
- std::cout << "New counter value = " << cnt << "!" << std::endl;
-};
+ cnt++;
+ fireMyStatusEvent((int32_t) cnt);
+}
----
+
The subscription to the broadcast is nearly identical to the subscription to the change of the value of an attribute. The example shows further an asynchronous and a synchronous call of the function foo; in the asynchronous case the callback function +recv_cb+ is defined.
[source,{cppstr}]
----
#include <iostream>
-
-#include <CommonAPI/CommonAPI.h>
-#include <commonapi/examples/E03MethodsProxy.h>
-
-using namespace commonapi::examples;
-
-void recv_cb(const CommonAPI::CallStatus& callStatus, const E03Methods::fooError& methodError,
- const int32_t& y1, const std::string& y2) {
-
-... // your code
+#include <unistd.h>
+
+#include <CommonAPI/CommonAPI.hpp>
+#include <v1_2/commonapi/examples/E03MethodsProxy.hpp>
+
+using namespace v1_2::commonapi::examples;
+
+void recv_cb(const CommonAPI::CallStatus& callStatus,
+ const E03Methods::fooError& 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 << " error: "
+ << ((methodError.stdErrorTypeEnum ==
+ E03Methods::stdErrorTypeEnum::NO_FAULT) ? "NO_FAULT" : "MY_FAULT")
+ << std::endl;
+
+ std::cout << " Output values: y1 = " << y1 << ", y2 = " << y2 << std::endl;
}
int main() {
@@ -131,5 +144,5 @@ A frequently asked question is what happens if the service does not answer. In t
- *NOT* considered to be a remote error is an application level error that is defined in the corresponding Franca interface, because from the point of view of the transport layer the service still returned a valid answer.
- It *IS* considered to be a remote error if no answer for a sent remote method call is returned within a defined time. It is discouraged to allow the sending of any method calls without a defined timeout. This timeout may be middleware specific. This timeout may also be configurable by means of a Franca Deployment Model. It is *NOT* configurable at runtime by means of the Common API.
-The actual version of the D-Bus binding has a non configurable timeout of about 5 seconds.
+The timeout of function calls can be set by the optional +CallInfo+ argument on client side.
diff --git a/CommonAPI-Examples/E03Methods/fidl/E03Methods.fdepl b/CommonAPI-Examples/E03Methods/fidl/E03Methods.fdepl
new file mode 100644
index 0000000..eb5d918
--- /dev/null
+++ b/CommonAPI-Examples/E03Methods/fidl/E03Methods.fdepl
@@ -0,0 +1,8 @@
+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/fidl/E03Methods.fidl b/CommonAPI-Examples/E03Methods/fidl/E03Methods.fidl
index 9c6c93e..edf8dc6 100644
--- a/CommonAPI-Examples/e03Methods/fidl/E03Methods.fidl
+++ b/CommonAPI-Examples/E03Methods/fidl/E03Methods.fidl
@@ -9,7 +9,7 @@ package commonapi.examples
interface E03Methods {
- version { major 1 minor 0 }
+ version { major 1 minor 2 }
method foo {
in {
diff --git a/CommonAPI-Examples/e03Methods/src/e03MethodsClient.cpp b/CommonAPI-Examples/E03Methods/src/E03MethodsClient.cpp
index f5b4426..0c6bc56 100644
--- a/CommonAPI-Examples/e03Methods/src/e03MethodsClient.cpp
+++ b/CommonAPI-Examples/E03Methods/src/E03MethodsClient.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 BMW Group
+/* Copyright (C) 2014, 2015 BMW Group
* Author: Manfred Bathelt (manfred.bathelt@bmw.de)
* Author: Juergen Gehring (juergen.gehring@bmw.de)
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -7,10 +7,14 @@
#include <iostream>
-#include <CommonAPI/CommonAPI.h>
-#include <commonapi/examples/E03MethodsProxy.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
-using namespace commonapi::examples;
+#include <CommonAPI/CommonAPI.hpp>
+#include <v1_2/commonapi/examples/E03MethodsProxy.hpp>
+
+using namespace v1_2::commonapi::examples;
void recv_cb(const CommonAPI::CallStatus& callStatus,
const E03Methods::fooError& methodError,
@@ -20,17 +24,18 @@ void recv_cb(const CommonAPI::CallStatus& callStatus,
std::cout << " callStatus: " << ((callStatus == CommonAPI::CallStatus::SUCCESS) ? "SUCCESS" : "NO_SUCCESS")
<< std::endl;
std::cout << " error: "
- << (((E03Methods::stdErrorTypeEnum) methodError == E03Methods::stdErrorTypeEnum::NO_FAULT) ? "NO_FAULT" :
+ << ((methodError.stdErrorTypeEnum == E03Methods::stdErrorTypeEnum::NO_FAULT) ? "NO_FAULT" :
"MY_FAULT") << std::endl;
std::cout << " Output values: y1 = " << y1 << ", y2 = " << y2 << std::endl;
}
int main() {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
+
+ std::string domain = "local";
+ std::string instance = "commonapi.examples.Methods";
- std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
- const std::string& serviceAddress = "local:commonapi.examples.Methods:commonapi.examples.Methods";
- std::shared_ptr<E03MethodsProxyDefault> myProxy = factory->buildProxy < E03MethodsProxy > (serviceAddress);
+ std::shared_ptr<E03MethodsProxy<>> myProxy = runtime->buildProxy < E03MethodsProxy > (domain, instance);
while (!myProxy->isAvailable()) {
usleep(10);
@@ -57,7 +62,7 @@ int main() {
std::cout << " callStatus: " << ((callStatus == CommonAPI::CallStatus::SUCCESS) ? "SUCCESS" : "NO_SUCCESS")
<< std::endl;
std::cout << " error: "
- << (((E03Methods::stdErrorTypeEnum) methodError == E03Methods::stdErrorTypeEnum::NO_FAULT) ? "NO_FAULT" : "MY_FAULT")
+ << ((methodError.stdErrorTypeEnum == 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;
diff --git a/CommonAPI-Examples/e03Methods/src/e03MethodsService.cpp b/CommonAPI-Examples/E03Methods/src/E03MethodsService.cpp
index 71003bc..7c9528c 100644
--- a/CommonAPI-Examples/e03Methods/src/e03MethodsService.cpp
+++ b/CommonAPI-Examples/E03Methods/src/E03MethodsService.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 BMW Group
+/* Copyright (C) 2014, 2015 BMW Group
* Author: Manfred Bathelt (manfred.bathelt@bmw.de)
* Author: Juergen Gehring (juergen.gehring@bmw.de)
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -8,17 +8,17 @@
#include <thread>
#include <iostream>
-#include <CommonAPI/CommonAPI.h>
-#include "E03MethodsStubImpl.h"
+#include <CommonAPI/CommonAPI.hpp>
+#include "E03MethodsStubImpl.hpp"
int main() {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
+
+ std::string domain = "local";
+ std::string instance = "commonapi.examples.Methods";
- const std::string& serviceAddress = "local:commonapi.examples.Methods:commonapi.examples.Methods";
std::shared_ptr<E03MethodsStubImpl> myService = std::make_shared<E03MethodsStubImpl>();
- servicePublisher->registerService(myService, serviceAddress, factory);
+ runtime->registerService(domain, instance, myService);
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 e0b47ef..d2856d2 100644
--- a/CommonAPI-Examples/e03Methods/src/E03MethodsStubImpl.cpp
+++ b/CommonAPI-Examples/E03Methods/src/E03MethodsStubImpl.cpp
@@ -1,13 +1,13 @@
-/* Copyright (C) 2014 BMW Group
+/* Copyright (C) 2014, 2015 BMW Group
* Author: Manfred Bathelt (manfred.bathelt@bmw.de)
* Author: Juergen Gehring (juergen.gehring@bmw.de)
* 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/. */
-#include "E03MethodsStubImpl.h"
+#include "E03MethodsStubImpl.hpp"
-using namespace commonapi::examples;
+using namespace v1_2::commonapi::examples;
E03MethodsStubImpl::E03MethodsStubImpl() {
cnt = 0;
@@ -23,15 +23,15 @@ void E03MethodsStubImpl::incCounter() {
}
;
-void E03MethodsStubImpl::foo(int32_t x1,
- std::string x2,
- E03Methods::fooError& methodError,
- int32_t& y1,
- std::string& y2) {
+void E03MethodsStubImpl::foo(const std::shared_ptr<CommonAPI::ClientId> _client,
+ int32_t _x1,
+ std::string _x2,
+ fooReply_t _reply) {
std::cout << "foo called, setting new values." << std::endl;
- methodError = (E03Methods::fooError) E03Methods::stdErrorTypeEnum::MY_FAULT;
- y1 = 42;
- y2 = "xyz";
+ E03Methods::fooError methodError = (E03Methods::fooError) E03Methods::stdErrorTypeEnum::MY_FAULT;
+ int32_t y1 = 42;
+ std::string y2 = "xyz";
+ _reply(methodError, y1, y2);
}
diff --git a/CommonAPI-Examples/e03Methods/src/E03MethodsStubImpl.h b/CommonAPI-Examples/E03Methods/src/E03MethodsStubImpl.hpp
index 654620c..3afdbe8 100644
--- a/CommonAPI-Examples/e03Methods/src/E03MethodsStubImpl.h
+++ b/CommonAPI-Examples/E03Methods/src/E03MethodsStubImpl.hpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 BMW Group
+/* Copyright (C) 2014, 2015 BMW Group
* Author: Manfred Bathelt (manfred.bathelt@bmw.de)
* Author: Juergen Gehring (juergen.gehring@bmw.de)
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -8,20 +8,19 @@
#ifndef E03METHODSSTUBIMPL_H_
#define E03METHODSSTUBIMPL_H_
-#include <CommonAPI/CommonAPI.h>
-#include <commonapi/examples/E03MethodsStubDefault.h>
+#include <CommonAPI/CommonAPI.hpp>
+#include <v1_2/commonapi/examples/E03MethodsStubDefault.hpp>
-class E03MethodsStubImpl: public commonapi::examples::E03MethodsStubDefault {
+class E03MethodsStubImpl: public v1_2::commonapi::examples::E03MethodsStubDefault {
public:
E03MethodsStubImpl();
virtual ~E03MethodsStubImpl();
virtual void incCounter();
- void foo(int32_t x1,
- std::string x2,
- commonapi::examples::E03Methods::fooError& methodError,
- int32_t& y1,
- std::string& y2);
+ virtual void foo(const std::shared_ptr<CommonAPI::ClientId> _client,
+ int32_t _x1,
+ std::string _x2,
+ fooReply_t _reply);
private:
int cnt;
diff --git a/CommonAPI-Examples/E04PhoneBook/.cproject b/CommonAPI-Examples/E04PhoneBook/.cproject
new file mode 100644
index 0000000..79b6194
--- /dev/null
+++ b/CommonAPI-Examples/E04PhoneBook/.cproject
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="0.1761849592">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1761849592" moduleId="org.eclipse.cdt.core.settings" name="Default">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildProperties="" description="" id="0.1761849592" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
+ <folderInfo id="0.1761849592." name="/" resourcePath="">
+ <toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.577012360" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
+ <targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.577012360.957683016" name=""/>
+ <builder arguments="-C ${ProjDirPath}/build VERBOSE=0" buildPath="" command="make" id="org.eclipse.cdt.build.core.settings.default.builder.1653340291" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.libs.412065462" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.1143268066" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1234796833" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.458324329" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1205538846" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/ascgit017.CommonAPI/include}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/ascgit017.CommonAPI-D-Bus/include}&quot;"/>
+ </option>
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1956760823" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.1410105709" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1565544040" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="e04PhoneBook.null.84948954" name="e04PhoneBook"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ <scannerConfigBuildInfo instanceId="0.1761849592">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="refreshScope" versionNumber="2">
+ <configuration configurationName="Default">
+ <resource resourceType="PROJECT" workspacePath="/e04PhoneBook"/>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
+ <buildTargets>
+ <target name="Run cmake" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
+ <buildCommand>cmake</buildCommand>
+ <buildArguments>-E chdir build/ cmake -D CMAKE_BUILD_TYPE=Debug -DUSE_INSTALLED_COMMONAPI=OFF -DUSE_INSTALLED_DBUS=OFF ../</buildArguments>
+ <buildTarget/>
+ <stopOnError>true</stopOnError>
+ <useDefaultCommand>false</useDefaultCommand>
+ <runAllBuilders>true</runAllBuilders>
+ </target>
+ </buildTargets>
+ </storageModule>
+</cproject>
diff --git a/CommonAPI-Examples/e03Methods/.gitignore b/CommonAPI-Examples/E04PhoneBook/.gitignore
index 5897208..5897208 100644
--- a/CommonAPI-Examples/e03Methods/.gitignore
+++ b/CommonAPI-Examples/E04PhoneBook/.gitignore
diff --git a/CommonAPI-Examples/E04PhoneBook/.project b/CommonAPI-Examples/E04PhoneBook/.project
new file mode 100644
index 0000000..af5f73a
--- /dev/null
+++ b/CommonAPI-Examples/E04PhoneBook/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>E04PhoneBook</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ </natures>
+</projectDescription>
diff --git a/CommonAPI-Examples/E04PhoneBook/CMakeLists.txt b/CommonAPI-Examples/E04PhoneBook/CMakeLists.txt
new file mode 100644
index 0000000..ed9840a
--- /dev/null
+++ b/CommonAPI-Examples/E04PhoneBook/CMakeLists.txt
@@ -0,0 +1,90 @@
+# Copyright (C) 2014, 2015 BMW Group
+# Author: Manfred Bathelt (manfred.bathelt@bmw.de)
+# Author: Juergen Gehring (juergen.gehring@bmw.de)
+# 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/.
+
+cmake_minimum_required(VERSION 2.8)
+
+set(PRJ_NAME E04PhoneBook)
+
+set(CMAKE_VERBOSE_MAKEFILE on)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O0 -std=c++0x -D_GLIBCXX_USE_NANOSLEEP")
+
+message(STATUS "Compiler options: ${CMAKE_CXX_FLAGS}")
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
+ "Choose the type of build, options are: Debug Release." FORCE)
+endif(NOT CMAKE_BUILD_TYPE)
+message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
+
+OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version of CommonAPI" ON)
+message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}")
+
+if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+else()
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+endif()
+
+message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_INCLUDE_DIRS: ${COMMONAPI_INCLUDE_DIRS}")
+message(STATUS "CommonAPI-DBus_CONSIDERED_CONFIGS: ${CommonAPI-DBus_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_DBUS_INCLUDE_DIRS: ${COMMONAPI_DBUS_INCLUDE_DIRS}")
+
+# CommonAPI
+include(FindPkgConfig)
+pkg_check_modules (DBUS "dbus-1 >= 1.4")
+
+# Source Files
+set(PRJ_SRC_PATH src)
+set(PRJ_SRC_GEN_PATH src-gen/commonapi/examples)
+
+set(PRJ_NAME_CLIENT ${PRJ_NAME}Client)
+set(PRJ_NAME_SERVICE ${PRJ_NAME}Service)
+
+FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Proxy.cpp ${PRJ_SRC_GEN_PATH}/${PRJ_NAME}.cpp)
+FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Stub*.cpp ${PRJ_SRC_GEN_PATH}/${PRJ_NAME}.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})
+
+# Paths
+OPTION(USE_INSTALLED_DBUS "Set to OFF to use the local (patched) version of dbus" ON)
+message(STATUS "USE_INSTALLED_DBUS is set to value: ${USE_INSTALLED_DBUS}")
+
+include_directories(
+ src-gen
+ ${COMMONAPI_INCLUDE_DIRS}
+ ${COMMONAPI_DBUS_INCLUDE_DIRS}
+ ${DBUS_INCLUDE_DIRS}
+)
+
+if ("${USE_INSTALLED_DBUS}" STREQUAL "ON")
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${DBUS_LIBDIR}
+)
+else()
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${DBUS_INCLUDE_DIRS}/dbus/.libs
+)
+endif()
+
+set(LINK_LIBRARIES -Wl,--no-as-needed CommonAPI-DBus -Wl,--as-needed CommonAPI ${DBUS_LIBRARIES})
+
+# Build Client
+add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS})
+target_link_libraries(${PRJ_NAME_CLIENT} ${LINK_LIBRARIES})
+
+# Build service
+add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS})
+target_link_libraries(${PRJ_NAME_SERVICE} ${LINK_LIBRARIES})
diff --git a/CommonAPI-Examples/E04PhoneBook/README b/CommonAPI-Examples/E04PhoneBook/README
new file mode 100644
index 0000000..431351a
--- /dev/null
+++ b/CommonAPI-Examples/E04PhoneBook/README
@@ -0,0 +1,219 @@
+=== Example 04: PhoneBook
+
+This slightly more complex example illustrates the application of some Franca features in combination with CommonAPI:
+
+- explicit named arrays and inline arrays
+- selective broadcasts
+- polymorphic structs
+
+Concerning arrays please note the following points:
+
+- In Franca there are two ways to define arrays: explicitly named (array myArray of UInt8) or implicit without defining a new name for the array (UInt8 []).
+- The implicit definition of multidimensional arrays is not possible at the moment (like UInt8 [][]), but multidimensional arrays can be defined with explicit names.
+- In CommonAPI arrays are implemented and generated as std::vector.
+
+A common problem in the specification of interfaces between user frontends and services which contain large data sets is, that the clients usually need only extracts from the database. That means that only a filtered excerpt from the database has to be transmitted via IPC to the client, but probably every client needs a different excerpt. The filter can affect the selection of the elements (element filter), the contents of the elements (content filter) or the number of elements (array window).
+
+The following example shows how different extracts of a central data array can be accessed by several clients via a data filter mechanism and selective broadcasts. As example of a central data array a phone book is selected; the following picture shows the basic content of the example.
+
+image::{imagedir}/E04PhoneBook.png[PhoneBookExample image]
+
+The Franca IDL specification is:
+
+[source,java]
+----
+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
+ }
+}
+----
+
+The phone book itself is modeled as an attribute which is an array of the structure +phoneBookStruct+. Here the phone book is +readonly+, that means that the whole content can be accessed only via subscription and the getter function. A special difficulty is the phone number, because there are several kinds of phone numbers allowed (home, mobile, ...). Therefore the element +phoneNumber+ in +phoneBookStruct+ is a map with an enumeration key and a value of type string for the number. The client can set a filter to the phone book data (in the example only content filter and element filter, but other filters are conceivable) via the method +setPhoneBookDataFilter+ and gets the data back via the selective broadcast +phoneBookDataSet+. Since the content of the data set depends on the filter, the elements of the client specific data set are specified as maps where the key is the type of the element (name, forename, ...) and the value is the content of the element. The content can be of the type String or of the user defined type phoneNumberMap. Therefore the value is defined as polymorphic struct which can be a String or a phoneNumberMap.
+
+In the following we consider only some interesting implementation details, for the complete implementation please see the source code.
+
+The interesting part of the service is the implementation of the set function for the data filter. At the moment only the element filter is implemented, but the implementation of the other filters can be added analogously.
+
+- Each client is identified via its client ID (+ClientId+); the implementation of client ID class allows the usage of client ID objects as key in a map (see the specification).
+- The data sets of the filtered data for the clients are stored in a map with the client ID as key; in this example the filtered data are sent back to the client directly in the filter set function. Please note, that +firePhoneBookDataSetSelective+ sends the data to only one receiver.
+- The value of the key has to be the right type (+phoneNumberMap+ for phoneNumbers and Strings for the rest).
+
+[source,{cppstr}]
+----
+void E04PhoneBookStubImpl::setPhoneBookDataFilter(
+ const std::shared_ptr<CommonAPI::ClientId> _client,
+ E04PhoneBook::elementFilterStruct _elementFilter,
+ std::vector<E04PhoneBook::contentFilterStruct> _contentFilter,
+ setPhoneBookDataFilterReply_t _reply) {
+
+ std::shared_ptr < CommonAPI::ClientIdList > clientList =
+ getSubscribersForPhoneBookDataSetSelective();
+
+ std::vector < E04PhoneBook::phoneBookDataElementMap > lPhoneBookDataSet;
+
+ phoneBookClientData.erase(_client);
+
+ std::vector<E04PhoneBook::phoneBookStruct>::const_iterator it0;
+ for (it0 = getPhoneBookAttribute().begin(); it0 != getPhoneBookAttribute().end(); it0++) {
+
+ E04PhoneBook::phoneBookDataElementMap lPhoneBookDataElement;
+
+ if (_elementFilter.getAddName()) {
+ std::shared_ptr<E04PhoneBook::phoneBookDataElementString> name =
+ std::make_shared<E04PhoneBook::phoneBookDataElementString>();
+ name->setContent(it0->getName());
+ lPhoneBookDataElement[E04PhoneBook::phoneBookDataElementEnum::NAME] = name;
+ }
+
+ /* ... Similar for all other elements */
+
+ lPhoneBookDataSet.push_back(lPhoneBookDataElement);
+ }
+
+ phoneBookClientData[_client] = lPhoneBookDataSet;
+
+ const std::shared_ptr<CommonAPI::ClientIdList> receivers(new CommonAPI::ClientIdList);
+ receivers->insert(_client);
+
+ firePhoneBookDataSetSelective(lPhoneBookDataSet, receivers);
+
+ receivers->erase(_client);
+
+ _reply();
+}
+----
+
+On client side we create two proxies which shall set different filters and get different data sets. With CommonAPI 2.x we needed two different factories for these two proxies; this can be achieved by now by creating a new Connection ID for the second proxy. Each proxy has to subscribe to phoneBookDataSet, but gets different contents depending on the filter. The whole phoneBookData can be obtained via the standard get function.
+
+[source,{cppstr}]
+----
+int main() {
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
+
+ const std::string &domain = "local";
+ const std::string &instance = "commonapi.examples.PhoneBook";
+
+ std::shared_ptr < E04PhoneBookProxyDefault > myProxyA =
+ runtime->buildProxy < E04PhoneBookProxy > (domain, instance);
+
+ while (!myProxyA->isAvailable()) { usleep(10); }
+
+ const CommonAPI::ConnectionId_t otherConnectionId = "42";
+
+ std::shared_ptr < E04PhoneBookProxyDefault > myProxyB =
+ runtime->buildProxy < E04PhoneBookProxy > (domain, instance, otherConnectionId);
+
+ while (!myProxyB->isAvailable()) { usleep(10); }
+
+ myProxyA->getPhoneBookDataSetSelectiveEvent().subscribe([&](
+ const std::vector<E04PhoneBook::phoneBookDataElementMap>& phoneBookDataSet) {
+ printFilterResult(phoneBookDataSet, "A");});
+
+ myProxyB->getPhoneBookDataSetSelectiveEvent().subscribe([&](
+ const std::vector<E04PhoneBook::phoneBookDataElementMap>& phoneBookDataSet) {
+ printFilterResult(phoneBookDataSet, "B");});
+
+ CommonAPI::CallStatus myCallStatus;
+ std::vector<E04PhoneBook::phoneBookStruct> myValue;
+
+ myProxyA->getPhoneBookAttribute().getValue(myCallStatus, myValue);
+ printPhoneBook (myValue);
+
+ E04PhoneBook::elementFilterStruct lElementFilterA =
+ {true, true, false, false, false, false};
+ std::vector<E04PhoneBook::contentFilterStruct> lContentFilterA =
+ { {E04PhoneBook::phoneBookDataElementEnum::NAME, "*"}};
+ myProxyA->setPhoneBookDataFilter(lElementFilterA, lContentFilterA, myCallStatus);
+
+ E04PhoneBook::elementFilterStruct lElementFilterB =
+ {true, false, false, false, false, true};
+ std::vector<E04PhoneBook::contentFilterStruct> lContentFilterB =
+ { {E04PhoneBook::phoneBookDataElementEnum::NAME, "*"}};
+ myProxyB->setPhoneBookDataFilter(lElementFilterB, lContentFilterB, myCallStatus);
+
+ while (true) { std::this_thread::sleep_for(std::chrono::seconds(5)); }
+ return 0;
+}
+----
+
diff --git a/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook.fdepl b/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook.fdepl
new file mode 100644
index 0000000..645b37e
--- /dev/null
+++ b/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook.fdepl
@@ -0,0 +1,112 @@
+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/fidl/E04PhoneBook.fidl b/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook.fidl
index 929b296..c22fd77 100644
--- a/CommonAPI-Examples/e04PhoneBook/fidl/E04PhoneBook.fidl
+++ b/CommonAPI-Examples/E04PhoneBook/fidl/E04PhoneBook.fidl
@@ -8,8 +8,7 @@
package commonapi.examples
interface E04PhoneBook {
-
- version { major 1 minor 0 }
+ version { major 0 minor 0 }
<** @description : the phone book itself **>
attribute phoneBookStruct [] phoneBook readonly
diff --git a/CommonAPI-Examples/e04PhoneBook/src/e04PhoneBookClient.cpp b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp
index eb9a7c5..8250762 100644
--- a/CommonAPI-Examples/e04PhoneBook/src/e04PhoneBookClient.cpp
+++ b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp
@@ -1,16 +1,18 @@
-/* Copyright (C) 2014 BMW Group
+/* Copyright (C) 2014, 2015 BMW Group
* Author: Manfred Bathelt (manfred.bathelt@bmw.de)
* Author: Juergen Gehring (juergen.gehring@bmw.de)
* 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/. */
+#include <unistd.h>
+
#include <map>
#include <iostream>
-#include <CommonAPI/CommonAPI.h>
-#include <commonapi/examples/E04PhoneBook.h>
-#include <commonapi/examples/E04PhoneBookProxy.h>
+#include <CommonAPI/CommonAPI.hpp>
+#include <commonapi/examples/E04PhoneBook.hpp>
+#include <commonapi/examples/E04PhoneBookProxy.hpp>
using namespace commonapi::examples;
@@ -18,7 +20,7 @@ using namespace commonapi::examples;
std::string phoneNumberType2String(E04PhoneBook::phoneNumberEnum phoneNumberType) {
- switch (static_cast<int32_t>(phoneNumberType)) {
+ switch (phoneNumberType) {
case 0:
return "WORK";
break;
@@ -43,14 +45,14 @@ void printPhoneBook(const std::vector<E04PhoneBook::phoneBookStruct>& myPhoneBoo
std::cout << "Actual phoneBook content: " << std::endl;
for (myIterator = myPhoneBook.begin(); myIterator != myPhoneBook.end(); myIterator++) {
- std::cout << "Name: " << myIterator->name << std::endl;
- std::cout << "Forename: " << myIterator->forename << std::endl;
- std::cout << "Organisation: " << myIterator->organisation << std::endl;
- std::cout << "Address: " << myIterator->address << std::endl;
- std::cout << "EMail: " << myIterator->email << std::endl;
+ std::cout << "Name: " << myIterator->getName() << std::endl;
+ std::cout << "Forename: " << myIterator->getForename() << std::endl;
+ std::cout << "Organisation: " << myIterator->getOrganisation() << std::endl;
+ std::cout << "Address: " << myIterator->getAddress() << std::endl;
+ std::cout << "EMail: " << myIterator->getEmail() << std::endl;
- for (E04PhoneBook::phoneNumberMap::const_iterator myPhoneNumberIterator = myIterator->phoneNumber.begin();
- myPhoneNumberIterator != myIterator->phoneNumber.end();
+ for (E04PhoneBook::phoneNumberMap::const_iterator myPhoneNumberIterator = myIterator->getPhoneNumber().begin();
+ myPhoneNumberIterator != myIterator->getPhoneNumber().end();
myPhoneNumberIterator++) {
std::cout << "phoneNumber[" << phoneNumberType2String(myPhoneNumberIterator->first) << "]: ";
std::cout << myPhoneNumberIterator->second << std::endl;
@@ -70,35 +72,35 @@ void printFilterResult(const std::vector<E04PhoneBook::phoneBookDataElementMap>&
switch (it1->first) {
case E04PhoneBook::phoneBookDataElementEnum::NAME: {
std::string name = (std::static_pointer_cast < E04PhoneBook::phoneBookDataElementString
- > (it1->second))->content;
+ > (it1->second))->getContent();
std::cout << "Name = " << name << std::endl;
}
break;
case E04PhoneBook::phoneBookDataElementEnum::FORENAME: {
std::string forename = (std::static_pointer_cast < E04PhoneBook::phoneBookDataElementString
- > (it1->second))->content;
+ > (it1->second))->getContent();
std::cout << "Forename = " << forename << std::endl;
}
break;
case E04PhoneBook::phoneBookDataElementEnum::ORGANISATION: {
std::string organisation = (std::static_pointer_cast < E04PhoneBook::phoneBookDataElementString
- > ((*it0).at(E04PhoneBook::phoneBookDataElementEnum::ORGANISATION)))->content;
+ > ((*it0).at(E04PhoneBook::phoneBookDataElementEnum::ORGANISATION)))->getContent();
std::cout << "Organisation = " << organisation << std::endl;
}
break;
case E04PhoneBook::phoneBookDataElementEnum::ADDRESS: {
std::string address = (std::static_pointer_cast < E04PhoneBook::phoneBookDataElementString
- > ((*it0).at(E04PhoneBook::phoneBookDataElementEnum::ADDRESS)))->content;
+ > ((*it0).at(E04PhoneBook::phoneBookDataElementEnum::ADDRESS)))->getContent();
std::cout << "Address = " << address << std::endl;
}
break;
case E04PhoneBook::phoneBookDataElementEnum::EMAIL: {
std::string email = (std::static_pointer_cast < E04PhoneBook::phoneBookDataElementString
- > ((*it0).at(E04PhoneBook::phoneBookDataElementEnum::EMAIL)))->content;
+ > ((*it0).at(E04PhoneBook::phoneBookDataElementEnum::EMAIL)))->getContent();
std::cout << "EMail = " << email << std::endl;
}
break;
@@ -106,7 +108,7 @@ void printFilterResult(const std::vector<E04PhoneBook::phoneBookDataElementMap>&
case E04PhoneBook::phoneBookDataElementEnum::PHONENUMBER: {
E04PhoneBook::phoneNumberMap phoneNumber = (std::static_pointer_cast
< E04PhoneBook::phoneBookDataElementPhoneNumber
- > ((*it0).at(E04PhoneBook::phoneBookDataElementEnum::PHONENUMBER)))->content;
+ > ((*it0).at(E04PhoneBook::phoneBookDataElementEnum::PHONENUMBER)))->getContent();
for (E04PhoneBook::phoneNumberMap::iterator myPhoneNumberIterator = phoneNumber.begin();
myPhoneNumberIterator != phoneNumber.end();
myPhoneNumberIterator++) {
@@ -126,17 +128,19 @@ void printFilterResult(const std::vector<E04PhoneBook::phoneBookDataElementMap>&
}
int main() {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- std::shared_ptr<CommonAPI::Factory> factoryA = runtime->createFactory();
- std::shared_ptr<CommonAPI::Factory> factoryB = runtime->createFactory();
+ const std::string &domain = "local";
+ const std::string &instance = "commonapi.examples.PhoneBook";
- const std::string& serviceAddress = "local:commonapi.examples.PhoneBook:commonapi.examples.PhoneBook";
- std::shared_ptr < E04PhoneBookProxyDefault > myProxyA = factoryA->buildProxy < E04PhoneBookProxy > (serviceAddress);
+ std::shared_ptr < E04PhoneBookProxyDefault > myProxyA = runtime->buildProxy < E04PhoneBookProxy > (domain, instance);
while (!myProxyA->isAvailable()) {
usleep(10);
}
- std::shared_ptr < E04PhoneBookProxyDefault > myProxyB = factoryB->buildProxy < E04PhoneBookProxy > (serviceAddress);
+
+ const CommonAPI::ConnectionId_t otherConnectionId = "42";
+
+ std::shared_ptr < E04PhoneBookProxyDefault > myProxyB = runtime->buildProxy < E04PhoneBookProxy > (domain, instance, otherConnectionId);
while (!myProxyB->isAvailable()) {
usleep(10);
}
@@ -171,16 +175,21 @@ int main() {
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;
- 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, "*"}};
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/src/e04PhoneBookService.cpp b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookService.cpp
index fba15a2..03da5d8 100644
--- a/CommonAPI-Examples/e04PhoneBook/src/e04PhoneBookService.cpp
+++ b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookService.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 BMW Group
+/* Copyright (C) 2014, 2015 BMW Group
* Author: Manfred Bathelt (manfred.bathelt@bmw.de)
* Author: Juergen Gehring (juergen.gehring@bmw.de)
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -8,20 +8,18 @@
#include <thread>
#include <iostream>
-#include <CommonAPI/CommonAPI.h>
+#include <CommonAPI/CommonAPI.hpp>
#include "E04PhoneBookStubImpl.h"
int main() {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- const std::string& serviceAddress = "local:commonapi.examples.PhoneBook:commonapi.examples.PhoneBook";
+ const std::string &domain = "local";
+ const std::string &instance = "commonapi.examples.PhoneBook";
std::shared_ptr<E04PhoneBookStubImpl> myService = std::make_shared<E04PhoneBookStubImpl>();
- servicePublisher->registerService(myService, serviceAddress, factory);
-
myService->setPhoneBookAttribute(myService->createTestPhoneBook());
+ runtime->registerService(domain, instance, myService);
while (true) {
std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(2));
diff --git a/CommonAPI-Examples/e04PhoneBook/src/E04PhoneBookStubImpl.cpp b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.cpp
index a0a8e05..bfd06bb 100644
--- a/CommonAPI-Examples/e04PhoneBook/src/E04PhoneBookStubImpl.cpp
+++ b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.cpp
@@ -1,10 +1,12 @@
-/* Copyright (C) 2014 BMW Group
+/* Copyright (C) 2014, 2015 BMW Group
* Author: Manfred Bathelt (manfred.bathelt@bmw.de)
* Author: Juergen Gehring (juergen.gehring@bmw.de)
* 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/. */
+#include <algorithm>
+
#include "E04PhoneBookStubImpl.h"
using namespace commonapi::examples;
@@ -37,110 +39,122 @@ void E04PhoneBookStubImpl::onPhoneBookDataSetSelectiveSubscriptionChanged(const
}
}
-void E04PhoneBookStubImpl::setPhoneBookDataFilter(const std::shared_ptr<CommonAPI::ClientId> clientId,
- E04PhoneBook::elementFilterStruct elementFilter,
- std::vector<E04PhoneBook::contentFilterStruct> contentFilter) {
-
- std::shared_ptr < CommonAPI::ClientIdList > clientIdList = getSubscribersForPhoneBookDataSetSelective();
- std::cout << "setPhoneBookDataFilter called from client " << clientId->hashCode() << " of ("
- << clientIdList->size() << ")" << std::endl;
+void E04PhoneBookStubImpl::setPhoneBookDataFilter(const std::shared_ptr<CommonAPI::ClientId> _client,
+ 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;
std::vector < E04PhoneBook::phoneBookDataElementMap > lPhoneBookDataSet;
- phoneBookClientData.erase(clientId);
+
+ phoneBookClientData.erase(_client);
std::vector<E04PhoneBook::phoneBookStruct>::const_iterator it0;
for (it0 = getPhoneBookAttribute().begin(); it0 != getPhoneBookAttribute().end(); it0++) {
E04PhoneBook::phoneBookDataElementMap lPhoneBookDataElement;
- if (elementFilter.addName) {
+ if (_elementFilter.getAddName()) {
std::shared_ptr<E04PhoneBook::phoneBookDataElementString> name = std::make_shared<E04PhoneBook::phoneBookDataElementString>();
- name->content = it0->name;
+ name->setContent(it0->getName());
lPhoneBookDataElement[E04PhoneBook::phoneBookDataElementEnum::NAME] = name;
}
- if (elementFilter.addForename) {
+ if (_elementFilter.getAddForename()) {
std::shared_ptr<E04PhoneBook::phoneBookDataElementString> forename = std::make_shared<E04PhoneBook::phoneBookDataElementString>();
- forename->content = it0->forename;
+ forename->setContent(it0->getForename());
lPhoneBookDataElement[E04PhoneBook::phoneBookDataElementEnum::FORENAME] = forename;
}
- if (elementFilter.addOrganisation) {
+ if (_elementFilter.getAddOrganisation()) {
std::shared_ptr<E04PhoneBook::phoneBookDataElementString> organisation = std::make_shared<E04PhoneBook::phoneBookDataElementString>();
- organisation->content = it0->organisation;
+ organisation->setContent(it0->getOrganisation());
lPhoneBookDataElement[E04PhoneBook::phoneBookDataElementEnum::ORGANISATION] = organisation;
}
- if (elementFilter.addAddress) {
+ if (_elementFilter.getAddAddress()) {
std::shared_ptr<E04PhoneBook::phoneBookDataElementString> address = std::make_shared<E04PhoneBook::phoneBookDataElementString>();
- address->content = it0->address;
+ address->setContent(it0->getAddress());
lPhoneBookDataElement[E04PhoneBook::phoneBookDataElementEnum::ADDRESS] = address;
}
- if (elementFilter.addEmail) {
+ if (_elementFilter.getAddEmail()) {
std::shared_ptr<E04PhoneBook::phoneBookDataElementString> email = std::make_shared<E04PhoneBook::phoneBookDataElementString>();
- email->content = it0->email;
+ email->setContent(it0->getEmail());
lPhoneBookDataElement[E04PhoneBook::phoneBookDataElementEnum::EMAIL] = email;
}
- if (elementFilter.addPhoneNumber) {
+ if (_elementFilter.getAddPhoneNumber()) {
std::shared_ptr<E04PhoneBook::phoneBookDataElementPhoneNumber> phoneNumber = std::make_shared<E04PhoneBook::phoneBookDataElementPhoneNumber>();
- phoneNumber->content = it0->phoneNumber;
+ phoneNumber->setContent(it0->getPhoneNumber());
lPhoneBookDataElement[E04PhoneBook::phoneBookDataElementEnum::PHONENUMBER] = phoneNumber;
}
lPhoneBookDataSet.push_back(lPhoneBookDataElement);
-
}
- phoneBookClientData[clientId] = lPhoneBookDataSet;
+ phoneBookClientData[_client] = lPhoneBookDataSet;
// Send client data
const std::shared_ptr<CommonAPI::ClientIdList> receivers(new CommonAPI::ClientIdList);
- receivers->insert(clientId);
- std::cout << "firePhoneBookDataSetSelective: " << receivers->size() << " / " << phoneBookClientData[clientId].size()
- << std::endl;
+ receivers->insert(_client);
+ std::cout << "firePhoneBookDataSetSelective: " << receivers->size() << " / " << phoneBookClientData[_client].size() << std::endl;
+
firePhoneBookDataSetSelective(lPhoneBookDataSet, receivers);
- receivers->erase(clientId);
+
+ receivers->erase(_client);
std::cout << "setPhoneBookDataFilter end." << std::endl;
+ _reply();
}
std::vector<E04PhoneBook::phoneBookStruct> E04PhoneBookStubImpl::createTestPhoneBook() {
std::vector<E04PhoneBook::phoneBookStruct> lPhoneBook;
E04PhoneBook::phoneBookStruct lPhoneBookEntry;
+ E04PhoneBook::phoneNumberMap lPhoneBookEntryMap;
// 1. entry
- lPhoneBookEntry.name = "Gehring";
- lPhoneBookEntry.forename = "Jürgen";
- lPhoneBookEntry.organisation = "BMW";
- lPhoneBookEntry.address = "Max-Diamand-Straße 13, 80788 München";
- lPhoneBookEntry.email = "juergen.gehring@bmw.de";
- lPhoneBookEntry.phoneNumber[E04PhoneBook::phoneNumberEnum::WORK] = "0111/12345-0";
+ lPhoneBookEntryMap[E04PhoneBook::phoneNumberEnum::WORK] = "0111/12345-0";
+
+ lPhoneBookEntry.setName("Gehring");
+ lPhoneBookEntry.setForename("Jürgen");
+ lPhoneBookEntry.setOrganisation("BMW");
+ lPhoneBookEntry.setAddress("Max-Diamand-Straße 13, 80788 München");
+ lPhoneBookEntry.setEmail("juergen.gehring@bmw.de");
+ lPhoneBookEntry.setPhoneNumber(lPhoneBookEntryMap);
lPhoneBook.push_back(lPhoneBookEntry);
- lPhoneBookEntry.phoneNumber.clear();
+
+ lPhoneBookEntryMap.clear();
// 2. entry
- lPhoneBookEntry.name = "Müller";
- lPhoneBookEntry.forename = "Alfred";
- lPhoneBookEntry.organisation = "Audi";
- lPhoneBookEntry.address = "August-Horch-Straße 27, 85055 Ingolstadt";
- lPhoneBookEntry.email = "alfred.mueller@audi.de";
- lPhoneBookEntry.phoneNumber[E04PhoneBook::phoneNumberEnum::MOBILE1] = "0222/23456-0";
+ lPhoneBookEntryMap[E04PhoneBook::phoneNumberEnum::MOBILE1] = "0222/23456-0";
+
+ lPhoneBookEntry.setName("Müller");
+ lPhoneBookEntry.setForename("Alfred");
+ lPhoneBookEntry.setOrganisation("Audi");
+ lPhoneBookEntry.setAddress("August-Horch-Straße 27, 85055 Ingolstadt");
+ lPhoneBookEntry.setEmail("alfred.mueller@audi.de");
+ lPhoneBookEntry.setPhoneNumber(lPhoneBookEntryMap);
lPhoneBook.push_back(lPhoneBookEntry);
- lPhoneBookEntry.phoneNumber.clear();
+
+ lPhoneBookEntryMap.clear();
// 3. entry
- lPhoneBookEntry.name = "Maier";
- lPhoneBookEntry.forename = "Hansi";
- lPhoneBookEntry.organisation = "Daimler";
- lPhoneBookEntry.address = "Mercedesstraße 137, 70546 Stuttgart";
- lPhoneBookEntry.email = "hansi.maier@daimler.de";
- lPhoneBookEntry.phoneNumber[E04PhoneBook::phoneNumberEnum::HOME] = "0333/34567-0";
- lPhoneBookEntry.phoneNumber[E04PhoneBook::phoneNumberEnum::WORK] = "0444/34567-1";
+ lPhoneBookEntryMap[E04PhoneBook::phoneNumberEnum::HOME] = "0333/34567-0";
+ lPhoneBookEntryMap[E04PhoneBook::phoneNumberEnum::WORK] = "0444/34567-1";
+
+ lPhoneBookEntry.setName("Maier");
+ lPhoneBookEntry.setForename("Hansi");
+ lPhoneBookEntry.setOrganisation("Daimler");
+ lPhoneBookEntry.setAddress("Mercedesstraße 137, 70546 Stuttgart");
+ lPhoneBookEntry.setEmail("hansi.maier@daimler.de");
+ lPhoneBookEntry.setPhoneNumber(lPhoneBookEntryMap);
lPhoneBook.push_back(lPhoneBookEntry);
- lPhoneBookEntry.phoneNumber.clear();
+
+ lPhoneBookEntryMap.clear();
return lPhoneBook;
}
diff --git a/CommonAPI-Examples/e04PhoneBook/src/E04PhoneBookStubImpl.h b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.h
index 9eebb29..38fce08 100644
--- a/CommonAPI-Examples/e04PhoneBook/src/E04PhoneBookStubImpl.h
+++ b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookStubImpl.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 BMW Group
+/* Copyright (C) 2014, 2015 BMW Group
* Author: Manfred Bathelt (manfred.bathelt@bmw.de)
* Author: Juergen Gehring (juergen.gehring@bmw.de)
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -8,8 +8,8 @@
#ifndef E04PHONEBOOKSTUBIMPL_H_
#define E04PHONEBOOKSTUBIMPL_H_
-#include <CommonAPI/CommonAPI.h>
-#include <commonapi/examples/E04PhoneBookStubDefault.h>
+#include <CommonAPI/CommonAPI.hpp>
+#include <commonapi/examples/E04PhoneBookStubDefault.hpp>
using namespace commonapi::examples;
@@ -24,10 +24,11 @@ public:
void onPhoneBookDataSetSelectiveSubscriptionChanged(
const std::shared_ptr<CommonAPI::ClientId>,
const CommonAPI::SelectiveBroadcastSubscriptionEvent);
- void setPhoneBookDataFilter(
- const std::shared_ptr<CommonAPI::ClientId>,
- E04PhoneBook::elementFilterStruct,
- std::vector<E04PhoneBook::contentFilterStruct>);
+
+ void setPhoneBookDataFilter(const std::shared_ptr<CommonAPI::ClientId> _client,
+ 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/E05Manager/.cproject b/CommonAPI-Examples/E05Manager/.cproject
new file mode 100644
index 0000000..fe9fce2
--- /dev/null
+++ b/CommonAPI-Examples/E05Manager/.cproject
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="0.1351891989">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1351891989" moduleId="org.eclipse.cdt.core.settings" name="Default">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildProperties="" description="" id="0.1351891989" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
+ <folderInfo id="0.1351891989." name="/" resourcePath="">
+ <toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1234274354" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
+ <targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1234274354.233049048" name=""/>
+ <builder arguments="-C ${ProjDirPath}/build VERBOSE=0" buildPath="" command="make" id="org.eclipse.cdt.build.core.settings.default.builder.1553075555" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.libs.2105323305" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.1122187189" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1459463066" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.1636660805" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1286572310" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.854927977" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.181992051" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="e05Manager.null.2055319143" name="e05Manager"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ <scannerConfigBuildInfo instanceId="0.1351891989">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="refreshScope" versionNumber="2">
+ <configuration configurationName="Default">
+ <resource resourceType="PROJECT" workspacePath="/e05Manager"/>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
+ <buildTargets>
+ <target name="Run cmake" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
+ <buildCommand>cmake</buildCommand>
+ <buildArguments>-E chdir build/ cmake -D CMAKE_BUILD_TYPE=Debug -D USE_INSTALLED_COMMONAPI=OFF -DUSE_INSTALLED_DBUS=OFF ../</buildArguments>
+ <buildTarget/>
+ <stopOnError>true</stopOnError>
+ <useDefaultCommand>false</useDefaultCommand>
+ <runAllBuilders>true</runAllBuilders>
+ </target>
+ </buildTargets>
+ </storageModule>
+</cproject>
diff --git a/CommonAPI-Examples/e04PhoneBook/.gitignore b/CommonAPI-Examples/E05Manager/.gitignore
index 5897208..5897208 100644
--- a/CommonAPI-Examples/e04PhoneBook/.gitignore
+++ b/CommonAPI-Examples/E05Manager/.gitignore
diff --git a/CommonAPI-Examples/E05Manager/.project b/CommonAPI-Examples/E05Manager/.project
new file mode 100644
index 0000000..3deb967
--- /dev/null
+++ b/CommonAPI-Examples/E05Manager/.project
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>E05Manager</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/CommonAPI-Examples/E05Manager/CMakeLists.txt b/CommonAPI-Examples/E05Manager/CMakeLists.txt
new file mode 100644
index 0000000..db10047
--- /dev/null
+++ b/CommonAPI-Examples/E05Manager/CMakeLists.txt
@@ -0,0 +1,90 @@
+# Copyright (C) 2014, 2015 BMW Group
+# Author: Manfred Bathelt (manfred.bathelt@bmw.de)
+# Author: Juergen Gehring (juergen.gehring@bmw.de)
+# 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/.
+
+cmake_minimum_required(VERSION 2.8)
+
+set(PRJ_NAME E05Manager)
+
+set(CMAKE_VERBOSE_MAKEFILE on)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O0 -std=c++0x -D_GLIBCXX_USE_NANOSLEEP")
+
+message(STATUS "Compiler options: ${CMAKE_CXX_FLAGS}")
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
+ "Choose the type of build, options are: Debug Release." FORCE)
+endif(NOT CMAKE_BUILD_TYPE)
+message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
+
+OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version of CommonAPI" ON)
+message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}")
+
+if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+else()
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+endif()
+
+message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_INCLUDE_DIRS: ${COMMONAPI_INCLUDE_DIRS}")
+message(STATUS "CommonAPI-DBus_CONSIDERED_CONFIGS: ${CommonAPI-DBus_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_DBUS_INCLUDE_DIRS: ${COMMONAPI_DBUS_INCLUDE_DIRS}")
+
+# CommonAPI
+include(FindPkgConfig)
+pkg_check_modules (DBUS "dbus-1 >= 1.4")
+
+# Source Files
+set(PRJ_SRC_PATH src)
+set(PRJ_SRC_GEN_PATH src-gen/v1_0/commonapi/examples)
+
+set(PRJ_NAME_CLIENT ${PRJ_NAME}Client)
+set(PRJ_NAME_SERVICE ${PRJ_NAME}Service)
+
+FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Proxy.cpp ${PRJ_SRC_GEN_PATH}/${PRJ_NAME}.cpp)
+FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Stub*.cpp ${PRJ_SRC_GEN_PATH}/${PRJ_NAME}.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})
+
+# Paths
+OPTION(USE_INSTALLED_DBUS "Set to OFF to use the local (patched) version of dbus" ON)
+message(STATUS "USE_INSTALLED_DBUS is set to value: ${USE_INSTALLED_DBUS}")
+
+include_directories(
+ src-gen
+ ${COMMONAPI_INCLUDE_DIRS}
+ ${COMMONAPI_DBUS_INCLUDE_DIRS}
+ ${DBUS_INCLUDE_DIRS}
+)
+
+if ("${USE_INSTALLED_DBUS}" STREQUAL "ON")
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${DBUS_LIBDIR}
+)
+else()
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${DBUS_INCLUDE_DIRS}/dbus/.libs
+)
+endif()
+
+set(LINK_LIBRARIES -Wl,--no-as-needed CommonAPI-DBus -Wl,--as-needed CommonAPI ${DBUS_LIBRARIES})
+
+# Build Client
+add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS})
+target_link_libraries(${PRJ_NAME_CLIENT} ${LINK_LIBRARIES})
+
+# Build service
+add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS})
+target_link_libraries(${PRJ_NAME_SERVICE} ${LINK_LIBRARIES})
diff --git a/CommonAPI-Examples/E05Manager/README b/CommonAPI-Examples/E05Manager/README
new file mode 100644
index 0000000..66bd9a0
--- /dev/null
+++ b/CommonAPI-Examples/E05Manager/README
@@ -0,0 +1,125 @@
+=== Example 05: Managed
+
+So far we have looked at software systems, which consisted of services and users of these services, the clients. However, in some systems there is a slightly different kind of relationship between the software components: a central manager manages other services (let's call them slaves or leaves). This central manager is a service itself but acts as client for the managed services. One example for such a system is, for example, a device manager that manages several devices, which can be available for usage in the system or not. The central manager handles all administrative tasks related to the slaves and provides a central, common interface to the user frontend.
+
+image::{imagedir}/E05Manager.png[ManagerExample image]
+
+Franca IDL supports this kind of software structure by the keyword _manages_, which can be added to the keyword interface. The following example illustrates the application of this keyword.
+
+[source,java]
+----
+package commonapi.examples
+
+interface E05Manager manages E05Device, E05SpecialDevice {
+ version { major 1 minor 0 }
+
+ attribute String [] myDevices
+
+}
+
+interface E05Device {
+ version { major 1 minor 0 }
+
+ method doSomething {
+ }
+}
+
+interface E05SpecialDevice extends E05Device {
+ version { major 1 minor 0 }
+
+ method doSomethingSpecial {
+ }
+}
+----
+
+The device manager has the service interface E05Manager and it manages devices with the interfaces E05Device and E05SpecialDevice. It is important to understand, that the exact meaning of the keyword +manages+ cannot be defined by the IDL; the keyword just indicates that there is a relationship between software components which implement manager and managed interfaces. It can be used in bindings as CommonAPI to provide API functions for a more convenient implementation of this certain kind of relationship.
+
+Therefore let's have a look at the generated and implemented source code. Since we have three interfaces the code generator generates for every interface proxy and stub classes. In our example we just want to illuminate one aspect of the managed interfaces: the registration of the managed interfaces via the manager. We assume that we have only one service (the manager) which gets informed about a detected or a removed device via the public function deviceDetected and deviceRemoved. The devices are distinguished by a number; in principle there is an arbitrary number of devices possible. The registration of the devices at CommonAPI does the manager in his stub implementation.
+
+[source,{cppstr}]
+----
+... // includes, namespaces, constructors as usual
+
+E05ManagerStubImpl::E05ManagerStubImpl(const std::string instanceName) {
+ managerInstanceName = instanceName;
+}
+
+
+void E05ManagerStubImpl::deviceDetected (unsigned int n) {
+
+ std::string deviceInstanceName = getDeviceName(n);
+ myDevices[deviceInstanceName] = DevicePtr (new E05DeviceStubImpl);
+ const bool deviceRegistered = this->registerManagedStubE05Device(
+ myDevices[deviceInstanceName], deviceInstanceName);
+}
+
+void E05ManagerStubImpl::deviceRemoved (unsigned int n) {
+
+ std::string deviceInstanceName = getDeviceName (n);
+ const bool deviceDeregistered = this->deregisterManagedStubE05Device(
+ deviceInstanceName);
+ if ( deviceDeregistered ) { myDevices.erase (deviceInstanceName); }
+}
+
+std::string E05ManagerStubImpl::getDeviceName (unsigned int n) {
+
+ std::stringstream ss;
+ ss << managerInstanceName <<
+ ".device" << std::setw(2) << std::hex << std::setfill('0') << n;
+ return ss.str();
+}
+
+... // implementation of special device analogously
+----
+
+The functions for the special device has been omitted for clarity.The implementations of the devices themselves are not important here as well. See now the implementation of the client. The client gets informed about new or removed devices including the addresses of these devices via the callback function newDeviceAvailable. This function can be subscribed as function object at an status event that is triggered when a device is added or removed.
+
+[source, {cppstr}]
+----
+#include <unistd.h>
+#include <iostream>
+
+#include <CommonAPI/CommonAPI.hpp>
+#include <v1_0/commonapi/examples/E05ManagerProxy.hpp>
+
+using namespace v1_0::commonapi::examples;
+
+void newDeviceAvailable(const std::string address,
+ const CommonAPI::AvailabilityStatus status) {
+
+ if (status == CommonAPI::AvailabilityStatus::AVAILABLE) {
+ std::cout << "New device available: " << address << std::endl;
+ }
+
+ if (status == CommonAPI::AvailabilityStatus::NOT_AVAILABLE) {
+ std::cout << "Device removed: " << address << std::endl;
+ }
+}
+
+int main() {
+ 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); }
+
+ CommonAPI::ProxyManager::InstanceAvailabilityStatusChangedEvent& deviceEvent =
+ myProxy->getProxyManagerE05Device().getInstanceAvailabilityStatusChangedEvent();
+
+ /* special device analogously */
+
+ 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)); }
+ return 0;
+}
+----
+
diff --git a/CommonAPI-Examples/e05Manager/fidl/E05Manager.fidl b/CommonAPI-Examples/E05Manager/fidl/E05Manager.fidl
index ff020b0..ff020b0 100644
--- a/CommonAPI-Examples/e05Manager/fidl/E05Manager.fidl
+++ b/CommonAPI-Examples/E05Manager/fidl/E05Manager.fidl
diff --git a/CommonAPI-Examples/e05Manager/src/E05DeviceStubImpl.cpp b/CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.cpp
index f8edfa9..80bc2be 100644
--- a/CommonAPI-Examples/e05Manager/src/E05DeviceStubImpl.cpp
+++ b/CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.cpp
@@ -9,8 +9,6 @@
#include "E05DeviceStubImpl.h"
-using namespace commonapi::examples;
-
E05DeviceStubImpl::E05DeviceStubImpl() {
}
diff --git a/CommonAPI-Examples/e05Manager/src/E05DeviceStubImpl.h b/CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.h
index e61a3cb..7b1932f 100644
--- a/CommonAPI-Examples/e05Manager/src/E05DeviceStubImpl.h
+++ b/CommonAPI-Examples/E05Manager/src/E05DeviceStubImpl.h
@@ -8,9 +8,9 @@
#ifndef E05DEVICESTUBIMPL_H_
#define E05DEVICESTUBIMPL_H_
-#include <commonapi/examples/E05DeviceStubDefault.h>
+#include <v1_0/commonapi/examples/E05DeviceStubDefault.hpp>
-using namespace commonapi::examples;
+using namespace v1_0::commonapi::examples;
class E05DeviceStubImpl: public E05DeviceStubDefault {
public:
diff --git a/CommonAPI-Examples/e05Manager/src/e05ManagerClient.cpp b/CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp
index b04b56d..d43fb3d 100644
--- a/CommonAPI-Examples/e05Manager/src/e05ManagerClient.cpp
+++ b/CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp
@@ -5,12 +5,14 @@
* 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/. */
+#include <unistd.h>
+
#include <iostream>
-#include <CommonAPI/CommonAPI.h>
-#include <commonapi/examples/E05ManagerProxy.h>
+#include <CommonAPI/CommonAPI.hpp>
+#include <v1_0/commonapi/examples/E05ManagerProxy.hpp>
-using namespace commonapi::examples;
+using namespace v1_0::commonapi::examples;
void newDeviceAvailable(const std::string address, const CommonAPI::AvailabilityStatus status) {
if (status == CommonAPI::AvailabilityStatus::AVAILABLE) {
@@ -23,12 +25,11 @@ void newDeviceAvailable(const std::string address, const CommonAPI::Availability
}
int main() {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
-
- std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- const std::string& serviceAddress = "local:commonapi.examples.Manager:commonapi.examples.Manager";
- std::shared_ptr<E05ManagerProxyDefault> myProxy = factory->buildProxy<E05ManagerProxy>(serviceAddress);
+ 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);
}
diff --git a/CommonAPI-Examples/e05Manager/src/e05ManagerService.cpp b/CommonAPI-Examples/E05Manager/src/E05ManagerService.cpp
index 2ae5d07..188d46c 100644
--- a/CommonAPI-Examples/e05Manager/src/e05ManagerService.cpp
+++ b/CommonAPI-Examples/E05Manager/src/E05ManagerService.cpp
@@ -8,24 +8,19 @@
#include <thread>
#include <iostream>
-#include <CommonAPI/CommonAPI.h>
+#include <CommonAPI/CommonAPI.hpp>
#include "E05ManagerStubImpl.h"
-using namespace commonapi::examples;
+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";
int main() {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
-
- const std::string& serviceAddress = "local:commonapi.examples.Manager:" + managerInstanceName;
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
std::shared_ptr<E05ManagerStubImpl> myService = std::make_shared < E05ManagerStubImpl > (managerInstanceName);
-
- const bool serviceRegistered = servicePublisher->registerService(myService, serviceAddress, factory);
+ const bool serviceRegistered = runtime->registerService("local", managerInstanceName, myService);
if (!serviceRegistered) {
std::cout << "Error: Unable to register service." << std::endl;
diff --git a/CommonAPI-Examples/e05Manager/src/E05ManagerStubImpl.cpp b/CommonAPI-Examples/E05Manager/src/E05ManagerStubImpl.cpp
index ab02edd..82f73e0 100644
--- a/CommonAPI-Examples/e05Manager/src/E05ManagerStubImpl.cpp
+++ b/CommonAPI-Examples/E05Manager/src/E05ManagerStubImpl.cpp
@@ -10,7 +10,7 @@
#include "E05ManagerStubImpl.h"
-using namespace commonapi::examples;
+using namespace v1_0::commonapi::examples;
E05ManagerStubImpl::E05ManagerStubImpl() {
}
diff --git a/CommonAPI-Examples/e05Manager/src/E05ManagerStubImpl.h b/CommonAPI-Examples/E05Manager/src/E05ManagerStubImpl.h
index c03c742..94be54d 100644
--- a/CommonAPI-Examples/e05Manager/src/E05ManagerStubImpl.h
+++ b/CommonAPI-Examples/E05Manager/src/E05ManagerStubImpl.h
@@ -10,13 +10,13 @@
#include <map>
-#include <CommonAPI/CommonAPI.h>
-#include <commonapi/examples/E05ManagerStubDefault.h>
+#include <CommonAPI/CommonAPI.hpp>
+#include <v1_0/commonapi/examples/E05ManagerStubDefault.hpp>
#include "E05DeviceStubImpl.h"
#include "E05SpecialDeviceStubImpl.h"
-using namespace commonapi::examples;
+using namespace v1_0::commonapi::examples;
class E05ManagerStubImpl: public E05ManagerStubDefault {
diff --git a/CommonAPI-Examples/e05Manager/src/E05SpecialDeviceStubImpl.cpp b/CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.cpp
index 4bbcf88..f31710c 100644
--- a/CommonAPI-Examples/e05Manager/src/E05SpecialDeviceStubImpl.cpp
+++ b/CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.cpp
@@ -9,8 +9,6 @@
#include "E05SpecialDeviceStubImpl.h"
-using namespace commonapi::examples;
-
E05SpecialDeviceStubImpl::E05SpecialDeviceStubImpl() {
}
diff --git a/CommonAPI-Examples/e05Manager/src/E05SpecialDeviceStubImpl.h b/CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.h
index eb172f6..0649ac5 100644
--- a/CommonAPI-Examples/e05Manager/src/E05SpecialDeviceStubImpl.h
+++ b/CommonAPI-Examples/E05Manager/src/E05SpecialDeviceStubImpl.h
@@ -8,9 +8,9 @@
#ifndef E05SPECIALDEVICESTUBIMPL_H_
#define E05SPECIALDEVICESTUBIMPL_H_
-#include <commonapi/examples/E05SpecialDeviceStubDefault.h>
+#include <v1_0/commonapi/examples/E05SpecialDeviceStubDefault.hpp>
-using namespace commonapi::examples;
+using namespace v1_0::commonapi::examples;
class E05SpecialDeviceStubImpl: public E05SpecialDeviceStubDefault {
public:
diff --git a/CommonAPI-Examples/E06Unions/.cproject b/CommonAPI-Examples/E06Unions/.cproject
new file mode 100644
index 0000000..95bebce
--- /dev/null
+++ b/CommonAPI-Examples/E06Unions/.cproject
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="0.1743517197">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1743517197" moduleId="org.eclipse.cdt.core.settings" name="Default">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildProperties="" description="" id="0.1743517197" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
+ <folderInfo id="0.1743517197." name="/" resourcePath="">
+ <toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1356057110" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
+ <targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1356057110.1351683931" name=""/>
+ <builder arguments="-C ${ProjDirPath}/build VERBOSE=0" buildPath="" command="make" id="org.eclipse.cdt.build.core.settings.default.builder.1927391379" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.libs.576448025" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.1490051833" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1742293224" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.1873415814" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1872659220" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.1934675545" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1097099165" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="e06Unions.null.1703363965" name="e06Unions"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ <scannerConfigBuildInfo instanceId="0.1743517197">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="refreshScope" versionNumber="2">
+ <configuration configurationName="Default">
+ <resource resourceType="PROJECT" workspacePath="/e06Unions"/>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
+ <buildTargets>
+ <target name="Run cmake" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
+ <buildCommand>cmake</buildCommand>
+ <buildArguments>-E chdir build/ cmake -D CMAKE_BUILD_TYPE=Debug -D USE_INSTALLED_COMMONAPI=OFF -DUSE_INSTALLED_DBUS=OFF ../</buildArguments>
+ <buildTarget/>
+ <stopOnError>true</stopOnError>
+ <useDefaultCommand>false</useDefaultCommand>
+ <runAllBuilders>true</runAllBuilders>
+ </target>
+ </buildTargets>
+ </storageModule>
+</cproject>
diff --git a/CommonAPI-Examples/e05Manager/.gitignore b/CommonAPI-Examples/E06Unions/.gitignore
index 5897208..5897208 100644
--- a/CommonAPI-Examples/e05Manager/.gitignore
+++ b/CommonAPI-Examples/E06Unions/.gitignore
diff --git a/CommonAPI-Examples/E06Unions/.project b/CommonAPI-Examples/E06Unions/.project
new file mode 100644
index 0000000..e24f0e5
--- /dev/null
+++ b/CommonAPI-Examples/E06Unions/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>E06Unions</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ </natures>
+</projectDescription>
diff --git a/CommonAPI-Examples/E06Unions/CMakeLists.txt b/CommonAPI-Examples/E06Unions/CMakeLists.txt
new file mode 100644
index 0000000..641fd78
--- /dev/null
+++ b/CommonAPI-Examples/E06Unions/CMakeLists.txt
@@ -0,0 +1,90 @@
+# Copyright (C) 2014, 2015 BMW Group
+# Author: Manfred Bathelt (manfred.bathelt@bmw.de)
+# Author: Juergen Gehring (juergen.gehring@bmw.de)
+# 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/.
+
+cmake_minimum_required(VERSION 2.8)
+
+set(PRJ_NAME E06Unions)
+
+set(CMAKE_VERBOSE_MAKEFILE on)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O0 -std=c++0x -D_GLIBCXX_USE_NANOSLEEP")
+
+message(STATUS "Compiler options: ${CMAKE_CXX_FLAGS}")
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
+ "Choose the type of build, options are: Debug Release." FORCE)
+endif(NOT CMAKE_BUILD_TYPE)
+message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
+
+OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version of CommonAPI" ON)
+message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}")
+
+if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+else()
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+endif()
+
+message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_INCLUDE_DIRS: ${COMMONAPI_INCLUDE_DIRS}")
+message(STATUS "CommonAPI-DBus_CONSIDERED_CONFIGS: ${CommonAPI-DBus_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_DBUS_INCLUDE_DIRS: ${COMMONAPI_DBUS_INCLUDE_DIRS}")
+
+# CommonAPI
+include(FindPkgConfig)
+pkg_check_modules (DBUS "dbus-1 >= 1.4")
+
+# Source Files
+set(PRJ_SRC_PATH src)
+set(PRJ_SRC_GEN_PATH src-gen/commonapi/examples)
+
+set(PRJ_NAME_CLIENT ${PRJ_NAME}Client)
+set(PRJ_NAME_SERVICE ${PRJ_NAME}Service)
+
+FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Proxy.cpp ${PRJ_SRC_GEN_PATH}/${PRJ_NAME}.cpp ${PRJ_SRC_GEN_PATH}/CommonTypes.cpp)
+FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Stub*.cpp ${PRJ_SRC_GEN_PATH}/${PRJ_NAME}.cpp ${PRJ_SRC_GEN_PATH}/CommonTypes.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})
+
+# Paths
+OPTION(USE_INSTALLED_DBUS "Set to OFF to use the local (patched) version of dbus" ON)
+message(STATUS "USE_INSTALLED_DBUS is set to value: ${USE_INSTALLED_DBUS}")
+
+include_directories(
+ src-gen
+ ${COMMONAPI_INCLUDE_DIRS}
+ ${COMMONAPI_DBUS_INCLUDE_DIRS}
+ ${DBUS_INCLUDE_DIRS}
+)
+
+if ("${USE_INSTALLED_DBUS}" STREQUAL "ON")
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${DBUS_LIBDIR}
+)
+else()
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${DBUS_INCLUDE_DIRS}/dbus/.libs
+)
+endif()
+
+set(LINK_LIBRARIES -Wl,--no-as-needed CommonAPI-DBus -Wl,--as-needed CommonAPI ${DBUS_LIBRARIES})
+
+# Build Client
+add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS})
+target_link_libraries(${PRJ_NAME_CLIENT} ${LINK_LIBRARIES})
+
+# Build service
+add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS})
+target_link_libraries(${PRJ_NAME_SERVICE} ${LINK_LIBRARIES})
diff --git a/CommonAPI-Examples/e06Unions/README b/CommonAPI-Examples/E06Unions/README
index 774f9b4..c4f1884 100644
--- a/CommonAPI-Examples/e06Unions/README
+++ b/CommonAPI-Examples/E06Unions/README
@@ -1,5 +1,4 @@
-Example 6: Unions
-~~~~~~~~~~~~~~~~~
+=== Example 06: Unions
Until now, some simple and complex data types in the examples already occurred. This example intends to describe the use of unions closer and to compare it with the usage of polymorphic structs. Consider the following Franca IDL example:
@@ -8,13 +7,14 @@ Until now, some simple and complex data types in the examples already occurred.
package commonapi.examples
interface E06Unions {
- version { major 1 minor 0 }
+ version { major 0 minor 0 }
attribute CommonTypes.SettingsUnion u
attribute CommonTypes.SettingsStruct x
}
typeCollection CommonTypes {
+ version { major 0 minor 0 }
typedef MyTypedef is Int32
@@ -52,7 +52,7 @@ typeCollection CommonTypes {
}
----
-We first want to leave the question aside whether this example makes sense from an application point of view or not; it is just an example for demonstration purposes. With unions we can transmit data of different types in one attribute. These different types are enumerated in one structure with the keyword *union*. D-Bus knows a similar data type which is called variant. Variants are used in the D-Bus binding for the implementation of unions. The interesting point is here not the definition of the union, but the realization in CommonAPI. I just want to point out here that it can lead to problems with the compiler or generally to problems with your toolchain if you define unions with an significant number of members (eg. >10), because each of these members appears in the generated C++ code as template argument in the template declaration.
+We first want to leave the question aside whether this example makes sense from an application point of view or not; it is just an example for demonstration purposes. With unions we can transmit data of different types in one attribute. These different types are enumerated in one structure with the keyword +union+. D-Bus knows a similar data type which is called variant. Variants are used in the D-Bus binding for the implementation of unions. The interesting point is here not the definition of the union, but the realization in CommonAPI. I just want to point out here that it can lead to problems with the compiler or generally to problems with your toolchain if you define unions with an significant number of members (eg. >10), because each of these members appears in the generated C++ code as template argument in the template declaration.
On the other hand we see the definition of a +polymorphic struct+ which can lead to a similar but not the same behavior. The difference is that the types of the +polymorphic struct+ definitions are extensions of a base type (here +SettingsStruct+), that means that they are inherited from this base type. The base type might contain some base elements which are then be inherited by the children. Another difference is, that the C++ API allows real polymorphic behavior. With Unions that is not possible, since there is no base type as we will see below.
@@ -61,32 +61,35 @@ The implementation of the set function for the attribute u in the stub implement
[source,{cppstr}]
----
void E06UnionsStubImpl::setMyValue(int n) {
-
- if ( n >= 0 && n < 4 ) {
-
- CommonTypes::MyTypedef t0 = -5;
- CommonTypes::MyEnum t1 = CommonTypes::MyEnum::OFF;
- uint8_t t2 = 42;
- std::string t3 = "abc";
-
- if ( n == 0 ) {
- CommonTypes::SettingsUnion v(t0);
- setUAttribute(v);
- setXAttribute(std::make_shared<CommonTypes::SettingsStructMyTypedef>(t0));
- } else if ( n == 1 ) {
- CommonTypes::SettingsUnion v(t1);
- setUAttribute(v);
- setXAttribute(std::make_shared<CommonTypes::SettingsStructMyEnum>(t1));
- } else if ( n == 2 ) {
- CommonTypes::SettingsUnion v(t2);
- setUAttribute(v);
- setXAttribute(std::make_shared<CommonTypes::SettingsStructUInt8>(t2));
- } else if ( n == 3 ) {
- CommonTypes::SettingsUnion v(t3);
- setUAttribute(v);
- setXAttribute(std::make_shared<CommonTypes::SettingsStructString>(t3));
- }
- }
+
+ if (n >= 0 && n < 4) {
+
+ CommonTypes::MyTypedef t0 = -5;
+ CommonTypes::MyEnum t1 = CommonTypes::MyEnum::OFF;
+ uint8_t t2 = 42;
+ std::string t3 = "∃y ∀x ¬(x ≺ y)";
+
+ if (n == 0) {
+ CommonTypes::SettingsUnion v(t0);
+ setUAttribute(v);
+ setXAttribute(std::make_shared<CommonTypes::SettingsStructMyTypedef>(t0));
+ } else if (n == 1) {
+ CommonTypes::SettingsUnion v(t1);
+ setUAttribute(v);
+ setXAttribute(std::make_shared<CommonTypes::SettingsStructMyEnum>(t1));
+ } else if (n == 2) {
+ CommonTypes::SettingsUnion v(t2);
+ setUAttribute(v);
+ setXAttribute(std::make_shared<CommonTypes::SettingsStructUInt8>(t2));
+ } else if (n == 3) {
+ CommonTypes::SettingsUnion v(t3);
+ setUAttribute(v);
+ setXAttribute(std::make_shared<CommonTypes::SettingsStructString>(t3));
+ }
+
+ } else {
+ std::cout << "Type number " << n << " not possible." << std::endl;
+ }
}
----
@@ -96,11 +99,14 @@ The standard implementation on client side to get the value of the attribute use
[source,{cppstr}]
----
+#include <unistd.h>
#include <iostream>
-#include <CommonAPI/CommonAPI.h>
-#include <commonapi/examples/E06UnionsProxy.h>
-#include <commonapi/examples/CommonTypes.h>
+#include <CommonAPI/CommonAPI.hpp>
+
+#include "../src-gen/commonapi/examples/CommonTypes.hpp"
+#include "../src-gen/commonapi/examples/E06UnionsProxy.hpp"
+#include "typeUtils.hpp"
using namespace commonapi::examples;
@@ -131,18 +137,20 @@ void recv_msg(const CommonTypes::SettingsUnion& v) {
}
int main() {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
- const std::string& serviceAddress =
- "local:commonapi.examples.Unions:commonapi.examples.Unions";
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
+
+ const std::string &domain = "local";
+ const std::string &instance = "commonapi.examples.Unions";
std::shared_ptr<E06UnionsProxyDefault> myProxy =
- factory->buildProxy<E06UnionsProxy> (serviceAddress);
+ runtime->buildProxy<E06UnionsProxy>(domain, instance);
+
while (!myProxy->isAvailable()) { usleep(10); }
std::function<void (CommonTypes::SettingsUnion)> f = recv_msg;
myProxy->getUAttribute().getChangedEvent().subscribe(f);
while (true) { usleep(10); }
+
return 0;
}
----
diff --git a/CommonAPI-Examples/e06Unions/fidl/E06Unions.fidl b/CommonAPI-Examples/E06Unions/fidl/E06Unions.fidl
index b244625..60dae9d 100644
--- a/CommonAPI-Examples/e06Unions/fidl/E06Unions.fidl
+++ b/CommonAPI-Examples/E06Unions/fidl/E06Unions.fidl
@@ -8,13 +8,14 @@
package commonapi.examples
interface E06Unions {
- version { major 1 minor 0 }
+ version { major 0 minor 0 }
attribute CommonTypes.SettingsUnion u
attribute CommonTypes.SettingsStruct x
}
typeCollection CommonTypes {
+ version { major 0 minor 0 }
typedef MyTypedef is Int32
diff --git a/CommonAPI-Examples/e06Unions/src/e06UnionsClient.cpp b/CommonAPI-Examples/E06Unions/src/E06UnionsClient.cpp
index ddefcf0..2fa2527 100644
--- a/CommonAPI-Examples/e06Unions/src/e06UnionsClient.cpp
+++ b/CommonAPI-Examples/E06Unions/src/E06UnionsClient.cpp
@@ -5,12 +5,14 @@
* 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/. */
+#include <unistd.h>
+
#include <iostream>
-#include <CommonAPI/CommonAPI.h>
-#include <commonapi/examples/E06UnionsProxy.h>
-#include <commonapi/examples/CommonTypes.h>
+#include <CommonAPI/CommonAPI.hpp>
+#include "../src-gen/commonapi/examples/CommonTypes.hpp"
+#include "../src-gen/commonapi/examples/E06UnionsProxy.hpp"
#include "typeUtils.hpp"
using namespace commonapi::examples;
@@ -131,19 +133,19 @@ void recv_msg1(std::shared_ptr<CommonTypes::SettingsStruct> x) {
if ( std::shared_ptr<CommonTypes::SettingsStructMyTypedef> sp = std::dynamic_pointer_cast<CommonTypes::SettingsStructMyTypedef>(x) ) {
- std::cout << "Received (D) MyTypedef with value " << (int)sp->id << 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) ) {
- std::cout << "Received (D) MyEnum with value " << (int)sp->status << 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) ) {
- std::cout << "Received (D) uint8_t with value " << (int)sp->channel << 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) ) {
- std::cout << "Received (D) string " << sp->name << std::endl;
+ std::cout << "Received (D) string " << sp->getName() << std::endl;
} else {
@@ -153,11 +155,11 @@ void recv_msg1(std::shared_ptr<CommonTypes::SettingsStruct> x) {
int main() {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
- const std::string& serviceAddress = "local:commonapi.examples.Unions:commonapi.examples.Unions";
- std::shared_ptr<E06UnionsProxyDefault> myProxy = factory->buildProxy<E06UnionsProxy> (serviceAddress);
+ const std::string &domain = "local";
+ const std::string &instance = "commonapi.examples.Unions";
+ std::shared_ptr<E06UnionsProxyDefault> myProxy = runtime->buildProxy<E06UnionsProxy>(domain, instance);
while (!myProxy->isAvailable()) {
usleep(10);
diff --git a/CommonAPI-Examples/E06Unions/src/E06UnionsService.cpp b/CommonAPI-Examples/E06Unions/src/E06UnionsService.cpp
new file mode 100644
index 0000000..0e1cf02
--- /dev/null
+++ b/CommonAPI-Examples/E06Unions/src/E06UnionsService.cpp
@@ -0,0 +1,34 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+#include <thread>
+#include <iostream>
+
+#include <CommonAPI/CommonAPI.hpp>
+#include "E06UnionsStubImpl.h"
+
+int main() {
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
+
+ const std::string &domain = "local";
+ const std::string &instance = "commonapi.examples.Unions";
+ std::shared_ptr<E06UnionsStubImpl> myService = std::make_shared<E06UnionsStubImpl>();
+
+ if (runtime->registerService(domain, instance, myService)) {
+ 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));
+ }
+ }
+ return 0;
+}
diff --git a/CommonAPI-Examples/e06Unions/src/E06UnionsStubImpl.cpp b/CommonAPI-Examples/E06Unions/src/E06UnionsStubImpl.cpp
index 31f2365..58e9f82 100644
--- a/CommonAPI-Examples/e06Unions/src/E06UnionsStubImpl.cpp
+++ b/CommonAPI-Examples/E06Unions/src/E06UnionsStubImpl.cpp
@@ -6,7 +6,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "E06UnionsStubImpl.h"
-#include <commonapi/examples/CommonTypes.h>
+
+#include "../src-gen/commonapi/examples/CommonTypes.hpp"
using namespace commonapi::examples;
diff --git a/CommonAPI-Examples/e06Unions/src/E06UnionsStubImpl.h b/CommonAPI-Examples/E06Unions/src/E06UnionsStubImpl.h
index 0297dbb..cc3b0bf 100644
--- a/CommonAPI-Examples/e06Unions/src/E06UnionsStubImpl.h
+++ b/CommonAPI-Examples/E06Unions/src/E06UnionsStubImpl.h
@@ -8,8 +8,9 @@
#ifndef E06UNIONSSTUBIMPL_H_
#define E06UNIONSSTUBIMPL_H_
-#include <CommonAPI/CommonAPI.h>
-#include <commonapi/examples/E06UnionsStubDefault.h>
+#include <CommonAPI/CommonAPI.hpp>
+
+#include "../src-gen/commonapi/examples/E06UnionsStubDefault.hpp"
class E06UnionsStubImpl: public commonapi::examples::E06UnionsStubDefault {
diff --git a/CommonAPI-Examples/e06Unions/src/typeUtils.hpp b/CommonAPI-Examples/E06Unions/src/typeUtils.hpp
index 0dfb0f2..0dfb0f2 100644
--- a/CommonAPI-Examples/e06Unions/src/typeUtils.hpp
+++ b/CommonAPI-Examples/E06Unions/src/typeUtils.hpp
diff --git a/CommonAPI-Examples/E07Mainloop/.cproject b/CommonAPI-Examples/E07Mainloop/.cproject
new file mode 100644
index 0000000..fc8a4e4
--- /dev/null
+++ b/CommonAPI-Examples/E07Mainloop/.cproject
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="0.416559588">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.416559588" moduleId="org.eclipse.cdt.core.settings" name="Default">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildProperties="" description="" id="0.416559588" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
+ <folderInfo id="0.416559588." name="/" resourcePath="">
+ <toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1038958730" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
+ <targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1038958730.2115115764" name=""/>
+ <builder arguments="-C ${ProjDirPath}/build VERBOSE=0" buildPath="" command="make" id="org.eclipse.cdt.build.core.settings.default.builder.1812880292" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.libs.1019901481" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.259363632" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.840421715" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.1212471744" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <option id="org.eclipse.cdt.build.core.settings.holder.incpaths.427233418" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/ascgit017.CommonAPI/include}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/E01HelloWorld/src-gen}&quot;"/>
+ <listOptionValue builtIn="false" value="/usr/include/c++/4.8.2"/>
+ </option>
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1678702299" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.build.core.settings.holder.291757453" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
+ <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1117944646" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="e01HelloWorld.null.741055877" name="e01HelloWorld"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ <scannerConfigBuildInfo instanceId="0.416559588">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="refreshScope" versionNumber="2">
+ <configuration configurationName="Default">
+ <resource resourceType="PROJECT" workspacePath="/e01HelloWorld"/>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
+ <buildTargets>
+ <target name="Run cmake" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
+ <buildCommand>cmake</buildCommand>
+ <buildArguments>-E chdir build/ cmake -D CMAKE_BUILD_TYPE=Debug -DUSE_INSTALLED_COMMONAPI=OFF -DUSE_INSTALLED_DBUS=OFF ../</buildArguments>
+ <buildTarget/>
+ <stopOnError>true</stopOnError>
+ <useDefaultCommand>false</useDefaultCommand>
+ <runAllBuilders>true</runAllBuilders>
+ </target>
+ </buildTargets>
+ </storageModule>
+</cproject>
diff --git a/CommonAPI-Examples/E07Mainloop/.gitignore b/CommonAPI-Examples/E07Mainloop/.gitignore
new file mode 100644
index 0000000..5fb7e99
--- /dev/null
+++ b/CommonAPI-Examples/E07Mainloop/.gitignore
@@ -0,0 +1,2 @@
+build
+src-gen
diff --git a/CommonAPI-Examples/E07Mainloop/.project b/CommonAPI-Examples/E07Mainloop/.project
new file mode 100644
index 0000000..93b34d5
--- /dev/null
+++ b/CommonAPI-Examples/E07Mainloop/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>E07Mainloop</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ </natures>
+</projectDescription>
diff --git a/CommonAPI-Examples/E07Mainloop/CMakeLists.txt b/CommonAPI-Examples/E07Mainloop/CMakeLists.txt
new file mode 100644
index 0000000..2642156
--- /dev/null
+++ b/CommonAPI-Examples/E07Mainloop/CMakeLists.txt
@@ -0,0 +1,125 @@
+# Copyright (C) 2015 BMW Group
+# Author: Lutz Bichler (lutz.bichler@bmw.de)
+# 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/.
+
+cmake_minimum_required(VERSION 2.8)
+
+set(PRJ_NAME E07Mainloop)
+
+set(CMAKE_VERBOSE_MAKEFILE on)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wall -O0 -std=c++0x -D_GLIBCXX_USE_NANOSLEEP -DLINUX")
+
+message(STATUS "Compiler options: ${CMAKE_CXX_FLAGS}")
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
+ "Choose the type of build, options are: Debug Release." FORCE)
+endif(NOT CMAKE_BUILD_TYPE)
+message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
+
+OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version of CommonAPI" ON)
+message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}")
+
+if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+else()
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+endif()
+
+message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_INCLUDE_DIRS: ${COMMONAPI_INCLUDE_DIRS}")
+message(STATUS "CommonAPI-DBus_CONSIDERED_CONFIGS: ${CommonAPI-DBus_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_DBUS_INCLUDE_DIRS: ${COMMONAPI_DBUS_INCLUDE_DIRS}")
+
+# CommonAPI
+include(FindPkgConfig)
+pkg_check_modules (DBUS "dbus-1 >= 1.4")
+
+# SOME/IP
+find_package (CommonAPI-SomeIP 3.1.1 REQUIRED)
+find_package (vsomeip 1.1.0 REQUIRED)
+
+# GLib
+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)
+
+# 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_NAME_CLIENT ${PRJ_NAME}Client)
+set(PRJ_NAME_SERVICE ${PRJ_NAME}Service)
+
+# Application
+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)
+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_SRC_PATH}/${PRJ_NAME}StubImpl.cpp ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_IMPL_SRCS})
+
+# DBus library
+FILE(GLOB PRJ_DBUS_LIB_SRCS ${PRJ_SRC_GEN_COMMONAPI_DBUS_PATH}/*cpp)
+
+# SOME/IP library
+FILE(GLOB PRJ_SOMEIP_LIB_SRCS ${PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH}/*cpp)
+
+# Paths
+OPTION(USE_INSTALLED_DBUS "Set to OFF to use the local (patched) version of dbus" ON)
+message(STATUS "USE_INSTALLED_DBUS is set to value: ${USE_INSTALLED_DBUS}")
+
+include_directories(
+ src-gen/core
+ src-gen/dbus
+ src-gen/someip
+ ${COMMONAPI_INCLUDE_DIRS}
+ ${COMMONAPI_DBUS_INCLUDE_DIRS}
+ ${COMMONAPI_SOMEIP_INCLUDE_DIRS}
+ ${DBUS_INCLUDE_DIRS}
+ ${VSOMEIP_INCLUDE_DIRS}
+)
+
+if ("${USE_INSTALLED_DBUS}" STREQUAL "ON")
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${COMMONAPI_SOMEIP_CMAKE_DIR}/build
+)
+else()
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${COMMONAPI_SOMEIP_CMAKE_DIR}/build
+ ${DBUS_INCLUDE_DIRS}/dbus/.libs
+)
+endif()
+
+set(LINK_LIBRARIES -Wl,--as-needed CommonAPI glib-2.0)
+
+# Build Client
+add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS})
+target_link_libraries(${PRJ_NAME_CLIENT} ${LINK_LIBRARIES})
+
+# Build service
+add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS})
+target_link_libraries(${PRJ_NAME_SERVICE} ${LINK_LIBRARIES})
+
+# Build DBus library
+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) \ No newline at end of file
diff --git a/CommonAPI-Examples/E07Mainloop/README b/CommonAPI-Examples/E07Mainloop/README
new file mode 100644
index 0000000..b8c99d7
--- /dev/null
+++ b/CommonAPI-Examples/E07Mainloop/README
@@ -0,0 +1,6 @@
+=== Example 07: Mainloop
+
+This example shows how CommonAPI can be integrated with an external main loop. For demonstration purposes the +glib+ main loop is used.
+
+CommonAPI does not contain a main loop implementation itself; just a demo implementation is provided for test purposes (please have a look to the verification tests in the CommonAPI tools project to find out how the demo main loop is used).
+
diff --git a/CommonAPI-Examples/E07Mainloop/commonapi4dbus.ini b/CommonAPI-Examples/E07Mainloop/commonapi4dbus.ini
new file mode 100644
index 0000000..39a52b7
--- /dev/null
+++ b/CommonAPI-Examples/E07Mainloop/commonapi4dbus.ini
@@ -0,0 +1,8 @@
+[default]
+binding=dbus
+
+[proxy]
+local:commonapi.examples.E07Mainloop:commonapi.examples.Mainloop=libE07Mainloop-DBus.so
+
+[stub]
+local:commonapi.examples.E07Mainloop:commonapi.examples.Mainloop=libE07Mainloop-DBus.so
diff --git a/CommonAPI-Examples/E07Mainloop/commonapi4someip.ini b/CommonAPI-Examples/E07Mainloop/commonapi4someip.ini
new file mode 100644
index 0000000..0c68943
--- /dev/null
+++ b/CommonAPI-Examples/E07Mainloop/commonapi4someip.ini
@@ -0,0 +1,8 @@
+[default]
+binding=someip
+
+[proxy]
+local:commonapi.examples.E07Mainloop:commonapi.examples.Mainloop=libE07Mainloop-SomeIP.so
+
+[stub]
+local:commonapi.examples.E07Mainloop:commonapi.examples.Mainloop=libE07Mainloop-SomeIP.so
diff --git a/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fdepl b/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fdepl
new file mode 100644
index 0000000..c617777
--- /dev/null
+++ b/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fdepl
@@ -0,0 +1,40 @@
+/* Copyright (C) 2015 BMW Group
+ * Author: Lutz Bichler (lutz.bichler@bmw.de)
+ * 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 "E07Mainloop.fidl"
+
+define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E07Mainloop {
+ SomeIpServiceID = 4660
+
+ 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"
+ SomeIpUnicastPort = 30499
+ }
+} \ No newline at end of file
diff --git a/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fidl b/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fidl
new file mode 100644
index 0000000..c835cd9
--- /dev/null
+++ b/CommonAPI-Examples/E07Mainloop/fidl/E07Mainloop.fidl
@@ -0,0 +1,22 @@
+/* Copyright (C) 2015 BMW Group
+ * Author: Lutz Bichler (lutz.bichler@bmw.de)
+ * 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/. */
+
+package commonapi.examples
+
+interface E07Mainloop {
+ version { major 1 minor 0 }
+
+ attribute Int32 x
+
+ 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
new file mode 100644
index 0000000..02954be
--- /dev/null
+++ b/CommonAPI-Examples/E07Mainloop/src/E07MainloopClient.cpp
@@ -0,0 +1,196 @@
+/* Copyright (C) 2015 BMW Group
+ * Author: Lutz Bichler (lutz.bichler@bmw.de)
+ * 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/. */
+
+#include <iostream>
+#include <unistd.h>
+#include <sstream>
+
+#include <glib.h>
+
+#include <CommonAPI/CommonAPI.hpp>
+#include <v1_0/commonapi/examples/E07MainloopProxy.hpp>
+
+using namespace v1_0::commonapi::examples;
+
+GIOChannel* channel;
+
+std::future<CommonAPI::CallStatus> gFutureCallStatus;
+std::future<CommonAPI::CallStatus> gFutureCallStatusISIA;
+std::future<CommonAPI::CallStatus> gFutureCallStatusGetAttrX;
+
+int32_t gValueForX = 428394;
+
+void myAttrXCallback(const CommonAPI::CallStatus& callStatus, const int32_t& val) {
+ std::cout << "Receive callback for Attribute x: " << val << std::endl;
+}
+
+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";
+
+}
+
+gboolean callSetAttrX(void* proxy) {
+
+ std::cout << "callSetAttrX called ..." << std::endl;
+
+ E07MainloopProxy<>* myProxy = static_cast<E07MainloopProxy<>*>(proxy);
+ myProxy->getXAttribute().setValueAsync(gValueForX , myAttrXCallback);
+
+ return false;
+}
+
+gboolean callGetAttrX(void* proxy) {
+
+ std::cout << "callGetAttrX called ..." << std::endl;
+
+ E07MainloopProxy<>* myProxy = static_cast<E07MainloopProxy<>*>(proxy);
+ myProxy->getXAttribute().getValueAsync(myAttrXCallback);
+
+ return false;
+}
+
+gboolean callSayHello(void* proxy) {
+
+ std::cout << "callSayHello called ..." << std::endl;
+
+ static int number = 1;
+
+ std::stringstream stream;
+ stream << "World (" << number << ")";
+ const std::string name = stream.str();
+
+ E07MainloopProxy<>* myProxy = static_cast<E07MainloopProxy<>*>(proxy);
+ gFutureCallStatus = myProxy->sayHelloAsync(name, mySayHelloCallback);
+
+ number++;
+
+ return true;
+}
+
+class GDispatchWrapper: public GSource {
+ public:
+ GDispatchWrapper(CommonAPI::DispatchSource* dispatchSource): dispatchSource_(dispatchSource) {}
+ CommonAPI::DispatchSource* dispatchSource_;
+};
+
+gboolean dispatchPrepare ( GSource* source, gint* timeout ) {
+
+ bool result = false;
+ int64_t eventTimeout;
+
+ result = static_cast<GDispatchWrapper*>(source)->dispatchSource_->prepare(eventTimeout);
+
+ *timeout = eventTimeout;
+
+ return result;
+}
+
+gboolean dispatchCheck ( GSource* source ) {
+
+ return static_cast<GDispatchWrapper*>(source)->dispatchSource_->check();
+}
+
+gboolean dispatchExecute ( GSource* source, GSourceFunc callback, gpointer userData ) {
+
+ static_cast<GDispatchWrapper*>(source)->dispatchSource_->dispatch();
+ return true;
+}
+
+static GSourceFuncs standardGLibSourceCallbackFuncs = {
+ dispatchPrepare,
+ dispatchCheck,
+ dispatchExecute,
+ NULL
+};
+
+gboolean gWatchDispatcher ( GIOChannel *source, GIOCondition condition, gpointer userData ) {
+
+ CommonAPI::Watch* watch = static_cast<CommonAPI::Watch*>(userData);
+ watch->dispatch(condition);
+ return true;
+}
+
+gboolean gTimeoutDispatcher ( void* userData ) {
+
+ return static_cast<CommonAPI::DispatchSource*>(userData)->dispatch();
+}
+
+void watchAddedCallback ( CommonAPI::Watch* watch, const CommonAPI::DispatchPriority dispatchPriority ) {
+
+ const pollfd& fileDesc = watch->getAssociatedFileDescriptor();
+ channel = g_io_channel_unix_new(fileDesc.fd);
+
+ GSource* gWatch = g_io_create_watch(channel, static_cast<GIOCondition>(fileDesc.events));
+ g_source_set_callback(gWatch, reinterpret_cast<GSourceFunc>(&gWatchDispatcher), watch, NULL);
+
+ const auto& dependentSources = watch->getDependentDispatchSources();
+ for (auto dependentSourceIterator = dependentSources.begin();
+ dependentSourceIterator != dependentSources.end();
+ dependentSourceIterator++) {
+ GSource* gDispatchSource = g_source_new(&standardGLibSourceCallbackFuncs, sizeof(GDispatchWrapper));
+ static_cast<GDispatchWrapper*>(gDispatchSource)->dispatchSource_ = *dependentSourceIterator;
+
+ g_source_add_child_source(gWatch, gDispatchSource);
+
+ }
+ g_source_attach(gWatch, NULL);
+}
+
+void watchRemovedCallback ( CommonAPI::Watch* watch ) {
+
+ g_source_remove_by_user_data(watch);
+
+ if(channel) {
+ g_io_channel_unref(channel);
+ channel = NULL;
+ }
+}
+
+int main() {
+ std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get();
+
+ std::string domain = "local";
+ std::string instance = "commonapi.examples.Mainloop";
+ std::string connection = "client-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::shared_ptr<E07MainloopProxyDefault> myProxy = runtime->buildProxy<E07MainloopProxy>(domain,
+ instance, mainloopContext);
+
+ std::cout << "Checking availability" << std::flush;
+ static constexpr 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);
+ }
+ 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);
+
+ g_main_loop_run (mainloop);
+ g_main_loop_unref (mainloop);
+
+ return 0;
+}
diff --git a/CommonAPI-Examples/E07Mainloop/src/E07MainloopService.cpp b/CommonAPI-Examples/E07Mainloop/src/E07MainloopService.cpp
new file mode 100644
index 0000000..e57f192
--- /dev/null
+++ b/CommonAPI-Examples/E07Mainloop/src/E07MainloopService.cpp
@@ -0,0 +1,140 @@
+/* Copyright (C) 2015 BMW Group
+ * Author: Lutz Bichler (lutz.bichler@bmw.de)
+ * 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/. */
+
+#include <iostream>
+#include <thread>
+
+#include <glib.h>
+
+#include <CommonAPI/CommonAPI.hpp>
+#include "E07MainloopStubImpl.hpp"
+
+using namespace std;
+
+GIOChannel* channel;
+
+gboolean callIncCounter(void* service) {
+
+ E07MainloopStubImpl* myService = static_cast<E07MainloopStubImpl*>(service);
+ myService->incAttrX();
+
+ return true;
+}
+
+gboolean callWaitingInfo(void* service) {
+ std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl;
+
+ return true;
+}
+
+class GDispatchWrapper: public GSource {
+ public:
+ GDispatchWrapper(CommonAPI::DispatchSource* dispatchSource): dispatchSource_(dispatchSource) {}
+ CommonAPI::DispatchSource* dispatchSource_;
+};
+
+gboolean dispatchPrepare ( GSource* source, gint* timeout ) {
+
+ bool result = false;
+ int64_t eventTimeout;
+
+ result = static_cast<GDispatchWrapper*>(source)->dispatchSource_->prepare(eventTimeout);
+
+ *timeout = eventTimeout;
+
+ return result;
+}
+
+gboolean dispatchCheck ( GSource* source ) {
+
+ return static_cast<GDispatchWrapper*>(source)->dispatchSource_->check();
+}
+
+gboolean dispatchExecute ( GSource* source, GSourceFunc callback, gpointer userData ) {
+
+ static_cast<GDispatchWrapper*>(source)->dispatchSource_->dispatch();
+ return true;
+}
+
+static GSourceFuncs standardGLibSourceCallbackFuncs = {
+ dispatchPrepare,
+ dispatchCheck,
+ dispatchExecute,
+ NULL
+};
+
+gboolean gWatchDispatcher ( GIOChannel *source, GIOCondition condition, gpointer userData ) {
+
+ CommonAPI::Watch* watch = static_cast<CommonAPI::Watch*>(userData);
+ watch->dispatch(condition);
+ return true;
+}
+
+gboolean gTimeoutDispatcher ( void* userData ) {
+
+ return static_cast<CommonAPI::DispatchSource*>(userData)->dispatch();
+}
+
+void watchAddedCallback ( CommonAPI::Watch* watch, const CommonAPI::DispatchPriority dispatchPriority ) {
+
+ const pollfd& fileDesc = watch->getAssociatedFileDescriptor();
+ channel = g_io_channel_unix_new(fileDesc.fd);
+
+ GSource* gWatch = g_io_create_watch(channel, static_cast<GIOCondition>(fileDesc.events));
+ g_source_set_callback(gWatch, reinterpret_cast<GSourceFunc>(&gWatchDispatcher), watch, NULL);
+
+ const auto& dependentSources = watch->getDependentDispatchSources();
+ for (auto dependentSourceIterator = dependentSources.begin();
+ dependentSourceIterator != dependentSources.end();
+ dependentSourceIterator++) {
+ GSource* gDispatchSource = g_source_new(&standardGLibSourceCallbackFuncs, sizeof(GDispatchWrapper));
+ static_cast<GDispatchWrapper*>(gDispatchSource)->dispatchSource_ = *dependentSourceIterator;
+
+ g_source_add_child_source(gWatch, gDispatchSource);
+
+ }
+ g_source_attach(gWatch, NULL);
+}
+
+void watchRemovedCallback ( CommonAPI::Watch* watch ) {
+
+ g_source_remove_by_user_data(watch);
+
+ if(channel) {
+ g_io_channel_unref(channel);
+ channel = NULL;
+ }
+}
+
+int main() {
+ 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::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::shared_ptr<E07MainloopStubImpl> myService = std::make_shared<E07MainloopStubImpl>();
+ runtime->registerService(domain, instance, myService, mainloopContext);
+
+ 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(2500, callIncCounter, servicePtr);
+
+ g_main_loop_run (mainloop);
+ g_main_loop_unref (mainloop);
+
+ return 0;
+}
diff --git a/CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.cpp b/CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.cpp
new file mode 100644
index 0000000..53a2cd0
--- /dev/null
+++ b/CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.cpp
@@ -0,0 +1,33 @@
+/* Copyright (C) 2015 BMW Group
+ * Author: Lutz Bichler (lutz.bichler@bmw.de)
+ * 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/. */
+
+#include "E07MainloopStubImpl.hpp"
+
+E07MainloopStubImpl::E07MainloopStubImpl() {
+ setXAttribute(0);
+}
+
+E07MainloopStubImpl::~E07MainloopStubImpl() {
+}
+
+void E07MainloopStubImpl::sayHello(const std::shared_ptr<CommonAPI::ClientId> _client,
+ std::string _name,
+ sayHelloReply_t _reply) {
+
+ std::stringstream messageStream;
+
+ messageStream << "Hello " << _name << "!";
+ std::cout << "sayHello('" << _name << "'): '" << messageStream.str() << "'\n";
+
+ _reply(messageStream.str());
+}
+
+void E07MainloopStubImpl::incAttrX() {
+ 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
new file mode 100644
index 0000000..1cd82b1
--- /dev/null
+++ b/CommonAPI-Examples/E07Mainloop/src/E07MainloopStubImpl.hpp
@@ -0,0 +1,24 @@
+/* Copyright (C) 2015 BMW Group
+ * Author: Lutz Bichler (lutz.bichler@bmw.de)
+ * 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/. */
+
+#ifndef E07MAINLOOPSTUBIMPL_H_
+#define E07MAINLOOPSTUBIMPL_H_
+
+#include <CommonAPI/CommonAPI.hpp>
+#include <v1_0/commonapi/examples/E07MainloopStubDefault.hpp>
+
+class E07MainloopStubImpl: public v1_0::commonapi::examples::E07MainloopStubDefault {
+
+public:
+ E07MainloopStubImpl();
+ virtual ~E07MainloopStubImpl();
+
+ virtual void sayHello(const std::shared_ptr<CommonAPI::ClientId> _client, std::string _name, sayHelloReply_t _return);
+ virtual void incAttrX();
+
+};
+
+#endif /* E07MAINLOOPSTUBIMPL_H_ */
diff --git a/CommonAPI-Examples/E07Mainloop/vsomeip.json b/CommonAPI-Examples/E07Mainloop/vsomeip.json
new file mode 100644
index 0000000..641f13b
--- /dev/null
+++ b/CommonAPI-Examples/E07Mainloop/vsomeip.json
@@ -0,0 +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"
+ }
+}
diff --git a/CommonAPI-Examples/README b/CommonAPI-Examples/README
index 19ce46c..8425ed4 100644
--- a/CommonAPI-Examples/README
+++ b/CommonAPI-Examples/README
@@ -1,23 +1,16 @@
-Preliminary remarks
-~~~~~~~~~~~~~~~~~~~
+=== Preliminary remarks
-The examples describe how some standard problems of interface design and implementation can be solved with Franca IDL and CommonAPI. Before you start make sure that your environment is properly installed. That means:
-
-- You can start the code generator in your Eclipse installation or from command line.
-- Your PKG_CONFIG_PATH contains the paths to the package config files of CommnAPI, CommonAPI-DBus and your patched D-Bus.
-- You have patched the DBus library with the patch in CommonAPI-D-Bus and you are sure that your LD_LIBRARY_PATH contains the path to the patched DBus library.
-- Make sure dbus session bus is available ($ env |grep DBUS_SESSION_BUS_ADDRESS, output must not be empty!).
-- If your platform is Windows, please read the instructions for Windows first. The following instructions assume that your are working on a Linux platform.
+The examples describe how some standard problems of interface design and implementation can be solved with Franca IDL and CommonAPI. Before you start make sure that your environment is properly installed as described in the integration guide. Please do not consider only the integration guide in this document but also in the binding specific tutorial.
The examples provide a more or less generic CMake file for building the executables. Two executables are needed: a service and a client program. The standard procedure to build one of these example programs is:
----
-$ mkdir build; cd build
-$ cmake -D DBUS_PATH_LOCAL=<your_local_path_of_the_patched_dbus_library> -D PRJ_NAME=<name_of_the_example> ..
+$ cd build
+$ cmake -D USE_INSTALLED_COMMONAPI=ON/OFF ..
$ make
----
-_name_of_the_example_ is +e01HelloWorld+ for the first example.
+Set USE_INSTALLED_COMMONAPI to ON if you use an installed version of CommonAPI; set it to OFF if you use working copy.
Here are some hints if you want to configure your eclipse project for the CMake build:
@@ -27,13 +20,10 @@ Here are some hints if you want to configure your eclipse project for the CMake
----
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 (eg via Window->Show View->Make Target). Set the build command to:
----
-cmake -E chdir build/ cmake -D DBUS_PATH_LOCAL=
- <your_local_path_of_the_patched_dbus_library> -D PRJ_NAME=<name_of_the_example> ..
+cmake -E chdir build/ cmake ..
----
-and leave the Make Target field empty. Finally, create in "Run Configurations" two configurations for client and service. Note that it might be necessary to start the executables with a local setting of the +LD_LIBRARY_PATH+ (eg to +/usr/local/lib+) since CommonAPI applications use a patched version of libdbus.
-
diff --git a/CommonAPI-Examples/e01HelloWorld/CMakeLists.txt b/CommonAPI-Examples/e01HelloWorld/CMakeLists.txt
deleted file mode 100644
index d558653..0000000
--- a/CommonAPI-Examples/e01HelloWorld/CMakeLists.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright (C) 2014 BMW Group
-# Author: Manfred Bathelt (manfred.bathelt@bmw.de)
-# Author: Juergen Gehring (juergen.gehring@bmw.de)
-# 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/.
-
-cmake_minimum_required(VERSION 2.8)
-
-# Project settings
-if (PRJ_NAME)
- message(STATUS "Start CMake for Project " ${PRJ_NAME})
-else()
- message(FATAL_ERROR "Please specify your project name using -D PRJ_NAME=yourName")
-endif()
-project(${PRJ_NAME})
-set(CMAKE_VERBOSE_MAKEFILE on)
-set(CMAKE_CXX_FLAGS "-Wall -O0 -std=c++0x")
-set(CMAKE_BUILD_TYPE Debug)
-
-# DBus Path
-if (DBUS_LIB_PATH)
- message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH})
-else()
- message(FATAL_ERROR "Please specify the path to your patched DBus library using -D DBUS_LIB_PATH=yourPath")
-endif()
-
-# CommonAPI
-include(FindPkgConfig)
-pkg_check_modules (DBUS "dbus-1 >= 1.4")
-pkg_check_modules (COMMONAPI "CommonAPI >= 2.1")
-pkg_check_modules (COMMONAPI_DBUS "CommonAPI-DBus >= 2.1")
-
-# Source Files
-set(PRJ_SRC_PATH src)
-set(PRJ_SRC_GEN_PATH src-gen/commonapi/examples)
-
-set(PRJ_NAME_CLIENT ${PROJECT_NAME}Client)
-set(PRJ_NAME_SERVICE ${PROJECT_NAME}Service)
-
-FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Proxy.cpp)
-FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_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})
-
-# Paths
-message(STATUS "COMMONAPI_INCLUDEDIR = " ${COMMONAPI_INCLUDEDIR})
-message(STATUS "COMMONAPI_DBUS_INCLUDEDIR = " ${COMMONAPI_DBUS_INCLUDEDIR})
-
-include_directories(
- src-gen
- ${DBUS_INCLUDE_DIRS}
- ${COMMONAPI_INCLUDEDIR}
- ${COMMONAPI_DBUS_INCLUDEDIR}
-)
-
-link_directories(
- ${DBUS_LIB_PATH}
- ${COMMONAPI_LIBDIR}
- ${COMMONAPI_DBUS_LIBDIR}
-)
-
-# Build Client
-add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS})
-target_link_libraries(${PRJ_NAME_CLIENT} CommonAPI CommonAPI-DBus)
-
-# Build service
-add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS})
-target_link_libraries(${PRJ_NAME_SERVICE} CommonAPI CommonAPI-DBus)
diff --git a/CommonAPI-Examples/e01HelloWorld/README b/CommonAPI-Examples/e01HelloWorld/README
deleted file mode 100644
index 8128fd9..0000000
--- a/CommonAPI-Examples/e01HelloWorld/README
+++ /dev/null
@@ -1,5 +0,0 @@
-Example 1: Hello World
-~~~~~~~~~~~~~~~~~~~~~~
-
-This example contains the code for the step by step introduction to CommonAPI.
-
diff --git a/CommonAPI-Examples/e01HelloWorld/src/E01HelloWorldStubImpl.cpp b/CommonAPI-Examples/e01HelloWorld/src/E01HelloWorldStubImpl.cpp
deleted file mode 100644
index 2e50ce9..0000000
--- a/CommonAPI-Examples/e01HelloWorld/src/E01HelloWorldStubImpl.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C) 2014 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-
-#include "E01HelloWorldStubImpl.h"
-
-E01HelloWorldStubImpl::E01HelloWorldStubImpl() {
-}
-
-E01HelloWorldStubImpl::~E01HelloWorldStubImpl() {
-}
-
-void E01HelloWorldStubImpl::sayHello(const std::shared_ptr<CommonAPI::ClientId> clientId,
- std::string name,
- std::string& message) {
- std::stringstream messageStream;
-
- messageStream << "Hello " << name << "!";
- message = messageStream.str();
-
- std::cout << "sayHello('" << name << "'): '" << message << "'\n";
-};
diff --git a/CommonAPI-Examples/e01HelloWorld/src/e01HelloWorldClient.cpp b/CommonAPI-Examples/e01HelloWorld/src/e01HelloWorldClient.cpp
deleted file mode 100644
index 6537a02..0000000
--- a/CommonAPI-Examples/e01HelloWorld/src/e01HelloWorldClient.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 2014 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-
-#include <iostream>
-
-#include <CommonAPI/CommonAPI.h> //Defined in the Common API Runtime library
-#include <commonapi/examples/E01HelloWorldProxy.h> //Part of the code we just generated
-
-using namespace commonapi::examples;
-
-int main() {
- std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::load();
-
- std::shared_ptr < CommonAPI::Factory > factory = runtime->createFactory();
- const std::string& serviceAddress = "local:commonapi.examples.HelloWorld:commonapi.examples.HelloWorld";
- std::shared_ptr<E01HelloWorldProxyDefault> myProxy = factory->buildProxy<E01HelloWorldProxy>(serviceAddress);
-
- while (!myProxy->isAvailable()) {
- usleep(10);
- }
-
- const std::string name = "World";
- CommonAPI::CallStatus callStatus;
- std::string returnMessage;
-
- myProxy->sayHello(name, callStatus, returnMessage);
- if (callStatus != CommonAPI::CallStatus::SUCCESS) {
- std::cerr << "Remote call failed!\n";
- return -1;
- }
-
- std::cout << "Got message: '" << returnMessage << "'\n";
-
- return 0;
-}
diff --git a/CommonAPI-Examples/e01HelloWorld/src/e01HelloWorldService.cpp b/CommonAPI-Examples/e01HelloWorld/src/e01HelloWorldService.cpp
deleted file mode 100644
index 5351065..0000000
--- a/CommonAPI-Examples/e01HelloWorld/src/e01HelloWorldService.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2014 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-
-#include <iostream>
-#include <thread>
-
-#include <CommonAPI/CommonAPI.h>
-#include "E01HelloWorldStubImpl.h"
-
-using namespace std;
-
-int main() {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
-
- const std::string& serviceAddress = "local:commonapi.examples.HelloWorld:commonapi.examples.HelloWorld";
- std::shared_ptr<E01HelloWorldStubImpl> myService = std::make_shared<E01HelloWorldStubImpl>();
- servicePublisher->registerService(myService, serviceAddress, factory);
-
- while (true) {
- std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl;
- std::this_thread::sleep_for(std::chrono::seconds(60));
- }
-
- return 0;
-}
diff --git a/CommonAPI-Examples/e02Attributes/CMakeLists.txt b/CommonAPI-Examples/e02Attributes/CMakeLists.txt
deleted file mode 100644
index 15aa464..0000000
--- a/CommonAPI-Examples/e02Attributes/CMakeLists.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright (C) 2014 BMW Group
-# Author: Manfred Bathelt (manfred.bathelt@bmw.de)
-# Author: Juergen Gehring (juergen.gehring@bmw.de)
-# 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/.
-
-cmake_minimum_required(VERSION 2.8)
-
-# Project settings
-if (PRJ_NAME)
- message(STATUS "Start CMake for Project " ${PRJ_NAME})
-else()
- message(FATAL_ERROR "Please specify your project name using -D PRJ_NAME=yourName")
-endif()
-project(${PRJ_NAME})
-set(CMAKE_VERBOSE_MAKEFILE on)
-set(CMAKE_CXX_FLAGS "-Wall -O0 -std=c++0x")
-set(CMAKE_BUILD_TYPE Debug)
-
-# DBus Path
-if (DBUS_LIB_PATH)
- message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH})
-else()
- message(FATAL_ERROR "Please specify the path to your patched DBus library using -D DBUS_LIB_PATH=yourPath")
-endif()
-
-# CommonAPI
-include(FindPkgConfig)
-pkg_check_modules (DBUS "dbus-1 >= 1.4")
-pkg_check_modules (COMMONAPI "CommonAPI >= 2.1")
-pkg_check_modules (COMMONAPI_DBUS "CommonAPI-DBus >= 2.1")
-
-# Source Files
-set(PRJ_SRC_PATH src)
-set(PRJ_SRC_GEN_PATH src-gen/commonapi/examples)
-
-set(PRJ_NAME_CLIENT ${PROJECT_NAME}Client)
-set(PRJ_NAME_SERVICE ${PROJECT_NAME}Service)
-
-FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Proxy.cpp ${PRJ_SRC_GEN_PATH}/*Types.cpp)
-FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Stub*.cpp ${PRJ_SRC_GEN_PATH}/*Types.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})
-
-# Paths
-message(STATUS "COMMONAPI_INCLUDEDIR = " ${COMMONAPI_INCLUDEDIR})
-message(STATUS "COMMONAPI_DBUS_INCLUDEDIR = " ${COMMONAPI_DBUS_INCLUDEDIR})
-
-include_directories(
- src-gen
- ${DBUS_INCLUDE_DIRS}
- ${COMMONAPI_INCLUDEDIR}
- ${COMMONAPI_DBUS_INCLUDEDIR}
-)
-
-link_directories(
- ${DBUS_LIB_PATH}
- ${COMMONAPI_LIBDIR}
- ${COMMONAPI_DBUS_LIBDIR}
-)
-
-# Build Client
-add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS})
-target_link_libraries(${PRJ_NAME_CLIENT} CommonAPI CommonAPI-DBus)
-
-# Build service
-add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS})
-target_link_libraries(${PRJ_NAME_SERVICE} CommonAPI CommonAPI-DBus)
diff --git a/CommonAPI-Examples/e02Attributes/README b/CommonAPI-Examples/e02Attributes/README
deleted file mode 100644
index 758e4ff..0000000
--- a/CommonAPI-Examples/e02Attributes/README
+++ /dev/null
@@ -1,170 +0,0 @@
-Example 2: Attributes
-~~~~~~~~~~~~~~~~~~~~~~
-
-Consider the Franca IDL specification of example 2:
-
-[source,java]
-----
-package commonapi.examples
-
-interface E02Attributes {
- version { major 1 minor 0 }
-
- attribute Int32 x
-
- attribute CommonTypes.a1Struct a1
-}
-
-typeCollection CommonTypes {
-
- struct a1Struct {
- String s
- a2Struct a2
- }
-
- struct a2Struct {
- Boolean b
- Double d
- }
-}
-----
-
-Modelling attributes in interfaces means in general that the service that implements this interface has an internal state which shall be visible for external clients like a HMI (Human Machine Interface). A developer of a client would normally expect that he can set and get the attribute and that he can notify or subscribe to changes of the value of the attribute. We will see below in the implementation how exactly this is realized by CommonAPI. Franca offers two key words that indicate exactly how the attribute can be accessed: +readonly+ and +noSubscriptions+. The default setting is that everything is allowed; with these two additional key words these possibilies can be limited (eg if someone tries to call a set method and the attribute is readonly he will get an error at compile time).
-
-The nested structure +a1Struct+ is defined in a type collection +CommonTypes+. Structures can be defined just like other type definitions within an interface definition or outside in a type collection. Since Franca 0.8.9 type collections can also be anonymous (without name). A type collection is transferred by the CommonAPI code generator in an additional namespace.
-
-The Franca interface specification of attributes does not contain any information about whether the access from client side is synchronous or asynchronous or whether the attribute is cached by the proxy. CommonAPI provides always methods for synchronous and asynchronous setter and getter methods; caching can be realized via an API extension.
-
-Now let's have a look to the CommonAPI code on the service side. The default implementation of the stub which is generated by the CommonAPI codegenerator defines the attribute as private attribute of the stub class. This attribute can be accessed from the stub implementation via getter and setter functions. Additionaly the API for the stub implementation provides some callbacks (the following code snippet shows parts of the generated stub class which refer to the attribute x):
-
-[source,{cppstr}]
-----
-class E02AttributesStubDefault : public virtual E02AttributesStub {
- public:
- E02AttributesStubDefault();
-
- virtual const int32_t& getXAttribute(
- const std::shared_ptr<CommonAPI::ClientId> clientId);
-
- virtual void setXAttribute(
- const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t value);
-
- protected:
- virtual bool trySetXAttribute(int32_t value);
- virtual bool validateXAttributeRequestedValue(const int32_t& value);
- virtual void onRemoteXAttributeChanged();
-
- private:
- int32_t xAttributeValue_;
-};
-----
-
-If the implementation of the stub has to change the value of the attribute +x+, let's say in a class +E02AttributesStubImpl+ that is derived from +E02AttributesStubDefault+, then it can call +setXAttribute+ (analog the usage of +getXAttribute+). The callback +onRemoteXAttributeChanged+ informs that a change of the attribute +x+ has been completed. The other callbacks can prevent the set of the attribute (+validateXAttributeRequestedValue+) or change the given value from the client (+trySetXAttribute+).
-
-In the example the service increments a counter every 2 seconds and publishes the counter value via the interface attribute +x+.
-
-Now see the implementation of the client. The simplest case is to get the current value of +x+. The following extract shows one part of the main function:
-
-[source,{cppstr}]
-----
-#include <iostream>
-
-#include <CommonAPI/CommonAPI.h>
-#include <commonapi/examples/E02AttributesProxy.h>
-
-using namespace commonapi::examples;
-
-int main() {
-
- std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::load();
-
- std::shared_ptr < CommonAPI::Factory > factory = runtime->createFactory();
- const std::string& serviceAddress =
- "local:commonapi.examples.Attributes:commonapi.examples.Attributes";
- std::shared_ptr < E02AttributesProxyDefault > myProxy =
- factory->buildProxy < E02AttributesProxy > (serviceAddress);
-
- while (!myProxy->isAvailable()) { usleep(10); }
-
- CommonAPI::CallStatus callStatus;
- int32_t value = 0;
-
- // Get actual attribute value from service
- myProxy->getXAttribute().getValue(callStatus, value);
- if (callStatus != CommonAPI::CallStatus::SUCCESS) {
- std::cerr << "Remote call A failed!\n";
- return -1;
- }
- std::cout << "Got attribute value: " << value << std::endl;
-
-}
-----
-
-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:
-
-[source,{cppstr}]
-----
-myProxy->getXAttribute().getChangedEvent().subscribe([&](const int32_t& val) {
- std::cout << "Received change message: " << val << std::endl;
-});
-----
-
-Of course it is also possible to define a separate callback function with an user-defined name (here recv_cb):
-
-[source,{cppstr}]
-----
-void recv_cb(const CommonAPI::CallStatus& callStatus, const int32_t& val) {
- std::cout << "Receive callback: " << val << std::endl;
-}
-
-.... // main method
-
-// Subscribe for receiving values, alternative implementation 1
-std::function<void (int32_t)> f = recv_msg;
-myProxy->getXAttribute().getChangedEvent().subscribe(f);
-
-// Subscribe for receiving values, alternative implementation 2
-myProxy->getXAttribute().getChangedEvent().subscribe(
- std::bind(recv_msg, std::placeholders::_1));
-----
-
-Asynchronous setting of attributes via setValueAsync works analog as shown in the following code extract where the more complex attribute _a1_ is set from the client:
-
-[source,{cppstr}]
-----
-void recv_cb_s(const CommonAPI::CallStatus& callStatus,
- const CommonTypes::a1Struct& valStruct) {
-
- std::cout << "Receive callback for structure: a1.s = " <<
- valStruct.s << ", valStruct.a2.d = " << valStruct.a2.d << std::endl;
-}
-.... // main method
-
-CommonTypes::a1Struct valueStruct;
-
-valueStruct.s = "abc";
-valueStruct.a2.b = true;
-valueStruct.a2.d = 1234;
-
-std::function<void (const CommonAPI::CallStatus&, CommonTypes::a1Struct)> fcb_s =
- recv_cb_s;
-
-myProxy->getA1Attribute().setValueAsync(valueStruct, fcb_s);
-----
-
-As described above, in the chapter "Attribute Extensions" of this tutorial, it is possible to extend the standard CommonAPI for attributes by defining Attribute Extensions. In this example you have to:
-
-* include the template definition of the extension (AttributeCacheExtension.hpp)
-* to call a different factory method for creating the proxy (e.g. buildProxyWithDefaultAttributeExtension)
-* and then it is possible to call the new defined methods, e.g.
-
-[source,{cppstr}]
-----
-int32_t valueCached = 0;
-bool r;
-r = myProxy->getXAttributeExtension().getCachedValue(valueCached);
-std::cout << "Got cached attribute value[" << (int)r << "]: " << valueCached << std::endl;
-----
-
-See the source code of the example for a deeper insight.
-
diff --git a/CommonAPI-Examples/e03Methods/CMakeLists.txt b/CommonAPI-Examples/e03Methods/CMakeLists.txt
deleted file mode 100644
index e321988..0000000
--- a/CommonAPI-Examples/e03Methods/CMakeLists.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright (C) 2014 BMW Group
-# Author: Manfred Bathelt (manfred.bathelt@bmw.de)
-# Author: Juergen Gehring (juergen.gehring@bmw.de)
-# 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/.
-
-cmake_minimum_required(VERSION 2.8)
-
-# Project settings
-if (PRJ_NAME)
- message(STATUS "Start CMake for Project " ${PRJ_NAME})
-else()
- message(FATAL_ERROR "Please specify your project name using -D PRJ_NAME=yourName")
-endif()
-project(${PRJ_NAME})
-set(CMAKE_VERBOSE_MAKEFILE on)
-set(CMAKE_CXX_FLAGS "-Wall -std=c++0x")
-set(CMAKE_BUILD_TYPE Debug)
-
-# DBus Path
-if (DBUS_LIB_PATH)
- message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH})
-else()
- message(FATAL_ERROR "Please specify the path to your patched DBus library using -D DBUS_LIB_PATH=yourPath")
-endif()
-
-# CommonAPI
-include(FindPkgConfig)
-pkg_check_modules (DBUS "dbus-1 >= 1.4")
-pkg_check_modules (COMMONAPI "CommonAPI >= 2.1")
-pkg_check_modules (COMMONAPI_DBUS "CommonAPI-DBus >= 2.1")
-
-# Source Files
-set(PRJ_SRC_PATH src)
-set(PRJ_SRC_GEN_PATH src-gen/commonapi/examples)
-
-set(PRJ_NAME_CLIENT ${PROJECT_NAME}Client)
-set(PRJ_NAME_SERVICE ${PROJECT_NAME}Service)
-
-FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Proxy.cpp ${PRJ_SRC_GEN_PATH}/*Types.cpp)
-FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Stub*.cpp ${PRJ_SRC_GEN_PATH}/*Types.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})
-
-# Paths
-message(STATUS "COMMONAPI_INCLUDEDIR = " ${COMMONAPI_INCLUDEDIR})
-message(STATUS "COMMONAPI_DBUS_INCLUDEDIR = " ${COMMONAPI_DBUS_INCLUDEDIR})
-
-include_directories(
- src-gen
- ${DBUS_INCLUDE_DIRS}
- ${COMMONAPI_INCLUDEDIR}
- ${COMMONAPI_DBUS_INCLUDEDIR}
-)
-
-link_directories(
- ${DBUS_LIB_PATH}
- ${COMMONAPI_LIBDIR}
- ${COMMONAPI_DBUS_LIBDIR}
-)
-
-# Build Client
-add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS})
-target_link_libraries(${PRJ_NAME_CLIENT} CommonAPI CommonAPI-DBus)
-
-# Build service
-add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS})
-target_link_libraries(${PRJ_NAME_SERVICE} CommonAPI CommonAPI-DBus)
diff --git a/CommonAPI-Examples/e04PhoneBook/CMakeLists.txt b/CommonAPI-Examples/e04PhoneBook/CMakeLists.txt
deleted file mode 100644
index 64346fb..0000000
--- a/CommonAPI-Examples/e04PhoneBook/CMakeLists.txt
+++ /dev/null
@@ -1,72 +0,0 @@
-# Copyright (C) 2014 BMW Group
-# Author: Manfred Bathelt (manfred.bathelt@bmw.de)
-# Author: Juergen Gehring (juergen.gehring@bmw.de)
-# 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/.
-
-cmake_minimum_required(VERSION 2.8)
-
-# Project settings
-if (PRJ_NAME)
- message(STATUS "Start CMake for Project " ${PRJ_NAME})
-else()
- message(FATAL_ERROR "Please specify your project name using -D PRJ_NAME=yourName")
-endif()
-project(${PRJ_NAME})
-set(CMAKE_VERBOSE_MAKEFILE on)
-set(CMAKE_CXX_FLAGS "-Wall -std=c++0x")
-set(CMAKE_BUILD_TYPE Debug)
-
-# DBus Path
-if (DBUS_LIB_PATH)
- message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH})
-else()
- message(FATAL_ERROR "Please specify the path to your patched DBus library using -D DBUS_LIB_PATH=yourPath")
-endif()
-
-# CommonAPI
-include(FindPkgConfig)
-pkg_check_modules (DBUS "dbus-1 >= 1.4")
-pkg_check_modules (COMMONAPI "CommonAPI >= 2.1")
-pkg_check_modules (COMMONAPI_DBUS "CommonAPI-DBus >= 2.1")
-
-# Source Files
-set(PRJ_SRC_PATH src)
-set(PRJ_SRC_GEN_PATH src-gen/commonapi/examples)
-
-set(PRJ_NAME_CLIENT ${PROJECT_NAME}Client)
-set(PRJ_NAME_SERVICE ${PROJECT_NAME}Service)
-
-STRING(REGEX REPLACE "^e" "E" PRJ_DATA_IMPL ${PRJ_NAME})
-FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Proxy.cpp ${PRJ_SRC_GEN_PATH}/*Types.cpp ${PRJ_SRC_GEN_PATH}/${PRJ_DATA_IMPL}.cpp)
-FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Stub*.cpp ${PRJ_SRC_GEN_PATH}/*Types.cpp ${PRJ_SRC_GEN_PATH}/${PRJ_DATA_IMPL}.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})
-
-# Paths
-message(STATUS "COMMONAPI_INCLUDEDIR = " ${COMMONAPI_INCLUDEDIR})
-message(STATUS "COMMONAPI_DBUS_INCLUDEDIR = " ${COMMONAPI_DBUS_INCLUDEDIR})
-
-include_directories(
- src-gen
- ${DBUS_INCLUDE_DIRS}
- ${COMMONAPI_INCLUDEDIR}
- ${COMMONAPI_DBUS_INCLUDEDIR}
-)
-
-link_directories(
- ${DBUS_LIB_PATH}
- ${COMMONAPI_LIBDIR}
- ${COMMONAPI_DBUS_LIBDIR}
-)
-
-# Build Client
-add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS})
-target_link_libraries(${PRJ_NAME_CLIENT} CommonAPI CommonAPI-DBus)
-
-# Build service
-add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS})
-target_link_libraries(${PRJ_NAME_SERVICE} CommonAPI CommonAPI-DBus)
diff --git a/CommonAPI-Examples/e04PhoneBook/README b/CommonAPI-Examples/e04PhoneBook/README
deleted file mode 100644
index 90a2eb5..0000000
--- a/CommonAPI-Examples/e04PhoneBook/README
+++ /dev/null
@@ -1,237 +0,0 @@
-Example 4: PhoneBook
-~~~~~~~~~~~~~~~~~~~~
-
-This slightly more complex example illustrates the application of some Franca features in combination with CommonAPI:
-
-- explicit named arrays and inline arrays
-- selective broadcasts
-- polymorphic structs
-
-Concerning arrays please note the following points:
-
-- In Franca there are two ways to define arrays: explicitly named (array myArray of UInt8) or implicit without defining a new name for the array (UInt8 []).
-- The implicit definition of multidimensional arrays is not possible at the moment (like UInt8 [][]), but multidimensional arrays can be defined with explicit names.
-- In CommonAPI arrays are implemented and generated as std::vector.
-
-A common problem in the specification of interfaces between user frontends and services which contain large data sets is, that the clients usually need only extracts from the database. That means that only a filtered excerpt from the database has to be transmitted via IPC to the client, but probably every client needs a different excerpt. The filter can affect the selection of the elements (element filter), the contents of the elements (content filter) or the number of elements (array window).
-
-The following example shows how different extracts of a central data array can be accessed by the several clients via a data filter mechansim and selective broadcasts. As example of a central data array a phonebook is selected; the following picture shows the basic content of the example.
-
-image::{imagedir}/E04PhoneBook.png[PhoneBookExample image]
-
-The Franca IDL specification is:
-
-[source,java]
-----
-package commonapi.examples
-
-interface E04PhoneBook {
-
- version { major 1 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
- }
-}
-----
-
-The phone book itself is modeled as an attribute which is an array of the structure +phoneBookStruct+. Here the phone book is readonly, that means that the whole content can be accessed only via subscription and the getter function. A special difficulty is the phone number, because there are several kinds of phone numbers allowed (home, mobile, ...). Therefore the element +phoneNumber+ in +phoneBookStruct+ is a map with an enumeration key and a value of type string for the number. The client can set a filter to the phone book data (in the example only content filter and element filter, but other filters are conceivable) via the method +setPhoneBookDataFilter+ and gets the data back via the selective broadcast +phoneBookDataSet+. Since the content of the data set depends on the filter, the elements of the client specific data set are specified as maps where the key is the type of the element (name, forename, ...) and the value is the content of the element. The content can be of the type String or of the user defined type phoneNumberMap. Therefore the value is defined as polymorphic struct which can be a String or a phoneNumberMap.
-
-In the following we consider only some interesting implementation details, for the complete implementation please see the source code.
-
-The interesting part of the service is the implementation of the set function for the data filter. At the moment only the element filter is implemented, but the implementation of the other filters can be added analogously.
-
-- Each client is identified via its clientId; the implementation of client ID class allows the usage of cientId objects as key in a map (see the specification).
-- The data sets of the filtered data for the clients are stored in a map with the clientId as key; in this example the filtered data are sent back to the client directly in the filter set function. Please note, that firePhoneBookDataSetSelective sends the data to only one receiver.
-- The value of the key has to be the right type (+phoneNumberMap+ for phoneNumbers and Strings for the rest).
-
-[source,{cppstr}]
-----
-void E04PhoneBookStubImpl::setPhoneBookDataFilter (
- const std::shared_ptr<CommonAPI::ClientId> clientId,
- E04PhoneBook::elementFilterStruct elementFilter,
- std::vector<E04PhoneBook::contentFilterStruct> contentFilter ) {
-
- std::shared_ptr<CommonAPI::ClientIdList> clientIdList =
- getSubscribersForPhoneBookDataSetSelective();
-
- std::vector<E04PhoneBook::phoneBookDataElementMap> lPhoneBookDataSet;
- phoneBookClientData.erase (clientId);
-
- std::vector<E04PhoneBook::phoneBookStruct>::const_iterator it0;
- for (it0 = getPhoneBookAttribute().begin();
- it0 != getPhoneBookAttribute().end(); it0++ ) {
-
- E04PhoneBook::phoneBookDataElementMap lPhoneBookDataElement;
-
- if ( elementFilter.addName ) {
- std::shared_ptr<E04PhoneBook::phoneBookDataElementString> name =
- std::make_shared<E04PhoneBook::phoneBookDataElementString>();
-
- name->content = it0->name;
-
- lPhoneBookDataElement[E04PhoneBook::phoneBookDataElementEnum::NAME] =
- name;
- }
-
- ... // analogue for the other elements
-
- if ( elementFilter.addPhoneNumber ) {
- std::shared_ptr<E04PhoneBook::phoneBookDataElementPhoneNumber> phoneNumber =
- std::make_shared<E04PhoneBook::phoneBookDataElementPhoneNumber>();
-
- phoneNumber->content = it0->phoneNumber;
-
- lPhoneBookDataElement[E04PhoneBook::phoneBookDataElementEnum::PHONENUMBER] =
- phoneNumber;
- }
-
- lPhoneBookDataSet.push_back(lPhoneBookDataElement);
-
- }
-
- phoneBookClientData[clientId] = lPhoneBookDataSet;
-
- // Send client data
- const std::shared_ptr<CommonAPI::ClientIdList> receivers(new CommonAPI::ClientIdList);
- receivers->insert(clientId);
-
- firePhoneBookDataSetSelective(lPhoneBookDataSet, receivers);
- receivers->erase(clientId);
-}
-----
-
-On client side we create two proxies which shall set different filters and get different data sets. For these two proxies we need different factories! Otherwise CommonAPI cannot keep the proxies apart. Each proxy has to subscribe to phoneBookDataSet, but gets different contents depending on the filter. The whole phoneBookData can be obtained via the standard get function.
-
-[source,{cppstr}]
-----
-int main() {
-
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
-
- std::shared_ptr<CommonAPI::Factory> factoryA = runtime->createFactory();
- std::shared_ptr<CommonAPI::Factory> factoryB = runtime->createFactory();
-
- const std::string& serviceAddress =
- "local:commonapi.examples.PhoneBook:commonapi.examples.PhoneBook";
-
- std::shared_ptr<E04PhoneBookProxy<>> myProxyA =
- factoryA->buildProxy<E04PhoneBookProxy>(serviceAddress);
- while (!myProxyA->isAvailable()) { usleep(10); }
-
- std::shared_ptr<E04PhoneBookProxy<>> myProxyB =
- factoryB->buildProxy<E04PhoneBookProxy>(serviceAddress);
- while (!myProxyB->isAvailable()) { usleep(10); }
-
- // Subscribe A to broadcast
- myProxyA->getPhoneBookDataSetSelectiveEvent().subscribe(
- [&](const std::vector<E04PhoneBook::phoneBookDataElementMap>& phoneBookDataSet) {
- printFilterResult(phoneBookDataSet, "A");
- });
-
- // Subscribe B to broadcast
- myProxyB->getPhoneBookDataSetSelectiveEvent().subscribe(
- [&](const std::vector<E04PhoneBook::phoneBookDataElementMap>& phoneBookDataSet) {
- printFilterResult(phoneBookDataSet, "B");
- });
-
- // Get actual phoneBook from service
- CommonAPI::CallStatus myCallStatus;
- std::vector<E04PhoneBook::phoneBookStruct> myValue;
- myProxyA->getPhoneBookAttribute().getValue(myCallStatus, myValue);
-
- // Synchronous call setPhoneBookDataFilter
- E04PhoneBook::elementFilterStruct lElementFilterA =
- { true, true, false, false, false, false};
-
- std::vector<E04PhoneBook::contentFilterStruct> lContentFilterA =
- { {E04PhoneBook::phoneBookDataElementEnum::NAME, "*"} };
- myProxyA->setPhoneBookDataFilter(lElementFilterA, lContentFilterA, myCallStatus);
-
- E04PhoneBook::elementFilterStruct lElementFilterB =
- { true, false, false, false, false, true };
-
- std::vector<E04PhoneBook::contentFilterStruct> lContentFilterB =
- { {E04PhoneBook::phoneBookDataElementEnum::NAME, "*"} };
- myProxyB->setPhoneBookDataFilter(lElementFilterB, lContentFilterB, myCallStatus);
-
- ... // further code
-}
-----
-
diff --git a/CommonAPI-Examples/e05Manager/CMakeLists.txt b/CommonAPI-Examples/e05Manager/CMakeLists.txt
deleted file mode 100644
index 64346fb..0000000
--- a/CommonAPI-Examples/e05Manager/CMakeLists.txt
+++ /dev/null
@@ -1,72 +0,0 @@
-# Copyright (C) 2014 BMW Group
-# Author: Manfred Bathelt (manfred.bathelt@bmw.de)
-# Author: Juergen Gehring (juergen.gehring@bmw.de)
-# 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/.
-
-cmake_minimum_required(VERSION 2.8)
-
-# Project settings
-if (PRJ_NAME)
- message(STATUS "Start CMake for Project " ${PRJ_NAME})
-else()
- message(FATAL_ERROR "Please specify your project name using -D PRJ_NAME=yourName")
-endif()
-project(${PRJ_NAME})
-set(CMAKE_VERBOSE_MAKEFILE on)
-set(CMAKE_CXX_FLAGS "-Wall -std=c++0x")
-set(CMAKE_BUILD_TYPE Debug)
-
-# DBus Path
-if (DBUS_LIB_PATH)
- message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH})
-else()
- message(FATAL_ERROR "Please specify the path to your patched DBus library using -D DBUS_LIB_PATH=yourPath")
-endif()
-
-# CommonAPI
-include(FindPkgConfig)
-pkg_check_modules (DBUS "dbus-1 >= 1.4")
-pkg_check_modules (COMMONAPI "CommonAPI >= 2.1")
-pkg_check_modules (COMMONAPI_DBUS "CommonAPI-DBus >= 2.1")
-
-# Source Files
-set(PRJ_SRC_PATH src)
-set(PRJ_SRC_GEN_PATH src-gen/commonapi/examples)
-
-set(PRJ_NAME_CLIENT ${PROJECT_NAME}Client)
-set(PRJ_NAME_SERVICE ${PROJECT_NAME}Service)
-
-STRING(REGEX REPLACE "^e" "E" PRJ_DATA_IMPL ${PRJ_NAME})
-FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Proxy.cpp ${PRJ_SRC_GEN_PATH}/*Types.cpp ${PRJ_SRC_GEN_PATH}/${PRJ_DATA_IMPL}.cpp)
-FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Stub*.cpp ${PRJ_SRC_GEN_PATH}/*Types.cpp ${PRJ_SRC_GEN_PATH}/${PRJ_DATA_IMPL}.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})
-
-# Paths
-message(STATUS "COMMONAPI_INCLUDEDIR = " ${COMMONAPI_INCLUDEDIR})
-message(STATUS "COMMONAPI_DBUS_INCLUDEDIR = " ${COMMONAPI_DBUS_INCLUDEDIR})
-
-include_directories(
- src-gen
- ${DBUS_INCLUDE_DIRS}
- ${COMMONAPI_INCLUDEDIR}
- ${COMMONAPI_DBUS_INCLUDEDIR}
-)
-
-link_directories(
- ${DBUS_LIB_PATH}
- ${COMMONAPI_LIBDIR}
- ${COMMONAPI_DBUS_LIBDIR}
-)
-
-# Build Client
-add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS})
-target_link_libraries(${PRJ_NAME_CLIENT} CommonAPI CommonAPI-DBus)
-
-# Build service
-add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS})
-target_link_libraries(${PRJ_NAME_SERVICE} CommonAPI CommonAPI-DBus)
diff --git a/CommonAPI-Examples/e05Manager/README b/CommonAPI-Examples/e05Manager/README
deleted file mode 100644
index 5a1da8a..0000000
--- a/CommonAPI-Examples/e05Manager/README
+++ /dev/null
@@ -1,135 +0,0 @@
-Example 5: Managed
-~~~~~~~~~~~~~~~~~~
-
-So far we have looked at software systems, which consisted of services and users of these servces, the clients. However, in some systems there is a slightly different kind of relationship between the software components: a central manager manages other services (let's call them slaves or leaves). This central manager is a service itself but acts as client for the managed services. One example for such a system is, for example, a device manager that manages several devices, which can be availabe for usage in the system or not. The central manager handles all adminitrative tasks related to the slaves and provides a central, common interface to the user frontend.
-
-image::{imagedir}/E05Manager.png[ManagerExample image]
-
-Franca IDL supports this kind of software structure by the keyword _manages_, which can be added to the keyword interface. The following example illustrates the application of this keyword.
-
-[source,java]
-----
-package commonapi.examples
-
-interface E05Manager manages E05Device, E05SpecialDevice {
- version { major 1 minor 0 }
-
- attribute String [] myDevices
-}
-
-interface E05Device {
- version { major 1 minor 0 }
-
- method doSomething {
- }
-}
-
-interface E05SpecialDevice extends E05Device {
- version { major 1 minor 0 }
-
- method doSomethingSpecial {
- }
-}
-----
-
-The device manager has the service interface E05Manager and it manages devices with the interfaces E05Device and E05SpecialDevice. It is important to understand, that the exact meaning of the keyword +manages+ cannot be defined by the IDL; the keyword just indicates that there is a relationship between software components which implement manager and managed interfaces. It can be used in bindings as CommonAPI to provide API functions for a more convenient implementation of this certain kind of relationship.
-
-Therefore let's have a look at the generated and implemented source code. Since we have three interfaces the code generator generates for every interface proxy and stub classes. In our example we just want to illuminate one aspect of the managed interfaces: the registration of the managed interfaces via the manager. We assume that we have only one service (the manager) which gets informed about a detected or a removed device via the public function deviceDetected and deviceRemoved. The devices are distinguished by a number; in principle there is an arbitrary number of devices possible. The registration of the devices at CommonAPI does the manager in his stub implementation.
-
-[source,{cppstr}]
-----
-... // includes, namespaces, constructors as usual
-
-E05ManagerStubImpl::E05ManagerStubImpl (const std::string instanceName) {
-
- managerInstanceName = instanceName;
-}
-
-void E05ManagerStubImpl::deviceDetected (unsigned int n) {
-
- std::string deviceInstanceName = getDeviceName (n);
- myDevices[deviceInstanceName] = DevicePtr (new E05DeviceStubImpl);
- const bool deviceRegistered = this->registerManagedStubE05Device(
- myDevices[deviceInstanceName], deviceInstanceName);
-}
-
-void E05ManagerStubImpl::deviceRemoved (unsigned int n) {
-
- std::string deviceInstanceName = getDeviceName (n);
- const bool deviceDeregistered = this->deregisterManagedStubE05Device(
- deviceInstanceName);
- if ( deviceDeregistered ) { myDevices.erase (deviceInstanceName); }
-}
-
-std::string E05ManagerStubImpl::getDeviceName (unsigned int n) {
-
- std::stringstream ss;
- ss << managerInstanceName <<
- ".device" << std::setw(2) << std::hex << std::setfill('0') << n;
- return ss.str();
-}
-
-... // implementation of special device analogously
-----
-
-The functions for the special device has been omitted for clarity.The implementations of the devices themselves are not important here as well. See now the implementation of the client. The client gets informed about new or removed devices including the addresses of these devices via the callback function newDeviceAvailable. This function can be subscribed as function object at an status event that is triggered when a device is added or removed.
-
-[source, {cppstr}]
-----
-#include <iostream>
-
-#include <CommonAPI/CommonAPI.h>
-#include <commonapi/examples/E05ManagerProxy.h>
-
-using namespace commonapi::examples;
-
-void newDeviceAvailable (const std::string address,
- const CommonAPI::AvailabilityStatus status) {
-
- if ( status == CommonAPI::AvailabilityStatus::AVAILABLE ) {
-
- std::cout << "New device available: " << address << std::endl;
- }
-
- if ( status == CommonAPI::AvailabilityStatus::NOT_AVAILABLE ) {
-
- std::cout << "Device removed: " << address << std::endl;
- }
-}
-
-int main() {
-
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
-
- std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
-
- const std::string& serviceAddress =
- "local:commonapi.examples.Manager:commonapi.examples.Manager";
-
- std::shared_ptr<E05ManagerProxy<>> myProxy =
- factory->buildProxy<E05ManagerProxy>(serviceAddress);
-
- while (!myProxy->isAvailable()) { usleep(10); }
-
- std::cout << "Proxy available." << std::endl;
-
- CommonAPI::ProxyManager::InstanceAvailabilityStatusChangedEvent& deviceEvent =
- myProxy->getProxyManagerE05Device().
- getInstanceAvailabilityStatusChangedEvent();
-
- CommonAPI::ProxyManager::InstanceAvailabilityStatusChangedEvent& specialDeviceEvent =
- myProxy->getProxyManagerE05SpecialDevice().
- getInstanceAvailabilityStatusChangedEvent();
-
- 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));
- }
- return 0;
-}
-----
diff --git a/CommonAPI-Examples/e06Unions/.gitignore b/CommonAPI-Examples/e06Unions/.gitignore
deleted file mode 100644
index 5897208..0000000
--- a/CommonAPI-Examples/e06Unions/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-build
-src-gen \ No newline at end of file
diff --git a/CommonAPI-Examples/e06Unions/CMakeLists.txt b/CommonAPI-Examples/e06Unions/CMakeLists.txt
deleted file mode 100644
index e321988..0000000
--- a/CommonAPI-Examples/e06Unions/CMakeLists.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright (C) 2014 BMW Group
-# Author: Manfred Bathelt (manfred.bathelt@bmw.de)
-# Author: Juergen Gehring (juergen.gehring@bmw.de)
-# 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/.
-
-cmake_minimum_required(VERSION 2.8)
-
-# Project settings
-if (PRJ_NAME)
- message(STATUS "Start CMake for Project " ${PRJ_NAME})
-else()
- message(FATAL_ERROR "Please specify your project name using -D PRJ_NAME=yourName")
-endif()
-project(${PRJ_NAME})
-set(CMAKE_VERBOSE_MAKEFILE on)
-set(CMAKE_CXX_FLAGS "-Wall -std=c++0x")
-set(CMAKE_BUILD_TYPE Debug)
-
-# DBus Path
-if (DBUS_LIB_PATH)
- message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH})
-else()
- message(FATAL_ERROR "Please specify the path to your patched DBus library using -D DBUS_LIB_PATH=yourPath")
-endif()
-
-# CommonAPI
-include(FindPkgConfig)
-pkg_check_modules (DBUS "dbus-1 >= 1.4")
-pkg_check_modules (COMMONAPI "CommonAPI >= 2.1")
-pkg_check_modules (COMMONAPI_DBUS "CommonAPI-DBus >= 2.1")
-
-# Source Files
-set(PRJ_SRC_PATH src)
-set(PRJ_SRC_GEN_PATH src-gen/commonapi/examples)
-
-set(PRJ_NAME_CLIENT ${PROJECT_NAME}Client)
-set(PRJ_NAME_SERVICE ${PROJECT_NAME}Service)
-
-FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Proxy.cpp ${PRJ_SRC_GEN_PATH}/*Types.cpp)
-FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Stub*.cpp ${PRJ_SRC_GEN_PATH}/*Types.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})
-
-# Paths
-message(STATUS "COMMONAPI_INCLUDEDIR = " ${COMMONAPI_INCLUDEDIR})
-message(STATUS "COMMONAPI_DBUS_INCLUDEDIR = " ${COMMONAPI_DBUS_INCLUDEDIR})
-
-include_directories(
- src-gen
- ${DBUS_INCLUDE_DIRS}
- ${COMMONAPI_INCLUDEDIR}
- ${COMMONAPI_DBUS_INCLUDEDIR}
-)
-
-link_directories(
- ${DBUS_LIB_PATH}
- ${COMMONAPI_LIBDIR}
- ${COMMONAPI_DBUS_LIBDIR}
-)
-
-# Build Client
-add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS})
-target_link_libraries(${PRJ_NAME_CLIENT} CommonAPI CommonAPI-DBus)
-
-# Build service
-add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS})
-target_link_libraries(${PRJ_NAME_SERVICE} CommonAPI CommonAPI-DBus)
diff --git a/CommonAPI-Examples/e06Unions/src/e06UnionsService.cpp b/CommonAPI-Examples/e06Unions/src/e06UnionsService.cpp
deleted file mode 100644
index d8486f5..0000000
--- a/CommonAPI-Examples/e06Unions/src/e06UnionsService.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 2014 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-
-#include <thread>
-#include <iostream>
-
-#include <CommonAPI/CommonAPI.h>
-#include "E06UnionsStubImpl.h"
-
-int main() {
- int n = 0;
-
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
-
- const std::string& serviceAddress = "local:commonapi.examples.Unions:commonapi.examples.Unions";
- std::shared_ptr<E06UnionsStubImpl> myService = std::make_shared<E06UnionsStubImpl>();
- servicePublisher->registerService(myService, serviceAddress, factory);
-
- 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-Ping/.gitignore b/CommonAPI-Ping/.gitignore
deleted file mode 100644
index d5e715c..0000000
--- a/CommonAPI-Ping/.gitignore
+++ /dev/null
@@ -1,26 +0,0 @@
-.deps
-.dirstamp
-.libs
-*.la
-*.lo
-*.o
-*.gz
-/.autotools
-/.cproject
-/.project
-/.settings
-/*.pc
-/Makefile
-/Makefile.in
-/aclocal.m4
-/autom4te.cache
-/build-aux
-/config.log
-/config.status
-/configure
-/libtool
-/m4/libtool.m4
-/m4/lt*.m4
-/src-gen
-/PingClient
-/PingService
diff --git a/CommonAPI-Ping/Makefile.am b/CommonAPI-Ping/Makefile.am
deleted file mode 100644
index 140839c..0000000
--- a/CommonAPI-Ping/Makefile.am
+++ /dev/null
@@ -1,71 +0,0 @@
-ACLOCAL_AMFLAGS = -I m4
-EXTRA_DIST = LICENSE
-
-# ------------------------------------------------------------------------------
-MAINTAINERCLEANFILES = \
- Makefile.in \
- aclocal.m4 \
- configure
-
-maintainer-clean-local:
- -rm -rf build-aux
- -rm -f config.h.in*
- -rm -f m4/libtool*.m4
- -rm -f m4/lt*.m4
- -rm -rf src-gen
-
-AM_CPPFLAGS = \
- ${COMMONAPI_DBUS_CFLAGS} \
- -I$(top_srcdir)/src-gen \
- -D_GNU_SOURCE \
- -D_GLIBCXX_USE_NANOSLEEP
-
-AM_LDFLAGS = ${COMMONAPI_DBUS_LIBS}
-
-# ------------------------------------------------------------------------------
-lib_LTLIBRARIES = \
- libcommonapi-tests-Ping.la \
- libcommonapi-tests-PingProxy.la \
- libcommonapi-tests-PingStubDefault.la
-
-libcommonapi_tests_Ping_la_SOURCES = \
- src-gen/CommonAPI/tests/Ping.h \
- src-gen/CommonAPI/tests/Ping.cpp
-
-libcommonapi_tests_PingProxy_la_SOURCES = \
- src-gen/CommonAPI/tests/PingProxyBase.h \
- src-gen/CommonAPI/tests/PingProxy.h \
- src-gen/CommonAPI/tests/PingDBusProxy.h \
- src-gen/CommonAPI/tests/PingDBusProxy.cpp
-libcommonapi_tests_PingProxy_la_LIBADD = \
- libcommonapi-tests-Ping.la
-
-libcommonapi_tests_PingStubDefault_la_SOURCES = \
- src-gen/CommonAPI/tests/PingStub.h \
- src-gen/CommonAPI/tests/PingStubDefault.h \
- src-gen/CommonAPI/tests/PingStubDefault.cpp \
- src-gen/CommonAPI/tests/PingDBusStubAdapter.h \
- src-gen/CommonAPI/tests/PingDBusStubAdapter.cpp
-libcommonapi_tests_PingStubDefault_la_LIBADD = \
- libcommonapi-tests-Ping.la
-
-# ------------------------------------------------------------------------------
-bin_PROGRAMS = \
- PingClient \
- PingService
-
-PingClient_SOURCES = \
- src/Benchmark.h \
- src/Benchmark.cpp \
- src/BenchmarkStats.h \
- src/BenchmarkStats.cpp \
- src/PingClient.cpp \
- src/StopWatch.h \
- src/StopWatch.cpp
-
-PingClient_LDADD = libcommonapi-tests-PingProxy.la
-
-PingService_SOURCES = \
- src/PingService.cpp
-PingService_LDADD = \
- libcommonapi-tests-PingStubDefault.la \ No newline at end of file
diff --git a/CommonAPI-Ping/configure.ac b/CommonAPI-Ping/configure.ac
deleted file mode 100644
index 190c8a2..0000000
--- a/CommonAPI-Ping/configure.ac
+++ /dev/null
@@ -1,40 +0,0 @@
-AC_PREREQ(2.61)
-AC_INIT([GENIVI Common API Ping Tool],
- [1.0],
- [],
- [CommonAPI-Ping])
-
-AC_CONFIG_MACRO_DIR([m4])
-m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
-AC_CONFIG_AUX_DIR([build-aux])
-AC_CONFIG_HEADERS([build-aux/config.h])
-AC_CONFIG_FILES([Makefile])
-
-AC_CANONICAL_SYSTEM
-
-AM_INIT_AUTOMAKE([foreign 1.11 silent-rules subdir-objects color-tests -Wall -Werror])
-AM_SILENT_RULES
-AM_MAINTAINER_MODE
-
-AC_PROG_CXX
-AC_LANG([C++])
-AX_CXX_COMPILE_STDCXX_11([noext])
-
-LT_PREREQ(2.2)
-LT_INIT
-
-PKG_PROG_PKG_CONFIG
-PKG_CHECK_MODULES(COMMONAPI_DBUS, [CommonAPI-DBus >= 2.0])
-
-AC_MSG_RESULT([
- $PACKAGE_NAME v$VERSION
-
- COMMONAPI_DBUS_CFLAGS: ${COMMONAPI_DBUS_CFLAGS}
- COMMONAPI_DBUS_LIBS: ${COMMONAPI_DBUS_LIBS}
-
- prefix: ${prefix}
- CXXFLAGS: ${CXXFLAGS}
- LDFLAGS: ${LDFLAGS}
-])
-
-AC_OUTPUT \ No newline at end of file
diff --git a/CommonAPI-Ping/m4/ax_cxx_compile_stdcxx_11.m4 b/CommonAPI-Ping/m4/ax_cxx_compile_stdcxx_11.m4
deleted file mode 100644
index 0d96c07..0000000
--- a/CommonAPI-Ping/m4/ax_cxx_compile_stdcxx_11.m4
+++ /dev/null
@@ -1,107 +0,0 @@
-# ============================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
-# ============================================================================
-#
-# SYNOPSIS
-#
-# AX_CXX_COMPILE_STDCXX_11([ext|noext])
-#
-# DESCRIPTION
-#
-# Check for baseline language coverage in the compiler for the C++11
-# standard; if necessary, add switches to CXXFLAGS to enable support.
-# Errors out if no mode that supports C++11 baseline syntax can be found.
-# The argument, if specified, indicates whether you insist on an extended
-# mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -std=c++11).
-# If neither is specified, you get whatever works, with preference for an
-# extended mode.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
-# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 1
-
-m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
- template <typename T>
- struct check
- {
- static_assert(sizeof(int) <= sizeof(T), "not big enough");
- };
-
- typedef check<check<bool>> right_angle_brackets;
-
- int a;
- decltype(a) b;
-
- typedef check<int> check_type;
- check_type c;
- check_type&& cr = static_cast<check_type&&>(c);
-])
-
-AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
- m4_if([$1], [], [],
- [$1], [ext], [],
- [$1], [noext], [],
- [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
- AC_LANG_ASSERT([C++])dnl
- ac_success=no
- AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
- ax_cv_cxx_compile_cxx11,
- [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
- [ax_cv_cxx_compile_cxx11=yes],
- [ax_cv_cxx_compile_cxx11=no])])
- if test x$ax_cv_cxx_compile_cxx11 = xyes; then
- ac_success=yes
- fi
-
- m4_if([$1], [noext], [], [dnl
- if test x$ac_success = xno; then
- for switch in -std=gnu++11 -std=gnu++0x; do
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
- AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
- $cachevar,
- [ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $switch"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
- [eval $cachevar=yes],
- [eval $cachevar=no])
- CXXFLAGS="$ac_save_CXXFLAGS"])
- if eval test x\$$cachevar = xyes; then
- CXXFLAGS="$CXXFLAGS $switch"
- ac_success=yes
- break
- fi
- done
- fi])
-
- m4_if([$1], [ext], [], [dnl
- if test x$ac_success = xno; then
- for switch in -std=c++11 -std=c++0x; do
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
- AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
- $cachevar,
- [ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $switch"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
- [eval $cachevar=yes],
- [eval $cachevar=no])
- CXXFLAGS="$ac_save_CXXFLAGS"])
- if eval test x\$$cachevar = xyes; then
- CXXFLAGS="$CXXFLAGS $switch"
- ac_success=yes
- break
- fi
- done
- fi])
-
- if test x$ac_success = xno; then
- AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
- fi
-])
diff --git a/CommonAPI-Ping/src/Benchmark.cpp b/CommonAPI-Ping/src/Benchmark.cpp
deleted file mode 100644
index 9c32a37..0000000
--- a/CommonAPI-Ping/src/Benchmark.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-#include "Benchmark.h"
-
-#include <CommonAPI/Factory.h>
-#include <chrono>
-#include <functional>
-
-
-static const std::string serviceAddress = "local:comommonapi.tests.PingService:commonapi.tests.Ping";
-
-
-namespace CommonAPI {
-namespace tests {
-
-Benchmark::Benchmark(SendType sendType, unsigned long sendCount, unsigned long arraySize, bool verbose, bool async):
- sendType_(sendType),
- sendCount_(sendCount),
- arraySize_(arraySize),
- verbose_(verbose),
- async_(async),
- benchmarkStats_("GENIVI_PING", sendCount_, verbose_),
- getEmptyResponseAsyncCallback_(std::bind(&Benchmark::emptyAsyncSendBenchmarkCallback, this, std::placeholders::_1)),
- getTestDataCopyAsyncCallback_(std::bind(&Benchmark::copyAsyncSendBenchmarkCallback, this, std::placeholders::_1, std::placeholders::_2)),
- getTestDataArrayCopyAsyncCallback_(std::bind(&Benchmark::copiesAsyncSendBenchmarkCallback, this, std::placeholders::_1, std::placeholders::_2)) {
-}
-
-bool Benchmark::run() {
- std::shared_ptr<CommonAPI::Factory> factory = CommonAPI::Runtime::load()->createFactory();
-
- pingProxy_ = factory->buildProxy<CommonAPI::tests::PingProxy>(serviceAddress);
-
- std::cout << "Waiting for PingService: " << serviceAddress << std::endl;
- for (int i = 0; !pingProxy_->isAvailable() && i < 10; i++) {
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
- }
-
- if (!pingProxy_->isAvailable()) {
- std::cerr << "PingService is not available: timed out waiting!\n";
- return false;
- }
-
- if (verbose_) {
- std::cout << "Benchmark begin: type=" << sendType_ << ", count=" << sendCount_ << std::endl;
- }
-
- benchmarkStats_.reset();
-
- CommonAPI::CallStatus result = CommonAPI::CallStatus::NOT_AVAILABLE;
-
- switch (sendType_) {
- case SEND_TYPE_EMPTY:
- result = async_ ? doEmptyAsyncSendBenchmark() : doEmptySendBenchmark();
- break;
-
- case SEND_TYPE_COPY:
- result = async_ ? doCopyAsyncSendBenchmark() : doCopySendBenchmark();
- break;
-
- case SEND_TYPE_COPIES:
- result = async_ ? doCopiesAsyncSendBenchmark() : doCopiesSendBenchmark();
- break;
-
- default:
- std::cerr << "Benchmark type=" << sendType_ << " not implemented!\n";
- break;
- }
-
- if (verbose_) {
- std::cout << "Benchmark end: type=" << sendType_ << ", count=" << sendCount_ << std::endl;
- }
-
- benchmarkStats_.stop();
-
- pingProxy_.reset();
-
- return result == CommonAPI::CallStatus::SUCCESS;
-}
-
-CommonAPI::tests::Ping::TestData Benchmark::createTestData() {
- if (verbose_) {
- std::cout << "Creating TestData struct...\n";
- }
-
- benchmarkStats_.startCreation();
-
- Ping::TestData testData(1, 12.6, 1e40, "XXXXXXXXXXXXXXXXXXXX");
-
- benchmarkStats_.stopCreation();
-
- return testData;
-}
-
-CommonAPI::tests::Ping::TestDataArray Benchmark::createTestDataArray() {
- if (verbose_) {
- std::cout << "Creating TestDataArray of size=" << arraySize_ << "...\n";
- }
-
- benchmarkStats_.startCreation();
-
- CommonAPI::tests::Ping::TestDataArray testDataArray;
-
- for (unsigned long i = 0; i < arraySize_; i++)
- testDataArray.emplace_back(1, 12.6, 1e40, "XXXXXXXXXXXXXXXXXXXX");
-
- benchmarkStats_.stopCreation();
-
- return testDataArray;
-}
-
-CommonAPI::CallStatus Benchmark::doEmptySendBenchmark() {
- CallStatus callStatus;
-
- for (unsigned long i = 0; i < sendCount_; i++) {
- benchmarkStats_.startTransport();
- pingProxy_->getEmptyResponse(callStatus);
-
- if (callStatus != CallStatus::SUCCESS) {
- break;
- }
- benchmarkStats_.stopTransport();
-
- benchmarkStats_.addSendReplyDelta();
- }
-
- return callStatus;
-}
-
-CommonAPI::CallStatus Benchmark::doCopySendBenchmark() {
- CallStatus callStatus;
- Ping::TestData testData = createTestData();
- Ping::TestData testDataReply;
-
- for (unsigned long i = 0; i < sendCount_; i++) {
- benchmarkStats_.startTransport();
- pingProxy_->getTestDataCopy(testData, callStatus, testDataReply);
-
- if (callStatus != CallStatus::SUCCESS) {
- break;
- }
- benchmarkStats_.stopTransport();
-
-
- benchmarkStats_.startCreation();
- testData = testDataReply;
- benchmarkStats_.stopCreation();
-
- benchmarkStats_.addSendReplyDelta();
- }
-
- return callStatus;
-}
-
-CommonAPI::CallStatus Benchmark::doCopiesSendBenchmark() {
- CallStatus callStatus;
- Ping::TestDataArray testDataArray = createTestDataArray();
- Ping::TestDataArray testDataArrayReply;
-
- for (unsigned long i = 0; i < sendCount_; i++) {
- benchmarkStats_.startTransport();
- pingProxy_->getTestDataArrayCopy(testDataArray, callStatus, testDataArrayReply);
-
- if (callStatus != CallStatus::SUCCESS) {
- break;
- }
- benchmarkStats_.stopTransport();
-
- benchmarkStats_.startCreation();
- testDataArray = testDataArrayReply;
- benchmarkStats_.stopCreation();
-
- benchmarkStats_.addSendReplyDelta();
- }
-
- return callStatus;
-}
-
-CommonAPI::CallStatus Benchmark::doEmptyAsyncSendBenchmark() {
- benchmarkStats_.startTransport();
- pingProxy_->getEmptyResponseAsync(getEmptyResponseAsyncCallback_);
-
- auto asyncFuture = asyncPromise_.get_future();
- const CommonAPI::CallStatus& callStatus = asyncFuture.get();
-
- return callStatus;
-}
-
-void Benchmark::emptyAsyncSendBenchmarkCallback(const CommonAPI::CallStatus& callStatus) {
- benchmarkStats_.stopTransport();
- benchmarkStats_.addSendReplyDelta();
-
- if (callStatus == CallStatus::SUCCESS && benchmarkStats_.getSendCount() < sendCount_) {
- benchmarkStats_.startTransport();
- pingProxy_->getEmptyResponseAsync(getEmptyResponseAsyncCallback_);
- } else {
- asyncPromise_.set_value(callStatus);
- }
-}
-
-CommonAPI::CallStatus Benchmark::doCopyAsyncSendBenchmark() {
- Ping::TestData testData = createTestData();
-
- benchmarkStats_.startTransport();
- pingProxy_->getTestDataCopyAsync(testData, getTestDataCopyAsyncCallback_);
-
- auto asyncFuture = asyncPromise_.get_future();
- const CommonAPI::CallStatus& callStatus = asyncFuture.get();
-
- return callStatus;
-}
-
-void Benchmark::copyAsyncSendBenchmarkCallback(const CommonAPI::CallStatus& callStatus, const Ping::TestData& testDataReply) {
- benchmarkStats_.stopTransport();
- benchmarkStats_.addSendReplyDelta();
-
- benchmarkStats_.startCreation();
- Ping::TestData testData = testDataReply;
- benchmarkStats_.stopCreation();
-
- if (callStatus == CallStatus::SUCCESS && benchmarkStats_.getSendCount() < sendCount_) {
- benchmarkStats_.startTransport();
- pingProxy_->getTestDataCopyAsync(testData, getTestDataCopyAsyncCallback_);
- } else {
- asyncPromise_.set_value(callStatus);
- }
-}
-
-CommonAPI::CallStatus Benchmark::doCopiesAsyncSendBenchmark() {
- Ping::TestDataArray testDataArray = createTestDataArray();
-
- benchmarkStats_.startTransport();
- pingProxy_->getTestDataArrayCopyAsync(testDataArray, getTestDataArrayCopyAsyncCallback_);
-
- auto asyncFuture = asyncPromise_.get_future();
- const CommonAPI::CallStatus& callStatus = asyncFuture.get();
-
- return callStatus;
-}
-
-void Benchmark::copiesAsyncSendBenchmarkCallback(const CommonAPI::CallStatus& callStatus, const Ping::TestDataArray& testDataArrayReply) {
- benchmarkStats_.stopTransport();
- benchmarkStats_.addSendReplyDelta();
-
- benchmarkStats_.startCreation();
- Ping::TestDataArray testDataArray = testDataArrayReply;
- benchmarkStats_.stopCreation();
-
- if (callStatus == CallStatus::SUCCESS && benchmarkStats_.getSendCount() < sendCount_) {
- benchmarkStats_.startTransport();
- pingProxy_->getTestDataArrayCopyAsync(testDataArray, getTestDataArrayCopyAsyncCallback_);
- } else {
- asyncPromise_.set_value(callStatus);
- }
-}
-
-} // namespace tests
-} // namespace CommonAPI
diff --git a/CommonAPI-Ping/src/Benchmark.h b/CommonAPI-Ping/src/Benchmark.h
deleted file mode 100644
index 0ed8b08..0000000
--- a/CommonAPI-Ping/src/Benchmark.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-#ifndef COMMONAPI_TESTS_BENCHMARKING_STATS_H_
-#define COMMONAPI_TESTS_BENCHMARKING_STATS_H_
-
-#include <CommonAPI/tests/PingProxy.h>
-
-#include "BenchmarkStats.h"
-
-#include <future>
-
-
-namespace CommonAPI {
-namespace tests {
-
-class Benchmark {
- public:
- enum SendType:int {
- SEND_TYPE_EMPTY = 0,
- SEND_TYPE_COPY,
- SEND_TYPE_COPIES,
- };
-
- Benchmark(SendType sendType, unsigned long sendCount, unsigned long arraySize, bool verbose, bool async);
-
- bool run();
-
- private:
- Ping::TestData createTestData();
- Ping::TestDataArray createTestDataArray();
-
- CommonAPI::CallStatus doEmptySendBenchmark();
- CommonAPI::CallStatus doCopySendBenchmark();
- CommonAPI::CallStatus doCopiesSendBenchmark();
-
- CommonAPI::CallStatus doEmptyAsyncSendBenchmark();
- void emptyAsyncSendBenchmarkCallback(const CommonAPI::CallStatus&);
-
- CommonAPI::CallStatus doCopyAsyncSendBenchmark();
- void copyAsyncSendBenchmarkCallback(const CommonAPI::CallStatus&, const Ping::TestData&);
-
- CommonAPI::CallStatus doCopiesAsyncSendBenchmark();
- void copiesAsyncSendBenchmarkCallback(const CommonAPI::CallStatus&, const Ping::TestDataArray&);
-
-
- SendType sendType_;
- unsigned long sendCount_;
- unsigned long arraySize_;
- bool verbose_;
- bool async_;
-
- BenchmarkStats benchmarkStats_;
- std::shared_ptr<CommonAPI::tests::PingProxy<> > pingProxy_;
-
- PingProxyBase::GetEmptyResponseAsyncCallback getEmptyResponseAsyncCallback_;
- PingProxyBase::GetTestDataCopyAsyncCallback getTestDataCopyAsyncCallback_;
- PingProxyBase::GetTestDataArrayCopyAsyncCallback getTestDataArrayCopyAsyncCallback_;
-
- std::promise<CommonAPI::CallStatus> asyncPromise_;
-};
-
-} // namespace tests
-} // namespace CommonAPI
-
-#endif // COMMONAPI_TESTS_BENCHMARKING_STATS_H_
diff --git a/CommonAPI-Ping/src/BenchmarkStats.cpp b/CommonAPI-Ping/src/BenchmarkStats.cpp
deleted file mode 100644
index 769344b..0000000
--- a/CommonAPI-Ping/src/BenchmarkStats.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-#include <iostream>
-#include <iomanip>
-
-#include "BenchmarkStats.h"
-
-
-BenchmarkStats::BenchmarkStats(const char* envPrefix, unsigned long sendCountMax, bool verbose) :
- envPrefix_(envPrefix),
- sendCountMax_(sendCountMax),
- verbose_(verbose),
- started_(false),
- sendCount_(0),
- replyCount_(0) {
-}
-
-BenchmarkStats::~BenchmarkStats() {
- stopStatsThread();
-}
-
-void BenchmarkStats::reset() {
- stopStatsThread();
-
- sendCount_ = 0;
- replyCount_ = 0;
-
- totalStopWatch_.reset();
- creationStopWatch_.reset();
- transportStopWatch_.reset();
-
- if (verbose_)
- statsThread_ = std::thread(&BenchmarkStats::showProgress, this);
-
- totalStopWatch_.start();
- started_ = true;
-}
-
-void BenchmarkStats::stop() {
- const unsigned long totalCount = sendCount_ + replyCount_;
-
- stopStatsThread();
-
- totalStopWatch_.stop();
-
- std::cout << envPrefix_ << "_SENT=" << sendCount_ << ";\n"
- << envPrefix_ << "_RECEIVED=" << replyCount_ << ";\n"
- << envPrefix_ << "_TOTAL=" << totalCount << ";\n"
- << envPrefix_ << "_TIME=" << totalStopWatch_.getTotalElapsedMicroseconds() << ";\n"
- << envPrefix_ << "_TIME_SEC=" << totalStopWatch_.getTotalElapsedSeconds() << ";\n"
- << envPrefix_ << "_MSGS_PER_SEC=" << getMessagesPerSecondCount() << ";\n"
- << envPrefix_ << "_CREATION_TIME=" << creationStopWatch_.getTotalElapsedMicroseconds() << ";\n"
- << envPrefix_ << "_TRANSPORT_TIME=" << transportStopWatch_.getTotalElapsedMicroseconds() << ";\n";
- std::cout.flush();
-
- if (verbose_)
- std::cerr << std::left << std::setw(10) << "sent" << " "
- << std::setw(10) << "received" << " " << std::setw(10)
- << "totalCount" << " " << std::setw(12) << "time (sec)" << " "
- << std::setw(13) << "time (usec)" << " " << std::setw(16)
- << "msgs/sec (totalCount)" << " " << std::setw(15) << "creation time"
- << " transport time" << std::endl << std::setw(10)
- << sendCount_ << " " << std::setw(10) << replyCount_ << " "
- << std::setw(10) << totalCount << " " << std::setw(12)
- << totalStopWatch_.getTotalElapsedSeconds() << " " << std::setw(13)
- << totalStopWatch_.getTotalElapsedMicroseconds() << " " << std::setw(16)
- << getMessagesPerSecondCount() << " " << std::setw(15)
- << creationStopWatch_.getTotalElapsedMicroseconds() << " "
- << transportStopWatch_.getTotalElapsedMicroseconds() << std::endl;
-
-}
-
-unsigned long BenchmarkStats::getMessagesPerSecondCount() const {
- const long totalMessageCount = sendCount_ + replyCount_;
-
- if (totalMessageCount <= 0) {
- return 0;
- }
-
- auto totalElapsedMicroseconds = totalStopWatch_.getTotalElapsedMicroseconds();
- auto microsecondsPerMessage = totalElapsedMicroseconds / totalMessageCount;
-
- if (microsecondsPerMessage <= 0) {
- return totalMessageCount;
- }
-
- const auto microsecondsPerSecond = 1000000ULL;
-
- return microsecondsPerSecond / microsecondsPerMessage;
-}
-
-void BenchmarkStats::stopStatsThread() {
- if (started_ && verbose_) {
- started_ = false;
- statsThread_.join();
- }
-}
-
-void BenchmarkStats::showProgress() const {
- const std::chrono::milliseconds updateRate(500);
- int count = 0;
-
- while (started_) {
- if (count++ >= 10) {
- std::cerr << "Sent " << sendCount_ << " message"
- << (sendCount_ != 1 ? "s" : "") << " in "
- << totalStopWatch_.getTotalElapsedSeconds() << " seconds" << " ("
- << getMessagesPerSecondCount() << " msgs/sec" << ", "
- << ((100 * sendCount_) / sendCountMax_) << "% done)\n";
- count = 0;
- }
-
- std::this_thread::sleep_for(updateRate);
- }
-}
diff --git a/CommonAPI-Ping/src/BenchmarkStats.h b/CommonAPI-Ping/src/BenchmarkStats.h
deleted file mode 100644
index 8dde793..0000000
--- a/CommonAPI-Ping/src/BenchmarkStats.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-#ifndef BENCHMARKING_STATS_H_
-#define BENCHMARKING_STATS_H_
-
-#include <thread>
-#include <memory>
-
-#include "StopWatch.h"
-
-
-class BenchmarkStats {
- public:
- BenchmarkStats(const char* envPrefix, unsigned long sendCountMax, bool verbose);
-
- ~BenchmarkStats();
-
- void reset();
- void stop();
-
- inline void startCreation() {
- creationStopWatch_.start();
- }
-
- void stopCreation() {
- creationStopWatch_.stop();
- }
-
- void startTransport() {
- transportStopWatch_.start();
- }
- void stopTransport() {
- transportStopWatch_.stop();
- }
-
- inline void addSendReplyDelta(const long& sendDelta = 1, const long& replyDelta = 1) {
- sendCount_ += sendDelta;
- replyCount_ += replyDelta;
- }
-
- inline unsigned long getSendCount() const {
- return sendCount_;
- }
-
- unsigned long getMessagesPerSecondCount() const;
-
-private:
- void stopStatsThread();
- void showProgress() const;
-
- const char* envPrefix_;
- const long sendCountMax_;
- bool verbose_;
-
- volatile bool started_;
- std::thread statsThread_;
-
- unsigned long sendCount_;
- unsigned long replyCount_;
-
- StopWatch totalStopWatch_;
- StopWatch creationStopWatch_;
- StopWatch transportStopWatch_;
-};
-
-#endif // BENCHMARKING_STATS_H_
diff --git a/CommonAPI-Ping/src/Ping.fidl b/CommonAPI-Ping/src/Ping.fidl
deleted file mode 100644
index e7f35fa..0000000
--- a/CommonAPI-Ping/src/Ping.fidl
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-package CommonAPI.tests
-
-interface Ping {
- version { major 1 minor 0 }
-
- method getEmptyResponse {
- }
-
- method getTestDataCopy {
- in { TestData testData }
- out { TestData testDataCopy }
- }
-
- method getTestDataArrayCopy {
- in { TestDataArray testDataArray }
- out { TestDataArray testDataArrayCopy }
- }
-
- struct TestData {
- Int32 int32Value
- Double doubleValue1
- Double doubleValue2
- String stringValue
- }
-
- array TestDataArray of TestData
-}
-
diff --git a/CommonAPI-Ping/src/PingClient.cpp b/CommonAPI-Ping/src/PingClient.cpp
deleted file mode 100644
index eb6258e..0000000
--- a/CommonAPI-Ping/src/PingClient.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-#include <CommonAPI/tests/PingProxy.h>
-
-#include <iostream>
-#include <cstdlib>
-#include <climits>
-#include <getopt.h>
-
-#include "Benchmark.h"
-
-
-static bool verbose;
-static bool async;
-static int sendMethodType;
-static unsigned int sendCount;
-static unsigned int arraySize;
-
-static struct option longOptions[] = {
- { "help", no_argument, 0, 'h' },
- { "verbose", no_argument, 0, 'v' },
- { "async", no_argument, 0, 'A' },
- { "count", required_argument, 0, 'c' },
- { "empty", no_argument, &sendMethodType, CommonAPI::tests::Benchmark::SEND_TYPE_EMPTY },
- { "copy", no_argument, &sendMethodType, CommonAPI::tests::Benchmark::SEND_TYPE_COPY },
- { "copies", required_argument, &sendMethodType, CommonAPI::tests::Benchmark::SEND_TYPE_COPIES },
- { 0, 0, 0, 0 }
-};
-
-static void showUsage(char *programPath) {
- std::cout << "Usage: " << programPath << " OPTIONS\n"
- << " Generic options:"
- << " --verbose\n"
- << " --async Perform async (otherwise sync) remote method calls.\n"
- << " --count <number> Number of messages to send.\n"
- << " Send mode options:\n"
- << " --empty Send an empty message.\n"
- << " --copy Send a single copy of the last test struct.\n"
- << " --copies <size> Send a copy of the last arguments <size> array of test struct.\n"
- << " TestStruct contents:\n"
- << " int32_t int32Value (4 bytes)\n"
- << " double doubleValue1 (8 bytes)\n"
- << " double doubleValue2 (8 bytes)\n"
- << " string stringValue (20 chars)\n";
-}
-
-static bool parseCommandLineArguments(int argc, char **argv) {
- int ch;
- int optionIndex = 0;
-
- while ((ch = getopt_long(argc, argv, "Ahvc:", longOptions, &optionIndex)) != -1) {
- switch (ch) {
- case 0:
- // save the size parameter of the "copies" option
- if (longOptions[optionIndex].has_arg) {
- arraySize = strtoul(optarg, NULL, 10);
- if (sendCount == ULONG_MAX) {
- std::cerr << "Invalid size value: " << optarg << std::endl;
- return false;
- }
- }
- break;
-
- case 'c':
- sendCount = strtoul(optarg, NULL, 10);
- if (sendCount == ULONG_MAX) {
- std::cerr << "Invalid count value: " << optarg << std::endl;
- return false;
- }
- break;
-
- case 'A':
- async = true;
- break;
-
- case 'v':
- verbose = true;
- break;
-
- case 'h':
- showUsage(argv[0]);
- return false;
-
- case '?':
- return false;
- }
- }
-
- if (!sendCount) {
- std::cerr << "Missing send count argument! See --help\n";
- return false;
- }
-
- return true;
-}
-
-int main(int argc, char** argv) {
- if (!parseCommandLineArguments(argc, argv))
- return -1;
-
- const CommonAPI::tests::Benchmark::SendType benchmarkSendType = (CommonAPI::tests::Benchmark::SendType) sendMethodType;
- CommonAPI::tests::Benchmark benchmark(benchmarkSendType, sendCount, arraySize, verbose, async);
-
- if (!benchmark.run())
- return -1;
-
- return 0;
-}
diff --git a/CommonAPI-Ping/src/PingService.cpp b/CommonAPI-Ping/src/PingService.cpp
deleted file mode 100644
index 4e9415c..0000000
--- a/CommonAPI-Ping/src/PingService.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-#include <CommonAPI/Factory.h>
-#include <CommonAPI/tests/PingStubDefault.h>
-
-#include <iostream>
-#include <chrono>
-#include <thread>
-
-
-class PingStubBenchmark: public CommonAPI::tests::PingStubDefault {
- public:
- virtual void getTestDataCopy(CommonAPI::tests::Ping::TestData testData, CommonAPI::tests::Ping::TestData& testDataCopy) {
- testDataCopy = testData;
- }
-
- virtual void getTestDataArrayCopy(CommonAPI::tests::Ping::TestDataArray testDataArray, CommonAPI::tests::Ping::TestDataArray& testDataArrayCopy) {
- testDataArrayCopy = testDataArray;
- }
-};
-
-
-int main(void) {
- std::shared_ptr<CommonAPI::Factory> factory = CommonAPI::Runtime::load()->createFactory();
- std::string serviceAddress = "local:comommonapi.tests.PingService:commonapi.tests.Ping";
- auto pingStub = std::make_shared<PingStubBenchmark>();
-
- bool success = factory->registerService(pingStub, serviceAddress);
- if (!success) {
- std::cerr << "Unable to register service!\n";
- return -1;
- }
-
- std::chrono::seconds sleepDuration(5);
- while(true) {
- std::this_thread::sleep_for(sleepDuration);
- }
-
- return 0;
-}
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..5c901d4
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,34 @@
+= IPC CommonAPI Tools C++
+
+:doctitle: IPC CommonAPI Tools C++
+:version:
+
+== Copyright
+Copyright (C) 2015, Bayerische Motoren Werke Aktiengesellschaft (BMW AG).
+Copyright (C) 2015, GENIVI Alliance, Inc.
+
+This file is part of GENIVI Project IPC Common API C++.
+
+Contributions are licensed to the GENIVI Alliance under one or more Contribution License Agreements or MPL 2.0.
+
+== License
+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/.
+
+== Version
+{version}
+
+== CommonAPI C++ Specification and User Guide
+The specification document and the user guide can be found in the CommonAPI documentation directory of the CommonAPI-Tools project.
+
+== Further information
+Source code and latest news can be found at http://projects.genivi.org/commonapi/.
+
+== Build Instructions for Linux
+
+You can build all code generators by calling maven from the command-line. Open a console and change in the directory org.genivi.commonapi.core.releng of your CommonAPI-Tools directory. Then call:
+
+----
+mvn -Dtarget.id=org.genivi.commonapi.core.target clean verify
+----
+
+After the successful build you will find the commond-line generators archived in org.genivi.commonapi.core.cli.product/target/products/commonapi-generator.zip and the update-sites in org.genivi.commonapi.core.updatesite/target. \ No newline at end of file
diff --git a/CommonAPI-Ping/LICENSE b/LICENSE
index 14e2f77..14e2f77 100644
--- a/CommonAPI-Ping/LICENSE
+++ b/LICENSE
diff --git a/NEWS b/NEWS
index 47c8c9a..98a3316 100644
--- a/NEWS
+++ b/NEWS
@@ -1,19 +1,6 @@
+This is CommonAPI 3.1.1
-This is CommonAPI-Tools 2.1.6
-
-Changes since 2.1.5
-
-- modifying target platform and pom.xml to accomodate incompatible Franca versioning scheme
-- Improved description for maven build of update-site and commandline generator.
-- adding dbus.validator to category.xml
-- extend and restructure documentation with tutorial and specification
-- added O0 optimization flag to CMakeLists.txt.
-- added generation of code for disambiguation needed for attributes on inherited interfaces
-- adding maven xtend plugin for command line build
-- genallincl bug in cli fixed
-- removing obsolete plugins to shrink down size of generator
-- adapted Test "DBusCommunicationTest > RemoteMethodCallSucceeds" to verification test.
-- deleted the old validator, added a validator with general restrictions
-- new feature to generate proxies and stubs into seperate target directories
-- small changes to generate code that can be compiled warning free
-- generator now creates windows compatible code
+Changes since 2.1.6
+- Changes for CommonAPI 3 (see CommonAPI runtime)
+- Franca 0.9.1
+- Extended code generator options
diff --git a/README b/README
deleted file mode 100644
index ec196af..0000000
--- a/README
+++ /dev/null
@@ -1,138 +0,0 @@
-IPC CommonAPI C++ Tools
------------------------
-:Author: Juergen Gehring - juergen.gehring@bmw.de, Manfred Bathelt - manfred.bathelt@bmw.de
-:doctitle: IPC CommonAPI C++ Tools
-:version:
-
-Copyright
-+++++++++
-Copyright (C) 2014, BMW AG.
-Copyright (C) 2014, GENIVI Alliance, Inc.
-This file is part of GENIVI Project IPC Common API C++ Tools.
-
-Contributions are licensed to the GENIVI Alliance under one or more Contribution License Agreements or MPL 2.0.
-
-License
-+++++++
-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/.
-
-Version
-+++++++
-{version}
-
-Further information
-+++++++++++++++++++
-Source code and latest news can be found at http://projects.genivi.org/commonapi/.
-
-Common API Overview
-~~~~~~~~~~~~~~~~~~~
-
-Common API C++ and its mechanism specific bindings (e.g. Common API D-Bus) provide a set of libraries and tools to work with
-RPC communication in a way independent of which mechanism is used. It currently consists of four sub-projects:
-
-*CommonAPI* - This is the base C++ library, which provides the application interface for users and can load runtime bindings such as DBus.
-
-*CommonAPI-Tools* - The Eclipse based tools for CommonAPI. This is essentially the code generator for the generation of C++ code from Franca IDL.
-
-*CommonAPI-D-Bus* - This is the D-Bus binding C++ library, which provides the necessary code to communicate over D-Bus. This is invisible to the application code, and simply needs to be linked against.
-
-*CommonAPI-D-Bus-Tools* - The eclipse based tools for CommonAPI D-Bus. This is the code generator for Franca IDL to Common API D-Bus C++ code.
-
-Usage Instructions
-~~~~~~~~~~~~~~~~~~
-
-The simplest way to use the CommonAPI Tools is to add the update site available on the GENIVI project servers to your Eclipse. This is available under:
-
-Help->Install New Software->Add Button
-
-Enter the following URL: http://docs.projects.genivi.org/yamaica-update-site/CommonAPI/updatesite/ and confirm.
-
-This provides CommonAPI, CommonAPI-D-Bus and all dependencies.
-
-Then select the newly added site in the site selection dropdown box, and in the Software selection window, select the entire "GENIVI Common API" Tree.
-
-After the software has been installed in Eclipse you can right-click on any .fidl file and generate C++ code for CommonAPI by selecting the "CommonAPI->Generate Common API Code" option.
-
-Build Instructions
-~~~~~~~~~~~~~~~~~~
-
-These are Eclipse Plug-In projects which require Xtext2 and Franca as dependencies within Eclipse.
-
-An automated build process via Maven for the update-site and the command line interface is provided.
-
-As a first step to build the update-site and the commandline generator, make sure that everything is configured correctly, i.e. the dependencies between CommonAPI-D-Bus and CommonAPI itself are set correctly (see the dependencies tab in the MANIFEST.MF file of org.genivi.commonapi.dbus and accordingly in org.genivi.commonapi.dbus.ui). If you don't want to build the CommonAPI-D-Bus-Tools components, you have to adjust the update-site category.xml and the "modules" section in the pom.xml of the org.genivi.commonapi.parent.releng accordingly.
-
-To build, change into the org.genivi.commonapi.parent.releng directory and run:
-
-----
-mvn tycho-versions:set-version -DnewVersion=<version-you-want-to-set>-SNAPSHOT
-----
-
-e.g. mvn tycho-versions:set-version -DnewVersion=2.1.4-SNAPSHOT. If the version is already set correctly you can skip this step.
-
-Next, to build the updatesite and the commandline generator, adjust your category.xml in the org.genivi.commonapi.updatesite project to the new version and run
-
-----
-mvn clean verify
-----
-
-in the org.genivi.commonapi.parent.releng directory. Now every project will be built and the update site will be created in org.genivi.commonapi.updatesite/target/repository/.
-
-If no configuration files are changed, the features
-
-----
-org.genivi.commonapi.core
-org.genivi.commonapi.validator
-org.genivi.commonapi.dbus
-org.genivi.commonapi.dbus.validator
-----
-
-will be included in the updatesite.
-
-The command line interface will be built for different platforms, with zip-files as generated output. These zip-files can be found in org.genivi.commonapi.cli.product/target/products/.
-
-An osgi based application will be contained in the zip-files. This application should be called as:
-
-----
-commonapi_generator [options] file [file...]
- Valid Options are:
- -dbus -> to generate files with the FrancaDBUSGenerator
- -dest path/to/output/folder -> the generated files will be saved at this Location
- -pref path/to/header/file -> here you can set the text which will be placed as a comment
- on each generated file (for example your license)
-----
-
-Working on the code & contribution
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-- First get the code from the git:
-----
-git clone
-----
-
-- Get an overview of all branches:
-----
-git branch
-----
-
-- Switch to the branch you want to work on (master is the feature branch) and verify that it has switched (* changed)
-----
-git checkout <your branch>
-git branch
-----
-
-- Best practice is to create a local branch based on the current branch:
-----
-git branch working_branch
-----
-
-Start working, best practice is to commit smaller, compilable pieces during the development process that makes it easier to handle later on.
-
-- If you want to commit you changes, send them to the author, you can create a patch like this:
-----
-git format-patch working_branch <your branch>
-----
-
-This creates a set of patches that are published via the mailing list. The patches will be discussed and then merged & uploaded on the git by the maintainer.
-
-Patches can be accepted under MPL 2.0 (see section License). Please be sure that the signed-off-by is set correctly. For more, check out http://gerrit.googlecode.com/svn/documentation/2.0/user-signedoffby.html
diff --git a/docx/.cproject b/docx/.cproject
new file mode 100644
index 0000000..be87c94
--- /dev/null
+++ b/docx/.cproject
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="cdt.managedbuild.toolchain.gnu.base.1362593216">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.1362593216" moduleId="org.eclipse.cdt.core.settings" name="Default">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration buildProperties="" id="cdt.managedbuild.toolchain.gnu.base.1362593216" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="cdt.managedbuild.toolchain.gnu.base.1362593216.1210670377" name="/" resourcePath="">
+ <toolChain id="cdt.managedbuild.toolchain.gnu.base.874034943" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
+ <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.1113200418" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
+ <builder id="cdt.managedbuild.target.gnu.builder.base.1580959973" managedBuildOn="false" name="Gnu Make Builder.Default" superClass="cdt.managedbuild.target.gnu.builder.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.archiver.base.1985631181" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.1961734241" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.c.compiler.base.535582809" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.c.linker.base.1092334049" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.166170882" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.assembler.base.1746311217" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base"/>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="docx.null.190719193" name="docx"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+</cproject>
diff --git a/docx/.gitignore b/docx/.gitignore
new file mode 100644
index 0000000..b25c15b
--- /dev/null
+++ b/docx/.gitignore
@@ -0,0 +1 @@
+*~
diff --git a/docx/.project b/docx/.project
new file mode 100644
index 0000000..ec982fc
--- /dev/null
+++ b/docx/.project
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>docx</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/docx/CommonAPICppSpecification b/docx/CommonAPICppSpecification
new file mode 100644
index 0000000..186d3e0
--- /dev/null
+++ b/docx/CommonAPICppSpecification
@@ -0,0 +1,1152 @@
+= CommonAPI C++ Specification
+
+:doctitle: CommonAPI C++ Specification
+:website: http://projects.genivi.org/commonapi/
+:version:
+:toc:
+:revdate:
+:imagedir:
+:cppstr: c++
+
+This is the specification for *Common API {version}* released at {revdate}.
+
+.Copyright and License
+*******************************************************************************
+Copyright (C) 2015, BMW AG
+Copyright (C) 2015, GENIVI Alliance, Inc.
+
+This file is part of the GENIVI IPC Common API C++ project.
+
+Contributions are licensed to the GENIVI Alliance under one or more
+Contribution License Agreements or MPL 2.0.
+*******************************************************************************
+
+IPC Common API is a C++ abstraction framework for *Interprocess Communication* (IPC). It is supposed to be neutral to IPC implementations and therefore can be used with any kind of IPC mechanism if a middleware specific _IPC Common API binding_ is provided.
+
+IPC Common API allows applications (i.e., clients and servers using C++) developed against IPC Common API to be linked with different IPC Common API _backends_ without any changes to the application code. Thus, components which have been developed for a system which uses specific IPC X could be deployed for another system which uses IPC Y easily - just by exchanging the IPC Common API backend without recompiling the application code.
+
+The actual interface definitions will be created using http://code.google.com/a/eclipselabs.org/p/franca/[Franca IDL], which is the Common IDL solution favored by http://www.genivi.org/[GENIVI].
+
+IPC Common API is not restricted to GENIVI members (see https://www.genivi.org/sites/default/files/genivi_public_newsletter_October_2013_liquid.html#LIC[public GENIVI licensing policy]). It is available as open source code, which is split into runtime code for the target system and code generation tooling (see http://projects.genivi.org/) to be used on development systems.
+
+== General Design
+
+=== Basic Assumptions
+
+- The applications use the client-server communication paradigm.
+- The C++ API is based on the common interface description language Franca IDL which provides the possibility to specify interfaces independent from the platform, middleware or programming language. That means that the application specific part of the API is generated via a code generator from a Franca IDL specification file (see figure 1).
+- CommonAPI specifies only an API and not an concrete IPC mechanism. It can only be used with a language binding that has to be developed for a special middleware.
+- In principle, the CommonAPI should be platform independent. However, this is without any restrictions very difficult to realize. Therefore it is agreed that CommonAPI attempts to use only features supported from the gnu C++ compiler version \<= 4.4.2. Please find supported ((compiler)) and compiler versions in the NEWS file of the CommonAPI distribution.
+
+.Code Generation from Franca IDL
+image::{imagedir}/CodeGenerationFrancaIDL.png[Code Generation image]
+
+=== Deployment
+
+One problem with definition of a middleware-independent C++ API is that depending on the middleware different configuration parameters for parts of the API could be necessary. Examples:
+
+- QoS parameter
+- Maximum length of arrays or strings
+- Endianness of data
+- Priorities
+
+The Franca IDL offers the possibility to specify these kind of parameters which depend on the used middleware in a middleware-specific or platform-specific deployment model (*.depl file). The deployment parameters can be specified arbitrarily.
+
+But as indicated above it is an explicit goal that an application written against CommonAPI can be linked against different CommonAPI IPC backends without any changes to the application code. This goal brings an important implicit restriction:
+
+[NOTE]
+The interface defined in Franca IDL is the only information that should be used to generate the CommonAPI headers that define the implementation API. Deployment models that are specific to the IPC backend must not affect the generated API. But a non specific deployment model is allowed.
+
+.Deployment Concept
+image::{imagedir}/Deployment.png[Deployment image]
+
+=== Basic Parts of CommonAPI
+
+CommonAPI can be divided up into two parts:
+
+- The first part (Franca based part, generated by the CommonAPI code generator) refers to the variable (generated) part of the logical interface. That is the part of the interface which depends on the specifications in the Franca IDL file (data types, arrays, enumerations and interface basics as attributes, methods, callbacks, error handling, broadcast).
+- The second fixed part (CommonAPI Runtime features) which is mainly independent from the interface specifications. It refers to the CommonAPI library functions as service discovery, connect/disconnect, and address handling which relate primarily to the runtime environment provided by the underlying middleware. Furthermore this part contains common type definitions and base classes.
+
+== Franca based part
+
+=== Namespaces
+
+The *namespace* of the CommonAPI base functions is CommonAPI; the _namespace_ of a CommonAPI application depends on the the qualified package name of the interface specification and of the interface version.
+
+[cols="<50%asciidoc,<50%asciidoc",frame="none",grid="none"]
+|====
+|[source,java]
+.FrancaIDL
+----
+package example.user
+
+interface Test {
+ version { major 1 minor 0 }
+
+}
+----
+|[source,{cppstr}]
+.CommonAPI C++
+----
+namespace v1_0 {
+namespace example {
+namespace user {
+
+}
+}
+}
+----
+|====
+
+If the interface has no version the version dependent part in the C++ namespace is omitted.
+
+=== Data Types
+
+==== Primitive Types
+
+The integer data types used by Common API are defined in +stdint.h+.
+
+.Mapping Of Franca Primitive Types With CommonAPI C++ Types
+[width="100%",cols="3,5,8",options="header"]
+|=========================================================
+|Franca Type Name |CommonAPI C++ Type |Notes
+
+|+UInt8+ |+uint8_t+ |
+unsigned 8-bit integer (range 0..255).
+
+|+Int8+ |+int8_t+ |
+signed 8-bit integer (range -128..127).
+
+|+UInt16+ |+uint16_t+ |
+unsigned 16-bit integer (range 0..65535).
+
+|+Int16+ |+int16_t+ |
+signed 16-bit integer (range -32768..32767).
+
+|+UInt32+ |+uint32_t+ |
+unsigned 32-bit integer (range 0..4294967295).
+
+|+Int32+ |+int32_t+ |
+signed 32-bit integer (range -2147483648..2147483647).
+
+|+UInt64+ |+uint64_t+ |
+unsigned 64-bit integer.
+
+|+Int64+ |+int64_t+ |
+signed 64-bit integer.
+
+|+Boolean+ |+bool+ |
+boolean value, which can take one of two values: false or true.
+
+|+Float+ |+float+ |
+floating point number (4 bytes, range +/- 3.4e +/- 38, ~7 digits).
+
+|+Double+ |+double+ |
+double precision floating point number (8 bytes, range +/- 1.7e +/- 308, ~15 digits).
+
+|+String+ |+std::string+ |
+character string.
+
+|+ByteBuffer+ |+std::vector<uint8_t>+ |
+buffer of bytes (aka BLOB).
+|=========================================================
+
+Franca has only one string data type, and if necessary the wire format / ((encoding)) can be specified via deployment model. The proxies always expect and deliver *UTF-8*.
+
+==== Arrays
+
+Franca ((array)) types (in explicit and implicit notation) are mapped to +std::vector<T>+. While explicitly defined array types will be made available as typedef with the name as it was given in Franca IDL, the implicit version will just be generated as +std::vector<T>+ wherever needed.
+
+==== Structures
+
+Franca +struct+ types are mapped to C++ +struct+ types. Example:
+
+.FrancaIDL
+[source,java]
+----
+struct TestStruct {
+ UInt16 uintValue
+ String stringValue
+}
+----
+
+.CommonAPI C++
+[source,{cppstr}]
+----
+struct TestStruct : CommonAPI::Struct<uint16_t, std::string> {
+
+ TestStruct() {
+ }
+ TestStruct(const uint16_t &_uintValue, const std::string &_stringValue) {
+ std::get\<0>(values_) = _uintValue;
+ std::get\<1>(values_) = _stringValue;
+ }
+
+ inline const uint16_t &getUintValue() const { return std::get\<0>(values_); }
+ inline void setUintValue(const uint16_t &_value) { std::get\<0>(values_) = _value; }
+ inline const std::string &getStringValue() const { return std::get\<1>(values_); }
+ inline void setStringValue(const std::string &_value) { std::get\<1>(values_) = _value; }
+ bool operator==(const TestStruct &_other) const;
+ inline bool operator!=(const TestStruct &_other) const {
+ return !((*this) == _other);
+ }
+
+};
+----
+
+Structures are mapped to a (generated) +struct+ which inherits from +CommonAPI::Struct+. +CommonAPI::Struct+ holds the structured data in a tuple. The generated class provides getter- and setter-methods for the structure members.
+
+CommonAPI +Struct+ base class (_Struct.hpp_):
+
+.CommonAPI C++
+[source,{cppstr}]
+----
+template<typename... _Types>
+struct Struct {
+ std::tuple<_Types...> values_;
+};
+----
+
+One problem is the possibility to inherit structures in Franca IDL. This feature is implemented by the code generator which generates the struct members of the base type into the extended type.
+
+*Polymorphic* structs are mapped to an interface that is derived from the base class +PolymorphicStruct+ and contain their parameter in a +struct+.
+
+.CommonAPI C++
+[source,{cppstr}]
+----
+struct PolymorphicStruct {
+ virtual const Serial getSerial() const = 0;
+};
+----
+
+==== Enumerations
+
+Franca ((enumerations)) will be mapped to C++ structs which inherit from the base class +CommonAPI::Enumeration+. The Enum backing datatype and wire format by default is +uint32_t+. If needed, the wire format can be specified by a CommonAPI deployment file (enumeration backing type).
+
+Example:
+
+.FrancaIDL
+[source,java]
+----
+enumeration MyEnum {
+ E_UNKNOWN = "0x00"
+}
+
+enumeration MyEnumExtended extends MyEnum {
+ E_NEW = "0x01"
+}
+----
+
+.CommonAPI C++
+[source,{cppstr}]
+----
+struct MyEnum : CommonAPI::Enumeration<int32_t> {
+ MyEnum() = default;
+ MyEnum(const int32_t &_value)
+ : CommonAPI::Enumeration<int32_t>(_value) {}
+ static const int32_t E_UNKNOWN = 0;
+};
+
+struct MyEnumExtended : MyEnum {
+ MyEnumExtended() = default;
+ MyEnumExtended(const int32_t &_value)
+ : MyEnum(_value) {}
+ static const int32_t E_NEW = 1;
+};
+----
+
+[NOTE]
+In earlier versions of ComonAPI Franca enumerations were mapped to strongly typed C++11 enums. This was changed because CommonAPI needs for the new serialization/deserialization concept the possibility to cast CommonAPI enumerations implicitely to its base types.
+
+The neumeration base class looks like:
+
+.CommonAPI C++
+[source,{cppstr}]
+----
+template <typename _Base>
+struct Enumeration {
+
+ Enumeration() = default;
+ Enumeration(const _Base &_value)
+ : value_(_value) {
+ }
+
+ inline Enumeration &operator=(const _Base &_value) {
+ value_ = _value;
+ return (*this);
+ }
+ inline operator const _Base() const {
+ return value_;
+ }
+ inline bool operator == (const Enumeration<_Base> &_other) const {
+ return value_ == _other.value_;
+ }
+ inline bool operator != (const Enumeration<_Base> &_other) const {
+ return value_ != _other.value_;
+ }
+
+ __Base value__;
+};
+----
+
+==== Maps
+
+For efficiency reasons the CommonAPI data type for Franca ((maps)) is +std::unordered_map<K,V>+.
+
+[cols="<30%asciidoc,<70%asciidoc",frame="none",grid="none"]
+|====
+|[source,java]
+.FrancaIDL
+----
+map MyMap {
+ UInt32 to String
+}
+----
+|[source,{cppstr}]
+.CommonAPI C++
+----
+typedef std::unordered_map<uint32_t, std::string> MyMap;
+----
+|====
+
+==== Unions
+
+Franca ((union)) types are implemented as a typedef of CommonAPI generic templated C++ variant class.
+
+[cols="<40%asciidoc,<60%asciidoc",frame="none",grid="none"]
+|====
+|[source,java]
+.FrancaIDL
+----
+union MyUnion {
+ UInt32 MyUInt
+ String MyString
+}
+----
+|[source,{cppstr}]
+.CommonAPI C++
+----
+typedef Variant<uint32_t, std::string> MyUnion;
+----
+|====
+
+This uses a variadic template to define the possible options, and implements operators in the expected fashion.
+
+Assignment works by constructor or assignment operator:
+
+[source,{cppstr}]
+----
+MyUnion union = 5;
+MyUnion stringUnion("my String");
+----
+
+Getting the contained value is done via a get method templated to the type desired for type safety. This results in a compile error if an impossible type is attempted to be fetched. In case of fetching a type which can be contained but is not an exception is thrown. The choice of an exception at this point is made for the following reasons:
+
+- Returning pointers is inconvenient, especially in case of primitives.
+- Returning a temporary reference in case of failure is dangerous due to potential for segmentation faults in case of accidental use.
+- Returning a null heap object will be a memory leak if not deleted by the user.
+
+[source,{cppstr}]
+----
+MyUnion union = 5;
+int a = union.get<uint32_t>(); //Works!
+std::string b = union.get<std::string>(); //Throws exception
+----
+
+Also available is an templated isType method to test for the contained type:
+
+[source,{cppstr}]
+----
+MyUnion union = 5;
+bool contained = union.isType<uint32_t>(); //True!
+contained = union.isType<std::string>(); //False!
+----
+
+[NOTE]
+To enable comparisons between variants in an inheritance hierarchy comparators have to be generated for the C\++ types, as C++ as all ((variants)) are instances of the same generic class.
+
+==== Type Aliases
+
+Franca typedefs are mapped to C++ +typedef+.
+
+==== Type Collections
+
+In Franca a set of user-defined types can be defined as _type collection_. The name of the type collection, referred to as _typecollectionname_, can be empty. CommonAPI uses for empty type collection the default name __Anonymous__.
+
+The CommonAPI code generator generates the header file __Anonymous__.hpp and creates a C++ +struct+ for the type collection.
+
+[source,java]
+.FrancaIDL
+----
+package example.user
+
+typeCollection {
+ typedef a is Int16
+}
+----
+
+[source,{cppstr}]
+.CommonAPI C++
+----
+namespace example {
+namespace user {
+
+struct __Anonymous__ {
+ typedef int16_t a;
+
+ static inline const char* getTypeCollectionName() {
+ static const char* typeCollectionName = "example.user.__Anonymous__";
+ return typeCollectionName;
+ }
+}; // struct __Anonymous__
+
+} // namespace user
+} // namespace example
+----
+
+[NOTE]
+In the internal Franca model type collections are a base class of interfaces. Type collections also can have a version. In this case the namespace is exented like a generated version name (e.g. +v1_0+). The example does not contain any version, therefore the generated namespace only contains the package names.
+
+=== Interfaces
+
+==== Basics
+
+For the Franca interface name, referred to as _interfacename_, a class +interfacename+ is generated which provides the methods +getInterfaceName+ and +getInterfaceVersion+. The ((version)) is mapped to a struct +CommonAPI::Version+.
+
+[source,java]
+.FrancaIDL
+----
+package commonapi.examples
+
+interface ExampleInterface {
+ version { major 1 minor 0 }
+}
+----
+
+[source,{cppstr}]
+.CommonAPI C++
+----
+namespace v1_0 {
+namespace commonapi {
+namespace examples {
+
+class ExampleInterface {
+public:
+ virtual ~ExampleInterface() { }
+
+ static inline const char* getInterface();
+ static inline CommonAPI::Version getInterfaceVersion();
+};
+
+const char* ExampleInterface::getInterface() {
+ return ("commonapi.examples.ExampleInterface");
+}
+
+CommonAPI::Version ExampleInterface::getInterfaceVersion() {
+ return CommonAPI::Version(1, 0);
+}
+
+
+} // namespace examples
+} // namespace commonapi
+} // namespace v1_0
+----
+
+The specification of the version structure is part of the namespace CommonAPI:
+[source,{cppstr}]
+----
+namespace CommonAPI {
+
+struct Version {
+ Version() = default;
+ Version(const uint32_t &majorValue, const uint32_t &minorValue)
+ : Major(majorValue), Minor(minorValue) {
+ }
+
+ uint32_t Major;
+ uint32_t Minor;
+};
+
+} // namespace CommonAPI
+----
+
+As described above it is a basic assumption that the applications use the client-server communication paradigm. That means that the CommonAPI code generator generates stub code for the server implementation and proxy code for the client implementation.
+
+At least the following files are generated:
+
+.Generated files of the CommmonAPI code generator for the example interface +ExampleInterface+
+[width="100%",cols="1,1"]
+|=========================================================
+|ExampleInterface.hpp | Common header file for client and service
+
+|ExampleInterfaceProxy.hpp | proxy class
+
+|ExampleInterfaceProxyBase.hpp | base class for proxy
+
+|ExampleInterfaceStub.hpp | stub
+
+|=========================================================
+
+The following picture shows the relationships between the proxy classes.
+
+.Proxy Classes
+image::{imagedir}/Diag_GeneratedProxy.png[Proxy image]
+
+On stub side it looks like this.
+
+.Stub Classes
+image::{imagedir}/Diag_GeneratedStub.png[Stub image]
+
+==== Methods
+
+Franca IDL supports the definition of ((methods)) and ((broadcasts)). Methods can have several in and out parameters; if an additional flag ((fireAndForget)) is specified, no out parameters are permitted. Broadcasts can have only out parameters. Methods without the +fireAndForget+ flag can return an error which can be specified in Franca IDL as an enumeration. For broadcasts an additional flag +selective+ can be defined. This flag indicates that the message should not be sent to all registered participants but that the service makes a selection.
+
+[NOTE]
+- In Franca IDL there is no difference between an asynchronous or synchronous call of methods; the CommonAPI will provide both. The user of the API can decide which variant he calls.
+- The CommonAPI does not provide the possibility to cancel asynchronous calls.
+
+For methods without the +fireAndForget+ flag an additional return value ((CallStatus)) is provided which is defined as enumeration:
+
+[source,{cppstr}]
+----
+enum class CallStatus {
+ SUCCESS,
+ OUT_OF_MEMORY,
+ NOT_AVAILABLE,
+ CONNECTION_FAILED,
+ REMOTE_ERROR,
+ UNKNOWN
+};
+----
+
+The +CallStatus+ defines the transport layer result of the call, i.e. it returns:
+
+- SUCCESS, if the remote call returned successfully.
+- OUT_OF_MEMORY, if sending the call or receiving the reply could not be completed due of a lack of memory.
+- NOT_AVAILABLE, if the corresponding service for the remote method call is not available.
+- CONNECTION_FAILED, if there is no connection to the communication medium available.
+- REMOTE_ERROR, if the sent remote call does not return (in time). *NOT* considered to be a remote error is an application level error that is defined in the corresponding Franca interface, because from the point of view of the transport layer the service still returned a valid answer. It is considered to be a remote error if no answer for a sent remote method call is returned within a defined time. It is discouraged to allow the sending of any method calls without a defined timeout. The timeout can be configured by passing an optional parameter +CallInfo+ to the method call or by the CommonAPI deployment.
+
+[source,{cppstr}]
+----
+struct CallInfo {
+ CallInfo()
+ : timeout_(DEFAULT_SEND_TIMEOUT_MS), sender_(0) {
+ }
+ CallInfo(Timeout_t _timeout)
+ : timeout_(_timeout), sender_(0) {
+ }
+
+ Timeout_t timeout_;
+ Sender_t sender_;
+};
+----
+
+The structure timeout contains an additional member +sender_+ which can be used to identify the caller of this function. The exact usage is binding specific.
+
+For the return parameters a function object is created which is passed to the asynchronous method call. This function object can then be used directly in the client application as function pointer to a callback function or be bound to a function with a different signature. The usage of +std::bind+ is not enforced but must be possible. The bound callback function object will be called in any case:
+
+- If the call returns successfully: Once the remote method call successfully returns, the callback function object is called with SUCCESS for its CallStatus and any received parameters.
+- If a transport layer error occurs: If an error occurs that would trigger the method to return anything other but SUCCESS for its CallStatus, the callback has to be called with the corresponding CallStatus value. All other values that are input to the callback may remain unitialized in this case.
+
+The asynchronous call returns the CallStatus as ((future)) object. This allows the synchronization of asynchronous calls to a defined time. The future object will attain its value at the same time at which the callback function object is called.
+
+The following example shows the signatures of the generated functions. First, the Franca IDL example:
+
+[source,java]
+----
+package commonapi.examples
+
+interface ExampleInterface {
+
+ version { major 1 minor 0 }
+
+ method getProperty {
+ in {
+ UInt32 ID
+ }
+ out {
+ String Property
+ }
+ error {
+ OK
+ NOT_OK
+ }
+ }
+
+ method newMessage fireAndForget {
+ in {
+ String MessageName
+ }
+ }
+
+ broadcast signalChanged {
+ out {
+ UInt32 NewValue
+ }
+ }
+
+ broadcast signalSpecial selective {
+ out {
+ UInt32 MyValue
+ }
+ }
+}
+----
+
+See the generated function calls for the methods _getProperty_ and _newMessage_ on *proxy side*:
+
+[source,{cppstr}]
+----
+/* Calls getProperty with synchronous semantics. */
+virtual void getProperty(
+ const uint32_t &_ID,
+ CommonAPI::CallStatus &_status,
+ ExampleInterface::getPropertyError &_error,
+ std::string &_Property,
+ const CommonAPI::CallInfo *_info = nullptr);
+
+
+/* Calls getProperty with asynchronous semantics. */
+virtual std::future<CommonAPI::CallStatus> getPropertyAsync(
+ const uint32_t &_ID,
+ GetPropertyAsyncCallback _callback,
+ const CommonAPI::CallInfo *_info = nullptr);
+
+/* Calls newMessage with Fire&Forget semantics. */
+virtual void newMessage(const std::string &_MessageName, CommonAPI::CallStatus &_status);
+----
+
+- All const parameters are input parameters.
+- All non-const parameters will be filled with the returned values.
+- The CallStatus will be filled when the methods return and indicate either +SUCCESS+ or which type of error has occurred. In case of an error, *ONLY* the CallStatus will be set.
+- The provided callback of the asynchronous call will be called when the reply to this call arrives or an error occurs during the call. The +std::future+ returned by this method will be fulfilled at arrival of the reply. It will provide the same value for CallStatus as will be handed to the callback.
+
+On *stub side* the generated functions are part of the generated stub (+ExampleInterfaceStub.hpp+):
+
+[source,{cppstr}]
+----
+/* This is the method that will be called on remote calls on the method getProperty.*/
+virtual void getProperty(
+ const std::shared_ptr<CommonAPI::ClientId> _client,
+ uint32_t _ID,
+ getPropertyReply_t _reply) = 0;
+
+/* This is the method that will be called on remote calls on the method newMessage.*/
+virtual void newMessage(
+ const std::shared_ptr<CommonAPI::ClientId> _client,
+ std::string _MessageName) = 0;
+----
+
+These functions are pure virtual; that means that an implementation must be provided. A skeleton for this implementation can be generated by the code generator. The return values of the function call are wrapped into a function object:
+
+[source,{cppstr}]
+----
+typedef std::function<void (ExampleInterface::getPropertyError _error, std::string _Property)> getPropertyReply_t;
+----
+
+This allows it to pass this object to other functions in order to implement an asynchronous behavior on stub side.
+
+On stub side the additional parameter of type _ClientId_ is passed. The _ClientId_ identifies a client sending a call to a stub. It is used to identify the caller within a stub and is supposed to be added by the middleware and can be compared using the == operator. The ClientId class is declared as:
+
+[source,{cppstr}]
+----
+class ClientId {
+public:
+ virtual ~ClientId() { }
+ virtual bool operator==(ClientId& clientIdToCompare) = 0;
+ virtual std::size_t hashCode() = 0;
+};
+----
+
+The pure virtual methods operator==() and hascode() have to be implemented by the middleware specific binding. Note that the value of the ClientId itself is irrelevant for CommonAPI. As API only the comparison operator is offered; the middleware specific identifier could be of any size as long as it is unique. The method +hascode()+ is there so that the +ClientId+ can be used as key in a hashmap.
+
+If we now consider the broadcast methods the generated functions on *proxy side* are:
+
+[source,{cppstr}]
+----
+virtual SignalChangedEvent& getSignalChangedEvent() {
+ return delegate_->getSignalChangedEvent();
+}
+
+virtual SignalSpecialSelectiveEvent& getSignalSpecialSelectiveEvent() {
+ return delegate_->getSignalSpecialSelectiveEvent();
+}
+----
+
+These methods return a wrapper class for an event that provides access to the broadcast +signalChanged+ (see below in this specification the CommonAPI definition of events). The wrapper class provides the methods subscribe and unsubscribe. The private property +delegate_+ is used for forwarding the function call to the specific binding.
+
+The generated stub provides methods to fire the broadcasts and some hooks:
+
+[source,{cppstr}]
+----
+virtual void fireSignalChangedEvent(const uint32_t &_NewValue) = 0;
+
+virtual void fireSignalSpecialSelective(
+ const uint32_t &_MyValue,
+ const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr) = 0;
+
+/* retreives the list of all subscribed clients for signalSpecial */
+virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForSignalSpecialSelective() = 0;
+
+/* Hook method for reacting on new subscriptions or
+ removed subscriptions respectively for selective broadcasts.*/
+virtual void onSignalSpecialSelectiveSubscriptionChanged(
+ const std::shared_ptr<CommonAPI::ClientId> _client,
+ const CommonAPI::SelectiveBroadcastSubscriptionEvent _event) = 0;
+
+/* Hook method for reacting accepting or denying new subscriptions */
+virtual bool onSignalSpecialSelectiveSubscriptionRequested(
+ const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
+----
+
+Note that the Franca keyword _selective_ is implemented only on stub side by using the _ClientId_ and the provided hooks.
+
+[NOTE]
+The _ClientId_ can be generated only on the stub side due to middleware specific data that can be composed entirely arbitrary.
+
+==== Attributes
+
+An attribute of an interface is defined by name and type. Additionally the specification of an attribute can have two flags:
+
+- +noSubscriptions+
+- +readonly+
+
+CommonAPI provides a basic implementation of the attribute interface and a mechanism for so-called ((extensions)). The basic implementation is shown in the example below. There are four possible combinations of flags:
+
+- standard attributes with no additional flag.
+- readonly attributes (readonly flag is set).
+- non observable attributes (noSubscription flag).
+- and non observable and non writable attributes (both flags are set).
+
+Attributes which are non readable but only writable are not supported by Franca IDL and CommonAPI.
+
+Template classes for each of those four types of attributes are defined in the header file Attribute.h. The CommonAPI provides a getter function which returns a reference to an instance of the appropriate attribute template class.
+
+.Attributes
+image::{imagedir}/Diag_Attributes.png[Attribute image]
+
+Observable attributes provide a ChangedEvent which can be used to subscribe to updates to the attribute. This Event works exactly as all other events (see description below). By default, the attributes are not cached in client side. Creating a cache on client side is not an implementation-specific detail that should be a part of the logical interface specification, nor is it a platform- or middleware-dependent parameter. Moreover, the requirements for an attribute cache can be very different depending on the application specific use case. Differences in points of view include, but are not limited to:
+
+- Is the cache value to be updated on any value changed event or is it to be updated periodically?
+- Should calls to getters of potentially cached values be blocking or non-blocking?
+- Should caching be configurable per attribute or per proxy, or should caching always be enabled?
+- Is getting a cached value a distinct method call or is it to be included transparently within the standard getter methods?
+
+Because of this, there is a general scheme to include individual extensions in order to provide any additional features for attributes (Attribute Extensions). This would prevent an exponential growth of configuration possibilities within the Common API and also relieve Common API developers from the necessity to always implement all specified features for their specific middleware, regardless of whether the feature is supported by the middleware or not. On the other hand, it gives complete freedom to application developers to add an implementation for their specific needs to attribute handling.
+
+The basic principle is that the user of the API has to implement an extension class that is derived from the base class +AttributeExtension+. The +AttributeExtension+ is packed in a wrapper class which in turn is generated for each attribute the Proxy has. A wrapper for a given attribute only then is mixed into the proxy if an extension for this given attribute is defined during construction time. The wrapper forwards the correct attribute to the constructor of the extension, so that the extension sees nothing but the attribute it should extend. Wrappers are written as templates, so that all wrappers can be reused for all attributes of the same category. As soon as an extension for an attribute is defined during construction time, the extension class will be instantiated and a method to retrieve the extended attribute will be added to the proxy.
+
+Such an solution requires the proxy to be made ready for mixins. The proxy inherits from all mixins that are defined during construction time, so that their interface is added directly to the proxy itself. The interface that would be added to the proxies in our case would be the interface of the defined attribute extension wrappers, which in turn provide access to the actual attribute extensions. By using variadic templates the amount of possible mixins is arbitrary.
+
+[NOTE]
+Because a given proxy may not inherit from the same class twice, only one extension per attribute per proxy is possible.
+
+The base class for extensions is defined in +AttributeExtension.hpp+.
+
+The CommonAPI for attributes on *stub side* looks like this when we only consider the attribute +A+:
+
+[source,{cppstr}]
+----
+class ExampleInterfaceStub
+ : public virtual CommonAPI::Stub<ExampleInterfaceStubAdapter, ExampleInterfaceStubRemoteEvent> {
+public:
+
+ // Other code here
+
+ /* Provides getter access to the attribute a */
+ virtual const uint32_t &getAAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
+
+ // Other code here
+};
+----
+
+The attribue +a+ is stored in the default implementation of the stub class as private member. The get function has to be implemented by the application, e.g.:
+
+[source,{cppstr}]
+----
+const uint32_t& ExampleInterfaceStubImpl::getAAttribute() {
+ return aAttributeValue_;
+}
+----
+
+Furthermore CommonAPI defines the necessary callbacks to handle remote set events related to the attributes defined in the IDL description for ExampleInterface. For each attribute two callbacks are defined in the class ExampleInterfaceStubRemoteEvent:
+
+- a verification callback that allows to verify the requested value and to prevent setting, e.g. an invalid value ("onRemoteSet<AttributeName>").
+ - an action callback to do local work after the attribute value has been changed ("onRemote<AttributeName>Changed").
+
+[source,{cppstr}]
+----
+class ExampleInterfaceStubRemoteEvent {
+public:
+ virtual ~ExampleInterfaceStubRemoteEvent() { }
+
+ /* Verification callback for remote set requests on the attribute a */
+ virtual bool onRemoteSetAAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t a) = 0;
+ /* Action callback for remote set requests on the attribute a */
+ virtual void onRemoteAAttributeChanged() = 0;
+};
+----
+
+An implementation could be:
+
+[source,{cppstr}]
+----
+bool ExampleInterfaceStubSkel::RemoteEventHandler::onRemoteSetAAttribute(uint32_t _value) {
+
+ const bool valueChanged = (aAttributeValue_ != _value);
+ aAttributeValue_ = std::move(_value);
+ return valueChanged;
+}
+----
+
+An API for sending broadcasts and attribute-changed-notifications of observable attributes is provided by the class ExampleInterfaceStubAdapter:
+
+[source,{cppstr}]
+----
+class ExampleInterfaceStubAdapter
+ : virtual public CommonAPI::StubAdapter,
+ public ExampleInterface {
+ public:
+ virtual void fireAAttributeChanged(const uint32_t& a) = 0;
+
+};
+----
+
+The fireAAttributeChanged method can be used in an implementation like this:
+
+[source,{cppstr}]
+----
+void ExampleInterfaceStubImpl::setAAttribute(uint32_t _value) {
+
+ if (valueChanged && stubAdapter_ != NULL) {
+ stubAdapter_->fireAAttributeChanged(aAttributeValue_);
+ }
+}
+----
+
+If skeletons for the stubs are generated (code generator option), they do:
+
+- nothing on method calls
+- return the new value of an attribute on a verify callback
+- do nothing on an attribute changed callback
+
+==== Events
+
+Events provide an asyncronous interface to remotely triggered actions. This covers broadcast methods in Franca IDL and change events for attributes Every proxy also provides an availabity event which can be used for notifications of the proxies status. The Events provide a subscribe and unsubscribe method which allow registration and de-registration of callbacks.
+
+The relevant part of the public interface of the event class is as follows:
+
+[source,{cppstr}]
+----
+template<typename... _Arguments>
+class Event {
+public:
+
+ typedef uint32_t Subscription;
+ typedef std::function<void(const _Arguments&...)> Listener;
+
+ Subscription subscribe(Listener listener);
+ void unsubscribe(Subscription subscription);
+
+ // Some more code here
+
+};
+----
+
+[NOTE]
+- Your _Listener_ will be called first time after your subscription and then on any time when there is a new event (e.g. the attribute has changed).
+
+== Runtime
+
+=== Runtime Interface
+
+The Common API ((Runtime)) is the base class from which all class loading starts. The Common API Runtime accesses a config file to determine which specific middleware runtime library shall be loaded. Middleware libraries are either linked statically or are provided as shared objects (file extension .so), so they can be loaded dynamically.
+
+[NOTE]
+The Runtime has no reference to any specific middleware. The used middleware is part of the CommonAPI configuration settings.
+
+The public interface of the runtime class provides the following functions:
+
+==== Access to a generic, static runtime object
+
+[source,{cppstr}]
+----
+static std::shared_ptr<Runtime> get();
+----
+
+==== Configuration Properties
+
+[source,{cppstr}]
+----
+static std::string getProperty(const std::string &_name);
+static void setProperty(const std::string &_name, const std::string &_value);
+----
+
+API for getting and setting configuration properties at runtime.
+
+
+==== Standard Build Proxy
+
+[source,{cppstr}]
+----
+template< template<typename ...> class _ProxyClass, typename ... _AttributeExtensions >
+std::shared_ptr< _ProxyClass<_AttributeExtensions...> > buildProxy(
+ const std::string &_domain,
+ const std::string &_instance,
+ const ConnectionId_t &_connectionId = DEFAULT_CONNECTION_ID) {
+
+ // Implementation here
+}
+----
+
+The _buildProxy_ method is a factory method for instantiating a proxy class for a certain instance of a certain interface. The generated proxy class for this interface is the template parameter +_ProxyClass+; +_domain+ and +_instance+ are parts of the CommonAPI address (see definition below). The +_connectionId+ is an optional parameter which can be used to assign proxies to different logical connections. Each connection means an own receiver thread for incoming messages (no mainloop integration).
+
+==== Build Proxy With Mainloop Integration
+
+[source,{cppstr}]
+----
+template<template<typename ...> class _ProxyClass, typename ... _AttributeExtensions >
+std::shared_ptr< _ProxyClass<_AttributeExtensions...> > buildProxy(
+ const std::string &_domain,
+ const std::string &_instance,
+ std::shared_ptr<MainLoopContext> _context) {
+
+ // Implementation here
+}
+----
+
+_buildProxy_ method for the integration with external mainloops (no internal thread will be created). Create the mainloop context object by +std::make_shared < CommonAPI::MainLoopContext >+.
+
+==== Build Proxy With Default Attribute Extension
+
+[source,{cppstr}]
+----
+template <template<typename ...> class _ProxyClass, template<typename> class _AttributeExtension>
+std::shared_ptr<typename DefaultAttributeProxyHelper<_ProxyClass, _AttributeExtension>::class_t>
+ buildProxyWithDefaultAttributeExtension(
+ const std::string &_domain,
+ const std::string &_instance,
+ const ConnectionId_t &_connectionId = DEFAULT_CONNECTION_ID) {
+
+ // Implementation here
+}
+----
+
+_buildProxy_ method without mainloop integration and with one default attribute extension for the whole proxy.
+
+==== Build Proxy With Default Attribute Extension And Mainloop Integration
+
+[source,{cppstr}]
+----
+template <template<typename ...> class _ProxyClass, template<typename> class _AttributeExtension>
+std::shared_ptr<typename DefaultAttributeProxyHelper<_ProxyClass, _AttributeExtension>::class_t>
+ buildProxyWithDefaultAttributeExtension(
+ const std::string &_domain,
+ const std::string &_instance,
+ std::shared_ptr<MainLoopContext> _context) {
+
+ // Implementation here
+}
+----
+
+_buildProxy_ method with mainloop context and with one default attribute extension for the whole proxy.
+
+==== Register Service
+
+[source,{cppstr}]
+----
+template<typename _Stub>
+bool registerService(
+ const std::string &_domain,
+ const std::string &_instance,
+ std::shared_ptr<_Stub> _service,
+ const ConnectionId_t &_connectionId = DEFAULT_CONNECTION_ID) {
+
+ // Implementation here
+}
+----
+
+The _registerService_ method can be used very similar to the build proxy method on service side. Pass your the implementation of the generated stub as shared pointer (argument +std::shared_ptr<_Stub> _service+). On stub side there are no attribute extensions.
+
+[source,{cppstr}]
+----
+template<typename _Stub>
+bool registerService(
+ const std::string &_domain,
+ const std::string &_instance,
+ std::shared_ptr<_Stub> _service,
+ std::shared_ptr<MainLoopContext> _context) {
+
+ // Implementation here
+}
+----
+
+The _registerService_ method with mainloop context.
+
+[source,{cppstr}]
+----
+bool unregisterService(
+ const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance) {
+
+ // Implementation here
+}
+----
+
+Unregister service.
+
+=== Proxy Interface
+
+The proxy base class has the following interface (slightly simplified):
+
+[source,{cppstr}]
+----
+class Proxy {
+public:
+ virtual ~Proxy() {}
+
+ const Address &getAddress() const;
+ virtual bool isAvailable() const = 0;
+ virtual bool isAvailableBlocking() const = 0;
+ virtual ProxyStatusEvent& getProxyStatusEvent() = 0;
+
+protected:
+ Address address_;
+};
+----
+
+- _isAvailable_ is a non-blocking check whether the remote service for this proxy currently is available. Always returns false until the availability of the proxy is determined. The proxy actively determines its availability status asynchronously and ASAP as soon as it is created, and maintains the correct state afterwards.
+- _isAvailableBlocking_ blocks until the service is available.
+- You may subscribe to the _ProxyStatusEvent_ in order to have a callback notified whenever the availability status of the proxy changes. It is guaranteed that the callback is notified of the proxy's currently known availability status at the same instant in which the subscription is done (i.e. the callback will most likely be called with a value of false if you subscribe for this event right after the proxy has been instantiated).
+- Calls to synchronous methods will block until the initial availability status of the proxy is determined. As soon as the availability status has been determined at least once, calls to synchronous methods will return NOT_AVAILABLE as value for the CallStatus whenever isAvailable() would return false.
+- Calls to asynchronous methods do not wait for the initial availability status to be determined. Calls to asynchronous methods will instantly call the given callback with NOT_AVAILABLE as value for the CallStatus whenever isAvailable() would return false.
+
+The member variable +address_+ is the address at which the service that shall be accessed will be available. The following extract shows the relevant parts of the address class:
+
+[source,{cppstr}]
+----
+class Address {
+public:
+
+ bool operator<(const Address &_other) const;
+
+ std::string getAddress() const;
+ void setAddress(const std::string &_address);
+
+ const std::string &getDomain() const;
+ void setDomain(const std::string &_domain);
+
+ const std::string &getInterface() const;
+ void setInterface(const std::string &_interface);
+
+ const std::string &getInstance() const;
+ void setInstance(const std::string &_instance);
+
+private:
+ std::string domain_;
+ std::string interface_;
+ std::string instance_;
+};
+----
+
+The CommonAPI address consists of three parts:
+
+[width="80%",cols="3,10"]
+|=========================================================
+
+|_Interface Name_ |
+This is the name of the interface the proxy or stub was built for. If not configured otherwise this is the full qualified name of the Franca interface.
+
+|_Instance Name_ |
+This is an arbitrary name for the instance of the interface implementation.
+
+|_Domain_ |
+The domain is again an arbitrary name; the default name is +local+.
+|=========================================================
+
+=== Configuring CommonAPI
+
+There are basically two possibilities to realize a specific behavior of your interface or to realize new features:
+
+- As described above the middleware implementation can be changed without changing the API for the applications. Changes in the configuration in the middleware or platform can be realized by changing the deployment specification and the deployment settings in the *.depl files.
+- For attributes (see specification below) there is the possibility to define and implement so-called extensions. This allows the developer to extend the standard framework with own implementations in a predefined and specified way. One example is to implement a cache for attributes on proxy side.
+
+CommonAPI has an own deployment specification which is part of the CommonAPI code generator. All deployment parameters for CommonAPI itself must be optional.
+
+The CommonAPI runtime and available bindings can be configured by ini-files. The CommonAPI configuration file is +commonapi.ini+. There are three places where CommonAPI Runtime tries to find this file (in the following order):
+
+1. in the directory of the current executable. If there is a +commonapi.ini+ file, it has the highest priority.
+2. in the directory which is specified by the environment variable +COMMONAPI_CONFIG+.
+3. in the global default directory +/etc+.
+
+The configuration file has at least the following sections; all sections are optional.
+
+[width="80%",cols="3,10"]
+|=========================================================
+
+|+logging+ |
+Settings for the internal CommonAPI logging.
+
+|+default+ |
+Default name of the binding.
+
+|+proxy+ |
+This section defines for each required CommonAPI address the shared library with the binding specific, generated glue code which has to be loaded when the proxy is created: _<CommonAPI address>_=_<library name>_
+
+|+stub+ |
+This section defines for each required CommonAPI address the shared library with the binding specific, generated glue code which has to be loaded when the stub is registered: _<CommonAPI address>_=_<library name>_
+|=========================================================
+
+=== Mainloop Integration
+
+As it is described in the chapter _Runtime Class_ CommonAPI supports multithreaded execution (standard threading) as well as single threaded execution (mainloop integration). In the multithreaded case the number of threads depends on the number of different connection IDs.
+
+In the case of mainloop integration a so-called _MainLoopContext_ must be instantiated and passed to the _buildProxy_ or _registerService_ method. The +CommonAPI::MainLoopContext+ provides nothing but hooks for callbacks that will be called on specific binding internal events. Internal events may be
+
+- (De-)Registration of a +CommonAPI::DispatchSource+
+- (De-)Registration of a +CommonAPI::Watch+
+- (De-)Registration of a +CommonAPI::Timeout+
+- Issuing of a wakeup call
+
+Each of these calls has to be mapped to an appropriate method in the context of the actual Mainloop that does the single threaded execution. CommonAPI does *NOT* provide a fully fledged implementation for a Mainloop!
+
+What the mainloop related interfaces are meant for is this:
+
+- +CommonAPI::DispatchSource+: Hooks that may have work ready that is to be done, e.g. dispatching a method call to a stub, dispatching a method return to a proxy callback and the like. There is no constraint on what kind of work may be represented by a DispatchSource, *BUT* a dispatch source may *NOT* be directly related to a file descriptor that is used to actually read or write the incoming or outgoing transmission from or to a transport!
+- +CommonAPI::Watch+: Work that is related to a file descriptor that is used for reading from or writing to a transport is represented by Watches. *ANY* work that is not directly related to such a file descriptor may *NOT* be represented by watches!
+- +CommonAPI::Timeout+: Represents the work that has to be done when a timeout occurs (e.g. deleting the structures that are used to identify an answer to an asynchronous call and calling the callback that is waiting for it with an appropriate error flag). A timeout stores internally both the interval of time within which it is to be dispatched, and the next moment in time the timeout is to be dispatched.
+
+A binding developer *MUST* provide his own implementations for at least DispatchSource and Watch in order to ensure the functionality of his respective CommonAPI binding in the single threaded case, and must ensure that the appropriate instances of those classes are handed to the application via the MainLoopContext that was handed to the factory that is used to instantiate proxies and stubs.
+
+An application developer *MAY* provide additional implementations of all these classes.
+
+[glossary]
+Glossary
+--------
+
+[glossary]
+BLOB::
+ Binary Large Object.
+
+IDL::
+ Interface Description Language.
+
+IPC::
+ Interprocess Communication.
+
+GENIVI::
+ is a non-profit industry alliance committed to driving the broad adoption of an In-Vehicle Infotainment (IVI) open-source development platform.
+
+
+ifdef::backend-docbook[]
+[index]
+Example Index
+-------------
+////////////////////////////////////////////////////////////////
+The index is normally left completely empty, it's contents being
+generated automatically by the DocBook toolchain.
+////////////////////////////////////////////////////////////////
+endif::backend-docbook[]
+
diff --git a/docx/CommonAPICppUserGuide b/docx/CommonAPICppUserGuide
new file mode 100644
index 0000000..cf458e4
--- /dev/null
+++ b/docx/CommonAPICppUserGuide
@@ -0,0 +1,903 @@
+= CommonAPI C++ User Guide
+
+:doctitle: CommonAPI C++ User Guide
+:website: http://projects.genivi.org/commonapi/
+:version:
+:date:
+:toc:
+:revdate:
+:imagedir:
+:cppstr: c++
+
+== Introduction
+
+=== Aim of this document
+
+This user guide has the following content:
+
+- installation instructions for CommonAPI in general including the code generator (CommonAPI Tools)
+- a step by step tutorial on how you can write your first Hello World program
+- examples for a deeper insight into the usage of CommonAPI in conjunction with Franca IDL
+- additional information to CommonAPI which is not part of the CommonAPI specification
+
+=== CommonAPI C++
+
+CommonAPI C\++ is a standardized C\++ API specification for the development of distributed applications which communicate via a middleware for interprocess communication. The main intention is to make the C++ interface for applications independent from the underlying IPC stack. The basic principle can be seen in the following picture.
+
+.CommonAPI C++ Overview 1
+image::{imagedir}/CommonAPIOverview01.png[CommonAPI C++ Overview 1 image]
+
+- CommonAPI C++ is divided up in a middleware-independent part (CommonAPI Core) and in a middleware-specific part (CommonAPI Binding).
+- CommonAPI uses the interface description language FrancaIDL for the specification of interfaces (logical interface specification). Code generation from FrancaIDL is an integrated part of CommonAPI.
+- The code generator for CommonAPI C++ bindings needs middleware-specific parameters (deployment parameters). These parameters are defined in Franca deployment files (*.fdepl).
+
+[NOTE]
+CommonAPI C\++ Core has no obligatory deployment parameters. But it turned out that it makes sense to add also additional deployment parameter to CommonAPI C++ Core itself.
+
+The user API of CommonAPI is divided up into two parts (see picture below):
+
+- A FrancaIDL based, generated part which contains API functions that are related to the types, attributes and methods of the FrancaIDL files.
+- A "common" part (Runtime API) which contains API functions for loading the runtime environment, creating proxies and so on.
+
+.CommonAPI C++ Overview 2
+image::{imagedir}/CommonAPIOverview02.png[CommonAPI C++ Overview 2 image]
+
+This picture shows in more detail how the elements of CommonAPI C++ fit together. Note that:
+
+- the vast majority of the user API is the generated part of CommonAPI.
+- there is no direct relation between CommonAPI Core and the IPC stack.
+- the generated code of the CommonAPI Binding has interfaces to all other parts of CommonAPI.
+
+The workflow for developers of applications is as follows:
+
+- Create a FrancaIDL file with the specification of an interface with methods and attributes.
+- Generate code for client and service by starting the CommonAPI code generator.
+- Implement the service by implementing the methods in the generated skeleton.
+- Implement the client by creating proxies and calling these methods by using the proxy.
+
+=== Links
+
+CommonAPI is a GENIVI project. Source code and latest news can be found at http://projects.genivi.org/commonapi/. Source code can be found in the Git repository (http://git.projects.genivi.org/). For documentation please visit the GENIVI document page http://docs.projects.genivi.org/.
+
+[NOTE]
+At http://git.projects.genivi.org/ you will find only source code even for the code generator. It might be cumbersome to build the code generator of your own; for your convenience you will find executables and update-sites at http://docs.projects.genivi.org/yamaica-update-site/.
+
+Closely related to CommonAPI is the yamaica project which provides a full integration of all Franca IDL and CommonAPI plugins and some more enhanced features like the import and export of Franca files to Enterprise Architect. The yamaica project provides eclipse update-sites for CommonAPI and yamaica (see http://docs.projects.genivi.org/yamaica-update-site/) ready for installation.
+
+The official FrancaIDL site is at the moment: https://code.google.com/a/eclipselabs.org/p/franca/
+
+== Integration Guide for CommonAPI users
+
+The following descriptions assume that host and target platform are Linux platforms. However CommonAPI supports also Windows as host and target platform. All you need to know for Windows concerning CommonAPI you find in the separate Windows paragraph below at the end of this Integration Guide.
+
+=== Requirements
+
+CommonAPI was developed for GENIVI and will run on most Linux platforms. Additionally it is possible to run it under Windows for test and development purposes. Please note:
+
+- CommonAPI uses a lot of C++11 features, as variadic templates, std::bind, std::function and so on. Make sure that the compiler of your target platform is able to compile it (e.g. gcc 4.8).
+- The build system of CommonAPI is CMake; please make sure that it is installed on your host. CommonAPI requires a CMake version > 2.8.12.
+- This user guide describes only the "common" CommonAPI part; there are no binding specific explanations. Please refer to the binding specific user guide for further information.
+- Do not use earlier versions of Eclipse as Luna; it could work but there is no warranty.
+- The build tool chain for the code generators is Maven; make sure that at least Maven 3 is available. If you use eclipse make sure that the maven plug-in is installed.
+
+=== Compile Runtime
+
+==== Command-line
+
+For building CommonAPI from the command-line download the Common API runtime via Git from the GENIVI Git repository, switch to the desired tag (e.g. 3.0.0) and compile it using CMake:
+
+----
+$ git clone git://git.projects.genivi.org/ipc/common-api-runtime.git
+$ cd common-api-runtime
+$ git checkout tags/3.0.0
+$ mkdir build
+$ cd build
+$ cmake ..
+$ make
+----
+
+This is the standard procedure and will hopefully create the shared CommonAPI runtime library libCommonAPI.so in _build/src/CommonAPI_. Note that CMake checks if doxygen and asciidoc are installed. These tools are only necessary if you want to generate the documentation of your own. The unit tests of CommonAPI are implemented by using the Google C++ Testing Framework. If you want to build and run the unit tests the environment variable +GTEST_ROOT+ must point to the correct directory (see the contributor's guide below).
+
+[NOTE]
+If you prefer to install CommonAPI from a tar file you can get the actual tar file from:
+ http://docs.projects.genivi.org/yamaica-update-site/CommonAPI/runtime/
+
+There are several options for calling CMake and make targets.
+
+Generate makefile for building a static CommonAPI library (default is a shared library). The library will be in _/build/src/CommonAPI_.
+----
+$ cmake -DBUILD_SHARED_LIBS=OFF ..
+----
+
+Generate makefile for building the release version of CommonAPI (default is debug).
+----
+$ cmake -DCMAKE_BUILD_TYPE=Release ..
+----
+
+Without any further settings +make install+ will copy CommonAPI libraries and header files to _/usr/local_. You can change this destination directory by changing the installation prefix (e.g. to test).
+----
+$ cmake -DCMAKE_INSTALL_PREFIX=/test ..
+----
+
+Additional cmake parameters:
+
+[width="90%",cols="6,5,5"]
+|=========================================================
+
+|+-DUSE_INSTALLED_COMMONAPI+ |
+OFF, ON | use uninstalled / installed CommonAPI core library
+
+|+-DMAX_LOG_LEVEL+ |
+ERROR, WARNING, INFO, DEBUG, VERBOSE | log messages with lower log level are ignored
+
+|=========================================================
+
+Make targets:
+
+[width="90%",cols="4,10"]
+|=========================================================
+
+|+make all+ |
+Same as make. Will compile and link CommonAPI.
+
+|+make clean+ |
+Deletes binaries, but not the files which has been generated by CMake.
+
+|+make maintainer-clean+ |
+Deletes everything in the build directory.
+
+|+make install+ |
+Copies libraries to _/user/local/lib/commonapiX.X.X_ and header files to _/user/local/include/commonapiX.X.X/CommonAPI_.
+
+|+make DESTDIR=< install_dir > install+ |
+The destination directory for the installation can be influenced by +DESTDIR+.
+
+|=========================================================
+
+Further make targets will be described in the contributor's guide below.
+
+==== Eclipse
+
+Start with importing your project by _File->New->Makefile Project with Existing Code_. Select your project directory and _Linux GCC_.
+
+If not yet available, create a +Make Target+ (e.g. with the name +Run cmake+) and edit it. Set the "+Build command:+" to:
+----
+cmake -E chdir build/ cmake -G "Unix Makefiles" ../
+----
+
+and delete the "+Make target:+" field and let it empty.
+
+Edit the project properties and go to +C/C\++ Build+. Set the +Build command:+ in the +Builder Settings+ to +make -C ${ProjDirPath}/build+ and delete the +Build directory+ line and keep it empty.
+
+.CommonAPI C++ Eclipse Settings 01
+image::{imagedir}/EclipseCommonAPISettings01.png[CommonAPI C++ Eclipse Settings 01 image]
+
+Create the +build+ directory directly in your project directory.
+
+Then you can start +Build target+ in the context menu of your +Make target+ and then build the project by _Project->Build Project_.
+
+=== Compile tools
+
+An executable version of the command-line version of the CommonAPI code generator is available for Linux (32 bit) as zip-file. An update-site for installing the code generators in eclipse is also available (see below). The following instructions are for the case that you have to build the code generator yourself.
+
+==== Command-line
+
+You can build all code generators by calling maven from the command-line. Open a console and change in the directory org.genivi.commonapi.core.releng of your CommonAPI-Tools directory. Then call:
+
+----
+mvn -Dtarget.id=org.genivi.commonapi.core.target clean verify
+----
+
+After the successful build you will find the commond-line generators archived in org.genivi.commonapi.core.cli.product/target/products/commonapi-generator.zip and the update-sites in org.genivi.commonapi.core.updatesite/target.
+
+==== Eclipse
+
+Make sure that you have installed the _m2e - Maven Integration for Eclipse_ plug-in. Then create a _Run Configuration_ in Eclipse. Open the _Run configuration_ settings. On the left side of you should find a launch configuration category _Maven Build_. Create a new launch configuration and add the parameter +target.id+ with the value +org.genivi.commonapi.core.target+. Set the _Goals_ to _clean verify_.
+
+.CommonAPI C++ Eclipse Build Tools Settings
+image::{imagedir}/EclipseBuildToolsSettings.png[CommonAPI C++ Eclipse Build Tools Settings image]
+
+=== Write Applications
+
+CommonAPI requires a basic workflow for creating executable applications.
+
+.CommonAPI C++ Workflow
+image::{imagedir}/CommonAPIWorkflow.png[CommonAPI C++ Workflow image]
+
+==== Generating Code
+
+No matter which development environment is used, the API for the applications is created by the CommonAPI code generator which is available as command-line version and as Eclipse update-site.
+
+The simplest way to use the CommonAPI Tools is to add the update-site available on the GENIVI project servers to your Eclipse. Add the update site in Eclipse by calling _Help->Install New Software->Add_. Enter the URL: http://docs.projects.genivi.org/yamaica-update-site/CommonAPI/updatesite/ and confirm.
+
+Then select the newly added site in the site selection dropdown box, and in the Software selection window, select the entire "GENIVI Common API" Tree.
+
+After the software has been installed in Eclipse you can right-click on any +.fidl+ or +.fdepl+ file and generate C++ code for CommonAPI by selecting the _CommonAPI->Generate Common API Code_ option.
+
+If you have built the update-site of your own, you can add the site as well; just add it as archive.
+
+An executable version of the command-line version of the CommonAPI code generator is available only for Linux (32 bit) as zip-file at http://docs.projects.genivi.org/yamaica-update-site/CommonAPI/generator. Download the zip-file and unzip it to an appropriate directory. Then it is ready for use.
+
+Call the executable +commonapi_generator+ as follows:
+
+----
+commonapi_generator [options] file [file...]
+----
+
+Valid Options are:
+[width="80%",cols="1,1"]
+|=========================================================
+
+|+-dest < path/to/output/folder >+ |
+The generated files will be saved at this Location.
+
+|+-pref < path/to/header/file >+ |
+Here you can set the text which will be placed as a comment on each generated file (for example your license).
+
+|=========================================================
+
+[NOTE]
+If your CommonAPI binding requires deployment files the input for the code generator is the appropriate deployment file which imports the Franca file. For some bindings (e.g. D-Bus) and deployment file is not obligatory; in this case it is also possible to start the code generator with fidl-files as input.
+
+==== Build Applications
+
+Your application should compile and link only with the generated CommonAPI code and the CommonAPI runtime library. For a fast setup please consider the provided examples in CommonAPI-Tools/CommonAPI-Examples.
+
+=== Project Setup
+
+==== Structuring CommonAPI project libraries
+
+CommonAPI executables typically consist of 6 parts:
+
+1. The application code itself which is written manually by the developer.
+2. The generated CommonAPI (binding independent) code. In clients this code contains proxy functions which are called by the application; in services it contains generated functions which must be manually implemented by the developer (optionally it is possible to generate default implementations).
+3. The CommonAPI runtime library.
+4. The generated, binding specific code (so-called glue code).
+5. The runtime library of the binding.
+6. Generic libraries of the used middleware (e.g. +libdbus+).
+
+Even if there are several possibilities to divide these 6 parts up into shared or static libraries and to integrate them on a target platform, there is a standard way which is intended for the integration of CommonAPI applications (see picture below).
+
+.CommonAPI C++ Structuring Libraries
+image::{imagedir}/CommonAPIStructuringLibraries.png[CommonAPI C++ Structuring Libraries image]
+
+The standard way assumes that there is a platform software which provides necessary standard libraries in a suitable version. For CommonAPI these are the runtime libraries of CommonAPI itself, bindings and the associated middleware. Furthermore the platform should provide binding specific libraries which contain generated binding specific code (glue code). The glue code can be divided up into several shared libraries depending on used bindings, number of interfaces and other platform and project specific requirements. The application can now be delivered together with the generated binding independent code which can be statically or dynamically linked.
+
+The glue code library will now be loaded at the exact moment in which a proxy is created. The right library will be found by the evaluation of the CommonAPI configuration file that contains the association between CommonAPI address and the glue code library. In the case that there are no entries in the configuration file, default settings are used.
+
+The glue code library is binding specific; that means that the required runtime libraries are loaded automatically by the runtime linker. In the case that a certain instantiated interface in a service is offered via another middleware as before, it is sufficient just to change the entries in the configuration file, provided that a generated glue code library is available.
+
+==== Write CommonAPI Configuration Files
+
+CommonAPI and available bindings can be configured by ini-files (see e.g. http://en.wikipedia.org/wiki/INI_file).
+
+The CommonAPI configuration file is +commonapi.ini+. There are three places where CommonAPI Runtime tries to find this file (in the following order):
+
+1. in the directory of the current executable. If there is a +commonapi.ini+ file, it has the highest priority.
+2. in the directory which is specified by the environment variable +COMMONAPI_CONFIG+.
+3. in the global default directory +/etc+.
+
+The configuration file has 4 possible sections; all sections are optional.
+
+===== +logging+
+CommonAPI has an internal logging mechanism which can be parameterized by the settings of this section:
+
+- +console=true/false+
+- +file=+ _<file name>_
+- +dlt=true/false+
+- +level=fatal/error/warning/info/debug/verbose+
+
+Example:
+----
+[logging]
+console=true
+file=./mylog.log
+dlt=true
+level=verbose
+----
+
+[NOTE]
+If the configured log level is higher than the maximum log level that was defined at compile time, the maximum log level will be used.
+
+===== +default+
+Section for setting the default value for the used binding.
+
+- +binding=dbus/someip+
+
+Example:
+----
+[default]
+binding=dbus
+----
+
+===== +proxy+
+This section defines for each required CommonAPI address the shared library with the binding specific, generated glue code which has to be loaded when the proxy is created.
+
+- _<CommonAPI address>_=_<library name>_
+
+If no library is defined, CommonAPI uses default settings for library names and paths; for further information see chapter _Creating Proxies And Stubs_.
+
+Example:
+----
+[proxy]
+local:commonapi.examples.Test:commonapi.examples.Test=libTest-DBus.so
+----
+
+===== +stub+
+Analogous to the proxy section.
+
+Example:
+----
+[stub]
+local:commonapi.examples.Test:commonapi.examples.Test=libTest-DBus.so
+----
+
+==== CommonAPI Deployment
+
+The CommonAPI code generator supports nearly the full feature set of Franca IDL and works without any deployment file. However it is possible to write deployment files for interface specifications not only for bindings but also for CommonAPI itself based on the following deployment specification.
+
+[source,java]
+----
+specification org.genivi.commonapi.core.deployment {
+
+ for interfaces {
+ /*
+ * define the enumeration backing type on CommonAPI C++ level for whole interface.
+ */
+ DefaultEnumBackingType : {UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64} (default: UInt32);
+ }
+
+ for providers {
+ /*
+ * Enumerate all service instances this provider depends on (if any).
+ */
+ ClientInstanceReferences : Instance[] (optional);
+ }
+
+ for instances {
+ /*
+ * The CommonAPI address string has the format "domain:interfaceid:instanceid"
+ * according to CommonAPI specification.
+ * To avoid inconsistencies only domain and instance id can be specified during deployment,
+ * while the interface id is fixed by the interface the instance realizes.
+ */
+ Domain : String (default: "local"); // the domain part of the CommonAPI address.
+ InstanceId : String; // the instance id of the CommonAPI address.
+
+ /*
+ * Define default timeout for all methods awaiting results of an instance in seconds.
+ * 0s means no timeout/waiting forever.
+ * if the timeout elapsed without arrival of a valid result an error will be delivered to the application.
+ */
+ DefaultMethodTimeout : Integer (default:0);
+
+ /*
+ * provide properties to register for instance. use "Name=Value" as format.
+ * This deployment property is currently not supported.
+ */
+ PreregisteredProperties : String [] (optional);
+ }
+
+ for methods {
+ /*
+ * timeout for method calls in ns.
+ * If timeout is defined with value > 0, then a method call will return with a timeout error
+ * in case no result arrived before the timeout elapsed.
+ * 0 means no timeout.
+ */
+ Timeout : Integer (default: 0);
+ }
+
+ for enumerations {
+ /*
+ * define the enumeration backing type on CommonAPI C++ level for a specific enumeration.
+ * If not specified use "ApiDefaultEnumBackingType".
+ */
+ EnumBackingType : {UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64} (optional);
+ }
+}
+----
+
+The enumeration backing type can be set on CommonAPI C++ level not only specific for single enumerations but also generally for the whole interface. Please note that bindings might also have deployment settings which concern the backing type of enumerations.
+
+It is also possible to define timeouts for function calls. Another possibility to set this timeout is to define it in the optional +CallInfo+ parameter of the method call.
+
+The settings for instances and providers are not evaluated by the code generator.
+
+See the following example for the usage of the deployment parameters. The Franca specification is:
+[source,java]
+----
+package commonapi.examples
+
+interface Example {
+
+ version { major 0 minor 1 }
+
+ method test {
+ in {
+ EN x
+ }
+ }
+
+ enumeration EN {
+ DEFAULT
+ NEW
+ }
+}
+----
+
+Possible deployment settings could look like:
+[source,java]
+----
+import "CommonAPI_deployment_spec.fdepl"
+import "Example.fidl"
+
+define org.genivi.commonapi.core.deployment for interface commonapi.examples.Example {
+
+ DefaultEnumBackingType = UInt8
+
+ method test {
+ Timeout = 1
+ }
+
+ enumeration EN {
+ EnumBackingType = UInt64
+ }
+}
+----
+
+==== CommonAPI Logging
+
+CommonAPI Runtime informs about internal errors, warnings and other events by means of the CommonAPI Logger. Please refer to the chapter _Write CommonAPI Configuration Files_ if you want to know in general how it is possible to get CommonAPI log messages.
+
+CommonAPI supports the DLT standard. To get DLT log messages make sure that DLT is installed when running _CMake_. If _CMake_ finds the DLT library the compiler switch +-DUSE_DLT+ is set. Additionally set the key +dlt=true+ in the logging section of your configuration file.
+
+The DLT application ID is always set to +CAPI+; the context ID can be set by the application (see e.g. example 01):
+
+[source,{cppstr}]
+----
+CommonAPI::Runtime::setProperty("LogContext", "E01C");
+----
+
+The default value for the _LogContext_ is +CAPI+.
+
+==== CMake
+
+Since version 3 the build system of CommonAPI has been converted from Autotools to CMake (http://www.cmake.org/). A good starting point for writing CMake files for your application are the CMake files which are delivered with the CommonAPI examples in the CommonAPI Tools project.
+
+Here are some additional hints how specific problems related to Franca IDL and CMake can be solved.
+
+===== Get a CMake variable with all generated files
+
+Let's assume that the code generator has generated all source fules into thedirectory src-gen. The CMake command:
+----
+FILE(GLOB GEN_SRCS src-gen/*cpp)
+----
+creates the CMake variable +GEN_SRC+ which can be used e.g. like
+----
+add_executable(${GEN_SRCS} _<other sources>_)
+----
+for building the execuatble.
+
+===== Generate code within your CMake file
+
+As described before one step in building your application is the generation of source files from your Franca interface specification. If you do not want to start the code generator manually you have several possibilities to automate that step. The following extract of a CMake file shows how it could be done within a CMake file.
+
+We assume that your fidl files are located in the subdirecory _fidl_ of your project directory and the generated output in _src-gen_.
+
+----
+set(FIDL_DIR ${PRJ_SRC_DIR}/fidl)
+set(GEN_SRC_DIR ${PRJ_SRC_DIR}/src-gen)
+
+set(GEN_COMMAND _<path-to-generator>_/commonapi_generator -dest ${GEN_SRC_DIR} ${FIDL_DIR}/MyFidl.fidl)
+
+add_custom_command(OUTPUT ${SRC_GEN_DIR}/_<generated-source-files>_.cpp
+ COMMAND ${GEN_COMMAND}
+ DEPENDS ${FIDL_DIR}/MyFidl.fidl
+ WORKING_DIRECTORY ${PRJ_SRC_DIR}
+ COMMENT "Call CommonAPI code generator."
+)
+----
+
+Set the +OUTPUT+ in the custom command to all generated src files.
+
+[NOTE]
+For CommonAPI itself it might be possible that there are no cpp files in the output. This is the case if you don't generate the skeletons for the stub and you don't have any complex datatypes in yor fidl file.
+
+=== Windows
+
+CommonAPI can also run on Windows platforms. In order to get a running system please refer to the binding specific user guides. To compile CommonAPI for Windows, do the following steps:
+
+- Open the file +CommonAPI.sln+ with Visual Studio 2013 (at least Update 4).
+- Build the project +CommonAPI+.
+
+== Basic Features
+
+=== New CommonAPI 3 Features
+
+The new CommonAPI version 3 contains a number of bug fixes, some internal modifications and new features. For the user of CommonAPI there are not as many changes as it may seem at first glance. The following sections provide an overview of the most important changes.
+
+==== Franca And Deployment
+
+CommonAPI 3 supports Franca IDL 0.9.1 and additionally some new deployment parameters (see chapter _CommonAPI Deployment_).
+
+==== Build System CMake
+
+The build system of CommonAPI has been converted from Autotools to CMake. Please refer to the build instructions of this user guide. For an improved window support also Windows project files are delivered.
+
+==== Changed Configuration Files
+
+The configuration files have now the ini file format and some additional settings. Please refer to the chapter _Write CommonAPI Configuration Files_.
+
+==== CommonAPI Logging
+
+CommonAPI 3 provides logging messages, e.g. in DLT format. Refer to chapter _CommonAPI Logging_.
+
+==== New Code Generator Command-line Parameters
+
+The parameters of the code generator are now significantly extended. The usage of the code generator is now (Linux 32 bit):
+
+----
+commonapi-generator-linux-x86 <options> <fidl files>
+----
+
+[cols="6,10", options="header"]
+|=========================================================
+
+|Options|
+Description
+
+|+-h, --help+|
+Print out options of the code generator
+
+|+-d, --dest+ _<arg>_|
+The default output directory
+
+|+-dc, --dest-common+ _<arg>_|
+The directory for the common code (relevant for proxy and stub, e.g. type definitions)
+
+|+-dp, --dest-proxy+ _<arg>_|
+The directory for proxy code
+
+|+-ds, --dest-stub+ _<arg>_|
+The directory for stub code
+
+|+-dsk, --dest-skel+ _<arg>_|
+The directory for the skeleton code
+
+|+-l, --license+ _<arg>_|
+The file path to the license text that will be added to each generated file
+
+|+-ll, --loglevel+ _<arg>_|
+The log level (quiet or verbose)
+
+|+-np, --no-proxy+ _<arg>_|
+Switch off generation of proxy code
+
+|+-ns, --no-stub+ _<arg>_|
+Switch off generation of stub code
+
+|+-pre, --prefix-enum-literal+ _<arg>_|
+The prefix added to all generated enumeration literals
+
+|+-sk, --skel+ _<arg>_|
+ Generate skeleton code. The optional argument specifies the postfix. Without argument, the postfix is 'default'
+|=========================================================
+
+Please note:
+
+- It is now possible to define different destination directories for proxy and stub code and to switch off the generation of proxy or stub code.
+- The CommonAPI 2.x code generator always generated default implementations for the stubs (skeleton). This is not the default behavior anymore. Call the code generator with the option +-sk+ without an argument to get the same result as before.
+- It is possible to influence the literals of enumerations by setting the option +-pre+. With this option you can add a custom prefix to all generated enumeration literals.
+
+==== Version In Namespace
+
+Since CommonAPI version 3, the version of the Franca interface becomes part of the C++ namespace. The version is added at the beginning of the namespace path, e.g. for an interface with version 1.0 the modified namespace begins with +v1_0+. Please refer to chapter _Namespaces_ for further information.
+
+==== New Runtime Loading Concept
+
+With CommonAPI 2.x you had to follow three steps to create proxies (or stubs):
+
+- Get a runtime object for your required middleware.
+- Create a factory from this runtime object (optionally with a mainloop context).
+- Build your proxy using this factory; one argument is the CommonAPI address.
+
+This procedure has been simplified and improved for the dynamic loading of CommonAPI bindings. For the relevant details see chapter _Creating Proxies And Stubs_.
+
+==== Asynchronous Stubs
+
+For client implementations CommonAPI offers the possibility to call functions (Franca methods or setter/getter functions for attributes) synchronously or asynchronously. In the asynchronous case the reply for the call will come as callback-function call. On stub side CommonAPI required to calculate the return values immediatly (see picture).
+
+.Asynchronous Stubs
+image::{imagedir}/AsynchronousStubs.png[Asynchronous Stubs image]
+
+But some applications work as kind of intermediate layer and simply pass on function calls to a next application. In this case it was only under relatively high cost possible to pass the function calls to another application and to delegate the calculation of the return values. This is now possible because the return values are now wrapped into a function object which can be passed to another execution path.
+
+==== CallInfo For Method Calls
+
+Method calls now have an additional, optional parameter which is called +CallInfo+. See e.g. the generated call +sayHello+ on proxy side:
+
+[source,{cppstr}]
+----
+virtual void sayHello(
+ const std::string &_name, CommonAPI::CallStatus &_status,
+ std::string &_message,
+ const CommonAPI::CallInfo *_info = nullptr
+);
+----
+
++CallInfo+ is defined as:
+
+[source,{cppstr}]
+----
+struct COMMONAPI_EXPORT CallInfo {
+ CallInfo()
+ : timeout_(DEFAULT_SEND_TIMEOUT_MS), sender_(0) {
+ }
+ CallInfo(Timeout_t _timeout)
+ : timeout_(_timeout), sender_(0) {
+ }
+
+ Timeout_t timeout_;
+ Sender_t sender_;
+};
+----
+
+The +timeout_+ defines how long the client will wait for the response from the service before it returns with CallStatus +REMOTE_ERROR+.
+
+The attribute +sender_+ can be used for passing an application specific sender handle to the method call which can be used in bindings to log the correlation between the sender handle and middleware specific information like serial numbers.
+
+=== Creating Proxies And Stubs
+
+The CommonAPI runtime creates proxies/registers stubs at the binding which is either configured for the given proxy/stub instance or is the default binding if no configured binding could be found. The configuration of a binding for a specific instance is done by providing an address mapping for the instance. An address mapping can either be specified using a deployment file to generate the interface specific binding code or by an entry in the binding configuration file. Such entries look like:
+
+----
+[_<commonapi address>_]
+_<ipc specific address parameter>_ = ...
+_<ipc specific address parameter>_ = ...
+...
+----
+
+[NOTE]
+CommonAPI does not check for multiple definitions for the same CommonAPI address. In this case, the binding that was registered first, will be used to create the proxy/register the stub.
+
+The default default binding is "dbus". This can be changed by setting the "binding" variable in the "default"-section of the CommonAPI configuration file or by setting the environment variable "COMMONAPI_DEFAULT_BINDING". The environment variable overwrites the setting provided by the configuration file.
+
+[NOTE]
+A binding that is used as default binding should be able to automatically (without further configuration) translate CommonAPI addresses to the addresses used by the communication mechanism it binds to. Otherwise all used instances must be defined in the deployment.
+
+Bindings are implicitly registered by the binding specific generated code for an interface. This code can either be statically linked or dynamically loaded at runtime. In the first case, the bindings an application uses are statically bound to the application while in the second case the application and their used bindings are independent from each other. The name of a library that needs to be loaded before being able to create a proxy or register a stub for a specific interface instance is determined
+as follows:
+
+. It is checked whether the requested action can be done be an already registered factory.
+
+. If 1. fails, the name of the library that contains the needed code is determined:
+
+.. If the requested proxy/stub instance is configured, the configured name will be used. Such configurations are done in the "proxy" and "stub" sections of the CommonAPI configuration file and look like: _<commonapi address>_ = _<library name>_
+
+.. If no configuration exists it is checked whether the property "LibraryBase" is set. If yes, the name is set to _lib<LibraryBase>_.
+
+.. If neither a configuration exists nor the property "LibraryBase" is set, the name will be built from the CommonAPI address as _lib<domain>____<interface>____<instance>_.
+
+. The runtime tries to load the library with the determined name. If it succeeds, it tries to create the proxy/register the stub again.
+
+=== Namespaces
+
+See the example +E01HelloWorld+:
+
+[source,java]
+----
+package commonapi.examples
+
+
+interface E01HelloWorld {
+ version { major 1 minor 0 }
+
+ // Interface definition here
+}
+----
+
+The generated code looks as follows:
+[source,{cppstr}]
+----
+namespace v1_0 {
+namespace commonapi {
+namespace examples {
+
+class E01HelloWorld {
+public:
+
+// Code here
+
+CommonAPI::Version E01HelloWorld::getInterfaceVersion() {
+ return CommonAPI::Version(1, 0);
+}
+
+} // namespace examples
+} // namespace commonapi
+} // namespace v1_0
+----
+
+The generated code will be generated into the directory +src-gen/v1_0/commonapi/examples+.
+
+The main reason for adding the version at the beginning of the namespace is that we consider the name of the interfaces together with the package path (fully qualified name) as a unit, as it is specified in the Franca file. This name should not be destroyed by an intervening add on.
+
+It is however possible to create project specific namespaces if needed, as the following example shows:
+
+[source,{cppstr}]
+----
+#include <iostream>
+
+namespace v1_0 {
+namespace commonapi {
+namespace examples {
+
+class MySample {
+public:
+ void print() const { std::cout << "commonapi.examples.v1_0.MySample" << std::endl; }
+};
+
+} // namespace examples
+} // namespace commonapi
+} // namespace v1_0
+
+namespace v1_1 {
+namespace commonapi {
+namespace examples {
+
+class MySample {
+public:
+ void print() const { std::cout << "commonapi.examples.v1_1.MySample" << std::endl; }
+};
+
+} // namespace examples
+} // namespace commonapi
+} // namespace v1_1
+
+namespace commonapi {
+namespace examples {
+
+namespace V1_0 = v1_0::commonapi::examples;
+namespace V1_1 = v1_1::commonapi::examples;
+
+} // namespace examples
+} // namespace commonapi
+
+using namespace commonapi::examples;
+
+int
+main(int argc, char **argv) {
+ V1_0::MySample aSample;
+ V1_1::MySample bSample;
+
+ aSample.print();
+ bSample.print();
+
+ return 0;
+}
+----
+
+=== Multithreading and Mainloops
+
+Please refer to example 07 for an example of the CommonAPI mainloop integration with the +glib+ mainloop.
+
+== Examples
+
+include::../CommonAPI-Examples/README[]
+include::../CommonAPI-Examples/E01HelloWorld/README[]
+include::../CommonAPI-Examples/E02Attributes/README[]
+include::../CommonAPI-Examples/E03Methods/README[]
+include::../CommonAPI-Examples/E04PhoneBook/README[]
+include::../CommonAPI-Examples/E05Manager/README[]
+include::../CommonAPI-Examples/E06Unions/README[]
+include::../CommonAPI-Examples/E07Mainloop/README[]
+
+== Contributor's Guide
+
+=== Preliminary Remarks
+
+You can contribute as little or as much as you like: bug reports, patches or documentation are all equally appreciated:
+
+- Create bug reports for CommonAPI and bindings at http://bugs.genivi.org, Product _Common API for IPC_
+- For the creation of patches: see chapter _Contribution of Code_ below
+- Provide changes in the existing documentation or new documentations as patch or _asciidoc_ document
+
+=== Build Tests and Documentation
+
+There are additional make targets for contributors and developers:
+
+[width="80%",cols="4,10"]
+|=========================================================
+
+|+make dist+ |
+Generates a packed tarball (*.tar.bz) from your current branch in your git repository.
+
+|+make doxygen-doc+ |
+Generates a packed tarball (*.tar.bz) from your current branch in your git repository.
+
+|=========================================================
+
+The CommonAPI documentation is written with _asciidoc_ (http://www.methods.co.nz/asciidoc/). You will find the source of this user guide and the specification in the _docx_ directory of the CommonAPI-Tools project. Please make sure that _asciidoc_ is installed before you try to create the pdf- or html-files yourself. The documentation can be created by starting the Makefile in the _docx_ directory. The doxygen output can be obtained by the make target _doxygen-doc_.
+
+Please note that CommonAPI itself does not contain any unit tests (only the source code of CommonAPI bindings might be delivered with unit tests). CommonAPI provides so-called verification tests which can be found in the ComonAPI Tools repository and there in the project _org.genivi.commonapi.core.verification_.
+
+The verification tests can be used to test features and the correct behavior of the CommonAPI framework together with the binding. These tests shall guarantee that CommonAPI and binding implement the CommonAPI specification and are stable.
+
+The verification tests are implemented by using _googletest_ (http://code.google.com/p/googletest). For compiling and running the tests _googletest_ must be built and the configuration script location must be available in the environment variable +GTEST_CONFIG+.
+
+The first step is to create the glue code library. The term "glue code" refers to a binary that contains the binding specific generated code from the provided Franca files which you can find in _org.genivi.commonapi.core.verification/fidl_. The glue code library must contain the generated binding specific proxy and stub files. Please follow the instructions in your binding code for creating the glue code library.
+
+Now create a _build_ directory in the verification project and start CMake. Call CMake with the following parameters:
+
+[width="80%",cols="5,5"]
+|=========================================================
+
+|+-DUSE_INSTALLED_COMMONAPI+ |
+OFF/ON
+
+|+-DBINDING_NAME+ |
+DBus/SomeIP/...
+
+|+-DCMAKE_BINDING_NAME+ |
+CommonAPI-DBus/CommonAPI-SomeIP/...
+
+|+-DCMAKE_BINDING_PATH+ |
+Path to the binding library
+
+|+-DCMAKE_GLUECODE_NAME+ |
+Name of the glue code library
+
+|+DCMAKE_GLUECODE_PATH+ |
+Path to the glue code library
+
+|+-DBINDING_EXTRA+ |
+Path to additional libraries which are needed by the linker (e.g. _libdbus_)
+
+|+-DCOMMONAPI_CMAKE_INSTALL_PATH+ |
+Path to the CommonAPI library
+
+|+-DCOMMONAPI_DBUS_TOOL_GENERATOR+ |
+Code generator executable with path
+
+|=========================================================
+
+After that start _make check_ to build and run the verification tests.
+
+=== Formatting Code
+
+Use the Eclipse internal formatter _K&R [built-in]_ for formatting the code.
+
+=== Contribution of Code
+
+First get the code from the git:
+----
+$ git clone
+----
+
+Get an overview of all branches:
+----
+$ git branch
+----
+
+Switch to the branch you want to work on (master is the feature branch) and verify that it has switched (* changed)
+----
+$ git checkout <your branch>
+$ git branch
+----
+
+Best practice is to create a local branch based on the current branch:
+----
+$ git branch working_branch
+----
+
+Start working, best practice is to commit smaller, compilable pieces during the development process that makes it easier to handle later on. If you want to commit you changes, send them to the author, you can create a patch like this:
+
+----
+$ git format-patch working_branch <your branch>
+----
+
+This creates a set of patches that are published via the mailing list.The patches will be discussed and then merged & uploaded on the git by the maintainer.
+
+Patches can be accepted either under GENIVI Cla or MPL 2.0 (see section License). Please be sure that the signed-off-by is set correctly. For more, check out http://gerrit.googlecode.com/svn/documentation/2.0/user-signedoffby.html
+
+
diff --git a/docx/CommonAPISpecification b/docx/CommonAPISpecification
deleted file mode 100644
index bf02176..0000000
--- a/docx/CommonAPISpecification
+++ /dev/null
@@ -1,1080 +0,0 @@
-:website: http://projects.genivi.org/commonapi/
-:version:
-:toc:
-:imagedir:
-:cppstr: c++
-
-CommonAPI C++ Specification
-===========================
-
-This is the specification for *Common API {version}* released at {revdate}.
-
-.Copyright and License
-*******************************************************************************
-Copyright (C) 2014, BMW AG
-Copyright (C) 2014, GENIVI Alliance, Inc.
-
-This file is part of the GENIVI IPC Common API C++ project.
-
-Contributions are licensed to the GENIVI Alliance under one or more
-Contribution License Agreements or MPL 2.0.
-*******************************************************************************
-
-IPC Common API is a C++ abstraction framework for *Interprocess Communication* (IPC).
-It is supposed to be neutral to IPC implementations and therefore can be used with any
-kind of IPC mechanism if a middleware specific _IPC Common API binding_ is provided.
-
-IPC Common API allows applications (i.e., clients and servers using C++) developed
-against IPC Common API to be linked with different IPC Common API _backends_ without
-any changes to the application code.
-Thus, components which have been developed for a system which uses specific IPC X could
-be deployed for another system which uses IPC Y easily - just by exchanging the
-IPC Common API backend without recompiling the application code.
-The actual interface definitions will be created using
-http://code.google.com/a/eclipselabs.org/p/franca/[Franca IDL], which is the
-Common IDL solution favored by http://www.genivi.org/[GENIVI].
-
-IPC Common API is not restricted to GENIVI members
-(see https://www.genivi.org/sites/default/files/genivi_public_newsletter_October_2013_liquid.html#LIC[public GENIVI licensing policy]).
-It is available as open source code, which is split into runtime code for the target
-system and code generation tooling (see http://projects.genivi.org/) to be used on
-development systems.
-
-.This document
-********************************************************************************
-This document originates from the GENIVI Wiki and was the result of
-some work of the IPC subdomain as part of the GENIVI System Infrastructure Expert Group.
-
-If you're new to IPC Common API please read the introduction of this document and
-the IPC Common API Tutorial available at the
-http://git.projects.genivi.org/?p=ipc/common-api-tools.git;a=summary[CommonAPI-Tools repository].
-********************************************************************************
-
-General Design
---------------
-
-Basic Assumptions
-~~~~~~~~~~~~~~~~~
-
-- The applications use the client-server communication paradigm.
-- The C++ API is based on the common interface description language Franca IDL which provides the possibility to specify interfaces independent from the platform, middleware or programming language. That means that the application specific part of the API is generated via a code generator from a Franca IDL specification file (see figure 1).
-- CommonAPI specifies only an API and not an concrete IPC mechanism. It can only be used with a language binding that has to be developed for a special middleware.
-- In principle, the CommonAPI should be platform independent. However, this is without any restrictions very difficult to realize. Therefore it is agreed that CommonAPI attempts to use only features supported from the gnu C++ compiler version \<= 4.4.2. Please find supported ((compiler)) and compiler versions in the NEWS file of the CommonAPI distribution.
-
-.Code Generation from Franca IDL
-image::{imagedir}/CodeGenerationFrancaIDL.png[Code Generation image]
-
-Deployment
-~~~~~~~~~~
-
-One problem with definition of a middleware-independent C++ API is that depending on the middleware different configuration parameters for parts of the API could be necessary. Examples:
-
-- QoS parameter
-- Maximum length of arrays or strings
-- Endianness of data
-- Priorities
-
-The Franca IDL offers the possibility to specify these kind of parameters which depend on the used middleware in a middleware-specific or platform-specific deployment model (*.depl file). The deployment parameters can be specified arbitrarily.
-
-But as indicated above it is an explicit goal that an application written against CommonAPI can be linked against different CommonAPI IPC backends without any changes to the application code. This goal brings an important implicit restriction:
-
-[NOTE]
-The interface defined in Franca IDL is the only information that should be used to generate the CommonAPI headers that define the implementation API. Deployment models that are specific to the IPC backend must not affect the generated API. But a non specific deployment model is allowed.
-
-.Deployment Concept
-image::{imagedir}/Deployment.png[Deployment image]
-
-Basic Parts of CommonAPI
-~~~~~~~~~~~~~~~~~~~~~~~~
-
-CommonAPI can be divided up into two parts:
-
-- The first part (Franca based part, generated by the CommonAPI code generator) refers to the variable (generated) part of the logical interface. That is the part of the interface which depends on the specifications in the Franca IDL file (data types, arrays, enumerations and interface basics as attributes, methods, callbacks, error handling, broadcast).
-- The second fixed part (CommonAPI Runtime features) which is mainly independent from the interface specifications. It refers to the CommonAPI library functions as service discovery, connect/disconnect, and address handling which relate primarily to the runtime environment provided by the underlying middleware. Furthermore this part contains common type definitions and base classes.
-
-Franca based part
------------------
-
-Namespaces
-~~~~~~~~~~
-
-The *namespace* of the CommonAPI base functions is CommonAPI; the ((namespace)) of a CommonAPI application depends on the the qualified package name of the interface specification.
-
-[cols="<50%asciidoc,<50%asciidoc",frame="none",grid="none"]
-|====
-|.FrancaIDL
-[source,java]
-----
-package example.user
-----
-|.CommonAPI C++
-[source,{cppstr}]
-----
-namespace example {
-namespace user {
-
-}
-}
-----
-|====
-
-Data Types
-~~~~~~~~~~
-
-Primitive Types
-^^^^^^^^^^^^^^^
-
-The integer data types used by Common API are defined in +stdint.h+.
-
-.Mapping Of Franca Primitive Types With CommonAPI C++ Types
-[width="100%",cols="3,5,8",options="header"]
-|=========================================================
-|Franca Type Name |CommonAPI C++ Type |Notes
-
-|+UInt8+ |+uint8_t+ |
-unsigned 8-bit integer (range 0..255).
-
-|+Int8+ |+int8_t+ |
-signed 8-bit integer (range -128..127).
-
-|+UInt16+ |+uint16_t+ |
-unsigned 16-bit integer (range 0..65535).
-
-|+Int16+ |+int16_t+ |
-signed 16-bit integer (range -32768..32767).
-
-|+UInt32+ |+uint32_t+ |
-unsigned 32-bit integer (range 0..4294967295).
-
-|+Int32+ |+int32_t+ |
-signed 32-bit integer (range -2147483648..2147483647).
-
-|+UInt64+ |+uint64_t+ |
-unsigned 64-bit integer.
-
-|+Int64+ |+int64_t+ |
-signed 64-bit integer.
-
-|+Boolean+ |+bool+ |
-boolean value, which can take one of two values: false or true.
-
-|+Float+ |+float+ |
-floating point number (4 bytes, range +/- 3.4e +/- 38, ~7 digits).
-
-|+Double+ |+double+ |
-double precision floating point number (8 bytes, range +/- 1.7e +/- 308, ~15 digits).
-
-|+String+ |+std::string+ |
-character string.
-
-|+ByteBuffer+ |+std::vector<uint8_t>+ |
-buffer of bytes (aka BLOB).
-|=========================================================
-
-Franca has only one string data type, and if necessary the wire format / ((encoding)) can be specified via deployment model. The Proxies always expect and deliver *UTF-8*.
-
-Arrays
-^^^^^^
-
-Franca ((array)) types (in explicit and implicit notation) are mapped to +std::vector<T>+. While explicitly defined array types will be made available as typedef with the name as it was given in Franca IDL, the implicit version will just be generated as +std::vector<T>+ wherever needed.
-
-Structures
-^^^^^^^^^^
-
-Franca struct types are mapped to C++ struct types.
-
-.FrancaIDL
-[source,java]
-----
-struct TestStruct {
- UInt16 uintValue
- String stringValue
-}
-----
-
-.CommonAPI C++
-[source,{cppstr}]
-----
-struct TestStruct: CommonAPI::SerializableStruct {
- TestStruct() = default;
- TestStruct(const uint16_t& uintValue, const std::string& stringValue);
-
- virtual void readFromInputStream(CommonAPI::InputStream& inputStream);
- virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const;
-
- uint16_t uintValue;
- std::string stringValue;
-};
-----
-
-One problem is the possibility to inherit structures in Franca IDL. This feature can be mapped 1:1 to C\++ inheritance for structs. Due to the limitations of the C\++ language, we can make use of the C\++ virtual methods to guarantee proper serialization of derived struct types. For that we define +InputStream+ and +OutputStream+ classes which are part of the CommonAPI library. Each basic struct (the topmost parent in inheritance) must derive from +SerializableStruct+ which is also defined within the CommonAPI library. This will force each struct to implement two virtual methods: +readFromInputStream()+ and +writeToOutputStream()+.
-
-The CommonAPI library also defines the two input and output stream operators on +SerializableStruct+: +operator<<()+ and +operator>>()+, whose purpose is to signal the +InputStream+ and +OutputStream+ implementations that a struct is about to be serialized, and call the internal +readFromInputStream()+ or +writeToOutputStream()+ methods. The latter are CommonAPI specific and must not be accessible from the application or the individual bindings to avoid confusion. A typical application will create a struct instance, fill in the values and call a proxy method with the struct instance. The proxy method will be dispatched to the apropriate binding, which will eventually serialize the struct using the stream operators. This will result in calling the binding specific +InputStream+ or +OutputStream+ implementations through SerializableStruct's virtual methods +readFromInputStream()+ or +writeToOutputStream()+.
-
-Enumerations
-^^^^^^^^^^^^
-
-Franca ((enumerations)) will be mapped to C++ strongly typed enums. Enum backing datatype and wire format by default is +uint32_t+. If needed, the wire format can be specified via deployment model, but proxy only delivers and expects the default.
-
-.FrancaIDL
-[source,java]
-----
-enumeration MyEnum {
- E_UNKNOWN = "0x00"
-}
-
-enumeration MyEnumExtended extends MyEnum {
- E_NEW = "0x01"
-}
-----
-
-.CommonAPI C++
-[source,{cppstr}]
-----
-enum class MyEnum: int32_t {
- E_UNKNOWN = 0 };
-
-// Definition of a comparator is necessary for GCC 4.4.1
-// Topic is fixed since 4.5.1
-struct MyEnumComparator;
-
-enum class MyEnumExtended: int32_t {
- E_UNKNOWN = MyEnum::E_UNKNOWN,
- E_NEW = 1
-};
-----
-
-[NOTE]
-To enable comparisons between enumerations in an inheritance hierarchy comparators have to be generated for the C\++ types, as C++ does not support enum-inheritance natively.
-
-Maps
-^^^^
-
-For efficiency reasons the CommonAPI data type for Franca ((maps)) is +std::unordered_map<K,V>+.
-
-[cols="<30%asciidoc,<70%asciidoc",frame="none",grid="none"]
-|====
-|[source,java]
-.FrancaIDL
-----
-map MyMap {
- UInt32 to String
-}
-----
-|[source,{cppstr}]
-.CommonAPI C++
-----
-typedef std::unordered_map<uint32_t, std::string> MyMap;
-----
-|====
-
-Unions
-^^^^^^
-
-Franca ((union)) types are implemented as a typedef of CommonAPI generic templated C++ variant class.
-
-[cols="<40%asciidoc,<60%asciidoc",frame="none",grid="none"]
-|====
-|[source,java]
-.FrancaIDL
-----
-union MyUnion {
- UInt32 MyUInt
- String MyString
-}
-----
-|[source,{cppstr}]
-.CommonAPI C++
-----
-typedef Variant<uint32_t, std::string> MyUnion;
-----
-|====
-
-This uses a variadic template to define the possible options, and implements operators in the expected fashion.
-
-Assignment works by constructor or assignment operator:
-----
-MyUnion union = 5;
-MyUnion stringUnion("my String");
-----
-
-Getting the contained value is done via a get method templated to the type desired for type safety. This results in a compile error if an impossible type is attempted to be fetched. In case of fetching a type which can be contained but is not an exception is thrown. The choice of an exception at this point is made for the following reasons:
-
-- Returning pointers is inconvenient, especially in case of primitives.
-- Returning a temporary reference in case of failure is dangerous due to potential for segmentation faults in case of accidental use.
-- Returning a null heap object will be a memory leak if not deleted by the user.
-
-----
-MyUnion union = 5;
-int a = union.get<uint32_t>(); //Works!
-std::string b = union.get<std::string>(); //Throws exception
-----
-
-Also available is an templated isType method to test for the contained type:
-
-----
-MyUnion union = 5;
-bool contained = union.isType<uint32_t>(); //True!
-contained = union.isType<std::string>(); //False!
-----
-
-[NOTE]
-To enable comparisons between variants in an inheritance hierarchy comparators have to be generated for the C\++ types, as C++ as all ((variants)) are instances of the same generic class.
-
-Type Aliases
-^^^^^^^^^^^^
-
-Franca typedefs are mapped to C++ typedef.
-
-Type Collections
-^^^^^^^^^^^^^^^^
-
-In Franca a set of user-defined types can be defined as _type collection_. The name of the type collection, referred to as _typecollectionname_, can be empty. CommonAPI uses for empty type collection the default name _AnonymousTypeCollection_.
-
-The CommonAPI code generator generates the header file +typecollectionname.h+ and creates an own namespace for the type collection.
-
-[source,java]
-.FrancaIDL
-----
-package commonapi.examples
-
-typeCollection {
-// type definitions here
-}
-----
-
-[source,{cppstr}]
-.CommonAPI C++
-----
-namespace commonapi {
-namespace examples {
-namespace AnonymousTypeCollection {
-
-static inline const char* getTypeCollectionName() {
- static const char* typeCollectionName = "commonapi.examples.AnonymousTypeCollection";
- return typeCollectionName;
-}
-
-} // namespace AnonymousTypeCollection
-} // namespace examples
-} // namespace commonapi
-----
-
-Interfaces
-~~~~~~~~~~
-
-Basics
-^^^^^^
-
-For the Franca interface name, referred to as _interfacename_, a class name is generated which provides the methods +getInterfaceName+ and +getInterfaceVersion+. The ((version)) is mapped to a struct +CommonAPI::Version+.
-
-[NOTE]
-Specifying a version is mandatory for CommonAPI.
-
-[source,java]
-.FrancaIDL
-----
-package commonapi.examples
-
-interface ExampleInterface {
- version { major 1 minor 0 }
-}
-----
-
-[source,{cppstr}]
-.CommonAPI C++
-----
-namespace commonapi {
-namespace examples {
-
-class ExampleInterface {
- public:
- virtual ~ExampleInterface() { }
-
- static inline const char* getInterfaceId();
- static inline CommonAPI::Version getInterfaceVersion();
-};
-
-const char* ExampleInterface::getInterfaceId() {
- static const char* interfaceId = "commonapi.examples.ExampleInterface";
- return interfaceId;
-}
-
-CommonAPI::Version ExampleInterface::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-} // namespace examples
-} // namespace commonapi
-----
-
-The specification of the version structure is part of the namespace CommonAPI:
-[source,{cppstr}]
-----
-struct Version {
- Version() = default;
-
- Version(const uint32_t& majorValue, const uint32_t& minorValue):
- Major(majorValue),
- Minor(minorValue) {}
-
- uint32_t Major;
- uint32_t Minor;
-};
-----
-
-As described above it is a basic assumption that the applications use the client-server communication paradigm. That means that the CommonAPI code generator generates stub code for the server implementation and proxy code for the client implementation.
-
-At least the following files are generated:
-
-.Generated files of the CommmonAPI code generator for the example interface +ExampleInterface+
-[width="80%",cols="2,1"]
-|=========================================================
-|ExampleInterface.h | Common header file for client and service
-
-|ExampleInterfaceProxy.h | proxy class
-
-|ExampleInterfaceProxyBase.h | base class for proxy
-
-|ExampleInterfaceStub.h | stub
-
-|ExampleInterfaceStubDefault.cpp | stub default implementation
-
-|ExampleInterfaceStubDefault.h | stub default header
-
-|=========================================================
-
-The following picture shows the relationships between the proxy classes.
-
-.Proxy Classes
-image::{imagedir}/Diag_GeneratedProxy.png[Proxy image]
-
-On stub side it looks like this.
-
-.Stub Classes
-image::{imagedir}/Diag_GeneratedStub.png[Stub image]
-
-Methods
-^^^^^^^
-
-Franca IDL supports the definition of ((methods)) and ((broadcasts)). Methods can have several in and out parameters; if an additional flag ((fireAndForget)) is specified, no out parameters are permitted. Broadcasts can have only out parameters. Methods without the +fireAndForget+ flag can return an error which can be specified in Franca IDL as an enumeration. For broadcasts an additional flag +selective+ can be defined. This flag indicates that the message should not be sent to all registered participants but that the service makes a selection.
-
-[NOTE]
-- In Franca IDL there is no difference between an asynchronous or synchronous call of methods; the CommonAPI will provide both. The user of the API can decide which variant he calls.
-- The CommonAPI does not provide the possibility to cancel asynchronous calls.
-
-For methods without the +fireAndForget+ flag an additional return value ((CallStatus)) is provided which is defined as enumeration:
-
-[source,{cppstr}]
-----
-enum class CallStatus {
- SUCCESS,
- OUT_OF_MEMORY,
- NOT_AVAILABLE,
- CONNECTION_FAILED,
- REMOTE_ERROR
-};
-----
-
-The +CallStatus+ defines the transport layer result of the call, i.e. it returns:
-
-- SUCCESS, if the remote call returned successfully.
-- OUT_OF_MEMORY, if sending the call or receiving the reply could not be completed due of a lack of memory.
-- NOT_AVAILABLE, if the corresponding service for the remote method call is not available.
-- CONNECTION_FAILED, if there is no connection to the communication medium available.
-- REMOTE_ERROR, if the sent remote call does not return (in time). *NOT* considered to be a remote error is an application level error that is defined in the corresponding Franca interface, because from the point of view of the transport layer the service still returned a valid answer. It *IS* considered to be a remote error if no answer for a sent remote method call is returned within a defined time. It is discouraged to allow the sending of any method calls without a defined timeout. This timeout may be middleware specific. This timeout may also be configurable by means of a Franca Deployment Model. It is *NOT* configurable at runtime by means of the Common API.
-
-For the return parameters a function object is created which is passed to the asynchronous method call. This function object can then be used directly in the client application as function pointer to a callback function or be bound to a function with a different signature. The usage of +std::bind+ is not enforced but must be possible. The bound callback function object will be called in any case:
-
-- If the call returns successfully: Once the remote method call successfully returns, the callback function object is called with SUCCESS for its CallStatus and any received parameters.
-- If a transport layer error occurs: If an error occurs that would trigger the method to return anything other but SUCCESS for its CallStatus, the callback has to be called with the corresponding CallStatus value. All other values that are input to the callback may remain unitialized in this case.
-
-The asynchronous call returns the CallStatus as ((future)) object. This allows the synchronization of asynchronous calls to a defined time. The future object will attain its value at the same time at which the callback function object is called.
-
-The following example shows the signatures of the generated functions. First, the Franca IDL example:
-
-[source,java]
-----
-package commonapi.examples
-
-interface ExampleInterface {
-
- version { major 1 minor 0 }
-
- method getProperty {
- in {
- UInt32 ID
- }
- out {
- String Property
- }
- error {
- OK
- NOT_OK
- }
- }
-
- method newMessage fireAndForget {
- in {
- String MessageName
- }
- }
-
- broadcast signalChanged {
- out {
- UInt32 NewValue
- }
- }
-
- broadcast signalSpecial selective {
- out {
- UInt32 MyValue
- }
- }
-}
-----
-
-See the generated function calls for the methods _getProperty_ and _newMessage_ on *proxy side*:
-
-[source,{cppstr}]
-----
-/* Calls getProperty with synchronous semantics. */
-virtual void getProperty(const uint32_t& ID, CommonAPI::CallStatus& callStatus, ExampleInterface::getPropertyError& methodError, std::string& Property);
-
-/* Calls getProperty with asynchronous semantics. */
-virtual std::future<CommonAPI::CallStatus> getPropertyAsync(const uint32_t& ID, GetPropertyAsyncCallback callback);
-
-/* Calls newMessage with Fire&Forget semantics. */
-virtual void newMessage(const std::string& MessageName, CommonAPI::CallStatus& callStatus);
-----
-
-- All const parameters are input parameters.
-- All non-const parameters will be filled with the returned values.
-- The CallStatus will be filled when the methods return and indicate either +SUCCESS+ or which type of error has occurred. In case of an error, *ONLY* the CallStatus will be set.
-- The provided callback of the asynchronous call will be called when the reply to this call arrives or an error occurs during the call. The +std::future+ returned by this method will be fulfilled at arrival of the reply. It will provide the same value for CallStatus as will be handed to the callback.
-
-On *stub side* the generated functions are part of the default stub (+ExampleInterfaceStubDefault.h+):
-
-[source,{cppstr}]
-----
-virtual void getProperty(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t ID, ExampleInterface::getPropertyError& methodError, std::string& Property);
-virtual void newMessage(const std::shared_ptr<CommonAPI::ClientId> clientId, std::string MessageName);
-----
-
-Note that it makes on the stub side no difference whether the function call was synchronous or asynchronous.
-
-On stub side the additional parameter of type _ClientId_ is passed. The _ClientId_ identifies a client sending a call to a stub. It is used to identify the caller within a stub and is supposed to be added by the middleware and can be compared using the == operator. The ClientId class is declared as:
-
-[source,{cppstr}]
-----
-class ClientId {
-public:
- virtual ~ClientId() { }
- virtual bool operator==(ClientId& clientIdToCompare) = 0;
- virtual std::size_t hashCode() = 0;
-};
-----
-
-The pure virtual methods operator==() and hascode() have to be implemented by the middleware specific binding. Note that the value of the ClientId itself is irrelevant for CommonAPI. As API only the comparison operator is offered; the middleware specific identifier could be of any size as long as it is unique. The method hascode() is there so that the ClientId can be used as key in a hashmap.
-
-If we now consider the broadcast methods the generated functions on *proxy side* are:
-
-[source,{cppstr}]
-----
-virtual SignalChangedEvent& getSignalChangedEvent() {
- return delegate_->getSignalChangedEvent();
-}
-
-virtual SignalSpecialSelectiveEvent& getSignalSpecialSelectiveEvent() {
- return delegate_->getSignalSpecialSelectiveEvent();
-}
-----
-
-These methods return a wrapper class for an event that provides access to the broadcast +signalChanged+ (see below in this specification the CommonAPI definition of events). The wrapper class provides the methods subscribe and unsubscribe. The private property +delegate_+ is used for forwarding the function call to the specific binding.
-
-The generated stub provides methods to fire the broadcasts and some hooks:
-
-[source,{cppstr}]
-----
-virtual void fireSignalChangedEvent(const uint32_t& NewValue);
-virtual void fireSignalSpecialSelective(const uint32_t& MyValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers = NULL);
-virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForSignalSpecialSelective();
-
-/* Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts. */
-virtual void onSignalSpecialSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event);
-/* Hook method for reacting accepting or denying new subscriptions */
-virtual bool onSignalSpecialSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> clientId);
-----
-
-Note that the Franca keyword _selective_ is implemented only on stub side by using the _ClientId_ and the provided hooks.
-
-[NOTE]
-The _ClientId_ can be generated only on the stub side due to middleware specific data that can be composed entirely arbitrary.
-
-Attributes
-^^^^^^^^^^
-
-An attribute of an interface is defined by name and type. Additionally the specification of an attribute can have two flags:
-
-- +noSubscriptions+
-- +readonly+
-
-CommonAPI provides a basic implementation of the attribute interface and a mechanism for so-called ((extensions)). The basic implementation is shown in the example below. There are four possible combinations of flags:
-
-- standard attributes with no additional flag.
-- readonly attributes (readonly flag is set).
-- non observable attributes (noSubscription flag).
-- and non observable and non writable attributes (both flags are set).
-
-Attributes which are non readable but only writable are not supported by Franca IDL and CommonAPI.
-
-Template classes for each of those four types of attributes are defined in the header file Attribute.h. The CommonAPI provides a getter function which returns a reference to an instance of the appropriate attribute template class.
-
-.Attributes
-image::{imagedir}/Diag_Attributes.png[Attribute image]
-
-Observable attributes provide a ChangedEvent which can be used to subscribe to updates to the attribute. This Event works exactly as all other events (see description below). By default, the attributes are not cached in client side. Creating a cache on client side is not an implementation-specific detail that should be a part of the logical interface specification, nor is it a platform- or middleware-dependent parameter. Moreover, the requirements for an attribute cache can be very different depending on the application specific use case. Differences in points of view include, but are not limited to:
-
-- Is the cache value to be updated on any value changed event or is it to be updated periodically?
-- Should calls to getters of potentially cached values be blocking or non-blocking?
-- Should caching be configurable per attribute or per proxy, or should caching always be enabled?
-- Is getting a cached value a distinct method call or is it to be included transparently within the standard getter methods?
-
-Because of this, there is a general scheme to include individual extensions in order to provide any additional features for attributes (Attribute Extensions). This would prevent an exponential growth of configuration possibilities within the Common API and also relieve Common API developers from the necessity to always implement all specified features for their specific middleware, regardless of whether the feature is supported by the middleware or not. On the other hand, it gives complete freedom to application developers to add an implementation for their specific needs to attribute handling.
-
-The basic principle is that the user of the API has to implement an extension class that is derived from the base class +AttributeExtension+. The +AttributeExtension+ is packed in a wrapper class which in turn is generated for each attribute the Proxy has. A wrapper for a given attribute only then is mixed into the proxy if an extension for this given attribute is defined during construction time. The wrapper forwards the correct attribute to the constructor of the extension, so that the extension sees nothing but the attribute it should extend. Wrappers are written as templates, so that all wrappers can be reused for all attributes of the same category. As soon as an extension for an attribute is defined during construction time, the extension class will be instantiated and a method to retrieve the extended attribute will be added to the proxy.
-
-Such an solution requires the proxy to be made ready for mixins. The proxy inherits from all mixins that are defined during construction time, so that their interface is added directly to the proxy itself. The interface that would be added to the proxies in our case would be the interface of the defined attribute extension wrappers, which in turn provide access to the actual attribute extensions. By using variadic templates the amount of possible mixins is arbitrary.
-
-[NOTE]
-Because a given proxy may not inherit from the same class twice, only one extension per attribute per proxy is possible.
-
-The base class for extensions is defined in +AttributeExtension.h+.
-
-The CommonAPI for attributes on *stub side* looks like this when we only consider the attribute +A+:
-
-[source,{cppstr}]
-----
- public:
- virtual const uint32_t& getAAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId);
- virtual void setAAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t value);
-
- protected:
- virtual bool trySetAAttribute(uint32_t value);
- virtual bool validateAAttributeRequestedValue(const uint32_t& value);
- virtual void onRemoteAAttributeChanged();
-----
-
-The attribue +A+ is stored in the default implementation of the stub class as private member and via CommonAPI accessible by calling the corresponding get function. CommonAPI defines furthermore three callbacks to handle remote set events related to the attributes defined in the IDL description for ExampleInterface.
-
-- The first, +validate<AttributeName>RequestedValue+, allows for verification of the attribute value before it actually is set. This callback receives the new requested value and should return true if the operation is possible or false if the operation cannot be completed at all. In the default case, this callback will return true.
-- The second, +trySet<AttributeName>Attribute+, setting and modification of the attribute value. This callback receives the new requested value as a reference and modifies this as needed. Additionally it returns true if the value was modified before setting, or false if it is set as requested. In the default case, this callback will return the same value and true (i.e. the new value for the attribute is accepted without further modifications).
-- The third callback, +onRemote<AttributeName>Changed+, is called if the new value of the attribute differs from the old, and allows the service to do arbitrary work in response to such an attribute change. This is called after the clients are informed of the change.
-
-These are protected to avoid exposing them to the API code, as they should only be called by the adapter. This is done via a generated class, the <interfaceName>StubRemoteEvent, which has access to these methods.
-
-The CommonAPI library will transmit any "attribute changed" event notifications to remote listeners after the verify callback but before the change callback, if and only if the value of the attribute actually has changed after verification.
-
-The default implementation of a generated stub does
-
-- nothing on method calls
-- return the new value of an attribute on a verify callback
-- do nothing on an attribute changed callback
-
-Events
-^^^^^^
-
-Events provide an asyncronous interface to remotely triggered actions. This covers broadcast methods in Franca IDL and change events for attributes Every proxy also provides an availabity event which can be used for notifications of the proxies status. The Events provide a subscribe and unsubscribe method which allow registration and de-registration of callbacks.
-
-The public interface of the event class is as follows:
-
-[source,{cppstr}]
-----
-template<typename ... _Arguments>
-class Event {
- public:
-
- typedef std::function<void(const _Arguments&...)> Listener;
- typedef std::function<SubscriptionStatus(const _Arguments&...)> CancellableListener;
- typedef std::list<CancellableListener> ListenersList;
- typedef typename ListenersList::iterator Subscription;
-
- class CancellableListenerWrapper;
-
- /* Subscribe a listener to this event.*/
- virtual inline Subscription subscribe(Listener listener);
- /*Subscribe a cancellable listener to this event.*/
- Subscription subscribeCancellableListener(CancellableListener listener);
- void unsubscribe(Subscription listenerSubscription);
-
- virtual ~Event() {}
-
-};
-----
-
-[NOTE]
-- You should not build new proxies or register services in callbacks from events. This can cause a deadlock or assert. Instead, you should set a trigger for your application to do this on the next iteration of your event loop if needed. The preferred solution is to build all proxies you need at the beginning and react to events appropriatly for each.
-- Do not call +unsubscribe+ inside a listener notification callback it will deadlock! Use cancellable listeners instead.
-
-Runtime
--------
-
-Loading the Middleware
-~~~~~~~~~~~~~~~~~~~~~~
-
-The Common API ((Runtime)) is the base class from which all class loading starts. The Common API Runtime accesses a config file to determine which specific middleware runtime library shall be loaded. Middleware libraries are either linked statically or are provided as shared objects (file extension .so), so they can be loaded dynamically. To make dynamic loading controllable, additional configuration parameters are available, see the chapter on "Configuration Files" below.
-
-The public interface of the runtime class provides the following functions:
-
-[width="100%",cols="50%asciidoc,50%"]
-|=========================================================
-|[source,{cppstr}]
-----
-static std::shared_ptr<Runtime>
-load();
-----
-|Loads the runtime for the default middleware binding. This can be one of the middleware bindings that were linked at compile time. It is the first middleware binding that is encountered when resolving bindings at runtime or the middleware binding that was configured as default in the corresponding configuration file (throws an error if no such binding exists). The function returns the runtime object for the default binding, or null if any error occurred.
-
-|[source,{cppstr}]
-----
-static std::shared_ptr<Runtime>
-load(LoadState& loadState);
-----
-|The _loadState_ is an enumeration that will be set appropriately after loading has finished or aborted. May be used for debugging purposes.
-
-|[source,{cppstr}]
-----
-static std::shared_ptr<Runtime>
-load(const std::string&
- middlewareIdOrAlias);
-----
-|Loads the runtime for the specified middleware binding. The given well known name can be either the well known name defined by a binding, or a configured alias for a binding.
-
-|[source,{cppstr}]
-----
-static std::shared_ptr<Runtime>
-load(const std::string&
- middlewareIdOrAlias,
- LoadState& loadState);
-----
-|
-
-|[source,{cppstr}]
-----
-std::shared_ptr<MainLoopContext>
-getNewMainLoopContext() const;
-----
-|Creates and returns a new MainLoopContext object. This context can be used to take complete control over the order and time of execution of the abstract middleware dispatching mechanism. Make sure to register all callback functions before subsequently handing it to createFactory(), as during creation of the factory object the callbacks may already be called.
-
-|[source,{cppstr}]
-----
-std::shared_ptr<Factory>
-createFactory(
- std::shared_ptr<MainLoopContext>
- mainLoopContext =
- std::shared_ptr<MainLoopContext>(NULL),
- const std::string factoryName = "",
- const bool nullOnInvalidName = false);
-----
-|In case mainloop integration shall be used, a std::shared_ptr<MainLoopContext> can be passed in. If no parameter is given, internal threading will handle sending and receiving of messages automatically. If the mainloop context is not initialized, no factory will be returned. If additional configuration parameters for the specific middleware factory shall be provided, the appropriate set of parameters may be identified by the _factoryName_. If a factoryName is provided, the parameter _nullOnInvalidName_ determines whether the standard configuration for factories shall be used if the specific parameter set cannot be found, or if instead no factory shall be returned in this case.
-
-|[source,{cppstr}]
-----
-std::shared_ptr<Factory>
-createFactory(const std::string
- factoryName,
- const bool nullOnInvalidName = false);
-----
-|
-
-|[source,{cppstr}]
-----
-virtual std::shared_ptr<ServicePublisher>
-getServicePublisher() = 0;
-----
-| Returns the ServicePublisher object for this runtime. Use the interface provided by the ServicePublisher to publish and de-publish the services that your application will provide to the outside world over the middleware represented by this runtime. A ServicePublisher exists once per middleware.
-|=========================================================
-
-
-Linking the Middleware at Compile Time
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-A specific Middleware runtime registers itself with the Common API Runtime during startup time via static initialization. Static initialization is done via a statically defined method in a +.cpp+ file with +__attribute\((constructor))+ as prefix. Within this method, registerRuntimeLoader of the Common API Runtime will be called. A specific middleware runtime needs to register itself with a well known string identifier, e.g. +DBus+ for a D-Bus middleware.
-
-The architecture was chosen this way in order to ease later support of dynamic linkage. No template based architecture was used to cross the boundary from Common API to a specific middleware, because template parameters can not be substituted dynamically.
-
-[source,{cppstr}]
-----
-__attribute__((constructor)) void registerDBusMiddleware(void) {
- Runtime::registerRuntimeLoader("DBus", &DBusRuntime::getInstance);
-}
-----
-
-[NOTE]
-These specification assumes that the operating system is Linux. For some reasons CommonAPI can be used for test purposes on Windows. Then, the procedure may be slightly different from the one described.
-
-Linking the Middleware at Runtime
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-CommonAPI supports the loading of Middleware specific libraries at runtime, without linking them to the executable beforehand. For this purpose, each Middleware binding library provides a struct defined as extern "C", which provides information on the well known name of the Middleware, plus a function pointer to its runtime loader.
-
-----
-extern "C" const CommonAPI::MiddlewareInfo middlewareInfo;
-----
-
-The type +CommonAPI::MiddlewareInfo+ is defined in CommonAPI/MiddlewareInfo.h:
-[source,{cppstr}]
-----
-typedef std::shared_ptr<Runtime> (*MiddlewareRuntimeLoadFunction) ();
-
-struct MiddlewareInfo {
- const char* middlewareName_;
- MiddlewareRuntimeLoadFunction getInstance_;
- Version version_;
-};
-----
-
-Factory
-~~~~~~~
-
-Create Factory
-^^^^^^^^^^^^^^
-
-The +CommonAPI::Factory+ class builds the proxies and registers stubs for a specific instance of a commonapi runtime (i.e. a particular binding) and connection. This class provides templated build methods which return particular instances of proxies according to the templates and passed address.
-
-[NOTE]
-If there are multiple connections to the rpc mechanism (not a specific service) multiple instances of Factory are needed.
-
-A CommonAPI factory can be obtained with:
-
-[source,{cppstr}]
-----
-//Loads default or first runtime binding defined in config file
-std::shared_ptr<CommonAPI::Factory> factory = CommonAPI::Runtime::load()->createFactory();
-
-//Loads a named runtime binding, either according to a well known name defined in the binding or a defined arbitrary alias as stated in the config file
-std::shared_ptr<CommonAPI::Factory> factory2 = CommonAPI::Runtime::load("namedBinding")->createFactory();
-----
-
-The code to generate a factory is equal on both sides (stub and proxy).
-
-The factory provides functions for the creation of the proxies and for determining the available services.
-
-[source,{cppstr}]
-----
-/* Get a pointer to the runtime of this factory.*/
-inline std::shared_ptr<Runtime> getRuntime();
-
-/* Get all instances of a specific service name available. Synchronous call.*/
-virtual std::vector<std::string> getAvailableServiceInstances(const std::string& serviceName, const std::string& serviceDomainName = "local") = 0;
-
-/* Is a particular complete common api address available. Synchronous call.*/
-virtual bool isServiceInstanceAlive(const std::string& serviceAddress) = 0;
-
-/ * Is a particular complete common api address available. Synchronous call.*/
-virtual bool isServiceInstanceAlive(const std::string& serviceInstanceID, const std::string& serviceName, const std::string& serviceDomainName = "local") = 0;
-----
-
-The asynchronous functions are defined analogously.
-
-Create Proxy Objects
-^^^^^^^^^^^^^^^^^^^^
-
-The factory provides at least two functions for building the proxy:
-
-[source,{cppstr}]
-----
-template<template<typename ...> class _ProxyClass, typename ... _AttributeExtensions >
-std::shared_ptr<_ProxyClass<_AttributeExtensions...> > buildProxy(const std::string& serviceAddress);
-
-template <template<typename ...> class _ProxyClass, template<typename> class _AttributeExtension>
-std::shared_ptr<typename DefaultAttributeProxyFactoryHelper<_ProxyClass, _AttributeExtension>::class_t> buildProxyWithDefaultAttributeExtension(const std::string& serviceAddress);
-----
-
-_isAvailable_ is a non-blocking check whether the remote service for this proxy currently is available. Always returns false until the availability of the proxy is determined. The proxy actively determines its availability status asynchronously and ASAP as soon as it is created, and maintains the correct state afterwards.
-
-- Calls to synchronous methods will block until the initial availability status of the proxy is determined. As soon as the availability status has been determined at least once, calls to synchronous methods will return NOT_AVAILABLE as value for the CallStatus whenever isAvailable() would return false.
-- Calls to asynchronous methods do not wait for the initial availability status to be determined. Calls to asynchronous methods will instantly call the given callback with NOT_AVAILABLE as value for the CallStatus whenever isAvailable() would return false.
-- You may subscribe to the ProxyStatusEvent in order to have a callback notified whenever the availability status of the proxy changes. It is guaranteed that the callback is notified of the proxy's currently known availability status at the same instant in which the subscription is done (i.e. the callback will most likely be called with a value of false if you subscribe for this event right after the proxy has been instantiated).
-
-The parameter +serviceAddress+ is the address at which the service that shall be accessed will be available. Semantically, this address consists of three parts, separated by colons:
-
-[width="80%",cols="3,10"]
-|=========================================================
-
-|Domain |
-The first part, defines in which domain the service is located.
-
-|ServiceID |
-The second part. This defines the name or type of the service that shall be accessed.
-
-|InstanceID |
-The third part. This defines the specific instance of this service that shall be accessed.
-
-|=========================================================
-
-Register Services
-^^^^^^^^^^^^^^^^^
-
-The Factory class provides a +registerService()+ and +unregisterService()+ method. These allow the activation and deactivation of services and stubs via a complete common api address and a provided stub. The usage is similar to that for Proxies, except that no object is returned. Included below is the header for Common API factory.
-
-Provider
-^^^^^^^^
-
-A ((provider)) is made up of two parts, the interface adapter and its helpers and the stub. The interface adapters need to be generated individually for each service, but they remain invisible to the application developer, except when designing a derived stub class.
-
-An interface adapter is responsible for serialization and deserialization of messages, as well as the dispatching of the (de-)serialized messages to a registered stub. The stub forwards the broadcasts that are fired by a call to the "fire<BroadcastName>" methods to the adapter via the held shared pointer in order to send them.
-
-An interface adapter for a specific middleware needs to be generated in order to provide dispatching and callback handling that matches the stub. The procedure to attain the correct interface adapter is equivalent to the procedure to attain the correct proxy on client side. A given instance of an interface handler can serve one and only one stub at a time. The connection from the adapter to the stub is established during build time by a call to the predefined initStubAdapter method of the Stub template class.
-
-The common ancestor of any middleware specific handler (+CommonAPI::StubAdapter+) and stub (+CommonAPI::Stub+) classes defines a basic interface to retrieve general information about the service.
-
-Stubs are the methods to be implemented by a provider. This includes the remotely callable methods defined in the interface and the callbacks for attribute accessors. These are provided as a default stub class with a default blank implementation for all methods and storage and handling of attribute values inside the stub, which allows the application developer to overwrite the methods in a subclass as needed. Alternatively the pure virtual root class can be implemented directly, which also allows delegation of attribute handlers to other parts of the code. A given instance of a stub can be appended to one and only one interface adapter.
-
-Threading Model
-~~~~~~~~~~~~~~~
-
-CommonAPI supports multithreaded execution (standard threading) as well as single threaded execution (i.e. ((mainloop) integration). The decision which of both is desired happens when +CommonAPI::Runtime::createFactory+ is called. If single threaded execution is desired, a +CommonAPI::MainLoopContext+ has to be created, and then has to be passed as an argument to this method. All objects that are created by a factory that was instantiated this way will be controllable via the mainloop context that was handed to this factory. If a factory is not given this parameter during instantiation, standard threading will be set up for all objects that are created by this factory.
-
-Standard Threading
-^^^^^^^^^^^^^^^^^^
-
-To create a factory that uses standard threading, a factory has to be created this way:
-
-[source,{cppstr}]
-----
-std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
-std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
-----
-
-Mainloop Integration
-^^^^^^^^^^^^^^^^^^^^
-
-A +CommonAPI::MainLoopContext+ provides nothing but hooks for callbacks that will be called on specific binding internal events. Internal events may be
-
-- (De-)Registration of a +CommonAPI::DispatchSource+
-- (De-)Registration of a +CommonAPI::Watch+
-- (De-)Registration of a +CommonAPI::Timeout+
-- Issuing of a wakeup call
-
-Each of these calls has to be mapped to an appropriate method in the context of the actual Mainloop that does the single threaded execution. CommonAPI does *NOT* provide a fully fledged implementation for a Mainloop!
-
-What the mainloop related interfaces are meant for is this:
-
-- +CommonAPI::DispatchSource+: Hooks that may have work ready that is to be done, e.g. dispatching a method call to a stub, dispatching a method return to a proxy callback and the like. There is no constraint on what kind of work may be represented by a DispatchSource, *BUT* a dispatch source may *NOT* be directly related to a file descriptor that is used to actually read or write the incoming or outgoing transmission from or to a transport!
-- +CommonAPI::Watch+: Work that is related to a file descriptor that is used for reading from or writing to a transport is represented by Watches. *ANY* work that is not directly related to such a file descriptor may *NOT* be represented by watches!
-- +CommonAPI::Timeout+: Represents the work that has to be done when a timeout occurs (e.g. deleting the structures that are used to identify an answer to an asynchronous call and calling the callback that is waiting for it with an appropriate error flag). A timeout stores internally both the interval of time within which it is to be dispatched, and the next moment in time the timeout is to be dispatched.
-
-A binding developer *MUST* provide his own implementations for at least DispatchSource and Watch in order to ensure the functionality of his respective CommonAPI binding in the single threaded case, and must ensure that the appropriate instances of those classes are handed to the application via the MainLoopContext that was handed to the factory that is used to instantiate proxies and stubs.
-
-An application developer *MAY* provide additional implementations of all these classes.
-
-[NOTE]
-During instantiation (i.e. during the call to +CommonAPI::Runtime::createFactory+) a binding *MAY* already issue calls to the callbacks that are registered with the +CommonAPI::MainLoopContext+. Therefore, it is mandatory to do any registration of required callbacks *BEFORE* doing so.
-
-To create a factory that supports Mainloop integration, a factory has to be created this way:
-
-[source,{cppstr}]
-----
-std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
-//Do any registration of callbacks for the actual Mainloop here!
-std::shared_ptr<CommonAPI::MainLoopContext> context = runtime->getNewMainLoopContext();
-std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory(context);
-----
-
-Configuring CommonAPI
-~~~~~~~~~~~~~~~~~~~~~
-
-Change the behavior of interfaces
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-There are basically two possibilities to realize a specific behavior of your interface or to realize new features:
-
-- As described above the middleware implementation can be changed without changing the API for the applications. Changes in the configuration in the middleware or platform can be realized by changing the deployment specification and the deployment settings in the *.depl files.
-- For attributes (see specification below) there is the possibility to define and implement so-called extensions. This allows the developer to extend the standard framework with own implementations in a predefined and specified way. One example is to implement a cache for attributes on proxy side.
-
-Configuration Files
-^^^^^^^^^^^^^^^^^^^
-
-Each CommonAPI configuration file will define additional parameters for specific categories. Which categories and which parameters for each of those categories are available will be detailed below. All parameters for all categories are optional. For each omitted parameter a reasonable default will be set. Because of this, it is not mandatory to provide a config file unless you want to alter any of the configurable default values.
-
-CommonAPI config files can be defined locally per binary, globally per binary or globally for all binaries. If more than one config file is defined for a given binary (e.g. one locally and one globally) and a given category is defined in several of these config files, for each parameter that may be provided for this category the value found in the most specific config file will take precedence. If a category is defined several times within the same config file, the first occurrence of each parameter will take precedence.
-
-All categories and all parameters are separated from each other by one or more newline characters.
-
-CommonAPI Config files have to be named this way:
-
-- Binary local: "<FqnOfBinary>.conf", e.g. "/usr/bin/myBinary.conf" if the binary is "/usr/bin/myBinary"
-- Binary global: "/etc/CommonApi/<NameOfBinary>.conf", e.g. "/etc/CommonAPI/myBinary.conf"
-- Global: "/etc/CommonAPI/CommonAPI.conf"
-
-Available categories
-++++++++++++++++++++
-
-_Well known names of specific middleware bindings_
-
-Allows to set parameters that influence the loading procedure of specific middleware bindings.
-
-The syntax is:
-
-----
-{binding:<well known binding name>}
-libpath=<Fully qualified name of the library of the binding>
-alias=<One or more desired aliases for the binding, separated by ":">
-genpath=<One or more fully qualified names to libraries containing additional (generated) code for this binding, separated by ":">
-default
-----
-
-- *libpath*: Provides a fully qualified name that replaces the search path when trying to dynamically load the identified binding.
-** The library found at libpath will take precedence over all other dynamically discoverable libraries for this binding.
-** If a library for the specified middleware binding is linked to the binary already, this parameter will have no effect.
-** Not finding an appropriate library at libpath is considered to be an error! In this case, no further attempts to resolve the library will be made, and the load function will return an empty std::shared_ptr<CommonAPI::Runtime>.
-** If an explicit error state is desired, one of the overloaded Runtime::load() functions may be called to pass in an instance of Runtime::LoadState as argument.
-
-- *alias*: In order to load a specific middleware binding, one normally has to know the well known name of the middleware (e.g. "DBus" for the D-Bus middleware binding) and pass this name as parameter when calling CommonAPI::Runtime::load("<name>"). _alias maps the well known name for this purpose to one or more arbitrary aliases, thereby decoupling the loading of a specific middleware binding from its specific name.
-** You *MAY* specify this parameter more than once for a binding. The effect will be the same as if you had one alias parameter specifying the exact same names separated by ":".
-** If the same alias is specified more than once, only the first occurrence of the alias will be considered.
-** As CommonAPI itself does not know about which well known middleware names there are, it is possible to specify the well known name of an actual binding as an alias for any other middleware binding. In this case, the actual middleware binding will not be accessible any longer, unless you specify another unique alias for it.
-- *genpath*: Specifies one or more paths at which a generic library containing additional (e.g. generated middleware and interface code for the middleware binding is to be found. This additional code will be injected when the specific middleware considers it to be the right time to do so.
-** You *MAY* specify this parameter more than once for a binding. The effect will be the same as if you had one genpath parameter specifying the exact same values separated by ":".
-** If No such parameter is defined, the standard search paths "/usr/lib" and "/usr/local/lib" plus any additional paths defined in the environment variable COMMONAPI_BINDING_PATH (see below) will be searched for any libraries that match the name pattern "lib<wellKnownMiddlewareName>Gen-<arbitraryName>.so[.major.minor.revision]". All matching libraries will be loaded.
-** Not finding an appropriate library at any single one of the defined genpaths may result in undefined behavior.
-- *default*: Specifies the library for this binding as the default that is to be loaded if no parameter is given to CommonAPI::Runtime::load().
-** Not finding an appropriate library for a configured default binding at neither specified nor the default paths is considered to be an error! In this case, no further attempts to resolve the library will be made, and the load function will return an empty std::shared_ptr<CommonAPI::Runtime>. If an explicit error state is desired, one of the overloaded Runtime::load() functions may be called to pass in an instance of Runtime::LoadState as argument.
-
-[NOTE]
-The genpath parameter will be parsed by the CommonAPI framework and stored in the singleton class CommonAPI::Configuration. Actually loading the libraries and following the rules described here however is task of the specific middleware binding. You might want to use the convenience methods provided in <CommonAPI/utils.h> for this purpose. By taking control of the actual proceedings, you may introduce additional mechanisms of discovering and loading such libraries, and you may defer the loading of these libraries until you deem it to be the right time to do so.
-
-Environment Variables
-^^^^^^^^^^^^^^^^^^^^^
-
-- *COMMONAPI_BINDING_PATH*: By default, the standard paths "/usr/lib" and "/usr/local/lib" will be searched for binding libraries that are loaded dynamically (i.e. at runtime without linking them to the binary beforehand). All paths defined in this environment variable will take precedence over those two default paths. Separator between several paths is ":".
-
-[glossary]
-Glossary
---------
-
-[glossary]
-BLOB::
- Binary Large Object.
-
-IDL::
- Interface Description Language.
-
-IPC::
- Interprocess Communication.
-
-GENIVI::
- is a non-profit industry alliance committed to driving the broad adoption of an In-Vehicle Infotainment (IVI) open-source development platform.
-
-
-ifdef::backend-docbook[]
-[index]
-Example Index
--------------
-////////////////////////////////////////////////////////////////
-The index is normally left completely empty, it's contents being
-generated automatically by the DocBook toolchain.
-////////////////////////////////////////////////////////////////
-endif::backend-docbook[]
-
diff --git a/docx/Makefile b/docx/Makefile
index 4e146aa..a69bcb3 100644
--- a/docx/Makefile
+++ b/docx/Makefile
@@ -10,15 +10,7 @@ commonapi_version=$(PROJECT_VERSION)
all: doc
-doc: readme_html spec_html spec_pdf tut_html tut_pdf test_html test_pdf
-
-readme_html: docgendir
- mkdir -p $(htmldocgendir)
- asciidoc \
- -a version=$(commonapi_version) \
- -a tabsize=4 \
- -o $(htmldocgendir)/readme.html \
- ../README
+doc: spec_html spec_pdf ug_html ug_pdf test_html test_pdf
spec_html: docgendir
mkdir -p $(htmldocgendir)
@@ -30,8 +22,8 @@ spec_html: docgendir
-a version=$(commonapi_version) \
-a cppstr=cpp \
-a tabsize=4 \
- -o $(htmldocgendir)/CommonAPISpecification.html \
- CommonAPISpecification
+ -o $(htmldocgendir)/CommonAPICppSpecification.html \
+ CommonAPICppSpecification
spec_pdf: docgendir
mkdir -p $(pdfdocgendir)
@@ -46,9 +38,9 @@ spec_pdf: docgendir
--dblatex-opts "-P latex.output.revhistory=0" \
--icons \
-D $(pdfdocgendir) \
- CommonAPISpecification
+ CommonAPICppSpecification
-tut_html: docgendir
+ug_html: docgendir
mkdir -p $(htmldocgendir)
asciidoc -a revdate=$(datestring) \
-a icons \
@@ -58,10 +50,10 @@ tut_html: docgendir
-a cppstr=cpp \
-a tabsize=4 \
-b html \
- -o $(htmldocgendir)/Tutorial.html \
- Tutorial
+ -o $(htmldocgendir)/CommonAPICppUserGuide.html \
+ CommonAPICppUserGuide
-tut_pdf: docgendir
+ug_pdf: docgendir
mkdir -p $(pdfdocgendir)
a2x \
-a revdate=$(datestring) \
@@ -74,7 +66,7 @@ tut_pdf: docgendir
--dblatex-opts "-P latex.output.revhistory=0 -P imagedata.default.scale=maxwidth=10cm,maxheight=8cm" \
--icons \
-D $(pdfdocgendir) \
- Tutorial
+ CommonAPICppUserGuide
test_html: docgendir
mkdir -p $(htmldocgendir)/tests
diff --git a/docx/Tutorial b/docx/Tutorial
deleted file mode 100644
index 742a6b6..0000000
--- a/docx/Tutorial
+++ /dev/null
@@ -1,705 +0,0 @@
-CommonAPI C++ Tutorial
-======================
-:author: Juergen Gehring - juergen.gehring@bmw.de
-:doctitle: CommonAPI C++ Tutorial
-:website: http://projects.genivi.org/commonapi/
-:version:
-:date:
-:toc:
-:revdate:
-:imagedir:
-:cppstr: c++
-
-Introduction
-------------
-
-This tutorial has the following content:
-
-- installation instructions for CommonAPI and CommonAPI-DBus including the tools
-- a step by step tutorial on how you can write your first Hello World program
-- some examples with description which show the usage of CommonAPI in conjunction with Franca IDL
-- some special topics like deployment or the communication with legacy D-Bus applications
-
-Common API and its mechanism specific bindings (e.g. Common API D-Bus) provide a set of libraries and tools to work with RPC communication in a way independent of wich mechanism is used. Once you have implemented your services and clients and tested it with D-Bus you later can switch D-Bus for any other communication layer (provided it has Common API support) _without the need to touch your code or your binary at all!_.
-
-Further information on Common API and Common API D-Bus is provided in the individual README files accompanying both packages.
-
-Getting started
----------------
-
-CommonAPI is a GENIVI project. Source code and latest news can be found at http://projects.genivi.org/commonapi/.
-
-For documentation please visit the GENIVI document page http://docs.projects.genivi.org/.
-
-CommonAPI currently consists of four sub-projects:
-
-[width="80%",cols="3,10"]
-|=========================================================
-
-|CommonAPI |
-This is the base C++ library, which provides the application interface for users and can load runtime bindings such as dbus.
-
-|CommonAPI-Tools |
-The eclipse based tools for CommonAPI. This is essentially the code generator for Franca -> Common API C++ code. (This is the current package.)
-
-|CommonAPI-D-Bus |
-This is the D-Bus binding C++ library, which provides the necessary code to communicate over D-Bus. This is invisible to the application code, and simply needs to be linked against.
-
-|CommonAPI-D-Bus-Tools |
-The eclipse based tools for CommonAPI D-Bus. This is the code generator for Franca -> Common API D-Bus C++ code.
-
-|=========================================================
-
-Closely related to CommonAPI is the yamaica project which provides a full integration of all Franca IDL and CommonAPI plugins and some more enhanced features like the import and export of Franca files to Enterprise Architect (see http://projects.genivi.org/yamaica/). The yamaica project provides eclipse update-sites for CommonAPI and yamaica (see http://docs.projects.genivi.org/yamaica-update-site/) ready for installation.
-
-Before we proceed you should clarifiy whether you are a user, in the sense that you want to write applications based on CommonAPI or whether you want to contribute to CommonAPI yourself or write your own middleware specific binding.
-
-Requirements
-~~~~~~~~~~~~
-- Code generator and Franca tooling are based on Eclipse. Please make sure that you have an appropriate Eclipse version installed.
-- Make sure all requirements to build the CommonAPI Runtime are installed and in the correct version. CommonAPI was developed using gcc 4.6 and gcc 4.7, but is feature compatible to gcc 4.5 and compiler compatible to gcc 4.4.
-
-Set up your environment as CommonAPI user
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-CommonAPI Tools
-^^^^^^^^^^^^^^^
-
-The CommonAPI Tools are available as Eclipse update-site or (if you prefer not to use Eclipse) as commandline tool.
-
-First we assume that you use an Eclipse CDT development environment. Please make sure that you have installed Franca IDL first before you continue with installing the CommonAPI Tools. Please find the installing instructions for Franca IDL at https://code.google.com/a/eclipselabs.org/p/franca/.
-
-The simplest way to use the CommonAPI Tools is to add the update site available on the GENIVI project servers to your Eclipse. This is available under:
-
-Help->Install New Software->Add Button
-
-Enter the following URL: http://docs.projects.genivi.org/yamaica-update-site/CommonAPI/updatesite/ and confirm. This provides CommonAPI, CommonAPI-D-Bus, CommonAPI Validator and all dependencies. Then select the newly added site in the site selection dropdown box, and in the Software selection window, select the entire "GENIVI CommonAPI Generators" Tree. Ignore all the other entries in the selection part of the "Available Software" window.
-
-After the software has been installed in Eclipse you can right-click on any .fidl file and generate C++ code for CommonAPI D-Bus by selecting the "CommonAPI->Generate Common API Code" option.
-
-[NOTE]
-- The CommonAPI Validator must not necessarily be installed. But he recognizes Franca language constructs that Franca IDL permits, but result in non-executable or non-compilable code. An example is the use of C++ keywords in the interface specification.
-- From Franca IDL, you will only need to install the sub-category "Franca Feature" for the Common API and Common API D-Bus generators to work.
-
-
-If you want to use the command line version of the code generator, you can get the actual version at:
-
-http://docs.projects.genivi.org/yamaica-update-site/CommonAPI/generator/
-
-where should be a link to the git repository:
-
-http://git.projects.genivi.org/yamaica-update-site.git/
-
-For the usage of the command line version please consider the README file of the CommonAPI-Tools project.
-
-CommonAPI Runtime
-^^^^^^^^^^^^^^^^^
-
-Download the Common API runtime via git from the download site of http://projects.genivi.org/commonapi/, then compile and install the library on your computer:
-
-----
-$ git clone git://git.projects.genivi.org/ipc/common-api-runtime.git
-$ cd common-api-runtime
-$ autoreconf -i
-$ ./configure
-$ make
-$ sudo make install (or alternative install process, eg. checkinstall on debian-based distributions, such as Ubuntu)
-----
-
-With this, the Common API runtime library will be installed in +/usr/local/lib+. The package is accessible for your application e.g. via pkgconfig. The pkgconfig data is located at /usr/local/lib/pkgconfig.
-
-To build Common API D-Bus, the Common API runtime and libdbus version 1.4.16 patched with the marshaling patch must be available through PkgConfig. The marshalling patch is provided within the Common API D-Bus package.
-
-Download the Common API D-Bus library via git from the download site of http://projects.genivi.org/commonapi/:
-
-----
-$ git clone git://git.projects.genivi.org/ipc/common-api-dbus-runtime.git
-----
-
-Download, patch and install version 1.4.16 of libdbus (*WARNING*: _Not_ following these instructions may result in corruption of the preinstalled libdbus library of your computer, thereby rendering your system unusable):
-
-----
-$ wget http://dbus.freedesktop.org/releases/dbus/dbus-1.4.16.tar.gz
-$ tar -xzf dbus-1.4.16.tar.gz
-$ cd dbus-1.4.16
-$ patch -p1 < </your/commonapi/path>/common-api-dbus-runtime/dbus-DBusMessage-add-support-for-custom-marshaling.patch
-$ ./configure --prefix=/usr/local
-$ make -C dbus
-$ sudo make -C dbus install
-$ sudo make install-pkgconfigDATA
-----
-
-The path to CommonAPI and patched libdbus pkgconfig files must be added to the +PKG_CONFIG_PATH+ for the rest of the entire build process.
-If you followed the instructions above, both will be located in +/usr/local/lib/pkgconfig+, so you can just type:
-
-----
-$ export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
-----
-
-[NOTE]
-If you want to make sure that you do not destroy your linux installation then it is also possible not to install the patched lidbus. In this case you just have to set your package config path correctly.
-
-Now, compile and install the Common API D-Bus library on your computer
-
-----
-$ cd </your/download/path>/common-api-dbus-runtime
-$ autoreconf -i
-$ ./configure
-$ make
-$ sudo make install (or alternative install process, eg. checkinstall on debian-based distributions, such as Ubuntu)
-----
-
-With this, the libraries for Common API and Common API D-Bus are installed and ready for use.
-
-[NOTE]
-- If you prefer to install CommonAPI from a tar file you can get the actual tar file from:
-http://docs.projects.genivi.org/yamaica-update-site/CommonAPI/runtime/
-- In Linux please don't forget to add the installation path of your CommonAPI libraries to your LD_LIBRARY_PATH environment variable.
-
-Set up your environment as CommonAPI contributor
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Preliminary remarks
-^^^^^^^^^^^^^^^^^^^
-
-First get the code from the git:
-----
-$ git clone
-----
-
-Get an overview of all branches:
-----
-$ git branch
-----
-
-Switch to the branch you want to work on (master is the feature branch) and verify that it has switched (* changed)
-----
-$ git checkout <your branch>
-$ git branch
-----
-
-Best practice is to create a local branch based on the current branch:
-----
-$ git branch working_branch
-----
-
-Start working, best practice is to commit smaller, compilable pieces during the development process that makes it easier to handle later on. If you want to commit you changes, send them to the author, you can create a patch like this:
-
-----
-$ git format-patch working_branch <your branch>
-----
-
-This creates a set of patches that are published via the mailing list.The patches will be discussed and then merged & uploaded on the git by the maintainer.
-
-Patches can be accepted either under GENIVI Cla or MPL 2.0 (see section License). Please be sure that the signed-off-by is set correctly. For more, check out http://gerrit.googlecode.com/svn/documentation/2.0/user-signedoffby.html
-
-CommonAPI Tools
-^^^^^^^^^^^^^^^
-
-For the build instructions of the CommonAPI tools with maven see again the README file.
-
-Hello World
------------
-
-The examples of the use of Franca IDL in conjunction with CommonAPI can be found in the folder CommonAPI-Examples in the subproject CommonAPI tools. The first example substantially contains the code for the Hello World example, which will be described below. But even if the code already exists, it is recommended to build the sample from scratch on for a better understanding of the individual steps.
-
-It is assumed that you have created a C++ project in your Eclipse in which all further development will happen.
-
-Creating the RMI interface definition
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-The first step in developing a Common API application likely will be the definition of the RMI interface the client will use to communicate with the server. In the context of CommonAPI, the definition of this interface always happens via the Franca IDL, regardless of which communication mechanism you intend to use in the end. For this tutorial, create an arbitrarily namend file ending in _.fidl_ in your Eclipse project. It is
-not relevant where in your project you have placed this file, as the the code generated from this file will always be put in the automatically created src-gen folder at the top level of the project hierarchy.
-
-Open your newly created _.fidl_-file, and type the following lines:
-
-[source,java]
-----
-package commonapi.examples
-
-interface e01HelloWorld {
- version { major 1 minor 0 }
-
- method sayHello {
- in {
- String name
- }
- out {
- String message
- }
- }
-}
-----
-
-[NOTE]
-The _version_ parameter in every interface is mandatory! No code will be generated if it is malformed or not present!
-
-
-Now, save the _.fidl_ file and right click it. As you have installed the Common API and Common API D-Bus generators, you will see a menu item saying _"Common API"_, with sub menu items for generating either the Common API level code only ("_Generate C\++ Code_") or for generating both the Common API level code and the glue code required to run applications with using Common API D-Bus ("_Generate D-Bus C++ Code_").
-
-Generating code
-~~~~~~~~~~~~~~~
-
-We do want to use D-Bus as middleware, so we will need the D-Bus specific glue code as well as the Common API level code which we will
-program agains. Therefore, you might want to chose the latter of the two options provided by the generator plugin ("_Generate D-Bus C++ Code_").
-After having done so, you will see the newly created src-gen folder and it's contents. The files will be created according to their
-fully qualified names relative to src-gen as the top level folder, as defined in the _.fidl_-file:
-
-----
-E01HelloWorld.h
-E01HelloWorldProxy.h
-E01HelloWorldProxyBase.h
-E01HelloWorldStub.h
-E01HelloWorldStubDefault.cpp
-E01HelloWorldStubDefault.h
-
-E01HelloWorldDBusProxy.cpp
-E01HelloWorldDBusProxy.h
-E01HelloWorldDBusStubAdapter.cpp
-E01HelloWorldDBusStubAdapter.h
-----
-
-All files that have a "DBus" in their name are glue code required by the D-Bus binding and are not relevant while developing your application, they only need to be compiled with your application (there are ways to NOT compile these sources with your applications and include them at runtime instead; see the README of Common API D-Bus for details).
-
-All other files that have a _Proxy_ in their name are relevant for you if you develop a client, all other files that have a _Stub_ in their name are relevant for you if you develop a service. A proxy is a class that provides method calls that will result in remote method invocations on the service, plus registration methods for events that can be broadcasted by the service.
-
-A stub is the part of the service that will be called when a remote method invocation from a client arrives. It also contains methods to fire events (broadcasts) to several or all clients. The Stub comes in two flavors: One default stub that contains empty implementations of all methods, thereby allowing you to implement only the ones you are interested in, and a Stub skeleton where you have to implement everything yourself before you can use it. A service will have to implement a subclass of either of the two in order to make itself available to the outside world (or just use the default stub if your service should not be able to do anything except firing events).
-
-In this tutorial, we will create both a client and a service in order to be able to see some communication going on.
-
-Implement the Client
-~~~~~~~~~~~~~~~~~~~~
-
-Start by creating a new .cpp source file in your project (e.g. e01HelloWorldClient.cpp). Make sure you have a main method in order to start the client application.
-
-Here, you will need two includes in order to access the Common API client functionality:
-
-[source,{cppstr}]
-----
-#include <iostream>
-
-#include <CommonAPI/CommonAPI.h> //Defined in the Common API Runtime library
-#include <commonapi/examples/E01HelloWorldProxy.h> //Part of the code we just generated
-----
-
-The first thing each and every Common API application will do is to load a runtime:
-
-[source,{cppstr}]
-----
-std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
-----
-
-If you link the Common API DBus library to and compile the generated DBus specific code with your executable, this runtime "magically" will be a runtime that provides access to the DBus communication infrastructure via a strictly CommonAPI level interface. If you link the library and add the generated code of another Common API middleware binding instead, this runtime will provide access to this other communication infrastructure.
-
-In order to be able to communicate with a specific service, we need a proxy. We can create a proxy by using a factory, which in turn we can get from the runtime we just created:
-
-[source,{cppstr}]
-----
-std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
-const std::string& serviceAddress = "local:commonapi.examples.HelloWorld:commonapi.examples.HelloWorld";
-std::shared_ptr<E01HelloWorldProxy<>> myProxy = factory->buildProxy<E01HelloWorldProxy>(serviceAddress);
-----
-
-The parameter _serviceAddress_ is the address at which the service that shall be accessed will be available. This address will be translated internally to an actual DBus-Address - or whatever format fits the communication infrastructure you use. Semantically, this address consists of three parts, separated by colons:
-
-[width="80%",cols="3,10"]
-|=========================================================
-
-|Domain |
-The first part, defines in which domain the service is located. For DBus use cases, only "local" makes any sense, as no services that are more remote than "on the same operating system" are accessible.
-
-|ServiceID |
-The second part. This defines the name or type of the service that shall be accessed.
-
-|InstanceID |
-The third part. This defines the specific instance of this service that shall be accessed.
-
-|=========================================================
-
-There are ways to influence the translation of the Common API address to the specific address (of course once again without the need to change your code). Please have a look at the README of Common API DBus if you want to know more about this possibility in the context of DBus, or the corresponding documentation of the other middleware binding you are using.
-
-With this, the client is set up and ready to use. We should wait for the service to be available, then we can start issuing calls:
-
-[source,{cppstr}]
-----
-while (!myProxy->isAvailable()) { usleep(10); }
-
-const std::string name = "World";
-CommonAPI::CallStatus callStatus;
-std::string returnMessage;
-
-myProxy->sayHello(name, callStatus, returnMessage);
-if (callStatus != CommonAPI::CallStatus::SUCCESS) {
- std::cerr << "Remote call failed!\n";
- return -1;
-}
-std::cout << "Got message: '" << returnMessage << "'\n";
-----
-
-Implement the Service
-~~~~~~~~~~~~~~~~~~~~~
-
-Works about the same way as implementing the client. The includes that are required are the following:
-
-[source,{cppstr}]
-----
-#include <iostream>
-#include <thread>
-
-#include <CommonAPI/CommonAPI.h>
-#include "E01HelloWorldStubImpl.h"
-----
-
-And we also need a stub that actually does something when the method we call in the client gets called:
-
-[source,{cppstr}]
-----
-void E01HelloWorldStubImpl::sayHello(const std::shared_ptr<CommonAPI::ClientId> clientId,
- std::string name, std::string& message) {
-
- std::stringstream messageStream;
-
- messageStream << "Hello " << name << "!";
- message = messageStream.str();
- std::cout << "sayHello('" << name << "'): '" << message << "'\n";
-};
-----
-
-The rest looks quite similar to the client side, with the difference that we do not issue calls via a proxy, but instead register a service that then
-will be provided to the outside world. The service is registered using the same Common API address, which allows the proxy to actually find the service.
-Afterwards, we just wait for calls:
-
-[source,{cppstr}]
-----
-std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
-std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
-std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher =
- runtime->getServicePublisher();
-
-const std::string& serviceAddress =
- "local:commonapi.examples.HelloWorld:commonapi.examples.HelloWorld";
-
-std::shared_ptr<E01HelloWorldStubImpl> myService =
- std::make_shared<E01HelloWorldStubImpl>();
-
-servicePublisher->registerService(myService, serviceAddress, factory);
-
-while(true) {
- std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl;
- std::this_thread::sleep_for(std::chrono::seconds(60));
-}
-----
-
-Running the Demo
-~~~~~~~~~~~~~~~~
-
-Build the two applications using your favourite build system. If all worked well, you should see communication ongoing via DBus (e.g. via dbus-monitor), and you should get output from your client once, saying
-
-----
-"Got Message: 'Hello World'".
-----
-
-Advanced Topics
----------------
-
-Special Franca Features
-~~~~~~~~~~~~~~~~~~~~~~~
-
-Selective
-^^^^^^^^^
-
-Selective broadcasts, indicated with the selective keword after the name of the broadcast in Franca can be sent to individual clients rather
-than all participants. This is accomplished with the use of a ClientID parameter which can serve to identify the targets. Note if you wish to
-identify clients absolutely you must do this on the application level.
-
-We can add a block to our interface for the selective broadcast:
-
-[source,java]
-----
-broadcast saySomething selective {
- out {
- String message
- }
-}
-----
-
-We can the add some code to our stub implementation to handle this:
-
-[source,{cppstr}]
-----
-virtual void onSaySomethingSelectiveSubscriptionChanged(
- const std::shared_ptr<CommonAPI::ClientId> clientId,
- const CommonAPI::SelectiveBroadcastSubscriptionEvent event) {
-
- if (event == CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED) {
- lastId = clientId;
- }
-}
-----
-
-and to the sayHello method:
-
-[source,{cppstr}]
-----
-std::shared_ptr<CommonAPI::ClientIdList> receivers =
- std::make_shared<CommonAPI::ClientIdList>();
-
-if (lastId) {
- receivers->insert(lastId);
-}
-
-this->fireSaySomethingSelective("Broadcast to last ID", receivers);
-----
-
-and finally a member to the stub:
-
-[source,{cppstr}]
-----
-private:
- std::shared_ptr<CommonAPI::ClientId> lastId;
-----
-
-The onSaySomethingSelectiveSubscriptionChanged method is called when a subscription for this boroadcast changes. Is added, we set the memeber lastId to this value. Whenever sayHello is called we now also send a broadcast only to the last client which registered. The ClientIdList contains all the intended recipients, and the middleware will send the message to all memeber of this list who are registered for the broadcast. If NULL is passed instead the broadcast is sent to all clients.
-
-On the client side we can add this before the const std::string name = "World"; line:
-
-[source,{cppstr}]
-----
-helloWorldProxy->getSaySomethingSelectiveEvent().subscribe(
- [&](const std::string& message) {
- std::cout << "Received broadcast message: " << message << "\n";
-});
-----
-
-This casues a subscription to the broadcast, and the lambda function will be called whenever we receive a message.
-
-Managed Stubs
-^^^^^^^^^^^^^
-
-In Franca a relationship between two interfaces can be declared in the form "x manages y". This indicates that x has a number of y as childeren whose lifecycle is tied to and managed by x. This allows a an application to activare y stubs on an instance of x stubs. Similarily on the proxy side a manager for y interfaces is available on the x proxy, where we can be informed of appearing and disappearing instances, and interrogate the network about the state of instances.
-
-In our Franca file change the defenition of the HelloWorldInterface to:
-
-[source,java]
-----
-interface HelloWorldInterface manages HelloWorldLeaf {
-----
-
-and after this interface block add:
-
-[source,java]
-----
-interface HelloWorldLeaf {
- version { major 1 minor 0 }
-
- method sayHelloLeaf {
- in {
- String name
- }
- out {
- String message
- }
- }
-}
-----
-
-This causes HelloWorldInterface to be able to manage HelloWorldLeaf instances. Note that HelloWorldLeaf instances can still be registered and accessed in the normal way via the service publisher and factory. To the stub application add to the top as a new class defenition:
-
-[source,{cppstr}]
-----
-class MyHelloWorldLeafStub: public commonapi::examples::HelloWorldLeafStubDefault {
- public:
- virtual void sayHelloLeaf(std::string name, std::string& message) {
- std::stringstream messageStream;
-
- messageStream << "Hello Leaf " << name << "!";
- message = messageStream.str();
-
- std::cout << "sayHelloLeaf('" << name << "'): '" << message << "'\n";
- }
-};
-----
-
-To the bottom of the main function before the while loop add:
-
-[source,{cppstr}]
-----
-auto helloWorldLeafStub = std::make_shared<MyHelloWorldLeafStub>();
-
-const std::string leafInstance = "commonapi.examples.HelloWorld.Leaf";
-
-const bool leafOk = helloWorldStub->registerManagedStubHelloWorldLeaf(
- helloWorldLeafStub, leafInstance);
-
-if (!leafOk) {
- std::cerr << "Error: Unable to register leaf service!\n";
- return -1;
-}
-----
-
-To the client programm add to the bottom of the main function just before return 0:
-
-[source,{cppstr}]
-----
-const std::string leafInstance = "commonapi.examples.HelloWorld.Leaf";
-CommonAPI::CallStatus callStatusAv;
-CommonAPI::AvailabilityStatus availabilityStatus;
-helloWorldProxy->getProxyManagerHelloWorldLeaf().getInstanceAvailabilityStatus(
- leafInstance, callStatusAv, availabilityStatus);
-
-if (callStatusAv == CommonAPI::CallStatus::SUCCESS &&
- availabilityStatus == CommonAPI::AvailabilityStatus::AVAILABLE) {
-
- auto helloWorldLeafProxy =
- helloWorldProxy->getProxyManagerHelloWorldLeaf().
- buildProxy<commonapi::examples::HelloWorldLeafProxy>(leafInstance);
-
- const std::string nameLeaf = "WorldLeaf";
- CommonAPI::CallStatus callStatusLeaf;
- std::string helloWorldLeafMessage;
-
- std::cout << "Sending name: '" << nameLeaf << "'\n";
- helloWorldLeafProxy->sayHelloLeaf(nameLeaf, callStatusLeaf, helloWorldLeafMessage);
- if (callStatusLeaf != CommonAPI::CallStatus::SUCCESS) {
- std::cerr << "Remote call failed!\n";
- return -1;
- }
-
- std::cout << "Got message: '" << helloWorldLeafMessage << "'\n";
-
-} else {
- std::cout << "Leaf Proxy not available\n";
- sleep(5);
- return -1;
-}
-----
-
-This instantiates and calls a managed leaf stub and proxy respectively.
-
-Attribute Extensions
-~~~~~~~~~~~~~~~~~~~~
-
-As described in the CommonAPI specification there is a general scheme to include individual extensions in order to provide any additional features for attributes. In principle Attribute Extensions work as follows:
-
-- Decide whether you want to implement a common attribute extension for all attributes of an interface or a specific extension for one attribute.
-- Define a so-called templated extension class which inherits from +CommonAPI::AttributeExtension+ within a hpp-file. The example below defined in +AttributeCacheExtension.hpp+ shows an extension class for the caching of attributes on proxy side.
-- Generate the proxy for your interface with the API method +buildProxyWithDefaultAttributeExtension+ if you want a common extension. For the specific extension call build proxy with the attribute extension as template parameter.
-- Now you can call the implemented functions of your extension via a +getNameAttributeExtension()+ call (where +Name+ is the name of your attribute).
-
-Example of an extension class for caching attributes (file +AttributeCacheExtension.hpp+, see example e02Attributes):
-[source,{cppstr}]
-----
-#include <CommonAPI/CommonAPI.h>
-
-template<typename _AttributeType>
-class AttributeCacheExtension: public CommonAPI::AttributeExtension<_AttributeType> {
- typedef CommonAPI::AttributeExtension<_AttributeType> __baseClass_t;
-
- public:
- typedef typename _AttributeType::ValueType value_t;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
-
- AttributeCacheExtension(_AttributeType& baseAttribute) :
- CommonAPI::AttributeExtension<_AttributeType>(baseAttribute),
- isCacheValid_(false) {
- }
-
- ~AttributeCacheExtension() {}
-
- bool getCachedValue(value_t& value) {
-
- if (isCacheValid_) {
-
- value = cachedValue_;
- } else {
-
- __baseClass_t::getBaseAttribute().getChangedEvent().subscribe(std::bind(
- &AttributeCacheExtension<_AttributeType>::onValueUpdate,
- this,
- std::placeholders::_1));
-
- CommonAPI::CallStatus callStatus;
- __baseClass_t::getBaseAttribute().getValue(callStatus, value);
- }
-
- return isCacheValid_;
- }
-
- private:
-
- void onValueUpdate(const value_t& t) {
- isCacheValid_ = true;
- cachedValue_ = t;
- }
-
- mutable bool isCacheValid_;
- mutable value_t cachedValue_;
-};
-----
-
-In your main function you can call now:
-[source,{cppstr}]
-----
-#include "AttributeCacheExtension.hpp"
-using your::namespace; // eg commonapi::examples
-
-... // Other code here
-
-const std::string& serviceAddress = "...";
-
-// your proxy class is ProxyName
-std::shared_ptr<CommonAPI::DefaultAttributeProxyFactoryHelper<ProxyName,
- AttributeCacheExtension>::class_t> myProxy =
- factory->buildProxyWithDefaultAttributeExtension<ProxyName,
- AttributeCacheExtension>(serviceAddress);
-
-// and then if your attribute is x of type Int32:
-int32_t valueCached = 0;
-myProxy->getXAttributeExtension().getCachedValue(valueCached);
-----
-
-Examples
---------
-
-include::../CommonAPI-Examples/README[]
-include::../CommonAPI-Examples/e01HelloWorld/README[]
-include::../CommonAPI-Examples/e02Attributes/README[]
-include::../CommonAPI-Examples/e03Methods/README[]
-include::../CommonAPI-Examples/e04PhoneBook/README[]
-include::../CommonAPI-Examples/e05Manager/README[]
-include::../CommonAPI-Examples/e06Unions/README[]
-
-FAQ
----
-
-The middleware loading mechanism of Common API
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-CommonAPI::Runtime::load() returns no runtime object, why?
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-As it was mentioned before, when you call +CommonAPI::Runtime::load()+ you "magically" will have access to a specific middleware library. In a very basic case, the library and thereby communication mechanism you will have access to will be the only Common API middleware library you linked to your executable during compilation.
-
-However, this call to +load()+ most likely will *FAIL* if you have no generated middleware specific code that is compiled with your application. Why that?
-
-The reason is simple, once understood: Most linkers are lazy. They do not link libraries that seem to be unused. Due to the fact that there is no reference whatsoever from Common API (and therefore your application) to any of the middleware libraries, the linker considers any and all middleware libraries as unused if not referenced by middleware specific generated code, and therefore will not add them to the executable.
-
-You can disable this behavior by passing the linker flag +whole-archive+ during the build process. Note however that this behavior normally is a good optimization
-without repercussions - except probably in the context of CommonAPI.
-
-
-How can I use Using more than one middleware binding?
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-CommonAPI provides the possibility to use more than one middleware binding at once. In this case, you should no longer use +CommonAPI::Runtime::load()+,
-but instead +CommonAPI::Runtime::load("NameOfSomeMiddleware")+.
-
-The "NameOfSomeMiddleware" is the well known name of the middleware you want to load. It is defined and made public by each of the middlewares that support
-Common API. For DBus, this name is simply "DBus".
-
-
-Fully dynamic loading and additional information
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-This topic is handled in-depth in the specification of Common API. Please refer to this file for any further information.
-
diff --git a/docx/images/AsynchronousStubs.png b/docx/images/AsynchronousStubs.png
new file mode 100755
index 0000000..47d7e03
--- /dev/null
+++ b/docx/images/AsynchronousStubs.png
Binary files differ
diff --git a/docx/images/CommonAPIOverview01.png b/docx/images/CommonAPIOverview01.png
new file mode 100755
index 0000000..532f77f
--- /dev/null
+++ b/docx/images/CommonAPIOverview01.png
Binary files differ
diff --git a/docx/images/CommonAPIOverview02.png b/docx/images/CommonAPIOverview02.png
new file mode 100755
index 0000000..13c8f15
--- /dev/null
+++ b/docx/images/CommonAPIOverview02.png
Binary files differ
diff --git a/docx/images/CommonAPIStructuringLibraries.png b/docx/images/CommonAPIStructuringLibraries.png
new file mode 100755
index 0000000..f0dc92e
--- /dev/null
+++ b/docx/images/CommonAPIStructuringLibraries.png
Binary files differ
diff --git a/docx/images/CommonAPIWorkflow.png b/docx/images/CommonAPIWorkflow.png
new file mode 100755
index 0000000..df3c3e9
--- /dev/null
+++ b/docx/images/CommonAPIWorkflow.png
Binary files differ
diff --git a/docx/images/Diag_Attributes.png b/docx/images/Diag_Attributes.png
index 36e25f7..9502334 100755
--- a/docx/images/Diag_Attributes.png
+++ b/docx/images/Diag_Attributes.png
Binary files differ
diff --git a/docx/images/Diag_GeneratedProxy.png b/docx/images/Diag_GeneratedProxy.png
index 2f7fc3b..26dd5db 100755
--- a/docx/images/Diag_GeneratedProxy.png
+++ b/docx/images/Diag_GeneratedProxy.png
Binary files differ
diff --git a/docx/images/Diag_GeneratedStub.png b/docx/images/Diag_GeneratedStub.png
index 8970c90..c4cd513 100755
--- a/docx/images/Diag_GeneratedStub.png
+++ b/docx/images/Diag_GeneratedStub.png
Binary files differ
diff --git a/docx/images/EclipseBuildToolsSettings.png b/docx/images/EclipseBuildToolsSettings.png
new file mode 100755
index 0000000..cf3e80a
--- /dev/null
+++ b/docx/images/EclipseBuildToolsSettings.png
Binary files differ
diff --git a/docx/images/EclipseCommonAPISettings01.png b/docx/images/EclipseCommonAPISettings01.png
new file mode 100644
index 0000000..7e79f4d
--- /dev/null
+++ b/docx/images/EclipseCommonAPISettings01.png
Binary files differ
diff --git a/docx/mainpagetests/01_mainpage.dox b/docx/mainpagetests/01_mainpage.dox
index 1cb65df..8179b98 100644
--- a/docx/mainpagetests/01_mainpage.dox
+++ b/docx/mainpagetests/01_mainpage.dox
@@ -1,14 +1,11 @@
/**
- * Copyright (C) 2013 BMW AG
+ * Copyright (C) 2015 BMW AG
* *
* This file is part of GENIVI project IPC CommonAPI C++.
*
* Contributions are licensed to the GENIVI Alliance under one or more
* Contribution License Agreements.
*
- * \author Juergen Gehring (juergen.gehring@bmw.de)
- * \author Manfred Bathelt (manfred.bathelt@bmw.de)
- *
*/
/*!
diff --git a/org.genivi.commonapi.cli.product/.project b/org.genivi.commonapi.cli.product/.project
index 90e2a71..a2fc7c5 100644
--- a/org.genivi.commonapi.cli.product/.project
+++ b/org.genivi.commonapi.cli.product/.project
@@ -8,4 +8,4 @@
</buildSpec>
<natures>
</natures>
-</projectDescription> \ No newline at end of file
+</projectDescription>
diff --git a/org.genivi.commonapi.cli.product/commonapi_cli.product b/org.genivi.commonapi.cli.product/commonapi_cli.product
deleted file mode 100644
index a3637e1..0000000
--- a/org.genivi.commonapi.cli.product/commonapi_cli.product
+++ /dev/null
@@ -1,155 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?pde version="3.5"?>
-
-<product name="CommonAPI Code Generator" uid="org.genivi.commonapi.cli.product" id="org.genivi.commonapi.core.cli.product" application="org.genivi.commonapi.core.cli.application" version="2.1.5" useFeatures="true" includeLaunchers="true">
-
- <configIni use="default">
- </configIni>
-
- <launcherArgs>
- <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
- </launcherArgs>
-
- <launcher name="commonapi_generator">
- <solaris/>
- <win useIco="false">
- <bmp/>
- </win>
- </launcher>
-
- <vm>
- </vm>
-
- <plugins>
- <plugin id="com.google.guava"/>
- <plugin id="com.google.inject"/>
- <plugin id="com.ibm.icu"/>
- <plugin id="javax.annotation"/>
- <plugin id="javax.inject"/>
- <plugin id="javax.xml"/>
- <plugin id="org.antlr.runtime"/>
- <plugin id="org.apache.batik.css"/>
- <plugin id="org.apache.batik.util"/>
- <plugin id="org.apache.batik.util.gui"/>
- <plugin id="org.apache.commons.cli"/>
- <plugin id="org.apache.commons.lang"/>
- <plugin id="org.apache.commons.logging"/>
- <plugin id="org.apache.log4j"/>
- <plugin id="org.eclipse.compare.core"/>
- <plugin id="org.eclipse.core.commands"/>
- <plugin id="org.eclipse.core.contenttype"/>
- <plugin id="org.eclipse.core.databinding"/>
- <plugin id="org.eclipse.core.databinding.observable"/>
- <plugin id="org.eclipse.core.databinding.property"/>
- <plugin id="org.eclipse.core.expressions"/>
- <plugin id="org.eclipse.core.filebuffers"/>
- <plugin id="org.eclipse.core.filesystem"/>
- <plugin id="org.eclipse.core.filesystem.win32.x86_64" fragment="true"/>
- <plugin id="org.eclipse.core.jobs"/>
- <plugin id="org.eclipse.core.resources"/>
- <plugin id="org.eclipse.core.resources.win32.x86_64" fragment="true"/>
- <plugin id="org.eclipse.core.runtime"/>
- <plugin id="org.eclipse.core.runtime.compatibility.registry" fragment="true"/>
- <plugin id="org.eclipse.e4.core.commands"/>
- <plugin id="org.eclipse.e4.core.contexts"/>
- <plugin id="org.eclipse.e4.core.di"/>
- <plugin id="org.eclipse.e4.core.di.extensions"/>
- <plugin id="org.eclipse.e4.core.services"/>
- <plugin id="org.eclipse.e4.ui.bindings"/>
- <plugin id="org.eclipse.e4.ui.css.core"/>
- <plugin id="org.eclipse.e4.ui.css.swt"/>
- <plugin id="org.eclipse.e4.ui.css.swt.theme"/>
- <plugin id="org.eclipse.e4.ui.di"/>
- <plugin id="org.eclipse.e4.ui.model.workbench"/>
- <plugin id="org.eclipse.e4.ui.services"/>
- <plugin id="org.eclipse.e4.ui.widgets"/>
- <plugin id="org.eclipse.e4.ui.workbench"/>
- <plugin id="org.eclipse.e4.ui.workbench.addons.swt"/>
- <plugin id="org.eclipse.e4.ui.workbench.renderers.swt"/>
- <plugin id="org.eclipse.e4.ui.workbench.swt"/>
- <plugin id="org.eclipse.e4.ui.workbench3"/>
- <plugin id="org.eclipse.emf.common"/>
- <plugin id="org.eclipse.emf.common.ui"/>
- <plugin id="org.eclipse.emf.ecore"/>
- <plugin id="org.eclipse.emf.ecore.change"/>
- <plugin id="org.eclipse.emf.ecore.xmi"/>
- <plugin id="org.eclipse.emf.edit"/>
- <plugin id="org.eclipse.emf.edit.ui"/>
- <plugin id="org.eclipse.emf.mwe.core"/>
- <plugin id="org.eclipse.emf.mwe.utils"/>
- <plugin id="org.eclipse.emf.mwe2.language"/>
- <plugin id="org.eclipse.emf.mwe2.launch"/>
- <plugin id="org.eclipse.emf.mwe2.lib"/>
- <plugin id="org.eclipse.emf.mwe2.runtime"/>
- <plugin id="org.eclipse.equinox.app"/>
- <plugin id="org.eclipse.equinox.bidi"/>
- <plugin id="org.eclipse.equinox.common"/>
- <plugin id="org.eclipse.equinox.ds"/>
- <plugin id="org.eclipse.equinox.event"/>
- <plugin id="org.eclipse.equinox.p2.core"/>
- <plugin id="org.eclipse.equinox.p2.engine"/>
- <plugin id="org.eclipse.equinox.p2.metadata"/>
- <plugin id="org.eclipse.equinox.p2.metadata.repository"/>
- <plugin id="org.eclipse.equinox.p2.repository"/>
- <plugin id="org.eclipse.equinox.preferences"/>
- <plugin id="org.eclipse.equinox.registry"/>
- <plugin id="org.eclipse.equinox.security"/>
- <plugin id="org.eclipse.equinox.security.win32.x86_64" fragment="true"/>
- <plugin id="org.eclipse.equinox.util"/>
- <plugin id="org.eclipse.help"/>
- <plugin id="org.eclipse.jface"/>
- <plugin id="org.eclipse.jface.databinding"/>
- <plugin id="org.eclipse.jface.text"/>
- <plugin id="org.eclipse.osgi"/>
- <plugin id="org.eclipse.osgi.services"/>
- <plugin id="org.eclipse.swt"/>
- <plugin id="org.eclipse.swt.win32.win32.x86_64" fragment="true"/>
- <plugin id="org.eclipse.text"/>
- <plugin id="org.eclipse.ui"/>
- <plugin id="org.eclipse.ui.editors"/>
- <plugin id="org.eclipse.ui.forms"/>
- <plugin id="org.eclipse.ui.ide"/>
- <plugin id="org.eclipse.ui.views"/>
- <plugin id="org.eclipse.ui.win32" fragment="true"/>
- <plugin id="org.eclipse.ui.workbench"/>
- <plugin id="org.eclipse.ui.workbench.texteditor"/>
- <plugin id="org.eclipse.xpand"/>
- <plugin id="org.eclipse.xtend"/>
- <plugin id="org.eclipse.xtend.lib"/>
- <plugin id="org.eclipse.xtend.typesystem.emf"/>
- <plugin id="org.eclipse.xtend2.lib"/>
- <plugin id="org.eclipse.xtext"/>
- <plugin id="org.eclipse.xtext.builder"/>
- <plugin id="org.eclipse.xtext.common.types"/>
- <plugin id="org.eclipse.xtext.ecore"/>
- <plugin id="org.eclipse.xtext.generator"/>
- <plugin id="org.eclipse.xtext.logging" fragment="true"/>
- <plugin id="org.eclipse.xtext.smap"/>
- <plugin id="org.eclipse.xtext.ui"/>
- <plugin id="org.eclipse.xtext.util"/>
- <plugin id="org.eclipse.xtext.xbase"/>
- <plugin id="org.eclipse.xtext.xbase.lib"/>
- <plugin id="org.franca.core"/>
- <plugin id="org.franca.core.dsl"/>
- <plugin id="org.franca.deploymodel.dsl"/>
- <plugin id="org.genivi.commonapi.core"/>
- <plugin id="org.genivi.commonapi.core.cli"/>
- <plugin id="org.genivi.commonapi.dbus"/>
- <plugin id="org.w3c.css.sac"/>
- <plugin id="org.w3c.dom.smil"/>
- <plugin id="org.w3c.dom.svg"/>
- </plugins>
-
- <features>
- <feature id="org.genivi.commonapi.core.cli.feature"/>
- <feature id="org.eclipse.rcp"/>
- </features>
-
- <configurations>
- <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" />
- <plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
- <plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="1" />
- <property name="osgi.instance.area.default" value="@user.home/.commonapi_generator" />
- </configurations>
-
-</product>
diff --git a/org.genivi.commonapi.cli.product/commonapi_console.product b/org.genivi.commonapi.cli.product/commonapi_console.product
new file mode 100644
index 0000000..bdc12b6
--- /dev/null
+++ b/org.genivi.commonapi.cli.product/commonapi_console.product
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?pde version="3.5"?>
+
+<product name="CommonAPI Code Generator" uid="org.genivi.commonapi.core.cli.product" id="org.genivi.commonapi.console.product" application="org.genivi.commonapi.console.application" version="2.1.6" useFeatures="true" includeLaunchers="true">
+
+ <configIni use="default">
+ </configIni>
+
+ <launcherArgs>
+ <vmArgs>-Dosgi.requiredJavaVersion=1.7 -Xms512m -Xmx512m -XX:PermSize=128m
+ </vmArgs>
+ <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
+ </vmArgsMac>
+ </launcherArgs>
+
+ <windowImages/>
+
+ <launcher name="commonapi-generator">
+ <solaris/>
+ <win useIco="false">
+ <bmp/>
+ </win>
+ </launcher>
+
+ <vm>
+ <windows include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7</windows>
+ </vm>
+
+ <plugins>
+ </plugins>
+
+ <features>
+ <feature id="org.genivi.commonapi.console.feature"/>
+ <feature id="org.genivi.commonapi.console.franca.feature"/>
+ <feature id="org.genivi.commonapi.core.cli.feature"/>
+ </features>
+
+ <configurations>
+ <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" />
+ <plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
+ <plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="2" />
+ <plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
+ <plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
+ <property name="osgi.instance.area.default" value="@user.home/.commonapi-generator" />
+ </configurations>
+
+</product>
diff --git a/org.genivi.commonapi.cli.product/pom.xml b/org.genivi.commonapi.cli.product/pom.xml
index 017efe1..ae95b0e 100644
--- a/org.genivi.commonapi.cli.product/pom.xml
+++ b/org.genivi.commonapi.cli.product/pom.xml
@@ -1,78 +1,131 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>commonapi</groupId>
- <artifactId>org.genivi.commonapi.cli.product</artifactId>
- <packaging>eclipse-repository</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-p2-director-plugin</artifactId>
- <version>${tycho-version}</version>
- <executions>
- <execution>
- <!-- install the product using the p2 director -->
- <id>materialize-products</id>
- <goals>
- <goal>materialize-products</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <id>run-ant-rename</id>
- <phase>package</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target>
- <delete
- file="${project.build.directory}/products/org.genivi.commonapi.cli.product/win32/win32/x86_64/commonapi_generator.exe" />
- <copy
- file="${project.build.directory}/products/org.genivi.commonapi.cli.product/win32/win32/x86_64/eclipsec.exe"
- tofile="${project.build.directory}/products/org.genivi.commonapi.cli.product/win32/win32/x86_64/commonapi_generator.exe" />
- <delete
- file="${project.build.directory}/products/org.genivi.commonapi.cli.product/win32/win32/x86_64/eclipsec.exe" />
- </target>
- </configuration>
- </execution>
- <execution>
- <id>create-zip-files</id>
- <phase>package</phase>
- <configuration>
- <target>
- <zip excludesfile="zip.excludes"
- destfile="${project.build.directory}/products/commonapi_generator-win32.win32.x86_64.zip"
- basedir="${project.build.directory}/products/org.genivi.commonapi.cli.product/win32/win32/x86_64" />
- <zip excludesfile="zip.excludes"
- destfile="${project.build.directory}/products/commonapi_generator-win32.win32.x86.zip"
- basedir="${project.build.directory}/products/org.genivi.commonapi.cli.product/win32/win32/x86" />
- <zip excludesfile="zip.excludes"
- destfile="${project.build.directory}/products/commonapi_generator-linux.gtk.x86.zip"
- basedir="${project.build.directory}/products/org.genivi.commonapi.cli.product/linux/gtk/x86" />
- <zip excludesfile="zip.excludes"
- destfile="${project.build.directory}/products/commonapi_generator-linux.gtk.x86_64.zip"
- basedir="${project.build.directory}/products/org.genivi.commonapi.cli.product/linux/gtk/x86_64" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <parent>
- <groupId>commonapi</groupId>
- <artifactId>org.genivi.commonapi.releng</artifactId>
- <version>2.1.6-SNAPSHOT</version>
- <relativePath>../org.genivi.commonapi.releng</relativePath>
- </parent>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commonapi</groupId>
+ <artifactId>org.genivi.commonapi.core.cli.product</artifactId>
+ <packaging>eclipse-repository</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-director-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <executions>
+ <execution>
+ <!-- install the product using the p2 director -->
+ <id>materialize-products</id>
+ <goals>
+ <goal>materialize-products</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+
+ <execution>
+ <id>run-ant-rename</id>
+ <phase>package</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/commonapi-generator.exe" />
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/eclipsec.exe"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/commonapi-generator-windows-x86.exe" />
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/commonapi-generator.ini"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/commonapi-generator-windows-x86.ini" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/eclipsec.exe" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/commonapi-generator.ini" />
+ <copy
+ todir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/">
+ <fileset
+ dir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/" />
+ </copy>
+
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/commonapi-generator.exe" />
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/eclipsec.exe"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/commonapi-generator-windows-x86_64.exe" />
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/commonapi-generator.ini"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/commonapi-generator-windows-x86_64.ini" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/eclipsec.exe" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/commonapi-generator.ini" />
+ <copy
+ todir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/">
+ <fileset
+ dir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/" />
+ </copy>
+
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator-linux-x86" />
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator.ini"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator-linux-x86.ini" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator.ini" />
+ <copy
+ todir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/">
+ <fileset
+ dir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/" />
+ </copy>
+
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator-linux-x86_64" />
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator.ini"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator-linux-x86_64.ini" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator.ini" />
+ <copy
+ todir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/">
+ <fileset
+ dir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/" />
+ </copy>
+ </target>
+ </configuration>
+ </execution>
+ <execution>
+ <id>create-zip-files</id>
+ <phase>package</phase>
+ <configuration>
+ <target>
+ <zip excludesfile="zip.excludes"
+ destfile="${project.build.directory}/products/commonapi-generator.zip"
+ basedir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <parent>
+ <groupId>commonapi</groupId>
+ <artifactId>org.genivi.commonapi.core.releng</artifactId>
+ <version>2.1.6-SNAPSHOT</version>
+ <relativePath>../org.genivi.commonapi.core.releng</relativePath>
+ </parent>
</project> \ No newline at end of file
diff --git a/org.genivi.commonapi.cli.product/.gitignore b/org.genivi.commonapi.console.feature/.gitignore
index ea8c4bf..873d37a 100644
--- a/org.genivi.commonapi.cli.product/.gitignore
+++ b/org.genivi.commonapi.console.feature/.gitignore
@@ -1 +1,2 @@
+*~
/target
diff --git a/org.genivi.commonapi.console.feature/.project b/org.genivi.commonapi.console.feature/.project
new file mode 100644
index 0000000..1e578d5
--- /dev/null
+++ b/org.genivi.commonapi.console.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.genivi.commonapi.console.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.genivi.commonapi.console.feature/.settings/org.eclipse.core.resources.prefs b/org.genivi.commonapi.console.feature/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.genivi.commonapi.console.feature/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.genivi.commonapi.console.feature/.settings/org.eclipse.core.runtime.prefs b/org.genivi.commonapi.console.feature/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/org.genivi.commonapi.console.feature/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.genivi.commonapi.console.feature/build.properties b/org.genivi.commonapi.console.feature/build.properties
new file mode 100644
index 0000000..3b8a221
--- /dev/null
+++ b/org.genivi.commonapi.console.feature/build.properties
@@ -0,0 +1,2 @@
+javacDefaultEncoding.. = UTF-8
+bin.includes = feature.xml
diff --git a/org.genivi.commonapi.console.feature/feature.xml b/org.genivi.commonapi.console.feature/feature.xml
new file mode 100644
index 0000000..95bd4c3
--- /dev/null
+++ b/org.genivi.commonapi.console.feature/feature.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.genivi.commonapi.console.feature"
+ label="Command Line Feature"
+ version="3.1.1.qualifier"
+ provider-name="BMW AG">
+
+ <description url="http://www.example.com/description">
+ [Enter Feature Description here.]
+ </description>
+
+ <copyright url="http://www.example.com/copyright">
+ [Enter Copyright Description here.]
+ </copyright>
+
+ <license url="http://www.example.com/license">
+ [Enter License Description here.]
+ </license>
+
+ <requires>
+ <import feature="org.genivi.commonapi.console.franca.feature" version="3.1.1" match="compatible"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.core.contenttype"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.core.jobs"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.core.runtime"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.equinox.app"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.equinox.common"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.equinox.preferences"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.equinox.registry"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.osgi"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.osgi.services"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.genivi.commonapi.console"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/org.genivi.commonapi.updatesite/pom.xml b/org.genivi.commonapi.console.feature/pom.xml
index ab862ef..6cbb9bd 100644
--- a/org.genivi.commonapi.updatesite/pom.xml
+++ b/org.genivi.commonapi.console.feature/pom.xml
@@ -2,12 +2,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>commonapi</groupId>
- <artifactId>org.genivi.commonapi.updatesite</artifactId>
- <packaging>eclipse-repository</packaging>
+ <artifactId>org.genivi.commonapi.console.feature</artifactId>
+ <packaging>eclipse-feature</packaging>
<parent>
<groupId>commonapi</groupId>
<artifactId>org.genivi.commonapi.releng</artifactId>
- <version>2.1.6-SNAPSHOT</version>
+ <version>3.1.1-SNAPSHOT</version>
<relativePath>../org.genivi.commonapi.releng</relativePath>
</parent>
</project> \ No newline at end of file
diff --git a/org.genivi.commonapi.updatesite/.gitignore b/org.genivi.commonapi.console.franca.feature/.gitignore
index ea8c4bf..873d37a 100644
--- a/org.genivi.commonapi.updatesite/.gitignore
+++ b/org.genivi.commonapi.console.franca.feature/.gitignore
@@ -1 +1,2 @@
+*~
/target
diff --git a/org.genivi.commonapi.console.franca.feature/.project b/org.genivi.commonapi.console.franca.feature/.project
new file mode 100644
index 0000000..7e49c65
--- /dev/null
+++ b/org.genivi.commonapi.console.franca.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.genivi.commonapi.console.franca.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.genivi.commonapi.console.franca.feature/.settings/org.eclipse.core.resources.prefs b/org.genivi.commonapi.console.franca.feature/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.genivi.commonapi.console.franca.feature/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.genivi.commonapi.console.franca.feature/.settings/org.eclipse.core.runtime.prefs b/org.genivi.commonapi.console.franca.feature/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/org.genivi.commonapi.console.franca.feature/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.genivi.commonapi.console.franca.feature/build.properties b/org.genivi.commonapi.console.franca.feature/build.properties
new file mode 100644
index 0000000..3b8a221
--- /dev/null
+++ b/org.genivi.commonapi.console.franca.feature/build.properties
@@ -0,0 +1,2 @@
+javacDefaultEncoding.. = UTF-8
+bin.includes = feature.xml
diff --git a/org.genivi.commonapi.console.franca.feature/feature.xml b/org.genivi.commonapi.console.franca.feature/feature.xml
new file mode 100644
index 0000000..cef489a
--- /dev/null
+++ b/org.genivi.commonapi.console.franca.feature/feature.xml
@@ -0,0 +1,287 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.genivi.commonapi.console.franca.feature"
+ label="Franca Core Dependencies Feature"
+ version="3.1.1.qualifier"
+ provider-name="BMW AG">
+
+ <description url="http://www.example.com/description">
+ [Enter Feature Description here.]
+ </description>
+
+ <copyright url="http://www.example.com/copyright">
+ [Enter Copyright Description here.]
+ </copyright>
+
+ <license url="http://www.example.com/license">
+ [Enter License Description here.]
+ </license>
+
+ <plugin
+ id="org.franca.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.franca.core.dsl"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.xtext"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.xtext.logging"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ fragment="true"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.xtext.util"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.xtext.xbase.lib"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.xtend"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.xtend.lib"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.xtend.lib.macro"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.xtend.typesystem.emf"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.log4j"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.google.guava"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.google.inject"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.commons.logging"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.emf.ecore.xmi"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.emf.ecore"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.emf.mwe.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="javax.inject"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.emf.common"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.antlr.runtime"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.emf.mwe.utils"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.commons.lang"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.commons.cli"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.emf.mwe2.runtime"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.core.expressions"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.core.variables"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="javax.annotation"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="javax.xml"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.core.commands"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.core.contenttype"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.core.jobs"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.xpand"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.xtext.ecore"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.ibm.icu"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.xtext.generator"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.franca.deploymodel.dsl"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.core.resources"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.core.filesystem"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/org.genivi.commonapi.target/pom.xml b/org.genivi.commonapi.console.franca.feature/pom.xml
index 34eb4fb..450df41 100644
--- a/org.genivi.commonapi.target/pom.xml
+++ b/org.genivi.commonapi.console.franca.feature/pom.xml
@@ -2,12 +2,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>commonapi</groupId>
- <artifactId>org.genivi.commonapi.target</artifactId>
- <packaging>eclipse-target-definition</packaging>
+ <artifactId>org.genivi.commonapi.console.franca.feature</artifactId>
+ <packaging>eclipse-feature</packaging>
<parent>
<groupId>commonapi</groupId>
<artifactId>org.genivi.commonapi.releng</artifactId>
- <version>2.1.6-SNAPSHOT</version>
+ <version>3.1.1-SNAPSHOT</version>
<relativePath>../org.genivi.commonapi.releng</relativePath>
</parent>
</project> \ No newline at end of file
diff --git a/org.genivi.commonapi.console/.classpath b/org.genivi.commonapi.console/.classpath
new file mode 100644
index 0000000..1fa3e68
--- /dev/null
+++ b/org.genivi.commonapi.console/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.genivi.commonapi.console/.gitignore b/org.genivi.commonapi.console/.gitignore
new file mode 100644
index 0000000..4cc0812
--- /dev/null
+++ b/org.genivi.commonapi.console/.gitignore
@@ -0,0 +1,2 @@
+bin/
+/target
diff --git a/org.genivi.commonapi.console/.project b/org.genivi.commonapi.console/.project
new file mode 100644
index 0000000..30db1b5
--- /dev/null
+++ b/org.genivi.commonapi.console/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.genivi.commonapi.console</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.genivi.commonapi.console/.settings/org.eclipse.core.resources.prefs b/org.genivi.commonapi.console/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.genivi.commonapi.console/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.genivi.commonapi.console/.settings/org.eclipse.core.runtime.prefs b/org.genivi.commonapi.console/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/org.genivi.commonapi.console/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.genivi.commonapi.console/.settings/org.eclipse.jdt.core.prefs b/org.genivi.commonapi.console/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..c55ccba
--- /dev/null
+++ b/org.genivi.commonapi.console/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,13 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/org.genivi.commonapi.console/.settings/org.eclipse.jdt.launching.prefs b/org.genivi.commonapi.console/.settings/org.eclipse.jdt.launching.prefs
new file mode 100644
index 0000000..d211d32
--- /dev/null
+++ b/org.genivi.commonapi.console/.settings/org.eclipse.jdt.launching.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
diff --git a/org.genivi.commonapi.console/META-INF/MANIFEST.MF b/org.genivi.commonapi.console/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..358403e
--- /dev/null
+++ b/org.genivi.commonapi.console/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: CommonAPI Console
+Bundle-SymbolicName: org.genivi.commonapi.console;singleton:=true
+Bundle-Version: 3.1.1.qualifier
+Bundle-Vendor: BMW AG
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.8.0,4.0.0)";visibility:=reexport,
+ org.apache.commons.cli;bundle-version="[1.2.0,2.0.0)";visibility:=reexport,
+ org.apache.commons.lang;bundle-version="[2.6.0,3.0.0)";visibility:=reexport,
+ org.franca.core.dsl;bundle-version="[0.9.0,0.10.0)";visibility:=reexport,
+ org.franca.deploymodel.dsl;bundle-version="[0.9.0,0.10.0)";visibility:=reexport
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Export-Package: org.genivi.commonapi.console,
+ org.genivi.commonapi.console.internal;x-internal:=true
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.genivi.commonapi.console.internal.Activator
diff --git a/org.genivi.commonapi.console/about.mappings b/org.genivi.commonapi.console/about.mappings
new file mode 100644
index 0000000..68552a9
--- /dev/null
+++ b/org.genivi.commonapi.console/about.mappings
@@ -0,0 +1,3 @@
+0=3.1.1
+1=20150529
+2=$sun.arch.data.model$ \ No newline at end of file
diff --git a/org.genivi.commonapi.console/build.properties b/org.genivi.commonapi.console/build.properties
new file mode 100644
index 0000000..203762b
--- /dev/null
+++ b/org.genivi.commonapi.console/build.properties
@@ -0,0 +1,8 @@
+javacDefaultEncoding.. = UTF-8
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.mappings
+
diff --git a/org.genivi.commonapi.console/plugin.xml b/org.genivi.commonapi.console/plugin.xml
new file mode 100644
index 0000000..b6d73ea
--- /dev/null
+++ b/org.genivi.commonapi.console/plugin.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="commands" name="CommonAPI Console Commands" schema="schema/commands.exsd"/>
+ <extension-point id="optionGroups" name="CommonAPI Console Option Groups" schema="schema/optionGroups.exsd"/>
+ <extension-point id="options" name="CommonAPI Console Options" schema="schema/options.exsd"/>
+ <extension
+ id="application"
+ point="org.eclipse.core.runtime.applications">
+ <application>
+ <run
+ class="org.genivi.commonapi.console.internal.Application">
+ </run>
+ </application>
+ </extension>
+ <extension
+ id="product"
+ point="org.eclipse.core.runtime.products">
+ <product
+ application="org.genivi.commonapi.console.application"
+ name="CommonAPI Code Generator">
+ <property
+ name="appName"
+ value="CommonAPI Code Generator">
+ </property>
+ </product>
+ </extension>
+ <extension
+ point="org.genivi.commonapi.console.commands">
+ <command
+ class="org.genivi.commonapi.console.internal.HelpCommandHandler"
+ id="org.genivi.commonapi.console.commands.help"
+ name="Console Help">
+ <options>
+ <option
+ argCount="0"
+ description="display help of available console commands"
+ hasOptionalArg="false"
+ id="org.genivi.commonapi.console.options.help"
+ longName="help"
+ required="true"
+ shortName="h">
+ </option>
+ </options>
+ </command>
+ <command
+ class="org.genivi.commonapi.console.internal.VersionCommandHandler"
+ id="org.genivi.commonapi.console.commands.versionInfo"
+ name="Version Information">
+ <options>
+ <option
+ argCount="0"
+ description="print code generator version"
+ hasOptionalArg="false"
+ id="org.genivi.commonapi.console.options.version"
+ longName="version"
+ required="true"
+ shortName="v">
+ </option>
+ <optionGroup
+ id="org.genivi.commonapi.console.optionGroups.version"
+ required="false">
+ <option
+ argCount="0"
+ description="print code generator and plug-in versions"
+ hasOptionalArg="false"
+ id="org.genivi.commonapi.console.options.pluginVersions"
+ longName="all"
+ required="false"
+ shortName="a">
+ </option>
+ <option
+ argCount="0"
+ description="print plug-in versions"
+ hasOptionalArg="false"
+ id="org.genivi.commonapi.console.options.allVersions"
+ longName="plugins"
+ required="false"
+ shortName="p">
+ </option>
+ </optionGroup>
+ </options>
+ </command>
+ </extension>
+</plugin>
diff --git a/org.genivi.commonapi.console/pom.xml b/org.genivi.commonapi.console/pom.xml
new file mode 100644
index 0000000..d1e1922
--- /dev/null
+++ b/org.genivi.commonapi.console/pom.xml
@@ -0,0 +1,15 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commonapi</groupId>
+ <artifactId>org.genivi.commonapi.console</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+ <parent>
+ <groupId>commonapi</groupId>
+ <artifactId>org.genivi.commonapi.releng</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
+ <relativePath>../org.genivi.commonapi.releng</relativePath>
+ </parent>
+
+</project> \ No newline at end of file
diff --git a/org.genivi.commonapi.console/schema/commands.exsd b/org.genivi.commonapi.console/schema/commands.exsd
new file mode 100644
index 0000000..d3e06b6
--- /dev/null
+++ b/org.genivi.commonapi.console/schema/commands.exsd
@@ -0,0 +1,181 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.genivi.commonapi.console" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.genivi.commonapi.console" id="commands" name="CommonAPI Console Commands"/>
+ </appinfo>
+ <documentation>
+ This extension point allows plug-ins to declaratively register console commands which can be executed by running the console application with the ID org.genivi.commonapi.console.application.
+ </documentation>
+ </annotation>
+
+ <include schemaLocation="options.exsd"/>
+
+ <include schemaLocation="optionGroups.exsd"/>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <choice>
+ <element ref="command" minOccurs="1" maxOccurs="unbounded"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="command">
+ <annotation>
+ <documentation>
+ This element represents a console command.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="options"/>
+ <element ref="header" minOccurs="0" maxOccurs="1"/>
+ <element ref="footer" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ An unique identifier for this command.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ A name for this command.
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="syntax" type="string">
+ <annotation>
+ <documentation>
+ The syntax for this command (optional).
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ Command handler class which must implement the ICommandLineHandler interface.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.genivi.commonapi.console.AbstractCommandLineHandler:org.genivi.commonapi.console.ICommandLineHandler"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="options">
+ <annotation>
+ <documentation>
+ An required subelement whose children define the console options which are available for this command.
+ </documentation>
+ </annotation>
+ <complexType>
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element ref="option"/>
+ <element ref="optionId"/>
+ <element ref="optionGroup"/>
+ <element ref="optionGroupId"/>
+ </choice>
+ </complexType>
+ </element>
+
+ <element name="header" type="string">
+ <annotation>
+ <appinfo>
+ <meta.element translatable="true"/>
+ </appinfo>
+ <documentation>
+ An optional subelement whose body should represent a short description which will be printed above the generated help text.
+ </documentation>
+ </annotation>
+ </element>
+
+ <element name="footer" type="string">
+ <annotation>
+ <appinfo>
+ <meta.element translatable="true"/>
+ </appinfo>
+ <documentation>
+ An optional subelement whose body should represent a short description which will be printed below the generated help text.
+ </documentation>
+ </annotation>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.genivi.commonapi.console/schema/optionGroups.exsd b/org.genivi.commonapi.console/schema/optionGroups.exsd
new file mode 100644
index 0000000..a227bc9
--- /dev/null
+++ b/org.genivi.commonapi.console/schema/optionGroups.exsd
@@ -0,0 +1,134 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.genivi.commonapi.console" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.genivi.commonapi.console" id="optionGroups" name="CommonAPI Console Option Groups"/>
+ </appinfo>
+ <documentation>
+ This extension point allows plug-ins to declaratively register console option groups which can be referenced by the org.genivi.commonapi.console.commands extension point. An option group is a group of mutually exclusive options.
+ </documentation>
+ </annotation>
+
+ <include schemaLocation="options.exsd"/>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element ref="optionGroup"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="optionGroup">
+ <annotation>
+ <documentation>
+ This element represents a console option group. An option group is a group of mutually exclusive options.
+ </documentation>
+ </annotation>
+ <complexType>
+ <choice minOccurs="2" maxOccurs="unbounded">
+ <element ref="option"/>
+ <element ref="optionId"/>
+ </choice>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ An unique identifier for this option group.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="required" type="boolean" use="required">
+ <annotation>
+ <documentation>
+ Specifies if this group is required.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="optionGroupId">
+ <annotation>
+ <documentation>
+ This element can refer to an option group which was contributed by the org.genivi.commonapi.console.optionGroups extension point.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="optionGroupId" type="string" use="required">
+ <annotation>
+ <documentation>
+ The unique identifier of the option group which was contributed by the org.genivi.commonapi.console.optionGroups extension point.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.genivi.commonapi.console/schema/options.exsd b/org.genivi.commonapi.console/schema/options.exsd
new file mode 100644
index 0000000..a5bab27
--- /dev/null
+++ b/org.genivi.commonapi.console/schema/options.exsd
@@ -0,0 +1,394 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.genivi.commonapi.console" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.genivi.commonapi.console" id="options" name="CommonAPI Console Options"/>
+ </appinfo>
+ <documentation>
+ This extension point allows plug-ins to declaratively register console options which can be referenced by the org.genivi.commonapi.console.commands and org.genivi.commonapi.console.optionGroups extension points. It maintains information regarding the short-name of the option, the long-name, if any exists, a flag indicating if an argument is required for this option, and a self-documenting description of the option.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element ref="option"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="option">
+ <annotation>
+ <documentation>
+ This element represents a console option.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ An unique identifier for this option.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="shortName" type="string" use="required">
+ <annotation>
+ <documentation>
+ Short representation of the option. The following command line options may not be used:
+&lt;ul&gt;
+&lt;li&gt;-ID,--COMMAND_ID (option handling is case sensitive, thus -id,--command_id can be used)&lt;/li&gt;
+&lt;li&gt;All Eclipse command line parameters&lt;/li&gt;
+&lt;/ul&gt;
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="longName" type="string">
+ <annotation>
+ <documentation>
+ Long representation of the option. The following command line options may not be used:
+&lt;ul&gt;
+&lt;li&gt;-ID,--COMMAND_ID (option handling is case sensitive, thus -id,--command_id can be used)&lt;/li&gt;
+&lt;li&gt;All Eclipse command line parameters&lt;/li&gt;
+&lt;/ul&gt;
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string" use="required">
+ <annotation>
+ <documentation>
+ Describes the function of the option.
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="required" type="boolean" use="required">
+ <annotation>
+ <documentation>
+ Specifies whether this Option is mandatory.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="argName" type="string">
+ <annotation>
+ <documentation>
+ The display name for the argument value.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="argCount" use="required">
+ <annotation>
+ <documentation>
+ The number of argument values.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="0">
+ </enumeration>
+ <enumeration value="1">
+ </enumeration>
+ <enumeration value="2">
+ </enumeration>
+ <enumeration value="3">
+ </enumeration>
+ <enumeration value="4">
+ </enumeration>
+ <enumeration value="5">
+ </enumeration>
+ <enumeration value="6">
+ </enumeration>
+ <enumeration value="7">
+ </enumeration>
+ <enumeration value="8">
+ </enumeration>
+ <enumeration value="9">
+ </enumeration>
+ <enumeration value="10">
+ </enumeration>
+ <enumeration value="11">
+ </enumeration>
+ <enumeration value="12">
+ </enumeration>
+ <enumeration value="13">
+ </enumeration>
+ <enumeration value="14">
+ </enumeration>
+ <enumeration value="15">
+ </enumeration>
+ <enumeration value="16">
+ </enumeration>
+ <enumeration value="17">
+ </enumeration>
+ <enumeration value="18">
+ </enumeration>
+ <enumeration value="19">
+ </enumeration>
+ <enumeration value="20">
+ </enumeration>
+ <enumeration value="21">
+ </enumeration>
+ <enumeration value="22">
+ </enumeration>
+ <enumeration value="23">
+ </enumeration>
+ <enumeration value="24">
+ </enumeration>
+ <enumeration value="25">
+ </enumeration>
+ <enumeration value="26">
+ </enumeration>
+ <enumeration value="27">
+ </enumeration>
+ <enumeration value="28">
+ </enumeration>
+ <enumeration value="29">
+ </enumeration>
+ <enumeration value="30">
+ </enumeration>
+ <enumeration value="31">
+ </enumeration>
+ <enumeration value="32">
+ </enumeration>
+ <enumeration value="33">
+ </enumeration>
+ <enumeration value="34">
+ </enumeration>
+ <enumeration value="35">
+ </enumeration>
+ <enumeration value="36">
+ </enumeration>
+ <enumeration value="37">
+ </enumeration>
+ <enumeration value="38">
+ </enumeration>
+ <enumeration value="39">
+ </enumeration>
+ <enumeration value="40">
+ </enumeration>
+ <enumeration value="41">
+ </enumeration>
+ <enumeration value="42">
+ </enumeration>
+ <enumeration value="43">
+ </enumeration>
+ <enumeration value="44">
+ </enumeration>
+ <enumeration value="45">
+ </enumeration>
+ <enumeration value="46">
+ </enumeration>
+ <enumeration value="47">
+ </enumeration>
+ <enumeration value="48">
+ </enumeration>
+ <enumeration value="49">
+ </enumeration>
+ <enumeration value="50">
+ </enumeration>
+ <enumeration value="51">
+ </enumeration>
+ <enumeration value="52">
+ </enumeration>
+ <enumeration value="53">
+ </enumeration>
+ <enumeration value="54">
+ </enumeration>
+ <enumeration value="55">
+ </enumeration>
+ <enumeration value="56">
+ </enumeration>
+ <enumeration value="57">
+ </enumeration>
+ <enumeration value="58">
+ </enumeration>
+ <enumeration value="59">
+ </enumeration>
+ <enumeration value="60">
+ </enumeration>
+ <enumeration value="61">
+ </enumeration>
+ <enumeration value="62">
+ </enumeration>
+ <enumeration value="63">
+ </enumeration>
+ <enumeration value="64">
+ </enumeration>
+ <enumeration value="65">
+ </enumeration>
+ <enumeration value="66">
+ </enumeration>
+ <enumeration value="67">
+ </enumeration>
+ <enumeration value="68">
+ </enumeration>
+ <enumeration value="69">
+ </enumeration>
+ <enumeration value="70">
+ </enumeration>
+ <enumeration value="71">
+ </enumeration>
+ <enumeration value="72">
+ </enumeration>
+ <enumeration value="73">
+ </enumeration>
+ <enumeration value="74">
+ </enumeration>
+ <enumeration value="75">
+ </enumeration>
+ <enumeration value="76">
+ </enumeration>
+ <enumeration value="77">
+ </enumeration>
+ <enumeration value="78">
+ </enumeration>
+ <enumeration value="79">
+ </enumeration>
+ <enumeration value="80">
+ </enumeration>
+ <enumeration value="81">
+ </enumeration>
+ <enumeration value="82">
+ </enumeration>
+ <enumeration value="83">
+ </enumeration>
+ <enumeration value="84">
+ </enumeration>
+ <enumeration value="85">
+ </enumeration>
+ <enumeration value="86">
+ </enumeration>
+ <enumeration value="87">
+ </enumeration>
+ <enumeration value="88">
+ </enumeration>
+ <enumeration value="89">
+ </enumeration>
+ <enumeration value="90">
+ </enumeration>
+ <enumeration value="91">
+ </enumeration>
+ <enumeration value="92">
+ </enumeration>
+ <enumeration value="93">
+ </enumeration>
+ <enumeration value="94">
+ </enumeration>
+ <enumeration value="95">
+ </enumeration>
+ <enumeration value="96">
+ </enumeration>
+ <enumeration value="97">
+ </enumeration>
+ <enumeration value="98">
+ </enumeration>
+ <enumeration value="99">
+ </enumeration>
+ <enumeration value="100">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="hasOptionalArg" type="boolean" use="required">
+ <annotation>
+ <documentation>
+ Specifies whether the Option can have an optional argument.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="valueSeparator" type="string">
+ <annotation>
+ <documentation>
+ The value separator. For example if the argument value was a Java property, the value separator would be &apos;=&apos;.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="optionId">
+ <annotation>
+ <documentation>
+ This element can refer to an option which was contributed by the org.genivi.commonapi.console.options extension point.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="optionId" type="string" use="required">
+ <annotation>
+ <documentation>
+ The unique identifier of the option which was contributed by the org.genivi.commonapi.console.options extension point.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.genivi.commonapi.console/src/org/genivi/commonapi/console/AbstractCommandLineHandler.java b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/AbstractCommandLineHandler.java
new file mode 100644
index 0000000..90937b4
--- /dev/null
+++ b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/AbstractCommandLineHandler.java
@@ -0,0 +1,66 @@
+/* Copyright (C) 2013-2014 BMW Group
+ * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+package org.genivi.commonapi.console;
+
+import org.apache.commons.cli.CommandLine;
+
+public abstract class AbstractCommandLineHandler implements ICommandLineHandler
+{
+ public AbstractCommandLineHandler()
+ {
+ }
+
+ /**
+ * This method has to be implemented. It will be called by the console plug-in if the application arguments match the specification.
+ *
+ * @param parsedArguments
+ * The parsed arguments with their values
+ * @return result of the excution
+ */
+ @Override
+ public abstract int excute(CommandLine parsedArguments);
+
+ /**
+ * Converts an instance the CommandLine Object into an array of strings.
+ *
+ * @param commandLine
+ * instance
+ * @return Arguments split into string array
+ */
+ public static String[] getArguments(CommandLine commandLine)
+ {
+ return CommandExecuter.getArguments(commandLine);
+ }
+
+ /**
+ * Converts an instance the CommandLine Object into an array of strings.
+ *
+ * @param commandLine
+ * instance
+ * @param keepIdOption
+ * if true the returned array will contain the ID option if available
+ * @return Arguments split into string array
+ */
+ public static String[] getArguments(CommandLine commandLine, boolean keepIdOption)
+ {
+ return CommandExecuter.getArguments(commandLine, keepIdOption);
+ }
+
+ /**
+ * Prints a message to the console and wraps the string to the same width as the outputs done by the command executer.
+ *
+ * @param message
+ * the message to print
+ * @param arguments
+ * Arguments referenced by the format specifiers in the message string. If there are more arguments than format specifiers,
+ * the extra arguments are ignored. The number of arguments is variable and may be zero.
+ */
+ public static void println(String message, Object... arguments)
+ {
+ CommandExecuter.println(message, arguments);
+ }
+}
diff --git a/org.genivi.commonapi.console/src/org/genivi/commonapi/console/CommandExecuter.java b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/CommandExecuter.java
new file mode 100644
index 0000000..a8a97d6
--- /dev/null
+++ b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/CommandExecuter.java
@@ -0,0 +1,611 @@
+/* Copyright (C) 2013-2014 BMW Group
+ * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+package org.genivi.commonapi.console;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.cli.AlreadySelectedException;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.MissingArgumentException;
+import org.apache.commons.cli.MissingOptionException;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionGroup;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.cli.Parser;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.UnrecognizedOptionException;
+import org.apache.commons.lang.WordUtils;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.core.runtime.Status;
+import org.genivi.commonapi.console.internal.Application;
+
+public enum CommandExecuter
+{
+ INSTANCE;
+
+ private final String COMMANDS_EXTENSION_POINT_ID = Application.PLUGIN_ID + ".commands";
+ private final String OPTIONS_EXTENSION_POINT_ID = Application.PLUGIN_ID + ".options";
+ private final String OPTION_GROUPS_EXTENSION_POINT_ID = Application.PLUGIN_ID + ".optionGroups";
+
+ private final String COMMAND_ID_ATTRIBUTE_NAME = "id";
+ private final String COMMAND_NAME_ATTRIBUTE_NAME = "name";
+ private final String COMMAND_HANDLER_ATTRIBUTE_NAME = "class";
+ private final String COMMAND_SYNTAX_ATTRIBUTE_NAME = "syntax";
+
+ private final String OPTION_ID_ATTRIBUTE_NAME = "id";
+ private final String OPTION_SHORT_NAME_ATTRIBUTE_NAME = "shortName";
+ private final String OPTION_LONG_NAME_ATTRIBUTE_NAME = "longName";
+ private final String OPTION_DESCRIPTION_ATTRIBUTE_NAME = "description";
+ private final String OPTION_REQUIRED_ATTRIBUTE_NAME = "required";
+ private final String OPTION_ARG_COUNT_ATTRIBUTE_NAME = "argCount";
+ private final String OPTION_ARG_NAME_ATTRIBUTE_NAME = "argName";
+ private final String OPTION_HAS_OPTIONAL_ARG_ATTRIBUTE_NAME = "hasOptionalArg";
+ private final String OPTION_VALUE_SEPARATOR_ATTRIBUTE_NAME = "valueSeparator";
+
+ private final String OPTION_ID_OPTION_ID_ATTRIBUTE_NAME = "optionId";
+
+ private final String OPTION_GROUP_ID_ATTRIBUTE_NAME = "id";
+ private final String OPTION_GROUP_REQUIRED_ATTRIBUTE_NAME = "required";
+
+ private final String OPTION_GROUP_OPTION_GROUP_ID_ATTRIBUTE_NAME = "optionGroupId";
+
+ private final String OPTIONS_CONFIGURATION_NAME = "options";
+ private final String HEADER_CONFIGURATION_NAME = "header";
+ private final String FOOTER_CONFIGURATION_NAME = "footer";
+ private final String OPTION_CONFIGURATION_NAME = "option";
+ private final String OPTION_ID_CONFIGURATION_NAME = "optionId";
+ private final String OPTION_GROUP_CONFIGURATION_NAME = "optionGroup";
+ private final String OPTION_GROUP_ID_CONFIGURATION_NAME = "optionGroupId";
+
+ private final String ECLIPSE_LAUNCHER_PROPERTY_NAME = "eclipse.launcher";
+
+ private final String ID_OPTION_DESCRIPTION = "%s of the desired console command";
+ private final String EXTENSION_POINT_PARSING_ERROR_MESSAGE = "An error occured while parsing console command \"%s\"!";
+ private final String OPTION_ID_NOT_FOUND_MESSAGE = "The option ID \"%s\" could not be found!";
+ private final String OPTION_GROUP_ID_NOT_FOUND_MESSAGE = "The option group ID \"%s\" could not be found!";
+ private final String NO_REQUIRED_OPTION_MESSAGE = "This console command needs to specify at least one required option!";
+ private final String HELP_NO_COMMANDS_TEXT_MESSAGE = "No registered console commands available!";
+ private final String HELP_NAME_TEXT_MESSAGE = "Command: %s";
+ private final String HELP_ID_TEXT_MESSAGE = "%s: %s";
+ private final String HELP_WRONG_ID_MESSAGE = HELP_ID_TEXT_MESSAGE + "%nID does not match: %s";
+ private final String HELP_SEVERAL_COMMANDS_MESSAGE = "Several console commands are compatible to this set of parameters. Add ID option to select the desired one.%n";
+ private final String EXECUTE_COMMAND_MESSAGE = "Excuting %s...%n" ;
+ private final String LAUNCHER_NAME;
+ private final Option ID_OPTION;
+
+ public static final String SHORT_ID_OPTION = "ID";
+ public static final String LONG_ID_OPTION = "COMMAND_ID";
+
+ public static final int DEFAULT_RETURN_VALUE = -1000;
+ public static final int CONSOLE_WIDTH = 80;
+
+ private int returnValue = DEFAULT_RETURN_VALUE;
+
+ private CommandExecuter()
+ {
+ String launcherName = System.getProperty(ECLIPSE_LAUNCHER_PROPERTY_NAME);
+ LAUNCHER_NAME = (null != launcherName) ? new Path(launcherName).lastSegment() : Platform.getProduct().getName();
+
+ ID_OPTION = new Option(SHORT_ID_OPTION, LONG_ID_OPTION, true, String.format(ID_OPTION_DESCRIPTION, SHORT_ID_OPTION));
+ ID_OPTION.setRequired(true);
+ ID_OPTION.setArgs(1);
+ ID_OPTION.setOptionalArg(true);
+ }
+
+ public int executeCommand(String command)
+ {
+ Assert.isNotNull(command);
+
+ String[] arguments = (command.length() > 0) ? (command.trim().split("\\s")) : (new String[0]);
+
+ return executeCommand(arguments);
+ }
+
+ public int executeCommand(String[] arguments)
+ {
+ Assert.isNotNull(arguments);
+
+ final List<ConsoleConfiguration> configurations = getParsedExtensionPointConfigurations();
+
+ // Print message if there are no registered console commands.
+ if (configurations.size() == 0)
+ {
+ println(HELP_NO_COMMANDS_TEXT_MESSAGE);
+
+ return DEFAULT_RETURN_VALUE;
+ }
+
+ // Print help text if no option is available.
+ if (arguments.length == 0)
+ {
+ printHelp(configurations);
+
+ return DEFAULT_RETURN_VALUE;
+ }
+
+ // Find a suitable console configuration.
+ final List<ConsoleConfiguration> perfectMatchingConfigurations = new ArrayList<ConsoleConfiguration>();
+ final List<ConsoleConfiguration> partialMatchingConfigurations = new ArrayList<ConsoleConfiguration>();
+ final List<ConsoleConfiguration> notMatchingConfigurations = new ArrayList<ConsoleConfiguration>();
+
+ Parser parser = new PosixParser();
+
+ for (ConsoleConfiguration configuration : configurations)
+ {
+ try
+ {
+ CommandLine commandLine = parser.parse(configuration.options, arguments);
+
+ // Add ID option and ID information to configuration. Thus if there are several
+ // perfect matches the printHelp method can print this information.
+ configuration.options.addOption(ID_OPTION);
+ configuration.message = String.format(HELP_ID_TEXT_MESSAGE, SHORT_ID_OPTION, configuration.id);
+ configuration.commandLine = commandLine;
+ perfectMatchingConfigurations.add(configuration);
+ }
+ catch (MissingOptionException | MissingArgumentException | AlreadySelectedException exception)
+ {
+ configuration.message = exception.getMessage();
+ partialMatchingConfigurations.add(configuration);
+ }
+ catch (UnrecognizedOptionException exception)
+ {
+ // Check if the unrecognized option is the ID option.
+ String unrecognizedOption = exception.getOption();
+
+ if (unrecognizedOption.equals("-" + SHORT_ID_OPTION) || unrecognizedOption.equals("--" + LONG_ID_OPTION))
+ {
+ try
+ {
+ // Add ID option to options object an parse arguments again.
+ CommandLine commandLine = parser.parse(configuration.options.addOption(ID_OPTION), arguments);
+ String idValue = commandLine.getOptionValue(SHORT_ID_OPTION);
+
+ // The correct console configuration is found if parsing did not throw an
+ // exception and the ID option equals extension point ID.
+ if (configuration.id.equals(idValue))
+ {
+ configuration.commandLine = commandLine;
+ perfectMatchingConfigurations.add(configuration);
+ }
+ else
+ {
+ configuration.message = String.format(HELP_WRONG_ID_MESSAGE, SHORT_ID_OPTION, configuration.id, idValue);
+ partialMatchingConfigurations.add(configuration);
+ }
+ }
+ catch (ParseException e)
+ {
+ configuration.message = e.getMessage();
+ notMatchingConfigurations.add(configuration);
+ }
+ }
+ else
+ {
+ configuration.message = exception.getMessage();
+ notMatchingConfigurations.add(configuration);
+ }
+ }
+ catch (ParseException exception)
+ {
+ configuration.message = exception.getMessage();
+ notMatchingConfigurations.add(configuration);
+ }
+ }
+
+ // Execute compatible command or print help text
+ if (perfectMatchingConfigurations.size() == 1)
+ {
+ SafeRunner.run(new ISafeRunnable()
+ {
+ @Override
+ public void run() throws Exception
+ {
+ ConsoleConfiguration configuration = perfectMatchingConfigurations.get(0);
+
+ if (configurations.size() > 1)
+ {
+ println(EXECUTE_COMMAND_MESSAGE, configuration.name);
+ }
+
+ Object executable = configuration.commandConfiguration.createExecutableExtension(COMMAND_HANDLER_ATTRIBUTE_NAME);
+ ICommandLineHandler handler = (ICommandLineHandler) executable;
+
+ returnValue = handler.excute(configuration.commandLine);
+ }
+
+ @Override
+ public void handleException(Throwable throwable)
+ {
+ log(throwable);
+ }
+ });
+ }
+ else if (perfectMatchingConfigurations.size() > 1)
+ {
+ println(HELP_SEVERAL_COMMANDS_MESSAGE);
+ printHelp(perfectMatchingConfigurations);
+ }
+ else if (partialMatchingConfigurations.size() > 0)
+ {
+ printHelp(partialMatchingConfigurations);
+ }
+ else
+ {
+ printHelp(notMatchingConfigurations);
+ }
+
+ return returnValue;
+ }
+
+ private void printHelp(List<ConsoleConfiguration> configurations)
+ {
+ for (ConsoleConfiguration configuration : configurations)
+ {
+ printHelp(configuration);
+ }
+ }
+
+ private void printHelp(ConsoleConfiguration configuration)
+ {
+ println(HELP_NAME_TEXT_MESSAGE, configuration.name);
+
+ if (null != configuration.message)
+ {
+ println(configuration.message);
+ }
+
+ boolean generateSyntax = true;
+ String syntax = LAUNCHER_NAME;
+
+ if (null != configuration.syntax && configuration.syntax.length() > 0)
+ {
+ syntax = syntax + " " + configuration.syntax;
+ generateSyntax = false;
+ }
+
+ new HelpFormatter().printHelp(CONSOLE_WIDTH, syntax, configuration.header, configuration.options, configuration.footer,
+ generateSyntax);
+
+ System.out.println();
+ }
+
+ private void log(Throwable throwable)
+ {
+ IStatus status = new Status(Status.ERROR, Application.PLUGIN_ID, throwable.getMessage(), throwable);
+
+ Platform.getLog(Platform.getBundle(Application.PLUGIN_ID)).log(status);
+ }
+
+ private List<ConsoleConfiguration> getParsedExtensionPointConfigurations()
+ {
+ List<ConsoleConfiguration> configurations = new ArrayList<ConsoleConfiguration>();
+
+ // Parse extension point information
+ IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
+ IExtensionPoint commandsExtensionPoint = extensionRegistry.getExtensionPoint(COMMANDS_EXTENSION_POINT_ID);
+
+ if (null != commandsExtensionPoint)
+ {
+ Map<String, IConfigurationElement> referenceableOptionConfigurations = parseExtensionPoint(
+ extensionRegistry.getExtensionPoint(OPTIONS_EXTENSION_POINT_ID), OPTION_ID_ATTRIBUTE_NAME);
+ Map<String, IConfigurationElement> referenceableOptionGroupConfigurations = parseExtensionPoint(
+ extensionRegistry.getExtensionPoint(OPTION_GROUPS_EXTENSION_POINT_ID), OPTION_GROUP_ID_ATTRIBUTE_NAME);
+
+ for (IConfigurationElement commandConfiguration : commandsExtensionPoint.getConfigurationElements())
+ {
+ String id = commandConfiguration.getAttribute(COMMAND_ID_ATTRIBUTE_NAME);
+
+ try
+ {
+ Options options = new Options();
+
+ String name = commandConfiguration.getAttribute(COMMAND_NAME_ATTRIBUTE_NAME);
+ String syntax = commandConfiguration.getAttribute(COMMAND_SYNTAX_ATTRIBUTE_NAME);
+ String header = null;
+ String footer = null;
+
+ for (IConfigurationElement childConfiguration : commandConfiguration.getChildren())
+ {
+ switch (childConfiguration.getName())
+ {
+ case OPTIONS_CONFIGURATION_NAME:
+ for (IConfigurationElement optionConfiguration : childConfiguration.getChildren())
+ {
+ Option option = getOptionByConfiguration(optionConfiguration, referenceableOptionConfigurations);
+ OptionGroup optionGroup = getOptionGroupByConfiguration(optionConfiguration,
+ referenceableOptionGroupConfigurations, referenceableOptionConfigurations);
+
+ if (null != option)
+ {
+ options.addOption(option);
+ }
+
+ if (null != optionGroup)
+ {
+ options.addOptionGroup(optionGroup);
+ }
+ }
+ break;
+
+ case HEADER_CONFIGURATION_NAME:
+ header = childConfiguration.getValue();
+ break;
+
+ case FOOTER_CONFIGURATION_NAME:
+ footer = childConfiguration.getValue();
+ break;
+ }
+ }
+
+ configurations.add(new ConsoleConfiguration(commandConfiguration, options, id, name, syntax, header, footer));
+ }
+ catch (Exception exception)
+ {
+ String message = String.format(EXTENSION_POINT_PARSING_ERROR_MESSAGE + " " + exception.getMessage(), id);
+
+ log(new IllegalArgumentException(message, exception));
+ }
+ }
+ }
+
+ return configurations;
+ }
+
+ private Map<String, IConfigurationElement> parseExtensionPoint(IExtensionPoint extensionPoint, String keyAttributeName)
+ {
+ Map<String, IConfigurationElement> map = new HashMap<String, IConfigurationElement>();
+
+ if (null != extensionPoint && null != keyAttributeName)
+ {
+ for (IConfigurationElement configurationElement : extensionPoint.getConfigurationElements())
+ {
+ map.put(configurationElement.getAttribute(keyAttributeName), configurationElement);
+ }
+ }
+
+ return map;
+ }
+
+ private Option getOptionByConfiguration(IConfigurationElement optionConfiguration,
+ Map<String, IConfigurationElement> referenceableOptionConfigurations)
+ {
+ switch (optionConfiguration.getName())
+ {
+ case OPTION_CONFIGURATION_NAME:
+ return createOption(optionConfiguration);
+
+ case OPTION_ID_CONFIGURATION_NAME:
+ String referencedOptionId = optionConfiguration.getAttribute(OPTION_ID_OPTION_ID_ATTRIBUTE_NAME);
+ IConfigurationElement referencedOptionConfiguration = referenceableOptionConfigurations.get(referencedOptionId);
+
+ if (null == referencedOptionConfiguration)
+ {
+ throw new IllegalArgumentException(String.format(OPTION_ID_NOT_FOUND_MESSAGE, referencedOptionId));
+ }
+
+ return createOption(referencedOptionConfiguration);
+
+ default:
+ return null;
+ }
+ }
+
+ private OptionGroup getOptionGroupByConfiguration(IConfigurationElement optionConfiguration,
+ Map<String, IConfigurationElement> referenceableOptionGroupConfigurations,
+ Map<String, IConfigurationElement> referenceableOptionConfigurations)
+ {
+ switch (optionConfiguration.getName())
+ {
+ case OPTION_GROUP_CONFIGURATION_NAME:
+ return createOptionGroup(optionConfiguration, referenceableOptionConfigurations);
+
+ case OPTION_GROUP_ID_CONFIGURATION_NAME:
+ String referencedOptionGroupId = optionConfiguration.getAttribute(OPTION_GROUP_OPTION_GROUP_ID_ATTRIBUTE_NAME);
+ IConfigurationElement referencedOptionGroupConfiguration = referenceableOptionGroupConfigurations
+ .get(referencedOptionGroupId);
+
+ if (null == referencedOptionGroupConfiguration)
+ {
+ throw new IllegalArgumentException(String.format(OPTION_GROUP_ID_NOT_FOUND_MESSAGE, referencedOptionGroupId));
+ }
+
+ return createOptionGroup(referencedOptionGroupConfiguration, referenceableOptionConfigurations);
+
+ default:
+ return null;
+ }
+ }
+
+ private Option createOption(IConfigurationElement optionConfiguration)
+ {
+ String shortName = optionConfiguration.getAttribute(OPTION_SHORT_NAME_ATTRIBUTE_NAME);
+ String longName = optionConfiguration.getAttribute(OPTION_LONG_NAME_ATTRIBUTE_NAME);
+ String description = optionConfiguration.getAttribute(OPTION_DESCRIPTION_ATTRIBUTE_NAME);
+ String required = optionConfiguration.getAttribute(OPTION_REQUIRED_ATTRIBUTE_NAME);
+ String argCount = optionConfiguration.getAttribute(OPTION_ARG_COUNT_ATTRIBUTE_NAME);
+ String argName = optionConfiguration.getAttribute(OPTION_ARG_NAME_ATTRIBUTE_NAME);
+ String hasOptionalArg = optionConfiguration.getAttribute(OPTION_HAS_OPTIONAL_ARG_ATTRIBUTE_NAME);
+ String valueSeparator = optionConfiguration.getAttribute(OPTION_VALUE_SEPARATOR_ATTRIBUTE_NAME);
+
+ Option option = new Option(shortName, description);
+ option.setRequired(Boolean.parseBoolean(required));
+ option.setArgs(Integer.parseInt(argCount));
+ option.setOptionalArg(Boolean.parseBoolean(hasOptionalArg));
+
+ if (null != longName)
+ {
+ option.setLongOpt(longName);
+ }
+
+ if (null != argName)
+ {
+ option.setArgName(argName);
+ }
+
+ if (null != valueSeparator)
+ {
+ option.setValueSeparator(valueSeparator.charAt(0));
+ }
+
+ return option;
+ }
+
+ private OptionGroup createOptionGroup(IConfigurationElement optionGroupConfiguration,
+ Map<String, IConfigurationElement> referenceableOptionConfigurations)
+ {
+ String required = optionGroupConfiguration.getAttribute(OPTION_GROUP_REQUIRED_ATTRIBUTE_NAME);
+
+ OptionGroup optionGroup = new OptionGroup();
+ optionGroup.setRequired(Boolean.parseBoolean(required));
+
+ for (IConfigurationElement optionConfiguration : optionGroupConfiguration.getChildren())
+ {
+ Option option = getOptionByConfiguration(optionConfiguration, referenceableOptionConfigurations);
+
+ if (null != option)
+ {
+ optionGroup.addOption(option);
+ }
+ }
+
+ return optionGroup;
+ }
+
+ private class ConsoleConfiguration
+ {
+ public final IConfigurationElement commandConfiguration;
+ public final Options options;
+ public final String id;
+ public final String name;
+ public final String syntax;
+ public final String header;
+ public final String footer;
+
+ public CommandLine commandLine;
+ public String message;
+
+ public ConsoleConfiguration(IConfigurationElement commandConfiguration, Options options, String id, String name, String syntax,
+ String header, String footer, CommandLine commandLine, String message)
+ {
+ this.commandConfiguration = commandConfiguration;
+ this.options = options;
+ this.id = id;
+ this.name = name;
+ this.syntax = syntax;
+ this.header = header;
+ this.footer = footer;
+ this.commandLine = commandLine;
+ this.message = message;
+ }
+
+ public ConsoleConfiguration(IConfigurationElement commandConfiguration, Options options, String id, String name, String syntax,
+ String header, String footer)
+ {
+ this(commandConfiguration, options, id, name, syntax, header, footer, null, null);
+ }
+ }
+
+ /**
+ * Converts an instance the CommandLine Object into an array of strings.
+ *
+ * @param commandLine
+ * instance
+ * @return Arguments split into string array
+ */
+ public static String[] getArguments(CommandLine commandLine)
+ {
+ return getArguments(commandLine, false);
+ }
+
+ /**
+ * Converts an instance the CommandLine Object into an array of strings.
+ *
+ * @param commandLine
+ * instance
+ * @param keepIdOption
+ * if true the returned array will contain the ID option if available
+ * @return Arguments split into string array
+ */
+ public static String[] getArguments(CommandLine commandLine, boolean keepIdOption)
+ {
+ Assert.isNotNull(commandLine);
+
+ List<String> argumentsList = new ArrayList<String>();
+
+ Option[] options = commandLine.getOptions();
+
+ if (null != options)
+ {
+ for (Option option : options)
+ {
+ String optionString = option.getOpt();
+
+ if (keepIdOption == false && SHORT_ID_OPTION.equals(optionString))
+ {
+ continue;
+ }
+
+ argumentsList.add("-" + optionString);
+
+ String[] values = option.getValues();
+
+ if (null != values)
+ {
+ for (String value : values)
+ {
+ argumentsList.add(value);
+ }
+ }
+ }
+ }
+
+ return argumentsList.toArray(new String[argumentsList.size()]);
+ }
+
+ /**
+ * Prints a message to the console and wraps the string to the same width as the outputs done by the command executer.
+ *
+ * @param message
+ * the message to print
+ * @param arguments
+ * Arguments referenced by the format specifiers in the message string. If there are more arguments than format specifiers,
+ * the extra arguments are ignored. The number of arguments is variable and may be zero.
+ */
+ public static void println(String message, Object... arguments)
+ {
+ Assert.isNotNull(message);
+
+ String formattedString = String.format(message, arguments);
+ String newLineString = String.format("%n");
+
+ // Split message into single line strings because the wrap method cannot handle multi-line messages.
+ for (String line : formattedString.split(newLineString))
+ {
+ System.out.println(WordUtils.wrap(line, CONSOLE_WIDTH));
+ }
+
+ // A new-line character at the end gets lost because of the split method.
+ if (formattedString.endsWith(newLineString))
+ {
+ System.out.println();
+ }
+ }
+}
diff --git a/org.genivi.commonapi.console/src/org/genivi/commonapi/console/ConsoleLogger.java b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/ConsoleLogger.java
new file mode 100644
index 0000000..9b6a738
--- /dev/null
+++ b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/ConsoleLogger.java
@@ -0,0 +1,43 @@
+package org.genivi.commonapi.console;
+
+/**
+ * A simple command line logger.
+ *
+ * @author notbert
+ *
+ */
+
+
+public class ConsoleLogger {
+
+ private static boolean isLogoutput = true;
+ private static boolean isErrorLogoutput = true;
+
+ /**
+ * Enable or disable the log output
+ * @param enabled true or false
+ */
+ public static void enableLogging(boolean enabled) {
+ isLogoutput = enabled;
+ }
+
+ /**
+ * Enable or disable the error log output
+ * @param enabled true or false
+ */
+ public static void enableErrorLogging(boolean enabled) {
+ isErrorLogoutput = enabled;
+ }
+
+ public static void printLog(String message) {
+ if(isLogoutput) {
+ System.out.println(message);
+ }
+ }
+
+ public static void printErrorLog(String message) {
+ if(isErrorLogoutput) {
+ System.err.println(message);
+ }
+ }
+}
diff --git a/org.genivi.commonapi.console/src/org/genivi/commonapi/console/ICommandLineHandler.java b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/ICommandLineHandler.java
new file mode 100644
index 0000000..5c7db31
--- /dev/null
+++ b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/ICommandLineHandler.java
@@ -0,0 +1,21 @@
+/* Copyright (C) 2013-2014 BMW Group
+ * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+package org.genivi.commonapi.console;
+
+import org.apache.commons.cli.CommandLine;
+
+public interface ICommandLineHandler
+{
+ /**
+ * This method has to be implemented. It will be called by the console plug-in if the application arguments match the specification.
+ *
+ * @param parsedArguments
+ * The parsed arguments with their values
+ * @return result of the excution
+ */
+ public int excute(CommandLine parsedArguments);
+}
diff --git a/org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/Activator.java b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/Activator.java
new file mode 100644
index 0000000..8cabd56
--- /dev/null
+++ b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/Activator.java
@@ -0,0 +1,150 @@
+package org.genivi.commonapi.console.internal;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin
+{
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.genivi.commonapi.console"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ private static final String ABOUT_MAPPINGS = "$nl$/about.mappings"; //$NON-NLS-1$
+
+ public static final String VERSION_MAPPING = "0"; //$NON-NLS-1$
+ public static final String BUILD_ID_MAPPING = "1"; //$NON-NLS-1$
+ public static final String ARCHITECTURE_MAPPING = "2"; //$NON-NLS-1$
+ public static final String VERSION = "VERSION"; //$NON-NLS-1$
+ public static final String BUILD_ID = "BUILD_ID"; //$NON-NLS-1$
+
+ public Map<String, String> mappings = null;
+
+ /**
+ * The constructor
+ */
+ public Activator()
+ {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception
+ {
+ super.start(context);
+ plugin = this;
+
+ mappings = loadMappings(Platform.getBundle(PLUGIN_ID));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception
+ {
+ plugin = null;
+ super.stop(context);
+ }
+
+ public String getMapping(String key)
+ {
+ return mappings.get(key);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault()
+ {
+ return plugin;
+ }
+
+ private HashMap<String, String> loadMappings(Bundle definingBundle)
+ {
+ URL location = FileLocator.find(definingBundle, new Path(ABOUT_MAPPINGS), Collections.emptyMap());
+ PropertyResourceBundle bundle = null;
+ InputStream inputStream = null;
+
+ if (null != location)
+ {
+ try
+ {
+ inputStream = location.openStream();
+ bundle = new PropertyResourceBundle(inputStream);
+ }
+ catch (IOException e)
+ {
+ bundle = null;
+ }
+ finally
+ {
+ try
+ {
+ if (null != inputStream)
+ {
+ inputStream.close();
+ }
+ }
+ catch (IOException e)
+ {
+ // do nothing if we fail to close
+ }
+ }
+ }
+
+ HashMap<String, String> mappings = new HashMap<String, String>();
+
+ if (null != bundle)
+ {
+ boolean found = true;
+
+ for (int i = 0; true == found; i++)
+ {
+ try
+ {
+ String key = Integer.toString(i);
+ String value = bundle.getString(key);
+ int valueLength = value.length();
+
+ if (valueLength > 2 && value.charAt(0) == '$' && value.charAt(valueLength - 1) == '$')
+ {
+ String systemPropertyKey = value.substring(1, valueLength - 1);
+ value = System.getProperty(systemPropertyKey); //$NON-NLS-1$;
+ }
+
+ mappings.put(key, value);
+ }
+ catch (MissingResourceException e)
+ {
+ found = false;
+ }
+ }
+ }
+
+ return mappings;
+ }
+}
diff --git a/org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/Application.java b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/Application.java
new file mode 100644
index 0000000..79baf77
--- /dev/null
+++ b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/Application.java
@@ -0,0 +1,51 @@
+/* Copyright (C) 2013-2015 BMW Group
+ * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+package org.genivi.commonapi.console.internal;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.franca.core.dsl.FrancaIDLStandaloneSetup;
+import org.franca.deploymodel.dsl.FDeployStandaloneSetup;
+import org.genivi.commonapi.console.CommandExecuter;
+
+public class Application implements IApplication
+{
+ public static final String PLUGIN_ID = "org.genivi.commonapi.console";
+
+ private final long MINIMUM_RUNTIME_MS = 100;
+
+ @Override
+ public Object start(IApplicationContext context) throws Exception
+ {
+ long startTime = System.currentTimeMillis();
+
+ FrancaIDLStandaloneSetup.doSetup();
+ FDeployStandaloneSetup.doSetup();
+
+ int returnValue = CommandExecuter.INSTANCE.executeCommand(Platform.getApplicationArgs());
+
+ // Prevent launcher messages if exit code is not 0.
+ System.setProperty(IApplicationContext.EXIT_DATA_PROPERTY, "");
+
+ // The application has to run at least 100 ms. Otherwise the plug-in "org.apache.felix.gogo.shell"
+ // will throw an interrupt exception because its startup process takes about 100 ms.
+ long waitTime = MINIMUM_RUNTIME_MS - (System.currentTimeMillis() - startTime);
+
+ if (waitTime > 0)
+ {
+ Thread.sleep(waitTime);
+ }
+
+ return new Integer(returnValue);
+ }
+
+ @Override
+ public void stop()
+ {
+ }
+}
diff --git a/org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/HelpCommandHandler.java b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/HelpCommandHandler.java
new file mode 100644
index 0000000..319bc53
--- /dev/null
+++ b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/HelpCommandHandler.java
@@ -0,0 +1,23 @@
+/* Copyright (C) 2013-2014 BMW Group
+ * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+package org.genivi.commonapi.console.internal;
+
+import org.apache.commons.cli.CommandLine;
+import org.genivi.commonapi.console.AbstractCommandLineHandler;
+import org.genivi.commonapi.console.CommandExecuter;
+
+public class HelpCommandHandler extends AbstractCommandLineHandler
+{
+ @Override
+ public int excute(CommandLine parsedArguments)
+ {
+ // Command executer will print help on empty command.
+ CommandExecuter.INSTANCE.executeCommand("");
+
+ return 0;
+ }
+}
diff --git a/org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/VersionCommandHandler.java b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/VersionCommandHandler.java
new file mode 100644
index 0000000..57c68c2
--- /dev/null
+++ b/org.genivi.commonapi.console/src/org/genivi/commonapi/console/internal/VersionCommandHandler.java
@@ -0,0 +1,91 @@
+package org.genivi.commonapi.console.internal;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.commons.cli.CommandLine;
+import org.eclipse.core.runtime.Platform;
+import org.genivi.commonapi.console.AbstractCommandLineHandler;
+import org.genivi.commonapi.console.CommandExecuter;
+import org.osgi.framework.Bundle;
+
+public class VersionCommandHandler extends AbstractCommandLineHandler
+{
+ public static final String SHORT_ALL_OPTION = "a";
+ public static final String SHORT_PLUGINS_OPTION = "p";
+
+ private final char HEADER_SEPARATOR_CHAR = '-';
+ private final String LIST_SEPARATOR_TEXT = " ";
+
+ private final String SYMBOLIC_NAME_TEXT = "Symbolic Name";
+ private final String VERSION_TEXT = "Version";
+ private final String BIT_TEXT = "Bit";
+
+ private final String CODE_GENERATOR_MESSAGE = "Code Generator:";
+ private final String VERSION_MESSAGE = VERSION_TEXT + ":";
+ private final String BUILD_ID_MESSAGE = "Build id:";
+ private final String ARCHITECTURE_MESSAGE = "Architecture:";
+ private final String PLUGINS_MESSAGE = "Plug-ins:";
+
+ final int DEFAULT_NAME_WIDTH = 50;
+
+ @Override
+ public int excute(final CommandLine parsedArguments)
+ {
+ final boolean printAllVersions = parsedArguments.hasOption(SHORT_ALL_OPTION);
+ final boolean printPluginVersions = parsedArguments.hasOption(SHORT_PLUGINS_OPTION);
+
+ if (printAllVersions)
+ {
+ println(CODE_GENERATOR_MESSAGE);
+ }
+
+ if (printAllVersions || !printPluginVersions)
+ {
+ final String formatString = "%-13s %s";
+
+ println(formatString, VERSION_MESSAGE, Activator.getDefault().getMapping(Activator.VERSION_MAPPING));
+ println(formatString, BUILD_ID_MESSAGE, Activator.getDefault().getMapping(Activator.BUILD_ID_MAPPING));
+ println(formatString + " %s", ARCHITECTURE_MESSAGE, Activator.getDefault().getMapping(Activator.ARCHITECTURE_MAPPING), BIT_TEXT);
+ println("");
+ }
+
+ if (printAllVersions)
+ {
+ println(PLUGINS_MESSAGE);
+ println("%-" + DEFAULT_NAME_WIDTH + "s%s%s", SYMBOLIC_NAME_TEXT, LIST_SEPARATOR_TEXT, VERSION_TEXT);
+ println(String.format("%-" + CommandExecuter.CONSOLE_WIDTH + "s", "").replace(' ', HEADER_SEPARATOR_CHAR));
+ }
+
+ if (printAllVersions || printPluginVersions)
+ {
+ final TreeMap<String, String> sortedbundleInfos = new TreeMap<String, String>();
+
+ for (final Bundle bundle : Platform.getBundle(Activator.PLUGIN_ID).getBundleContext().getBundles())
+ {
+ sortedbundleInfos.put(bundle.getSymbolicName(), bundle.getVersion().toString());
+ }
+
+ final int width = CommandExecuter.CONSOLE_WIDTH - LIST_SEPARATOR_TEXT.length();
+
+ for (final Map.Entry<String, String> bundleInfo : sortedbundleInfos.entrySet())
+ {
+ final String name = bundleInfo.getKey();
+ final String version = bundleInfo.getValue();
+ int nameWidth = DEFAULT_NAME_WIDTH;
+ int versionWidth = version.length();
+
+ if (versionWidth > width - nameWidth)
+ {
+ nameWidth = Math.max(width - versionWidth, name.length());
+ }
+
+ println("%-" + nameWidth + "s%s%s", name, LIST_SEPARATOR_TEXT, version);
+ }
+
+ println("");
+ }
+
+ return 0;
+ }
+}
diff --git a/org.genivi.commonapi.core.cli.feature/.gitignore b/org.genivi.commonapi.core.cli.feature/.gitignore
index ea8c4bf..873d37a 100644
--- a/org.genivi.commonapi.core.cli.feature/.gitignore
+++ b/org.genivi.commonapi.core.cli.feature/.gitignore
@@ -1 +1,2 @@
+*~
/target
diff --git a/org.genivi.commonapi.core.cli.feature/.project b/org.genivi.commonapi.core.cli.feature/.project
index 98a34ba..9273e3c 100644
--- a/org.genivi.commonapi.core.cli.feature/.project
+++ b/org.genivi.commonapi.core.cli.feature/.project
@@ -14,4 +14,4 @@
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
-</projectDescription> \ No newline at end of file
+</projectDescription>
diff --git a/org.genivi.commonapi.core.cli.feature/.settings/org.eclipse.core.resources.prefs b/org.genivi.commonapi.core.cli.feature/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.genivi.commonapi.core.cli.feature/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.genivi.commonapi.core.cli.feature/.settings/org.eclipse.core.runtime.prefs b/org.genivi.commonapi.core.cli.feature/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/org.genivi.commonapi.core.cli.feature/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.genivi.commonapi.core.cli.feature/build.properties b/org.genivi.commonapi.core.cli.feature/build.properties
index 64f93a9..3b8a221 100644
--- a/org.genivi.commonapi.core.cli.feature/build.properties
+++ b/org.genivi.commonapi.core.cli.feature/build.properties
@@ -1 +1,2 @@
+javacDefaultEncoding.. = UTF-8
bin.includes = feature.xml
diff --git a/org.genivi.commonapi.core.cli.feature/feature.xml b/org.genivi.commonapi.core.cli.feature/feature.xml
index b58fe35..495a14f 100644
--- a/org.genivi.commonapi.core.cli.feature/feature.xml
+++ b/org.genivi.commonapi.core.cli.feature/feature.xml
@@ -2,13 +2,9 @@
<feature
id="org.genivi.commonapi.core.cli.feature"
label="CommonAPI Generator Feature"
- version="2.1.6.qualifier"
+ version="3.1.1.qualifier"
provider-name="BMW AG">
- <requires>
- <import feature="org.franca.feature" version="0.8.10.201309262002" match="compatible"/>
- </requires>
-
<plugin
id="org.genivi.commonapi.core.cli"
download-size="0"
@@ -23,479 +19,4 @@
version="0.0.0"
unpack="false"/>
- <plugin
- id="org.genivi.commonapi.dbus"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="com.google.guava"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.ecore"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.ecore.change"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.ecore.xmi"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.common"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.apache.commons.logging"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.apache.log4j"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtext"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtext.builder"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="com.google.inject"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.codegen.ecore"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtext.util"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.core.resources"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtend2.lib"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtext.generator"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtend.lib"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtext.xbase.lib"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.franca.core.dsl"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.franca.deploymodel.dsl"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.franca.core"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.antlr.runtime"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtext.smap"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtext.xbase"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtext.ecore"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.mwe2.lib"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.mwe.utils"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.mwe2.launch"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtext.ui"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtext.ui.ecore"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtext.common.types"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtext.ui.shared"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.ecore.editor"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xpand"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtend"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.mwe.core"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.mwe2.runtime"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.mwe2.language"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.apache.commons.cli"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtend.typesystem.emf"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.apache.commons.lang"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.core.filesystem"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.codegen"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.jdt.core"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.text"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.jdt.launching"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.debug.core"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.core.variables"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.ecore.edit"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.edit.ui"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.edit"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.jface.text"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.ui.ide"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.emf.common.ui"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.ui.views"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.jdt.debug"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.ui.editors"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.ui.forms"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.ui.workbench.texteditor"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.compare.core"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.core.filebuffers"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.equinox.p2.engine"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.equinox.p2.metadata"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.equinox.p2.core"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.equinox.p2.repository"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.equinox.p2.metadata.repository"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.equinox.security"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.xtext.activities"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
</feature>
diff --git a/org.genivi.commonapi.core.cli.feature/pom.xml b/org.genivi.commonapi.core.cli.feature/pom.xml
index f2c66d3..dcfd4b7 100644
--- a/org.genivi.commonapi.core.cli.feature/pom.xml
+++ b/org.genivi.commonapi.core.cli.feature/pom.xml
@@ -6,8 +6,8 @@
<packaging>eclipse-feature</packaging>
<parent>
<groupId>commonapi</groupId>
- <artifactId>org.genivi.commonapi.releng</artifactId>
- <version>2.1.6-SNAPSHOT</version>
- <relativePath>../org.genivi.commonapi.releng</relativePath>
+ <artifactId>org.genivi.commonapi.core.releng</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
+ <relativePath>../org.genivi.commonapi.core.releng</relativePath>
</parent>
-</project> \ No newline at end of file
+</project>
diff --git a/org.genivi.commonapi.core.cli.product/.gitignore b/org.genivi.commonapi.core.cli.product/.gitignore
new file mode 100644
index 0000000..873d37a
--- /dev/null
+++ b/org.genivi.commonapi.core.cli.product/.gitignore
@@ -0,0 +1,2 @@
+*~
+/target
diff --git a/org.genivi.commonapi.core.cli.product/.project b/org.genivi.commonapi.core.cli.product/.project
new file mode 100644
index 0000000..cb84653
--- /dev/null
+++ b/org.genivi.commonapi.core.cli.product/.project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.genivi.commonapi.core.cli.product</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription> \ No newline at end of file
diff --git a/org.genivi.commonapi.core.cli.product/.settings/org.eclipse.core.resources.prefs b/org.genivi.commonapi.core.cli.product/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.genivi.commonapi.core.cli.product/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.genivi.commonapi.core.cli.product/.settings/org.eclipse.core.runtime.prefs b/org.genivi.commonapi.core.cli.product/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/org.genivi.commonapi.core.cli.product/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.genivi.commonapi.core.cli.product/category.xml b/org.genivi.commonapi.core.cli.product/category.xml
new file mode 100644
index 0000000..4ee4178
--- /dev/null
+++ b/org.genivi.commonapi.core.cli.product/category.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<site>
+ <feature url="features/org.genivi.commonapi.console.feature_3.1.1.qualifier.jar" id="org.genivi.commonapi.console.feature" version="3.1.1.qualifier">
+ <category name="GENIVI CommonAPI Console"/>
+ </feature>
+ <feature url="features/org.genivi.commonapi.console.franca.feature_3.1.1.qualifier.jar" id="org.genivi.commonapi.console.franca.feature" version="3.1.1.qualifier">
+ <category name="GENIVI CommonAPI Console"/>
+ </feature>
+ <category-def name="GENIVI CommonAPI Console" label="GENIVI CommonAPI Console Generators">
+ <description>
+ The basic console generator for all CommonAPI compliant middleware libraries. Creates all source code that needs to adhere the specification. Any specific middleware code is generated by seperate generators, in seperate files.
+ </description>
+ </category-def>
+</site>
diff --git a/org.genivi.commonapi.core.cli.product/commonapi_console.product b/org.genivi.commonapi.core.cli.product/commonapi_console.product
new file mode 100644
index 0000000..1bc020e
--- /dev/null
+++ b/org.genivi.commonapi.core.cli.product/commonapi_console.product
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?pde version="3.5"?>
+
+<product name="CommonAPI Code Generator" uid="org.genivi.commonapi.core.cli.product" id="org.genivi.commonapi.console.product" application="org.genivi.commonapi.console.application" version="3.1.1" useFeatures="true" includeLaunchers="true">
+
+ <configIni use="default">
+ </configIni>
+
+ <launcherArgs>
+ <vmArgs>-Dosgi.requiredJavaVersion=1.7 -Xms512m -Xmx512m -XX:PermSize=128m
+ </vmArgs>
+ <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
+ </vmArgsMac>
+ </launcherArgs>
+
+ <windowImages/>
+
+ <launcher name="commonapi-generator">
+ <solaris/>
+ <win useIco="false">
+ <bmp/>
+ </win>
+ </launcher>
+
+ <vm>
+ <windows include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7</windows>
+ </vm>
+
+ <plugins>
+ </plugins>
+
+ <features>
+ <feature id="org.genivi.commonapi.console.feature"/>
+ <feature id="org.genivi.commonapi.console.franca.feature"/>
+ <feature id="org.genivi.commonapi.core.cli.feature"/>
+ </features>
+
+ <configurations>
+ <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" />
+ <plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
+ <plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="2" />
+ <plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
+ <plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
+ <property name="osgi.instance.area.default" value="@user.home/.commonapi-generator" />
+ </configurations>
+
+</product>
diff --git a/org.genivi.commonapi.core.cli.product/pom.xml b/org.genivi.commonapi.core.cli.product/pom.xml
new file mode 100644
index 0000000..d414692
--- /dev/null
+++ b/org.genivi.commonapi.core.cli.product/pom.xml
@@ -0,0 +1,131 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commonapi</groupId>
+ <artifactId>org.genivi.commonapi.core.cli.product</artifactId>
+ <packaging>eclipse-repository</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-director-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <executions>
+ <execution>
+ <!-- install the product using the p2 director -->
+ <id>materialize-products</id>
+ <goals>
+ <goal>materialize-products</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+
+ <execution>
+ <id>run-ant-rename</id>
+ <phase>package</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/commonapi-generator.exe" />
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/eclipsec.exe"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/commonapi-generator-windows-x86.exe" />
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/commonapi-generator.ini"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/commonapi-generator-windows-x86.ini" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/eclipsec.exe" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/commonapi-generator.ini" />
+ <copy
+ todir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/">
+ <fileset
+ dir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86/" />
+ </copy>
+
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/commonapi-generator.exe" />
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/eclipsec.exe"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/commonapi-generator-windows-x86_64.exe" />
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/commonapi-generator.ini"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/commonapi-generator-windows-x86_64.ini" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/eclipsec.exe" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/commonapi-generator.ini" />
+ <copy
+ todir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/">
+ <fileset
+ dir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/win32/win32/x86_64/" />
+ </copy>
+
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator-linux-x86" />
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator.ini"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator-linux-x86.ini" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator.ini" />
+ <copy
+ todir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/">
+ <fileset
+ dir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/" />
+ </copy>
+
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator-linux-x86_64" />
+ <copy
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator.ini"
+ tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator-linux-x86_64.ini" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator" />
+ <delete
+ file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator.ini" />
+ <copy
+ todir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/">
+ <fileset
+ dir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/" />
+ </copy>
+ </target>
+ </configuration>
+ </execution>
+ <execution>
+ <id>create-zip-files</id>
+ <phase>package</phase>
+ <configuration>
+ <target>
+ <zip excludesfile="zip.excludes"
+ destfile="${project.build.directory}/products/commonapi-generator.zip"
+ basedir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <parent>
+ <groupId>commonapi</groupId>
+ <artifactId>org.genivi.commonapi.core.releng</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
+ <relativePath>../org.genivi.commonapi.core.releng</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/org.genivi.commonapi.core.cli.product/zip.excludes b/org.genivi.commonapi.core.cli.product/zip.excludes
new file mode 100644
index 0000000..6dd3f27
--- /dev/null
+++ b/org.genivi.commonapi.core.cli.product/zip.excludes
@@ -0,0 +1,5 @@
+p2/**
+readme/**
+.eclipseproduct
+epl-v10.html
+notice.html
diff --git a/org.genivi.commonapi.core.cli/.classpath b/org.genivi.commonapi.core.cli/.classpath
index 8572780..5ba1743 100644
--- a/org.genivi.commonapi.core.cli/.classpath
+++ b/org.genivi.commonapi.core.cli/.classpath
@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con"
- path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6" />
- <classpathentry kind="con"
- path="org.eclipse.pde.core.requiredPlugins" />
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" />
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins" />
<classpathentry kind="src" path="src" />
<classpathentry kind="output" path="bin" />
-</classpath> \ No newline at end of file
+</classpath>
diff --git a/org.genivi.commonapi.core.cli/.gitignore b/org.genivi.commonapi.core.cli/.gitignore
index 912c25a..ad19da6 100644
--- a/org.genivi.commonapi.core.cli/.gitignore
+++ b/org.genivi.commonapi.core.cli/.gitignore
@@ -1,10 +1,3 @@
-/.settings
-/.DS_Store
-/org.genivi.commonapi.dbus
-/org.genivi.commonapi.core
-/.settings/org.eclipse.ltk.core.refactoring.prefs
-/workspaceitestra.xml
-/build.xml
-/temp
-/.classpath
+*~
+/bin
/target
diff --git a/org.genivi.commonapi.core.cli/.project b/org.genivi.commonapi.core.cli/.project
index f719ee6..aec6f21 100644
--- a/org.genivi.commonapi.core.cli/.project
+++ b/org.genivi.commonapi.core.cli/.project
@@ -25,4 +25,4 @@
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
-</projectDescription> \ No newline at end of file
+</projectDescription>
diff --git a/org.genivi.commonapi.core.cli/.settings/org.eclipse.core.resources.prefs b/org.genivi.commonapi.core.cli/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.genivi.commonapi.core.cli/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.genivi.commonapi.core.cli/.settings/org.eclipse.core.runtime.prefs b/org.genivi.commonapi.core.cli/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/org.genivi.commonapi.core.cli/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.genivi.commonapi.core.cli/META-INF/MANIFEST.MF b/org.genivi.commonapi.core.cli/META-INF/MANIFEST.MF
index bbfa462..9647524 100644
--- a/org.genivi.commonapi.core.cli/META-INF/MANIFEST.MF
+++ b/org.genivi.commonapi.core.cli/META-INF/MANIFEST.MF
@@ -2,20 +2,15 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: commonapi generator Console Interface
Bundle-SymbolicName: org.genivi.commonapi.core.cli;singleton:=true
-Bundle-Version: 2.1.6.qualifier
+Bundle-Version: 3.1.1.qualifier
Bundle-Activator: org.genivi.commonapi.core.cli.Activator
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.emf.common,
- org.eclipse.emf.ecore,
- org.eclipse.emf.codegen.ecore,
- org.eclipse.xtext,
- org.franca.core.dsl,
- org.franca.deploymodel.dsl,
- org.genivi.commonapi.core,
- org.genivi.commonapi.dbus,
- org.eclipse.xtext.ui.ecore,
- org.eclipse.xtext.ui,
- org.eclipse.xtext.builder
+ org.eclipse.xtext;bundle-version="[2.7.0,3.0.0)";visibility:=reexport,
+ org.franca.core.dsl;bundle-version="[0.9.0,0.10.0)";visibility:=reexport,
+ org.franca.deploymodel.dsl;bundle-version="[0.9.0,0.10.0)";visibility:=reexport,
+ org.genivi.commonapi.core;bundle-version="3.1.1";visibility:=reexport,
+ org.genivi.commonapi.console;bundle-version="3.1.1"
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-Vendor: BMW AG
+Export-Package: org.genivi.commonapi.core.cli
diff --git a/org.genivi.commonapi.core.cli/plugin.xml b/org.genivi.commonapi.core.cli/plugin.xml
index 71e23e9..cbbd9d3 100644
--- a/org.genivi.commonapi.core.cli/plugin.xml
+++ b/org.genivi.commonapi.core.cli/plugin.xml
@@ -1,15 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
- <extension
- id="application"
- point="org.eclipse.core.runtime.applications">
- <application>
- <run
- class="org.genivi.commonapi.core.cli.Application">
- </run>
- </application>
- </extension>
<extension
id="product"
@@ -23,4 +14,113 @@
</property>
</product>
</extension>
+ <extension
+ point="org.genivi.commonapi.console.commands">
+ <command
+ class="org.genivi.commonapi.core.cli.CommandLineHandler"
+ id="org.genivi.commonapi.core.cli.command"
+ name="CommonAPI Core Code Generation">
+ <options>
+ <option
+ argCount="0"
+ description="Switch off generation of proxy code"
+ hasOptionalArg="false"
+ id="org.genivi.commonapi.core.cli.option.noproxy"
+ longName="no-proxy"
+ required="false"
+ shortName="np">
+ </option>
+ <option
+ argCount="0"
+ description="Switch off generation of stub code"
+ hasOptionalArg="false"
+ id="org.genivi.commonapi.core.cli.option.nostub"
+ longName="no-stub"
+ required="false"
+ shortName="ns">
+ </option>
+ <option
+ argCount="1"
+ description="The default output directory"
+ hasOptionalArg="false"
+ id="org.genivi.commonapi.core.cli.option.dir.default"
+ longName="dest"
+ required="false"
+ shortName="d">
+ </option>
+ <option
+ argCount="1"
+ description="The directory for the common code"
+ hasOptionalArg="false"
+ id="org.genivi.commonapi.core.cli.option.dir.common"
+ longName="dest-common"
+ required="false"
+ shortName="dc">
+ </option>
+ <option
+ argCount="1"
+ description="The directory for proxy code"
+ hasOptionalArg="false"
+ id="org.genivi.commonapi.core.cli.option.dir.proxy"
+ longName="dest-proxy"
+ required="false"
+ shortName="dp">
+ </option>
+ <option
+ argCount="1"
+ description="The directory for stub code"
+ hasOptionalArg="false"
+ id="org.genivi.commonapi.core.cli.option.dir.stub"
+ longName="dest-stub"
+ required="false"
+ shortName="ds">
+ </option>
+ <option
+ argCount="1"
+ description="The directory for the skeleton code"
+ hasOptionalArg="false"
+ id="org.genivi.commonapi.core.cli.option.dir.skel"
+ longName="dest-skel"
+ required="false"
+ shortName="dsk">
+ </option>
+ <option
+ argCount="1"
+ description="The file path to the license text that will be added to each generated file"
+ hasOptionalArg="false"
+ id="org.genivi.commonapi.core.cli.option.license"
+ longName="license"
+ required="false"
+ shortName="l">
+ </option>
+ <option
+ argCount="1"
+ description="The log level (quiet or verbose)"
+ hasOptionalArg="false"
+ id="org.genivi.commonapi.core.cli.option.loglevel"
+ longName="loglevel"
+ required="false"
+ shortName="ll">
+ </option>
+ <option
+ argCount="1"
+ description="The prefix added to all generated enumeration literals"
+ hasOptionalArg="false"
+ id="org.genivi.commonapi.core.cli.option.prefix"
+ longName="prefix-enum-literal"
+ required="false"
+ shortName="pre">
+ </option>
+ <option
+ argCount="1"
+ description="Generate skeleton code. The optional argument specifies the postfix. Without argument, the postfix is 'default'"
+ hasOptionalArg="true"
+ id="org.genivi.commonapi.core.cli.option.prefix"
+ longName="skel"
+ required="false"
+ shortName="sk">
+ </option>
+ </options>
+ </command>
+ </extension>
</plugin>
diff --git a/org.genivi.commonapi.core.cli/pom.xml b/org.genivi.commonapi.core.cli/pom.xml
index 6de7307..c19c5b2 100644
--- a/org.genivi.commonapi.core.cli/pom.xml
+++ b/org.genivi.commonapi.core.cli/pom.xml
@@ -6,8 +6,8 @@
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>commonapi</groupId>
- <artifactId>org.genivi.commonapi.releng</artifactId>
- <version>2.1.6-SNAPSHOT</version>
- <relativePath>../org.genivi.commonapi.releng</relativePath>
+ <artifactId>org.genivi.commonapi.core.releng</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
+ <relativePath>../org.genivi.commonapi.core.releng</relativePath>
</parent>
-</project> \ No newline at end of file
+</project>
diff --git a/org.genivi.commonapi.core.cli/src/.gitignore b/org.genivi.commonapi.core.cli/src/.gitignore
deleted file mode 100644
index 9bb88d3..0000000
--- a/org.genivi.commonapi.core.cli/src/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/.DS_Store
diff --git a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/Application.java b/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/Application.java
deleted file mode 100644
index 2a45fd4..0000000
--- a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/Application.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2013 BMW Group Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de) 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/.
- */
-package org.genivi.commonapi.core.cli;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.equinox.app.IApplication;
-import org.eclipse.equinox.app.IApplicationContext;
-
-public class Application implements IApplication
-{
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.
- * IApplicationContext)
- */
- @Override
- public Object start(IApplicationContext context) throws Exception
- {
- /*
- * sleep 100 ms to guarantee that the gogo.shell.Activator is not
- * interrupted in start-up, sometimes causing a InterruptException
- */
- Thread.sleep(100);
- String[] args = Platform.getApplicationArgs();
-
- try
- {
- CommandlineToolMain.generate(args);
- }
- catch (IllegalArgumentException e)
- {
- System.err.println(e.getMessage());
- }
-
- return IApplication.EXIT_OK;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.equinox.app.IApplication#stop()
- */
- @Override
- public void stop()
- {
-
- }
-}
diff --git a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandExecutableExtensionFactory.java b/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandExecutableExtensionFactory.java
deleted file mode 100644
index 768c1ab..0000000
--- a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandExecutableExtensionFactory.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-package org.genivi.commonapi.core.cli;
-
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.xtext.generator.IGenerator;
-import org.eclipse.xtext.ui.ecore.ExecutableExtensionFactory;
-import org.genivi.commonapi.core.generator.FrancaGenerator;
-import org.osgi.framework.Bundle;
-
-import com.google.inject.Binder;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-
-public class CommandExecutableExtensionFactory extends ExecutableExtensionFactory
-{
- private Injector injector;
-
- @Override
- protected Bundle getBundle()
- {
- return Activator.getDefault().getBundle();
- }
-
- @Override
- protected Injector getInjector()
- {
- if (injector == null)
- injector = super.getInjector().createChildInjector(new Module()
- {
- @Override
- public void configure(final Binder binder)
- {
- binder.bind(ResourceSet.class).to(ResourceSetImpl.class);
- bindGeneratorClass(binder);
- }
- });
-
- return injector;
- }
-
- protected void bindGeneratorClass(final Binder binder)
- {
- binder.bind(IGenerator.class).to(FrancaGenerator.class);
- }
-}
diff --git a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandLineHandler.java b/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandLineHandler.java
new file mode 100644
index 0000000..07f43ea
--- /dev/null
+++ b/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandLineHandler.java
@@ -0,0 +1,124 @@
+package org.genivi.commonapi.core.cli;
+
+import java.util.List;
+
+import org.apache.commons.cli.CommandLine;
+import org.genivi.commonapi.console.AbstractCommandLineHandler;
+import org.genivi.commonapi.console.ICommandLineHandler;
+
+
+/**
+ * Handle command line options
+ */
+public class CommandLineHandler extends AbstractCommandLineHandler implements
+ ICommandLineHandler {
+
+
+ public static final String FILE_EXTENSION_FDEPL = "fdepl";
+ public static final String FILE_EXTENSION_FIDL = "fidl";
+ private CommandlineToolMain cliTool;
+
+ public CommandLineHandler() {
+ cliTool = new CommandlineToolMain();
+ }
+
+ @Override
+ public int excute(CommandLine parsedArguments) {
+
+ @SuppressWarnings("unchecked")
+ List<String> files = parsedArguments.getArgList();
+
+ // Disable log outputs if "quiet" as the very first action.
+ // -ll --loglevel quiet or verbose
+ if(parsedArguments.hasOption("ll")) {
+ cliTool.setLogLevel(parsedArguments.getOptionValue("ll"));
+ }
+
+ if(parsedArguments.hasOption("sk")) {
+ // Switch on generation of skeletons (if this option has a parameter,
+ // the parameter is the postfix for the file names
+ cliTool.setCreateSkeletonCode();
+ String skArgument = parsedArguments.getOptionValue("sk");
+ if(skArgument == null) {
+ // no -sk argument was given, use "Default"
+ skArgument = "Default";
+ }
+ // The fidl/fdepl file will be interpreted as sk argument,
+ // if "-sk" is placed just before the fidl/fdepl file in the command line !
+ if(skArgument.endsWith(FILE_EXTENSION_FDEPL) || skArgument.endsWith(FILE_EXTENSION_FIDL)) {
+ // it is not an -sk argument but it is the file to generate code from !
+ files.add(skArgument);
+ }
+ else {
+ cliTool.setSkeletonPostfix(skArgument);
+ }
+ }
+ // we expect at least the fidel/fdepl file as command line argument
+ if(files.size() > 0 && files.get(0) != null) {
+ String file = files.get(0);
+ if(file.endsWith(FILE_EXTENSION_FDEPL) || file.endsWith(FILE_EXTENSION_FIDL)) {
+ // handle command line options
+
+ // Switch off generation of proxy code
+ // -np --no-proxy do not generate proxy code
+ if(parsedArguments.hasOption("np")) {
+ cliTool.setNoProxyCode();
+ }
+
+ // Switch off generation of stub code
+ // -ns --no-stub do not generate stub code
+ if(parsedArguments.hasOption("ns")) {
+ cliTool.setNoStubCode();
+ }
+
+ // destination: -d --dest overwrite default directory
+ if(parsedArguments.hasOption("d")) {
+ cliTool.setDefaultDirectory(parsedArguments.getOptionValue("d"));
+ }
+
+ // destination: -dc --dest-common overwrite target directory for common part
+ if(parsedArguments.hasOption("dc")) {
+ cliTool.setCommonDirectory(parsedArguments.getOptionValue("dc"));
+ }
+
+ // destination: -dp --dest-proxy overwrite target directory for proxy code
+ if(parsedArguments.hasOption("dp")) {
+ cliTool.setProxyDirectory(parsedArguments.getOptionValue("dp"));
+ }
+
+ // destination: -ds --dest-stub overwrite target directory for stub code
+ if(parsedArguments.hasOption("ds")) {
+ cliTool.setStubtDirectory(parsedArguments.getOptionValue("ds"));
+ }
+
+ // destination: -dsk --dest-skel overwrite target directory for skeleton code
+ if(parsedArguments.hasOption("dsk")) {
+ cliTool.setSkeletonDirectory(parsedArguments.getOptionValue("dsk"));
+ }
+
+ // A file path, that points to a file, that contains the license text.
+ // -l --license license text in generated files
+ if(parsedArguments.hasOption("l")) {
+ cliTool.setLicenseText(parsedArguments.getOptionValue("l"));
+ }
+
+ // Add prefixes to enumeration literals
+ // -pre --prefix-enum-literal additional prefix to all generated enumeration literals
+ if(parsedArguments.hasOption("pre")) {
+ cliTool.setEnumPrefix(parsedArguments.getOptionValue("pre"));
+ }
+
+ // finally invoke the generator.
+ // the remaining arguments are assumed to be files !
+ cliTool.generateCore(files);
+ }
+ else {
+ System.out.println("The file extension should be ." + FILE_EXTENSION_FIDL + " or ." + FILE_EXTENSION_FDEPL);
+ }
+ }
+ else {
+ System.out.println("A *.fidl or *.fdepl file was not specified !");
+ }
+ return 0;
+ }
+}
diff --git a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandlineToolMain.java b/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandlineToolMain.java
index 18f247e..5756906 100644
--- a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandlineToolMain.java
+++ b/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandlineToolMain.java
@@ -9,676 +9,423 @@
package org.genivi.commonapi.core.cli;
import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.DataOutputStream;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.FileReader;
-import java.io.FileWriter;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
-import javax.inject.Inject;
-
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.preferences.DefaultScope;
-import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.xtext.generator.IFileSystemAccess;
+import org.eclipse.xtext.generator.IGenerator;
import org.eclipse.xtext.generator.JavaIoFileSystemAccess;
import org.eclipse.xtext.resource.XtextResourceSet;
+import org.eclipse.xtext.validation.AbstractValidationMessageAcceptor;
+import org.eclipse.xtext.validation.ValidationMessageAcceptor;
+import org.franca.core.dsl.FrancaIDLRuntimeModule;
+import org.franca.core.franca.FModel;
+import org.genivi.commonapi.console.ConsoleLogger;
import org.genivi.commonapi.core.generator.FrancaGenerator;
import org.genivi.commonapi.core.generator.FrancaGeneratorExtensions;
import org.genivi.commonapi.core.preferences.FPreferences;
import org.genivi.commonapi.core.preferences.PreferenceConstants;
-import org.genivi.commonapi.dbus.generator.FrancaDBusGenerator;
+import org.genivi.commonapi.core.verification.ValidatorCore;
+import com.google.inject.Guice;
import com.google.inject.Injector;
-import com.google.inject.Provider;
/**
- * This is a little Tool to generate C++ files from Franca files over the
- * commandline without Eclipse. The arguments of this tool can be the Franca
- * files which have to be generated. Additional you can set an argument -dbus to
- * generate for dbus, -dest and a path to a folder in the arguments will set the
- * output-destination to the given path and finally with -pref and a path to a
- * Textile will set the comment in the head of each file to the text from the
- * file given after -pref
- *
- * @author Patrick Sattler
+ * Receive command line arguments and set them as preference values for the code generation.
*/
public class CommandlineToolMain
{
- public static final String FILESEPARATOR = System.getProperty("file.separator");
-
- public static final String FILESEPARATORIMP = "/";
- public static final String TEMP_PFAD = System.getProperty("user.dir") + FILESEPARATOR + "temp/";
- public static final String CORE_DEPL = TEMP_PFAD + FILESEPARATOR + "org.genivi.commonapi.core"
- + FILESEPARATOR + "deployment" + FILESEPARATOR
- + "CommonAPI_deployment.fdepl";
- public static final String CORE_PFAD = TEMP_PFAD + FILESEPARATOR + "org.genivi.commonapi.core"
- + FILESEPARATOR + "deployment";
- public static final String DBUS_DEPL = TEMP_PFAD + FILESEPARATOR + "org.genivi.commonapi.dbus"
- + FILESEPARATOR + "deployment" + FILESEPARATOR
- + "CommonAPI-DBus_deployment.fdepl";
- public static final String DBUS_PFAD = TEMP_PFAD + FILESEPARATOR + "org.genivi.commonapi.dbus"
- + FILESEPARATOR + "deployment";
- public static final String TEMP_FDEPL_PFAD = TEMP_PFAD + FILESEPARATOR + "fdepl";
- public static List<String> files = new ArrayList<String>();
- // All given files were saved in this list with an absolute path
- private static Set<String> filelist = new LinkedHashSet<String>();
- // true if for all interfaces have to be generated the stubs
- private static boolean allstubs = false;
-
- @Inject
- private static Provider<JavaIoFileSystemAccess> fileAccessProvider;
-
- public static void generate(String[] args)
- {
-
- // Initialization with all options
- File tempfolder = null;
- boolean dbus = false;
- String dest = createAbsolutPath("." + FILESEPARATOR + "src-gen" + FILESEPARATOR);
- if (args.length < 1)
- {
- String errorMessage = "Usage: commonapi_generator [options] file...\n"
- + "\n"
- + "Options:\n"
- + " -dbus Additionally generate gluecode for the CommonAPI-D-Bus middleware binding\n"
- + " -dest <path/to/folder> Relative to current location, the generated files will be saved there\n"
- + " -pref <path/to/file> The text in this file which will be inserted as a comment in each generated file (for example your license)\n"
- + " -version Used versions from the CommonAPI-Generator and Franca plugin\n"
- + " -genallincl Generates all included fidls too (all Proxys and Stubs will be generated)\n";
- throw new IllegalArgumentException(errorMessage);
- }
-
- List<String> tempfilelist = new ArrayList<String>();
- FPreferences pref = FPreferences.getInstance();
- pref.clidefPreferences();
- /*
- * Reading the options and the files given in the arguments and they
- * will be saved in the predefined attributes
- */
- String francaversion = getFrancaVersion();
- String coreversion = FrancaGeneratorExtensions.getCoreVersion();
- pref.setPreference(PreferenceConstants.FRANCA_VERSION, francaversion);
- pref.setPreference(PreferenceConstants.USEPROJECTSETTINGS, Boolean.TRUE.toString());
- for (int i = 0; i < args.length; i++)
- {
- String arg = args[i];
- if (arg.equals("-dbus"))
- dbus = true;
- else if (arg.equals("-dest"))
- {
- if (i + 1 == args.length)
- {
- System.err.println("Please write a destination folder after -dest");
- System.exit(0);
- }
- File file = new File(args[i + 1]);
- if (!file.exists() || !file.isDirectory())
- {
- if (!file.mkdirs())
- {
- System.err.println("Could not create dest path");
- System.exit(0);
- }
- }
- dest = createAbsolutPath(args[i + 1]);
- i++;
- }
- else if (arg.equals("-pref"))
- {
- if (i + 1 == args.length)
- {
- System.err.println("Please write a path to an existing file after -pref");
- System.exit(0);
- }
- File file = new File(createAbsolutPath(args[i + 1]));
- i++;
- if (!file.exists() || file.isDirectory())
- {
- System.err.println("Please write a path to an existing file after -pref");
- System.exit(0);
- }
- System.out.println("The following file was set as header:\n" + file.getAbsolutePath());
- try
- {
- pref.setPreference(PreferenceConstants.USEPROJECTSETTINGS, Boolean.toString(true));
- pref.setPreferences(PreferenceConstants.P_LICENSE, file);
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
- else if (arg.equals("-version"))
- {
- System.out.println("Franca Version: " + francaversion);
- System.out.println("CommonAPI Version: " + coreversion);
- System.exit(0);
- }
- else if (arg.equals("-genallincl"))
- {
- allstubs = true;
- }
- else
- {
- File file = new File(createAbsolutPath(args[i]));
- if (!file.exists() || file.isDirectory())
- {
- System.err.println("The following path won't be generated because it doesn't exists:\n" + args[i] + "\n");
- }
- else
- tempfilelist.add(createAbsolutPath(arg));
- }
- }
- if (tempfilelist.size() == 0)
- {
- System.err.println("There are no valid files to generate!");
- System.exit(0);
- }
- System.out.println("The following path was set as the Outputfolder: \n" + dest);
- System.out.println("Using Franca Version " + francaversion);
- System.out.println("and CommonAPI Version " + coreversion);
- try
- {
- /*
- * The FDeploy.xmi will be loaded from the jar in a temporary folder
- * because the Generator expects a hierarchical URI an with a
- * Hierarchical URI you can't refer to a file in a jar
- */
- File xmifile = null;
- InputStream in = null;
- OutputStream out = null;
- try
- {
- in = CommandlineToolMain.class.getResourceAsStream("/org/franca/deploymodel/dsl/FDeploy.xmi");
- xmifile = new File(TEMP_PFAD + FILESEPARATOR + "FDeploy.xmi");
- tempfolder = new File(TEMP_PFAD);
- tempfolder.mkdir();
- xmifile.createNewFile();
- out = new DataOutputStream(new FileOutputStream(xmifile));
- int l = 0;
- while ((l = in.read()) != -1)
- out.write(l);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- finally
- {
- try
- {
- out.close();
- }
- catch (Exception e)
- {
- }
- try
- {
- in.close();
- }
- catch (Exception e)
- {
- }
- }
- /*
- * Here we look recursively at all files and their imports because
- * all fdepls must have overwritten imports so that the user can use
- * the same files in eclipse and the Commandline to generate. In the
- * same time the temporary path to the modified file will be saved
- * instead of the original one
- */
-
- for (int i = 0; i < tempfilelist.size(); i++)
- {
- filelist.add(rewriteImports(tempfilelist.get(i)));
- }
-
- DBusCommandExecutableExtensionFactory dbusCommandFactory = new DBusCommandExecutableExtensionFactory();
- Injector injectorDBus = dbusCommandFactory.getInjector();
- CommandExecutableExtensionFactory commandFactory = new CommandExecutableExtensionFactory();
- Injector injectorCore = commandFactory.getInjector();
- URI uri = null;
- // we initialize both generators with the Injectors
- FrancaDBusGenerator dbusgenerator = injectorDBus.getInstance(FrancaDBusGenerator.class);
- FrancaGenerator generator = injectorCore.getInstance(FrancaGenerator.class);
-
- XtextResourceSet rsset = injectorCore.getProvider(XtextResourceSet.class).get();
- fileAccessProvider = injectorCore.getProvider(JavaIoFileSystemAccess.class);
-
- final JavaIoFileSystemAccess fsa = fileAccessProvider.get();
-
- DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_OUTPUT_PROXIES, dest);
- DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_OUTPUT_STUBS, dest);
- InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).get(PreferenceConstants.P_OUTPUT_PROXIES, dest);
- InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).get(PreferenceConstants.P_OUTPUT_STUBS, dest);
- pref.setPreference(PreferenceConstants.P_OUTPUT_PROXIES, dest);
- pref.setPreference(PreferenceConstants.P_OUTPUT_STUBS, dest);
- fsa.setOutputPath(createAbsolutPath(dest));
- fsa.getOutputConfigurations().get(IFileSystemAccess.DEFAULT_OUTPUT).setCreateOutputDirectory(true);
- for (String file : filelist)
- {
- uri = URI.createFileURI(file);
- Resource rs = rsset.createResource(uri);
- if (dbus)
- {
- // Attention!!! some Methods from the generator are
- // deprecated because of this it could be in the near future
- // that URI's will be used
- dbusgenerator.doGenerate(rs, fsa);
- }
- else
- {
- generator.doGenerate(rs, fsa);
- }
- }
-
- }
- finally
- {
- deleteTempFiles(tempfolder);
- }
- }
-
- /**
- * gets the last segment from a path which fileseperators are
- * System.getProperty("file.separator")
- *
- * @param pfad
- * the path from were the filename is going to be extracted
- * @return the last segment of the path
- */
- private static String getFileName(String pfad)
- {
- if (pfad.lastIndexOf(FILESEPARATOR) >= 0)
- return pfad.substring(pfad.lastIndexOf(FILESEPARATOR) + 1).trim();
- return pfad.trim();
- }
-
- /**
- * the file on the path will be loaded, if the file has imports then the
- * imports will be overwritten with the right path. if the imported files
- * are also *.fdepl then thex will be also loaded
- *
- * @param path
- * the path to the file which has to be loaded and analyzed
- * @return the new path to the file
- */
- private static String rewriteImports(String path)
- {
- files.add(path);
- String rootpath = path.substring(0, path.lastIndexOf(FILESEPARATOR));
- String ret = path;
- if (path.endsWith(".fdepl"))
- {
- File filein = new File(createAbsolutPath(path));
- String uristr = "";
- File fileout = null;
- uristr = TEMP_FDEPL_PFAD + FILESEPARATOR + getFileName(path);
- fileout = new File(uristr);
- ret = uristr;
- File folder = new File(TEMP_FDEPL_PFAD);
- folder.mkdirs();
- BufferedReader instr = null;
- BufferedWriter outstr = null;
- try
- {
- fileout.createNewFile();
- instr = new BufferedReader(new FileReader(filein));
- outstr = new BufferedWriter(new FileWriter(fileout));
- String line = "";
- while ((line = instr.readLine()) != null)
- {
- // if a line contains the string "import" it will be
- // analyzed if there is something imported that i dont know
- // how to handle it will be passed through
-
- // here could be problems with relative paths on things that
- // get imported but not handled
-
- // the imported files will only be handled if they weren't
- // handled before
- if (line.trim().startsWith("import"))
- {
- if (line.contains("dbus/deployment/CommonAPI-DBus_deployment.fdepl"))
- {
- line = "import \"file:" + FILESEPARATORIMP + replaceAll(DBUS_DEPL, "\\", "/") + "\"";
- if (!files.contains(DBUS_DEPL))
- {
- handleDeployment(false);
- }
- }
- else if (line.contains("core/deployment/CommonAPI_deployment.fdepl"))
- {
- line = "import \"file:" + FILESEPARATORIMP + replaceAll(CORE_DEPL, "\\", "/") + "\"";
- if (!files.contains(CORE_DEPL))
- {
- handleDeployment(true);
- }
- }
- else if (line.contains(".fdepl"))
- {
- String cp = line;
- line = "import \"file:" + FILESEPARATORIMP + replaceAll(TEMP_FDEPL_PFAD, "\\", "/") + FILESEPARATORIMP
- + getImportsName(line) + "\"";
- if (!files.contains(createAbsolutPath(getImportPath(cp), path)))
- rewriteImports(createAbsolutPath(getImportPath(cp), path));
- }
- else if (line.contains(".fidl"))
- {
- String fidlpath = createAbsolutPath(getImportPath(line), path.substring(0, path.lastIndexOf(FILESEPARATOR)));
- if (allstubs)
- filelist.add(fidlpath);
- line = "import \"file:" + replaceAll(fidlpath, "\\", "/") + "\"";
-
- }
- }
- outstr.write(line + "\n");
- }
-
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- finally
- {
- try
- {
- instr.close();
- }
- catch (Exception e)
- {
- ;
- }
- try
- {
- outstr.close();
- }
- catch (Exception e)
- {
- ;
- }
- }
- }
- else if (allstubs)
- {
- File file = new File(createAbsolutPath(path));
- BufferedReader str = null;
- try
- {
- str = new BufferedReader(new FileReader(file));
- String line = "";
- while ((line = str.readLine()) != null)
- {
- if (line.contains("import"))
- {
- String importfile = line.substring(line.indexOf('"') + 1);
- importfile = importfile.substring(0, importfile.indexOf('"'));
- filelist.add(createAbsolutPath(importfile,rootpath));
- }
- }
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- finally
- {
- try
- {
- str.close();
- }
- catch (Exception e)
- {
- }
- }
- }
- return ret;
- }
-
- /**
- * Here we create an absolute path from a relativ path and a rootpath from
- * which the relative path begins
- *
- * @param path
- * the relative path which begins on rootpath
- * @param rootpath
- * an absolute path to a folder
- * @return the merded absolute path without points
- */
- private static String createAbsolutPath(String path, String rootpath)
- {
- if (System.getProperty("os.name").contains("Windows"))
- {
- if (path.startsWith(":", 1))
- return path;
- }
- else
- {
- if (path.startsWith(FILESEPARATOR))
- return path;
- }
-
- String ret = (rootpath.endsWith(FILESEPARATOR) ? rootpath : (rootpath + FILESEPARATOR)) + path;
- while (ret.contains(FILESEPARATOR + "." + FILESEPARATOR) || ret.contains(FILESEPARATOR + ".." + FILESEPARATOR))
- {
- if (ret.contains(FILESEPARATOR + ".." + FILESEPARATOR))
- {
- String temp = ret.substring(0, ret.indexOf(FILESEPARATOR + ".."));
- temp = temp.substring(0, temp.lastIndexOf(FILESEPARATOR));
- ret = temp + ret.substring(ret.indexOf(FILESEPARATOR + "..") + 3);
- }
- else
- {
- ret = replaceAll(ret, FILESEPARATOR + "." + FILESEPARATOR, FILESEPARATOR);
- }
- }
- return ret;
- }
-
- /**
- * reads from a line with import "path/to/file" the path to file
- *
- * @param line
- * the line with the import instruction
- * @return the path alone without import and ""
- */
- private static String getImportPath(String line)
- {
- line = line.substring(line.indexOf("import") + 8).trim();
- line = line.substring(0, line.length() - 1);
- return line;
- }
-
- /**
- * creates a absolute path from a relative path which starts on the current
- * user directory
- *
- * @param path
- * the relative path which start on the current user-directory
- * @return the created absolute path
- */
- public static String createAbsolutPath(String path)
- {
- return createAbsolutPath(path, System.getProperty("user.dir") + FILESEPARATOR);
- }
-
- /**
- * reads from a line with import "path/to/import/file" the filename
- *
- * @param line
- * the line with the import instruction
- * @return The name of the imported file
- */
- private static String getImportsName(String line)
- {
- return getFileName(getImportPath(line));
- }
-
- /**
- * handles the import instructions which refer to a deployment.fdepl (dbus
- * or core). These deployment files are in the commandline jar and because
- * of this they have to be loaded on a different way you can choose if you
- * would like only to load the core or also the dbus depl (because the dbus
- * deployment.fdepl imports the core deployment.fdepl)
- *
- * @param core
- * if true only the core file will be loaded otherwise also the
- * dbus deployment.fdepl will be loaded
- */
- private static void handleDeployment(boolean core)
- {
- BufferedReader reader = null;
- BufferedWriter writer = null;
- if (!core)
- {
- File file = new File(DBUS_DEPL);
- File folder = new File(DBUS_PFAD);
- folder.mkdirs();
- try
- {
- file.createNewFile();
- reader = new BufferedReader(new InputStreamReader(
- CommandlineToolMain.class.getResourceAsStream("/CommonAPI-DBus_deployment.fdepl")));
- writer = new BufferedWriter(new FileWriter(file));
- String line = "";
- while ((line = reader.readLine()) != null)
- {
- if (line.contains("import"))
- {
- line = "import \"file:" + FILESEPARATORIMP + replaceAll(CORE_DEPL, "\\", "/") + "\"";
- }
-
- writer.write(line + "\n");
- }
- files.add(DBUS_DEPL);
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- finally
- {
- try
- {
- reader.close();
- }
- catch (Exception e)
- {
- ;
- }
- try
- {
- writer.close();
- }
- catch (Exception e)
- {
- ;
- }
- }
-
- }
- File file = new File(CORE_DEPL);
- File folder = new File(CORE_PFAD);
- folder.mkdirs();
- try
- {
- file.createNewFile();
- reader = new BufferedReader(new InputStreamReader(CommandlineToolMain.class.getResourceAsStream("/CommonAPI_deployment.fdepl")));
- writer = new BufferedWriter(new FileWriter(file));
- int i = 0;
- while ((i = reader.read()) != -1)
- writer.write(i);
- files.add(CORE_DEPL);
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- finally
- {
- try
- {
- reader.close();
- }
- catch (Exception e)
- {
- ;
- }
- try
- {
- writer.close();
- }
- catch (Exception e)
- {
- ;
- }
- }
- }
-
- /**
- * a relaceAll Method which doesn't interprets the toreplace String as a
- * regex and so you can also replace \ and such special things
- *
- * @param text
- * the text who has to be modified
- * @param toreplace
- * the text which has to be replaced
- * @param replacement
- * the text which has to be inserted instead of toreplace
- * @return the modified text with all toreplace parts replaced with
- * replacement
- */
- public static String replaceAll(String text, String toreplace, String replacement)
- {
- String ret = "";
- while (text.contains(toreplace))
- {
- ret += text.substring(0, text.indexOf(toreplace)) + replacement;
- text = text.substring(text.indexOf(toreplace) + toreplace.length());
- }
- ret += text;
- return ret;
- }
-
- /**
- * removes recursively all files on the path and his folders and at the end
- * himself
- *
- * @param path
- * the path to the folder which has to be deleted
- */
- public static void deleteTempFiles(File path)
- {
- if (path != null && path.isDirectory())
- {
- for (File file : path.listFiles())
- {
- if (file.isDirectory())
- deleteTempFiles(file);
- file.delete();
- }
- }
- if (path != null)
- path.delete();
- }
-
- public static String getFrancaVersion()
- {
- return Platform.getBundle("org.franca.core").getVersion().toString();
- }
-
+ public static final String FILESEPARATOR = System.getProperty("file.separator");
+
+ public static List<String> files = new ArrayList<String>();
+ // All given files were saved in this list with an absolute path
+ protected static Set<String> filelist = new LinkedHashSet<String>();
+ // true if for all interfaces have to be generated the stubs
+ protected static boolean allstubs = false;
+
+ protected JavaIoFileSystemAccess fsa;
+ private FPreferences pref;
+ protected Injector injector;
+ private List<String> tempfilelist;
+
+ protected IGenerator francaGenerator;
+
+ protected ValidatorCore validator;
+ private int validationErrorCount;
+ protected String SCOPE = "Core validation: ";
+
+ private ValidationMessageAcceptor cliMessageAcceptor = new AbstractValidationMessageAcceptor() {
+
+ @Override
+ public void acceptInfo(String message, EObject object, EStructuralFeature feature, int index, String code, String... issueData) {
+ ConsoleLogger.printLog(SCOPE + message);
+ }
+
+ @Override
+ public void acceptWarning(String message, EObject object, EStructuralFeature feature, int index, String code, String... issueData) {
+ ConsoleLogger.printLog("Warning: " + SCOPE + message);
+ }
+
+ @Override
+ public void acceptError(String message, EObject object, EStructuralFeature feature, int index, String code, String... issueData) {
+ validationErrorCount++;
+ ConsoleLogger.printLog("Error: " + SCOPE + message);
+ }
+ };
+
+ /**
+ * The constructor registers the needed bindings to use the generator
+ */
+ public CommandlineToolMain()
+ {
+ injector = Guice.createInjector(new FrancaIDLRuntimeModule());
+
+ fsa = injector.getInstance(JavaIoFileSystemAccess.class);
+
+ pref = FPreferences.getInstance();
+
+ validator = new ValidatorCore();
+
+ }
+
+ /**
+ * Set the text from a file which will be inserted as a comment in each generated file (for example your license)
+ *
+ * @param fileWithText
+ * @return
+ */
+ public void setLicenseText(String fileWithText) {
+ if (fileWithText != null && !fileWithText.isEmpty())
+ {
+ File file = new File(createAbsolutPath(fileWithText));
+ if (!file.exists() || file.isDirectory())
+ {
+ ConsoleLogger.printErrorLog("Please specify a path to an existing file after option -l");
+ }
+ BufferedReader inReader = null;
+ String licenseText = "";
+ try
+ {
+ inReader = new BufferedReader(new FileReader(file));
+ String thisLine;
+ while ((thisLine = inReader.readLine()) != null)
+ {
+ licenseText = licenseText + thisLine + "\n";
+ }
+ if (licenseText != null && !licenseText.isEmpty())
+ {
+ pref.setPreference(PreferenceConstants.P_LICENSE, licenseText);
+ }
+ }
+ catch (IOException e)
+ {
+ ConsoleLogger.printLog("Failed to set the text from the given file: " + e.getLocalizedMessage());
+ }
+ finally
+ {
+ try
+ {
+ inReader.close();
+ }
+ catch (Exception e)
+ {
+ ;
+ }
+ }
+ ConsoleLogger.printLog("The following text was set as header: \n" + licenseText);
+ }
+ else
+ {
+ ConsoleLogger.printErrorLog("Please write a path to an existing file after -p");
+ }
+ }
+
+ public void generateCore(List<String> fileList)
+ {
+ francaGenerator = injector.getInstance(FrancaGenerator.class);
+
+ doGenerate(fileList);
+ }
+
+ /**
+ * Call the franca generator for the specified list of files.
+ *
+ * @param fileList
+ * the list of files to generate code from
+ */
+ protected void doGenerate(List<String> fileList)
+ {
+ fsa.setOutputConfigurations(FPreferences.getInstance().getOutputpathConfiguration());
+
+ XtextResourceSet rsset = injector.getProvider(XtextResourceSet.class).get();
+
+ tempfilelist = new ArrayList<String>();
+
+ /*
+ * Reading the options and the files given in the arguments and they
+ * will be saved in the predefined attributes
+ */
+ String francaversion = getFrancaVersion();
+ String coreversion = FrancaGeneratorExtensions.getCoreVersion();
+ for (String element : fileList)
+ {
+ File file = new File(createAbsolutPath(element));
+ if (!file.exists() || file.isDirectory())
+ {
+ ConsoleLogger.printErrorLog("The following path won't be generated because it doesn't exists:\n" + element + "\n");
+ }
+ else
+ tempfilelist.add(createAbsolutPath(element));
+ }
+ if (tempfilelist.size() == 0)
+ {
+ ConsoleLogger.printErrorLog("There are no valid files to generate !");
+ return;
+ }
+ ConsoleLogger.printLog("Using Franca Version " + francaversion);
+ ConsoleLogger.printLog("and CommonAPI Version " + coreversion);
+
+ for (String file : tempfilelist)
+ {
+ URI uri = URI.createFileURI(file);
+ Resource resource = rsset.createResource(uri);
+ validationErrorCount = 0;
+ validate(resource);
+ if(validationErrorCount == 0) {
+ ConsoleLogger.printLog("Generating code for " + file);
+ try {
+ francaGenerator.doGenerate(resource, fsa);
+ }
+ catch (Exception e) {
+ ConsoleLogger.printErrorLog("Failed to generate code !");
+ ConsoleLogger.printErrorLog(e.getMessage());
+ }
+ }
+ else {
+ ConsoleLogger.printErrorLog(file + " contains errors !");
+ }
+ }
+ }
+
+ private void validate(Resource resource) {
+ EObject model = null;
+
+ if(resource != null && resource.getURI().isFile()) {
+
+ try {
+ resource.load(Collections.EMPTY_MAP);
+ model = resource.getContents().get(0);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ ConsoleLogger.printLog("validating...");
+
+ // check for (internal )resource validation errors
+ for(org.eclipse.emf.ecore.resource.Resource.Diagnostic error : resource.getErrors()) {
+ ConsoleLogger.printErrorLog("ERROR at line: " + error.getLine() + " : " + error.getMessage());
+ validationErrorCount++;
+ }
+
+ // check for external validation errors if no errors have been detected so far
+ if(validationErrorCount == 0 ) {
+ if( model instanceof FModel) {
+ FModel fmodel = (FModel)model;
+ try {
+ validator.validateModel(fmodel, cliMessageAcceptor);
+ } catch (Exception e) {
+ ConsoleLogger.printErrorLog(e.getMessage());
+ validationErrorCount++;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * creates a absolute path from a relative path which starts on the current
+ * user directory
+ *
+ * @param path
+ * the relative path which start on the current user-directory
+ * @return the created absolute path
+ */
+ public String createAbsolutPath(String path)
+ {
+ return createAbsolutPath(path, System.getProperty("user.dir") + FILESEPARATOR);
+ }
+
+ /**
+ * Here we create an absolute path from a relativ path and a rootpath from
+ * which the relative path begins
+ *
+ * @param path
+ * the relative path which begins on rootpath
+ * @param rootpath
+ * an absolute path to a folder
+ * @return the merded absolute path without points
+ */
+ private String createAbsolutPath(String path, String rootpath)
+ {
+ if (System.getProperty("os.name").contains("Windows"))
+ {
+ if (path.startsWith(":", 1))
+ return path;
+ }
+ else
+ {
+ if (path.startsWith(FILESEPARATOR))
+ return path;
+ }
+
+ String ret = (rootpath.endsWith(FILESEPARATOR) ? rootpath : (rootpath + FILESEPARATOR)) + path;
+ while (ret.contains(FILESEPARATOR + "." + FILESEPARATOR) || ret.contains(FILESEPARATOR + ".." + FILESEPARATOR))
+ {
+ if (ret.contains(FILESEPARATOR + ".." + FILESEPARATOR))
+ {
+ String temp = ret.substring(0, ret.indexOf(FILESEPARATOR + ".."));
+ temp = temp.substring(0, temp.lastIndexOf(FILESEPARATOR));
+ ret = temp + ret.substring(ret.indexOf(FILESEPARATOR + "..") + 3);
+ }
+ else
+ {
+ ret = replaceAll(ret, FILESEPARATOR + "." + FILESEPARATOR, FILESEPARATOR);
+ }
+ }
+ return ret;
+ }
+
+
+ /**
+ * a relaceAll Method which doesn't interprets the toreplace String as a
+ * regex and so you can also replace \ and such special things
+ *
+ * @param text
+ * the text who has to be modified
+ * @param toreplace
+ * the text which has to be replaced
+ * @param replacement
+ * the text which has to be inserted instead of toreplace
+ * @return the modified text with all toreplace parts replaced with
+ * replacement
+ */
+ public String replaceAll(String text, String toreplace, String replacement)
+ {
+ String ret = "";
+ while (text.contains(toreplace))
+ {
+ ret += text.substring(0, text.indexOf(toreplace)) + replacement;
+ text = text.substring(text.indexOf(toreplace) + toreplace.length());
+ }
+ ret += text;
+ return ret;
+ }
+
+ /**
+ * removes recursively all files on the path and his folders and at the end
+ * himself
+ *
+ * @param path
+ * the path to the folder which has to be deleted
+ */
+ public void deleteTempFiles(File path)
+ {
+ if (path != null && path.isDirectory())
+ {
+ for (File file : path.listFiles())
+ {
+ if (file.isDirectory())
+ deleteTempFiles(file);
+ file.delete();
+ }
+ }
+ if (path != null)
+ path.delete();
+ }
+
+ public String getFrancaVersion()
+ {
+ return Platform.getBundle("org.franca.core").getVersion().toString();
+ }
+
+ public void setNoProxyCode() {
+ pref.setPreference(PreferenceConstants.P_GENERATEPROXY, "false");
+ ConsoleLogger.printLog("No proxy code will be generated");
+ }
+
+ public void setNoStubCode() {
+ pref.setPreference(PreferenceConstants.P_GENERATESTUB, "false");
+ ConsoleLogger.printLog("No stub code will be generated");
+ }
+
+ public void setDefaultDirectory(String optionValue) {
+ ConsoleLogger.printLog("Default output directory: " + optionValue);
+ pref.setPreference(PreferenceConstants.P_OUTPUT_DEFAULT, optionValue);
+ // In the case where no other output directories are set,
+ // this default directory will be used for them
+ pref.setPreference(PreferenceConstants.P_OUTPUT_COMMON, optionValue);
+ pref.setPreference(PreferenceConstants.P_OUTPUT_PROXIES, optionValue);
+ pref.setPreference(PreferenceConstants.P_OUTPUT_STUBS, optionValue);
+ pref.setPreference(PreferenceConstants.P_OUTPUT_SKELETON, optionValue);
+ }
+
+ public void setCommonDirectory(String optionValue) {
+ ConsoleLogger.printLog("Common output directory: " + optionValue);
+ pref.setPreference(PreferenceConstants.P_OUTPUT_COMMON, optionValue);
+ }
+
+ public void setProxyDirectory(String optionValue) {
+ ConsoleLogger.printLog("Proxy output directory: " + optionValue);
+ pref.setPreference(PreferenceConstants.P_OUTPUT_PROXIES, optionValue);
+ }
+
+ public void setStubtDirectory(String optionValue) {
+ ConsoleLogger.printLog("Stub output directory: " + optionValue);
+ pref.setPreference(PreferenceConstants.P_OUTPUT_STUBS, optionValue);
+ }
+
+ public void setSkeletonDirectory(String optionValue) {
+ ConsoleLogger.printLog("Skeleton output directory: " + optionValue);
+ pref.setPreference(PreferenceConstants.P_OUTPUT_SKELETON, optionValue);
+ }
+
+ public void setLogLevel(String optionValue) {
+ if(PreferenceConstants.LOGLEVEL_QUIET.equals(optionValue)) {
+ pref.setPreference(PreferenceConstants.P_LOGOUTPUT, "false");
+ ConsoleLogger.enableLogging(false);
+ ConsoleLogger.enableErrorLogging(false);
+ }
+ if(PreferenceConstants.LOGLEVEL_VERBOSE.equals(optionValue)) {
+ pref.setPreference(PreferenceConstants.P_LOGOUTPUT, "true");
+ ConsoleLogger.enableErrorLogging(true);
+ ConsoleLogger.enableLogging(true);
+ }
+ }
+
+ public void setEnumPrefix(String optionValue) {
+ pref.setPreference(PreferenceConstants.P_ENUMPREFIX, optionValue);
+ ConsoleLogger.printLog("Enum prefix: " + optionValue);
+ }
+
+ public void setCreateSkeletonCode() {
+ pref.setPreference(PreferenceConstants.P_GENERATESKELETON, "true");
+ ConsoleLogger.printLog("Skeleton code will be created");
+ }
+
+ public void setSkeletonPostfix(String optionValue) {
+ String postfix = (optionValue == null ? "Default" : optionValue);
+ pref.setPreference(PreferenceConstants.P_SKELETONPOSTFIX, postfix);
+ ConsoleLogger.printLog("Skeleton postfix: " + postfix);
+ }
}
diff --git a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/DBusCommandExecutableExtensionFactory.java b/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/DBusCommandExecutableExtensionFactory.java
deleted file mode 100644
index 8a20c7d..0000000
--- a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/DBusCommandExecutableExtensionFactory.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-package org.genivi.commonapi.core.cli;
-
-import org.eclipse.xtext.generator.IGenerator;
-import org.genivi.commonapi.dbus.generator.FrancaDBusGenerator;
-import org.osgi.framework.Bundle;
-
-import com.google.inject.Binder;
-
-public class DBusCommandExecutableExtensionFactory extends CommandExecutableExtensionFactory
-{
- @Override
- protected Bundle getBundle()
- {
- return Activator.getDefault().getBundle();
- }
-
- @Override
- protected void bindGeneratorClass(Binder binder)
- {
- binder.bind(IGenerator.class).to(FrancaDBusGenerator.class);
- }
-}
diff --git a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/DeployStandaloneSetup.java b/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/DeployStandaloneSetup.java
deleted file mode 100644
index c25e319..0000000
--- a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/DeployStandaloneSetup.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2013 BMW Group Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de) 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/.
- */
-
-package org.genivi.commonapi.core.cli;
-
-import org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.franca.deploymodel.dsl.FDeployRuntimeModule;
-import org.franca.deploymodel.dsl.FDeployStandaloneSetup;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.util.Modules;
-
-public class DeployStandaloneSetup extends FDeployStandaloneSetup {
-
- @Override
- public Injector createInjector() {
- // The Module has to replace some standard bindings in the
- // FDeployRuntimeModule
- return Guice.createInjector(Modules.override(new FDeployRuntimeModule()).with(new TestModule()));
- }
-
- @Override
- public Injector createInjectorAndDoEMFRegistration() {
- // Here the Resourcefactory is set for the fileending .fdepl so that the
- // resourceset knows where to search for a factory for files with these
- // ending
- Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("fdepl", new FrancaResourceFactory());
- EPackage.Registry.INSTANCE.put(GenModelPackage.eNS_URI, GenModelPackage.eINSTANCE);
- return super.createInjectorAndDoEMFRegistration();
- }
-
-}
diff --git a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/FrancaResourceFactory.java b/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/FrancaResourceFactory.java
deleted file mode 100644
index 938e9aa..0000000
--- a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/FrancaResourceFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2013 BMW Group Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de) 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/.
- */
-
-package org.genivi.commonapi.core.cli;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.xtext.linking.lazy.LazyLinker;
-import org.eclipse.xtext.linking.lazy.LazyLinkingResource;
-import org.eclipse.xtext.linking.lazy.LazyURIEncoder;
-import org.eclipse.xtext.resource.IResourceFactory;
-import org.franca.deploymodel.dsl.parser.antlr.FDeployParser;
-import org.franca.deploymodel.dsl.services.FDeployGrammarAccess;
-
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-
-public class FrancaResourceFactory implements IResourceFactory {
-
- @Inject
- Injector in;
-
- /**
- * creates from uris to files with the fdepl fileending resources
- */
- public Resource createResource(URI uri) {
-
- LazyLinkingResource rs = in.getInstance(LazyLinkingResource.class);
- rs.setURI(uri);
- FDeployParser parser = in.getInstance(FDeployParser.class);
- FDeployGrammarAccess access = in.getInstance(FDeployGrammarAccess.class);
-
- // For here the FDeploy.xmi is loaded
- parser.setGrammarAccess(access);
- rs.setParser(parser);
-
- rs.setLinker(in.getInstance(LazyLinker.class));
- rs.setEncoder(in.getInstance(LazyURIEncoder.class));
-
- return rs;
- }
-
-}
diff --git a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/MyProviderXtext.java b/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/MyProviderXtext.java
deleted file mode 100644
index e383e04..0000000
--- a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/MyProviderXtext.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2013 BMW Group Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de) 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/.
- */
-
-package org.genivi.commonapi.core.cli;
-
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.xtext.resource.XtextResourceSet;
-
-import com.google.inject.Provider;
-
-public class MyProviderXtext implements Provider<XtextResourceSet> {
-
- /**
- * These Provider creates a XtextResourceSet because i had to modify the
- * URIConverter so that the FDeploy.xmi will be loaded correctly
- */
- public XtextResourceSet get() {
- XtextResourceSet rsset = new XtextResourceSet();
- rsset.setURIConverter(new MyURIConverter());
- rsset.setResourceFactoryRegistry(Resource.Factory.Registry.INSTANCE);
- return rsset;
- }
-}
diff --git a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/MyURIConverter.java b/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/MyURIConverter.java
deleted file mode 100644
index 6c36151..0000000
--- a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/MyURIConverter.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2013 BMW Group Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de) 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/.
- */
-
-package org.genivi.commonapi.core.cli;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl;
-import org.eclipse.xtext.resource.FileNotFoundOnClasspathException;
-
-public class MyURIConverter extends ExtensibleURIConverterImpl {
-
- /**
- * If these URIConverter gets as URI the file FDeploy.xmi sothe path will be
- * new created to the temporary loaded file. the path to the temporary file
- * we get from the Main class which knows the temporary path. If the given
- * URI is FDeploy.xtextbin we throw a FileNotFoundOnClasspathException
- * because we don't have these file and the calling method expects this
- * error if the file is not available
- */
- @Override
- public URI normalize(URI uri) {
- if (uri.lastSegment() != null && uri.lastSegment().contains("FDeploy.xmi")) {
- URI ret = URI.createFileURI(CommandlineToolMain.createAbsolutPath("." + CommandlineToolMain.FILESEPARATOR
- + "temp" + CommandlineToolMain.FILESEPARATOR + "FDeploy.xmi"));
- return ret;
- }
- if (uri.lastSegment() != null && uri.lastSegment().contains("FDeploy.xtextbin"))
- throw new FileNotFoundOnClasspathException("");
- return super.normalize(uri);
- }
-}
diff --git a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/StandaloneSetup.java b/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/StandaloneSetup.java
deleted file mode 100644
index cadb147..0000000
--- a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/StandaloneSetup.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2013 BMW Group Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de) 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/.
- */
-
-package org.genivi.commonapi.core.cli;
-
-import org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.xtext.Grammar;
-import org.eclipse.xtext.generator.IGenerator;
-import org.eclipse.xtext.impl.GrammarImpl;
-import org.franca.core.dsl.FrancaIDLRuntimeModule;
-import org.franca.core.dsl.FrancaIDLStandaloneSetup;
-import org.genivi.commonapi.core.generator.FrancaGenerator;
-
-import com.google.inject.Binder;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-import com.google.inject.util.Modules;
-
-public class StandaloneSetup extends FrancaIDLStandaloneSetup {
- @Override
- public Injector createInjector() {
- return Guice.createInjector(Modules.combine(new FrancaIDLRuntimeModule(), new Module() {
-
- public void configure(Binder binder) {
- binder.bind(IGenerator.class).to(FrancaGenerator.class);
- binder.bind(Grammar.class).to(GrammarImpl.class);
- }
- }));
- }
-
- @Override
- public Injector createInjectorAndDoEMFRegistration() {
- EPackage.Registry.INSTANCE.put(GenModelPackage.eNS_URI, GenModelPackage.eINSTANCE);
- return super.createInjectorAndDoEMFRegistration();
- }
-} \ No newline at end of file
diff --git a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/TestModule.java b/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/TestModule.java
deleted file mode 100644
index d94eba0..0000000
--- a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/TestModule.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2013 BMW Group Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de) 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/.
- */
-
-package org.genivi.commonapi.core.cli;
-
-import org.eclipse.xtext.resource.IResourceFactory;
-import org.eclipse.xtext.resource.XtextResourceSet;
-import org.franca.deploymodel.dsl.FDeployRuntimeModule;
-
-import com.google.inject.Binder;
-
-public class TestModule extends FDeployRuntimeModule {
-
- /**
- * Here the Injector gets the bindings which we need for correct generating.
- * For example there we set the binding for the XtextResourceSet that these
- * classes can only be created by the injector by a Provider which i have
- * implemented
- */
- public void configure(Binder binder) {
- binder.bind(IResourceFactory.class).to(FrancaResourceFactory.class);
- binder.bind(XtextResourceSet.class).toProvider(MyProviderXtext.class);
- }
-}
diff --git a/org.genivi.commonapi.core.feature/.gitignore b/org.genivi.commonapi.core.feature/.gitignore
index ea8c4bf..873d37a 100644
--- a/org.genivi.commonapi.core.feature/.gitignore
+++ b/org.genivi.commonapi.core.feature/.gitignore
@@ -1 +1,2 @@
+*~
/target
diff --git a/org.genivi.commonapi.core.feature/.settings/org.eclipse.core.resources.prefs b/org.genivi.commonapi.core.feature/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.genivi.commonapi.core.feature/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.genivi.commonapi.core.feature/.settings/org.eclipse.core.runtime.prefs b/org.genivi.commonapi.core.feature/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/org.genivi.commonapi.core.feature/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.genivi.commonapi.core.feature/build.properties b/org.genivi.commonapi.core.feature/build.properties
index 52c3cfc..3efcc19 100644
--- a/org.genivi.commonapi.core.feature/build.properties
+++ b/org.genivi.commonapi.core.feature/build.properties
@@ -1,3 +1,4 @@
+javacDefaultEncoding.. = UTF-8
bin.includes = feature.xml,\
license.html,\
feature.properties
diff --git a/org.genivi.commonapi.core.feature/feature.xml b/org.genivi.commonapi.core.feature/feature.xml
index a59d249..64a6a81 100644
--- a/org.genivi.commonapi.core.feature/feature.xml
+++ b/org.genivi.commonapi.core.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.genivi.commonapi.core.feature"
label="%featureName"
- version="2.1.6.qualifier"
+ version="3.1.1.qualifier"
provider-name="%providerName">
<copyright>
@@ -13,24 +13,7 @@
%license
</license>
- <requires>
- <import plugin="org.eclipse.core.resources" version="3.8.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.core.runtime" version="3.8.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.xtend2.lib" version="2.4.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.xtext.generator" version="2.4.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.xtext.util" version="2.4.0" match="greaterOrEqual"/>
- <import plugin="org.franca.core.dsl" version="0.8.9" match="equivalent"/>
- <import plugin="javax.inject"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.core.expressions" version="3.4.400" match="greaterOrEqual"/>
- <import plugin="org.eclipse.xtext.builder" version="2.4.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.xtext.ui" version="2.4.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.xtext.ui.ecore" version="2.4.0" match="greaterOrEqual"/>
- <import plugin="com.google.inject" version="3.0.0" match="greaterOrEqual"/>
- <import plugin="org.genivi.commonapi.core" version="2.1.5" match="greaterOrEqual"/>
- </requires>
-
- <plugin
+ <plugin
id="org.genivi.commonapi.core"
download-size="0"
install-size="0"
diff --git a/org.genivi.commonapi.core.feature/pom.xml b/org.genivi.commonapi.core.feature/pom.xml
index 282fcd3..8649cae 100644
--- a/org.genivi.commonapi.core.feature/pom.xml
+++ b/org.genivi.commonapi.core.feature/pom.xml
@@ -6,8 +6,8 @@
<packaging>eclipse-feature</packaging>
<parent>
<groupId>commonapi</groupId>
- <artifactId>org.genivi.commonapi.releng</artifactId>
- <version>2.1.6-SNAPSHOT</version>
- <relativePath>../org.genivi.commonapi.releng</relativePath>
+ <artifactId>org.genivi.commonapi.core.releng</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
+ <relativePath>../org.genivi.commonapi.core.releng</relativePath>
</parent>
-</project> \ No newline at end of file
+</project>
diff --git a/org.genivi.commonapi.core.releng/.gitignore b/org.genivi.commonapi.core.releng/.gitignore
new file mode 100644
index 0000000..b25c15b
--- /dev/null
+++ b/org.genivi.commonapi.core.releng/.gitignore
@@ -0,0 +1 @@
+*~
diff --git a/org.genivi.commonapi.target/.project b/org.genivi.commonapi.core.releng/.project
index 1ab48aa..00b1a97 100644
--- a/org.genivi.commonapi.target/.project
+++ b/org.genivi.commonapi.core.releng/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.genivi.commonapi.target</name>
+ <name>org.genivi.commonapi.core.releng</name>
<comment></comment>
<projects>
</projects>
diff --git a/org.genivi.commonapi.core.releng/.settings/org.eclipse.core.resources.prefs b/org.genivi.commonapi.core.releng/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.genivi.commonapi.core.releng/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.genivi.commonapi.core.releng/.settings/org.eclipse.core.runtime.prefs b/org.genivi.commonapi.core.releng/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/org.genivi.commonapi.core.releng/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.genivi.commonapi.core.releng/pom.xml b/org.genivi.commonapi.core.releng/pom.xml
new file mode 100644
index 0000000..183dd5a
--- /dev/null
+++ b/org.genivi.commonapi.core.releng/pom.xml
@@ -0,0 +1,28 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commonapi</groupId>
+ <artifactId>org.genivi.commonapi.core.releng</artifactId>
+ <packaging>pom</packaging>
+ <modules>
+ <module>../org.genivi.commonapi.core.target</module>
+ <module>../org.genivi.commonapi.console</module>
+ <module>../org.genivi.commonapi.console.feature</module>
+ <module>../org.genivi.commonapi.console.franca.feature</module>
+ <module>../org.genivi.commonapi.core</module>
+ <module>../org.genivi.commonapi.core.cli</module>
+ <module>../org.genivi.commonapi.core.cli.feature</module>
+ <module>../org.genivi.commonapi.core.cli.product</module>
+ <module>../org.genivi.commonapi.core.feature</module>
+ <module>../org.genivi.commonapi.core.ui</module>
+ <module>../org.genivi.commonapi.core.validator</module>
+ <module>../org.genivi.commonapi.core.validator.feature</module>
+ <module>../org.genivi.commonapi.core.updatesite</module>
+ </modules>
+ <parent>
+ <groupId>commonapi</groupId>
+ <artifactId>org.genivi.commonapi.releng</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
+ <relativePath>../org.genivi.commonapi.releng</relativePath>
+ </parent>
+</project>
diff --git a/org.genivi.commonapi.core.target/.gitignore b/org.genivi.commonapi.core.target/.gitignore
new file mode 100644
index 0000000..b25c15b
--- /dev/null
+++ b/org.genivi.commonapi.core.target/.gitignore
@@ -0,0 +1 @@
+*~
diff --git a/org.genivi.commonapi.updatesite/.project b/org.genivi.commonapi.core.target/.project
index 10fecc3..cc11d87 100644
--- a/org.genivi.commonapi.updatesite/.project
+++ b/org.genivi.commonapi.core.target/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.genivi.commonapi.updatesite</name>
+ <name>org.genivi.commonapi.core.target</name>
<comment></comment>
<projects>
</projects>
diff --git a/org.genivi.commonapi.core.target/.settings/org.eclipse.core.resources.prefs b/org.genivi.commonapi.core.target/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.genivi.commonapi.core.target/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.genivi.commonapi.core.target/.settings/org.eclipse.core.runtime.prefs b/org.genivi.commonapi.core.target/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/org.genivi.commonapi.core.target/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.genivi.commonapi.core.target/org.genivi.commonapi.core.target.target b/org.genivi.commonapi.core.target/org.genivi.commonapi.core.target.target
new file mode 100644
index 0000000..85ec8c0
--- /dev/null
+++ b/org.genivi.commonapi.core.target/org.genivi.commonapi.core.target.target
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?pde version="3.8"?><target name="CommonAPI Luna SR1" sequenceNumber="32">
+<locations>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.franca.ui.sdk.feature.group" version="0.9.1.201412191134"/>
+<unit id="org.franca.core.sdk.feature.group" version="0.9.1.201412191134"/>
+<repository location="http://franca.eclipselabs.org.codespot.com/git/update_site/releases"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.platform.sdk" version="4.4.1.M20140925-0400"/>
+<unit id="org.eclipse.equinox.sdk.feature.group" version="3.10.0.v20140909-1633"/>
+<unit id="org.eclipse.e4.rcp.R441patch.feature.group" version="1.0.0"/>
+<unit id="org.eclipse.equinox.core.sdk.R441patch.feature.group" version="1.0.0"/>
+<unit id="org.eclipse.equinox.core.feature.R441patch.feature.group" version="1.0.0"/>
+<unit id="org.eclipse.equinox.server.core.R441patch.feature.group" version="1.0.0"/>
+<repository location="http://download.eclipse.org/eclipse/updates/4.4/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.cdt.sdk.feature.group" version="8.5.0.201409172108"/>
+<unit id="org.eclipse.xtend.sdk.feature.group" version="2.7.2.v201409160908"/>
+<repository location="http://download.eclipse.org/releases/luna"/>
+</location>
+</locations>
+</target>
diff --git a/org.genivi.commonapi.core.target/pom.xml b/org.genivi.commonapi.core.target/pom.xml
new file mode 100644
index 0000000..3b59852
--- /dev/null
+++ b/org.genivi.commonapi.core.target/pom.xml
@@ -0,0 +1,13 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commonapi</groupId>
+ <artifactId>org.genivi.commonapi.core.target</artifactId>
+ <packaging>eclipse-target-definition</packaging>
+ <parent>
+ <groupId>commonapi</groupId>
+ <artifactId>org.genivi.commonapi.core.releng</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
+ <relativePath>../org.genivi.commonapi.core.releng</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/org.genivi.commonapi.core.tests/.gitignore b/org.genivi.commonapi.core.tests/.gitignore
deleted file mode 100644
index 077e3f1..0000000
--- a/org.genivi.commonapi.core.tests/.gitignore
+++ /dev/null
@@ -1,22 +0,0 @@
-.deps
-.dirstamp
-.libs
-*.la
-*.lo
-*.o
-/.autotools
-/.cproject
-/.project
-/.settings
-/Makefile
-/Makefile.in
-/aclocal.m4
-/autom4te.cache
-/build-aux
-/config.log
-/config.status
-/configure
-/libtool
-/m4/libtool.m4
-/m4/lt*.m4
-test-*
diff --git a/org.genivi.commonapi.core.tests/LICENSE b/org.genivi.commonapi.core.tests/LICENSE
deleted file mode 100644
index 14e2f77..0000000
--- a/org.genivi.commonapi.core.tests/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- 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/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/org.genivi.commonapi.core.tests/Makefile.am b/org.genivi.commonapi.core.tests/Makefile.am
deleted file mode 100644
index c56c651..0000000
--- a/org.genivi.commonapi.core.tests/Makefile.am
+++ /dev/null
@@ -1,61 +0,0 @@
-ACLOCAL_AMFLAGS = -I m4
-
-AM_CPPFLAGS = \
- ${COMMONAPI_CFLAGS} \
- ${GMOCK_CPPFLAGS} \
- -Isrc-gen
-AM_CXXFLAGS = \
- ${GMOCK_CXXFLAGS}
-AM_LDFLAGS = \
- ${GMOCK_LDFLAGS}
-LDADD = \
- ${COMMONAPI_LIBS} \
- ${GMOCK_LIBS}
-
-# ------------------------------------------------------------------------------
-check_PROGRAMS = \
- test-derived-types \
- test-interface-proxy \
- test-interface-stub \
- test-predefined-types
-
-TESTS = ${check_PROGRAMS}
-bin_PROGRAMS = ${check_PROGRAMS}
-
-test_derived_types_SOURCES = \
- src-gen/commonapi/tests/DerivedTypeCollection.h \
- src/test-derived-types.cpp
-
-test_interface_proxy_SOURCES = \
- src-gen/commonapi/tests/DerivedTypeCollection.h \
- src-gen/commonapi/tests/DerivedTypeCollection.cpp \
- src-gen/commonapi/tests/TestInterfaceProxy.h \
- src/test-interface-proxy.h \
- src/test-interface-proxy.cpp
-
-test_interface_stub_SOURCES = \
- src-gen/commonapi/tests/DerivedTypeCollection.h \
- src-gen/commonapi/tests/DerivedTypeCollection.cpp \
- src-gen/commonapi/tests/TestInterfaceStub.h \
- src-gen/commonapi/tests/TestInterfaceStubDefault.h \
- src-gen/commonapi/tests/TestInterfaceStubDefault.cpp \
- src/test-interface-stub.cpp
-
-test_predefined_types_SOURCES = \
- src-gen/commonapi/tests/PredefinedTypeCollection.h \
- src/test-predefined-types.cpp
-
-# ------------------------------------------------------------------------------
-MAINTAINERCLEANFILES = \
- Makefile.in \
- aclocal.m4 \
- configure
-
-clean-local:
- -rm -rf src-gen
-
-maintainer-clean-local:
- -rm -rf build-aux
- -rm -f config.h.in*
- -rm -f m4/libtool*.m4
- -rm -f m4/lt*.m4
diff --git a/org.genivi.commonapi.core.tests/configure.ac b/org.genivi.commonapi.core.tests/configure.ac
deleted file mode 100644
index 57d76bd..0000000
--- a/org.genivi.commonapi.core.tests/configure.ac
+++ /dev/null
@@ -1,88 +0,0 @@
-AC_PREREQ(2.61)
-AC_INIT([Common API C++ Tests],
- [1.0],
- [],
- [commonapi-tests])
-
-AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_AUX_DIR([build-aux])
-AC_CONFIG_HEADERS([build-aux/config.h])
-AC_CONFIG_FILES([Makefile])
-
-AC_CANONICAL_SYSTEM
-
-dnl silent-rules parallel-tests
-AM_INIT_AUTOMAKE([foreign 1.11 subdir-objects -Wall -Werror])
-dnl AM_SILENT_RULES
-AM_MAINTAINER_MODE
-
-AC_PROG_CXX
-AC_LANG([C++])
-AX_CXX_COMPILE_STDCXX_11([noext])
-
-LT_PREREQ(2.2)
-LT_INIT
-
-GMOCK_MIN_VERSION="1.6.0"
-GMOCK_URL="http://code.google.com/p/googlemock"
-
-AC_ARG_WITH([gmock],
- [AS_HELP_STRING([--with-gmock],
- [Specifies how to find the gmock package. The gmock
- built or installed at that prefix will be used.])],
- [],
- [with_gmock=yes])
-
-AC_ARG_VAR([GMOCK_CONFIG], [The exact path of Google Mock's 'gmock-config' script.])
-AC_ARG_VAR([GMOCK_CPPFLAGS], [C-like preprocessor flags for Google Mock.])
-AC_ARG_VAR([GMOCK_CXXFLAGS], [C++ compile flags for Google Mock.])
-AC_ARG_VAR([GMOCK_LDFLAGS], [Linker path and option flags for Google Mock.])
-AC_ARG_VAR([GMOCK_LIBS], [Library linking flags for Google Mock.])
-AC_ARG_VAR([GMOCK_VERSION], [The version of Google Mock available.])
-
-AS_IF([test "x${with_gmock}" != "xyes"],
- [AS_IF([test -x "${with_gmock}/scripts/gmock-config"],
- [GMOCK_CONFIG="${with_gmock}/scripts/gmock-config"],
- [GMOCK_CONFIG="${with_gmock}/bin/gmock-config"])])
-
-AS_IF([test -f "${GMOCK_CONFIG}"],
- [],
- [AC_MSG_ERROR([dnl
-Unable to locate Google Mock, please provide the path to an installed version
-by using the --with-gmock parameter or GMOCK_CONFIG environment variable.
-Refer to ${GMOCK_URL} for more information.])])
-
-GMOCK_CPPFLAGS=`${GMOCK_CONFIG} --cppflags`
-GMOCK_CXXFLAGS=`${GMOCK_CONFIG} --cxxflags`
-GMOCK_LDFLAGS=`${GMOCK_CONFIG} --ldflags`
-GMOCK_LIBS=`${GMOCK_CONFIG} --libs`
-GMOCK_VERSION=`${GMOCK_CONFIG} --version`
-
-AS_IF([${GMOCK_CONFIG} --min-version=${GMOCK_MIN_VERSION}],
- [],
- [AC_MSG_ERROR([dnl
-Found Google Mock Version ${GMOCK_VERSION}. However ${GMOCK_MIN_VERSION} is
-required. Please refer to ${GMOCK_URL} for a more recent version.])])
-
-PKG_CHECK_MODULES(COMMONAPI, [CommonAPI >= 0.7])
-
-AC_MSG_RESULT([
- $PACKAGE_NAME v$VERSION
-
- GMOCK_CONFIG: ${GMOCK_CONFIG}
- GMOCK_CPPFLAGS: ${GMOCK_CPPFLAGS}
- GMOCK_CXXFLAGS: ${GMOCK_CXXFLAGS}
- GMOCK_LDFLAGS: ${GMOCK_LDFLAGS}
- GMOCK_LIBS: ${GMOCK_LIBS}
- GMOCK_VERSION: ${GMOCK_VERSION}
-
- COMMONAPI_CFLAGS: ${COMMONAPI_CFLAGS}
- COMMONAPI_LIBS: ${COMMONAPI_LIBS}
-
- prefix: ${prefix}
- CXXFLAGS: ${CXXFLAGS}
- LDFLAGS: ${LDFLAGS}
-])
-
-AC_OUTPUT
-
diff --git a/org.genivi.commonapi.core.tests/m4/ax_cxx_compile_stdcxx_11.m4 b/org.genivi.commonapi.core.tests/m4/ax_cxx_compile_stdcxx_11.m4
deleted file mode 100644
index 0d96c07..0000000
--- a/org.genivi.commonapi.core.tests/m4/ax_cxx_compile_stdcxx_11.m4
+++ /dev/null
@@ -1,107 +0,0 @@
-# ============================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
-# ============================================================================
-#
-# SYNOPSIS
-#
-# AX_CXX_COMPILE_STDCXX_11([ext|noext])
-#
-# DESCRIPTION
-#
-# Check for baseline language coverage in the compiler for the C++11
-# standard; if necessary, add switches to CXXFLAGS to enable support.
-# Errors out if no mode that supports C++11 baseline syntax can be found.
-# The argument, if specified, indicates whether you insist on an extended
-# mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -std=c++11).
-# If neither is specified, you get whatever works, with preference for an
-# extended mode.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
-# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 1
-
-m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
- template <typename T>
- struct check
- {
- static_assert(sizeof(int) <= sizeof(T), "not big enough");
- };
-
- typedef check<check<bool>> right_angle_brackets;
-
- int a;
- decltype(a) b;
-
- typedef check<int> check_type;
- check_type c;
- check_type&& cr = static_cast<check_type&&>(c);
-])
-
-AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
- m4_if([$1], [], [],
- [$1], [ext], [],
- [$1], [noext], [],
- [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
- AC_LANG_ASSERT([C++])dnl
- ac_success=no
- AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
- ax_cv_cxx_compile_cxx11,
- [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
- [ax_cv_cxx_compile_cxx11=yes],
- [ax_cv_cxx_compile_cxx11=no])])
- if test x$ax_cv_cxx_compile_cxx11 = xyes; then
- ac_success=yes
- fi
-
- m4_if([$1], [noext], [], [dnl
- if test x$ac_success = xno; then
- for switch in -std=gnu++11 -std=gnu++0x; do
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
- AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
- $cachevar,
- [ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $switch"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
- [eval $cachevar=yes],
- [eval $cachevar=no])
- CXXFLAGS="$ac_save_CXXFLAGS"])
- if eval test x\$$cachevar = xyes; then
- CXXFLAGS="$CXXFLAGS $switch"
- ac_success=yes
- break
- fi
- done
- fi])
-
- m4_if([$1], [ext], [], [dnl
- if test x$ac_success = xno; then
- for switch in -std=c++11 -std=c++0x; do
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
- AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
- $cachevar,
- [ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $switch"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
- [eval $cachevar=yes],
- [eval $cachevar=no])
- CXXFLAGS="$ac_save_CXXFLAGS"])
- if eval test x\$$cachevar = xyes; then
- CXXFLAGS="$CXXFLAGS $switch"
- ac_success=yes
- break
- fi
- done
- fi])
-
- if test x$ac_success = xno; then
- AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
- fi
-])
diff --git a/org.genivi.commonapi.core.tests/src/commonapi-mock.h b/org.genivi.commonapi.core.tests/src/commonapi-mock.h
deleted file mode 100644
index 3235779..0000000
--- a/org.genivi.commonapi.core.tests/src/commonapi-mock.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-#ifndef MOCK_PROXY_H_
-#define MOCK_PROXY_H_
-
-#include <CommonAPI/Proxy.h>
-
-#include "gmock.h"
-
-
-class MockProxy: virtual public CommonAPI::Proxy {
- public:
- MOCK_CONST_METHOD0(getAddress, std::string());
- MOCK_CONST_METHOD0(getDomain, const std::string&());
- MOCK_CONST_METHOD0(getServiceId, const std::string&());
- MOCK_CONST_METHOD0(getInstanceId, const std::string&());
- MOCK_CONST_METHOD0(isAvailable, bool());
- MOCK_METHOD0(getProxyStatusEvent, CommonAPI::ProxyStatusEvent&());
- MOCK_METHOD0(getInterfaceVersionAttribute, CommonAPI::InterfaceVersionAttribute&());
-};
-
-
-#endif // MOCK_PROXY_H_
diff --git a/org.genivi.commonapi.core.tests/src/gmock.h b/org.genivi.commonapi.core.tests/src/gmock.h
deleted file mode 100644
index a2871dc..0000000
--- a/org.genivi.commonapi.core.tests/src/gmock.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-#ifndef ORG_GENIVI_COMMONAPI_GMOCK_H_
-#define ORG_GENIVI_COMMONAPI_GMOCK_H_
-
-#include <gmock/gmock.h>
-
-#include <utility>
-
-
-#define MOCK_METHOD0_WITH_FUTURE_RETURN(m, F) \
- MOCK_METHOD0(m##WithoutStdFuture, F); \
- std::future<GMOCK_RESULT_(, F)> m() { \
- std::promise<CommonAPI::CallStatus> promise; \
- promise.set_value(m##WithoutStdFuture()); \
- return promise.get_future(); \
- }
-
-#define MOCK_METHOD1_WITH_FUTURE_RETURN(m, F) \
- MOCK_METHOD1(m##WithoutStdFuture, F); \
- std::future<GMOCK_RESULT_(, F)> m( \
- GMOCK_ARG_(, F, 1) gmock_a1) { \
- std::promise<CommonAPI::CallStatus> promise; \
- promise.set_value(m##WithoutStdFuture( \
- std::forward<GMOCK_ARG_(, F, 1)>(gmock_a1))); \
- return promise.get_future(); \
- }
-
-#define MOCK_METHOD2_WITH_FUTURE_RETURN(m, F) \
- MOCK_METHOD2(m##WithoutStdFuture, F); \
- std::future<GMOCK_RESULT_(, F)> m( \
- GMOCK_ARG_(, F, 1) gmock_a1, \
- GMOCK_ARG_(, F, 2) gmock_a2) { \
- std::promise<CommonAPI::CallStatus> promise; \
- promise.set_value(m##WithoutStdFuture( \
- std::forward<GMOCK_ARG_(, F, 1)>(gmock_a1), \
- std::forward<GMOCK_ARG_(, F, 2)>(gmock_a2))); \
- return promise.get_future(); \
- }
-
-#define MOCK_METHOD3_WITH_FUTURE_RETURN(m, F) \
- MOCK_METHOD3(m##WithoutStdFuture, F); \
- std::future<GMOCK_RESULT_(, F)> m( \
- GMOCK_ARG_(, F, 1) gmock_a1, \
- GMOCK_ARG_(, F, 2) gmock_a2, \
- GMOCK_ARG_(, F, 3) gmock_a3) { \
- std::promise<CommonAPI::CallStatus> promise; \
- promise.set_value(m##WithoutStdFuture( \
- std::forward<GMOCK_ARG_(, F, 1)>(gmock_a1), \
- std::forward<GMOCK_ARG_(, F, 2)>(gmock_a2), \
- std::forward<GMOCK_ARG_(, F, 3)>(gmock_a3))); \
- return promise.get_future(); \
- }
-
-#define MOCK_METHOD4_WITH_FUTURE_RETURN(m, F) \
- MOCK_METHOD4(m##WithoutStdFuture, F); \
- std::future<GMOCK_RESULT_(, F)> m( \
- GMOCK_ARG_(, F, 1) gmock_a1, \
- GMOCK_ARG_(, F, 2) gmock_a2, \
- GMOCK_ARG_(, F, 2) gmock_a3, \
- GMOCK_ARG_(, F, 3) gmock_a4) { \
- std::promise<CommonAPI::CallStatus> promise; \
- promise.set_value(m##WithoutStdFuture( \
- std::forward<GMOCK_ARG_(, F, 1)>(gmock_a1), \
- std::forward<GMOCK_ARG_(, F, 2)>(gmock_a2), \
- std::forward<GMOCK_ARG_(, F, 3)>(gmock_a3), \
- std::forward<GMOCK_ARG_(, F, 4>(gmock_a4))); \
- return promise.get_future(); \
- }
-
-#define MOCK_METHOD5_WITH_FUTURE_RETURN(m, F) \
- MOCK_METHOD5(m##WithoutStdFuture, F); \
- std::future<GMOCK_RESULT_(, F)> m( \
- GMOCK_ARG_(, F, 1) gmock_a1, \
- GMOCK_ARG_(, F, 2) gmock_a2, \
- GMOCK_ARG_(, F, 2) gmock_a3, \
- GMOCK_ARG_(, F, 2) gmock_a4, \
- GMOCK_ARG_(, F, 3) gmock_a5) { \
- std::promise<CommonAPI::CallStatus> promise; \
- promise.set_value(m##WithoutStdFuture( \
- std::forward<GMOCK_ARG_(, F, 1)>(gmock_a1), \
- std::forward<GMOCK_ARG_(, F, 2)>(gmock_a2), \
- std::forward<GMOCK_ARG_(, F, 3)>(gmock_a3), \
- std::forward<GMOCK_ARG_(, F, 4)>(gmock_a4), \
- std::forward<GMOCK_ARG_(, F, 5)>(gmock_a5))); \
- return promise.get_future(); \
- }
-
-#define MOCK_METHOD6_WITH_FUTURE_RETURN(m, F) \
- MOCK_METHOD6(m##WithoutStdFuture, F); \
- std::future<GMOCK_RESULT_(, F)> m( \
- GMOCK_ARG_(, F, 1) gmock_a1, \
- GMOCK_ARG_(, F, 2) gmock_a2, \
- GMOCK_ARG_(, F, 2) gmock_a3, \
- GMOCK_ARG_(, F, 2) gmock_a4, \
- GMOCK_ARG_(, F, 2) gmock_a5, \
- GMOCK_ARG_(, F, 3) gmock_a6) { \
- std::promise<CommonAPI::CallStatus> promise; \
- promise.set_value(m##WithoutStdFuture( \
- std::forward<GMOCK_ARG_(, F, 1)>(gmock_a1), \
- std::forward<GMOCK_ARG_(, F, 2)>(gmock_a2), \
- std::forward<GMOCK_ARG_(, F, 3)>(gmock_a3), \
- std::forward<GMOCK_ARG_(, F, 4)>(gmock_a4), \
- std::forward<GMOCK_ARG_(, F, 5)>(gmock_a5), \
- std::forward<GMOCK_ARG_(, F, 6)>(gmock_a6))); \
- return promise.get_future(); \
- }
-
-#endif // ORG_GENIVI_COMMONAPI_GMOCK_H_
diff --git a/org.genivi.commonapi.core.tests/src/test-derived-types.cpp b/org.genivi.commonapi.core.tests/src/test-derived-types.cpp
deleted file mode 100644
index 2252967..0000000
--- a/org.genivi.commonapi.core.tests/src/test-derived-types.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-#include <commonapi/tests/DerivedTypeCollection.h>
-
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-int main(int argc, char** argv) {
- ::testing::InitGoogleMock(&argc, argv);
- return RUN_ALL_TESTS();
-}
diff --git a/org.genivi.commonapi.core.tests/src/test-derived-types.fidl b/org.genivi.commonapi.core.tests/src/test-derived-types.fidl
deleted file mode 100644
index 63c3467..0000000
--- a/org.genivi.commonapi.core.tests/src/test-derived-types.fidl
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-package commonapi.tests
-
-import commonapi.tests.* from "test-predefined-types.fidl"
-
-typeCollection DerivedTypeCollection {
- <** @description : Common errors. **>
- enumeration TestEnum {
- <** @description : default **>
- E_UNKNOWN = "0x00"
- <** @description : no error - positive reply **>
- E_OK = "0x01"
- <** @description : value out of range **>
- E_OUT_OF_RANGE = "0x02"
- <** @description : not used **>
- E_NOT_USED = "0x03"
- }
-
- enumeration TestEnumMissingValue {
- <** @description : default **>
- E1 = "A"
- E2
- E3 = "2"
- }
-
- enumeration TestEnumExtended extends TestEnum {
- <** @description : new error **>
- E_NEW = "0x04"
- }
-
- enumeration TestEnumExtended2 extends TestEnumExtended {
- <** @description : new error **>
- E_NEW2 = "0x05"
- }
-
- struct TestStruct {
- <** @description : the name of the property **>
- PredefinedTypeCollection.TestString testString
-
- <** @description : the actual value **>
- UInt16 uintValue
- }
-
- struct TestStructExtended extends TestStruct {
- TestEnumExtended2 testEnumExtended2
- }
-
- array TestArrayUInt64 of UInt64
- array TestArrayTestStruct of TestStruct
-
- map TestMap { UInt32 to TestArrayTestStruct }
-
- union TestUnionIn {
- TestEnum enum
- Int16 int
- String text
- }
-
- union TestUnionOut {
- TestEnumExtended enum
- Int16 int
- String text
- }
-}
-
-
diff --git a/org.genivi.commonapi.core.tests/src/test-interface-proxy.cpp b/org.genivi.commonapi.core.tests/src/test-interface-proxy.cpp
deleted file mode 100644
index f42dde6..0000000
--- a/org.genivi.commonapi.core.tests/src/test-interface-proxy.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-#include "test-interface-proxy.h"
-
-#include <gtest/gtest.h>
-
-#include <limits>
-
-using namespace ::testing;
-
-ACTION_P(SyncMethodCopyInValues2, cs) { arg3 = arg0; arg4 = arg1; arg2 = cs; }
-ACTION_P(ASyncMethodReturnInValues2, cs) { arg2(cs, arg0, arg1); return cs; }
-
-TEST(TestInterfaceProxy, VoidPredefinedTypeMethodWorks) {
- MockTestInterfaceProxyBase mockTestInterfaceProxyBase;
-
- EXPECT_CALL(mockTestInterfaceProxyBase, testVoidPredefinedTypeMethod(1234567, "Hello World!", _))
- .WillOnce(SetArgReferee<2>(CommonAPI::CallStatus::SUCCESS));
-
- CommonAPI::CallStatus callStatusOutValue;
- mockTestInterfaceProxyBase.testVoidPredefinedTypeMethod(1234567, "Hello World!", callStatusOutValue);
-
- ASSERT_EQ(callStatusOutValue, CommonAPI::CallStatus::SUCCESS);
-}
-
-TEST(TestInterfaceProxy, VoidPredefinedTypeMethodAsyncWorks) {
- MockTestInterfaceProxyBase mockTestInterfaceProxyBase;
-
- EXPECT_CALL(mockTestInterfaceProxyBase, testVoidPredefinedTypeMethodAsyncWithoutStdFuture(1234567, "Hello World!", _))
- .WillOnce(DoAll(
- InvokeArgument<2>(CommonAPI::CallStatus::SUCCESS),
- Return(CommonAPI::CallStatus::SUCCESS)));
-
- CommonAPI::CallStatus callStatusOutValue;
-
- std::future<CommonAPI::CallStatus> asyncFuture = mockTestInterfaceProxyBase.testVoidPredefinedTypeMethodAsync(
- 1234567,
- "Hello World!",
- [&] (const CommonAPI::CallStatus& callStatusCallback) { callStatusOutValue = callStatusCallback; });
-
- CommonAPI::CallStatus callStatusFuture = asyncFuture.get();
-
- ASSERT_EQ(callStatusFuture, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(callStatusOutValue, callStatusFuture);
-}
-
-TEST(TestInterfaceProxy, PredefinedTypeMethodWorks) {
- MockTestInterfaceProxyBase mockTestInterfaceProxyBase;
-
- EXPECT_CALL(mockTestInterfaceProxyBase, testPredefinedTypeMethod(_, _, _, _, _))
- .WillOnce(SyncMethodCopyInValues2(CommonAPI::CallStatus::SUCCESS));
-
- const uint32_t uint32InValue = std::numeric_limits<uint32_t>::max();
- const std::string& stringInValue = "Hello World!";
-
- CommonAPI::CallStatus callStatusOutValue;
- uint32_t uint32OutValue;
- std::string stringOutValue;
-
- mockTestInterfaceProxyBase.testPredefinedTypeMethod(
- uint32InValue,
- stringInValue,
- callStatusOutValue,
- uint32OutValue,
- stringOutValue);
-
- ASSERT_EQ(callStatusOutValue, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(uint32OutValue, uint32InValue);
- ASSERT_EQ(stringOutValue, stringInValue);
-}
-
-TEST(TestInterfaceProxy, PredefinedTypeMethodAsyncWorks) {
- MockTestInterfaceProxyBase mockTestInterfaceProxyBase;
-
- EXPECT_CALL(mockTestInterfaceProxyBase, testPredefinedTypeMethodAsyncWithoutStdFuture(_, _, _))
- .WillOnce(ASyncMethodReturnInValues2(CommonAPI::CallStatus::SUCCESS));
-
- const uint32_t uint32InValue = std::numeric_limits<uint32_t>::max();
- const std::string& stringInValue = "Hello World!";
-
- CommonAPI::CallStatus callStatusOutValue;
- uint32_t uint32OutValue;
- std::string stringOutValue;
-
- std::future<CommonAPI::CallStatus> asyncFuture = mockTestInterfaceProxyBase.testPredefinedTypeMethodAsync(
- uint32InValue,
- stringInValue,
- [&] (const CommonAPI::CallStatus& callStatusCallback, const uint32_t& uint32InValueCallback, const std::string& stringInValueCallback) {
- callStatusOutValue = callStatusCallback;
- uint32OutValue = uint32InValueCallback;
- stringOutValue = stringInValueCallback;
- });
-
- CommonAPI::CallStatus callStatusFuture = asyncFuture.get();
-
- ASSERT_EQ(callStatusFuture, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(callStatusOutValue, callStatusFuture);
- ASSERT_EQ(uint32OutValue, uint32InValue);
- ASSERT_EQ(stringOutValue, stringInValue);
-}
-
-TEST(TestInterfaceProxy, VoidDerivedTypeMethodWorks) {
- MockTestInterfaceProxyBase mockTestInterfaceProxyBase;
-
- EXPECT_CALL(mockTestInterfaceProxyBase, testVoidDerivedTypeMethod(commonapi::tests::DerivedTypeCollection::TestEnumExtended2::E_OK, _, _))
- .WillOnce(SetArgReferee<2>(CommonAPI::CallStatus::SUCCESS));
-
- commonapi::tests::DerivedTypeCollection::TestMap testMap;
- CommonAPI::CallStatus callStatusReturn;
- mockTestInterfaceProxyBase.testVoidDerivedTypeMethod(commonapi::tests::DerivedTypeCollection::TestEnumExtended2::E_OK, testMap, callStatusReturn);
-
- ASSERT_EQ(callStatusReturn, CommonAPI::CallStatus::SUCCESS);
-}
-
-TEST(TestInterfaceProxy, VoidDerivedTypeMethodAsyncWorks) {
- MockTestInterfaceProxyBase mockTestInterfaceProxyBase;
-
- EXPECT_CALL(mockTestInterfaceProxyBase, testVoidDerivedTypeMethodAsyncWithoutStdFuture(
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2::E_OK, _, _))
- .WillOnce(DoAll(
- InvokeArgument<2>(CommonAPI::CallStatus::SUCCESS),
- Return(CommonAPI::CallStatus::SUCCESS)));
-
- commonapi::tests::DerivedTypeCollection::TestMap testMap;
- CommonAPI::CallStatus callStatusOutValue;
-
- std::future<CommonAPI::CallStatus> asyncFuture = mockTestInterfaceProxyBase.testVoidDerivedTypeMethodAsync(
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2::E_OK,
- testMap,
- [&] (const CommonAPI::CallStatus& callStatusCallback) { callStatusOutValue = callStatusCallback; });
-
- CommonAPI::CallStatus callStatusFuture = asyncFuture.get();
-
- ASSERT_EQ(callStatusFuture, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(callStatusOutValue, callStatusFuture);
-}
-
-TEST(TestInterfaceProxy, DerivedTypeMethodWorks) {
- MockTestInterfaceProxyBase mockTestInterfaceProxyBase;
-
- EXPECT_CALL(mockTestInterfaceProxyBase, testDerivedTypeMethod(_, _, _, _, _))
- .WillOnce(SyncMethodCopyInValues2(CommonAPI::CallStatus::SUCCESS));
-
- CommonAPI::CallStatus callStatusOutValue;
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2 testEnumExtended2OutValue;
- commonapi::tests::DerivedTypeCollection::TestMap testMapOutValue;
-
- mockTestInterfaceProxyBase.testDerivedTypeMethod(
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2::E_OK,
- { { 123, { { "First Element", 12345 }, { "Second Element", 6789 } } },
- { 456, { { "Third Element", 333 }, { "Fourth Element", 4444 }, { "Fifth Element", 55555 } } },
- { 7, { } } },
- callStatusOutValue,
- testEnumExtended2OutValue,
- testMapOutValue);
-
- ASSERT_EQ(callStatusOutValue, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(testEnumExtended2OutValue, commonapi::tests::DerivedTypeCollection::TestEnumExtended2::E_OK);
- ASSERT_FALSE(testMapOutValue.empty());
- ASSERT_EQ(testMapOutValue.size(), 3);
- ASSERT_NE(testMapOutValue.find(123), testMapOutValue.end());
- ASSERT_NE(testMapOutValue.find(456), testMapOutValue.end());
- ASSERT_NE(testMapOutValue.find(7), testMapOutValue.end());
- ASSERT_FALSE(testMapOutValue[123].empty());
- ASSERT_EQ(testMapOutValue[123].size(), 2);
- ASSERT_EQ(testMapOutValue[123][0].testString, "First Element");
- ASSERT_EQ(testMapOutValue[123][0].uintValue, 12345);
- ASSERT_EQ(testMapOutValue[123][1].testString, "Second Element");
- ASSERT_EQ(testMapOutValue[123][1].uintValue, 6789);
- ASSERT_FALSE(testMapOutValue[456].empty());
- ASSERT_EQ(testMapOutValue[456].size(), 3);
- ASSERT_EQ(testMapOutValue[456][0].testString, "Third Element");
- ASSERT_EQ(testMapOutValue[456][0].uintValue, 333);
- ASSERT_EQ(testMapOutValue[456][1].testString, "Fourth Element");
- ASSERT_EQ(testMapOutValue[456][1].uintValue, 4444);
- ASSERT_EQ(testMapOutValue[456][2].testString, "Fifth Element");
- ASSERT_EQ(testMapOutValue[456][2].uintValue, 55555);
- ASSERT_TRUE(testMapOutValue[7].empty());
- ASSERT_EQ(testMapOutValue[7].size(), 0);
-}
-
-TEST(TestInterfaceProxy, DerivedTypeMethodAsyncWorks) {
- MockTestInterfaceProxyBase mockTestInterfaceProxyBase;
-
- EXPECT_CALL(mockTestInterfaceProxyBase, testDerivedTypeMethodAsyncWithoutStdFuture(_, _, _))
- .WillOnce(ASyncMethodReturnInValues2(CommonAPI::CallStatus::SUCCESS));
-
- CommonAPI::CallStatus callStatusOutValue;
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2 testEnumExtended2OutValue;
- commonapi::tests::DerivedTypeCollection::TestMap testMapOutValue;
-
- std::future<CommonAPI::CallStatus> asyncFuture = mockTestInterfaceProxyBase.testDerivedTypeMethodAsync(
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2::E_OK,
- { { 123, { { "First Element", 12345 }, { "Second Element", 6789 } } },
- { 456, { { "Third Element", 333 }, { "Fourth Element", 4444 }, { "Fifth Element", 55555 } } },
- { 7, { } } },
- [&] (const CommonAPI::CallStatus& callStatusCallback,
- const commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2Callback,
- const commonapi::tests::DerivedTypeCollection::TestMap& testMapCallback) {
- callStatusOutValue = callStatusCallback;
- testEnumExtended2OutValue = testEnumExtended2Callback;
- testMapOutValue = testMapCallback;
- });
-
- CommonAPI::CallStatus callStatusFuture = asyncFuture.get();
-
- ASSERT_EQ(callStatusFuture, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(callStatusOutValue, callStatusFuture);
- ASSERT_EQ(testEnumExtended2OutValue, commonapi::tests::DerivedTypeCollection::TestEnumExtended2::E_OK);
- ASSERT_FALSE(testMapOutValue.empty());
- ASSERT_EQ(testMapOutValue.size(), 3);
- ASSERT_NE(testMapOutValue.find(123), testMapOutValue.end());
- ASSERT_NE(testMapOutValue.find(456), testMapOutValue.end());
- ASSERT_NE(testMapOutValue.find(7), testMapOutValue.end());
- ASSERT_FALSE(testMapOutValue[123].empty());
- ASSERT_EQ(testMapOutValue[123].size(), 2);
- ASSERT_EQ(testMapOutValue[123][0].testString, "First Element");
- ASSERT_EQ(testMapOutValue[123][0].uintValue, 12345);
- ASSERT_EQ(testMapOutValue[123][1].testString, "Second Element");
- ASSERT_EQ(testMapOutValue[123][1].uintValue, 6789);
- ASSERT_FALSE(testMapOutValue[456].empty());
- ASSERT_EQ(testMapOutValue[456].size(), 3);
- ASSERT_EQ(testMapOutValue[456][0].testString, "Third Element");
- ASSERT_EQ(testMapOutValue[456][0].uintValue, 333);
- ASSERT_EQ(testMapOutValue[456][1].testString, "Fourth Element");
- ASSERT_EQ(testMapOutValue[456][1].uintValue, 4444);
- ASSERT_EQ(testMapOutValue[456][2].testString, "Fifth Element");
- ASSERT_EQ(testMapOutValue[456][2].uintValue, 55555);
- ASSERT_TRUE(testMapOutValue[7].empty());
- ASSERT_EQ(testMapOutValue[7].size(), 0);
-}
-
-int main(int argc, char** argv) {
- ::testing::InitGoogleMock(&argc, argv);
- return RUN_ALL_TESTS();
-}
diff --git a/org.genivi.commonapi.core.tests/src/test-interface-proxy.fidl b/org.genivi.commonapi.core.tests/src/test-interface-proxy.fidl
deleted file mode 100644
index 295902f..0000000
--- a/org.genivi.commonapi.core.tests/src/test-interface-proxy.fidl
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-package commonapi.tests
-
-import commonapi.tests.* from "test-derived-types.fidl"
-
-interface TestInterface {
- version { major 1 minor 0 }
-
- attribute UInt32 TestPredefinedTypeAttribute
- attribute DerivedTypeCollection.TestStructExtended TestDerivedStructAttribute
- attribute DerivedTypeCollection.TestArrayUInt64 TestDerivedArrayAttribute
-
- method testVoidPredefinedTypeMethod {
- in {
- UInt32 uint32Value
- String stringValue
- }
- }
-
- method testPredefinedTypeMethod {
- in {
- UInt32 uint32InValue
- String stringInValue
- }
- out {
- UInt32 uint32OutValue
- String stringOutValue
- }
- }
-
- method testVoidDerivedTypeMethod {
- in {
- DerivedTypeCollection.TestEnumExtended2 testEnumExtended2Value
- DerivedTypeCollection.TestMap testMapValue
- }
- }
-
- method testDerivedTypeMethod {
- in {
- DerivedTypeCollection.TestEnumExtended2 testEnumExtended2InValue
- DerivedTypeCollection.TestMap testMapInValue
- }
- out {
- DerivedTypeCollection.TestEnumExtended2 testEnumExtended2OutValue
- DerivedTypeCollection.TestMap testMapOutValue
- }
- }
-
- method testUnionMethod {
- in {
- DerivedTypeCollection.TestUnionIn inParam
- }
- out {
- DerivedTypeCollection.TestUnionOut outParam
- }
- }
-
- broadcast TestPredefinedTypeBroadcast {
- out {
- UInt32 uint32Value
- String stringValue
- }
- }
-}
-
diff --git a/org.genivi.commonapi.core.tests/src/test-interface-proxy.h b/org.genivi.commonapi.core.tests/src/test-interface-proxy.h
deleted file mode 100644
index e025731..0000000
--- a/org.genivi.commonapi.core.tests/src/test-interface-proxy.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-#ifndef TEST_INTERFACE_PROXY_H_
-#define TEST_INTERFACE_PROXY_H_
-
-#include "commonapi-mock.h"
-
-#include <commonapi/tests/TestInterfaceProxy.h>
-
-
-class MockTestPredefinedTypeAttributeAttribute:
- public commonapi::tests::TestInterfaceProxyBase::TestPredefinedTypeAttributeAttribute {
-// TODO
-};
-
-class MockTestDerivedStructAttributeAttribute:
- public commonapi::tests::TestInterfaceProxyBase::TestDerivedStructAttributeAttribute {
-// TODO
-};
-
-class MockTestDerivedArrayAttributeAttribute:
- public commonapi::tests::TestInterfaceProxyBase::TestDerivedArrayAttributeAttribute {
-// TODO
-};
-
-class MockTestPredefinedTypeBroadcastEvent:
- public commonapi::tests::TestInterfaceProxyBase::TestPredefinedTypeBroadcastEvent {
-// TODO
-};
-
-
-
-class MockTestInterfaceProxyBase: public MockProxy, public commonapi::tests::TestInterfaceProxyBase {
- public:
- MOCK_METHOD0(getTestPredefinedTypeAttributeAttribute, TestPredefinedTypeAttributeAttribute&());
- MOCK_METHOD0(getTestDerivedStructAttributeAttribute, TestDerivedStructAttributeAttribute&());
- MOCK_METHOD0(getTestDerivedArrayAttributeAttribute, TestDerivedArrayAttributeAttribute&());
- MOCK_METHOD0(getTestPredefinedTypeBroadcastEvent, TestPredefinedTypeBroadcastEvent&());
-
- MOCK_METHOD3(testVoidPredefinedTypeMethod,
- void(const uint32_t& uint32Value,
- const std::string& stringValue,
- CommonAPI::CallStatus& callStatus));
-
- MOCK_METHOD3_WITH_FUTURE_RETURN(testVoidPredefinedTypeMethodAsync,
- CommonAPI::CallStatus (const uint32_t& uint32Value,
- const std::string& stringValue,
- TestVoidPredefinedTypeMethodAsyncCallback callback));
-
- MOCK_METHOD5(testPredefinedTypeMethod,
- void(const uint32_t& uint32InValue,
- const std::string& stringInValue,
- CommonAPI::CallStatus& callStatus,
- uint32_t& uint32OutValue,
- std::string& stringOutValue));
-
- MOCK_METHOD3_WITH_FUTURE_RETURN(testPredefinedTypeMethodAsync,
- CommonAPI::CallStatus (const uint32_t& uint32InValue,
- const std::string& stringInValue,
- TestPredefinedTypeMethodAsyncCallback callback));
-
- MOCK_METHOD3(testVoidDerivedTypeMethod,
- void(const commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2Value,
- const commonapi::tests::DerivedTypeCollection::TestMap& testMapValue,
- CommonAPI::CallStatus& callStatus));
-
-
- MOCK_METHOD3_WITH_FUTURE_RETURN(testVoidDerivedTypeMethodAsync,
- CommonAPI::CallStatus (const commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2Value,
- const commonapi::tests::DerivedTypeCollection::TestMap& testMapValue,
- TestVoidDerivedTypeMethodAsyncCallback callback));
-
- MOCK_METHOD5(testDerivedTypeMethod,
- void(const commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2InValue,
- const commonapi::tests::DerivedTypeCollection::TestMap& testMapInValue,
- CommonAPI::CallStatus& callStatus,
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue,
- commonapi::tests::DerivedTypeCollection::TestMap& testMapOutValue));
-
- MOCK_METHOD3_WITH_FUTURE_RETURN(testDerivedTypeMethodAsync,
- CommonAPI::CallStatus (const commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2InValue,
- const commonapi::tests::DerivedTypeCollection::TestMap& testMapInValue,
- TestDerivedTypeMethodAsyncCallback callback));
-};
-
-#endif /* TEST_INTERFACE_PROXY_H_ */
diff --git a/org.genivi.commonapi.core.tests/src/test-interface-stub.cpp b/org.genivi.commonapi.core.tests/src/test-interface-stub.cpp
deleted file mode 100644
index ba9ac01..0000000
--- a/org.genivi.commonapi.core.tests/src/test-interface-stub.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-#include <commonapi/tests/TestInterfaceStubDefault.h>
-
-// TODO
-
-int main(int argc, char** argv) {
- return -1;
-}
diff --git a/org.genivi.commonapi.core.tests/src/test-predefined-types.cpp b/org.genivi.commonapi.core.tests/src/test-predefined-types.cpp
deleted file mode 100644
index 9c617f4..0000000
--- a/org.genivi.commonapi.core.tests/src/test-predefined-types.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-#include <commonapi/tests/PredefinedTypeCollection.h>
-
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include <limits>
-
-TEST(PredefinedDataTypes, HaveCorrectSize) {
- ASSERT_EQ(sizeof(::commonapi::tests::PredefinedTypeCollection::TestUInt8), 1);
- ASSERT_EQ(sizeof(::commonapi::tests::PredefinedTypeCollection::TestUInt16), 2);
- ASSERT_EQ(sizeof(::commonapi::tests::PredefinedTypeCollection::TestUInt32), 4);
- ASSERT_EQ(sizeof(::commonapi::tests::PredefinedTypeCollection::TestUInt64), 8);
- ASSERT_EQ(sizeof(::commonapi::tests::PredefinedTypeCollection::TestInt8), 1);
- ASSERT_EQ(sizeof(::commonapi::tests::PredefinedTypeCollection::TestInt16), 2);
- ASSERT_EQ(sizeof(::commonapi::tests::PredefinedTypeCollection::TestInt32), 4);
- ASSERT_EQ(sizeof(::commonapi::tests::PredefinedTypeCollection::TestInt64), 8);
- ASSERT_EQ(sizeof(::commonapi::tests::PredefinedTypeCollection::TestDouble), 8);
- ASSERT_EQ(sizeof(::commonapi::tests::PredefinedTypeCollection::TestFloat), 4);
-}
-
-TEST(PredefinedDataTypes, HaveCorrectTypes) {
- ASSERT_EQ(typeid(::commonapi::tests::PredefinedTypeCollection::TestUInt8), typeid(uint8_t));
- ASSERT_EQ(typeid(::commonapi::tests::PredefinedTypeCollection::TestUInt16), typeid(uint16_t));
- ASSERT_EQ(typeid(::commonapi::tests::PredefinedTypeCollection::TestUInt32), typeid(uint32_t));
- ASSERT_EQ(typeid(::commonapi::tests::PredefinedTypeCollection::TestUInt64), typeid(uint64_t));
- ASSERT_EQ(typeid(::commonapi::tests::PredefinedTypeCollection::TestInt8), typeid(int8_t));
- ASSERT_EQ(typeid(::commonapi::tests::PredefinedTypeCollection::TestInt16), typeid(int16_t));
- ASSERT_EQ(typeid(::commonapi::tests::PredefinedTypeCollection::TestInt32), typeid(int32_t));
- ASSERT_EQ(typeid(::commonapi::tests::PredefinedTypeCollection::TestInt64), typeid(int64_t));
- ASSERT_EQ(typeid(::commonapi::tests::PredefinedTypeCollection::TestDouble), typeid(double));
- ASSERT_EQ(typeid(::commonapi::tests::PredefinedTypeCollection::TestFloat), typeid(float));
- ASSERT_EQ(typeid(::commonapi::tests::PredefinedTypeCollection::TestString), typeid(std::string));
- ASSERT_EQ(typeid(::commonapi::tests::PredefinedTypeCollection::TestBoolean), typeid(bool));
- ASSERT_EQ(typeid(::commonapi::tests::PredefinedTypeCollection::TestByteBuffer), typeid(CommonAPI::ByteBuffer));
-}
-
-TEST(PredefinedDataTypes, StoreCorrectValues) {
- ::commonapi::tests::PredefinedTypeCollection::TestUInt8 testUInt8 = std::numeric_limits<uint8_t>::max();
- ASSERT_EQ(testUInt8, std::numeric_limits<uint8_t>::max());
-
- ::commonapi::tests::PredefinedTypeCollection::TestUInt16 testUInt16 = std::numeric_limits<uint16_t>::max();
- ASSERT_EQ(testUInt16, std::numeric_limits<uint16_t>::max());
-
- ::commonapi::tests::PredefinedTypeCollection::TestUInt32 testUInt32 = std::numeric_limits<uint32_t>::max();
- ASSERT_EQ(testUInt32, std::numeric_limits<uint32_t>::max());
-
- ::commonapi::tests::PredefinedTypeCollection::TestUInt64 testUInt64 = std::numeric_limits<uint64_t>::max();
- ASSERT_EQ(testUInt64, std::numeric_limits<uint64_t>::max());
-
- ::commonapi::tests::PredefinedTypeCollection::TestInt8 testInt8 = std::numeric_limits<int8_t>::max();
- ASSERT_EQ(testInt8, std::numeric_limits<int8_t>::max());
-
- ::commonapi::tests::PredefinedTypeCollection::TestInt16 testInt16 = std::numeric_limits<int16_t>::max();
- ASSERT_EQ(testInt16, std::numeric_limits<int16_t>::max());
-
- ::commonapi::tests::PredefinedTypeCollection::TestInt32 testInt32 = std::numeric_limits<int32_t>::max();
- ASSERT_EQ(testInt32, std::numeric_limits<int32_t>::max());
-
- ::commonapi::tests::PredefinedTypeCollection::TestInt64 testInt64 = std::numeric_limits<int64_t>::max();
- ASSERT_EQ(testInt64, std::numeric_limits<int64_t>::max());
-
- ::commonapi::tests::PredefinedTypeCollection::TestDouble testDouble = std::numeric_limits<double>::max();
- ASSERT_EQ(testDouble, std::numeric_limits<double>::max());
-
- ::commonapi::tests::PredefinedTypeCollection::TestFloat testFloat = std::numeric_limits<float>::max();
- ASSERT_EQ(testFloat, std::numeric_limits<float>::max());
-
- ::commonapi::tests::PredefinedTypeCollection::TestString testString = std::string("Hello World!");
- ASSERT_EQ(testString, std::string("Hello World!"));
-
- ::commonapi::tests::PredefinedTypeCollection::TestBoolean testBoolean = true;
- ASSERT_EQ(testBoolean, true);
-
- ::commonapi::tests::PredefinedTypeCollection::TestByteBuffer testByteBuffer;
- ASSERT_EQ(testByteBuffer.empty(), true);
- ASSERT_EQ(testByteBuffer.size(), 0);
- testByteBuffer.emplace_back(std::numeric_limits<uint8_t>::max());
- testByteBuffer.emplace_back(0x05);
- testByteBuffer.emplace_back(0xA0);
- testByteBuffer.emplace_back(0xCB);
- testByteBuffer.emplace_back(0xFF);
- ASSERT_EQ(testByteBuffer.empty(), false);
- ASSERT_EQ(testByteBuffer.size(), 5);
- ASSERT_EQ(testByteBuffer[0], std::numeric_limits<uint8_t>::max());
- ASSERT_EQ(testByteBuffer[1], 0x05);
- ASSERT_EQ(testByteBuffer[2], 0xA0);
- ASSERT_EQ(testByteBuffer[3], 0xCB);
- ASSERT_EQ(testByteBuffer[4], 0xFF);
-}
-
-int main(int argc, char** argv) {
- ::testing::InitGoogleMock(&argc, argv);
- return RUN_ALL_TESTS();
-}
diff --git a/org.genivi.commonapi.core.tests/src/test-predefined-types.fidl b/org.genivi.commonapi.core.tests/src/test-predefined-types.fidl
deleted file mode 100644
index c8f9882..0000000
--- a/org.genivi.commonapi.core.tests/src/test-predefined-types.fidl
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-package commonapi.tests
-
-typeCollection PredefinedTypeCollection {
- typedef TestUInt8 is UInt8
- typedef TestUInt16 is UInt16
- typedef TestUInt32 is UInt32
- typedef TestUInt64 is UInt64
- typedef TestInt8 is Int8
- typedef TestInt16 is Int16
- typedef TestInt32 is Int32
- typedef TestInt64 is Int64
- typedef TestBoolean is Boolean
- typedef TestByteBuffer is ByteBuffer
- typedef TestDouble is Double
- typedef TestFloat is Float
- typedef TestString is String
-}
-
-
diff --git a/org.genivi.commonapi.core.ui/.classpath b/org.genivi.commonapi.core.ui/.classpath
index ad32c83..1fa3e68 100644
--- a/org.genivi.commonapi.core.ui/.classpath
+++ b/org.genivi.commonapi.core.ui/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.genivi.commonapi.core.ui/.gitignore b/org.genivi.commonapi.core.ui/.gitignore
index ea8c4bf..ad19da6 100644
--- a/org.genivi.commonapi.core.ui/.gitignore
+++ b/org.genivi.commonapi.core.ui/.gitignore
@@ -1 +1,3 @@
+*~
+/bin
/target
diff --git a/org.genivi.commonapi.core.ui/.settings/org.eclipse.core.resources.prefs b/org.genivi.commonapi.core.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.genivi.commonapi.core.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.genivi.commonapi.core.ui/.settings/org.eclipse.core.runtime.prefs b/org.genivi.commonapi.core.ui/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/org.genivi.commonapi.core.ui/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.genivi.commonapi.core.ui/.settings/org.eclipse.jdt.core.prefs b/org.genivi.commonapi.core.ui/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 8000cd6..0000000
--- a/org.genivi.commonapi.core.ui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,11 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.genivi.commonapi.core.ui/LICENSE b/org.genivi.commonapi.core.ui/LICENSE
deleted file mode 100644
index 14e2f77..0000000
--- a/org.genivi.commonapi.core.ui/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- 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/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF b/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF
index b89ed62..5882593 100644
--- a/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF
+++ b/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF
@@ -2,25 +2,24 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: GENIVI Common API UI
Bundle-SymbolicName: org.genivi.commonapi.core.ui;singleton:=true
-Bundle-Version: 2.1.6.qualifier
+Bundle-Version: 3.1.1.qualifier
Bundle-Activator: org.genivi.commonapi.core.ui.CommonApiUiPlugin
Bundle-Vendor: BMW AG
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.expressions;bundle-version="3.4.400",
- org.eclipse.core.resources,
- org.eclipse.core.runtime,
- org.eclipse.xtext.builder;bundle-version="2.4.0",
- org.eclipse.xtext.generator;bundle-version="2.4.0",
- org.eclipse.xtext.ui;bundle-version="2.4.0",
- org.eclipse.xtext.ui.ecore;bundle-version="2.4.0",
- com.google.inject;bundle-version="3.0.0",
- org.genivi.commonapi.core;bundle-version="2.1.5",
- org.eclipse.cdt.ui;bundle-version="5.5.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.10.0,4.0.0)";visibility:=reexport,
+ org.eclipse.core.resources;bundle-version="[3.9.0,4.0.0)";visibility:=reexport,
+ org.eclipse.core.expressions;bundle-version="[3.4.400,4.0.0)";visibility:=reexport,
+ org.eclipse.ui,
+ org.eclipse.cdt.ui;bundle-version="[5.5.0,6.0.0)";visibility:=reexport,
+ org.eclipse.xtext.ui;bundle-version="[2.7.0,3.0.0)";visibility:=reexport,
+ org.eclipse.xtext.ui.ecore;bundle-version="[2.7.0,3.0.0)";visibility:=reexport,
+ org.eclipse.xtext.builder;bundle-version="[2.7.0,3.0.0)";visibility:=reexport,
+ org.eclipse.xtext.generator;bundle-version="[2.7.0,3.0.0)";visibility:=reexport,
+ com.google.inject;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
+ org.genivi.commonapi.core;bundle-version="3.1.1";visibility:=reexport,
+ org.franca.core.dsl.ui;bundle-version="0.9.1",
+ org.franca.deploymodel.dsl.ui;bundle-version="0.9.1"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
-Import-Package: javax.inject,
- org.franca.core.dsl.validation,
- org.franca.core.franca,
- org.franca.core.utils
-Export-Package: org.genivi.commonapi.core.ui,org.genivi.commonapi.core
- .ui.handler
+Export-Package: org.genivi.commonapi.core.ui,
+ org.genivi.commonapi.core.ui.handler,
+ org.genivi.commonapi.core.ui.preferences
diff --git a/org.genivi.commonapi.core.ui/build.properties b/org.genivi.commonapi.core.ui/build.properties
index 2b0d95b..32c2330 100644
--- a/org.genivi.commonapi.core.ui/build.properties
+++ b/org.genivi.commonapi.core.ui/build.properties
@@ -1,3 +1,4 @@
+javacDefaultEncoding.. = UTF-8
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
diff --git a/org.genivi.commonapi.core.ui/plugin.xml b/org.genivi.commonapi.core.ui/plugin.xml
index 1b8ef6f..57352fd 100644
--- a/org.genivi.commonapi.core.ui/plugin.xml
+++ b/org.genivi.commonapi.core.ui/plugin.xml
@@ -66,6 +66,23 @@
</iterate>
</or>
</definition>
+ <definition
+ id="org.genivi.commonapi.core.ui.FrancaIDL.Resources.fdepl.selected">
+ <or>
+ <reference
+ definitionId="org.franca.core.dsl.FrancaIDL.Editor.opened">
+ </reference>
+ <iterate>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <test
+ property="org.eclipse.core.resources.name"
+ value="*.fdepl">
+ </test>
+ </adapt>
+ </iterate>
+ </or>
+ </definition>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
diff --git a/org.genivi.commonapi.core.ui/pom.xml b/org.genivi.commonapi.core.ui/pom.xml
index 186dd2f..98884aa 100644
--- a/org.genivi.commonapi.core.ui/pom.xml
+++ b/org.genivi.commonapi.core.ui/pom.xml
@@ -6,8 +6,8 @@
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>commonapi</groupId>
- <artifactId>org.genivi.commonapi.releng</artifactId>
- <version>2.1.6-SNAPSHOT</version>
- <relativePath>../org.genivi.commonapi.releng</relativePath>
+ <artifactId>org.genivi.commonapi.core.releng</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
+ <relativePath>../org.genivi.commonapi.core.releng</relativePath>
</parent>
-</project> \ No newline at end of file
+</project>
diff --git a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/CommonApiUiPlugin.java b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/CommonApiUiPlugin.java
index 452c147..fbeb93d 100644
--- a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/CommonApiUiPlugin.java
+++ b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/CommonApiUiPlugin.java
@@ -6,6 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.genivi.commonapi.core.ui;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -48,4 +49,9 @@ public class CommonApiUiPlugin extends AbstractUIPlugin {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
+ public static IPreferenceStore getValidatorPreferences() {
+ return INSTANCE.getPreferenceStore();
+ }
+
+
}
diff --git a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/handler/GenerationCommand.java b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/handler/GenerationCommand.java
index ec6fe7f..5bd5b38 100644
--- a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/handler/GenerationCommand.java
+++ b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/handler/GenerationCommand.java
@@ -23,6 +23,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.common.util.URI;
@@ -36,9 +37,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2;
-import org.eclipse.xtext.generator.IFileSystemAccess;
import org.eclipse.xtext.generator.IGenerator;
-import org.eclipse.xtext.resource.IResourceDescriptions;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.ui.editor.XtextEditor;
import org.eclipse.xtext.ui.resource.IResourceSetProvider;
@@ -46,233 +45,320 @@ import org.eclipse.xtext.util.concurrent.IUnitOfWork;
import org.genivi.commonapi.core.preferences.FPreferences;
import org.genivi.commonapi.core.preferences.PreferenceConstants;
import org.genivi.commonapi.core.ui.CommonApiUiPlugin;
-import org.genivi.commonapi.core.ui.preferences.CommonAPIPreferencePage;
-import org.genivi.commonapi.core.ui.preferences.FieldEditorOverlayPage;
import com.google.inject.Provider;
public class GenerationCommand extends AbstractHandler {
- @Inject
- private Provider<EclipseResourceFileSystemAccess2> fileAccessProvider;
- @Inject
- private IResourceDescriptions resourceDescriptions;
- @Inject
- private IResourceSetProvider resourceSetProvider;
- @Inject
- private IGenerator francaGenerator;
-
- @Override
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- final ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection) {
- if (!selection.isEmpty())
- executeGeneratorForSelection((IStructuredSelection) selection);
- } else {
- final IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
- if (activeEditor instanceof XtextEditor)
- executeGeneratorForXtextEditor((XtextEditor) activeEditor);
- else
- throw new ExecutionException("Cannot handle ExecutionEvent: "
- + event);
- }
-
- return null;
- }
-
- private void executeGeneratorForSelection(
- final IStructuredSelection structuredSelection) {
- IProject project = null;
- for (Iterator<?> iterator = structuredSelection.iterator(); iterator
- .hasNext();) {
- final Object selectiobObject = iterator.next();
- if (selectiobObject instanceof IFile) {
- final IFile file = (IFile) selectiobObject;
- final URI uri = URI.createPlatformResourceURI(file
- .getFullPath().toString(), true);
- final ResourceSet rs = resourceSetProvider.get(file
- .getProject());
- final Resource r = rs.getResource(uri, true);
-
- project = file.getProject();
- FieldEditorOverlayPage page = new CommonAPIPreferencePage();
- page.setElement(project);
- page.createControl(null);
- FPreferences.init(page.getPreferenceStore(), CommonApiUiPlugin
- .getDefault().getPreferenceStore(), project);
- final EclipseResourceFileSystemAccess2 fileSystemAccess = createFileSystemAccess(project);
- fileSystemAccess.setProject(project);
- Job job = new Job("validation and generation") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask("handle " + file.getName(),
- IProgressMonitor.UNKNOWN);
- monitor.subTask("validation");
- int i = 0;
- try {
- for (IMarker m : ((IResource) file).findMarkers(
- IMarker.PROBLEM, true, 2)) {
- if ((Integer) m.getAttribute(IMarker.SEVERITY) == IMarker.SEVERITY_ERROR) {
- i++;
- break;
- }
- }
-
- } catch (CoreException ce) {
- }
- if (r.getErrors().size() == 0 && i == 0) {
- monitor.subTask("Generate");
- try {
- francaGenerator.doGenerate(r, fileSystemAccess);
- } catch (Exception e) {
- exceptionPopUp(e, file);
- return Status.CANCEL_STATUS;
- } catch (Error e) {
- errorPopUp(e, file);
- return Status.CANCEL_STATUS;
- }
- return Status.OK_STATUS;
- } else {
- markerPopUp(file);
- return Status.CANCEL_STATUS;
- }
-
- }
-
- };
- job.schedule();
- }
- }
- }
-
- private void executeGeneratorForXtextEditor(final XtextEditor xtextEditor) {
- final Object fileObject = xtextEditor.getEditorInput().getAdapter(
- IFile.class);
- if (fileObject instanceof IFile) {
- IProject project = ((IResource) fileObject).getProject();
- final EclipseResourceFileSystemAccess2 fileSystemAccess = createFileSystemAccess(project);
- fileSystemAccess.setProject(project);
-
- xtextEditor.getDocument().readOnly(
- new IUnitOfWork<Boolean, XtextResource>() {
- @Override
- public Boolean exec(XtextResource xtextResource)
- throws Exception {
- final XtextResource xtextRes = xtextResource;
- Job job = new Job("validation and generation") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
-
- monitor.beginTask(
- "handle "
- + ((IResource) fileObject)
- .getName(),
- IProgressMonitor.UNKNOWN);
- monitor.subTask("validation");
- int i = 0;
- try {
- for (IMarker m : ((IResource) fileObject)
- .findMarkers(IMarker.PROBLEM,
- true, 2)) {
- if ((Integer) m
- .getAttribute(IMarker.SEVERITY) == IMarker.SEVERITY_ERROR) {
- i++;
- break;
- }
- }
- } catch (CoreException ce) {
- }
- if (xtextRes.getErrors().size() == 0
- && i == 0) {
- monitor.subTask("Generate");
- try {
- francaGenerator.doGenerate(
- xtextRes, fileSystemAccess);
- } catch (Exception e) {
- exceptionPopUp(e,
- (IFile) fileObject);
- return Status.CANCEL_STATUS;
- } catch (Error e) {
- errorPopUp(e, (IFile) fileObject);
- return Status.CANCEL_STATUS;
- }
- return Status.OK_STATUS;
- } else {
- markerPopUp((IFile) fileObject);
- return Status.CANCEL_STATUS;
- }
- }
-
- };
- job.schedule();
- return Boolean.TRUE;
- }
- });
- }
- }
-
- private void exceptionPopUp(Exception e, IFile f) {
- final Exception ex = e;
- final IFile file = f;
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- ex.printStackTrace();
- MessageDialog.openError(
- null,
- "Error by generating file " + file.getName(),
- "Couldn't generate file. Exception occured:\n"
- + ex.toString()
- + "\n\nSee console for stack trace.");
- }
- });
- }
-
- private void markerPopUp(IFile f) {
- final IFile file = f;
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- MessageDialog.openError(
- null,
- "Error in file " + file.getName(),
- "Couldn't generate file. File still holds errors!\n\nSee Problems view for details.");
- }
- });
- }
-
- private void errorPopUp(Error e, IFile f) {
- final Error er = e;
- final IFile file = f;
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- er.printStackTrace();
- MessageDialog.openError(
- null,
- "Error by generating file " + file.getName(),
- "Couldn't generate file. Error occured:\n"
- + er.toString()
- + "\n\nSee console for stack trace.");
- }
- });
- }
-
- private EclipseResourceFileSystemAccess2 createFileSystemAccess(
- IProject project) {
- IPreferenceStore store = CommonApiUiPlugin.getDefault()
- .getPreferenceStore();
- String outputDir = store.getString(PreferenceConstants.P_OUTPUT_PROXIES);
- if (FPreferences.getInstance().getPreference(project, PreferenceConstants.P_OUTPUT_PROXIES, null) != null)
- {
- outputDir = FPreferences.getInstance().getPreference(project, PreferenceConstants.P_OUTPUT_PROXIES, null);
- }
- final EclipseResourceFileSystemAccess2 fsa = fileAccessProvider.get();
-
- fsa.setOutputPath(outputDir);
- fsa.getOutputConfigurations().get(IFileSystemAccess.DEFAULT_OUTPUT)
- .setCreateOutputDirectory(true);
- fsa.setMonitor(new NullProgressMonitor());
-
- return fsa;
- }
+ @Inject
+ protected Provider<EclipseResourceFileSystemAccess2> fileAccessProvider;
+ @Inject
+ private IResourceSetProvider resourceSetProvider;
+ @Inject
+ private IGenerator francaGenerator;
+
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ final ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ if (!selection.isEmpty())
+ executeGeneratorForSelection((IStructuredSelection) selection);
+ } else {
+ final IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
+ if (activeEditor instanceof XtextEditor)
+ executeGeneratorForXtextEditor((XtextEditor) activeEditor);
+ else
+ throw new ExecutionException("Cannot handle ExecutionEvent: "
+ + event);
+ }
+
+ return null;
+ }
+
+ private void executeGeneratorForSelection(
+ final IStructuredSelection structuredSelection) {
+ IProject project = null;
+ for (Iterator<?> iterator = structuredSelection.iterator(); iterator
+ .hasNext();) {
+ final Object selectiobObject = iterator.next();
+ if (selectiobObject instanceof IFile) {
+ final IFile file = (IFile) selectiobObject;
+ final URI uri = URI.createPlatformResourceURI(file
+ .getFullPath().toString(), true);
+ final ResourceSet rs = resourceSetProvider.get(file
+ .getProject());
+ final Resource r = rs.getResource(uri, true);
+
+ project = file.getProject();
+
+ setupPreferences(file);
+
+ final EclipseResourceFileSystemAccess2 fileSystemAccess = createFileSystemAccess();
+ fileSystemAccess.setProject(project);
+ Job job = new Job("validation and generation") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask("handle " + file.getName(),
+ IProgressMonitor.UNKNOWN);
+ monitor.subTask("validation");
+ int i = 0;
+ try {
+ for (IMarker m : ((IResource) file).findMarkers(
+ IMarker.PROBLEM, true, 2)) {
+ if ((Integer) m.getAttribute(IMarker.SEVERITY) == IMarker.SEVERITY_ERROR) {
+ i++;
+ break;
+ }
+ }
+
+ } catch (CoreException ce) {
+ }
+ if (r.getErrors().size() == 0 && i == 0) {
+ monitor.subTask("Generate");
+ try {
+ francaGenerator.doGenerate(r, fileSystemAccess);
+ } catch (Exception e) {
+ exceptionPopUp(e, file);
+ return Status.CANCEL_STATUS;
+ } catch (Error e) {
+ errorPopUp(e, file);
+ return Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
+ } else {
+ markerPopUp(file);
+ return Status.CANCEL_STATUS;
+ }
+
+ }
+
+ };
+ job.schedule();
+ }
+ }
+ }
+
+ /**
+ * Init core preferences
+ * @param file
+ * @param page
+ * @param project
+ */
+ protected void setupPreferences(IFile file) {
+
+ initPreferences(file, CommonApiUiPlugin.getDefault().getPreferenceStore());
+ }
+
+ private void executeGeneratorForXtextEditor(final XtextEditor xtextEditor) {
+ final Object fileObject = xtextEditor.getEditorInput().getAdapter(
+ IFile.class);
+ if (fileObject instanceof IFile) {
+ IProject project = ((IResource) fileObject).getProject();
+ final EclipseResourceFileSystemAccess2 fileSystemAccess = createFileSystemAccess();
+ fileSystemAccess.setProject(project);
+
+ xtextEditor.getDocument().readOnly(
+ new IUnitOfWork<Boolean, XtextResource>() {
+ @Override
+ public Boolean exec(XtextResource xtextResource)
+ throws Exception {
+ final XtextResource xtextRes = xtextResource;
+ Job job = new Job("validation and generation") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+
+ monitor.beginTask(
+ "handle "
+ + ((IResource) fileObject)
+ .getName(),
+ IProgressMonitor.UNKNOWN);
+ monitor.subTask("validation");
+ int i = 0;
+ try {
+ for (IMarker m : ((IResource) fileObject)
+ .findMarkers(IMarker.PROBLEM,
+ true, 2)) {
+ if ((Integer) m
+ .getAttribute(IMarker.SEVERITY) == IMarker.SEVERITY_ERROR) {
+ i++;
+ break;
+ }
+ }
+ } catch (CoreException ce) {
+ }
+ if (xtextRes.getErrors().size() == 0
+ && i == 0) {
+ monitor.subTask("Generate");
+ try {
+ francaGenerator.doGenerate(
+ xtextRes, fileSystemAccess);
+ } catch (Exception e) {
+ exceptionPopUp(e,
+ (IFile) fileObject);
+ return Status.CANCEL_STATUS;
+ } catch (Error e) {
+ errorPopUp(e, (IFile) fileObject);
+ return Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
+ } else {
+ markerPopUp((IFile) fileObject);
+ return Status.CANCEL_STATUS;
+ }
+ }
+
+ };
+ job.schedule();
+ return Boolean.TRUE;
+ }
+ });
+ }
+ }
+
+ private void exceptionPopUp(Exception e, IFile f) {
+ final Exception ex = e;
+ final IFile file = f;
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ ex.printStackTrace();
+ MessageDialog.openError(
+ null,
+ "Error by generating file " + file.getName(),
+ "Couldn't generate file. Exception occured:\n"
+ + ex.toString()
+ + "\n\nSee console for stack trace.");
+ }
+ });
+ }
+
+ private void markerPopUp(IFile f) {
+ final IFile file = f;
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ MessageDialog.openError(
+ null,
+ "Error in file " + file.getName(),
+ "Couldn't generate file. File still holds errors!\n\nSee Problems view for details.");
+ }
+ });
+ }
+
+ private void errorPopUp(Error e, IFile f) {
+ final Error er = e;
+ final IFile file = f;
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ er.printStackTrace();
+ MessageDialog.openError(
+ null,
+ "Error by generating file " + file.getName(),
+ "Couldn't generate file. Error occured:\n"
+ + er.toString()
+ + "\n\nSee console for stack trace.");
+ }
+ });
+ }
+
+ protected EclipseResourceFileSystemAccess2 createFileSystemAccess() {
+
+ final EclipseResourceFileSystemAccess2 fsa = fileAccessProvider.get();
+
+ fsa.setOutputConfigurations(FPreferences.getInstance().getOutputpathConfiguration());
+
+ fsa.setMonitor(new NullProgressMonitor());
+
+ return fsa;
+ }
+
+ /**
+ * Set the properties for the code generation from the resource properties (set with the property page, via the context menu).
+ * Take default values from the eclipse preference page.
+ * @param file
+ * @param store - the eclipse preference store
+ */
+ private void initPreferences(IFile file, IPreferenceStore store) {
+ FPreferences instance = FPreferences.getInstance();
+
+ String outputFolderCommon = null;
+ String outputFolderProxies = null;
+ String outputFolderStubs = null;
+ String outputFolderSkeleton = null;
+ String licenseHeader = null;
+ String generateProxy = null;
+ String generatStub = null;
+ String generatSkeleton = null;
+ String skeletonPostfix = null;
+ String enumPrefix = null;
+
+ IProject project = file.getProject();
+ IResource resource = file;
+
+ try {
+ // Should project or file specific properties be used ?
+ String useProject1 = project.getPersistentProperty(new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_USEPROJECTSETTINGS));
+ String useProject2 = file.getPersistentProperty(new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_USEPROJECTSETTINGS));
+ if("true".equals(useProject1) || "true".equals(useProject2)) {
+ resource = project;
+ }
+ outputFolderCommon = resource.getPersistentProperty(new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_OUTPUT_COMMON));
+ outputFolderSkeleton = resource.getPersistentProperty(new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_OUTPUT_SKELETON));
+ outputFolderProxies = resource.getPersistentProperty(new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_OUTPUT_PROXIES));
+ outputFolderStubs = resource.getPersistentProperty(new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_OUTPUT_STUBS));
+ licenseHeader = resource.getPersistentProperty(new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_LICENSE));
+ generateProxy = resource.getPersistentProperty(new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_GENERATEPROXY));
+ generatStub = resource.getPersistentProperty(new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_GENERATESTUB));
+ generatSkeleton = resource.getPersistentProperty(new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_GENERATESKELETON));
+ skeletonPostfix = resource.getPersistentProperty(new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_SKELETONPOSTFIX));
+ enumPrefix = resource.getPersistentProperty(new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_ENUMPREFIX));
+ } catch (CoreException ce) {
+ System.err.println("Failed to get property for " + resource.getName());
+ }
+
+ // Set defaults in the case, where nothing was specified from the user.
+ if(outputFolderCommon == null) {
+ outputFolderCommon = store.getString(PreferenceConstants.P_OUTPUT_COMMON);
+ }
+ if(outputFolderProxies == null) {
+ outputFolderProxies = store.getString(PreferenceConstants.P_OUTPUT_PROXIES);
+ }
+ if(outputFolderStubs == null) {
+ outputFolderStubs = store.getString(PreferenceConstants.P_OUTPUT_STUBS);
+ }
+ if(outputFolderSkeleton == null) {
+ outputFolderSkeleton = store.getString(PreferenceConstants.P_OUTPUT_SKELETON);
+ }
+ if(skeletonPostfix == null) {
+ skeletonPostfix = store.getString(PreferenceConstants.P_SKELETONPOSTFIX);
+ }
+ if(enumPrefix == null) {
+ enumPrefix = store.getString(PreferenceConstants.P_ENUMPREFIX);
+ }
+ if(licenseHeader == null) {
+ licenseHeader = store.getString(PreferenceConstants.P_LICENSE);
+ }
+ if(generateProxy == null) {
+ generateProxy = "true";
+ }
+ if(generatStub == null) {
+ generatStub = "true";
+ }
+ if(generatSkeleton == null) {
+ generatSkeleton = "false";
+ }
+
+ // finally, store the properties for the code generator
+ instance.setPreference(PreferenceConstants.P_OUTPUT_COMMON, outputFolderCommon);
+ instance.setPreference(PreferenceConstants.P_OUTPUT_PROXIES, outputFolderProxies);
+ instance.setPreference(PreferenceConstants.P_OUTPUT_STUBS, outputFolderStubs);
+ instance.setPreference(PreferenceConstants.P_OUTPUT_SKELETON, outputFolderSkeleton);
+ instance.setPreference(PreferenceConstants.P_LICENSE, licenseHeader);
+ instance.setPreference(PreferenceConstants.P_GENERATEPROXY, generateProxy);
+ instance.setPreference(PreferenceConstants.P_GENERATESTUB, generatStub);
+ instance.setPreference(PreferenceConstants.P_GENERATESKELETON, generatSkeleton);
+ instance.setPreference(PreferenceConstants.P_SKELETONPOSTFIX, skeletonPostfix);
+ instance.setPreference(PreferenceConstants.P_ENUMPREFIX, enumPrefix);
+ }
+
}
diff --git a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/CommonAPIPreferencePage.java b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/CommonAPIPreferencePage.java
index 9afa5f6..e825c86 100644
--- a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/CommonAPIPreferencePage.java
+++ b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/CommonAPIPreferencePage.java
@@ -8,10 +8,16 @@
package org.genivi.commonapi.core.ui.preferences;
+import org.eclipse.cdt.ui.newui.MultiLineTextFieldEditor;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.genivi.commonapi.core.preferences.PreferenceConstants;
@@ -19,25 +25,27 @@ import org.genivi.commonapi.core.ui.CommonApiUiPlugin;
/**
* This class represents a preference page that is contributed to the
- * Preferences dialog. By subclassing <samp>FieldEditorOverlayPage</samp>, we
- * can use the field support built into JFace that allows us to create a page
- * that is small and knows how to save, restore and apply itself.
+ * Preferences dialog. By subclassing <samp>FieldEditorOverlayPage</samp>.
* <p>
- * This page is used to modify preferences only. They are stored in the preference store that belongs to the main plug-in class. That way,
- * preferences can be accessed directly via the preference store.
+ * This page is used to modify preferences. They are stored in the preference store that
+ * belongs to the main plug-in class.
*/
public class CommonAPIPreferencePage extends FieldEditorOverlayPage implements IWorkbenchPreferencePage
{
- private FieldEditor license = null;
+ private MultiLineTextFieldEditor license = null;
private FieldEditor proxyOutput = null;
private FieldEditor stubOutput = null;
-
+ private FieldEditor commonOutput = null;
+ private FieldEditor skeletonOutput = null;
+ private StringFieldEditor postFix = null;
+ private BooleanFieldEditor generatSkeleton = null;
+ private StringFieldEditor enumPrefix = null;
+
public CommonAPIPreferencePage()
{
super(GRID);
- setDescription("Preferences for CommonAPI");
}
/**
@@ -47,24 +55,54 @@ public class CommonAPIPreferencePage extends FieldEditorOverlayPage implements I
*/
public void createFieldEditors()
{
- license = new MultiLineTextField(PreferenceConstants.P_LICENSE, "The header to insert for all generated files", 60,
+ generatSkeleton = new BooleanFieldEditor(PreferenceConstants.P_GENERATESKELETON, "Generate skeleton code", getFieldEditorParent());
+ addField(generatSkeleton);
+
+ license = new MultiLineTextFieldEditor(PreferenceConstants.P_LICENSE, "The license header to be inserted in all generated files", 30,
getFieldEditorParent());
+ license.setLabelText(""); // need to set this parameter (seems to be a bug)
addField(license);
- proxyOutput = new StringFieldEditor(PreferenceConstants.P_OUTPUT_PROXIES, "Output directory for proxies inside project", 30,
+
+ // output directory definitions
+ commonOutput = new StringFieldEditor(PreferenceConstants.P_OUTPUT_COMMON, "Output directory for the common code", 30,
+ getFieldEditorParent());
+ addField(commonOutput);
+ proxyOutput = new StringFieldEditor(PreferenceConstants.P_OUTPUT_PROXIES, "Output directory for proxy code", 30,
getFieldEditorParent());
addField(proxyOutput);
- stubOutput = new StringFieldEditor(PreferenceConstants.P_OUTPUT_STUBS, "Output directory for stubs inside project", 30,
+ stubOutput = new StringFieldEditor(PreferenceConstants.P_OUTPUT_STUBS, "Output directory for stub code", 30,
+ getFieldEditorParent());
+ addField(stubOutput);
+ skeletonOutput = new StringFieldEditor(PreferenceConstants.P_OUTPUT_SKELETON, "Output directory for the skeleton code", 30,
getFieldEditorParent());
- addField(stubOutput);
+ addField(skeletonOutput);
+
+ postFix = new StringFieldEditor(PreferenceConstants.P_SKELETONPOSTFIX, "Postfix for skeleton filenames", 30, getFieldEditorParent());
+ addField(postFix);
+ postFix.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
+
+ enumPrefix = new StringFieldEditor(PreferenceConstants.P_ENUMPREFIX, "Prefix for enumeration literals", 30, getFieldEditorParent());
+ addField(enumPrefix);
}
@Override
protected void performDefaults()
{
- DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_OUTPUT_PROXIES,
+ DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATEPROXY, "true");
+ DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATESTUB, "true");
+ DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATESKELETON, "false");
+ DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_SKELETONPOSTFIX, "Default");
+ DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_ENUMPREFIX, "");
+
+ DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_OUTPUT_PROXIES,
PreferenceConstants.DEFAULT_OUTPUT);
DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE)
.put(PreferenceConstants.P_OUTPUT_STUBS, PreferenceConstants.DEFAULT_OUTPUT);
+ DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE)
+ .put(PreferenceConstants.P_OUTPUT_COMMON, PreferenceConstants.DEFAULT_OUTPUT);
+ DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE)
+ .put(PreferenceConstants.P_OUTPUT_SKELETON, PreferenceConstants.DEFAULT_OUTPUT);
+
super.performDefaults();
}
@@ -86,4 +124,32 @@ public class CommonAPIPreferencePage extends FieldEditorOverlayPage implements I
return CommonApiUiPlugin.getDefault().getPreferenceStore();
}
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ super.propertyChange(event);
+
+ String preferenceName = ((FieldEditor) event.getSource()).getPreferenceName();
+ // was the skeletonOutput field editor changed ?
+ if(preferenceName != null && preferenceName.equals(PreferenceConstants.P_SKELETONPOSTFIX)) {
+ boolean enableSkeletonCode = !event.getNewValue().toString().isEmpty();
+ generatSkeleton.setEnabled(enableSkeletonCode, getFieldEditorParent());
+
+ if(!enableSkeletonCode) {
+ // disable skeleton code generation
+ generatSkeleton.loadDefault();
+
+ IResource resource = (IResource) getElement();
+ try
+ {
+ resource.setPersistentProperty(new QualifiedName(getPageId(), PreferenceConstants.P_GENERATESKELETON), "false");
+ }
+ catch (CoreException e)
+ {
+ }
+ }
+ }
+ // will be disposed from FieldEditorPreferencePage !
+ }
+
+
}
diff --git a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/FieldEditorOverlayPage.java b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/FieldEditorOverlayPage.java
index aad4ba0..7a859df 100755
--- a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/FieldEditorOverlayPage.java
+++ b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/FieldEditorOverlayPage.java
@@ -13,7 +13,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -32,25 +31,17 @@ import org.eclipse.jface.preference.PreferenceNode;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.IWorkbenchPropertyPage;
import org.genivi.commonapi.core.preferences.PreferenceConstants;
public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage implements IWorkbenchPropertyPage
{
-
- /***
- * Name of resource property for the selection of workbench or project
- * settings
- ***/
- // public static final String USEPROJECTSETTINGS = "useProjectSettings"; //$NON-NLS-1$
-
private static final String FALSE = "false"; //$NON-NLS-1$
private static final String TRUE = "true"; //$NON-NLS-1$
@@ -61,19 +52,14 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
private Button checkboxproxy = null;
private Button checkboxstub = null;
+ private Button checkboxProject = null;
// Stores owning element of properties
private IAdaptable element;
- // Additional buttons for property pages
- private Button useWorkspaceSettingsButton, useProjectSettingsButton, configureButton;
-
// Overlay preference store for property pages
private IPreferenceStore overlayStore;
- // The image descriptor of this pages title image
- private ImageDescriptor image;
-
// Cache for page id
private String pageId;
@@ -114,7 +100,6 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
public FieldEditorOverlayPage(String title, ImageDescriptor image, int style)
{
super(title, image, style);
- this.image = image;
}
/**
@@ -167,11 +152,6 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
super.addField(editor);
}
- protected void addButton(Button button)
- {
- buttons.add(button);
- }
-
/**
* We override the createControl method. In case of property pages we create
* a new PropertyStore as local preference store. After all control have
@@ -209,7 +189,7 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
super.createControl(parent);
// Update state of all subclass controls
if (isPropertyPage())
- updateFieldEditors();
+ enableControls();
}
}
@@ -221,78 +201,9 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
*/
protected Control createContents(Composite parent)
{
- if (isPropertyPage())
- {
- createSelectionGroup(parent);
- updateFieldEditors();
- }
- else
- createButtons(parent);
- return super.createContents(parent);
- }
-
- /**
- * Creates and initializes a selection group with two choice buttons and one
- * push button.
- *
- * @param parent
- * - the parent composite
- */
- private void createSelectionGroup(Composite parent)
- {
- Composite comp = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- comp.setLayout(layout);
- comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Composite radioGroup = new Composite(comp, SWT.NONE);
- radioGroup.setLayout(new GridLayout());
- radioGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- String msg = Messages.getString("OverlayPage.Use_Workspace_Settings");
- if (element instanceof IFile)
- msg = Messages.getString("OverlayPage.Use_Project_Settings");
- useWorkspaceSettingsButton = createRadioButton(radioGroup, msg); //$NON-NLS-1$
- msg = Messages.getString("OverlayPage.Use_Project_Settings");
- if (element instanceof IFile)
- msg = Messages.getString("OverlayPage.Use_File_Settings");
- useProjectSettingsButton = createRadioButton(radioGroup, msg); //$NON-NLS-1$
- configureButton = new Button(comp, SWT.PUSH);
- msg = Messages.getString("OverlayPage.Configure_Workspace_Settings");
- if (element instanceof IFile)
- msg = Messages.getString("OverlayPage.Configure_Project_Settings");
- configureButton.setText(msg); //$NON-NLS-1$
- configureButton.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent e)
- {
- configureWorkspaceSettings();
- }
- });
createButtons(parent);
- // Set workspace/project radio buttons
- try
- {
- String use = ((IResource) element).getPersistentProperty(new QualifiedName(pageId, PreferenceConstants.USEPROJECTSETTINGS));
- if (use == null)
- {
- ((IResource) element).setPersistentProperty(new QualifiedName(pageId, PreferenceConstants.USEPROJECTSETTINGS),
- Boolean.FALSE.toString());
- use = FALSE;
- }
- if (TRUE.equals(use))
- {
- useProjectSettingsButton.setSelection(true);
- configureButton.setEnabled(false);
- }
- else
- useWorkspaceSettingsButton.setSelection(true);
- }
- catch (CoreException e)
- {
- useWorkspaceSettingsButton.setSelection(true);
- }
+ enableControls();
+ return super.createContents(parent);
}
public void createButtons(Composite parent)
@@ -306,103 +217,70 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
Composite radioGroup = new Composite(comp, SWT.BOTTOM);
radioGroup.setLayout(new GridLayout());
radioGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Group settingsGroup = new Group(radioGroup, SWT.SHADOW_IN);
+ //settingsGroup.setText("Scope of properties: ");
+ settingsGroup.setLayout(new GridLayout());
+ settingsGroup.setLayoutData(new GridData());
+
+ checkboxProject = new Button(settingsGroup, SWT.CHECK);
+ checkboxProject.setText("Enable project specific settings");
+
checkboxproxy = new Button(radioGroup, SWT.CHECK);
checkboxproxy.setText(Messages.getString("OverlayPage.Generate_Proxy"));
checkboxstub = new Button(radioGroup, SWT.CHECK);
checkboxstub.setText(Messages.getString("OverlayPage.Generate_Stub"));
+
+ buttons.add(checkboxproxy);
+ buttons.add(checkboxproxy);
+ buttons.add(checkboxProject);
+
+ String genProxy = TRUE;
+ String genStub = TRUE;
+ String project = FALSE;
+
if (isPropertyPage())
{
+ // get values from the persistent properties of theses resources and set the button states
try
{
- String use = ((IResource) getElement())
+ genProxy = ((IResource) getElement())
.getPersistentProperty(new QualifiedName(pageId, PreferenceConstants.P_GENERATEPROXY));
- if (TRUE.equals(use))
- checkboxproxy.setSelection(true);
+ genStub = ((IResource) getElement())
+ .getPersistentProperty(new QualifiedName(pageId, PreferenceConstants.P_GENERATESTUB));
+ project = ((IResource) getElement())
+ .getPersistentProperty(new QualifiedName(pageId, PreferenceConstants.P_USEPROJECTSETTINGS));
}
catch (CoreException e)
{
- checkboxproxy.setSelection(true);
+ // failed to access this resource...
}
- try
- {
- String use = ((IResource) getElement())
- .getPersistentProperty(new QualifiedName(pageId, PreferenceConstants.P_GENERATESTUB));
- if (TRUE.equals(use))
- checkboxstub.setSelection(true);
- else if (!checkboxproxy.getSelection())
- {
- checkboxproxy.setSelection(true);
- checkboxstub.setSelection(true);
- }
+ // Not all properties are set for this resource
+ if(genProxy == null) {
+ genProxy = TRUE;
}
- catch (CoreException e)
- {
- checkboxstub.setSelection(true);
+ if(genStub == null) {
+ genStub = TRUE;
}
- }
- else
- {
- String use = DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).get(PreferenceConstants.P_GENERATEPROXY, "");
- use = InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).get(PreferenceConstants.P_GENERATEPROXY, use);
- if (TRUE.equals(use))
- checkboxproxy.setSelection(true);
- use = DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).get(PreferenceConstants.P_GENERATESTUB, "");
- use = InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).get(PreferenceConstants.P_GENERATESTUB, use);
- if (TRUE.equals(use))
- checkboxstub.setSelection(true);
- if (!checkboxproxy.getSelection() && !checkboxstub.getSelection())
- {
- checkboxproxy.setSelection(true);
- checkboxstub.setSelection(true);
+ if(project == null) {
+ project = FALSE;
}
}
- checkboxproxy.addSelectionListener(new SelectionAdapter()
- {
-
- @Override
- public void widgetSelected(SelectionEvent e)
- {
- if (!checkboxproxy.getSelection() && !checkboxstub.getSelection())
- checkboxstub.setSelection(true);
- }
-
- });
- checkboxstub.addSelectionListener(new SelectionAdapter()
+ else // is a preference page
{
+ genProxy = DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).get(PreferenceConstants.P_GENERATEPROXY, "");
+ genProxy = InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).get(PreferenceConstants.P_GENERATEPROXY, genProxy);
- @Override
- public void widgetSelected(SelectionEvent e)
- {
- if (!checkboxproxy.getSelection() && !checkboxstub.getSelection())
- checkboxproxy.setSelection(true);
- }
- });
- addButton(checkboxproxy);
- addButton(checkboxstub);
- }
+ genStub = DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).get(PreferenceConstants.P_GENERATESTUB, "");
+ genStub = InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).get(PreferenceConstants.P_GENERATESTUB, genStub);
- /**
- * Convenience method creating a radio button
- *
- * @param parent
- * - the parent composite
- * @param label
- * - the button label
- * @return - the new button
- */
- private Button createRadioButton(Composite parent, String label)
- {
- final Button button = new Button(parent, SWT.RADIO);
- button.setText(label);
- button.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent e)
- {
- configureButton.setEnabled(button == useWorkspaceSettingsButton);
- updateFieldEditors();
- }
- });
- return button;
+ project = DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).get(PreferenceConstants.P_USEPROJECTSETTINGS, "");
+ project = InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).get(PreferenceConstants.P_USEPROJECTSETTINGS, project);
+ }
+ // set the selection state of the buttons
+ checkboxproxy.setSelection(TRUE.equals(genProxy));
+ checkboxstub.setSelection(TRUE.equals(genStub));
+ checkboxProject.setSelection(TRUE.equals(project));
}
/**
@@ -413,40 +291,27 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
*/
public IPreferenceStore getPreferenceStore()
{
- if (isPropertyPage())
+ if (isPropertyPage()) {
return overlayStore;
+ }
return super.getPreferenceStore();
}
- /*
- * Enables or disables the field editors and buttons of this page
- */
- private void updateFieldEditors()
- {
- // We iterate through all field editors
- boolean enabled = useProjectSettingsButton.getSelection();
- updateFieldEditors(enabled);
- }
-
/**
- * Enables or disables the field editors and buttons of this page Subclasses
- * may override.
- *
- * @param enabled
- * - true if enabled
+ * Enables the field editors and buttons of this page
*/
- protected void updateFieldEditors(boolean enabled)
+ protected void enableControls()
{
Composite parent = getFieldEditorParent();
Iterator<FieldEditor> it = editors.iterator();
while (it.hasNext())
{
FieldEditor editor = it.next();
- editor.setEnabled(enabled, parent);
+ editor.setEnabled(true, parent);
}
for (Button button : buttons)
{
- button.setEnabled(enabled);
+ button.setEnabled(true);
}
}
@@ -460,79 +325,46 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
public boolean performOk()
{
boolean result = super.performOk();
+ String genProxy = (checkboxproxy.getSelection()) ? TRUE : FALSE;
+ String genStub = (checkboxstub.getSelection()) ? TRUE : FALSE;
+ String project = (checkboxProject.getSelection()) ? TRUE : FALSE;
+
if (result && isPropertyPage())
{
- // Save state of radio buttons in project properties
IResource resource = (IResource) getElement();
try
{
- String value = (useProjectSettingsButton.getSelection()) ? TRUE : FALSE;
- resource.setPersistentProperty(new QualifiedName(pageId, PreferenceConstants.USEPROJECTSETTINGS), value);
- value = (checkboxproxy.getSelection()) ? TRUE : FALSE;
- resource.setPersistentProperty(new QualifiedName(pageId, PreferenceConstants.P_GENERATEPROXY), value);
- value = (checkboxstub.getSelection()) ? TRUE : FALSE;
- resource.setPersistentProperty(new QualifiedName(pageId, PreferenceConstants.P_GENERATESTUB), value);
+ resource.setPersistentProperty(new QualifiedName(pageId, PreferenceConstants.P_USEPROJECTSETTINGS), project);
+ resource.setPersistentProperty(new QualifiedName(pageId, PreferenceConstants.P_GENERATEPROXY), genProxy);
+ resource.setPersistentProperty(new QualifiedName(pageId, PreferenceConstants.P_GENERATESTUB), genStub);
}
catch (CoreException e)
{
+ result = false;
}
}
else if (result)
{
- String value = (checkboxproxy.getSelection()) ? TRUE : FALSE;
- InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATEPROXY, value);
- value = (checkboxstub.getSelection()) ? TRUE : FALSE;
- InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATESTUB, value);
+ InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATEPROXY, genProxy);
+ InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATESTUB, genStub);
}
return result;
}
/**
- * We override the performDefaults method. In case of property pages we
- * switch back to the workspace settings and disable the field editors.
- *
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
+ * In case of property page set checkboxes to true
+ */
protected void performDefaults()
{
- if (isPropertyPage())
- {
- useWorkspaceSettingsButton.setSelection(true);
- useProjectSettingsButton.setSelection(false);
- configureButton.setEnabled(true);
- checkboxproxy.setSelection(true);
- checkboxstub.setSelection(true);
- updateFieldEditors();
- }
- super.performDefaults();
- }
-
- /**
- * Creates a new preferences page and opens it
- *
- * @see com.bdaum.SpellChecker.preferences.SpellCheckerPreferencePage#configureWorkspaceSettings()
- */
- protected void configureWorkspaceSettings()
- {
- try
- {
- // create a new instance of the current class
- FieldEditorOverlayPage page = (FieldEditorOverlayPage) this.getClass().newInstance();
- page.setTitle(getTitle());
- if (element instanceof IFile)
- page.setElement(((IFile) element).getProject());
- page.setImageDescriptor(image);
- // and show it
- showPreferencePage(pageId, page);
- }
- catch (InstantiationException e)
- {
- e.printStackTrace();
- }
- catch (IllegalAccessException e)
- {
- e.printStackTrace();
- }
+ enableControls();
+ checkboxproxy.setSelection(true);
+ checkboxstub.setSelection(true);
+ checkboxProject.setSelection(false);
+ InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATEPROXY, "true");
+ InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATESTUB, "true");
+ InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_USEPROJECTSETTINGS, "false");
+
+ super.performDefaults();
}
/**
diff --git a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/Messages.properties b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/Messages.properties
index 673a828..081c072 100755
--- a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/Messages.properties
+++ b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/Messages.properties
@@ -1,9 +1,9 @@
-OverlayPage.Use_Workspace_Settings=Use workspace settings
-OverlayPage.Use_Project_Settings=Use project settings
-OverlayPage.Configure_Workspace_Settings=Configure Workspace Settings ...
-OverlayPage.Configure_Project_Settings=Configure Project Settings ...
+
+
+
PropertyStore.Cannot_write_resource_property=Cannot write resource property
PropertyStore.Cannot_read_resource_property=Cannot read resource property
-OverlayPage.Generate_Proxy=Generate with ProxyGenerator
-OverlayPage.Generate_Stub=Generate with StubGenerator
-OverlayPage.Use_File_Settings=Use file settings \ No newline at end of file
+
+OverlayPage.Generate_Proxy=Generate proxy code
+OverlayPage.Generate_Stub=Generate stub code
+
diff --git a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/MultiLineTextField.java b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/MultiLineTextField.java
deleted file mode 100644
index 4a91157..0000000
--- a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/MultiLineTextField.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 BMW Group Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de) 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/.
- */
-
-package org.genivi.commonapi.core.ui.preferences;
-
-import org.eclipse.cdt.ui.newui.MultiLineTextFieldEditor;
-import org.eclipse.swt.widgets.Composite;
-
-public class MultiLineTextField extends MultiLineTextFieldEditor {
-
- public MultiLineTextField() {
- super();
- }
-
- public MultiLineTextField(String name, String labelText, Composite parent) {
- super(name, labelText, parent);
- }
-
- public MultiLineTextField(String name, String labelText, int width, Composite parent) {
- super(name, labelText, width, parent);
- }
-
- public MultiLineTextField(String name, String labelText, int width, int strategy, Composite parent) {
- super(name, labelText, width, strategy, parent);
- }
-
- @Override
- public void setEnabled(boolean enabled, Composite parent) {
- // super.setEnabled(enabled, parent);
- getTextControl(parent).setEnabled(enabled);
- }
-} \ No newline at end of file
diff --git a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/PreferenceInitializer.java b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/PreferenceInitializer.java
index eea41a1..0d33ecd 100644
--- a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/PreferenceInitializer.java
+++ b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/PreferenceInitializer.java
@@ -26,12 +26,16 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
*/
public void initializeDefaultPreferences() {
IPreferenceStore store = CommonApiUiPlugin.getDefault().getPreferenceStore();
- store.setDefault(PreferenceConstants.USEPROJECTSETTINGS, true);
store.setDefault(PreferenceConstants.P_LICENSE, PreferenceConstants.DEFAULT_LICENSE);
store.setDefault(PreferenceConstants.P_OUTPUT_PROXIES, PreferenceConstants.DEFAULT_OUTPUT);
store.setDefault(PreferenceConstants.P_OUTPUT_STUBS, PreferenceConstants.DEFAULT_OUTPUT);
+ store.setDefault(PreferenceConstants.P_OUTPUT_COMMON, PreferenceConstants.DEFAULT_OUTPUT);
+ store.setDefault(PreferenceConstants.P_OUTPUT_SKELETON, PreferenceConstants.DEFAULT_OUTPUT);
store.setDefault(PreferenceConstants.P_GENERATEPROXY, true);
store.setDefault(PreferenceConstants.P_GENERATESTUB, true);
+ store.setDefault(PreferenceConstants.P_GENERATESKELETON, false);
+ store.setDefault(PreferenceConstants.P_SKELETONPOSTFIX, PreferenceConstants.DEFAULT_SKELETONPOSTFIX);
+ store.setDefault(PreferenceConstants.P_USEPROJECTSETTINGS, false);
}
}
diff --git a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/PropertyStore.java b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/PropertyStore.java
index 180bfbd..e7d4d2d 100755
--- a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/PropertyStore.java
+++ b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/PropertyStore.java
@@ -16,8 +16,6 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceStore;
-import org.genivi.commonapi.core.preferences.FPreferences;
-import org.genivi.commonapi.core.preferences.PreferenceConstants;
public class PropertyStore extends PreferenceStore {
@@ -31,8 +29,6 @@ public class PropertyStore extends PreferenceStore {
this.resource = resource;
this.workbenchStore = workbenchStore;
this.pageId = pageId;
- FPreferences pref = FPreferences.getInstance();
- pref.addPreferences(resource);
}
/*** Write modified values back to properties ***/
@@ -42,13 +38,8 @@ public class PropertyStore extends PreferenceStore {
* @see org.eclipse.jface.preference.IPersistentPreferenceStore#save()
*/
public void save() throws IOException {
- try {
- if (getProperty(PreferenceConstants.USEPROJECTSETTINGS).equals(Boolean.TRUE.toString()))
- writeProperties();
- } catch (CoreException e) {
- throw new IOException(Messages.getString("PropertyStore.Cannot_read_resource_property")
- + PreferenceConstants.USEPROJECTSETTINGS); //$NON-NLS-1$
- }
+
+ writeProperties();
}
/*
diff --git a/org.genivi.commonapi.core.updatesite/.gitignore b/org.genivi.commonapi.core.updatesite/.gitignore
new file mode 100644
index 0000000..873d37a
--- /dev/null
+++ b/org.genivi.commonapi.core.updatesite/.gitignore
@@ -0,0 +1,2 @@
+*~
+/target
diff --git a/org.genivi.commonapi.parent.releng/.project b/org.genivi.commonapi.core.updatesite/.project
index 529d3bb..220eba6 100644
--- a/org.genivi.commonapi.parent.releng/.project
+++ b/org.genivi.commonapi.core.updatesite/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.genivi.commonapi.parent.releng</name>
+ <name>org.genivi.commonapi.core.updatesite</name>
<comment></comment>
<projects>
</projects>
diff --git a/org.genivi.commonapi.core.updatesite/.settings/org.eclipse.core.resources.prefs b/org.genivi.commonapi.core.updatesite/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.genivi.commonapi.core.updatesite/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.genivi.commonapi.core.updatesite/.settings/org.eclipse.core.runtime.prefs b/org.genivi.commonapi.core.updatesite/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/org.genivi.commonapi.core.updatesite/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.genivi.commonapi.core.updatesite/category.xml b/org.genivi.commonapi.core.updatesite/category.xml
new file mode 100644
index 0000000..33b8400
--- /dev/null
+++ b/org.genivi.commonapi.core.updatesite/category.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<site>
+ <feature url="features/org.genivi.commonapi.core.validator.feature_3.1.1.qualifier.jar" id="org.genivi.commonapi.core.validator.feature" version="3.1.1.qualifier">
+ <category name="GENIVI CommonAPI"/>
+ </feature>
+ <feature url="features/org.genivi.commonapi.core.feature_3.1.1.qualifier.jar" id="org.genivi.commonapi.core.feature" version="3.1.1.qualifier">
+ <category name="GENIVI CommonAPI"/>
+ </feature>
+ <category-def name="GENIVI CommonAPI" label="GENIVI CommonAPI Generators">
+ <description>
+ The basic generator for all CommonAPI compliant middle ware libraries. Creates all source code that needs to adhere the specification. Any specific middle ware code is generated by separate generators, in separate files.
+ </description>
+ </category-def>
+</site>
diff --git a/org.genivi.commonapi.core.updatesite/pom.xml b/org.genivi.commonapi.core.updatesite/pom.xml
new file mode 100644
index 0000000..02c1dd5
--- /dev/null
+++ b/org.genivi.commonapi.core.updatesite/pom.xml
@@ -0,0 +1,13 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commonapi</groupId>
+ <artifactId>org.genivi.commonapi.core.updatesite</artifactId>
+ <packaging>eclipse-repository</packaging>
+ <parent>
+ <groupId>commonapi</groupId>
+ <artifactId>org.genivi.commonapi.core.releng</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
+ <relativePath>../org.genivi.commonapi.core.releng</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/org.genivi.commonapi.core.validator.feature/.gitignore b/org.genivi.commonapi.core.validator.feature/.gitignore
index ea8c4bf..873d37a 100644
--- a/org.genivi.commonapi.core.validator.feature/.gitignore
+++ b/org.genivi.commonapi.core.validator.feature/.gitignore
@@ -1 +1,2 @@
+*~
/target
diff --git a/org.genivi.commonapi.core.validator.feature/.settings/org.eclipse.core.resources.prefs b/org.genivi.commonapi.core.validator.feature/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.genivi.commonapi.core.validator.feature/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.genivi.commonapi.core.validator.feature/.settings/org.eclipse.core.runtime.prefs b/org.genivi.commonapi.core.validator.feature/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/org.genivi.commonapi.core.validator.feature/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.genivi.commonapi.core.validator.feature/build.properties b/org.genivi.commonapi.core.validator.feature/build.properties
index a4bee29..0485b70 100644
--- a/org.genivi.commonapi.core.validator.feature/build.properties
+++ b/org.genivi.commonapi.core.validator.feature/build.properties
@@ -1,3 +1,4 @@
+javacDefaultEncoding.. = UTF-8
bin.includes = feature.xml,\
feature.properties,\
license.html \ No newline at end of file
diff --git a/org.genivi.commonapi.core.validator.feature/feature.xml b/org.genivi.commonapi.core.validator.feature/feature.xml
index 586ce8c..a2fb5fe 100644
--- a/org.genivi.commonapi.core.validator.feature/feature.xml
+++ b/org.genivi.commonapi.core.validator.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.genivi.commonapi.core.validator.feature"
label="%featureName"
- version="2.1.6.qualifier"
+ version="3.1.1.qualifier"
provider-name="%providerName">
<copyright>
@@ -14,7 +14,7 @@
</license>
<requires>
- <import plugin="org.genivi.commonapi.core.ui" version="2.1.4" match="greaterOrEqual"/>
+ <import plugin="org.genivi.commonapi.core.ui" version="3.1.1" match="compatible"/>
</requires>
<plugin
diff --git a/org.genivi.commonapi.core.validator.feature/pom.xml b/org.genivi.commonapi.core.validator.feature/pom.xml
index c47055d..bf2da36 100644
--- a/org.genivi.commonapi.core.validator.feature/pom.xml
+++ b/org.genivi.commonapi.core.validator.feature/pom.xml
@@ -6,8 +6,8 @@
<packaging>eclipse-feature</packaging>
<parent>
<groupId>commonapi</groupId>
- <artifactId>org.genivi.commonapi.releng</artifactId>
- <version>2.1.6-SNAPSHOT</version>
- <relativePath>../org.genivi.commonapi.releng</relativePath>
+ <artifactId>org.genivi.commonapi.core.releng</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
+ <relativePath>../org.genivi.commonapi.core.releng</relativePath>
</parent>
-</project> \ No newline at end of file
+</project>
diff --git a/org.genivi.commonapi.core.validator/.classpath b/org.genivi.commonapi.core.validator/.classpath
index ad32c83..1fa3e68 100644
--- a/org.genivi.commonapi.core.validator/.classpath
+++ b/org.genivi.commonapi.core.validator/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.genivi.commonapi.core.validator/.gitignore b/org.genivi.commonapi.core.validator/.gitignore
index ea8c4bf..ad19da6 100644
--- a/org.genivi.commonapi.core.validator/.gitignore
+++ b/org.genivi.commonapi.core.validator/.gitignore
@@ -1 +1,3 @@
+*~
+/bin
/target
diff --git a/org.genivi.commonapi.core.validator/.settings/org.eclipse.core.resources.prefs b/org.genivi.commonapi.core.validator/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.genivi.commonapi.core.validator/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.genivi.commonapi.core.validator/.settings/org.eclipse.core.runtime.prefs b/org.genivi.commonapi.core.validator/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/org.genivi.commonapi.core.validator/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.genivi.commonapi.core.validator/.settings/org.eclipse.jdt.core.prefs b/org.genivi.commonapi.core.validator/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index f42de36..0000000
--- a/org.genivi.commonapi.core.validator/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.compliance=1.7
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.7
diff --git a/org.genivi.commonapi.core.validator/META-INF/MANIFEST.MF b/org.genivi.commonapi.core.validator/META-INF/MANIFEST.MF
index bef7e61..880487c 100644
--- a/org.genivi.commonapi.core.validator/META-INF/MANIFEST.MF
+++ b/org.genivi.commonapi.core.validator/META-INF/MANIFEST.MF
@@ -3,25 +3,15 @@ Bundle-ManifestVersion: 2
Bundle-Name: General
Bundle-Vendor: BMW AG
Bundle-SymbolicName: org.genivi.commonapi.core.validator;singleton:=true
-Bundle-Version: 2.1.6.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Version: 3.1.1.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.ui,
org.eclipse.core.expressions;bundle-version="3.4.400",
org.eclipse.core.resources,
org.eclipse.core.runtime,
- org.eclipse.xtext.builder;bundle-version="2.4.0",
- org.eclipse.xtext.generator;bundle-version="2.4.0",
- org.eclipse.xtext.ui;bundle-version="2.4.0",
- org.eclipse.xtext.ui.ecore;bundle-version="2.4.0",
com.google.inject;bundle-version="3.0.0",
- org.genivi.commonapi.core;bundle-version="2.1.4",
- org.genivi.commonapi.core.ui;bundle-version="2.1.4",
- org.franca.core.dsl;bundle-version="0.8.9",
- org.eclipse.xtext;bundle-version="2.4.3",
- org.eclipse.ui;bundle-version="3.104.0"
-Import-Package: org.eclipse.core.resources,
- org.eclipse.core.runtime;version="3.4.0",
- org.eclipse.jface.preference,
- org.genivi.commonapi.core.ui,
- org.osgi.framework;version="1.7.0"
+ org.genivi.commonapi.core;bundle-version="3.1.1",
+ org.genivi.commonapi.core.ui;bundle-version="3.1.1",
+ org.franca.core.dsl;bundle-version="[0.9.0,0.10.0)";visibility:=reexport,
+ org.eclipse.xtext;bundle-version="[2.7.0,3.0.0)";visibility:=reexport
Export-Package: org.genivi.commonapi.core.validator
diff --git a/org.genivi.commonapi.core.validator/build.properties b/org.genivi.commonapi.core.validator/build.properties
index e9863e2..66927d0 100644
--- a/org.genivi.commonapi.core.validator/build.properties
+++ b/org.genivi.commonapi.core.validator/build.properties
@@ -1,3 +1,4 @@
+javacDefaultEncoding.. = UTF-8
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
diff --git a/org.genivi.commonapi.core.validator/plugin.xml b/org.genivi.commonapi.core.validator/plugin.xml
index 31886e4..bc378fe 100644
--- a/org.genivi.commonapi.core.validator/plugin.xml
+++ b/org.genivi.commonapi.core.validator/plugin.xml
@@ -4,7 +4,7 @@
<extension
point="org.franca.core.dsl.francaValidator">
<validator
- class="org.genivi.commonapi.core.validator.ValidatorCore"
+ class="org.genivi.commonapi.core.validator.ValidatorCoreUi"
mode="FAST"
name="ValidatorCore">
</validator>
diff --git a/org.genivi.commonapi.core.validator/pom.xml b/org.genivi.commonapi.core.validator/pom.xml
index d3ccbcd..431a2ec 100644
--- a/org.genivi.commonapi.core.validator/pom.xml
+++ b/org.genivi.commonapi.core.validator/pom.xml
@@ -6,8 +6,8 @@
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>commonapi</groupId>
- <artifactId>org.genivi.commonapi.releng</artifactId>
- <version>2.1.6-SNAPSHOT</version>
- <relativePath>../org.genivi.commonapi.releng</relativePath>
+ <artifactId>org.genivi.commonapi.core.releng</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
+ <relativePath>../org.genivi.commonapi.core.releng</relativePath>
</parent>
-</project> \ No newline at end of file
+</project>
diff --git a/org.genivi.commonapi.core.validator/src/org/genivi/commonapi/core/validator/ValidatorCoreUi.java b/org.genivi.commonapi.core.validator/src/org/genivi/commonapi/core/validator/ValidatorCoreUi.java
new file mode 100644
index 0000000..4c288ed
--- /dev/null
+++ b/org.genivi.commonapi.core.validator/src/org/genivi/commonapi/core/validator/ValidatorCoreUi.java
@@ -0,0 +1,207 @@
+/* Copyright (C) 2013 BMW Group
+ * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+package org.genivi.commonapi.core.validator;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map.Entry;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.xtext.validation.ValidationMessageAcceptor;
+import org.franca.core.franca.FModel;
+import org.franca.core.franca.FrancaPackage;
+import org.franca.core.franca.Import;
+import org.genivi.commonapi.core.verification.ValidatorCore;
+import org.genivi.commonapi.core.ui.CommonApiUiPlugin;
+import org.genivi.commonapi.core.validator.preferencepage.ValidatorCorePreferencesPage;
+
+/**
+ * This validator is automatically triggered from the XText editor.
+ */
+public class ValidatorCoreUi extends ValidatorCore {
+
+ private HashMap<String, HashSet<String>> importList = new HashMap<String, HashSet<String>>();
+ private Boolean hasChanged = false;
+
+
+ @Override
+ public void validateModel(FModel model,
+ ValidationMessageAcceptor messageAcceptor) {
+ if (!isValidatorEnabled()) {
+ return;
+ }
+ // call the super validation method
+ super.validateModel(model, messageAcceptor);
+
+ Resource res = model.eResource();
+ final Path platformPath = new Path(res.getURI().toPlatformString(true));
+ final IFile file = ResourcesPlugin.getWorkspace().getRoot()
+ .getFile(platformPath);
+ IPath filePath = file.getLocation();
+ String cwd = filePath.removeLastSegments(1).toString();
+ validateImport(model, messageAcceptor, file, filePath, cwd);
+ }
+
+ protected void validateImport(FModel model,
+ ValidationMessageAcceptor messageAcceptor, final IFile file,
+ IPath filePath, String cwd) {
+ HashSet<String> importedFiles = new HashSet<String>();
+ ArrayList<String> importUriAndNamesspace = new ArrayList<String>();
+ for (Import fImport : model.getImports()) {
+
+ if (importUriAndNamesspace.contains(fImport.getImportURI() + ","
+ + fImport.getImportedNamespace()))
+ acceptWarning("Multiple times imported!", fImport,
+ FrancaPackage.Literals.IMPORT__IMPORT_URI, -1,
+ messageAcceptor);
+ if (fImport.getImportURI().equals(file.getName())) {
+ acceptError("Class may not import itself!", fImport,
+ FrancaPackage.Literals.IMPORT__IMPORT_URI, -1,
+ messageAcceptor);
+ } else {
+ Path absoluteImportPath = new Path(fImport.getImportURI());
+ if (!absoluteImportPath.isAbsolute()) {
+ absoluteImportPath = new Path(cwd + "/"
+ + fImport.getImportURI());
+ importedFiles.add(absoluteImportPath.toString());
+ } else {
+ importedFiles.add(absoluteImportPath.toString()
+ .replaceFirst(absoluteImportPath.getDevice() + "/",
+ ""));
+ }
+
+ }
+ importUriAndNamesspace.add(fImport.getImportURI() + ","
+ + fImport.getImportedNamespace());
+ }
+ importUriAndNamesspace.clear();
+ importList.put(filePath.toString(), importedFiles);
+
+ ArrayList<String> start = new ArrayList<String>();
+ try {
+ importList = buildImportList(importList);
+ } catch (NullPointerException e) {
+ }
+ start.add(filePath.toString());
+ for (Import fImport : model.getImports()) {
+ Path importPath = new Path(fImport.getImportURI());
+ if (importPath.isAbsolute()) {
+ findCyclicImports(
+ importPath.toString().replaceFirst(
+ importPath.getDevice() + "/", ""),
+ filePath.toString(), start, fImport, messageAcceptor);
+ } else {
+ importPath = new Path(cwd + "/" + fImport.getImportURI());
+ findCyclicImports(importPath.toString(), filePath.toString(),
+ start, fImport, messageAcceptor);
+ }
+ }
+ start.clear();
+ }
+
+ private HashMap<String, HashSet<String>> buildImportList(
+ HashMap<String, HashSet<String>> rekImportList) {
+ HashMap<String, HashSet<String>> helpMap = new HashMap<String, HashSet<String>>();
+ for (Entry<String, HashSet<String>> entry : rekImportList.entrySet()) {
+ for (String importedPath : entry.getValue()) {
+ if (!rekImportList.containsKey(importedPath)) {
+ hasChanged = true;
+ HashSet<String> importedFIDL = new HashSet<String>();
+ EObject resource = null;
+ resource = buildResource(
+ importedPath.substring(
+ importedPath.lastIndexOf("/") + 1,
+ importedPath.length()),
+ "file:/"
+ + importedPath.substring(0,
+ importedPath.lastIndexOf("/") + 1));
+ for (EObject imp : resource.eContents()) {
+ if (imp instanceof Import) {
+ Path importImportedPath = new Path(
+ ((Import) imp).getImportURI());
+ if (importImportedPath.isAbsolute()) {
+ importedFIDL.add(importImportedPath.toString()
+ .replaceFirst(
+ importImportedPath.getDevice()
+ + "/", ""));
+ } else {
+ importImportedPath = new Path(
+ importedPath.substring(0,
+ importedPath.lastIndexOf("/"))
+ + "/"
+ + ((Import) imp).getImportURI());
+ importedFIDL.add(importImportedPath.toString());
+ }
+ }
+ }
+ helpMap.put(importedPath, importedFIDL);
+ }
+ }
+ }
+ if (hasChanged) {
+ hasChanged = false;
+ helpMap.putAll(rekImportList);
+ return buildImportList(helpMap);
+ } else {
+ return rekImportList;
+ }
+ }
+
+
+ protected void findCyclicImports(String filePath, String prevFilePath,
+ ArrayList<String> cyclicList, Import imp,
+ ValidationMessageAcceptor messageAcceptor) {
+ if (cyclicList.contains(filePath)) {
+ String errorString = "";
+ for (String impString : cyclicList) {
+ errorString = errorString + impString + "->";
+ }
+ if (prevFilePath.equals(filePath)) {
+ if (cyclicList.size() > 1)
+ acceptError("Last file imports itself!: " + errorString
+ + filePath, imp,
+ FrancaPackage.Literals.IMPORT__IMPORT_URI, -1,
+ messageAcceptor);
+ return;
+ } else {
+ acceptError("Cyclic Imports: " + errorString + filePath, imp,
+ FrancaPackage.Literals.IMPORT__IMPORT_URI, -1,
+ messageAcceptor);
+ return;
+ }
+ } else {
+ cyclicList.add(filePath);
+ if (importList.containsKey(filePath)) {
+ for (String importPath : importList.get(filePath)) {
+ findCyclicImports(importPath, filePath, cyclicList, imp,
+ messageAcceptor);
+ }
+ }
+ cyclicList.remove(cyclicList.size() - 1);
+ }
+ }
+
+
+ /**
+ * Check whether the validation is enabled in the eclipse preferences
+ * @return
+ */
+ public boolean isValidatorEnabled() {
+
+ IPreferenceStore prefs = CommonApiUiPlugin.getValidatorPreferences();
+ return prefs != null && prefs.getBoolean(ValidatorCorePreferencesPage.ENABLED_CORE_VALIDATOR);
+ }
+
+}
diff --git a/org.genivi.commonapi.core.verification/.gitignore b/org.genivi.commonapi.core.verification/.gitignore
index 4df666e..2053e13 100644
--- a/org.genivi.commonapi.core.verification/.gitignore
+++ b/org.genivi.commonapi.core.verification/.gitignore
@@ -1,21 +1,8 @@
+*~
*.o
/.deps
-/.libs
/.settings
-/autom4te.cache
-/build-aux
/.cproject
/.project
-/.autotools
-/aclocal.m4
-/config.log
-/config.status
-/configure
-/DynamicLoadingVerification.conf
-/CommunicationVerification.conf
-/libtool
-/Makefile
-/Makefile.in
-/Build (GNU)
-/src/DynamicLoadingVerification.cpp
-/src/CommunicationVerification.cpp
+/build
+/src-gen
diff --git a/org.genivi.commonapi.core.verification/AUTHORS b/org.genivi.commonapi.core.verification/AUTHORS
deleted file mode 100644
index 2708c9d..0000000
--- a/org.genivi.commonapi.core.verification/AUTHORS
+++ /dev/null
@@ -1 +0,0 @@
-BMW Group \ No newline at end of file
diff --git a/org.genivi.commonapi.core.verification/CMakeLists.txt b/org.genivi.commonapi.core.verification/CMakeLists.txt
new file mode 100644
index 0000000..79bb784
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/CMakeLists.txt
@@ -0,0 +1,383 @@
+cmake_minimum_required (VERSION 2.8.1)
+
+PROJECT(capi_verification_tests)
+
+message("Project name: ${PROJECT_NAME}")
+
+##############################################################################
+
+# create the commandline variables:
+OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version of CommonAPI" ON)
+message("USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}")
+
+SET(CMAKE_GLUECODE_DBUS_NAME "na" CACHE STRING "The cmake name of the gluecode library without cmake extension e.g. DBusGlue.")
+if("${CMAKE_GLUECODE_DBUS_NAME}" STREQUAL "na")
+ message(WARNING "The cmake name of the D-Bus gluecode library without cmake extension needs to be specified. Use '-DCMAKE_GLUECODE_DBUS_NAME=' to do so.")
+else()
+ message("CMAKE_GLUECODE_DBUS_NAME specified: ${CMAKE_GLUECODE_DBUS_NAME}")
+endif()
+
+SET(CMAKE_GLUECODE_SOMEIP_NAME "na" CACHE STRING "The cmake name of the gluecode library without cmake extension e.g. DBusGlue.")
+if("${CMAKE_GLUECODE_SOMEIP_NAME}" STREQUAL "na")
+ message(WARNING "The cmake name of the SomeIP gluecode library without cmake extension needs to be specified. Use '-DCMAKE_GLUECODE_SOMEIP_NAME=' to do so.")
+else()
+ message("CMAKE_GLUECODE_SOMEIP_NAME specified: ${CMAKE_GLUECODE_SOMEIP_NAME}")
+endif()
+
+if("${CMAKE_GLUECODE_DBUS_NAME}" STREQUAL "na" AND "${CMAKE_GLUECODE_SOMEIP_NAME}" STREQUAL "na")
+ message(FATAL_ERROR "Please specify at least one of CMAKE_GLUECODE_DBUS_NAME or CMAKE_GLUECODE_SOMEIP_NAME")
+ return()
+endif()
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
+ "Choose the type of build, options are: Debug Release." FORCE)
+endif(NOT CMAKE_BUILD_TYPE)
+
+message("Build type: ${CMAKE_BUILD_TYPE}")
+
+##############################################################################
+# add COMMONAPI install path to cmake find root path
+
+message("CMAKE_FIND_ROOT_PATH: ${CMAKE_FIND_ROOT_PATH}")
+
+FIND_PACKAGE(PkgConfig)
+
+# find gluecode for D-Bus
+if(NOT "${CMAKE_GLUECODE_DBUS_NAME}" STREQUAL "na")
+ FIND_PACKAGE(${CMAKE_GLUECODE_DBUS_NAME})
+ if ("${${CMAKE_GLUECODE_DBUS_NAME}_CONSIDERED_CONFIGS}" STREQUAL "")
+ message(WARNING "The cmake file for the D-Bus gluecode was not found. Please DBusGlue_DIR. Use '-DDBusGlue_DIR=' to do so.")
+ else()
+ message("${CMAKE_GLUECODE_DBUS_NAME}_CONSIDERED_CONFIGS found: ${${CMAKE_GLUECODE_DBUS_NAME}_CONSIDERED_CONFIGS}")
+ endif()
+endif()
+
+# find gluecode for SomeIP
+if(NOT "${CMAKE_GLUECODE_SOMEIP_NAME}" STREQUAL "na")
+ FIND_PACKAGE(${CMAKE_GLUECODE_SOMEIP_NAME})
+ if ("${${CMAKE_GLUECODE_SOMEIP_NAME}_CONSIDERED_CONFIGS}" STREQUAL "")
+ message(WARNING "The cmake file for the SomeIP gluecode was not found. Please specify SomeIPGlue_DIR. Use '-DSomeIPGlue_DIR=' to do so.")
+ else()
+ message("${CMAKE_GLUECODE_SOMEIP_NAME}_CONSIDERED_CONFIGS found: ${${CMAKE_GLUECODE_SOMEIP_NAME}_CONSIDERED_CONFIGS}")
+ endif()
+endif()
+
+# find commonapi
+if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+else()
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+endif()
+
+message("CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
+message("COMMONAPI_INCLUDE_DIRS: ${COMMONAPI_INCLUDE_DIRS}")
+
+##############################################################################
+# generate code from fidl
+file(GLOB FIDL_FILES "fidl/*.fidl")
+execute_process(COMMAND ${COMMONAPI_TOOL_GENERATOR} --dest src-gen --skel ${FIDL_FILES}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+
+##############################################################################
+# get library names
+
+string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_CMAKE_BUILD_TYPE)
+message("UPPER_CMAKE_BUILD_TYPE: ${UPPER_CMAKE_BUILD_TYPE}")
+
+# libDBusGLue
+if(NOT "${CMAKE_GLUECODE_DBUS_NAME}" STREQUAL "na")
+ get_property(GLUECODE_LIB_PATH_NAME_DBUS TARGET ${CMAKE_GLUECODE_DBUS_NAME} PROPERTY IMPORTED_LOCATION_${UPPER_CMAKE_BUILD_TYPE})
+ message("GLUECODE_LIB_PATH_NAME_DBUS value: ${GLUECODE_LIB_PATH_NAME_DBUS}")
+ # Strip the trailing .0.0.0 from the path as otherwise libCommonAPI won't load the .so
+ string(LENGTH ${GLUECODE_LIB_PATH_NAME_DBUS} GLUECODE_LIB_PATH_NAME_DBUS_LENGTH)
+ math(EXPR GLUECODE_LIB_PATH_NAME_DBUS_LENGTH_ADJUSTED '${GLUECODE_LIB_PATH_NAME_DBUS_LENGTH}-6')
+ string(SUBSTRING ${GLUECODE_LIB_PATH_NAME_DBUS}
+ 0 ${GLUECODE_LIB_PATH_NAME_DBUS_LENGTH_ADJUSTED}
+ GLUECODE_LIB_PATH_NAME_DBUS_LENGTH_CLEAN
+ )
+ # GLUECODE_SO_DBUS is used in commonapi4dbus.ini.in file
+ SET(GLUECODE_SO_DBUS ${GLUECODE_LIB_PATH_NAME_DBUS_LENGTH_CLEAN})
+endif()
+
+# libSomeIPGlue
+if(NOT "${CMAKE_GLUECODE_SOMEIP_NAME}" STREQUAL "na")
+ get_property(GLUECODE_LIB_PATH_NAME_SOMEIP TARGET ${CMAKE_GLUECODE_SOMEIP_NAME} PROPERTY IMPORTED_LOCATION_${UPPER_CMAKE_BUILD_TYPE})
+ message("GLUECODE_LIB_PATH_NAME_SOMEIP value: ${GLUECODE_LIB_PATH_NAME_SOMEIP}")
+ # Strip the trailing .0.0.0 from the path as otherwise libCommonAPI won't load the .so
+ string(LENGTH ${GLUECODE_LIB_PATH_NAME_SOMEIP} GLUECODE_LIB_PATH_NAME_SOMEIP_LENGTH)
+ math(EXPR GLUECODE_LIB_PATH_NAME_SOMEIP_LENGTH_ADJUSTED '${GLUECODE_LIB_PATH_NAME_SOMEIP_LENGTH}-6')
+ string(SUBSTRING ${GLUECODE_LIB_PATH_NAME_SOMEIP}
+ 0 ${GLUECODE_LIB_PATH_NAME_SOMEIP_LENGTH_ADJUSTED}
+ GLUECODE_LIB_PATH_NAME_SOMEIP_LENGTH_CLEAN
+ )
+ # GLUECODE_SO_SOMEIP is used in commonapi4dbus.ini.in file
+ SET(GLUECODE_SO_SOMEIP ${GLUECODE_LIB_PATH_NAME_SOMEIP_LENGTH_CLEAN})
+endif()
+
+##############################################################################
+# configure configuration files
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/conf/commonapi4dbus.ini.in
+ "${PROJECT_BINARY_DIR}/commonapi4dbus.ini" @ONLY)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/conf/commonapi4someip.ini.in
+ "${PROJECT_BINARY_DIR}/commonapi4someip.ini" @ONLY)
+
+##############################################################################
+# google test
+
+# check for set environment variable
+if(DEFINED ENV{GTEST_ROOT})
+ message("GTEST_ROOT is set. GTEST_ROOT = $ENV{GTEST_ROOT}")
+else()
+ message("GTEST_ROOT is not defined. For building the tests environment variable
+ GTEST_ROOT have to be defined. Tests can not be built.")
+ # early exit
+ return() # test can not be build -> make check is not available
+endif()
+
+# build google test as static library (always) -> therefore deactivate BUILD_SHARED_LIBS in case it is active
+set(BUILD_SHARED_LIBS_AUTOMATIC_OFF 0)
+if ("${BUILD_SHARED_LIBS}" STREQUAL "ON")
+ set(BUILD_SHARED_LIBS OFF)
+ set(BUILD_SHARED_LIBS_AUTOMATIC_OFF 1)
+endif()
+add_subdirectory($ENV{GTEST_ROOT} ${CMAKE_CURRENT_BINARY_DIR}/gtest EXCLUDE_FROM_ALL)
+if ("${BUILD_SHARED_LIBS_AUTOMATIC_OFF}" STREQUAL "1")
+ set(BUILD_SHARED_LIBS ON)
+ set(BUILD_SHARED_LIBS_AUTOMATIC_OFF 0)
+endif()
+
+##############################################################################
+# verification tests build section
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -Wno-reorder -Wno-unused-variable -DCOMMONAPI_INTERNAL_COMPILATION")
+set(USE_RT "rt")
+
+message("Compiler options: ${CMAKE_CXX_FLAGS}")
+
+include_directories(
+ src
+ src-gen
+ ${COMMONAPI_INCLUDE_DIRS}
+ ${gtest_SOURCE_DIR}/include
+)
+
+enable_testing()
+
+set(CMAKE_CTEST_COMMAND ctest -V)
+add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
+
+set(TEST_LINK_LIBRARIES CommonAPI gtest)
+
+add_executable(RTLoadingRuntime src/RTLoadingRuntime.cpp)
+target_link_libraries(RTLoadingRuntime ${TEST_LINK_LIBRARIES})
+
+add_executable(RTBuildProxiesAndStubs
+ src/RTBuildProxiesAndStubs.cpp
+ src-gen/v1_0/commonapi/runtime/TestInterfaceStubDefault.cpp)
+target_link_libraries(RTBuildProxiesAndStubs ${TEST_LINK_LIBRARIES})
+
+add_executable(CMMethodCalls
+ src/CMMethodCalls.cpp
+ src/stub/CMMethodCallsStub.cpp
+ src-gen/v1_0/commonapi/communication/TestInterfaceStubDefault.cpp)
+target_link_libraries(CMMethodCalls ${TEST_LINK_LIBRARIES})
+
+add_executable(CMAttributes
+ src/CMAttributes.cpp
+ src/stub/CMAttributesStub.cpp
+ src-gen/v1_0/commonapi/communication/TestInterfaceStubDefault.cpp)
+target_link_libraries(CMAttributes ${TEST_LINK_LIBRARIES})
+
+add_executable(CMAttributeSubscription
+ src/CMAttributeSubscription.cpp
+ src-gen/v1_0/commonapi/communication/TestInterfaceStubDefault.cpp)
+target_link_libraries(CMAttributeSubscription ${TEST_LINK_LIBRARIES})
+
+add_executable(DTPrimitive
+ src/DTPrimitive.cpp
+ src/stub/DTPrimitiveStub.cpp
+ src-gen/v1_0/commonapi/datatypes/primitive/TestInterfaceStubDefault.cpp)
+target_link_libraries(DTPrimitive ${TEST_LINK_LIBRARIES})
+
+add_executable(DTAdvanced
+ src/DTAdvanced.cpp
+ src/stub/DTAdvancedStub.cpp
+ src-gen/v1_0/commonapi/datatypes/advanced/TestInterfaceStubDefault.cpp
+ src-gen/v1_0/commonapi/datatypes/advanced/TestInterface.cpp)
+target_link_libraries(DTAdvanced ${TEST_LINK_LIBRARIES})
+
+add_executable(DTDerived
+ src/DTDerived.cpp
+ src/stub/DTDerivedStub.cpp
+ src-gen/v1_0/commonapi/datatypes/derived/TestInterfaceStubDefault.cpp
+ src-gen/v1_0/commonapi/datatypes/derived/TestInterface.cpp)
+target_link_libraries(DTDerived ${TEST_LINK_LIBRARIES})
+
+#add_executable(DTCombined
+# src/DTCombined.cpp
+# src/stub/DTCombinedStub.cpp
+# src-gen/v1_0/commonapi/datatypes/combined/TestInterface.cpp
+# src-gen/v1_0/commonapi/datatypes/combined/TestInterfaceStubDefault.cpp)
+#target_link_libraries(DTCombined ${TEST_LINK_LIBRARIES})
+
+add_executable(THMainLoopIntegration
+ src/THMainLoopIntegration.cpp
+ src/stub/THMainLoopIntegrationStub.cpp
+ src-gen/v1_0/commonapi/threading/TestInterfaceStubDefault.cpp)
+target_link_libraries(THMainLoopIntegration ${TEST_LINK_LIBRARIES})
+
+add_executable(THMainLoopIndependence
+ src/THMainLoopIndependence.cpp
+ src-gen/v1_0/commonapi/threading/TestInterfaceStubDefault.cpp)
+target_link_libraries(THMainLoopIndependence ${TEST_LINK_LIBRARIES})
+
+add_executable(PFPrimitive
+ src/PFPrimitive.cpp
+ src/stub/PFPrimitiveStub.cpp
+ src/utils/StopWatch.cpp
+ src-gen/v1_0/commonapi/performance/primitive/TestInterfaceStubDefault.cpp)
+target_link_libraries(PFPrimitive ${TEST_LINK_LIBRARIES} ${USE_RT})
+
+add_executable(PFComplex
+ src/PFComplex.cpp
+ src/stub/PFComplexStub.cpp
+ src/utils/StopWatch.cpp
+ src-gen/v1_0/commonapi/performance/complex/TestInterface.cpp
+ src-gen/v1_0/commonapi/performance/complex/TestInterfaceStubDefault.cpp)
+target_link_libraries(PFComplex ${TEST_LINK_LIBRARIES} ${USE_RT})
+
+add_executable(StabilitySP
+ src/StabilitySP.cpp
+ src/stub/StabilitySPStub.cpp
+ src-gen/v1_0/commonapi/stability/sp/TestInterfaceStubDefault.cpp)
+target_link_libraries(StabilitySP ${TEST_LINK_LIBRARIES})
+
+add_executable(StabilityMP
+ src/StabilityMP.cpp
+ src/stub/StabControlStub.cpp
+ src/stub/StabilityMPStub.cpp
+ src-gen/v1_0/commonapi/stability/mp/ControlInterfaceStubDefault.cpp
+ src-gen/v1_0/commonapi/stability/mp/TestInterfaceStubDefault.cpp)
+target_link_libraries(StabilityMP ${TEST_LINK_LIBRARIES})
+
+add_dependencies(RTLoadingRuntime gtest)
+add_dependencies(RTBuildProxiesAndStubs gtest)
+add_dependencies(CMMethodCalls gtest)
+add_dependencies(CMAttributes gtest)
+add_dependencies(CMAttributeSubscription gtest)
+add_dependencies(DTPrimitive gtest)
+add_dependencies(DTAdvanced gtest)
+add_dependencies(DTDerived gtest)
+#add_dependencies(DTCombined gtest)
+add_dependencies(THMainLoopIntegration gtest)
+add_dependencies(THMainLoopIndependence gtest)
+add_dependencies(PFPrimitive gtest)
+add_dependencies(PFComplex gtest)
+add_dependencies(StabilitySP gtest)
+add_dependencies(StabilityMP gtest)
+
+add_dependencies(check RTLoadingRuntime)
+add_dependencies(check RTBuildProxiesAndStubs)
+add_dependencies(check CMMethodCalls)
+add_dependencies(check CMAttributes)
+add_dependencies(check CMAttributeSubscription)
+add_dependencies(check DTPrimitive)
+add_dependencies(check DTAdvanced)
+add_dependencies(check DTDerived)
+#add_dependencies(check DTCombined)
+add_dependencies(check THMainLoopIntegration)
+add_dependencies(check THMainLoopIndependence)
+add_dependencies(check PFPrimitive)
+add_dependencies(check PFComplex)
+add_dependencies(check StabilitySP)
+add_dependencies(check StabilityMP)
+
+# Tests for DBus
+if(NOT "${CMAKE_GLUECODE_DBUS_NAME}" STREQUAL "na")
+ # Construct the environment for the tests
+ set(DBUS_COMMONAPI_CONFIG "COMMONAPI_CONFIG=commonapi4dbus.ini")
+ set(DBUS_TEST_ENVIRONMENT
+ ${DBUS_COMMONAPI_CONFIG}
+ )
+
+ add_test(NAME RTLoadingRuntimeDBus COMMAND RTLoadingRuntime)
+ set_property(TEST RTLoadingRuntimeDBus APPEND PROPERTY ENVIRONMENT ${DBUS_TEST_ENVIRONMENT})
+ add_test(NAME RTBuildProxiesAndStubsDBus COMMAND RTBuildProxiesAndStubs)
+ set_property(TEST RTBuildProxiesAndStubsDBus APPEND PROPERTY ENVIRONMENT ${DBUS_TEST_ENVIRONMENT})
+ add_test(NAME CMMethodCallsDBus COMMAND CMMethodCalls)
+ set_property(TEST CMMethodCallsDBus APPEND PROPERTY ENVIRONMENT ${DBUS_TEST_ENVIRONMENT})
+ add_test(NAME CMAttributesDBus COMMAND CMAttributes)
+ set_property(TEST CMAttributesDBus APPEND PROPERTY ENVIRONMENT ${DBUS_TEST_ENVIRONMENT})
+ add_test(NAME CMAttributeSubscriptionDBus COMMAND CMAttributeSubscription)
+ set_property(TEST CMAttributeSubscriptionDBus APPEND PROPERTY ENVIRONMENT ${DBUS_TEST_ENVIRONMENT})
+ add_test(NAME DTPrimitiveDBus COMMAND DTPrimitive)
+ set_property(TEST DTPrimitiveDBus APPEND PROPERTY ENVIRONMENT ${DBUS_TEST_ENVIRONMENT})
+ add_test(NAME DTAdvancedDBus COMMAND DTAdvanced)
+ set_property(TEST DTAdvancedDBus APPEND PROPERTY ENVIRONMENT ${DBUS_TEST_ENVIRONMENT})
+ add_test(NAME DTDerivedDBus COMMAND DTDerived)
+ set_property(TEST DTDerivedDBus APPEND PROPERTY ENVIRONMENT ${DBUS_TEST_ENVIRONMENT})
+ #add_test(NAME DTCombinedDBus COMMAND DTCombined)
+ #set_property(TEST DTCombinedDBus APPEND PROPERTY ENVIRONMENT ${DBUS_TEST_ENVIRONMENT})
+ add_test(NAME THMainLoopIntegrationDBus COMMAND THMainLoopIntegration)
+ set_property(TEST THMainLoopIntegrationDBus APPEND PROPERTY ENVIRONMENT ${DBUS_TEST_ENVIRONMENT})
+ add_test(NAME THMainLoopIndependenceDBus COMMAND THMainLoopIndependence)
+ set_property(TEST THMainLoopIndependenceDBus APPEND PROPERTY ENVIRONMENT ${DBUS_TEST_ENVIRONMENT})
+ add_test(NAME PFPrimitiveDBus COMMAND PFPrimitive)
+ set_property(TEST PFPrimitiveDBus APPEND PROPERTY ENVIRONMENT ${DBUS_TEST_ENVIRONMENT})
+ add_test(NAME PFComplexDBus COMMAND PFComplex)
+ set_property(TEST PFComplexDBus APPEND PROPERTY ENVIRONMENT ${DBUS_TEST_ENVIRONMENT})
+ add_test(NAME StabilitySPDBus COMMAND StabilitySP)
+ set_property(TEST StabilitySPDBus APPEND PROPERTY ENVIRONMENT ${DBUS_TEST_ENVIRONMENT})
+ add_test(NAME StabilityMPDBus COMMAND StabilityMP)
+ set_property(TEST StabilityMPDBus APPEND PROPERTY ENVIRONMENT ${DBUS_TEST_ENVIRONMENT})
+endif()
+
+# Tests for SomeIP
+if(NOT "${CMAKE_GLUECODE_SOMEIP_NAME}" STREQUAL "na")
+ # Construct the environment for the tests
+ set(SOMEIP_COMMONAPI_CONFIG "COMMONAPI_CONFIG=commonapi4someip.ini")
+ set(SOMEIP_VSOMEIP_JSON_FILE "VSOMEIP_CONFIGURATION_FILE=../../../ascgit017.CommonAPI-SomeIP-Tools/org.genivi.commonapi.someip.verification/vsomeip.json")
+ set(SOMEIP_TEST_ENVIRONMENT
+ ${SOMEIP_COMMONAPI_CONFIG}
+ ${SOMEIP_VSOMEIP_JSON_FILE}
+ )
+
+ add_test(NAME RTLoadingRuntimeSomeIP COMMAND RTLoadingRuntime)
+ set_property(TEST RTLoadingRuntimeSomeIP APPEND PROPERTY ENVIRONMENT ${SOMEIP_TEST_ENVIRONMENT})
+ add_test(NAME RTBuildProxiesAndStubsSomeIP COMMAND RTBuildProxiesAndStubs)
+ set_property(TEST RTBuildProxiesAndStubsSomeIP APPEND PROPERTY ENVIRONMENT ${SOMEIP_TEST_ENVIRONMENT})
+ add_test(NAME CMMethodCallsSomeIP COMMAND CMMethodCalls)
+ set_property(TEST CMMethodCallsSomeIP APPEND PROPERTY ENVIRONMENT ${SOMEIP_TEST_ENVIRONMENT})
+ add_test(NAME CMAttributesSomeIP COMMAND CMAttributes)
+ set_property(TEST CMAttributesSomeIP APPEND PROPERTY ENVIRONMENT ${SOMEIP_TEST_ENVIRONMENT})
+ add_test(NAME CMAttributeSubscriptionSomeIP COMMAND CMAttributeSubscription)
+ set_property(TEST CMAttributeSubscriptionSomeIP APPEND PROPERTY ENVIRONMENT ${SOMEIP_TEST_ENVIRONMENT})
+ add_test(NAME DTPrimitiveSomeIP COMMAND DTPrimitive)
+ set_property(TEST DTPrimitiveSomeIP APPEND PROPERTY ENVIRONMENT ${SOMEIP_TEST_ENVIRONMENT})
+ add_test(NAME DTAdvancedSomeIP COMMAND DTAdvanced)
+ set_property(TEST DTAdvancedSomeIP APPEND PROPERTY ENVIRONMENT ${SOMEIP_TEST_ENVIRONMENT})
+ add_test(NAME DTDerivedSomeIP COMMAND DTDerived)
+ set_property(TEST DTDerivedSomeIP APPEND PROPERTY ENVIRONMENT ${SOMEIP_TEST_ENVIRONMENT})
+ #add_test(NAME DTCombinedSomeIP COMMAND DTCombined)
+ #set_property(TEST DTCombinedSomeIP APPEND PROPERTY ENVIRONMENT ${SOMEIP_TEST_ENVIRONMENT})
+ add_test(NAME THMainLoopIntegrationSomeIP COMMAND THMainLoopIntegration)
+ set_property(TEST THMainLoopIntegrationSomeIP APPEND PROPERTY ENVIRONMENT ${SOMEIP_TEST_ENVIRONMENT})
+ add_test(NAME THMainLoopIndependenceSomeIP COMMAND THMainLoopIndependence)
+ set_property(TEST THMainLoopIndependenceSomeIP APPEND PROPERTY ENVIRONMENT ${SOMEIP_TEST_ENVIRONMENT})
+ add_test(NAME PFPrimitiveSomeIP COMMAND PFPrimitive)
+ set_property(TEST PFPrimitiveSomeIP APPEND PROPERTY ENVIRONMENT ${SOMEIP_TEST_ENVIRONMENT})
+ add_test(NAME PFComplexSomeIP COMMAND PFComplex)
+ set_property(TEST PFComplexSomeIP APPEND PROPERTY ENVIRONMENT ${SOMEIP_TEST_ENVIRONMENT})
+ add_test(NAME StabilitySPSomeIP COMMAND StabilitySP)
+ set_property(TEST StabilitySPSomeIP APPEND PROPERTY ENVIRONMENT ${SOMEIP_TEST_ENVIRONMENT})
+ add_test(NAME StabilityMPSomeIP COMMAND StabilityMP)
+ set_property(TEST StabilityMPSomeIP APPEND PROPERTY ENVIRONMENT ${SOMEIP_TEST_ENVIRONMENT})
+endif()
+
+##############################################################################
+# maintainer-clean
+add_custom_target(maintainer-clean COMMAND rm -rf *)
+
diff --git a/org.genivi.commonapi.core.verification/COPYING b/org.genivi.commonapi.core.verification/COPYING
deleted file mode 100644
index 94a9ed0..0000000
--- a/org.genivi.commonapi.core.verification/COPYING
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- <program> Copyright (C) <year> <name of author>
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/org.genivi.commonapi.core.verification/CommunicationVerification.conf.in b/org.genivi.commonapi.core.verification/CommunicationVerification.conf.in
deleted file mode 100644
index 4916c37..0000000
--- a/org.genivi.commonapi.core.verification/CommunicationVerification.conf.in
+++ /dev/null
@@ -1,5 +0,0 @@
-{binding:@BINDING_NAME@}
-libpath=@BINDING_SO@
-alias=TestAlias
-genpath=@GLUECODE_SO@
-default
diff --git a/org.genivi.commonapi.core.verification/DynamicLoadingVerification.conf.in b/org.genivi.commonapi.core.verification/DynamicLoadingVerification.conf.in
deleted file mode 100644
index 4916c37..0000000
--- a/org.genivi.commonapi.core.verification/DynamicLoadingVerification.conf.in
+++ /dev/null
@@ -1,5 +0,0 @@
-{binding:@BINDING_NAME@}
-libpath=@BINDING_SO@
-alias=TestAlias
-genpath=@GLUECODE_SO@
-default
diff --git a/org.genivi.commonapi.core.verification/LICENSE b/org.genivi.commonapi.core.verification/LICENSE
deleted file mode 100644
index 14e2f77..0000000
--- a/org.genivi.commonapi.core.verification/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- 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/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/org.genivi.commonapi.core.verification/Makefile.am b/org.genivi.commonapi.core.verification/Makefile.am
deleted file mode 100644
index db8aa4e..0000000
--- a/org.genivi.commonapi.core.verification/Makefile.am
+++ /dev/null
@@ -1,47 +0,0 @@
-ACLOCAL_AMFLAGS = -I m4
-
-GLUE_LDFLAGS_FOR_A="-Wl,--whole-archive,${GLUECODE_A},${BINDING_A},--no-whole-archive,${BINDING_EXTRA}"
-GLUE_LDFLAGS_FOR_SO="-Wl,--no-as-needed,${GLUECODE_SO},${BINDING_SO},--as-needed,${BINDING_EXTRA}"
-
-AM_CPPFLAGS = \
- -I$(top_srcdir)/src \
- -I./src-gen \
- -I$(includedir) \
- ${COMMONAPI_CFLAGS} \
- ${GTEST_CPPFLAGS}
-
-check_PROGRAMS = \
- DynamicLoadingVerification \
- MainLoopVerification \
- CommunicationVerification
-
-generated = \
- src-gen/commonapi/tests/DerivedTypeCollection.cpp \
- src-gen/commonapi/tests/TestInterfaceStubDefault.cpp \
- src-gen/commonapi/tests/CommunicationVerification.cpp
-
-TESTS = ${check_PROGRAMS}
-
-DynamicLoadingVerification_SOURCES = \
- src/utils/VerificationTestStub.cpp \
- src/DynamicLoadingVerification.cpp
-
-MainLoopVerification_SOURCES = \
- src/utils/VerificationTestStub.cpp \
- src/MainLoopVerification.cpp
-
-CommunicationVerification_SOURCES = \
- src/utils/VerificationTestStub.cpp \
- src/CommunicationVerification.cpp
-
-DynamicLoadingVerification_CPPFLAGS = ${AM_CPPFLAGS}
-DynamicLoadingVerification_LDADD = ${COMMONAPI_LIBS} ${GTEST_LIBS}
-DynamicLoadingVerification_LDFLAGS = ${GLUE_LDFLAGS_FOR_SO}
-
-MainLoopVerification_CPPFLAGS = ${AM_CPPFLAGS}
-MainLoopVerification_LDADD = ${COMMONAPI_LIBS} ${BINDING_A} ${GTEST_LIBS}
-MainLoopVerification_LDFLAGS = ${GLUE_LDFLAGS_FOR_A}
-
-CommunicationVerification_CPPFLAGS = ${AM_CPPFLAGS}
-CommunicationVerification_LDADD = ${COMMONAPI_LIBS} ${BINDING_A} ${GTEST_LIBS}
-CommunicationVerification_LDFLAGS = ${GLUE_LDFLAGS_FOR_A}
diff --git a/org.genivi.commonapi.core.verification/README b/org.genivi.commonapi.core.verification/README
index 4f3c790..78d03d9 100644
--- a/org.genivi.commonapi.core.verification/README
+++ b/org.genivi.commonapi.core.verification/README
@@ -1,5 +1,5 @@
GENIVI_org.genivi.commonapi.core.verification
-======================
+=============================================
:Author: Juergen Gehring - juergen.gehring@bmw.de, Manfred Bathelt - manfred.bathelt@bmw.de
:doctitle: GENIVI_org.genivi.commonapi.core.verification
@@ -35,32 +35,72 @@ The term "gluecode" refers to a binary that contains the binding specific genera
src directory within that project. The gluecode library needs to contain the generated proxy and stub files (Common-API as well as binding specific ones) from
the three .fidl files mentioned above.
-There are some configure options that allow you to define the binding that should be tested:
+There are some cmake options that allow you to define the binding that should be tested:
---with-gluecode=... specifies the path to your gluecode libraries, including name, excluding file ending; .a and .so files with
-the given name will be used.
---with-binding-name=... specifies the "well-known" name for the binding to be tested. This is the name which may be used to
-dynamically load the binding.
---with-binding=... specifies the path to the binding library, including name, excluding file ending; .a and .so files with
-the given name will be used.
+* -DCMAKE_GLUECODE_SOMEIP_NAME=SomeIPGlue and -DSomeIPGlue_DIR :
+ This will enable the verification test for SomeIP in ctest
+* -DCMAKE_GLUECODE_DBUS_NAME=DBusGlue and -DDBusGlue_DIR :
+ This will enable the verifcation tests for DBus in ctest
-If your binding needs additional libraries, use --binding-extra=... to specify them.
+If the gluecode for both middlewarebindings is defined, there will be two
+testcases available for one verification tests. One with postfix `DBus` and one
+with `SomeIP`.
+
+Example: Excerpt of a `ctest -N` call inside the build directory, when both middlewares
+were specified in the `cmake` call:
+----
+$ ctest -N
+Test project ascgit017.CommonAPI-Tools/org.genivi.commonapi.core.verification/build
+ [...]
+ Test #6: DTPrimitiveDBus
+ Test #7: DTAdvancedDBus
+ Test #8: DTDerivedDBus
+ [...]
+ Test #20: DTPrimitiveSomeIP
+ Test #21: DTAdvancedSomeIP
+ Test #22: DTDerivedSomeIP
+ [...]
+----
GTest is needed to compile and run the test. Its confuguration script location must be available
-in the environment variable GTEST_CONFIG.
+in the environment variable `GTEST_CONFIG`.
== Usage
-1. Generate CommonAPI code for alll .fidl files within /src using the code generator. After that you should find the generated files in /src-gen
-2. Run autoreconf -i
-3. Configure the project to find the gluecode (see also "Description")
-Ensure you have GTEST_CONFIG set to the correct location, e.g. GTEST_CONFIG=/home/user/work/gtest/scripts/gtest-config
- Examples:
- configure --with-gluecode=/home/user/CommonAPI-D-Bus-Tools/org.genivi.commonapi.dbus.verification/.libs/libDBusGlue \
- --with-binding-name=DBus \
- --with-binding=/home/user/CommonAPI-D-Bus/.libs/libCommonAPI-DBus
- --with-binding-extra=/home/user/dbus-1.4.16/dbus/.libs/libdbus-1.so
- If you do not need extra libraries, you can omit the --with-binding-extra option
-4. Run make check (Ensure that any additional .so which may be required can be found, for example by setting the LD_LIBRARY_PATH variable)
-5. Execute ./verification in order to run the test cases once again
- \ No newline at end of file
+1. Build needed glue code libraries, e.g. for SomeIP and for DBus.
+ Instructions how to do so can be found in the corresponding READMEs in the
+ verification folders of the middlewares. For example
+ `ascgit017.CommonAPI-SomeIP-Tools/org.genivi.commonapi.someip.verification`
+ in case of SomeIP.
+2. Run `cmake` (see below).
+ Ensure you have `GTEST_CONFIG` set to the correct location,
+ e.g. `GTEST_CONFIG=/home/user/work/gtest/scripts/gtest-config`
+3. Run `make check` (Ensure that any additional .so, like the patched libdbus,
+ which may be required can be found, for example by setting the LD_LIBRARY_PATH variable)
+4. Call `ctest -N` in the build directory to list the available test cases.
+ Run `ctest -V` (additional .so must be set in LD_LIBRARY_PATH) to run all tests.
+ or run `ctest -V -R $TESTCASENAME` to run a single test.
+
+CMake Example call:
+----
+export GTEST_ROOT=$YOUR_PATH_HERE/gtest-1.7.0/
+
+cd org.genivi.commonapi.core.verification/
+rm -rf build
+rm -rf src-gen
+mkdir build
+cd build
+cmake \
+-DCommonAPI_DIR=$(readlink -f ../../../ascgit017.CommonAPI/build) \
+-DCOMMONAPI_TOOL_GENERATOR=$(readlink -f ../../../ascgit017.CommonAPI-Tools/org.genivi.commonapi.core.cli.product/target/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator-linux-x86_64) \
+-DCMAKE_GLUECODE_SOMEIP_NAME=SomeIPGlue \
+-DSomeIPGlue_DIR=$(readlink -f ../../../ascgit017.CommonAPI-SomeIP-Tools/org.genivi.commonapi.someip.verification/build) \
+-DCMAKE_GLUECODE_DBUS_NAME=DBusGlue \
+-DDBusGlue_DIR=$(readlink -f ../../../ascgit017.CommonAPI-D-Bus-Tools/org.genivi.commonapi.dbus.verification/build) \
+..
+
+make check
+ctest -V
+----
+
+
diff --git a/org.genivi.commonapi.core.verification/configure.ac b/org.genivi.commonapi.core.verification/configure.ac
deleted file mode 100644
index a091ee5..0000000
--- a/org.genivi.commonapi.core.verification/configure.ac
+++ /dev/null
@@ -1,189 +0,0 @@
-AC_PREREQ(2.59)
-AC_INIT(org.genivi.commonapi.core.verification, 1.0)
-AC_USE_SYSTEM_EXTENSIONS
-AC_CONFIG_MACRO_DIR([m4])
-m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
-AC_CONFIG_AUX_DIR([build-aux])
-AC_CONFIG_HEADERS([build-aux/config.h])
-AC_CONFIG_FILES([
- Makefile
- DynamicLoadingVerification.conf
- src/DynamicLoadingVerification.cpp
- CommunicationVerification.conf
- src/CommunicationVerification.cpp
- ])
-
-AC_CANONICAL_SYSTEM
-AM_INIT_AUTOMAKE([foreign])
-
-
-### Binding definitions ###
-
-# Well known binding name
-AC_MSG_CHECKING(Well known name of the binding that is to be tested)
-AC_ARG_WITH([binding-name], [Well known name of the binding that is to be tested], [
- BINDING_NAME=${withval}
- AC_MSG_RESULT(${BINDING_NAME})
-],[
- AC_MSG_RESULT(no)
- AC_MSG_ERROR([A binding that shall be verified ne eds to be specified! Use '--with-binding=' to do so.])
-])
-
-AC_MSG_RESULT([
- $PACKAGE_NAME v$VERSION
-
- COMMONAPI_CFLAGS: ${COMMONAPI_CFLAGS}
- COMMONAPI_LIBS: ${COMMONAPI_LIBS}
-
- BINDING_FQN: ${BINDING_FQN}
- BINDING_SO: ${BINDING_SO}
-
- BINDING_A: ${BINDING_A}
- BINDING_EXTRA: ${BINDING_EXTRA}
-])
-
-
-
-# Path to binding libraries
-AC_ARG_WITH([binding], [full path to binding library, including name, excluding file ending. The .a and .so files with the given fqn will be used if present and when needed.], [
- BINDING_FQN=${withval}
-
- AC_MSG_CHECKING(.a binding library)
- AS_IF([test -f "${BINDING_FQN}.a"], [
- BINDING_A="${BINDING_FQN}.a"
- AC_MSG_RESULT(yes)
- ], [
- AC_MSG_RESULT(no)
- ]
- )
-
- AC_MSG_CHECKING(.so binding library)
- AS_IF([test -f "${BINDING_FQN}.so"], [
- BINDING_SO="${BINDING_FQN}.so"
- AC_MSG_RESULT(yes)
- ], [
- AC_MSG_RESULT(no)
- ]
- )
-], [AC_MSG_ERROR([A binding that shall be verified needs to be specified! Use '--with-binding=' to do so.])])
-
-
-# Additional libraries required by the binding
-AC_ARG_WITH([binding-extra], [full path to additional library required by statically linked binding], [
- AC_MSG_CHECKING(required additional libraries for the binding)
- AS_IF([test -f "${withval}"], [
- BINDING_EXTRA="${withval}"
- AC_MSG_RESULT(yes)
- ], [
- AC_MSG_RESULT(no)
- ]
- )
-],[])
-
-
-AM_CONDITIONAL(STATICALLY_LINKED_BINDING, [test -f "${GTEST_CONFIG}" && ${TESTS_CAN_BE_EXECUTED}])
-AM_CONDITIONAL(DYNAMICALLY_LINKED_BINDING, [test -f "${GTEST_CONFIG}" && ${TESTS_CAN_BE_EXECUTED}])
-
-#Libraries containing binding specific gluecode
-AC_ARG_WITH([gluecode], [full path to gluecode libraries, including name, excluding file ending. The .a and .so files with the given name will be used if present and when needed.], [
- GLUECODE_FQN=${withval}
-
- AC_MSG_CHECKING(.a gluecode library)
- AS_IF([test -f "${GLUECODE_FQN}.a"], [
- GLUECODE_A="${GLUECODE_FQN}.a"
- AC_MSG_RESULT(yes)
- ], [
- AC_MSG_RESULT(no)
- ]
- )
-
- AC_MSG_CHECKING(.so gluecode library)
- AS_IF([test -f "${GLUECODE_FQN}.so"], [
- GLUECODE_SO="${GLUECODE_FQN}.so"
- AC_MSG_RESULT(yes)
- ], [
- AC_MSG_RESULT(no)
- ]
- )
-], [AC_MSG_WARN([No path to binding specific gluecode library specified. Is this correct? If not, do so with '--with-gluecode='.])])
-
-
-#Substitutions
-AC_SUBST(BINDING_NAME)
-AC_SUBST(BINDING_SO)
-AC_SUBST(BINDING_A)
-AC_SUBST(BINDING_EXTRA)
-AC_SUBST(GLUECODE_SO)
-AC_SUBST(GLUECODE_A)
-
-
-#Configurations
-AC_PROG_CXX
-AC_LANG([C++])
-AX_CXX_COMPILE_STDCXX_11([noext])
-
-LT_PREREQ(2.2)
-LT_INIT
-
-
-#Dependencies
-PKG_PROG_PKG_CONFIG
-PKG_CHECK_MODULES(COMMONAPI, [CommonAPI >= 2.0])
-
-GTEST_MIN_VERSION="1.6.0"
-GTEST_URL="http://code.google.com/p/googletest"
-
-AC_ARG_VAR([GTEST_CONFIG], [The exact path of Google Test's 'gtest-config' script.])
-AC_ARG_VAR([GTEST_CPPFLAGS], [C-like preprocessor flags for Google Test.])
-AC_ARG_VAR([GTEST_CXXFLAGS], [C++ compile flags for Google Test.])
-AC_ARG_VAR([GTEST_LDFLAGS], [Linker path and option flags for Google Test.])
-AC_ARG_VAR([GTEST_LIBS], [Library linking flags for Google Test.])
-AC_ARG_VAR([GTEST_VERSION], [The available version of Google Test.])
-
-AS_IF([test -f "${GTEST_CONFIG}"], [
- AS_IF([${GTEST_CONFIG} --min-version=${GTEST_MIN_VERSION}],
- [],
- [AC_MSG_ERROR([Found Google Test Version ${GTEST_VERSION}. However ${GTEST_MIN_VERSION} is
- required. Please refer to ${GTEST_URL} for a more recent version.])])
- [GTEST_CPPFLAGS=`${GTEST_CONFIG} --cppflags`]
- [GTEST_CXXFLAGS=`${GTEST_CONFIG} --cxxflags`]
- [GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`]
- [GTEST_LIBS=`${GTEST_CONFIG} --libs`]
- [GTEST_VERSION=`${GTEST_CONFIG} --version`]
- ], [
- AC_MSG_ERROR([Google Test could not be found! Please provide an environment variable 'GTEST_CONFIG'
- pointing to the location of Google Test's 'gtest-config' script])
- ]
-)
-
-
-#Result
-AC_MSG_RESULT([
- $PACKAGE_NAME v$VERSION
-
- COMMONAPI_CFLAGS: ${COMMONAPI_CFLAGS}
- COMMONAPI_LIBS: ${COMMONAPI_LIBS}
-
- BINDING_FQN: ${BINDING_FQN}
- BINDING_SO: ${BINDING_SO}
-
- BINDING_A: ${BINDING_A}
- BINDING_EXTRA: ${BINDING_EXTRA}
-
- GLUECODE_FQN: ${GLUECODE_FQN}
- GLUECODE_SO: ${GLUECODE_SO}
- GLUECODE_A: ${GLUECODE_A}
-
- GTEST_CONFIG: ${GTEST_CONFIG}
- GTEST_CPPFLAGS: ${GTEST_CPPFLAGS}
- GTEST_CXXFLAGS: ${GTEST_CXXFLAGS}
- GTEST_LDFLAGS: ${GTEST_LDFLAGS}
- GTEST_LIBS: ${GTEST_LIBS}
- GTEST_VERSION: ${GTEST_VERSION}
-
- CXXFLAGS: ${CXXFLAGS}
- LDFLAGS: ${LDFLAGS}
-])
-
-AC_OUTPUT
-
diff --git a/org.genivi.commonapi.core.verification/fidl/ti_communication.fidl b/org.genivi.commonapi.core.verification/fidl/ti_communication.fidl
new file mode 100644
index 0000000..50329be
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/fidl/ti_communication.fidl
@@ -0,0 +1,23 @@
+/* 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/. */
+package commonapi.communication
+
+interface TestInterface {
+ version { major 1 minor 0 }
+
+ attribute UInt8 testAttribute
+
+ attribute UInt8 testA readonly
+ attribute UInt8 testB noSubscriptions
+ attribute UInt8 testC readonly noSubscriptions
+
+ method testMethod {
+ in {
+ UInt8 x
+ }
+ out {
+ UInt8 y
+ }
+ }
+} \ No newline at end of file
diff --git a/org.genivi.commonapi.core.verification/fidl/ti_datatypes_advanced.fidl b/org.genivi.commonapi.core.verification/fidl/ti_datatypes_advanced.fidl
new file mode 100644
index 0000000..65b44a9
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/fidl/ti_datatypes_advanced.fidl
@@ -0,0 +1,70 @@
+/* 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/. */
+package commonapi.datatypes.advanced
+
+interface TestInterface {
+ version { major 1 minor 0 }
+
+ attribute tArray aArray
+ attribute tEnumeration aEnumeration
+ attribute tStruct aStruct
+ attribute tUnion aUnion
+ attribute tMap aMap
+ attribute tTypedef aTypedef
+
+ method fTest {
+ in {
+ tArray tArrayIn
+ tEnumeration tEnumerationIn
+ tStruct tStructIn
+ tUnion tUnionIn
+ tMap tMapIn
+ tTypedef tTypedefIn
+ }
+ out {
+ tArray tArrayOut
+ tEnumeration tEnumerationOut
+ tStruct tStructOut
+ tUnion tUnionOut
+ tMap tMapOut
+ tTypedef tTypedefOut
+ }
+ }
+
+ broadcast bTest {
+ out {
+ tArray tArrayOut
+ tEnumeration tEnumerationOut
+ tStruct tStructOut
+ tUnion tUnionOut
+ tMap tMapOut
+ tTypedef tTypedefOut
+ }
+ }
+
+ array tArray of String
+
+ enumeration tEnumeration {
+ VALUE1= "0"
+ VALUE2= "123"
+ }
+
+ struct tStruct {
+ Boolean booleanMember
+ UInt8 uint8Member
+ String stringMember
+ }
+
+ union tUnion {
+ Boolean booleanMember
+ UInt8 uint8Member
+ String stringMember
+ }
+
+ map tMap {
+ UInt8 to String
+ }
+
+ typedef tTypedef is UInt8
+}
diff --git a/org.genivi.commonapi.core.verification/fidl/ti_datatypes_combined.fidl b/org.genivi.commonapi.core.verification/fidl/ti_datatypes_combined.fidl
new file mode 100644
index 0000000..eab2007
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/fidl/ti_datatypes_combined.fidl
@@ -0,0 +1,249 @@
+/* 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/. */
+package commonapi.datatypes.combined
+
+interface TestInterface {
+ version { major 1 minor 0 }
+
+ attribute tStructL3 aStructL3
+ //attribute tUnionL3 aUnionL3
+
+ method fTest {
+ in {
+ tStructL3 tStructL3In
+ //tUnionL3 tUnionL3In
+
+ }
+ out {
+ tStructL3 tStructL3Out
+ //tUnionL3 tUnionL3Out
+ }
+ }
+
+ // Level 0
+
+ enumeration tEnum {
+ VALUE1= "0"
+ VALUE2= "123"
+ }
+
+ array tArray of String
+
+ struct tStruct {
+ Boolean booleanMember
+ UInt8 uint8Member
+ String stringMember
+ tEnum enumMember
+ }
+
+ union tUnion {
+ Boolean booleanMember
+ UInt8 uint8Member
+ String stringMember
+ tEnum enumMember
+ }
+
+ map tMap {
+ UInt8 to String
+ }
+
+ // Level 1
+
+ array tArrayEnum of tEnum
+ array tArrayArray of tArray
+ array tArrayStruct of tStruct
+ array tArrayUnion of tUnion
+ array tArrayMap of tMap
+
+ struct tStructL1 {
+ tEnum enumMember
+ tArray arrayMemner
+ tStruct structMember
+ tUnion unionMember
+ tMap mapMember
+ }
+
+ union tUnionL1 {
+ tEnum enumMember
+ tArray arrayMember
+ tStruct structMember
+ tUnion unionMember
+ tMap mapMember
+ }
+
+ map tMapEnum {
+ UInt8 to tEnum
+ }
+
+ map tMapArray {
+ Double to tArray
+ }
+
+ map tMapStruct {
+ String to tStruct
+ }
+
+ map tMapUnion {
+ Float to tUnion
+ }
+
+ map tMapMap {
+ Int8 to tMap
+ }
+
+ // Level 2
+
+ array tArrayArrayEnum of tArrayEnum
+ array tArrayArrayArray of tArrayArray
+ array tArrayArrayStruct of tArrayStruct
+ array tArrayArrayUnion of tArrayUnion
+ array tArrayArrayMap of tArrayMap
+ array tArrayStructL1 of tStructL1
+ array tArrayUnionL1 of tUnionL1
+ array tArrayMapEnum of tMapEnum
+ array tArrayMapArray of tMapArray
+ array tArrayMapStruct of tMapStruct
+ array tArrayMapUnion of tMapUnion
+ array tArrayMapMap of tMapMap
+
+ struct tStructL2 {
+ tEnum [] arrayEnumMember
+ tArray [] arrayArrayMember
+ tStruct [] arrayStructMember
+ tUnion [] arrayUnionMember
+ tMap [] arrayMapMember
+ tStructL1 structL1Member
+ tUnionL1 unionL1Member
+ tMapEnum mapEnumMember
+ tMapArray mapArrayMember
+ tMapStruct mapStructMember
+ tMapUnion mapUnionMember
+ tMapMap mapMapMember
+ }
+
+ union tUnionL2 {
+ tArrayEnum arrayEnumMember
+ tArrayArray arrayArrayMember
+ tArrayStruct arrayStructMember
+ tArrayUnion arrayUnionMember
+ tArrayMap arrayMapMember
+ tStructL1 structL1Member
+ tUnionL1 unionL1Member
+ tMapEnum mapEnumMember
+ tMapArray mapArrayMember
+ tMapStruct mapStructMember
+ tMapUnion mapUnionMember
+ tMapMap mapMapMember
+ }
+
+ map tMapArrayEnum {
+ String to tArrayEnum
+ }
+
+ map tMapArrayArray {
+ String to tArrayArray
+ }
+
+ map tMapArrayStruct {
+ String to tArrayStruct
+ }
+
+ map tMapArrayUnion {
+ String to tArrayUnion
+ }
+
+ map tMapArrayMap {
+ String to tArrayMap
+ }
+
+ map tMapStructL1 {
+ String to tStructL1
+ }
+
+ map tMapUnionL1 {
+ String to tUnionL1
+ }
+
+ map tMapMapEnum {
+ String to tMapEnum
+ }
+
+ map tMapMapArray {
+ String to tMapArray
+ }
+
+ map tMapMapStruct {
+ String to tMapStruct
+ }
+
+ map tMapMapUnion {
+ String to tMapUnion
+ }
+
+ map tMapMapMap {
+ String to tMapMap
+ }
+
+ // Level 3
+ // Due to the libdbus limit of signature length < DBUS_MAXIMUM_SIGNATURE_LENGTH = 255 the structure cannot be completely used as argument
+ // see dbus-protocol.h. Simply change this value does not work.
+
+ struct tStructL3 {
+ tArrayArrayEnum arrayArrayEnumMember
+ tArrayArrayArray arrayArrayArrayMember
+ tArrayArrayStruct arrayArrayStructMember
+ tArrayArrayUnion arrayArrayUnionMember
+ tArrayArrayMap arrayArrayMapMember
+ tArrayStructL1 arrayStructL1Member
+ //tArrayUnionL1 arrayUnionL1Member
+ //tArrayMapEnum arrayMapEnumMember
+ //tArrayMapArray arrayMapArrayMember
+ //tArrayMapStruct arrayMapStructMember
+ //tArrayMapUnion arrayMapUnionMember
+ //tArrayMapMap arrayMapMapMember
+ tStructL2 structL2Member
+ //tUnionL2 unionL2Member
+ tMapArrayEnum mapArrayEnumMember
+ tMapArrayArray mapArrayArrayMember
+ tMapArrayStruct mapArrayStructMember
+ tMapArrayUnion mapArrayUnionMember
+ tMapArrayMap mapArrayMapMember
+ //tMapStructL1 mapStructL1Member
+ tMapUnionL1 mapUnionL1Member
+ tMapMapEnum mapMapEnumMember
+ tMapMapArray mapMapArrayMember
+ tMapMapStruct mapMapStructMember
+ tMapMapUnion mapMapUnionMember
+ tMapMapMap mapMapMapMember
+ }
+
+// union tUnionL3 {
+// tArrayArrayEnum arrayArrayEnumMember
+// tArrayArrayArray arrayArrayArrayMember
+// tArrayArrayStruct arrayArrayStructMember
+// tArrayArrayUnion arrayArrayUnionMember
+// tArrayArrayMap arrayArrayMapMember
+// tArrayStructL1 arrayStructL1Member
+// tArrayUnionL1 arrayUnionL1Member
+// tArrayMapEnum arrayMapEnumMember
+// tArrayMapArray arrayMapArrayMember
+// tArrayMapStruct arrayMapStructMember
+// tArrayMapUnion arrayMapUnionMember
+// tArrayMapMap arrayMapMapMember
+// tStructL2 structL2Member
+// tUnionL2 unionL2Member
+// tMapArrayEnum mapArrayEnumMember
+// tMapArrayArray mapArrayArrayMember
+// tMapArrayStruct mapArrayStructMember
+// tMapArrayUnion mapArrayUnionMember
+// tMapArrayMap mapArrayMapMember
+// tMapStructL1 mapStructL1Member
+// tMapUnionL1 mapUnionL1Member
+// tMapMapEnum mapMapEnumMember
+// tMapMapArray mapMapArrayMember
+// tMapMapStruct mapMapStructMember
+// tMapMapUnion mapMapUnionMember
+// tMapMapMap mapMapMapMember
+// }
+}
diff --git a/org.genivi.commonapi.core.verification/fidl/ti_datatypes_derived.fidl b/org.genivi.commonapi.core.verification/fidl/ti_datatypes_derived.fidl
new file mode 100644
index 0000000..d7eede7
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/fidl/ti_datatypes_derived.fidl
@@ -0,0 +1,74 @@
+/* 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/. */
+package commonapi.datatypes.derived
+
+interface TestInterface {
+ version { major 1 minor 0 }
+
+ attribute tStructExt aStructExt
+ attribute tEnumExt aEnumExt
+ attribute tUnionExt aUnionExt
+ attribute tBaseStruct aBaseStruct
+
+ method fTest {
+ in {
+ tStructExt tStructExtIn
+ tEnumExt tEnumExtIn
+ tUnionExt tUnionExtIn
+ tBaseStruct tBaseStructIn
+ }
+ out {
+ tStructExt tStructExtOut
+ tEnumExt tEnumExtOut
+ tUnionExt tUnionExtOut
+ tBaseStruct tBaseStructOut
+ }
+ }
+
+ broadcast bTest {
+ out {
+ tStructExt tStructExtOut
+ tEnumExt tEnumExtOut
+ tUnionExt tUnionExtOut
+ tBaseStruct tBaseStructOut
+ }
+ }
+
+ struct tStruct {
+ UInt8 baseMember
+ }
+
+ struct tStructExt extends tStruct {
+ String extendedMember
+ }
+
+ enumeration tEnum {
+ VALUE1= "0"
+ }
+
+ enumeration tEnumExt extends tEnum {
+ VALUE2= "1"
+ }
+
+ union tUnion {
+ UInt8 baseMember
+ }
+
+ union tUnionExt extends tUnion {
+ String extendedMember
+ }
+
+ struct tBaseStruct polymorphic {
+ }
+
+ struct tBaseOneStruct extends tBaseStruct {
+ UInt8 number
+ }
+
+ struct tBaseTwoStruct extends tBaseStruct {
+ String name
+ }
+
+
+}
diff --git a/org.genivi.commonapi.core.verification/fidl/ti_datatypes_primitive.fidl b/org.genivi.commonapi.core.verification/fidl/ti_datatypes_primitive.fidl
new file mode 100644
index 0000000..57e8be2
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/fidl/ti_datatypes_primitive.fidl
@@ -0,0 +1,73 @@
+/* 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/. */
+package commonapi.datatypes.primitive
+
+interface TestInterface {
+ version { major 1 minor 0 }
+
+ attribute UInt8 aUint8
+ attribute Int8 aInt8
+ attribute UInt16 aUint16
+ attribute Int16 aInt16
+ attribute UInt32 aUint32
+ attribute Int32 aInt32
+ attribute UInt64 aUint64
+ attribute Int64 aInt64
+ attribute Boolean aBoolean
+ attribute Float aFloat
+ attribute Double aDouble
+ attribute String aString
+ //attribute ByteBuffer aByteBuffer
+
+ method fTest {
+ in {
+ UInt8 uint8In
+ Int8 int8In
+ UInt16 uint16In
+ Int16 int16In
+ UInt32 uint32In
+ Int32 int32In
+ UInt64 uint64In
+ Int64 int64In
+ Boolean booleanIn
+ Float floatIn
+ Double doubleIn
+ String stringIn
+ //ByteBuffer byteBufferIn
+ }
+ out {
+ UInt8 uint8Out
+ Int8 int8Out
+ UInt16 uint16Out
+ Int16 int16Out
+ UInt32 uint32Out
+ Int32 int32Out
+ UInt64 uint64Out
+ Int64 int64Out
+ Boolean booleanOut
+ Float floatOut
+ Double doubleOut
+ String stringOut
+ //ByteBuffer byteBufferOut
+ }
+ }
+
+ broadcast bTest {
+ out {
+ UInt8 uint8Out
+ Int8 int8Out
+ UInt16 uint16Out
+ Int16 int16Out
+ UInt32 uint32Out
+ Int32 int32Out
+ UInt64 uint64Out
+ Int64 int64Out
+ Boolean booleanOut
+ Float floatOut
+ Double doubleOut
+ String stringOut
+ //ByteBuffer byteBufferOut
+ }
+ }
+}
diff --git a/org.genivi.commonapi.core.verification/fidl/ti_performance_complex.fidl b/org.genivi.commonapi.core.verification/fidl/ti_performance_complex.fidl
new file mode 100644
index 0000000..eb80e40
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/fidl/ti_performance_complex.fidl
@@ -0,0 +1,38 @@
+/* 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/. */
+package commonapi.performance.complex
+
+interface TestInterface {
+ version { major 1 minor 0 }
+
+ method testMethod {
+ in {
+ tArray x
+ }
+ out {
+ tArray y
+ }
+ }
+
+ struct tStruct {
+ innerStruct iStruct
+ innerUnion iUnion
+ }
+
+ struct innerStruct {
+ UInt32 uint32Member
+ Boolean booleanMember
+ UInt8 uint8Member
+ String stringMember
+ UInt16 uint16Member
+ }
+
+ union innerUnion {
+ Boolean booleanMember
+ UInt8 uint8Member
+ String stringMember
+ }
+
+ array tArray of tStruct
+} \ No newline at end of file
diff --git a/org.genivi.commonapi.core.verification/fidl/ti_performance_primitive.fidl b/org.genivi.commonapi.core.verification/fidl/ti_performance_primitive.fidl
new file mode 100644
index 0000000..6d30d29
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/fidl/ti_performance_primitive.fidl
@@ -0,0 +1,19 @@
+/* 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/. */
+package commonapi.performance.primitive
+
+interface TestInterface {
+ version { major 1 minor 0 }
+
+ method testMethod {
+ in {
+ TestArray x
+ }
+ out {
+ TestArray y
+ }
+ }
+
+ array TestArray of UInt8
+} \ No newline at end of file
diff --git a/org.genivi.commonapi.core.verification/fidl/ti_runtime.fidl b/org.genivi.commonapi.core.verification/fidl/ti_runtime.fidl
new file mode 100644
index 0000000..100f086
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/fidl/ti_runtime.fidl
@@ -0,0 +1,11 @@
+/* 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/. */
+package commonapi.runtime
+
+interface TestInterface {
+ version { major 1 minor 0 }
+
+ method testMethod {
+ }
+} \ No newline at end of file
diff --git a/org.genivi.commonapi.core.verification/fidl/ti_stability_mp.fidl b/org.genivi.commonapi.core.verification/fidl/ti_stability_mp.fidl
new file mode 100644
index 0000000..0b89dcb
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/fidl/ti_stability_mp.fidl
@@ -0,0 +1,46 @@
+/* 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/. */
+package commonapi.stability.mp
+
+interface TestInterface {
+ version { major 1 minor 0 }
+
+ attribute tArray testAttribute
+
+ method testMethod {
+ in {
+ tArray x
+ }
+ out {
+ tArray y
+ }
+ }
+
+ broadcast testBroadcast {
+ out {
+ tArray y
+ }
+ }
+
+ array tArray of UInt8
+}
+
+interface ControlInterface {
+ version { major 1 minor 0 }
+ method controlMethod {
+ in {
+ UInt8 id
+ UInt32 data
+ }
+ out {
+ UInt8 command
+ UInt32 data1
+ UInt32 data2
+ }
+ }
+
+
+}
+
+
diff --git a/org.genivi.commonapi.core.verification/fidl/ti_stability_sp.fidl b/org.genivi.commonapi.core.verification/fidl/ti_stability_sp.fidl
new file mode 100644
index 0000000..144186a
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/fidl/ti_stability_sp.fidl
@@ -0,0 +1,28 @@
+/* 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/. */
+package commonapi.stability.sp
+
+interface TestInterface {
+ version { major 1 minor 0 }
+
+ attribute tArray testAttribute
+
+ method testMethod {
+ in {
+ tArray x
+ }
+ out {
+ tArray y
+ }
+ }
+
+ broadcast testBroadcast {
+ out {
+ tArray y
+ }
+ }
+
+ array tArray of UInt8
+}
+
diff --git a/org.genivi.commonapi.core.verification/fidl/ti_threading.fidl b/org.genivi.commonapi.core.verification/fidl/ti_threading.fidl
new file mode 100644
index 0000000..2e829a4
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/fidl/ti_threading.fidl
@@ -0,0 +1,23 @@
+/* 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/. */
+package commonapi.threading
+
+interface TestInterface {
+ version { major 1 minor 0 }
+
+ method testMethod {
+ in {
+ UInt8 x
+ }
+ out {
+ UInt8 y
+ }
+ }
+
+ broadcast testBroadcast {
+ out {
+ UInt8 y
+ }
+ }
+} \ No newline at end of file
diff --git a/org.genivi.commonapi.core.verification/m4/.gitignore b/org.genivi.commonapi.core.verification/m4/.gitignore
deleted file mode 100644
index 764b428..0000000
--- a/org.genivi.commonapi.core.verification/m4/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/libtool.m4
-/lt~obsolete.m4
-/ltoptions.m4
-/ltsugar.m4
-/ltversion.m4
diff --git a/org.genivi.commonapi.core.verification/m4/ax_cxx_compile_stdcxx_11.m4 b/org.genivi.commonapi.core.verification/m4/ax_cxx_compile_stdcxx_11.m4
deleted file mode 100644
index 0d96c07..0000000
--- a/org.genivi.commonapi.core.verification/m4/ax_cxx_compile_stdcxx_11.m4
+++ /dev/null
@@ -1,107 +0,0 @@
-# ============================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
-# ============================================================================
-#
-# SYNOPSIS
-#
-# AX_CXX_COMPILE_STDCXX_11([ext|noext])
-#
-# DESCRIPTION
-#
-# Check for baseline language coverage in the compiler for the C++11
-# standard; if necessary, add switches to CXXFLAGS to enable support.
-# Errors out if no mode that supports C++11 baseline syntax can be found.
-# The argument, if specified, indicates whether you insist on an extended
-# mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -std=c++11).
-# If neither is specified, you get whatever works, with preference for an
-# extended mode.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
-# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 1
-
-m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
- template <typename T>
- struct check
- {
- static_assert(sizeof(int) <= sizeof(T), "not big enough");
- };
-
- typedef check<check<bool>> right_angle_brackets;
-
- int a;
- decltype(a) b;
-
- typedef check<int> check_type;
- check_type c;
- check_type&& cr = static_cast<check_type&&>(c);
-])
-
-AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
- m4_if([$1], [], [],
- [$1], [ext], [],
- [$1], [noext], [],
- [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
- AC_LANG_ASSERT([C++])dnl
- ac_success=no
- AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
- ax_cv_cxx_compile_cxx11,
- [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
- [ax_cv_cxx_compile_cxx11=yes],
- [ax_cv_cxx_compile_cxx11=no])])
- if test x$ax_cv_cxx_compile_cxx11 = xyes; then
- ac_success=yes
- fi
-
- m4_if([$1], [noext], [], [dnl
- if test x$ac_success = xno; then
- for switch in -std=gnu++11 -std=gnu++0x; do
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
- AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
- $cachevar,
- [ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $switch"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
- [eval $cachevar=yes],
- [eval $cachevar=no])
- CXXFLAGS="$ac_save_CXXFLAGS"])
- if eval test x\$$cachevar = xyes; then
- CXXFLAGS="$CXXFLAGS $switch"
- ac_success=yes
- break
- fi
- done
- fi])
-
- m4_if([$1], [ext], [], [dnl
- if test x$ac_success = xno; then
- for switch in -std=c++11 -std=c++0x; do
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
- AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
- $cachevar,
- [ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $switch"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
- [eval $cachevar=yes],
- [eval $cachevar=no])
- CXXFLAGS="$ac_save_CXXFLAGS"])
- if eval test x\$$cachevar = xyes; then
- CXXFLAGS="$CXXFLAGS $switch"
- ac_success=yes
- break
- fi
- done
- fi])
-
- if test x$ac_success = xno; then
- AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
- fi
-])
diff --git a/org.genivi.commonapi.core.verification/src/CMAttributeSubscription.cpp b/org.genivi.commonapi.core.verification/src/CMAttributeSubscription.cpp
new file mode 100644
index 0000000..b4af088
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/CMAttributeSubscription.cpp
@@ -0,0 +1,401 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+/**
+ * @file Communication
+ */
+
+#include <functional>
+#include <fstream>
+#include <deque>
+#include <mutex>
+#include <condition_variable>
+#include <thread>
+#include <gtest/gtest.h>
+#include "CommonAPI/CommonAPI.hpp"
+#include "v1_0/commonapi/communication/TestInterfaceProxy.hpp"
+#include "v1_0/commonapi/communication/TestInterfaceStubDefault.hpp"
+
+const std::string serviceId = "service-sample";
+const std::string clientId = "client-sample";
+
+const std::string domain = "local";
+const std::string testAddress = "commonapi.communication.TestInterface";
+
+const unsigned int wt = 500000;
+
+typedef std::shared_ptr<v1_0::commonapi::communication::TestInterfaceProxy<>> ProxyPtr;
+
+std::mutex mut;
+std::deque<uint32_t> data_queue;
+std::condition_variable data_cond;
+
+class SubscriptionHandler {
+
+public:
+
+ SubscriptionHandler(ProxyPtr pp) : myProxy_(pp) {
+ availabilityStatus_ = CommonAPI::AvailabilityStatus::UNKNOWN;
+ callbackTestAttribute_ = std::bind(&SubscriptionHandler::myCallback, this, std::placeholders::_1);
+ subscriptionStarted_ = false;
+ testAttribute_ = 0;
+ }
+
+ void receiveServiceAvailable(CommonAPI::AvailabilityStatus as) {
+
+ availabilityStatus_ = as;
+
+ if (as == CommonAPI::AvailabilityStatus::AVAILABLE) {
+
+ startSubscribe();
+
+ } else if (as == CommonAPI::AvailabilityStatus::NOT_AVAILABLE) {
+
+ cancelSubscribe();
+ }
+ }
+
+ void myCallback(const uint8_t& val) {
+
+ testAttribute_ = val;
+ myQueue_.push_back(val);
+
+ /* for test purposes, magic value 99 unsubscribes the attribute. */
+ if (val == 99) {
+ cancelSubscribe();
+ }
+ }
+
+ void startSubscribe() {
+ if (!subscriptionStarted_) {
+ subscribedListener_ =
+ myProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(callbackTestAttribute_);
+ subscriptionStarted_ = true;
+ }
+ }
+
+ void cancelSubscribe() {
+ if (subscriptionStarted_) {
+ myProxy_->getTestAttributeAttribute().getChangedEvent().unsubscribe(subscribedListener_);
+ subscriptionStarted_ = false;
+ }
+ }
+
+ CommonAPI::AvailabilityStatus getAvailabilityStatus() {
+ return availabilityStatus_;
+ }
+
+
+ uint8_t getSubscriptedTestAttribute() {
+ return testAttribute_;
+ }
+
+ std::deque<uint8_t> myQueue_;
+
+private:
+
+ bool subscriptionStarted_;
+ uint8_t testAttribute_;
+ ProxyPtr myProxy_;
+
+ CommonAPI::AvailabilityStatus availabilityStatus_;
+ CommonAPI::Event<uint8_t>::Subscription subscribedListener_;
+
+ std::function<void(const uint8_t&)> callbackTestAttribute_;
+};
+
+void testSubscription(ProxyPtr pp) {
+
+ SubscriptionHandler subscriptionHandler(pp);
+
+ std::function<void(CommonAPI::AvailabilityStatus)> callbackAvailabilityStatus =
+ std::bind(&SubscriptionHandler::receiveServiceAvailable, &subscriptionHandler, std::placeholders::_1);
+
+ pp->getProxyStatusEvent().subscribe(callbackAvailabilityStatus);
+
+ int cnt = 0;
+ while (!(subscriptionHandler.getSubscriptedTestAttribute() > 0
+ && subscriptionHandler.getAvailabilityStatus()
+ == CommonAPI::AvailabilityStatus::NOT_AVAILABLE)
+ && cnt < 1000) {
+ usleep(10000);
+ cnt++;
+ }
+
+ std::lock_guard < std::mutex > lk(mut);
+ data_queue.push_back(subscriptionHandler.getSubscriptedTestAttribute());
+ data_cond.notify_one();
+}
+
+class CMAttributeSubscription: public ::testing::Test {
+
+protected:
+ void SetUp() {
+
+ runtime_ = CommonAPI::Runtime::get();
+ ASSERT_TRUE((bool)runtime_);
+
+ testProxy_ = runtime_->buildProxy<v1_0::commonapi::communication::TestInterfaceProxy>(domain, testAddress, clientId);
+ ASSERT_TRUE((bool)testProxy_);
+
+ testStub_ = std::make_shared<v1_0::commonapi::communication::TestInterfaceStubDefault>();
+ }
+
+ void TearDown() {
+ }
+
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
+
+ std::shared_ptr<v1_0::commonapi::communication::TestInterfaceProxy<>> testProxy_;
+ std::shared_ptr<v1_0::commonapi::communication::TestInterfaceStubDefault> testStub_;
+};
+
+class Environment: public ::testing::Environment {
+
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ }
+
+ virtual void TearDown() {
+ }
+
+private:
+};
+
+/**
+ * @test Subscription standard test.
+ * - Register service and check if proxy is available.
+ * - Proxy subscribes for TestAttribute (uint8_t).
+ * - Change attribute in service several times by set method.
+ * - Callback function in proxy writes the received values in a queue.
+ * - Check if values in the queue are the same as the values that were set in the service.
+ * - Unregister test service.
+ */
+TEST_F(CMAttributeSubscription, SubscriptionStandard) {
+
+ bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId);
+ ASSERT_TRUE(serviceRegistered);
+
+ for(unsigned int i = 0; !testProxy_->isAvailable() && i < 100; ++i) {
+ usleep(10000);
+ }
+ ASSERT_TRUE(testProxy_->isAvailable());
+
+ SubscriptionHandler subscriptionHandler(testProxy_);
+ std::function<void (const uint8_t&)> myCallback = std::bind(&SubscriptionHandler::myCallback, &subscriptionHandler, std::placeholders::_1);
+ //CommonAPI::Event<uint8_t>::Subscription subscribedListener =
+ testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback);
+
+ const uint8_t testNumber = 10;
+ for (uint8_t i=1; i<testNumber+1; i++) {
+ testStub_->setTestAttributeAttribute(i);
+ }
+
+ usleep(wt);
+ ASSERT_EQ(subscriptionHandler.myQueue_.size(), testNumber);
+
+ uint8_t t = 1;
+ for(std::deque<uint8_t>::iterator it = subscriptionHandler.myQueue_.begin(); it != subscriptionHandler.myQueue_.end(); ++it) {
+ EXPECT_EQ(*it, t);
+ t++;
+ }
+ runtime_->unregisterService(domain, v1_0::commonapi::communication::TestInterfaceStubDefault::StubInterface::getInterface(), testAddress);
+}
+
+/**
+ * @test Subscription test with subscription on available-event.
+ * - Subscribe for available-event.
+ * - Available-callback subscribes for TestPredefinedTypeAttribute if service is available for proxy and
+ * unsubscribes if service is not available for proxy.
+ * - Change attribute in service by set method; the new attribute value should be received by the proxy because the service is not registered.
+ * - Register service and change value again; the value should now be received.
+ * - Unregister and change value again.
+ */
+TEST_F(CMAttributeSubscription, SubscriptionOnAvailable) {
+
+ SubscriptionHandler subscriptionHandler(testProxy_);
+
+ std::function<void (CommonAPI::AvailabilityStatus)> callbackAvailabilityStatus = std::bind(&SubscriptionHandler::receiveServiceAvailable, &subscriptionHandler, std::placeholders::_1);
+ testProxy_->getProxyStatusEvent().subscribe(callbackAvailabilityStatus);
+
+ testStub_->setTestAttributeAttribute(1);
+ usleep(wt);
+ EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 0);
+
+ bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId);
+ ASSERT_TRUE(serviceRegistered);
+ usleep(wt);
+ testStub_->setTestAttributeAttribute(2);
+ usleep(wt);
+ ASSERT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 2);
+
+ bool serviceUnregistered = runtime_->unregisterService(domain, v1_0::commonapi::communication::TestInterfaceStubDefault::StubInterface::getInterface(), testAddress);
+ ASSERT_TRUE(serviceUnregistered);
+ usleep(wt);
+ ASSERT_EQ(subscriptionHandler.getAvailabilityStatus(), CommonAPI::AvailabilityStatus::NOT_AVAILABLE);
+
+ testStub_->setTestAttributeAttribute(3);
+ usleep(wt);
+ ASSERT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 2);
+}
+
+/**
+ * @test Subscription test with several threads.
+ * - Start several threads.
+ * - The threads subscribe for the availability status.
+ * - The available-callback subscribes for TestAttribute if service is available for proxy and
+ * - unsubscribes if service is not available for proxy.
+ * - Change attribute in service by set method; the new attribute value should be received by all the threads.
+ * - The new value is written into a queue.
+ * - Check if the values of each thread are written into the queue.
+ */
+TEST_F(CMAttributeSubscription, SubscriptionMultithreading) {
+
+ std::thread t0(testSubscription, testProxy_);
+ std::thread t1(testSubscription, testProxy_);
+ std::thread t2(testSubscription, testProxy_);
+ std::thread t3(testSubscription, testProxy_);
+ std::thread t4(testSubscription, testProxy_);
+ std::thread t5(testSubscription, testProxy_);
+ std::thread t6(testSubscription, testProxy_);
+ std::thread t7(testSubscription, testProxy_);
+ std::thread t8(testSubscription, testProxy_);
+ std::thread t9(testSubscription, testProxy_);
+
+ bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId);
+ ASSERT_TRUE(serviceRegistered);
+
+ usleep(wt);
+ testStub_->setTestAttributeAttribute(1);
+
+ usleep(wt);
+
+ bool serviceUnregistered = runtime_->unregisterService(domain, v1_0::commonapi::communication::TestInterfaceStubDefault::StubInterface::getInterface(), testAddress);
+ ASSERT_TRUE(serviceUnregistered);
+
+ uint32_t data = 0;
+ unsigned int cnt = 0;
+ while (cnt<10) {
+
+ std::unique_lock<std::mutex> lk(mut);
+ data_cond.wait_for(lk, std::chrono::milliseconds(2000), [] {return !data_queue.empty();});
+
+ if ( !data_queue.empty() ) {
+ data = data_queue.front();
+ data_queue.pop_front();
+ }
+ lk.unlock();
+ EXPECT_EQ(static_cast<int32_t>(data), 1);
+ cnt++;
+ }
+
+ t0.join();
+ t1.join();
+ t2.join();
+ t3.join();
+ t4.join();
+ t5.join();
+ t6.join();
+ t7.join();
+ t8.join();
+ t9.join();
+}
+
+/**
+ * @test Subscription test for cancellable callbacks.
+ * - Register service and check if proxy is available.
+ * - Proxy subscribes for TestAttribute (uint8_t) with the subscribeCancellableListener method.
+ * - Change attribute in service by set method.
+ * - Check if callback function in proxy received the right value.
+ * - Set desired subscription status to CANCEL.
+ * - Change value again; the callback should be called again but with return value CommonAPI::SubscriptionStatus::CANCEL.
+ * - Change value again; the callback should now be called anymore.
+ * - Unregister the test service.
+ */
+/* this test is no longer valid for CommonAPI 3.0.
+
+TEST_F(CMAttributeSubscription, SubscriptionCancellable) {
+
+ bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_);
+ ASSERT_TRUE(serviceRegistered);
+
+ for(unsigned int i = 0; !testProxy_->isAvailable() && i < 100; ++i) {
+ usleep(10000);
+ }
+ ASSERT_TRUE(testProxy_->isAvailable());
+
+ SubscriptionHandler subscriptionHandler(testProxy_);
+
+ std::function<CommonAPI::SubscriptionStatus (const uint8_t&)> myCallback = std::bind(&SubscriptionHandler::myCallback, &subscriptionHandler, std::placeholders::_1);
+ testProxy_->getTestAttributeAttribute().getChangedEvent().subscribeCancellableListener(myCallback);
+ subscriptionHandler.setSubscriptionStatus(CommonAPI::SubscriptionStatus::RETAIN);
+
+ testStub_->setTestAttributeAttribute(42);
+ usleep(wt);
+ EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 42);
+
+ subscriptionHandler.setSubscriptionStatus(CommonAPI::SubscriptionStatus::CANCEL);
+
+ testStub_->setTestAttributeAttribute(99);
+ usleep(wt);
+ EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 99);
+
+ testStub_->setTestAttributeAttribute(250);
+ usleep(wt);
+ EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 99);
+
+ runtime_->unregisterService(domain, v1_0::commonapi::communication::TestInterfaceStubDefault::StubInterface::getInterface(), testAddress);
+}
+*/
+/**
+ * @test Subscription test : unsibscribe from the subscription callback.
+ * - Register service and check if proxy is available.
+ * - Proxy subscribes for TestAttribute (uint8_t).
+ * - Change attribute in service by set method.
+ * - Check if callback function in proxy received the right value.
+ * - Change value to the magic value 99: this triggers the callback to unsubscribe.
+ * - Change value again; the callback should now be called anymore.
+ * - Unregister the test service.
+ */
+
+TEST_F(CMAttributeSubscription, SubscriptionUnsubscribeFromCallback) {
+
+ bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId);
+ ASSERT_TRUE(serviceRegistered);
+
+ for(unsigned int i = 0; !testProxy_->isAvailable() && i < 100; ++i) {
+ usleep(10000);
+ }
+ ASSERT_TRUE(testProxy_->isAvailable());
+
+ SubscriptionHandler subscriptionHandler(testProxy_);
+
+ std::function<void (const uint8_t&)> myCallback = std::bind(&SubscriptionHandler::myCallback, &subscriptionHandler, std::placeholders::_1);
+ subscriptionHandler.startSubscribe();
+
+ testStub_->setTestAttributeAttribute(42);
+ usleep(wt);
+ EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 42);
+
+ testStub_->setTestAttributeAttribute(99);
+ usleep(wt);
+ EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 99);
+
+ testStub_->setTestAttributeAttribute(250);
+ usleep(wt);
+ EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 99);
+
+ runtime_->unregisterService(domain, v1_0::commonapi::communication::TestInterfaceStubDefault::StubInterface::getInterface(), testAddress);
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
+ return RUN_ALL_TESTS();
+}
diff --git a/org.genivi.commonapi.core.verification/src/CMAttributes.cpp b/org.genivi.commonapi.core.verification/src/CMAttributes.cpp
new file mode 100644
index 0000000..b577770
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/CMAttributes.cpp
@@ -0,0 +1,271 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+/**
+* @file Communication
+*/
+
+#include <functional>
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <fstream>
+#include <gtest/gtest.h>
+#include "CommonAPI/CommonAPI.hpp"
+#include "v1_0/commonapi/communication/TestInterfaceProxy.hpp"
+#include "stub/CMAttributesStub.h"
+
+const std::string serviceId = "service-sample";
+const std::string clientId = "client-sample";
+
+const std::string domain = "local";
+const std::string testAddress = "commonapi.communication.TestInterface";
+const int tasync = 100000;
+
+using namespace v1_0::commonapi::communication;
+
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ }
+
+ virtual void TearDown() {
+ }
+};
+
+class CMAttributes: public ::testing::Test {
+
+public:
+ void recvValue(const CommonAPI::CallStatus& callStatus, uint8_t y) {
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ value_ = y;
+ }
+
+ void recvSubscribedValue(uint8_t y) {
+ value_ = y;
+ }
+
+protected:
+ void SetUp() {
+ runtime_ = CommonAPI::Runtime::get();
+ ASSERT_TRUE((bool)runtime_);
+ std::mutex availabilityMutex;
+ std::unique_lock<std::mutex> lock(availabilityMutex);
+ std::condition_variable cv;
+ bool proxyAvailable = false;
+
+ std::thread t1([this, &proxyAvailable, &cv, &availabilityMutex]() {
+ testProxy_ = runtime_->buildProxy<TestInterfaceProxy>(domain, testAddress, clientId);
+ testProxy_->isAvailableBlocking();
+ std::lock_guard<std::mutex> lock(availabilityMutex);
+ ASSERT_TRUE((bool)testProxy_);
+ proxyAvailable = true;
+ cv.notify_one();
+ });
+ testStub_ = std::make_shared<CMAttributesStub>();
+ bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId);
+ ASSERT_TRUE(serviceRegistered);
+
+ while(!proxyAvailable) {
+ cv.wait(lock);
+ }
+ t1.join();
+ ASSERT_TRUE(testProxy_->isAvailable());
+ }
+
+ void TearDown() {
+ bool serviceUnregistered =
+ runtime_->unregisterService(domain, CMAttributesStub::StubInterface::getInterface(),
+ testAddress);
+
+ ASSERT_TRUE(serviceUnregistered);
+ }
+
+ uint8_t value_;
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
+ std::shared_ptr<CMAttributesStub> testStub_;
+ std::shared_ptr<TestInterfaceProxy<>> testProxy_;
+};
+
+/**
+* @test Test synchronous getValue API function for attributes with combinations of
+* additional properties readonly and noSubscriptions (testAttribute,
+* testA readonly, testB noSubscriptions, testC readonly noSubscriptions).
+* - Set attribute to certain value on stub side.
+* - Call getValue.
+* - Check if returned call status is CommonAPI::CallStatus::SUCCESS.
+* - Check if value of is equal to expected value.
+*/
+TEST_F(CMAttributes, AttributeGetSynchronous) {
+
+ CommonAPI::CallStatus callStatus;
+
+ uint8_t x = 5;
+ uint8_t y = 0;
+ testStub_->setTestValues(x);
+ testProxy_->getTestAttributeAttribute().getValue(callStatus, y);
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(x, y);
+
+ x = 6;
+ y = 0;
+ testStub_->setTestValues(x);
+ testProxy_->getTestAAttribute().getValue(callStatus, y);
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(x, y);
+
+ x = 7;
+ y = 0;
+ testStub_->setTestValues(x);
+ testProxy_->getTestBAttribute().getValue(callStatus, y);
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(x, y);
+
+ x = 8;
+ y = 0;
+ testStub_->setTestValues(x);
+ testProxy_->getTestCAttribute().getValue(callStatus, y);
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(x, y);
+
+}
+
+/**
+* @test Test asynchronous getValue API function for attributes with combinations of
+* additional properties readonly and noSubscriptions (testAttribute,
+* testA readonly, testB noSubscriptions, testC readonly noSubscriptions).
+* - Set attribute to certain value on stub side.
+* - Call getValue.
+* - Check if returned call status is CommonAPI::CallStatus::SUCCESS.
+* - Check if value of is equal to expected value.
+*/
+TEST_F(CMAttributes, AttributeGetAsynchronous) {
+
+ CommonAPI::CallStatus callStatus;
+ std::function<void (const CommonAPI::CallStatus&, uint8_t)> myCallback =
+ std::bind(&CMAttributes::recvValue, this, std::placeholders::_1, std::placeholders::_2);
+
+ uint8_t x = 5;
+ testStub_->setTestValues(x);
+ testProxy_->getTestAttributeAttribute().getValueAsync(myCallback);
+ usleep(100000);
+ EXPECT_EQ(x, value_);
+
+ x = 6;
+ value_ = x;
+ testStub_->setTestValues(x);
+ testProxy_->getTestAttributeAttribute().getValueAsync(myCallback);
+ usleep(100000);
+ EXPECT_EQ(x, value_);
+
+ x = 7;
+ value_ = x;
+ testStub_->setTestValues(x);
+ testProxy_->getTestAttributeAttribute().getValueAsync(myCallback);
+ usleep(100000);
+ EXPECT_EQ(x, value_);
+
+ x = 8;
+ value_ = x;
+ testStub_->setTestValues(x);
+ testProxy_->getTestAttributeAttribute().getValueAsync(myCallback);
+ usleep(100000);
+ EXPECT_EQ(x, value_);
+}
+
+/**
+* @test Test synchronous setValue API function for attributes with combinations of
+* additional properties readonly and noSubscriptions (testAttribute, testB noSubscriptions)
+* - Set attribute to certain value on proxy side.
+* - Check if returned call status is CommonAPI::CallStatus::SUCCESS.
+* - Check if returned value of setValue is equal to expected value.
+*/
+TEST_F(CMAttributes, AttributeSetSynchronous) {
+
+ CommonAPI::CallStatus callStatus;
+
+ uint8_t x = 5;
+ uint8_t y = 0;
+ testProxy_->getTestAttributeAttribute().setValue(x, callStatus, y);
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(x, y);
+
+ x = 6;
+ y = 0;
+ testProxy_->getTestBAttribute().setValue(x, callStatus, y);
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(x, y);
+
+}
+
+/**
+* @test Test asynchronous setValue API function for attributes with combinations of
+* additional properties readonly and noSubscriptions (testAttribute, testB noSubscriptions).
+* - Set attribute to certain value on proxy side.
+* - Check if returned call status is CommonAPI::CallStatus::SUCCESS.
+* - Check if returned value of setValue is equal to expected value.
+*/
+TEST_F(CMAttributes, AttributeSetAsynchronous) {
+
+ CommonAPI::CallStatus callStatus;
+ std::function<void (const CommonAPI::CallStatus&, uint8_t)> myCallback =
+ std::bind(&CMAttributes::recvValue, this, std::placeholders::_1, std::placeholders::_2);
+
+ testStub_->setTestValues(0);
+
+ uint8_t x = 5;
+ testProxy_->getTestAttributeAttribute().setValueAsync(x, myCallback);
+ usleep(100000);
+ EXPECT_EQ(x, value_);
+
+ x = 6;
+ testProxy_->getTestBAttribute().setValueAsync(x, myCallback);
+ usleep(100000);
+ EXPECT_EQ(x, value_);
+}
+
+/**
+* @test Test subscription API function for attributes
+*
+* - Subscribe on testAttribute.
+* - Set attribute to certain value on stub side.
+* - Do checks of call status (CommonAPI::CallStatus::SUCCESS) and returned value in callback function.
+* - Checks if returned value of setValue is equal to expected value.
+* - Set attribute to certain value with synchronous call from proxy.
+* - Check again.
+*/
+TEST_F(CMAttributes, AttributeSubscription) {
+
+ CommonAPI::CallStatus callStatus;
+ std::function<void (uint8_t)> myCallback =
+ std::bind(&CMAttributes::recvSubscribedValue, this, std::placeholders::_1);
+
+ testStub_->setTestValues(0);
+
+ uint8_t y = 0;
+ uint8_t x = 5;
+
+ value_ = 0;
+
+ testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback);
+ testStub_->setTestValues(x);
+ usleep(100000);
+ EXPECT_EQ(x, value_);
+
+ x = 6;
+ testProxy_->getTestAttributeAttribute().setValue(x, callStatus, y);
+ usleep(100000);
+ EXPECT_EQ(x, value_);
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
+ return RUN_ALL_TESTS();
+}
diff --git a/org.genivi.commonapi.core.verification/src/CMMethodCalls.cpp b/org.genivi.commonapi.core.verification/src/CMMethodCalls.cpp
new file mode 100644
index 0000000..e3ac255
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/CMMethodCalls.cpp
@@ -0,0 +1,116 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+/**
+* @file Communication
+*/
+
+#include <functional>
+#include <fstream>
+#include <gtest/gtest.h>
+#include "CommonAPI/CommonAPI.hpp"
+#include "v1_0/commonapi/communication/TestInterfaceProxy.hpp"
+#include "stub/CMMethodCallsStub.h"
+
+const std::string serviceId = "service-sample";
+const std::string clientId = "client-sample";
+
+const std::string domain = "local";
+const std::string testAddress = "commonapi.communication.TestInterface";
+const int tasync = 100000;
+
+using namespace v1_0::commonapi::communication;
+
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ }
+
+ virtual void TearDown() {
+ }
+};
+
+class CMMethodCalls: public ::testing::Test {
+
+public:
+ void recvValue(const CommonAPI::CallStatus& callStatus, uint8_t y) {
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ value_ = y;
+ }
+
+protected:
+ void SetUp() {
+ runtime_ = CommonAPI::Runtime::get();
+ ASSERT_TRUE((bool)runtime_);
+
+ testStub_ = std::make_shared<CMMethodCallsStub>();
+ bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId);
+ ASSERT_TRUE(serviceRegistered);
+
+ testProxy_ = runtime_->buildProxy<TestInterfaceProxy>(domain, testAddress, clientId);
+ ASSERT_TRUE((bool)testProxy_);
+
+ testProxy_->isAvailableBlocking();
+ ASSERT_TRUE(testProxy_->isAvailable());
+ }
+
+ void TearDown() {
+ runtime_->unregisterService(domain, CMMethodCallsStub::StubInterface::getInterface(), testAddress);
+ }
+
+ uint8_t value_;
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
+ std::shared_ptr<TestInterfaceStub> testStub_;
+ std::shared_ptr<TestInterfaceProxy<>> testProxy_;
+};
+
+/**
+* @test Call test method synchronous and check call status.
+* - Test stub sets in-value of test method equal out-value of test method.
+* - Make synchronous call of test method.
+* - Check if returned call status is CommonAPI::CallStatus::SUCCESS.
+* - Check if out value of test method is equal to in value.
+*/
+TEST_F(CMMethodCalls, SynchronousMethodCall) {
+
+ uint8_t x = 5;
+ uint8_t y = 0;
+ CommonAPI::CallStatus callStatus;
+ testProxy_->testMethod(x, callStatus, y);
+
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(x, y);
+
+}
+
+/**
+* @test Call test method asynchronous and check call status.
+* - Test stub sets in-value of test method equal out-value of test method.
+* - Make asynchronous call of test method.
+* - Do checks of call status (CommonAPI::CallStatus::SUCCESS) and returned value in callback function.
+*/
+TEST_F(CMMethodCalls, AsynchronousMethodCall) {
+
+ uint8_t x = 5;
+ uint8_t y = 0;
+ CommonAPI::CallStatus callStatus;
+
+ std::function<void (const CommonAPI::CallStatus&, uint8_t)> myCallback =
+ std::bind(&CMMethodCalls::recvValue, this, std::placeholders::_1, std::placeholders::_2);
+
+ testProxy_->testMethodAsync(x, myCallback);
+ usleep(tasync);
+ EXPECT_EQ(x, value_);
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
+ return RUN_ALL_TESTS();
+}
diff --git a/org.genivi.commonapi.core.verification/src/CommunicationVerification.cpp.in b/org.genivi.commonapi.core.verification/src/CommunicationVerification.cpp.in
deleted file mode 100644
index f20300d..0000000
--- a/org.genivi.commonapi.core.verification/src/CommunicationVerification.cpp.in
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-
-/**
-* @file Communication
-*/
-
-#include <functional>
-#include <fstream>
-#include <gtest/gtest.h>
-#include "CommonAPI/CommonAPI.h"
-#include "utils/VerificationMainLoop.h"
-#include "commonapi/tests/TestInterfaceProxy.h"
-#include "utils/VerificationTestStub.h"
-
-const std::string testAddress = "local:my.test:commonapi.address";
-
-const std::string configString =
- "{binding:@BINDING_NAME@}\n"
- "libpath=@BINDING_SO@\n"
- "alias=TestAlias\n"
- "genpath=@GLUECODE_SO@\n"
- "default"
-;
-
-const std::string COMMONAPI_CONFIG_SUFFIX = ".conf";
-
-
-
-class Environment: public ::testing::Environment {
-public:
- virtual ~Environment() {
- }
-
- virtual void SetUp() {
- configFileName_ = CommonAPI::getCurrentBinaryFileFQN();
- configFileName_ += COMMONAPI_CONFIG_SUFFIX;
- std::ofstream configFile(configFileName_);
- ASSERT_TRUE(configFile.is_open());
- configFile << configString;
- configFile.close();
- }
-
- virtual void TearDown() {
- std::remove(configFileName_.c_str());
- }
-
- std::string configFileName_;
-};
-
-
-
-
-class CommunicationTest: public ::testing::Test {
-
-protected:
- void SetUp() {
- runtime_ = CommonAPI::Runtime::load();
- ASSERT_TRUE((bool)runtime_);
-
- proxyFactory_ = runtime_->createFactory();
- ASSERT_TRUE((bool)proxyFactory_);
- stubFactory_ = runtime_->createFactory();
- ASSERT_TRUE((bool)stubFactory_);
-
- servicePublisher_ = runtime_->getServicePublisher();
- ASSERT_TRUE((bool)servicePublisher_);
- }
-
- void TearDown() {
- usleep(30000);
- }
-
- std::string configFileName_;
- std::shared_ptr<CommonAPI::Runtime> runtime_;
- std::shared_ptr<CommonAPI::Factory> proxyFactory_;
- std::shared_ptr<CommonAPI::Factory> stubFactory_;
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher_;
-};
-
-/**
-* @test Builds proxy, registers service, checks if proxy is available, calls test method, checks call status, unregisters service.
-* - Calls proxyFactory_->buildProxy(...) and checks if return value is true.
-* - Calls servicePublisher_->registerService(...) and checks if return value is true (max. 100 tries every 10 ms).
-* - Checks if proxy is available (max. 100 tries every 10 ms).
-* - Calls test method and checks if returned call status is CommonAPI::CallStatus::SUCCESS.
-* - Unregisters the test service.
-*/
-TEST_F(CommunicationTest, RemoteMethodCallSucceeds) {
- auto defaultTestProxy = proxyFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(testAddress);
- ASSERT_TRUE((bool)defaultTestProxy);
-
- auto stub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
-
- bool serviceRegistered = servicePublisher_->registerService(stub, testAddress, stubFactory_);
- for(unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = servicePublisher_->registerService(stub, testAddress, stubFactory_);
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
-
- for(unsigned int i = 0; !defaultTestProxy->isAvailable() && i < 100; ++i) {
- usleep(10000);
- }
- ASSERT_TRUE(defaultTestProxy->isAvailable());
-
- uint32_t v1 = 5;
- std::string v2 = "Ciao ;)";
- CommonAPI::CallStatus stat;
- defaultTestProxy->testVoidPredefinedTypeMethod(v1, v2, stat);
-
- EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
-
- servicePublisher_->unregisterService(testAddress);
-}
-
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- ::testing::AddGlobalTestEnvironment(new Environment());
- return RUN_ALL_TESTS();
-}
diff --git a/org.genivi.commonapi.core.verification/src/DTAdvanced.cpp b/org.genivi.commonapi.core.verification/src/DTAdvanced.cpp
new file mode 100644
index 0000000..52b6451
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/DTAdvanced.cpp
@@ -0,0 +1,300 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+/**
+* @file DataTypes
+*/
+
+#include <functional>
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <fstream>
+#include <gtest/gtest.h>
+#include "CommonAPI/CommonAPI.hpp"
+
+#include "v1_0/commonapi/datatypes/advanced/TestInterfaceProxy.hpp"
+#include "stub/DTAdvancedStub.h"
+
+const std::string domain = "local";
+const std::string testAddress = "commonapi.datatypes.advanced.TestInterface";
+const std::string connectionIdService = "service-sample";
+const std::string connectionIdClient = "client-sample";
+
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ }
+
+ virtual void TearDown() {
+ }
+};
+
+class DTAdvanced: public ::testing::Test {
+
+protected:
+ void SetUp() {
+ runtime_ = CommonAPI::Runtime::get();
+ ASSERT_TRUE((bool)runtime_);
+ std::mutex availabilityMutex;
+ std::unique_lock<std::mutex> lock(availabilityMutex);
+ std::condition_variable cv;
+ bool proxyAvailable = false;
+
+ std::thread t1([this, &proxyAvailable, &cv, &availabilityMutex]() {
+ testProxy_ = runtime_->buildProxy<v1_0::commonapi::datatypes::advanced::TestInterfaceProxy>(domain, testAddress, connectionIdClient);
+ testProxy_->isAvailableBlocking();
+ std::lock_guard<std::mutex> lock(availabilityMutex);
+ ASSERT_TRUE((bool)testProxy_);
+ proxyAvailable = true;
+ cv.notify_one();
+ });
+
+ testStub_ = std::make_shared<v1_0::commonapi::datatypes::advanced::DTAdvancedStub>();
+ serviceRegistered_ = runtime_->registerService(domain, testAddress, testStub_, connectionIdService);
+ ASSERT_TRUE(serviceRegistered_);
+
+ while(!proxyAvailable) {
+ cv.wait(lock);
+ }
+ t1.join();
+ ASSERT_TRUE(testProxy_->isAvailable());
+ }
+
+ void TearDown() {
+ ASSERT_TRUE(runtime_->unregisterService(domain, v1_0::commonapi::datatypes::advanced::DTAdvancedStub::StubInterface::getInterface(), testAddress));
+ }
+
+ bool received_;
+ bool serviceRegistered_;
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
+
+ std::shared_ptr<v1_0::commonapi::datatypes::advanced::TestInterfaceProxy<>> testProxy_;
+ std::shared_ptr<v1_0::commonapi::datatypes::advanced::DTAdvancedStub> testStub_;
+};
+
+/*
+* @test Test function call with advanced types
+* - Advanced types are: arrays, enumerations, structs, unions, maps, typedefs
+* - Function call of a function that has for each advanced type one argument (test values) and one return value
+* - The stub copies the test values to the return values
+* - On client side the test values are compared with the return values
+*/
+TEST_F(DTAdvanced, SendAndReceive) {
+
+ CommonAPI::CallStatus callStatus;
+
+ v1_0::commonapi::datatypes::advanced::TestInterface::tArray arrayTestValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tEnumeration enumerationTestValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tStruct structTestValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tUnion unionTestValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tMap mapTestValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tTypedef typedefTestValue;
+
+ arrayTestValue.push_back("Test1");
+ arrayTestValue.push_back("Test2");
+ arrayTestValue.push_back("Test3");
+
+ enumerationTestValue = v1_0::commonapi::datatypes::advanced::TestInterface::tEnumeration::VALUE2;
+
+ structTestValue.setBooleanMember(true);
+ structTestValue.setUint8Member(42);
+ structTestValue.setStringMember("Hello World");
+
+ uint8_t u = 53;
+ unionTestValue = u;
+
+ mapTestValue[1] = "Hello";
+ mapTestValue[2] = "World";
+
+ typedefTestValue = 64;
+
+ v1_0::commonapi::datatypes::advanced::TestInterface::tArray arrayResultValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tEnumeration enumerationResultValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tStruct structResultValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tUnion unionResultValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tMap mapResultValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tTypedef typedefResultValue;
+
+ testProxy_->fTest(
+ arrayTestValue,
+ enumerationTestValue,
+ structTestValue,
+ unionTestValue,
+ mapTestValue,
+ typedefTestValue,
+ callStatus,
+ arrayResultValue,
+ enumerationResultValue,
+ structResultValue,
+ unionResultValue,
+ mapResultValue,
+ typedefResultValue
+ );
+
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(arrayTestValue, arrayResultValue);
+ EXPECT_EQ(enumerationTestValue, enumerationResultValue);
+ EXPECT_EQ(structTestValue, structResultValue);
+ EXPECT_EQ(unionTestValue, unionResultValue);
+ EXPECT_EQ(mapTestValue, mapResultValue);
+ EXPECT_EQ(typedefTestValue, typedefResultValue);
+}
+
+/**
+* @test Test attribute functions with advanced types
+* - Call set function of attributes with advanced types
+* - Call get function and check if the return value is the same
+*/
+TEST_F(DTAdvanced, AttributeSet) {
+
+ CommonAPI::CallStatus callStatus;
+
+ v1_0::commonapi::datatypes::advanced::TestInterface::tArray arrayTestValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tEnumeration enumerationTestValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tStruct structTestValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tUnion unionTestValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tMap mapTestValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tTypedef typedefTestValue;
+
+ arrayTestValue.push_back("Test1");
+ arrayTestValue.push_back("Test2");
+ arrayTestValue.push_back("Test3");
+
+ enumerationTestValue = v1_0::commonapi::datatypes::advanced::TestInterface::tEnumeration::VALUE2;
+
+ structTestValue.setBooleanMember(true);
+ structTestValue.setUint8Member(42);
+ structTestValue.setStringMember("Hello World");
+
+ uint8_t u = 53;
+ unionTestValue = u;
+
+ mapTestValue[1] = "Hello";
+ mapTestValue[2] = "World";
+
+ typedefTestValue = 64;
+
+ v1_0::commonapi::datatypes::advanced::TestInterface::tArray arrayResultValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tEnumeration enumerationResultValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tStruct structResultValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tUnion unionResultValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tMap mapResultValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tTypedef typedefResultValue;
+
+ testProxy_->getAArrayAttribute().setValue(arrayTestValue, callStatus, arrayResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(arrayTestValue, arrayResultValue);
+
+ testProxy_->getAEnumerationAttribute().setValue(enumerationTestValue, callStatus, enumerationResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(enumerationTestValue, enumerationResultValue);
+
+ testProxy_->getAStructAttribute().setValue(structTestValue, callStatus, structResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(structTestValue, structResultValue);
+
+ testProxy_->getAUnionAttribute().setValue(unionTestValue, callStatus, unionResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(unionTestValue, unionResultValue);
+
+ testProxy_->getAMapAttribute().setValue(mapTestValue, callStatus, mapResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(mapTestValue, mapResultValue);
+
+ testProxy_->getATypedefAttribute().setValue(typedefTestValue, callStatus, typedefResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(typedefTestValue, typedefResultValue);
+}
+
+/**
+* @test Test broadcast with advanced types
+* - Subscribe to broadcast which contains advanced types
+* - Call function to cause the stub to fire broadcast event with the same content
+* - Check if the values in the callback function are as expected
+*/
+TEST_F(DTAdvanced, BroadcastReceive) {
+
+ CommonAPI::CallStatus callStatus;
+
+ v1_0::commonapi::datatypes::advanced::TestInterface::tArray arrayTestValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tEnumeration enumerationTestValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tStruct structTestValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tUnion unionTestValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tMap mapTestValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tTypedef typedefTestValue;
+
+ arrayTestValue.push_back("Test1");
+ arrayTestValue.push_back("Test2");
+ arrayTestValue.push_back("Test3");
+
+ enumerationTestValue = v1_0::commonapi::datatypes::advanced::TestInterface::tEnumeration::VALUE2;
+
+ structTestValue.setBooleanMember(true);
+ structTestValue.setUint8Member(42);
+ structTestValue.setStringMember("Hello World");
+
+ uint8_t u = 53;
+ unionTestValue = u;
+
+ mapTestValue[1] = "Hello";
+ mapTestValue[2] = "World";
+
+ typedefTestValue = 64;
+
+ v1_0::commonapi::datatypes::advanced::TestInterface::tArray arrayResultValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tEnumeration enumerationResultValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tStruct structResultValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tUnion unionResultValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tMap mapResultValue;
+ v1_0::commonapi::datatypes::advanced::TestInterface::tTypedef typedefResultValue;
+
+ received_ = false;
+ testProxy_->getBTestEvent().subscribe([&](
+ const v1_0::commonapi::datatypes::advanced::TestInterface::tArray& arrayResultValue,
+ const v1_0::commonapi::datatypes::advanced::TestInterface::tEnumeration& enumerationResultValue,
+ const v1_0::commonapi::datatypes::advanced::TestInterface::tStruct& structResultValue,
+ const v1_0::commonapi::datatypes::advanced::TestInterface::tUnion& unionResultValue,
+ const v1_0::commonapi::datatypes::advanced::TestInterface::tMap& mapResultValue,
+ const v1_0::commonapi::datatypes::advanced::TestInterface::tTypedef& typedefResultValue
+ ) {
+ received_ = true;
+ EXPECT_EQ(arrayTestValue, arrayResultValue);
+ EXPECT_EQ(enumerationTestValue, enumerationResultValue);
+ EXPECT_EQ(structTestValue, structResultValue);
+ EXPECT_EQ(unionTestValue, unionResultValue);
+ EXPECT_EQ(mapTestValue, mapResultValue);
+ EXPECT_EQ(typedefTestValue, typedefResultValue);
+ });
+
+ testProxy_->fTest(
+ arrayTestValue,
+ enumerationTestValue,
+ structTestValue,
+ unionTestValue,
+ mapTestValue,
+ typedefTestValue,
+ callStatus,
+ arrayResultValue,
+ enumerationResultValue,
+ structResultValue,
+ unionResultValue,
+ mapResultValue,
+ typedefResultValue
+ );
+
+ usleep(100000);
+ ASSERT_TRUE(received_);
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
+ return RUN_ALL_TESTS();
+}
diff --git a/org.genivi.commonapi.core.verification/src/DTCombined.cpp b/org.genivi.commonapi.core.verification/src/DTCombined.cpp
new file mode 100644
index 0000000..08eead6
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/DTCombined.cpp
@@ -0,0 +1,232 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+/**
+* @file DataTypes
+*/
+
+#include <functional>
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <fstream>
+#include <gtest/gtest.h>
+#include "CommonAPI/CommonAPI.hpp"
+
+#include "v1_0/commonapi/datatypes/combined/TestInterfaceProxy.hpp"
+#include "stub/DTCombinedStub.h"
+
+const std::string domain = "local";
+const std::string testAddress = "commonapi.datatypes.combined.TestInterface";
+const std::string connectionIdService = "service-sample";
+const std::string connectionIdClient = "client-sample";
+
+using namespace v1_0::commonapi::datatypes::combined;
+
+class DTCombinedStub : public TestInterfaceStubDefault {
+
+public:
+ DTCombinedStub() {};
+ virtual ~DTCombinedStub() {};
+
+ void fTest(const std::shared_ptr<CommonAPI::ClientId> clientId,
+ TestInterface::tStructL3 tStructL3In,
+ TestInterface::tStructL3& tStructL3Out) {
+
+ tStructL3Out = tStructL3In;
+ }
+
+};
+
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+
+ }
+
+ virtual void TearDown() {
+ }
+};
+
+class DTCombined: public ::testing::Test {
+
+protected:
+ void SetUp() {
+ runtime_ = CommonAPI::Runtime::get();
+ ASSERT_TRUE((bool)runtime_);
+ std::mutex availabilityMutex;
+ std::unique_lock<std::mutex> lock(availabilityMutex);
+ std::condition_variable cv;
+ bool proxyAvailable = false;
+
+ std::thread t1([this, &proxyAvailable, &cv, &availabilityMutex]() {
+ testProxy_ = runtime_->buildProxy<v1_0::commonapi::datatypes::combined::TestInterfaceProxy>(domain, testAddress, connectionIdClient);
+ testProxy_->isAvailableBlocking();
+ std::lock_guard<std::mutex> lock(availabilityMutex);
+ ASSERT_TRUE((bool)testProxy_);
+ proxyAvailable = true;
+ cv.notify_one();
+ });
+
+ testStub_ = std::make_shared<v1_0::commonapi::datatypes::combined::DTCombinedStub>();
+ serviceRegistered_ = runtime_->registerService(domain, testAddress, testStub_, connectionIdService);
+ ASSERT_TRUE(serviceRegistered_);
+
+ while(!proxyAvailable) {
+ cv.wait(lock);
+ }
+ t1.join();
+ ASSERT_TRUE(testProxy_->isAvailable());
+ }
+
+ void TearDown() {
+ ASSERT_TRUE(runtime_->unregisterService(domain, v1_0::commonapi::datatypes::combined::TestInterfaceStub::StubInterface::getInterface(), testAddress));
+ }
+
+ bool serviceRegistered_;
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
+
+ std::shared_ptr<v1_0::commonapi::datatypes::combined::TestInterfaceProxy<>> testProxy_;
+ std::shared_ptr<v1_0::commonapi::datatypes::combined::DTCombinedStub> testStub_;
+};
+
+/**
+* @test Test function call with combined type
+* - The combined type is one structure with combinations of advanced and primitive types
+* - Function call of a function that has for each advanced type one argument (test values) and one return value
+* - The stub copies the test values to the return values
+* - On client side the test values are compared with the return values
+*/
+TEST_F(DTCombined, SendAndReceive) {
+
+ CommonAPI::CallStatus callStatus;
+
+ // TestValue is TV; start with Level0
+ TestInterface::tEnum enumTV0 = TestInterface::tEnum::VALUE1;
+ TestInterface::tEnum enumTV1 = TestInterface::tEnum::VALUE2;
+ TestInterface::tArray arrayTV0 = {"Test1", "Test2", "Test3"};
+ TestInterface::tArray arrayTV1 = {"Test4", "Test5", "Test6"};
+ TestInterface::tArray arrayTV2 = {"Test7", "Test8", "Test9"};
+ TestInterface::tStruct structTV0 = {true, 42, "Hello World", TestInterface::tEnum::VALUE1};
+ TestInterface::tStruct structTV1 = {false, 53, "ABC", TestInterface::tEnum::VALUE2};
+ TestInterface::tUnion unionTV0 = true;
+ TestInterface::tUnion unionTV1 = (uint8_t)42;
+ TestInterface::tUnion unionTV2 = std::string("Hello World");
+ TestInterface::tUnion unionTV3 = TestInterface::tEnum::VALUE1;
+ TestInterface::tMap mapTV0 = {{1, "Hello"}, {2, "World"}};
+ TestInterface::tMap mapTV1 = {{123, "ABC"}, {456, "DEF"}};
+
+ // Level1
+ TestInterface::tArrayEnum arrayEnumTV0 = {enumTV0, enumTV1, enumTV0};
+ TestInterface::tArrayEnum arrayEnumTV1 = {enumTV1, enumTV0, enumTV1};
+ TestInterface::tArrayEnum arrayEnumTV2 = {enumTV0, enumTV0, enumTV0};
+ TestInterface::tArrayArray arrayArrayTV0 = {arrayTV0, arrayTV1, arrayTV2};
+ TestInterface::tArrayArray arrayArrayTV1 = {arrayTV1, arrayTV2};
+ TestInterface::tArrayStruct arrayStructTV0 = {structTV0, structTV0};
+ TestInterface::tArrayStruct arrayStructTV1 = {structTV1, structTV1};
+ TestInterface::tArrayStruct arrayStructTV2 = {structTV0, structTV1};
+ TestInterface::tArrayStruct arrayStructTV3 = {structTV1, structTV0};
+ TestInterface::tArrayUnion arrayUnionTV0 = {unionTV0, unionTV1, unionTV2, unionTV3};
+ TestInterface::tArrayMap arrayMapTV0 = {mapTV0, mapTV1};
+ TestInterface::tArrayMap arrayMapTV1 = {mapTV1, mapTV0};
+
+ TestInterface::tStructL1 structL1TV0 = {enumTV0, arrayTV0, structTV0, unionTV0, mapTV0};
+ TestInterface::tStructL1 structL1TV1 = {enumTV1, arrayTV1, structTV1, unionTV1, mapTV1};
+
+ TestInterface::tUnionL1 unionL1TV0 = enumTV0;
+ TestInterface::tUnionL1 unionL1TV1 = arrayTV0;
+ TestInterface::tUnionL1 unionL1TV2 = structTV0;
+ TestInterface::tUnionL1 unionL1TV3 = unionTV0;
+ TestInterface::tUnionL1 unionL1TV4 = mapTV0;
+
+ TestInterface::tMapEnum mapEnumTV0 = {{1, TestInterface::tEnum::VALUE1}, {2, TestInterface::tEnum::VALUE2}};
+ TestInterface::tMapEnum mapEnumTV1 = {{123, TestInterface::tEnum::VALUE2}, {456, TestInterface::tEnum::VALUE1}};
+ TestInterface::tMapArray mapArrayTV0 = {{123456789, arrayTV0}, {987654321, arrayTV1}};
+ TestInterface::tMapStruct mapStructTV0 = {{"Hello", structTV0}};
+ TestInterface::tMapStruct mapStructTV1 = {{"Hello", structTV0}, {"World", structTV1}};
+ TestInterface::tMapStruct mapStructTV2 = {{"Hello", structTV0}, {"World", structTV1}, {"JG", structTV0}};
+ TestInterface::tMapUnion mapUnionTV0 = {{1.23456789, unionTV2}, {9.87654321, unionTV3}};
+ TestInterface::tMapUnion mapUnionTV1 = {{3.123, unionTV0}, {0.111111, unionTV1}};
+ TestInterface::tMapMap mapMapTV0 = {{-1, mapTV0}, {-2, mapTV1}};
+
+
+ // Level2
+ TestInterface::tArrayArrayEnum arrayArrayEnumTV = {arrayEnumTV0, arrayEnumTV1, arrayEnumTV2};
+ TestInterface::tArrayArrayArray arrayArrayArrayTV = {arrayArrayTV0, arrayArrayTV1};
+ TestInterface::tArrayArrayStruct arrayArrayStructTV = {arrayStructTV0, arrayStructTV1, arrayStructTV2, arrayStructTV3};
+ TestInterface::tArrayArrayUnion arrayArrayUnionTV = {arrayUnionTV0};
+ TestInterface::tArrayArrayMap arrayArrayMapTV = {arrayMapTV0, arrayMapTV1};
+ TestInterface::tArrayStructL1 arrayStructL1TV = {structL1TV0, structL1TV1};
+ TestInterface::tArrayUnionL1 arrayUnionL1TV = {unionL1TV0, unionL1TV1, unionL1TV2, unionL1TV3, unionL1TV4};
+ TestInterface::tArrayMapEnum arrayMapEnumTV = {mapEnumTV0, mapEnumTV1};
+ TestInterface::tArrayMapArray arrayMapArrayTV = {mapArrayTV0};
+ TestInterface::tArrayMapStruct arrayMapStructTV = {mapStructTV0, mapStructTV1, mapStructTV2};
+ TestInterface::tArrayMapUnion arrayMapUnionTV = {mapUnionTV0, mapUnionTV1};
+ TestInterface::tArrayMapMap arrayMapMapTV = {mapMapTV0};
+
+ TestInterface::tStructL2 structL2TV = {arrayEnumTV0, arrayArrayTV0, arrayStructTV0, arrayUnionTV0, arrayMapTV0,
+ structL1TV0, unionL1TV0, mapEnumTV0, mapArrayTV0, mapStructTV0, mapUnionTV0, mapMapTV0};
+
+ //TestInterface::tUnionL2 unionL2TV = arrayEnumTV0;
+
+ TestInterface::tMapArrayEnum mapArrayEnumTV = {{"A", arrayEnumTV0}, {"B", arrayEnumTV1}, {"C", arrayEnumTV1}};
+ TestInterface::tMapArrayArray mapArrayArrayTV = {{"ABCDEFGHIJK", arrayArrayTV0}, {"LMNOPQRST", arrayArrayTV1}};
+ TestInterface::tMapArrayStruct mapArrayStructTV = {{"Z", arrayStructTV3}, {"Y", arrayStructTV2}, {"X", arrayStructTV1}, {"W", arrayStructTV0}};
+ TestInterface::tMapArrayUnion mapArrayUnionTV = {{"JG", arrayUnionTV0}};
+ TestInterface::tMapArrayMap mapArrayMapTV = {{"0x1", arrayMapTV0}, {"0x2", arrayMapTV0}};
+ TestInterface::tMapStructL1 mapStructL1TV = {{"Hello", structL1TV0}, {"World", structL1TV1}};
+ TestInterface::tMapUnionL1 mapUnionL1TV = {{"A", unionL1TV0}, {"B", unionL1TV1}, {"C", unionL1TV2}, {"D", unionL1TV3}, {"E", unionL1TV4}};
+ TestInterface::tMapMapEnum mapMapEnumTV = {{"Hello", mapEnumTV0}, {"World", mapEnumTV1}};
+ TestInterface::tMapMapArray mapMapArrayTV = {{"JG", mapArrayTV0}};
+ TestInterface::tMapMapStruct mapMapStructTV = {{"AA", mapStructTV0}, {"BB", mapStructTV1}, {"CC", mapStructTV2}};
+ TestInterface::tMapMapUnion mapMapUnionTV = {{"Hello", mapUnionTV0}, {"World", mapUnionTV1}};
+ TestInterface::tMapMapMap mapMapMapTV = {{"ABCDEFGHI", mapMapTV0}};
+
+ TestInterface::tStructL3 tStructL3TV = {
+ arrayArrayEnumTV,
+ arrayArrayArrayTV,
+ arrayArrayStructTV,
+ arrayArrayUnionTV,
+ arrayArrayMapTV,
+ arrayStructL1TV,
+ //arrayUnionL1TV,
+ //arrayMapEnumTV,
+ //arrayMapArrayTV,
+ //arrayMapStructTV,
+ //arrayMapUnionTV,
+ //arrayMapMapTV,
+ structL2TV,
+ //tUnionL2TV,
+ mapArrayEnumTV,
+ mapArrayArrayTV,
+ mapArrayStructTV,
+ mapArrayUnionTV,
+ mapArrayMapTV,
+ //mapStructL1TV,
+ mapUnionL1TV,
+ mapMapEnumTV,
+ mapMapArrayTV,
+ mapMapStructTV,
+ mapMapUnionTV,
+ mapMapMapTV
+ };
+
+ TestInterface::tStructL3 tStructL3RV;
+
+ testProxy_->fTest(tStructL3TV, callStatus, tStructL3RV);
+
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(tStructL3TV, tStructL3RV);
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
+ return RUN_ALL_TESTS();
+}
diff --git a/org.genivi.commonapi.core.verification/src/DTDerived.cpp b/org.genivi.commonapi.core.verification/src/DTDerived.cpp
new file mode 100644
index 0000000..bbb1785
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/DTDerived.cpp
@@ -0,0 +1,259 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+/**
+* @file DataTypes
+*/
+
+#include <functional>
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <fstream>
+#include <gtest/gtest.h>
+#include "CommonAPI/CommonAPI.hpp"
+
+#include "v1_0/commonapi/datatypes/derived/TestInterfaceProxy.hpp"
+#include "stub/DTDerivedStub.h"
+
+const std::string domain = "local";
+const std::string testAddress = "commonapi.datatypes.derived.TestInterface";
+const std::string connectionId_client = "client-sample";
+const std::string connectionId_service = "service-sample";
+
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ }
+
+ virtual void TearDown() {
+ }
+};
+
+class DTDerived: public ::testing::Test {
+
+protected:
+ void SetUp() {
+ runtime_ = CommonAPI::Runtime::get();
+ ASSERT_TRUE((bool)runtime_);
+ std::mutex availabilityMutex;
+ std::unique_lock<std::mutex> lock(availabilityMutex);
+ std::condition_variable cv;
+ bool proxyAvailable = false;
+
+ std::thread t1([this, &proxyAvailable, &cv, &availabilityMutex]() {
+ testProxy_ = runtime_->buildProxy<v1_0::commonapi::datatypes::derived::TestInterfaceProxy>(domain, testAddress, connectionId_client);
+ testProxy_->isAvailableBlocking();
+ std::lock_guard<std::mutex> lock(availabilityMutex);
+ ASSERT_TRUE((bool)testProxy_);
+ proxyAvailable = true;
+ cv.notify_one();
+ });
+
+ testStub_ = std::make_shared<v1_0::commonapi::datatypes::derived::DTDerivedStub>();
+ serviceRegistered_ = runtime_->registerService(domain, testAddress, testStub_, connectionId_service);
+ ASSERT_TRUE(serviceRegistered_);
+
+ while(!proxyAvailable) {
+ cv.wait(lock);
+ }
+ t1.join();
+ ASSERT_TRUE(testProxy_->isAvailable());
+ }
+
+ void TearDown() {
+ runtime_->unregisterService(domain, v1_0::commonapi::datatypes::derived::DTDerivedStub::StubInterface::getInterface(), testAddress);
+ }
+
+ bool received_;
+ bool serviceRegistered_;
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
+
+ std::shared_ptr<v1_0::commonapi::datatypes::derived::TestInterfaceProxy<>> testProxy_;
+ std::shared_ptr<v1_0::commonapi::datatypes::derived::DTDerivedStub> testStub_;
+
+};
+
+/*
+* @test Test function call with derived types
+* - Derived types are: extended struct, extended enumeration, extended union, polymorphic struct
+* - Function call of a function that has for each derived type one argument (test values) and one return value
+* - The stub copies the test values to the return values
+* - On client side the test values are compared with the return values
+*/
+TEST_F(DTDerived, SendAndReceive) {
+
+ CommonAPI::CallStatus callStatus;
+
+ v1_0::commonapi::datatypes::derived::TestInterface::tStructExt structExtTestValue;
+ v1_0::commonapi::datatypes::derived::TestInterface::tEnumExt enumExtTestValue;
+ v1_0::commonapi::datatypes::derived::TestInterface::tUnionExt unionExtTestValue;
+ std::shared_ptr<v1_0::commonapi::datatypes::derived::TestInterface::tBaseStruct> baseStructTestValue;
+
+ structExtTestValue.setBaseMember(42);
+ structExtTestValue.setExtendedMember("Hello World");
+
+ enumExtTestValue = v1_0::commonapi::datatypes::derived::TestInterface::tEnumExt::VALUE2;
+
+ std::string u = "Hello World";
+ unionExtTestValue = u;
+
+ std::shared_ptr<v1_0::commonapi::datatypes::derived::TestInterface::tBaseTwoStruct> l_two = std::make_shared<v1_0::commonapi::datatypes::derived::TestInterface::tBaseTwoStruct>();
+ l_two->setName("ABC");
+ baseStructTestValue = l_two;
+
+ v1_0::commonapi::datatypes::derived::TestInterface::tStructExt structExtResultValue;
+ v1_0::commonapi::datatypes::derived::TestInterface::tEnumExt enumExtResultValue;
+ v1_0::commonapi::datatypes::derived::TestInterface::tUnionExt unionExtResultValue;
+ std::shared_ptr<v1_0::commonapi::datatypes::derived::TestInterface::tBaseStruct> baseStructResultValue;
+
+ testProxy_->fTest(
+ structExtTestValue,
+ enumExtTestValue,
+ unionExtTestValue,
+ baseStructTestValue,
+ callStatus,
+ structExtResultValue,
+ enumExtResultValue,
+ unionExtResultValue,
+ baseStructResultValue
+ );
+
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(structExtTestValue, structExtResultValue);
+ EXPECT_EQ(enumExtTestValue, enumExtResultValue);
+ EXPECT_EQ(unionExtTestValue, unionExtResultValue);
+
+ std::shared_ptr<v1_0::commonapi::datatypes::derived::TestInterface::tBaseTwoStruct> l_twoResult =
+ std::dynamic_pointer_cast<v1_0::commonapi::datatypes::derived::TestInterface::tBaseTwoStruct>(baseStructResultValue);
+ EXPECT_EQ(l_twoResult->getName(), "ABC");
+}
+
+/**
+* @test Test attribute functions with derived types
+* - Call set function of attributes with derived types
+* - Call get function and check if the return value is the same
+*/
+TEST_F(DTDerived, AttributeSet) {
+
+ CommonAPI::CallStatus callStatus;
+
+ v1_0::commonapi::datatypes::derived::TestInterface::tStructExt structExtTestValue;
+ v1_0::commonapi::datatypes::derived::TestInterface::tEnumExt enumExtTestValue;
+ v1_0::commonapi::datatypes::derived::TestInterface::tUnionExt unionExtTestValue;
+ std::shared_ptr<v1_0::commonapi::datatypes::derived::TestInterface::tBaseStruct> baseStructTestValue;
+
+ structExtTestValue.setBaseMember(42);
+ structExtTestValue.setExtendedMember("Hello World");
+
+ enumExtTestValue = v1_0::commonapi::datatypes::derived::TestInterface::tEnumExt::VALUE2;
+
+ std::string u = "Hello World";
+ unionExtTestValue = u;
+
+ std::shared_ptr<v1_0::commonapi::datatypes::derived::TestInterface::tBaseTwoStruct> l_two = std::make_shared<v1_0::commonapi::datatypes::derived::TestInterface::tBaseTwoStruct>();
+ l_two->setName("ABC");
+ baseStructTestValue = l_two;
+
+ v1_0::commonapi::datatypes::derived::TestInterface::tStructExt structExtResultValue;
+ v1_0::commonapi::datatypes::derived::TestInterface::tEnumExt enumExtResultValue;
+ v1_0::commonapi::datatypes::derived::TestInterface::tUnionExt unionExtResultValue;
+ std::shared_ptr<v1_0::commonapi::datatypes::derived::TestInterface::tBaseStruct> baseStructResultValue;
+
+ testProxy_->getAStructExtAttribute().setValue(structExtTestValue, callStatus, structExtResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(structExtTestValue, structExtResultValue);
+
+ testProxy_->getAEnumExtAttribute().setValue(enumExtTestValue, callStatus, enumExtResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(enumExtTestValue, enumExtResultValue);
+
+ testProxy_->getAUnionExtAttribute().setValue(unionExtTestValue, callStatus, unionExtResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(unionExtTestValue, unionExtResultValue);
+
+ testProxy_->getABaseStructAttribute().setValue(baseStructTestValue, callStatus, baseStructResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+
+ std::shared_ptr<v1_0::commonapi::datatypes::derived::TestInterface::tBaseTwoStruct> l_twoResult =
+ std::dynamic_pointer_cast<v1_0::commonapi::datatypes::derived::TestInterface::tBaseTwoStruct>(baseStructResultValue);
+ EXPECT_EQ(l_twoResult->getName(), "ABC");
+
+}
+
+/**
+* @test Test broadcast with derived types
+* - Subscribe to broadcast which contains derived types
+* - Call function to cause the stub to fire broadcast event with the same content
+* - Check if the values in the callback function are as expected
+*/
+TEST_F(DTDerived, BroadcastReceive) {
+
+ CommonAPI::CallStatus callStatus;
+
+ v1_0::commonapi::datatypes::derived::TestInterface::tStructExt structExtTestValue;
+ v1_0::commonapi::datatypes::derived::TestInterface::tEnumExt enumExtTestValue;
+ v1_0::commonapi::datatypes::derived::TestInterface::tUnionExt unionExtTestValue;
+ std::shared_ptr<v1_0::commonapi::datatypes::derived::TestInterface::tBaseStruct> baseStructTestValue;
+
+ structExtTestValue.setBaseMember(42);
+ structExtTestValue.setExtendedMember("Hello World");
+
+ enumExtTestValue = v1_0::commonapi::datatypes::derived::TestInterface::tEnumExt::VALUE2;
+
+ std::string u = "Hello World";
+ unionExtTestValue = u;
+
+ std::shared_ptr<v1_0::commonapi::datatypes::derived::TestInterface::tBaseTwoStruct> l_two = std::make_shared<v1_0::commonapi::datatypes::derived::TestInterface::tBaseTwoStruct>();
+ l_two->setName("ABC");
+ baseStructTestValue = l_two;
+
+ v1_0::commonapi::datatypes::derived::TestInterface::tStructExt structExtResultValue;
+ v1_0::commonapi::datatypes::derived::TestInterface::tEnumExt enumExtResultValue;
+ v1_0::commonapi::datatypes::derived::TestInterface::tUnionExt unionExtResultValue;
+ std::shared_ptr<v1_0::commonapi::datatypes::derived::TestInterface::tBaseStruct> baseStructResultValue;
+
+ received_ = false;
+ testProxy_->getBTestEvent().subscribe([&](
+ const v1_0::commonapi::datatypes::derived::TestInterface::tStructExt& structExtResultValue,
+ const v1_0::commonapi::datatypes::derived::TestInterface::tEnumExt& enumExtResultValue,
+ const v1_0::commonapi::datatypes::derived::TestInterface::tUnionExt& unionExtResultValue,
+ const std::shared_ptr<v1_0::commonapi::datatypes::derived::TestInterface::tBaseStruct>& baseStructResultValue
+ ) {
+ received_ = true;
+ EXPECT_EQ(structExtTestValue, structExtResultValue);
+ EXPECT_EQ(enumExtTestValue, enumExtResultValue);
+ EXPECT_EQ(unionExtTestValue, unionExtResultValue);
+
+ std::shared_ptr<v1_0::commonapi::datatypes::derived::TestInterface::tBaseTwoStruct> l_twoResult =
+ std::dynamic_pointer_cast<v1_0::commonapi::datatypes::derived::TestInterface::tBaseTwoStruct>(baseStructResultValue);
+ EXPECT_EQ(l_twoResult->getName(), "ABC");
+ });
+
+ testProxy_->fTest(
+ structExtTestValue,
+ enumExtTestValue,
+ unionExtTestValue,
+ baseStructTestValue,
+ callStatus,
+ structExtResultValue,
+ enumExtResultValue,
+ unionExtResultValue,
+ baseStructResultValue
+ );
+
+ usleep(100000);
+ ASSERT_TRUE(received_);
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
+ return RUN_ALL_TESTS();
+}
diff --git a/org.genivi.commonapi.core.verification/src/DTPrimitive.cpp b/org.genivi.commonapi.core.verification/src/DTPrimitive.cpp
new file mode 100644
index 0000000..3091b3f
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/DTPrimitive.cpp
@@ -0,0 +1,355 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+/**
+* @file DataTypes
+*/
+
+#include <functional>
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <fstream>
+#include <gtest/gtest.h>
+#include "CommonAPI/CommonAPI.hpp"
+
+#include "v1_0/commonapi/datatypes/primitive/TestInterfaceProxy.hpp"
+#include "stub/DTPrimitiveStub.h"
+
+const std::string domain = "local";
+const std::string testAddress = "commonapi.datatypes.primitive.TestInterface";
+const std::string connectionIdService = "service-sample";
+const std::string connectionIdClient = "client-sample";
+
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ }
+
+ virtual void TearDown() {
+ }
+};
+
+class DTPrimitive: public ::testing::Test {
+
+protected:
+ void SetUp() {
+
+ runtime_ = CommonAPI::Runtime::get();
+ ASSERT_TRUE((bool)runtime_);
+ std::mutex availabilityMutex;
+ std::unique_lock<std::mutex> lock(availabilityMutex);
+ std::condition_variable cv;
+ bool proxyAvailable = false;
+
+ std::thread t1([this, &proxyAvailable, &cv, &availabilityMutex]() {
+ testProxy_ = runtime_->buildProxy<v1_0::commonapi::datatypes::primitive::TestInterfaceProxy>(domain, testAddress, connectionIdClient);
+ testProxy_->isAvailableBlocking();
+ std::lock_guard<std::mutex> lock(availabilityMutex);
+ ASSERT_TRUE((bool)testProxy_);
+ proxyAvailable = true;
+ cv.notify_one();
+ });
+ testStub_ = std::make_shared<v1_0::commonapi::datatypes::primitive::DTPrimitiveStub>();
+ serviceRegistered_ = runtime_->registerService(domain, testAddress, testStub_, connectionIdService);
+ ASSERT_TRUE(serviceRegistered_);
+
+ while(!proxyAvailable) {
+ cv.wait(lock);
+ }
+ t1.join();
+ ASSERT_TRUE(testProxy_->isAvailable());
+ }
+
+ void TearDown() {
+ ASSERT_TRUE(runtime_->unregisterService(domain, v1_0::commonapi::datatypes::primitive::DTPrimitiveStub::StubInterface::getInterface(), testAddress));
+ }
+
+ bool received_;
+ bool serviceRegistered_;
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
+
+ std::shared_ptr<v1_0::commonapi::datatypes::primitive::TestInterfaceProxy<>> testProxy_;
+ std::shared_ptr<v1_0::commonapi::datatypes::primitive::DTPrimitiveStub> testStub_;
+};
+
+/**
+* @test Test function call with primitive types
+* - Primitive types are: uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, bool, float, double, std::string, ByteBuffer
+* - Function call of a function that has for each primitive type one argument (test values) and one return value
+* - The stub copies the test values to the return values
+* - On client side the test values are compared with the return values
+*/
+TEST_F(DTPrimitive, SendAndReceive) {
+
+ CommonAPI::CallStatus callStatus;
+
+ uint8_t uint8TestValue = +101;
+ int8_t int8TestValue = -101;
+ uint16_t uint16TestValue = +40004;
+ int16_t int16TestValue = -5005;
+ uint32_t uint32TestValue = +1000000001;
+ int32_t int32TestValue = -20002;
+ uint64_t uint64TestValue = +4000000000000000004;
+ int64_t int64TestValue = -5000000005;
+ bool booleanTestValue = true;
+ float floatTestValue = 1.01;
+ double doubleTestValue = 12345.12345;
+ std::string stringTestValue = "∃y ∀x ¬(x ≺ y)";
+ //ByteBuffer byteBufferTestValue
+
+ uint8_t uint8ResultValue = 0;
+ int8_t int8ResultValue = 0;
+ uint16_t uint16ResultValue = 0;
+ int16_t int16ResultValue = 0;
+ uint32_t uint32ResultValue = 0;
+ int32_t int32ResultValue = 0;
+ uint64_t uint64ResultValue = 0;
+ int64_t int64ResultValue = 0;
+ bool booleanResultValue = false;
+ float floatResultValue = 0.0;
+ double doubleResultValue = 0;
+ std::string stringResultValue = "";
+ //ByteBuffer byteBufferTestValue
+
+ testProxy_->fTest(
+ uint8TestValue,
+ int8TestValue,
+ uint16TestValue,
+ int16TestValue,
+ uint32TestValue,
+ int32TestValue,
+ uint64TestValue,
+ int64TestValue,
+ booleanTestValue,
+ floatTestValue,
+ doubleTestValue,
+ stringTestValue,
+ callStatus,
+ uint8ResultValue,
+ int8ResultValue,
+ uint16ResultValue,
+ int16ResultValue,
+ uint32ResultValue,
+ int32ResultValue,
+ uint64ResultValue,
+ int64ResultValue,
+ booleanResultValue,
+ floatResultValue,
+ doubleResultValue,
+ stringResultValue
+ );
+
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+
+ EXPECT_EQ(uint8TestValue, uint8ResultValue);
+ EXPECT_EQ(int8TestValue, int8ResultValue);
+ EXPECT_EQ(uint16TestValue, uint16ResultValue);
+ EXPECT_EQ(int16TestValue, int16ResultValue);
+ EXPECT_EQ(uint32TestValue, uint32ResultValue);
+ EXPECT_EQ(int32TestValue, int32ResultValue);
+ EXPECT_EQ(uint64TestValue, uint64ResultValue);
+ EXPECT_EQ(int64TestValue, int64ResultValue);
+ EXPECT_EQ(booleanTestValue, booleanResultValue);
+ EXPECT_EQ(floatTestValue, floatResultValue);
+ EXPECT_EQ(doubleTestValue, doubleResultValue);
+ EXPECT_EQ(stringTestValue, stringResultValue);
+}
+
+/**
+* @test Test attribute functions with primitive types
+* - Call set function of attributes with primitive types
+* - Call get function and check if the return value is the same
+*/
+TEST_F(DTPrimitive, AttributeSet) {
+
+ CommonAPI::CallStatus callStatus;
+
+ uint8_t uint8TestValue = +101;
+ int8_t int8TestValue = -101;
+ uint16_t uint16TestValue = +40004;
+ int16_t int16TestValue = -5005;
+ uint32_t uint32TestValue = +1000000001;
+ int32_t int32TestValue = -20002;
+ uint64_t uint64TestValue = +4000000000000000004;
+ int64_t int64TestValue = -5000000005;
+ bool booleanTestValue = true;
+ float floatTestValue = 1.01;
+ double doubleTestValue = 12345.12345;
+ std::string stringTestValue = "∃y ∀x ¬(x ≺ y)";
+ //ByteBuffer byteBufferTestValue
+
+ uint8_t uint8ResultValue = 0;
+ int8_t int8ResultValue = 0;
+ uint16_t uint16ResultValue = 0;
+ int16_t int16ResultValue = 0;
+ uint32_t uint32ResultValue = 0;
+ int32_t int32ResultValue = 0;
+ uint64_t uint64ResultValue = 0;
+ int64_t int64ResultValue = 0;
+ bool booleanResultValue = false;
+ float floatResultValue = 0.0;
+ double doubleResultValue = 0;
+ std::string stringResultValue = "";
+ //ByteBuffer byteBufferTestValue
+
+ testProxy_->getAUint8Attribute().setValue(uint8TestValue, callStatus, uint8ResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(uint8TestValue, uint8ResultValue);
+
+ testProxy_->getAInt8Attribute().setValue(int8TestValue, callStatus, int8ResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(int8TestValue, int8ResultValue);
+
+ testProxy_->getAUint16Attribute().setValue(uint16TestValue, callStatus, uint16ResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(uint16TestValue, uint16ResultValue);
+
+ testProxy_->getAInt16Attribute().setValue(int16TestValue, callStatus, int16ResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(int16TestValue, int16ResultValue);
+
+ testProxy_->getAUint32Attribute().setValue(uint32TestValue, callStatus, uint32ResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(uint32TestValue, uint32ResultValue);
+
+ testProxy_->getAInt32Attribute().setValue(int32TestValue, callStatus, int32ResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(int32TestValue, int32ResultValue);
+
+ testProxy_->getAUint64Attribute().setValue(uint64TestValue, callStatus, uint64ResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(uint64TestValue, uint64ResultValue);
+
+ testProxy_->getAInt64Attribute().setValue(int64TestValue, callStatus, int64ResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(int64TestValue, int64ResultValue);
+
+ testProxy_->getABooleanAttribute().setValue(booleanTestValue, callStatus, booleanResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(booleanTestValue, booleanResultValue);
+
+ testProxy_->getAFloatAttribute().setValue(floatTestValue, callStatus, floatResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(floatTestValue, floatResultValue);
+
+ testProxy_->getADoubleAttribute().setValue(doubleTestValue, callStatus, doubleResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(doubleTestValue, doubleResultValue);
+
+ testProxy_->getAStringAttribute().setValue(stringTestValue, callStatus, stringResultValue);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(stringTestValue, stringResultValue);
+}
+
+/**
+* @test Test broadcast with primitive types
+* - Subscribe to broadcast which contains primitive types
+* - Call function to cause the stub to fire broadcast event with the same content
+* - Check if the values in the callback function are as expected
+*/
+TEST_F(DTPrimitive, BroadcastReceive) {
+
+ CommonAPI::CallStatus callStatus;
+
+ uint8_t uint8TestValue = +101;
+ int8_t int8TestValue = -101;
+ uint16_t uint16TestValue = +40004;
+ int16_t int16TestValue = -5005;
+ uint32_t uint32TestValue = +1000000001;
+ int32_t int32TestValue = -20002;
+ uint64_t uint64TestValue = +4000000000000000004;
+ int64_t int64TestValue = -5000000005;
+ bool booleanTestValue = true;
+ float floatTestValue = 1.01;
+ double doubleTestValue = 12345.12345;
+ std::string stringTestValue = "∃y ∀x ¬(x ≺ y)";
+ //ByteBuffer byteBufferTestValue
+
+ uint8_t uint8ResultValue = 0;
+ int8_t int8ResultValue = 0;
+ uint16_t uint16ResultValue = 0;
+ int16_t int16ResultValue = 0;
+ uint32_t uint32ResultValue = 0;
+ int32_t int32ResultValue = 0;
+ uint64_t uint64ResultValue = 0;
+ int64_t int64ResultValue = 0;
+ bool booleanResultValue = false;
+ float floatResultValue = 0.0;
+ double doubleResultValue = 0;
+ std::string stringResultValue = "";
+ //ByteBuffer byteBufferTestValue
+
+ received_ = false;
+ testProxy_->getBTestEvent().subscribe([&](
+ const uint8_t& uint8ResultValue,
+ const int8_t& int8ResultValue,
+ const uint16_t& uint16ResultValue,
+ const int16_t& int16ResultValue,
+ const uint32_t& uint32ResultValue,
+ const int32_t& int32ResultValue,
+ const uint64_t& uint64ResultValue,
+ const int64_t& int64ResultValue,
+ const bool& booleanResultValue,
+ const float& floatResultValue,
+ const double& doubleResultValue,
+ const std::string& stringResultValue
+ ) {
+ received_ = true;
+ EXPECT_EQ(uint8TestValue, uint8ResultValue);
+ EXPECT_EQ(int8TestValue, int8ResultValue);
+ EXPECT_EQ(uint16TestValue, uint16ResultValue);
+ EXPECT_EQ(int16TestValue, int16ResultValue);
+ EXPECT_EQ(uint32TestValue, uint32ResultValue);
+ EXPECT_EQ(int32TestValue, int32ResultValue);
+ EXPECT_EQ(uint64TestValue, uint64ResultValue);
+ EXPECT_EQ(int64TestValue, int64ResultValue);
+ EXPECT_EQ(booleanTestValue, booleanResultValue);
+ EXPECT_EQ(floatTestValue, floatResultValue);
+ EXPECT_EQ(doubleTestValue, doubleResultValue);
+ EXPECT_EQ(stringTestValue, stringResultValue);
+ });
+
+ testProxy_->fTest(
+ uint8TestValue,
+ int8TestValue,
+ uint16TestValue,
+ int16TestValue,
+ uint32TestValue,
+ int32TestValue,
+ uint64TestValue,
+ int64TestValue,
+ booleanTestValue,
+ floatTestValue,
+ doubleTestValue,
+ stringTestValue,
+ callStatus,
+ uint8ResultValue,
+ int8ResultValue,
+ uint16ResultValue,
+ int16ResultValue,
+ uint32ResultValue,
+ int32ResultValue,
+ uint64ResultValue,
+ int64ResultValue,
+ booleanResultValue,
+ floatResultValue,
+ doubleResultValue,
+ stringResultValue
+ );
+
+ usleep(100000);
+ ASSERT_TRUE(received_);
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
+ return RUN_ALL_TESTS();
+}
diff --git a/org.genivi.commonapi.core.verification/src/DynamicLoadingVerification.cpp.in b/org.genivi.commonapi.core.verification/src/DynamicLoadingVerification.cpp.in
deleted file mode 100644
index a39b544..0000000
--- a/org.genivi.commonapi.core.verification/src/DynamicLoadingVerification.cpp.in
+++ /dev/null
@@ -1,197 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-
-/**
-* @file Dynamic Loading
-*/
-
-#include <functional>
-#include <fstream>
-#include <gtest/gtest.h>
-#include "CommonAPI/CommonAPI.h"
-#include "utils/VerificationMainLoop.h"
-#include "commonapi/tests/TestInterfaceProxy.h"
-#include "utils/VerificationTestStub.h"
-
-const std::string testAddress = "local:my.test:commonapi.address";
-
-const std::string configString =
- "{binding:@BINDING_NAME@}\n"
- "libpath=@BINDING_SO@\n"
- "alias=TestAlias\n"
- "genpath=@GLUECODE_SO@\n"
- "default"
-;
-
-const std::string COMMONAPI_CONFIG_SUFFIX = ".conf";
-
-class Environment: public ::testing::Environment {
-public:
- virtual ~Environment() {
- }
-
- virtual void SetUp() {
- configFileName_ = CommonAPI::getCurrentBinaryFileFQN();
- configFileName_ += COMMONAPI_CONFIG_SUFFIX;
- std::ofstream configFile(configFileName_);
- ASSERT_TRUE(configFile.is_open());
- configFile << configString;
- configFile.close();
- }
-
- virtual void TearDown() {
- std::remove(configFileName_.c_str());
- }
-
- std::string configFileName_;
-};
-
-class DynamicLoadingTest: public ::testing::Test {
-
-protected:
- void SetUp() {
- }
-
- void TearDown() {
- }
-
- std::string configFileName_;
-};
-
-/**
-* @test Loads Default Runtime.
-* - Calls CommonAPI::Runtime::load().
-* - Success if return value is true.
-*/
-TEST_F(DynamicLoadingTest, LoadsDefaultRuntime) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- ASSERT_TRUE((bool)runtime);
-}
-
-/**
-* @test Loads Runtime By Binding Name.
-* - Calls CommonAPI::Runtime::load("@BINDING_NAME@").
-* - Success if return value is true.
-*/
-TEST_F(DynamicLoadingTest, LoadsRuntimeByBindingName) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("@BINDING_NAME@");
- ASSERT_TRUE((bool)runtime);
-}
-
-/**
-* @test Loads Runtime By Alias.
-* - Calls CommonAPI::Runtime::load("TestAlias").
-* - Success if return value is true.
-*/
-TEST_F(DynamicLoadingTest, LoadsRuntimeByAlias) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("TestAlias");
- ASSERT_TRUE((bool)runtime);
-}
-
-/**
-* @test Loads Runtime and creates facory.
-* - Calls CommonAPI::Runtime::load("TestAlias") and checks if return value is true.
-* - Calls runtime->createFactory().
-* - Success if return value is true.
-*/
-TEST_F(DynamicLoadingTest, LoadedRuntimeCanCreateFactory) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("TestAlias");
- ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
- ASSERT_TRUE((bool)factory);
-}
-
-/**
-* @test Loads Runtime, creates facory and checks if proxies and stubs can be built.
-* - Calls CommonAPI::Runtime::load("TestAlias") and checks if return value is true.
-* - Calls runtime->createFactory() for proxy and checks if return value is true.
-* - Calls runtime->createFactory() for stub and checks if return value is true.
-* - Checks if test proxy with test address can be created.
-* - Calls runtime->getServicePublisher() checks if return value is true.
-* - Checks if test stub with test address can be created.
-* - Unregisters the test service.
-*/
-TEST_F(DynamicLoadingTest, LoadedRuntimeCanBuildProxiesAndStubs) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("TestAlias");
- ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::Factory> factoryProxy = runtime->createFactory();
- ASSERT_TRUE((bool)factoryProxy);
-
- std::shared_ptr<CommonAPI::Factory> factoryStub = runtime->createFactory();
- ASSERT_TRUE((bool)factoryStub);
-
- auto proxy = factoryProxy->buildProxy<commonapi::tests::TestInterfaceProxy>(testAddress);
- ASSERT_TRUE((bool)proxy);
-
- auto servicePublisher = runtime->getServicePublisher();
- ASSERT_TRUE((bool) servicePublisher);
-
- auto stub = std::make_shared<commonapi::verification::VerificationTestStub>();
- ASSERT_TRUE(servicePublisher->registerService(stub, testAddress, factoryStub));
-
- servicePublisher->unregisterService(testAddress);
- sleep(2);
-}
-
-/**
-* @test Loads Runtime, creates facory, if proxies and stubs can be built and checks if they can communicate.
-* - Calls CommonAPI::Runtime::load("TestAlias") and checks if return value is true.
-* - Calls runtime->createFactory() for proxy and checks if return value is true.
-* - Calls runtime->createFactory() for stub and checks if return value is true.
-* - Checks if test proxy with test address can be created.
-* - Calls runtime->getServicePublisher() checks if return value is true.
-* - Checks if test stub with test address can be created.
-* - Checks isAvailable flag of proxy.
-* - Unregisters the test service.
-*/
-TEST_F(DynamicLoadingTest, LoadedRuntimeCanBuildProxiesAndStubsThatCommunicate) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("TestAlias");
- ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::Factory> factoryProxy = runtime->createFactory();
- ASSERT_TRUE((bool)factoryProxy);
-
- std::shared_ptr<CommonAPI::Factory> factoryStub = runtime->createFactory();
- ASSERT_TRUE((bool)factoryStub);
-
- auto proxy = factoryProxy->buildProxy<commonapi::tests::TestInterfaceProxy>(testAddress);
- ASSERT_TRUE((bool)proxy);
-
- auto servicePublisher = runtime->getServicePublisher();
- ASSERT_TRUE((bool) servicePublisher);
-
- auto stub = std::make_shared<commonapi::verification::VerificationTestStub>();
- ASSERT_TRUE(servicePublisher->registerService(stub, testAddress, factoryStub));
-
- CommonAPI::CallStatus callStatus;
- std::string outString;
- uint32_t outInt = 0;
-
- for(int i=0; i<10; i++)
- {
- if(proxy->isAvailable()) {
- break;
- }
- usleep(50);
- }
-
- ASSERT_TRUE(proxy->isAvailable());
-
- proxy->testPredefinedTypeMethod(0, "", callStatus, outInt, outString);
- ASSERT_EQ(1, outInt);
-
- servicePublisher->unregisterService(testAddress);
- sleep(2);
-}
-
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- ::testing::AddGlobalTestEnvironment(new Environment());
- return RUN_ALL_TESTS();
-}
diff --git a/org.genivi.commonapi.core.verification/src/MainLoopVerification.cpp b/org.genivi.commonapi.core.verification/src/MainLoopVerification.cpp
deleted file mode 100644
index 4f28cde..0000000
--- a/org.genivi.commonapi.core.verification/src/MainLoopVerification.cpp
+++ /dev/null
@@ -1,496 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-
-/**
-* @file Main Loop Integration
-*/
-
-#include <gtest/gtest.h>
-#include "CommonAPI/CommonAPI.h"
-#include "utils/VerificationMainLoop.h"
-#include "commonapi/tests/TestInterfaceProxy.h"
-#include "utils/VerificationTestStub.h"
-#include <functional>
-
-const std::string testAddress6 = "local:my.eigth.test:commonapi.address.six";
-const std::string testAddress7 = "local:my.eigth.test:commonapi.address.seven";
-const std::string testAddress8 = "local:my.eigth.test:commonapi.address.eight";
-
-class PingPongTestStub : public commonapi::tests::TestInterfaceStubDefault {
- virtual void testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId,
- uint32_t uint32InValue,
- std::string stringInValue,
- uint32_t& uint32OutValue,
- std::string& stringOutValue) {
- stringOutValue = stringInValue;
- uint32OutValue = uint32InValue;
- }
-};
-
-class MainLoopTest: public ::testing::Test {
-
-protected:
- void SetUp() {
-
- runtime_ = CommonAPI::Runtime::load();
- ASSERT_TRUE((bool) runtime_);
-
- contextForProxy_ = runtime_->getNewMainLoopContext();
- contextForStub_ = runtime_->getNewMainLoopContext();
- ASSERT_TRUE((bool) contextForProxy_);
- ASSERT_TRUE((bool) contextForStub_);
- ASSERT_FALSE(contextForProxy_ == contextForStub_);
-
- mainLoopForProxy_ = new CommonAPI::VerificationMainLoop(contextForProxy_);
- mainLoopForStub_ = new CommonAPI::VerificationMainLoop(contextForStub_);
-
- mainloopFactoryProxy_ = runtime_->createFactory(contextForProxy_);
- mainloopFactoryStub_ = runtime_->createFactory(contextForStub_);
- ASSERT_TRUE((bool) mainloopFactoryProxy_);
- ASSERT_TRUE((bool) mainloopFactoryStub_);
- ASSERT_FALSE(mainloopFactoryProxy_ == mainloopFactoryStub_);
-
- servicePublisher_ = runtime_->getServicePublisher();
- ASSERT_TRUE((bool) servicePublisher_);
-
- stub_ = std::make_shared<commonapi::verification::VerificationTestStub>();
- ASSERT_TRUE(servicePublisher_->registerService(stub_, testAddress8, mainloopFactoryStub_));
-
- callbackCalled = 0;
- lastBroadcastNumber = 0;
- outInt = 0;
- }
-
- void TearDown() {
- servicePublisher_->unregisterService(testAddress8);
- mainLoopForProxy_->stop();
- mainLoopForStub_->stop();
- usleep(200);
- delete mainLoopForProxy_;
- delete mainLoopForStub_;
- }
-
- std::shared_ptr<CommonAPI::Runtime> runtime_;
-
- std::shared_ptr<CommonAPI::MainLoopContext> contextForProxy_;
- std::shared_ptr<CommonAPI::MainLoopContext> contextForStub_;
- std::shared_ptr<CommonAPI::Factory> mainloopFactoryProxy_;
- std::shared_ptr<CommonAPI::Factory> mainloopFactoryStub_;
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher_;
- std::shared_ptr<commonapi::verification::VerificationTestStub> stub_;
-
- CommonAPI::VerificationMainLoop* mainLoopForProxy_;
- CommonAPI::VerificationMainLoop* mainLoopForStub_;
-
- int callbackCalled;
- int lastBroadcastNumber;
- uint32_t outInt;
- CommonAPI::CallStatus callStatus;
-
-public:
- void broadcastCallback(uint32_t intValue, std::string stringValue) {
- // check correct order
- lastBroadcastNumber++;
- ASSERT_EQ(lastBroadcastNumber, intValue);
- // check, if broadcast is handled after method call
- ASSERT_EQ(outInt, 1);
- }
-};
-
-/**
-* @test Verifies Transport Reading When Dispatching Watches.
-* - get proxy with available flag = true
-* - generate big test data
-* - send asynchronous test message
-* - dispatch dispatchSource: the message must not be arrived
-* - dispatch watches (reads transport).
-* - dispatch dispatchSources again: now the message must be arrived.
-*/
-TEST_F(MainLoopTest, VerifyTransportReadingWhenDispatchingWatches) {
- auto proxy = mainloopFactoryProxy_->buildProxy<commonapi::tests::TestInterfaceProxy>(testAddress8);
- ASSERT_TRUE((bool) proxy);
-
- std::thread stubThread = std::thread([&](){ mainLoopForStub_->run(); });
-
- while (!proxy->isAvailable()) {
- mainLoopForProxy_->doSingleIteration();
- usleep(500);
- }
-
- ASSERT_TRUE(proxy->isAvailable());
-
- mainLoopForStub_->stop();
- stubThread.join();
-
- uint32_t uint32Value = 42;
- std::string stringValue = "Hai :)";
- bool running = true;
-
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue =
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2::E_OK;
- commonapi::tests::DerivedTypeCollection::TestMap testMapInValue;
-
- // Estimated amount of data (differring padding at beginning/end of Map/Array etc. not taken into account):
- // 4 + 4 + 500 * (4 + (4 + 4 + 100 * (11 + 1 + 4)) + 4 ) = 811008
- for (uint32_t i = 0; i < 500; ++i) {
- commonapi::tests::DerivedTypeCollection::TestArrayTestStruct testArrayTestStruct;
- for (uint32_t j = 0; j < 100; ++j) {
- commonapi::tests::DerivedTypeCollection::TestStruct testStruct("Hai all (:", j);
- testArrayTestStruct.push_back(testStruct);
- }
- testMapInValue.insert( {i, testArrayTestStruct});
- }
-
- std::future<CommonAPI::CallStatus> futureStatus =
- proxy->testDerivedTypeMethodAsync(
- testEnumExtended2InValue,
- testMapInValue,
- [&] (const CommonAPI::CallStatus& status,
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2 testEnumExtended2OutValue,
- commonapi::tests::DerivedTypeCollection::TestMap testMapOutValue) {
- mainLoopForProxy_->stop();
- callbackCalled++;
- }
- );
-
- mainLoopForProxy_->runVerification(15, true, true);
-
- // 1. just dispatch dispatchSources
- mainLoopForStub_->runVerification(15, false, true);
- EXPECT_EQ(stub_->getCalledTestDerivedTypeMethod(), 0);
-
- // 2. just dispatch watches (reads transport)
- mainLoopForStub_->runVerification(20, true, false);
- EXPECT_EQ(stub_->getCalledTestDerivedTypeMethod(), 0);
-
- // 3. just dispatch dispatchSources again. This should dispatch the messages already read from transport in 2.
- mainLoopForStub_->doVerificationIteration(false, true);
- EXPECT_EQ(stub_->getCalledTestDerivedTypeMethod(), 1);
-}
-
-/**
-* @test Verifies Synchronous Call Message Handling Order.
-* - get proxy with available flag = true
-* - subscribe for broadcast event
-* - generate 5 test broadcasts
-* - 5 broadcasts should arrive in the right order
-*/
-TEST_F(MainLoopTest, VerifySyncCallMessageHandlingOrder) {
- auto proxy = mainloopFactoryProxy_->buildProxy<commonapi::tests::TestInterfaceProxy>(testAddress8);
- ASSERT_TRUE((bool) proxy);
-
- std::thread stubThread = std::thread([&](){ mainLoopForStub_->run(); });
-
- while (!proxy->isAvailable()) {
- mainLoopForProxy_->doSingleIteration();
- usleep(500);
- }
-
- ASSERT_TRUE(proxy->isAvailable());
-
- auto& broadcastEvent = proxy->getTestPredefinedTypeBroadcastEvent();
- broadcastEvent.subscribe(std::bind(&MainLoopTest::broadcastCallback, this, std::placeholders::_1, std::placeholders::_2));
-
- CommonAPI::CallStatus callStatus;
- std::string outString;
-
- proxy->testPredefinedTypeMethod(0, "", callStatus, outInt, outString);
- ASSERT_EQ(outInt, 1);
-
- for (int i = 0; i < 10000; i++) {
- mainLoopForProxy_->doSingleIteration(100);
- }
-
- sleep(10);
-
- mainLoopForProxy_->stop();
- mainLoopForStub_->stop();
-
- stubThread.join();
-
- // in total 5 broadcasts should have been arrived
- ASSERT_EQ(lastBroadcastNumber, 5);
-}
-
-/**
-* @test Synchronous Calls Do Not Deadlock.
-* - get proxy with available flag = true
-* - call synchronous test method in syncCallThread
-* - 5 broadcasts should arrive in the right order
-* - run the mainloop again in order to give the syncCallThread a chance to return
-*/
-TEST_F(MainLoopTest, SyncCallsDoNotDeadlock) {
- auto proxy = mainloopFactoryProxy_->buildProxy<commonapi::tests::TestInterfaceProxy>(testAddress8);
- ASSERT_TRUE((bool) proxy);
-
- std::thread stubThread = std::thread([&]() {mainLoopForStub_->run();});
-
- // let the proxy become available
- while (!proxy->isAvailable()) {
- mainLoopForProxy_->doSingleIteration();
- usleep(500);
- }
-
- uint32_t inInt, outInt;
- std::string inStr, outStr;
- inInt = 1;
- outInt = 0;
-
- callStatus = CommonAPI::CallStatus::REMOTE_ERROR;
-
- std::thread syncCallThread = std::thread(
- [&]() {proxy->testPredefinedTypeMethod(inInt, inStr, callStatus, outInt, outStr);}
- );
- sleep(10);
-
- ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, callStatus);
-
- if (callStatus != CommonAPI::CallStatus::SUCCESS) {
- mainLoopForProxy_->runVerification(10, true, true); // run the mainloop again in order to give the syncCallThread a chance to return
- }
- mainLoopForStub_->stop();
- stubThread.join();
- syncCallThread.join();
-}
-
-class MainLoopThreadContext {
-public:
- void setupRuntime(std::promise<bool>& p) {
- runtime_ = CommonAPI::Runtime::load();
- p.set_value(true);
- }
-
- void setupMainLoopContext(std::promise<bool>& p) {
- mainLoopContext_ = runtime_->getNewMainLoopContext();
- mainLoop_ = new CommonAPI::VerificationMainLoop(mainLoopContext_);
- p.set_value(true);
- }
-
- void setupFactory(std::promise<bool>& p) {
- factory_ = runtime_->createFactory(mainLoopContext_);
- servicePublisher_ = runtime_->getServicePublisher();
- p.set_value(true);
- }
-
- void setAddresses(const std::string own, const std::string other, const std::string thirdParty) {
- ownAddress_ = own;
-
- otherAddress_ = other;
- thirdPartyAddress_ = thirdParty;
- }
-
- void createProxyAndStub() {
- stub_ = std::make_shared<PingPongTestStub>();
- ASSERT_TRUE(servicePublisher_->registerService(stub_, ownAddress_, factory_));
- proxy_ = factory_->buildProxy<commonapi::tests::TestInterfaceProxy>(otherAddress_);
- ASSERT_TRUE((bool)proxy_);
- proxyThirdParty_ = factory_->buildProxy<commonapi::tests::TestInterfaceProxy>(thirdPartyAddress_);
- ASSERT_TRUE((bool)proxyThirdParty_);
- }
-
- std::shared_ptr<CommonAPI::Runtime> runtime_;
- std::shared_ptr<CommonAPI::MainLoopContext> mainLoopContext_;
- std::shared_ptr<CommonAPI::Factory> factory_;
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher_;
- std::string ownAddress_, otherAddress_, thirdPartyAddress_;
- std::shared_ptr<PingPongTestStub> stub_;
- std::shared_ptr<commonapi::tests::TestInterfaceProxy<>> proxy_, proxyThirdParty_;
-
- CommonAPI::VerificationMainLoop* mainLoop_;
-};
-
-class MainLoopIndependenceTest: public ::testing::Test {
-protected:
- void SetUp() {
- std::shared_ptr<CommonAPI::Runtime> runtimePtr1_, runtimePtr2_;
-
- std::promise<bool> promiseRuntime1, promiseRuntime2;
- std::future<bool> futureRuntime1 = promiseRuntime1.get_future();
- std::future<bool> futureRuntime2 = promiseRuntime2.get_future();
-
- mainLoopThread1_ = std::thread(
- std::bind(&MainLoopThreadContext::setupRuntime, &threadCtx1_, std::move(promiseRuntime1)));
- mainLoopThread2_ = std::thread(
- std::bind(&MainLoopThreadContext::setupRuntime, &threadCtx2_, std::move(promiseRuntime2)));
-
- mainLoopThread1_.detach();
- mainLoopThread2_.detach();
-
- futureRuntime1.wait_for(std::chrono::milliseconds(200));
- futureRuntime2.wait_for(std::chrono::milliseconds(200));
-
- // check that both threads have a runtime and it is the same
- ASSERT_TRUE((bool)threadCtx1_.runtime_);
- ASSERT_TRUE((bool)threadCtx2_.runtime_);
- ASSERT_EQ(threadCtx1_.runtime_, threadCtx2_.runtime_);
-
- std::promise<bool> promiseContext1, promiseContext2;
- std::future<bool> futureContext1 = promiseContext1.get_future();
- std::future<bool> futureContext2 = promiseContext2.get_future();
-
- mainLoopThread1_ = std::thread(
- std::bind(
- &MainLoopThreadContext::setupMainLoopContext,
- &threadCtx1_,
- std::move(promiseContext1)));
- mainLoopThread2_ = std::thread(
- std::bind(
- &MainLoopThreadContext::setupMainLoopContext,
- &threadCtx2_,
- std::move(promiseContext2)));
- mainLoopThread1_.detach();
- mainLoopThread2_.detach();
-
- futureContext1.wait_for(std::chrono::milliseconds(200));
- futureContext2.wait_for(std::chrono::milliseconds(200));
-
- // check that both threads have an own mainloop context
- ASSERT_TRUE((bool)threadCtx1_.mainLoopContext_);
- ASSERT_TRUE((bool)threadCtx2_.mainLoopContext_);
- ASSERT_NE(threadCtx1_.mainLoopContext_, threadCtx2_.mainLoopContext_);
-
- std::promise<bool> promiseFactory1, promiseFactory2;
- std::future<bool> futureFactory1 = promiseFactory1.get_future();
- std::future<bool> futureFactory2 = promiseFactory2.get_future();
-
- mainLoopThread1_ = std::thread(std::bind(&MainLoopThreadContext::setupFactory, &threadCtx1_, std::move(promiseFactory1)));
- mainLoopThread2_ = std::thread(std::bind(&MainLoopThreadContext::setupFactory, &threadCtx2_, std::move(promiseFactory2)));
-
- mainLoopThread1_.detach();
- mainLoopThread2_.detach();
-
- futureFactory1.wait_for(std::chrono::milliseconds(200));
- futureFactory2.wait_for(std::chrono::milliseconds(200));
-
- // check that both threads have a factory and a service publisher
- ASSERT_TRUE((bool)threadCtx1_.factory_);
- ASSERT_TRUE((bool)threadCtx2_.factory_);
- ASSERT_TRUE((bool)threadCtx1_.servicePublisher_);
- ASSERT_TRUE((bool)threadCtx2_.servicePublisher_);
-
- // set addresses
- threadCtx1_.setAddresses(testAddress7, testAddress8, testAddress6);
- threadCtx2_.setAddresses(testAddress8, testAddress7, testAddress6);
-
- threadCtx1_.createProxyAndStub();
- threadCtx2_.createProxyAndStub();
-
- mainLoopThread1_ = std::thread([&]() { threadCtx1_.mainLoop_->run(); });
- mainLoopThread2_ = std::thread([&]() { threadCtx2_.mainLoop_->run(); });
-
- usleep(200000);
-
- ASSERT_TRUE(threadCtx1_.proxy_->isAvailable());
- ASSERT_TRUE(threadCtx2_.proxy_->isAvailable());
-
- threadCtx1_.mainLoop_->stop();
- threadCtx2_.mainLoop_->stop();
-
- mainLoopThread1_.join();
- mainLoopThread2_.join();
- }
-
- void TearDown() {
- threadCtx1_.servicePublisher_->unregisterService(testAddress6);
- threadCtx1_.servicePublisher_->unregisterService(testAddress7);
- threadCtx2_.servicePublisher_->unregisterService(testAddress8);
- usleep(2000);
- threadCtx1_.mainLoop_->stop();
- threadCtx2_.mainLoop_->stop();
-
- if(mainLoopThread1_.joinable()) {
- mainLoopThread1_.join();
- }
- if(mainLoopThread2_.joinable()) {
- mainLoopThread2_.join();
- }
- }
-
- MainLoopThreadContext threadCtx1_, threadCtx2_;
- std::thread mainLoopThread1_, mainLoopThread2_;
-};
-
-/**
-* @test Proxy Receives Answer Only If Stub MainLoop Runs.
-* - start proxy in thread 1 and call testPredefinedTypeMethod
-* - proxy should not receive answer, if the stub mainloop does not run
-* - run mainloop of stub
-* - now the stub mainloop also runs, so the proxy should receive the answer
-*/
-TEST_F(MainLoopIndependenceTest, ProxyReceivesAnswerOnlyIfStubMainLoopRuns) {
- CommonAPI::CallStatus callStatus;
-
- uint32_t inInt, outInt;
- std::string inStr, outStr;
- inInt = 1;
- outInt = 0;
-
- std::thread mainLoopRunnerProxy([&]() { threadCtx1_.mainLoop_->runVerification(5, true, true); });
- mainLoopRunnerProxy.detach();
-
- mainLoopThread1_ = std::thread([&]() { threadCtx1_.proxy_->testPredefinedTypeMethod(inInt, inStr, callStatus, outInt, outStr); });
- mainLoopThread1_.detach();
-
- sleep(1);
- // proxy should not receive answer, if the stub mainloop does not run
- ASSERT_EQ(0, outInt);
-
- mainLoopThread2_ = std::thread([&]() { threadCtx2_.mainLoop_->run(); });
- mainLoopThread2_.detach();
-
- sleep(1);
-
- // now the stub mainloop also runs, so the proxy should receive the answer
- ASSERT_EQ(1, outInt);
-}
-
-/**
-* @test Proxy Receives Just His Own Answers.
-* - start 2 proxies in own threads
-* - call test method in each proxy
-* - now each proxy should have received the answer to his own request
-*/
-TEST_F(MainLoopIndependenceTest, ProxyReceivesJustHisOwnAnswers) {
- std::shared_ptr<PingPongTestStub> stubThirdParty = std::make_shared<PingPongTestStub>();
- auto runtime = CommonAPI::Runtime::load();
- ASSERT_TRUE(runtime->getServicePublisher()->registerService(stubThirdParty, testAddress6, runtime->createFactory()));
-
- CommonAPI::CallStatus callStatusProxy1, callStatusProxy2;
-
- uint32_t inIntProxy1, outIntProxy1, inIntProxy2, outIntProxy2;
- std::string inStrProxy1, outStrProxy1, inStrProxy2, outStrProxy2;
- inIntProxy1 = 1;
- inIntProxy2 = 2;
- outIntProxy1 = outIntProxy2 = 0;
-
- std::thread mainLoopRunnerProxy1([&]() { threadCtx1_.mainLoop_->run(); });
- std::thread mainLoopRunnerProxy2([&]() { threadCtx2_.mainLoop_->run(); });
- mainLoopRunnerProxy1.detach();
- mainLoopRunnerProxy2.detach();
-
- while(!(threadCtx1_.proxyThirdParty_->isAvailable() && threadCtx2_.proxyThirdParty_->isAvailable())) {
- usleep(5000);
- }
-
-
- mainLoopThread1_ = std::thread([&]() { threadCtx1_.proxyThirdParty_->testPredefinedTypeMethod(inIntProxy1, inStrProxy1, callStatusProxy1, outIntProxy1, outStrProxy1); });
- mainLoopThread2_ = std::thread([&]() { threadCtx2_.proxyThirdParty_->testPredefinedTypeMethod(inIntProxy2, inStrProxy2, callStatusProxy2, outIntProxy2, outStrProxy2); });
- mainLoopThread1_.detach();
- mainLoopThread2_.detach();
-
- sleep(5);
- // now each proxy should have received the answer to his own request
- ASSERT_EQ(1, outIntProxy1);
- ASSERT_EQ(2, outIntProxy2);
-
- sleep(1);
-}
-
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
diff --git a/org.genivi.commonapi.core.verification/src/PFComplex.cpp b/org.genivi.commonapi.core.verification/src/PFComplex.cpp
new file mode 100644
index 0000000..2730ce1
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/PFComplex.cpp
@@ -0,0 +1,224 @@
+/* Copyright (C) 2014 BMW Group
+ * Copyright (C) 2015 Mentor Graphics
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * Author: Felix Scherzinger (felix_scherzinger@mentor.com)
+ * 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/. */
+
+/**
+* @file Performance_Complex
+*/
+
+#include <gtest/gtest.h>
+#include "CommonAPI/CommonAPI.hpp"
+
+#include "v1_0/commonapi/performance/complex/TestInterfaceProxy.hpp"
+#include "stub/PFComplexStub.h"
+
+#include "utils/StopWatch.h"
+
+const int usecPerSecond = 1000000;
+
+const std::string serviceId = "service-sample";
+const std::string clientId = "client-sample";
+
+const std::string domain = "local";
+const std::string testAddress = "commonapi.performance.complex.TestInterface";
+const int tasync = 100000;
+
+// Define the max. array size to test
+const int maxArraySize = 4096 / 16;
+// Define the loop count how often the commonAPI test function is called for calculating the mean time
+const int loopCountPerPaylod = 1000;
+
+using namespace v1_0::commonapi::performance::complex;
+
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ }
+
+ virtual void TearDown() {
+ }
+};
+
+class PFComplex: public ::testing::Test {
+public:
+ void recvArray(const CommonAPI::CallStatus& callStatus, TestInterface::tArray y) {
+ // Stop the time & verify call status
+ watch_.stop();
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+
+ std::unique_lock<std::mutex> uniqueLock(synchLock_);
+ condVar_.notify_one();
+ }
+
+protected:
+ void SetUp() {
+ runtime_ = CommonAPI::Runtime::get();
+ ASSERT_TRUE((bool)runtime_);
+
+ testStub_ = std::make_shared<PFComplexStub>();
+ serviceRegistered_ = runtime_->registerService(domain, testAddress, testStub_, "service-sample");
+ ASSERT_TRUE(serviceRegistered_);
+
+ testProxy_ = runtime_->buildProxy<TestInterfaceProxy>(domain, testAddress, "client-sample");
+ ASSERT_TRUE((bool)testProxy_);
+
+ testProxy_->isAvailableBlocking();
+ ASSERT_TRUE(testProxy_->isAvailable());
+ }
+
+ void TearDown() {
+ runtime_->unregisterService(domain, PFComplexStub::StubInterface::getInterface(), testAddress);
+ }
+
+ void printTestValues(size_t payloadSize, size_t objectSize) {
+ // Get elapsed time, calculate mean time and print out!
+ StopWatch::usec_t methodCallTime = watch_.getTotalElapsedMicroseconds();
+ StopWatch::usec_t meanTime = (methodCallTime / loopCountPerPaylod);
+ StopWatch::usec_t perByteTime = meanTime / objectSize;
+ uint32_t callsPerSeconds = usecPerSecond / (methodCallTime / loopCountPerPaylod);
+
+ std::cout << "[MEASURING ] Payload-Size=" << std::setw(7) << std::setfill('.') << payloadSize
+ << ", Mean-Time=" << std::setw(7) << std::setfill('.') << meanTime
+ << "us, per-Byte(payload)=" << std::setw(7) << std::setfill('.')
+ << (perByteTime <= 0 ? ".....<1" : std::to_string(perByteTime)) << "us"
+ << ", calls/s=" << std::setw(7) << std::setfill('.') << callsPerSeconds
+ << std::endl;
+ }
+
+ std::string configFileName_;
+ bool serviceRegistered_;
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
+ std::shared_ptr<TestInterfaceProxy<>> testProxy_;
+ std::shared_ptr<TestInterfaceStubDefault> testStub_;
+
+ StopWatch watch_;
+ std::mutex synchLock_;
+ std::condition_variable condVar_;
+ uint32_t callCount_;
+ std::function<void (const CommonAPI::CallStatus&, TestInterface::tArray)> myCallback_;
+ uint32_t arraySize_ = 1;
+};
+
+/**
+* @test Test synchronous ping pong function call
+* - complex array is array of a struct containing an union and another struc with primitive datatypes
+* - The stub just set the in array to the out array
+* - CallStatus and array content will be used to verify the sync call has succeeded
+* - Using double payload every cycle, starting with 1 end with maxPrimitiveArraySize
+* - Doing primitiveLoopSize loops to build the mean time
+*/
+TEST_F(PFComplex, Ping_Pong_Complex_Synchronous) {
+ CommonAPI::CallStatus callStatus;
+
+ watch_.reset();
+
+ // Loop until maxPrimitiveArraySize
+ while (arraySize_ <= maxArraySize) {
+
+ // Create in-array with actual arraySize
+ TestInterface::tArray in;
+ TestInterface::innerStruct innerTestStruct(123, true, 4, "test", 35);
+ std::string unionMember = std::string("Hello World");
+ TestInterface::innerUnion innerTestUnion = unionMember;
+ TestInterface::tStruct testStruct(innerTestStruct, innerTestUnion);
+ for (uint32_t i = 0; i < arraySize_; ++i) {
+ in.push_back(testStruct);
+ }
+
+ // Sum up payload size of primitive memebers
+ size_t payloadSize = sizeof(innerTestStruct.getBooleanMember()) + sizeof(innerTestStruct.getUint8Member())
+ + sizeof(innerTestStruct.getUint16Member()) + sizeof(innerTestStruct.getUint32Member())
+ + sizeof(innerTestStruct.getStringMember()) + sizeof(unionMember);
+
+ // Call commonAPI method loopCountPerPaylod times to calculate mean time
+ for (uint32_t i = 0; i < loopCountPerPaylod; ++i) {
+
+ // Create an empty out-array for every commonAPI function call
+ TestInterface::tArray out;
+
+ // Call commonAPI function and measure time
+ watch_.start();
+ testProxy_->testMethod(in, callStatus, out);
+ watch_.stop();
+
+ // Check the call was successful & out array has same elements than in array
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(in, out);
+ }
+
+ // Printing results
+ printTestValues(arraySize_ * payloadSize, arraySize_ * sizeof(testStruct));
+
+ // Increase array size for next iteration
+ arraySize_ *= 2;
+
+ // Reset StopWatch for next iteration
+ watch_.reset();
+ }
+}
+
+/**
+* @test Test asynchronous ping pong function call
+* - complex array is array of a struct containing an union and another struc with primitive datatypes
+* - The stub just set (copies) the in array to the out array
+* - Only the CallStatus will be used to verify the async call has succeeded
+* - Using double payload every cycle, starting with 1 end with maxPrimitiveArraySize
+* - Doing loopCountPerPaylod loops to calc the mean time
+*/
+TEST_F(PFComplex, Ping_Pong_Complex_Asynchronous) {
+ myCallback_ = std::bind(&PFComplex::recvArray, this, std::placeholders::_1, std::placeholders::_2);
+
+ std::unique_lock<std::mutex> uniqueLock(synchLock_);
+
+ watch_.reset();
+
+ // Loop until maxPrimitiveArraySize
+ while (arraySize_ <= maxArraySize) {
+
+ // Create in-array with actual arraySize
+ TestInterface::tArray in;
+ TestInterface::innerStruct innerTestStruct(123, true, 4, "test", 35);
+ std::string unionMember = std::string("Hello World");
+ TestInterface::innerUnion innerTestUnion = unionMember;
+ TestInterface::tStruct testStruct(innerTestStruct, innerTestUnion);
+ for (uint32_t i = 0; i < arraySize_; ++i) {
+ in.push_back(testStruct);
+ }
+
+ // Sum up payload size of primitive memebers
+ size_t payloadSize = sizeof(innerTestStruct.getBooleanMember()) + sizeof(innerTestStruct.getUint8Member())
+ + sizeof(innerTestStruct.getUint16Member()) + sizeof(innerTestStruct.getUint32Member())
+ + sizeof(innerTestStruct.getStringMember()) + sizeof(unionMember);
+
+ // Call commonAPI method loopCountPerPaylod times to calculate mean time
+ for (uint32_t i = 0; i < loopCountPerPaylod; ++i) {
+ TestInterface::tArray out;
+ watch_.start();
+ testProxy_->testMethodAsync(in, myCallback_);
+ condVar_.wait(uniqueLock);
+ }
+
+ // Printing results
+ printTestValues(arraySize_ * payloadSize, arraySize_ * sizeof(testStruct));
+
+ // Increase array size for next iteration
+ arraySize_ *= 2;
+
+ // Reset StopWatch for next iteration
+ watch_.reset();
+ }
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
+ return RUN_ALL_TESTS();
+}
+
diff --git a/org.genivi.commonapi.core.verification/src/PFPrimitive.cpp b/org.genivi.commonapi.core.verification/src/PFPrimitive.cpp
new file mode 100644
index 0000000..ca71952
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/PFPrimitive.cpp
@@ -0,0 +1,196 @@
+/* Copyright (C) 2014 BMW Group
+ * Copyright (C) 2015 Mentor Graphics
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * Author: Felix Scherzinger (felix_scherzinger@mentor.com)
+ * 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/. */
+
+/**
+* @file Performance_Primitive
+*/
+
+#include <gtest/gtest.h>
+#include "CommonAPI/CommonAPI.hpp"
+
+#include "v1_0/commonapi/performance/primitive/TestInterfaceProxy.hpp"
+#include "stub/PFPrimitiveStub.h"
+
+#include "utils/StopWatch.h"
+
+const std::string serviceId = "service-sample";
+const std::string clientId = "client-sample";
+
+const std::string domain = "local";
+const std::string testAddress = "commonapi.performance.primitive.TestInterface";
+const int tasync = 100000;
+
+const int usecPerSecond = 1000000;
+
+// Define the max. array size to test
+const int maxPrimitiveArraySize = 1024*16;
+// Define the loop count how often the commonAPI test function is called for calculating the mean time
+const int loopCountPerPaylod = 1000;
+
+using namespace v1_0::commonapi::performance::primitive;
+
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ }
+
+ virtual void TearDown() {
+ }
+};
+
+class PFPrimitive: public ::testing::Test {
+public:
+ void recvArray(const CommonAPI::CallStatus& callStatus, TestInterface::TestArray y) {
+ // Stop the time & verify call status
+ watch_.stop();
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+
+ std::unique_lock<std::mutex> uniqueLock(synchLock_);
+ condVar_.notify_one();
+ }
+
+protected:
+ void SetUp() {
+ runtime_ = CommonAPI::Runtime::get();
+ ASSERT_TRUE((bool)runtime_);
+
+ testStub_ = std::make_shared<PFPrimitiveStub>();
+ bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId);
+ ASSERT_TRUE(serviceRegistered);
+
+ testProxy_ = runtime_->buildProxy<TestInterfaceProxy>(domain, testAddress, clientId);
+ ASSERT_TRUE((bool)testProxy_);
+
+ testProxy_->isAvailableBlocking();
+ ASSERT_TRUE(testProxy_->isAvailable());
+ }
+
+ void TearDown() {
+ bool unregistered = runtime_->unregisterService(domain, PFPrimitiveStub::StubInterface::getInterface(), testAddress);
+ ASSERT_TRUE(unregistered);
+ }
+
+ void printTestValues() {
+ // Get elapsed time, calculate mean time and print out!
+ StopWatch::usec_t methodCallTime = watch_.getTotalElapsedMicroseconds();
+ StopWatch::usec_t meanTime = (methodCallTime / loopCountPerPaylod);
+ StopWatch::usec_t perByteTime = meanTime / arraySize_;
+ uint32_t callsPerSeconds = usecPerSecond / (methodCallTime / loopCountPerPaylod);
+
+ std::cout << "[MEASURING ] Size=" << std::setw(7) << std::setfill('.') << arraySize_
+ << ", Mean-Time=" << std::setw(7) << std::setfill('.') << meanTime << "us"
+ << ", per-Byte=" << std::setw(7) << std::setfill('.')
+ << (perByteTime <= 0 ? ".....<1" : std::to_string(perByteTime)) << "us"
+ << ", calls/s=" << std::setw(7) << std::setfill('.') << callsPerSeconds
+ << std::endl;
+ }
+
+ std::string configFileName_;
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
+ std::shared_ptr<TestInterfaceProxy<>> testProxy_;
+ std::shared_ptr<TestInterfaceStub> testStub_;
+
+ StopWatch watch_;
+ std::mutex synchLock_;
+ std::condition_variable condVar_;
+ uint32_t callCount_;
+ std::function<void (const CommonAPI::CallStatus&, TestInterface::TestArray)> myCallback_;
+ uint32_t arraySize_ = 1;
+};
+
+/**
+* @test Test synchronous ping pong function call
+* - primitive array is array of UInt_8
+* - The stub just set the in array to the out array
+* - CallStatus and array content will be used to verify the sync call has succeeded
+* - Using double payload every cycle, starting with 1 end with maxPrimitiveArraySize
+* - Doing primitiveLoopSize loops to build the mean time
+*/
+TEST_F(PFPrimitive, DISABLED_Ping_Pong_Primitive_Synchronous) {
+ CommonAPI::CallStatus callStatus;
+
+ watch_.reset();
+
+ // Loop until maxPrimitiveArraySize
+ while (arraySize_ <= maxPrimitiveArraySize) {
+
+ // Create in-array with actual arraySize
+ TestInterface::TestArray in(arraySize_);
+
+ // Call commonAPI method loopCountPerPaylod times to calculate mean time
+ for (uint32_t i = 0; i < loopCountPerPaylod; ++i) {
+
+ // Create an empty out-array for every commonAPI function call
+ TestInterface::TestArray out;
+
+ // Call commonAPI function and measure time
+ watch_.start();
+ testProxy_->testMethod(in, callStatus, out);
+ watch_.stop();
+
+ // Check the call was successful & out array has same elements than in array
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(in, out);
+ }
+
+ // Printing results
+ printTestValues();
+
+ // Increase array size for next iteration
+ arraySize_ *= 2;
+
+ // Reset StopWatch for next iteration
+ watch_.reset();
+ }
+}
+
+/**
+* @test Test asynchronous ping pong function call
+* - primitive array is array of UInt_8
+* - The stub just set (copies) the in array to the out array
+* - Only the CallStatus will be used to verify the async call has succeeded
+* - Using double payload every cycle, starting with 1 end with maxPrimitiveArraySize
+* - Doing primitiveLoopSize loops to build the mean time
+*/
+TEST_F(PFPrimitive, Ping_Pong_Primitive_Asynchronous) {
+ myCallback_ = std::bind(&PFPrimitive::recvArray, this, std::placeholders::_1, std::placeholders::_2);
+
+ std::unique_lock<std::mutex> uniqueLock(synchLock_);
+
+ // Loop until maxPrimitiveArraySize
+ while (arraySize_ <= maxPrimitiveArraySize) {
+
+ watch_.reset();
+
+ // Initialize testData, call count stop watch for next iteration!
+ TestInterface::TestArray in(arraySize_);
+
+ for (uint32_t i = 0; i < loopCountPerPaylod; ++i) {
+ TestInterface::TestArray out;
+ watch_.start();
+ testProxy_->testMethodAsync(in, myCallback_);
+ condVar_.wait(uniqueLock);
+ }
+
+ // Printing results
+ printTestValues();
+
+ // Increase array size for next iteration
+ arraySize_ *= 2;
+ }
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
+ return RUN_ALL_TESTS();
+}
+
diff --git a/org.genivi.commonapi.core.verification/src/RTBuildProxiesAndStubs.cpp b/org.genivi.commonapi.core.verification/src/RTBuildProxiesAndStubs.cpp
new file mode 100644
index 0000000..88e7ff4
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/RTBuildProxiesAndStubs.cpp
@@ -0,0 +1,78 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+/**
+* @file Runtime
+*/
+
+#include <functional>
+#include <fstream>
+#include <thread>
+#include <gtest/gtest.h>
+#include "CommonAPI/CommonAPI.hpp"
+#include "v1_0/commonapi/runtime/TestInterfaceProxy.hpp"
+#include "v1_0/commonapi/runtime/TestInterfaceStubDefault.hpp"
+
+const std::string domain = "local";
+const std::string testAddress = "commonapi.runtime.TestInterface";
+const std::string applicationNameService = "service-sample";
+const std::string applicationNameClient = "client-sample";
+
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ }
+
+ virtual void TearDown() {
+ }
+};
+
+class RTBuildProxiesAndStubs: public ::testing::Test {
+
+protected:
+ void SetUp() {
+ }
+
+ void TearDown() {
+ }
+};
+
+/**
+* @test Loads Runtime, creates proxy and stub/service.
+* - Calls CommonAPI::Runtime::get() and checks if return value is true.
+* - Checks if test proxy with domain and test instance can be created.
+* - Checks if test stub can be created.
+* - Register the test service.
+* - Unregister the test service.
+*/
+TEST_F(RTBuildProxiesAndStubs, LoadedRuntimeCanBuildProxiesAndStubs) {
+
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
+ ASSERT_TRUE((bool)runtime);
+
+ std::thread t1([&runtime](){
+ auto testProxy = runtime->buildProxy<v1_0::commonapi::runtime::TestInterfaceProxy>(domain,testAddress, applicationNameClient);
+ testProxy->isAvailableBlocking();
+ ASSERT_TRUE((bool)testProxy);
+ });
+
+
+ auto testStub = std::make_shared<v1_0::commonapi::runtime::TestInterfaceStubDefault>();
+ ASSERT_TRUE((bool)testStub);
+
+ ASSERT_TRUE(runtime->registerService(domain,testAddress,testStub, applicationNameService));
+ t1.join();
+ ASSERT_TRUE(runtime->unregisterService(domain,v1_0::commonapi::runtime::TestInterfaceStub::StubInterface::getInterface(), testAddress));
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
+ return RUN_ALL_TESTS();
+}
diff --git a/org.genivi.commonapi.core.verification/src/RTLoadingRuntime.cpp b/org.genivi.commonapi.core.verification/src/RTLoadingRuntime.cpp
new file mode 100644
index 0000000..5321418
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/RTLoadingRuntime.cpp
@@ -0,0 +1,52 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+/**
+* @file Runtime
+*/
+
+#include <functional>
+#include <fstream>
+#include <gtest/gtest.h>
+#include "CommonAPI/CommonAPI.hpp"
+
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ }
+
+ virtual void TearDown() {
+ }
+};
+
+class RTLoadingRuntime: public ::testing::Test {
+
+protected:
+ void SetUp() {
+ }
+
+ void TearDown() {
+ }
+};
+
+/**
+* @test Loads Default Runtime.
+* - Calls CommonAPI::Runtime::get().
+* - Success if return value is true.
+*/
+TEST_F(RTLoadingRuntime, LoadsDefaultRuntime) {
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
+ ASSERT_TRUE((bool)runtime);
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
+ return RUN_ALL_TESTS();
+}
diff --git a/org.genivi.commonapi.core.verification/src/StabilityMP.cpp b/org.genivi.commonapi.core.verification/src/StabilityMP.cpp
new file mode 100644
index 0000000..92f61c4
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/StabilityMP.cpp
@@ -0,0 +1,648 @@
+/* stability tests, control program. */
+/* this program takes care of setting up a test and then making sure things happen in proper sequence. */
+
+#include <functional>
+#include <fstream>
+#include <algorithm>
+#include <gtest/gtest.h>
+#include <CommonAPI/CommonAPI.hpp>
+#include "v1_0/commonapi/stability/mp/TestInterfaceProxy.hpp"
+#include "v1_0/commonapi/stability/mp/ControlInterfaceProxy.hpp"
+#include "stub/StabControlStub.h"
+#include "stub/StabilityMPStub.h"
+#include <unistd.h>
+#include <sys/wait.h>
+
+using namespace v1_0::commonapi::stability::mp;
+
+const std::string serviceId = "service-sample";
+const std::string clientId = "client-sample";
+
+const std::string domain = "local";
+const std::string testAddress = "commonapi.stability.mp.TestInterface";
+const std::string controlAddress = "commonapi.stability.mp.ControlInterface";
+const std::string COMMONAPI_CONFIG_SUFFIX = ".conf";
+
+// test magnitude constants - the bigger the numbers, the more stressful the test
+const int N_SERVERS = 100;
+const int N_THREADS = 100;
+
+const int MAX_WAIT = 10000;
+
+const int N_TEST_PROXY_PROCESSES = 3;
+const int N_CHILDREN = 2 + 2 * N_TEST_PROXY_PROCESSES; // needs to be large enough to cover for all created processes
+pid_t childpids[N_CHILDREN];
+bool idChild;
+bool controlServiceRegistered = false;
+std::shared_ptr<CommonAPI::Runtime> runtime_;
+std::shared_ptr<CommonAPI::Factory> stubFactory_;
+std::shared_ptr<StabControlStub> controlServiceStub_;
+class Environment: public :: testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ }
+
+ virtual void TearDown() {
+ }
+
+};
+
+// server states:
+const int WAITING_FOR_CHILDREN = 0;
+// commands from child to parent:
+const uint32_t QUERY_NEW_ID = 0;
+const uint32_t GET_COMMAND = 1;
+const uint32_t CMD_DONE = 2;
+const uint32_t PROXIES_CONNECTED_OK = 3;
+const uint32_t PROXIES_CONNECTED_FAIL = 4;
+
+// child states:
+const int CHILD_SETUP = 1;
+const int CHILD_IDLE = 2;
+const int CHILD_RESERVED_IDLE = 3;
+const int CHILD_PROCESSING_CMD = 4;
+const int CONNECTION_STATUS_OK = 5;
+const int CONNECTION_STATUS_FAIL = 6;
+const int DEAD = 7;
+
+// commands from parent to child
+const uint8_t KEEP_IDLE = 1;
+const uint8_t PROXY_CREATE = 2;
+const uint8_t WAIT_UNTIL_CONNECTED = 3;
+const uint8_t WAIT_UNTIL_DISCONNECTED = 4;
+const uint8_t KILL_YOURSELF = 5;
+const uint8_t SERVER_CREATE = 6;
+
+class ControledChild {
+public:
+ uint8_t id;
+ int state = CHILD_SETUP;
+ uint8_t next_cmd;
+};
+
+std::vector<ControledChild *> children;
+bool allChildrenRegistered = false;
+
+bool isFree(ControledChild * pChild)
+{
+ return (pChild->state == CHILD_IDLE);
+}
+ControledChild * findFreeChild(void)
+{
+ std::vector<ControledChild *>::iterator i = std::find_if(children.begin(), children.end(), isFree);
+ if (i == children.end())
+ return 0;
+ (*i)->state = CHILD_RESERVED_IDLE;
+ return *i;
+}
+ControledChild * findChild(uint8_t id)
+{
+
+ std::vector<ControledChild *>::iterator i = children.begin();
+ while (i != children.end()) {
+ if ((*i)->id == id)
+ return *i;
+ i++;
+ }
+ return 0;
+}
+
+class ProxyThread {
+public:
+ std::shared_ptr<TestInterfaceProxy<>> proxy_[N_SERVERS];
+ void createProxies(void) {
+ // create a proxy for each of the servers
+ for (unsigned int proxycount = 0; proxycount < N_SERVERS; proxycount++) {
+ proxy_[proxycount] = runtime_->buildProxy<TestInterfaceProxy>(domain, testAddress + std::to_string(proxycount), clientId);
+ success_ = success_ && (bool)proxy_[proxycount];
+ }
+ }
+ void pollForAvailability(void) {
+ success_ = false;
+ for (int wait = 0; wait < 100; wait++) {
+ bool allAvailable = true;
+ for (unsigned int proxycount = 0; proxycount < N_SERVERS; proxycount++) {
+ if (!proxy_[proxycount]->isAvailable()) {
+ allAvailable = false;
+ break;
+ }
+ }
+ if (allAvailable) {
+ success_ = true;
+ break;
+ }
+ usleep(10000);
+ }
+ }
+ void pollForUnavailability(void) {
+ success_ = false;
+ for (int wait = 0; wait < 100; wait++) {
+ bool allUnAvailable = true;
+ for (unsigned int proxycount = 0; proxycount < N_SERVERS; proxycount++) {
+ if (proxy_[proxycount]->isAvailable()) {
+ allUnAvailable = false;
+ break;
+ }
+ }
+ if (allUnAvailable) {
+ success_ = true;
+ break;
+ }
+ usleep(10000);
+ }
+ }
+ void setThread(std::thread *thread) {
+ thread_ = thread;
+ }
+ std::thread * getThread(void) {
+ return thread_;
+ }
+ bool getSuccess(void) {
+ return success_;
+ }
+ std::thread *thread_ = 0;
+ bool success_ = true;
+};
+
+class ChildProcess {
+public:
+ bool setup()
+ {
+ runtime_ = CommonAPI::Runtime::get();
+ testProxy_ = runtime_->buildProxy<ControlInterfaceProxy>(domain, controlAddress, clientId);
+ while(!testProxy_->isAvailable())
+ usleep(10000);
+ // send register message through command interface
+ uint8_t cmd;
+ uint32_t data1, data2;
+ bool status = sendMessage(0, QUERY_NEW_ID, cmd, data1, data2);
+ if (!status)
+ // problems with communication.
+ return false;
+ id = cmd;
+ state = CHILD_IDLE;
+ return true;
+ }
+
+ bool sendMessage(const uint8_t &id,
+ const uint32_t &data,
+ uint8_t &command,
+ uint32_t &data1,
+ uint32_t &data2
+ )
+ {
+ CommonAPI::CallStatus callStatus;
+ testProxy_->controlMethod(id, data, callStatus, command, data1, data2);
+ if (callStatus == CommonAPI::CallStatus::SUCCESS)
+ return true;
+ // on error, exit - the control service has most likely just died.
+ exit(1);
+ return false;
+ }
+
+ void processCommands()
+ {
+ ProxyThread * proxyrunners[N_THREADS];
+ while (true) {
+ switch(state)
+ {
+ case CHILD_IDLE:
+ // send polling message
+ uint8_t cmd;
+ uint32_t data1, data2;
+ bool status = sendMessage(id, GET_COMMAND, cmd, data1, data2);
+ if (cmd == KEEP_IDLE) {
+ usleep(10000);
+ break;
+ }
+ if (cmd == PROXY_CREATE) {
+ // create threads with proxies to test services.
+ for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) {
+ proxyrunners[threadcount] = new ProxyThread();
+ std::thread * thread = new std::thread(std::bind(&ProxyThread::createProxies, proxyrunners[threadcount]));
+ proxyrunners[threadcount]->setThread(thread);
+ }
+
+ // wait until all threads have completed creating the proxies.
+ for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) {
+ proxyrunners[threadcount]->getThread()->join();
+ delete proxyrunners[threadcount]->getThread();
+ proxyrunners[threadcount]->setThread(0);
+ }
+
+ // once done with all, send CMD_DONE message.
+ sendMessage(id, CMD_DONE, cmd, data1, data2);
+ // then start polling again.
+ state = CHILD_IDLE;
+ }
+ else if (cmd == SERVER_CREATE) {
+ // create services for a number of addresses
+ std::shared_ptr<StabilityMPStub> testMultiRegisterStub_;
+ testMultiRegisterStub_ = std::make_shared<StabilityMPStub>();
+ for (unsigned int regcount = 0; regcount < N_SERVERS; regcount++) {
+ bool serviceRegistered_ = runtime_->registerService(domain, testAddress + std::to_string( regcount ), testMultiRegisterStub_, serviceId);
+ }
+
+ sendMessage(id, CMD_DONE, cmd, data1, data2);
+ state = CHILD_IDLE;
+ }
+ else if (cmd == WAIT_UNTIL_CONNECTED) {
+ // create threads to test the proxy availability
+ for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) {
+ std::thread * thread = new std::thread(std::bind(&ProxyThread::pollForAvailability, proxyrunners[threadcount]));
+ proxyrunners[threadcount]->setThread(thread);
+ }
+ // wait until all threads have completed
+ for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) {
+ proxyrunners[threadcount]->getThread()->join();
+ delete proxyrunners[threadcount]->getThread();
+ proxyrunners[threadcount]->setThread(0);
+ }
+ // check for succession status
+ bool success = true;
+ for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) {
+ success = success & proxyrunners[threadcount]->getSuccess();
+ }
+
+ // send message with the succession status
+ if (success)
+ sendMessage(id, PROXIES_CONNECTED_OK, cmd, data1, data2);
+ else
+ sendMessage(id, PROXIES_CONNECTED_FAIL, cmd, data1, data2);
+
+ // then start polling again.
+ state = CHILD_IDLE;
+
+ }
+ else if (cmd == WAIT_UNTIL_DISCONNECTED) {
+ // create threads to test the proxy unavailability
+ for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) {
+ std::thread * thread = new std::thread(std::bind(&ProxyThread::pollForUnavailability, proxyrunners[threadcount]));
+ proxyrunners[threadcount]->setThread(thread);
+ }
+ // wait until all threads have completed
+ for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) {
+ proxyrunners[threadcount]->getThread()->join();
+ delete proxyrunners[threadcount]->getThread();
+ proxyrunners[threadcount]->setThread(0);
+ }
+ // check for succession status
+ bool success = true;
+ for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) {
+ success = success & proxyrunners[threadcount]->getSuccess();
+ }
+
+ // send message with the succession status
+ if (success)
+ sendMessage(id, PROXIES_CONNECTED_OK, cmd, data1, data2);
+ else
+ sendMessage(id, PROXIES_CONNECTED_FAIL, cmd, data1, data2);
+
+ // then start polling again.
+ state = CHILD_IDLE;
+
+ }
+ else if (cmd == KILL_YOURSELF) {
+ exit(0);
+ }
+
+ }
+ }
+ return;
+ }
+
+
+ std::shared_ptr<ControlInterfaceProxy<>> testProxy_;
+
+ uint8_t id = 0;
+ int state = CHILD_SETUP;
+};
+
+int state = WAITING_FOR_CHILDREN;
+static int8_t next_id = 1;
+
+void listener(uint8_t id,uint32_t data, uint8_t& command, uint32_t& min, uint32_t &max) {
+ command = 0;
+ min = 0;
+ max = 0;
+ switch(data) {
+ case QUERY_NEW_ID:
+ {
+ // create a child data structure
+ ControledChild * child = new ControledChild();
+
+ // add this to the structure
+ child->id = next_id;
+ // increment id
+ next_id++;
+ child->state = CHILD_IDLE;
+ // prepare to return id to child
+ command = child->id;
+ children.push_back(child);
+ child->next_cmd = KEEP_IDLE;
+ }
+ if (children.size() == N_CHILDREN)
+ allChildrenRegistered = true;
+ break;
+
+ case GET_COMMAND:
+ {
+ // find the child with this id
+ ControledChild * child = findChild(id);
+ ASSERT_TRUE((bool)child);
+ uint8_t cmd = child->next_cmd;
+ if (cmd != KEEP_IDLE) {
+ child->next_cmd = KEEP_IDLE;
+ child->state = CHILD_PROCESSING_CMD;
+ }
+ command = cmd;
+ }
+ break;
+
+ case CMD_DONE:
+ {
+ // find the child with this id
+ ControledChild * child = findChild(id);
+ ASSERT_TRUE((bool)child);
+ child->state = CHILD_RESERVED_IDLE;
+ }
+ break;
+
+ case PROXIES_CONNECTED_OK:
+ {
+ // find the child with this id
+ ControledChild * child = findChild(id);
+ ASSERT_TRUE((bool)child);
+ child->state = CONNECTION_STATUS_OK;
+ }
+ break;
+
+ case PROXIES_CONNECTED_FAIL:
+ {
+ // find the child with this id
+ ControledChild * child = findChild(id);
+ ASSERT_TRUE((bool)child);
+ child->state = CONNECTION_STATUS_FAIL;
+ }
+ break;
+ }
+}
+
+
+/* this class is instantiated only for the control process. */
+class Stability: public ::testing::Test {
+protected:
+ void SetUp() {
+
+ }
+
+ void TearDown() {
+
+ }
+};
+
+TEST_F(Stability, BasicFunctionality) {
+ ASSERT_TRUE(allChildrenRegistered);
+}
+
+
+TEST_F(Stability, ProxyCreation_ProxyFirst) {
+ /*
+ DO for N child processes
+ get free child entry (proxy process)
+ setup 'proxy c' command
+ wait until child proc is in 'CMD DONE'
+ END
+ get free child entry (server)
+ setup 'server c' command
+ wait until server is in 'CMD DONE'
+ DO for N proxy processes
+ setup 'query status' c
+ wait until child proc is in 'CMD DONE'
+ assert child proc status is okay
+ END
+ setup 'kill' command to server
+ wait until server is in 'CMD SENT'
+ DO for N proxy processes
+ setup 'query status' cmd
+ wait until child proc is in 'CMD DONE'
+ assert child proc status is okay
+ setup 'kill' to child
+ wait until child proc is in CMD SENT
+ END
+ */
+ ControledChild * proxyprocs[N_TEST_PROXY_PROCESSES];
+ for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) {
+ ControledChild * child = findFreeChild();
+ ASSERT_TRUE((bool)child);
+ proxyprocs[i] = child;
+ child->state = CHILD_PROCESSING_CMD;
+ child->next_cmd = PROXY_CREATE;
+ }
+ // wait until children are ready for more commands
+ for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) {
+ ControledChild * child = proxyprocs[i];
+ for (int wait = 0; wait < MAX_WAIT; wait++) {
+ if (child->state == CHILD_RESERVED_IDLE) {
+ break;
+ }
+ usleep(100000);
+ }
+ ASSERT_TRUE(child->state == CHILD_RESERVED_IDLE);
+ }
+ // setup server test proc
+ ControledChild * srvChild = findFreeChild();
+ ASSERT_TRUE((bool)srvChild);
+ srvChild->state = CHILD_PROCESSING_CMD;
+ srvChild->next_cmd = SERVER_CREATE;
+ for (int wait = 0; wait < MAX_WAIT; wait++) {
+ if (srvChild->state == CHILD_RESERVED_IDLE) {
+ break;
+ }
+ usleep(100000);
+ }
+ ASSERT_TRUE(srvChild->state == CHILD_RESERVED_IDLE);
+ // send proxy status query messages
+ for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) {
+ ControledChild * child = proxyprocs[i];
+ child->state = CHILD_PROCESSING_CMD;
+ child->next_cmd = WAIT_UNTIL_CONNECTED;
+ }
+ // wait until children return connection status
+ for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) {
+ ControledChild * child = proxyprocs[i];
+ for (int wait = 0; wait < MAX_WAIT; wait++) {
+ if (child->state == CONNECTION_STATUS_OK) {
+ break;
+ }
+ if (child->state == CONNECTION_STATUS_FAIL) {
+ break;
+ }
+ usleep(100000);
+ }
+ ASSERT_TRUE(child->state == CONNECTION_STATUS_OK);
+ }
+ // kill server
+ srvChild->next_cmd = KILL_YOURSELF;
+ srvChild->state = DEAD;
+ // send proxy status query messages
+ for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) {
+ ControledChild * child = proxyprocs[i];
+ child->next_cmd = WAIT_UNTIL_DISCONNECTED;
+ }
+ // wait until children return connection status
+ for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) {
+ ControledChild * child = proxyprocs[i];
+ for (int wait = 0; wait < MAX_WAIT; wait++) {
+ if (child->state == CONNECTION_STATUS_OK) {
+ break;
+ }
+ if (child->state == CONNECTION_STATUS_FAIL) {
+ break;
+ }
+ usleep(100000);
+ }
+ ASSERT_TRUE(child->state == CONNECTION_STATUS_OK);
+ }
+ // kill children
+ for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) {
+ ControledChild * child = proxyprocs[i];
+ child->next_cmd = KILL_YOURSELF;
+ child->state = DEAD;
+ }
+
+
+}
+
+TEST_F(Stability, ProxyCreation_ServerFirst) {
+
+ ControledChild * proxyprocs[N_TEST_PROXY_PROCESSES];
+
+ // setup server test proc
+ ControledChild * srvChild = findFreeChild();
+ ASSERT_TRUE((bool)srvChild);
+ srvChild->state = CHILD_PROCESSING_CMD;
+ srvChild->next_cmd = SERVER_CREATE;
+ for (int wait = 0; wait < MAX_WAIT; wait++) {
+ if (srvChild->state == CHILD_RESERVED_IDLE) {
+ break;
+ }
+ usleep(100000);
+ }
+ ASSERT_TRUE(srvChild->state == CHILD_RESERVED_IDLE);
+
+ for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) {
+ ControledChild * child = findFreeChild();
+ ASSERT_TRUE((bool)child);
+ proxyprocs[i] = child;
+ child->state = CHILD_PROCESSING_CMD;
+ child->next_cmd = PROXY_CREATE;
+ }
+ // wait until children are ready for more commands
+ for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) {
+ ControledChild * child = proxyprocs[i];
+ for (int wait = 0; wait < MAX_WAIT; wait++) {
+ if (child->state == CHILD_RESERVED_IDLE) {
+ break;
+ }
+ usleep(100000);
+ }
+ ASSERT_TRUE(child->state == CHILD_RESERVED_IDLE);
+ }
+
+ // send proxy status query messages
+ for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) {
+ ControledChild * child = proxyprocs[i];
+ child->state = CHILD_PROCESSING_CMD;
+ child->next_cmd = WAIT_UNTIL_CONNECTED;
+ }
+ // wait until children return connection status
+ for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) {
+ ControledChild * child = proxyprocs[i];
+ for (int wait = 0; wait < MAX_WAIT; wait++) {
+ if (child->state == CONNECTION_STATUS_OK) {
+ break;
+ }
+ if (child->state == CONNECTION_STATUS_FAIL) {
+ break;
+ }
+ usleep(100000);
+ }
+ ASSERT_TRUE(child->state == CONNECTION_STATUS_OK);
+ }
+ // kill server
+ srvChild->next_cmd = KILL_YOURSELF;
+ srvChild->state = DEAD;
+ // send proxy status query messages
+ for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) {
+ ControledChild * child = proxyprocs[i];
+ child->next_cmd = WAIT_UNTIL_DISCONNECTED;
+ }
+ // wait until children return connection status
+ for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) {
+ ControledChild * child = proxyprocs[i];
+ for (int wait = 0; wait < MAX_WAIT; wait++) {
+ if (child->state == CONNECTION_STATUS_OK) {
+ break;
+ }
+ if (child->state == CONNECTION_STATUS_FAIL) {
+ break;
+ }
+ usleep(100000);
+ }
+ ASSERT_TRUE(child->state == CONNECTION_STATUS_OK);
+ }
+ // kill children
+ for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) {
+ ControledChild * child = proxyprocs[i];
+ child->next_cmd = KILL_YOURSELF;
+ child->state = DEAD;
+ }
+}
+
+int main(int argc, char ** argv)
+{
+ /* create the necessary child processes */
+ /* forking is best done before the google test environment is set up */
+ bool isChild = false;
+ for (int i = 0; i < N_CHILDREN; i++) {
+ pid_t child = fork();
+ if (child == 0) {
+ isChild = true;
+ break;
+ }
+ childpids[i] = child;
+ }
+
+ /* if we are not a child, set up test environment */
+ if (!isChild) {
+ // do this just once
+ runtime_ = CommonAPI::Runtime::get();
+ // register control service
+ StabControlStub::registerListener(&listener);
+ controlServiceStub_ = std::make_shared<StabControlStub>();
+ controlServiceRegistered = runtime_->registerService(domain, controlAddress, controlServiceStub_, serviceId);
+ std::cout << "Control service registered at " << controlAddress << std::endl;
+
+ // wait until children have been registered
+ while (!allChildrenRegistered) {
+ usleep(10000);
+ }
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
+ return RUN_ALL_TESTS();
+ }
+ /* otherwise, start acting as a child process */
+ ChildProcess child;
+ child.setup();
+ child.processCommands();
+
+ /* TBD */
+
+ return 0;
+}
+
+
diff --git a/org.genivi.commonapi.core.verification/src/StabilitySP.cpp b/org.genivi.commonapi.core.verification/src/StabilitySP.cpp
new file mode 100644
index 0000000..34059f8
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/StabilitySP.cpp
@@ -0,0 +1,617 @@
+/* Copyright (C) 2015 BMW Group
+ * Author: JP Ikaheimonen (jp_ikaheimonen@mentor.com)
+ * 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/. */
+
+/**
+* @file StabilitySP
+*/
+
+#include <functional>
+#include <fstream>
+#include <gtest/gtest.h>
+#include "CommonAPI/CommonAPI.hpp"
+#include "v1_0/commonapi/stability/sp/TestInterfaceProxy.hpp"
+#include "stub/StabilitySPStub.h"
+
+const std::string serviceId = "service-sample";
+const std::string clientId = "client-sample";
+
+const std::string domain = "local";
+const std::string testAddress = "commonapi.stability.sp.TestInterface";
+const std::string COMMONAPI_CONFIG_SUFFIX = ".conf";
+const int MAXSERVERCOUNT = 40;
+const int MAXTHREADCOUNT = 40;
+const int MAXMETHODCALLS = 80;
+const int MAXREGLOOPS = 16;
+const int MAXREGCOUNT = 16;
+const int MESSAGESIZE = 80;
+const int MAXSUBSCRIPTIONSETS = 10;
+
+using namespace v1_0::commonapi::stability::sp;
+
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+ virtual void SetUp() {
+ }
+
+ virtual void TearDown() {
+ }
+};
+
+class StabilitySP: public ::testing::Test {
+
+protected:
+ void SetUp() {
+ runtime_ = CommonAPI::Runtime::get();
+ ASSERT_TRUE((bool)runtime_);
+
+ testStub_ = std::make_shared<StabilitySPStub>();
+ serviceRegistered_ = runtime_->registerService(domain, testAddress, testStub_, serviceId);
+ ASSERT_TRUE(serviceRegistered_);
+
+ testProxy_ = runtime_->buildProxy<TestInterfaceProxy>(domain, testAddress, clientId);
+ ASSERT_TRUE((bool)testProxy_);
+
+ testProxy_->isAvailableBlocking();
+ ASSERT_TRUE(testProxy_->isAvailable());
+ }
+
+ void TearDown() {
+ bool unregistered = runtime_->unregisterService(domain, StabilitySPStub::StubInterface::getInterface(), testAddress);
+ ASSERT_TRUE(unregistered);
+ }
+
+ uint8_t value_;
+ bool serviceRegistered_;
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
+
+ std::shared_ptr<TestInterfaceProxy<>> testProxy_;
+ std::shared_ptr<TestInterfaceStub> testStub_;
+};
+/**
+* @test Register and unregister services in a loop.
+* - do MAXREGLOOPS times:
+* - register MAXREGCOUNT addresses as services
+* - unregister the addresses that were just registered
+* - check the return code of each register/unregister call
+* - test fails if any of the return codes are false
+**/
+
+TEST_F(StabilitySP, RepeatedRegistrations) {
+
+ std::shared_ptr<TestInterfaceStubDefault> testMultiRegisterStub_;
+
+ testMultiRegisterStub_ = std::make_shared<StabilitySPStub>();
+ for (unsigned int loopcount = 0; loopcount < MAXREGLOOPS; loopcount++) {
+ for (unsigned int regcount = 0; regcount < MAXREGCOUNT; regcount++) {
+ serviceRegistered_ = runtime_->registerService(domain, testAddress + std::to_string( regcount ), testMultiRegisterStub_, serviceId);
+ ASSERT_TRUE(serviceRegistered_);
+ }
+ for (unsigned int regcount = 0; regcount < MAXREGCOUNT; regcount++) {
+ serviceRegistered_ = runtime_->unregisterService(domain, StabilitySPStub::StubInterface::getInterface(), testAddress + std::to_string( regcount ));
+ ASSERT_TRUE(serviceRegistered_);
+ }
+ }
+}
+
+/* Helper class. Creates proxies for each server and calls a method for each */
+class ProxyThread {
+public:
+ int asyncCounter = 0;
+ std::shared_ptr<TestInterfaceProxy<>> proxy_[MAXSERVERCOUNT];
+ // callback for asynchronous attribute functions.
+ void recvValue(const CommonAPI::CallStatus& callStatus, TestInterface::tArray arrayResultValue) {
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ asyncCounter++;
+
+ TestInterface::tArray arrayTestValue;
+
+ // check the contents of the attribute.
+ for (unsigned int messageindex = 0; messageindex < MESSAGESIZE; messageindex++) {
+ arrayTestValue.push_back((unsigned char)(messageindex & 0xFF));
+ }
+
+ EXPECT_EQ(arrayTestValue, arrayResultValue);
+
+ }
+ // callback for attribute subscriptions.
+ void recvSubscribedValue(TestInterface::tArray arrayResultValue) {
+ asyncCounter++;
+ TestInterface::tArray arrayTestValue;
+
+ // check the contents of the attribute.
+ // The first byte may change, so ignore that one.
+ arrayTestValue.push_back(arrayResultValue[0]);
+ for (unsigned int messageindex = 0; messageindex < MESSAGESIZE; messageindex++) {
+ arrayTestValue.push_back((unsigned char)(messageindex & 0xFF));
+ }
+
+ EXPECT_EQ(arrayTestValue, arrayResultValue);
+ }
+
+ // helper function for creating proxies.
+ void createProxies(void) {
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
+ runtime_ = CommonAPI::Runtime::get();
+
+ // create a proxy for each of the servers
+ for (unsigned int proxycount = 0; proxycount < MAXSERVERCOUNT; proxycount++) {
+ proxy_[proxycount] = runtime_->buildProxy<TestInterfaceProxy>(domain, testAddress + std::to_string(proxycount), clientId);
+ success_ = success_ && (bool)proxy_[proxycount];
+ ASSERT_TRUE(success_);
+ for (unsigned int wait = 0; !proxy_[proxycount]->isAvailable() && wait < 100; ++wait) {
+ usleep(10000);
+ }
+ ASSERT_TRUE(proxy_[proxycount]->isAvailable());
+ }
+ }
+
+ void runMethodCalls(void) {
+ createProxies();
+ for (unsigned int loopcount = 0; loopcount < MAXMETHODCALLS; loopcount++) {
+ for (unsigned int proxycount = 0; proxycount < MAXSERVERCOUNT; proxycount++) {
+ exerciseMethod(proxy_[proxycount]);
+ }
+ }
+ }
+ void runSetAttributes() {
+ createProxies();
+ for (unsigned int loopcount = 0; loopcount < MAXMETHODCALLS; loopcount++) {
+ for (unsigned int proxycount = 0; proxycount < MAXSERVERCOUNT; proxycount++) {
+ exerciseSetAttribute(proxy_[proxycount]);
+ }
+ }
+
+ }
+ void runCreateProxiesAndSubscribe() {
+ std::function<void (TestInterface::tArray)> myCallback =
+ std::bind(&ProxyThread::recvSubscribedValue, this, std::placeholders::_1);
+ createProxies();
+ for (unsigned int proxycount = 0; proxycount < MAXSERVERCOUNT; proxycount++) {
+ // subscribe for attributes in that proxy
+ proxy_[proxycount]->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback);
+ }
+ }
+
+ void waitUntilAsyncCountIsFull(int expected) {
+ int previousCount = asyncCounter;
+ while (true) {
+ if (asyncCounter == expected) break;
+ for (unsigned int wait = 0; wait < 1000; wait++) {
+ if (previousCount != asyncCounter) {
+ break;
+ }
+ usleep(10000);
+ }
+ if (previousCount == asyncCounter) {
+ break;
+ }
+ previousCount = asyncCounter;
+ }
+ EXPECT_EQ(expected, asyncCounter);
+ }
+
+ void runSetSubscribedAttributes(unsigned int id) {
+
+ unsigned char message1 = id;
+ unsigned char message2 = message1 + MAXTHREADCOUNT;
+ unsigned char message = message1;
+
+ for (unsigned int loopcount = 0; loopcount < MAXSUBSCRIPTIONSETS; loopcount++) {
+ for (unsigned int proxycount = 0; proxycount < MAXSERVERCOUNT; proxycount++) {
+ exerciseSetSubscribedAttribute(proxy_[proxycount], message);
+ // toggle between two different messages
+ message = message1 + message2 - message;
+ }
+ }
+
+ // now wait until all the callbacks have been called
+ int EXPECTED_COUNT = MAXSUBSCRIPTIONSETS * MAXSERVERCOUNT * MAXTHREADCOUNT;
+ waitUntilAsyncCountIsFull(EXPECTED_COUNT);
+ }
+
+ void runGetAttributes() {
+ createProxies();
+ for (unsigned int loopcount = 0; loopcount < MAXMETHODCALLS; loopcount++) {
+ for (unsigned int proxycount = 0; proxycount < MAXSERVERCOUNT; proxycount++) {
+ exerciseGetAttribute(proxy_[proxycount]);
+ }
+ }
+
+ }
+ void runGetAttributesAsync() {
+ createProxies();
+ for (unsigned int loopcount = 0; loopcount < MAXMETHODCALLS; loopcount++) {
+ for (unsigned int proxycount = 0; proxycount < MAXSERVERCOUNT; proxycount++) {
+ exerciseGetAttributeAsync(proxy_[proxycount]);
+ }
+ }
+
+ // now wait until all the callbacks have been called
+ int EXPECTED_COUNT = MAXMETHODCALLS * MAXSERVERCOUNT;
+ waitUntilAsyncCountIsFull(EXPECTED_COUNT);
+
+ }
+ void runSetAttributesAsync() {
+ createProxies();
+ for (unsigned int loopcount = 0; loopcount < MAXMETHODCALLS; loopcount++) {
+ for (unsigned int proxycount = 0; proxycount < MAXSERVERCOUNT; proxycount++) {
+ exerciseSetAttributeAsync(proxy_[proxycount]);
+ }
+ }
+
+ // now wait until all the callbacks have been called
+ int EXPECTED_COUNT = MAXMETHODCALLS * MAXSERVERCOUNT;
+ waitUntilAsyncCountIsFull(EXPECTED_COUNT);
+
+ }
+
+
+ bool getSuccess(void) {
+ return success_;
+ }
+ void setThread(std::thread *thread) {
+ thread_ = thread;
+ }
+ std::thread * getThread(void) {
+ return thread_;
+ }
+ bool exerciseMethod(std::shared_ptr<TestInterfaceProxy<>> proxy) {
+ TestInterface::tArray arrayTestValue;
+ TestInterface::tArray arrayResultValue;
+
+ for (unsigned int messageindex = 0; messageindex < MESSAGESIZE; messageindex++) {
+ arrayTestValue.push_back((unsigned char)(messageindex & 0xFF));
+ }
+
+ CommonAPI::CallStatus callStatus;
+ proxy->testMethod(arrayTestValue, callStatus, arrayResultValue);
+
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(arrayTestValue, arrayResultValue);
+
+ return true;
+ }
+ bool exerciseSetAttribute(std::shared_ptr<TestInterfaceProxy<>> proxy) {
+ TestInterface::tArray arrayTestValue;
+ TestInterface::tArray arrayResultValue;
+
+ for (unsigned int messageindex = 0; messageindex < MESSAGESIZE; messageindex++) {
+ arrayTestValue.push_back((unsigned char)(messageindex & 0xFF));
+ }
+
+ CommonAPI::CallStatus callStatus;
+ proxy->getTestAttributeAttribute().setValue(arrayTestValue, callStatus, arrayResultValue);
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(arrayTestValue, arrayResultValue);
+
+ return true;
+ }
+
+ bool exerciseSetSubscribedAttribute(std::shared_ptr<TestInterfaceProxy<>> proxy, unsigned char message_number) {
+ TestInterface::tArray arrayTestValue;
+ TestInterface::tArray arrayResultValue;
+ arrayTestValue.push_back(message_number);
+ for (unsigned int messageindex = 0; messageindex < MESSAGESIZE; messageindex++) {
+ arrayTestValue.push_back((unsigned char)(messageindex & 0xFF));
+ }
+
+ CommonAPI::CallStatus callStatus;
+ proxy->getTestAttributeAttribute().setValue(arrayTestValue, callStatus, arrayResultValue);
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(arrayTestValue, arrayResultValue);
+
+ return true;
+ }
+
+ bool exerciseGetAttribute(std::shared_ptr<TestInterfaceProxy<>> proxy) {
+ TestInterface::tArray arrayTestValue;
+ TestInterface::tArray arrayResultValue;
+
+ for (unsigned int messageindex = 0; messageindex < MESSAGESIZE; messageindex++) {
+ arrayTestValue.push_back((unsigned char)(messageindex & 0xFF));
+ }
+
+ CommonAPI::CallStatus callStatus;
+ proxy->getTestAttributeAttribute().getValue(callStatus, arrayResultValue);
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(arrayTestValue, arrayResultValue);
+
+ return true;
+ }
+ bool exerciseGetAttributeAsync(std::shared_ptr<TestInterfaceProxy<>> proxy) {
+ std::function<void (const CommonAPI::CallStatus&, TestInterface::tArray)> myCallback =
+ std::bind(&ProxyThread::recvValue, this, std::placeholders::_1, std::placeholders::_2);
+
+ CommonAPI::CallStatus callStatus;
+ proxy->getTestAttributeAttribute().getValueAsync(myCallback);
+ return true;
+ }
+ bool exerciseSetAttributeAsync(std::shared_ptr<TestInterfaceProxy<>> proxy) {
+ TestInterface::tArray arrayTestValue;
+ std::function<void (const CommonAPI::CallStatus&, TestInterface::tArray)> myCallback =
+ std::bind(&ProxyThread::recvValue, this, std::placeholders::_1, std::placeholders::_2);
+
+ for (unsigned int messageindex = 0; messageindex < MESSAGESIZE; messageindex++) {
+ arrayTestValue.push_back((unsigned char)(messageindex & 0xFF));
+ }
+
+ proxy->getTestAttributeAttribute().setValueAsync(arrayTestValue, myCallback);
+ return true;
+ }
+
+ std::thread *thread_ = 0;
+ bool success_ = true;
+};
+/**
+* @test Create a number of services and proxies and send messages through them.
+* - Register MAXSERVERCOUNT addresses as services
+* - Create MAXTHREADCOUNT threads, each of which
+* creates a proxy for each service address and
+* then sends MAXMETHODCALLS messages to each.
+* - Each message is MESSAGESIZE bytes long.
+* - Test fails if any of the services fail to get registered
+* or if any of the proxies won't get available
+* or if the return message from the server is not correct
+**/
+TEST_F(StabilitySP, MultipleMethodCalls) {
+ std::shared_ptr<TestInterfaceStubDefault> testMultiRegisterStub_;
+
+ testMultiRegisterStub_ = std::make_shared<StabilitySPStub>();
+ for (unsigned int regcount = 0; regcount < MAXSERVERCOUNT; regcount++) {
+ serviceRegistered_ = runtime_->registerService(domain, testAddress + std::to_string( regcount ), testMultiRegisterStub_, serviceId);
+ ASSERT_TRUE(serviceRegistered_);
+ }
+ ProxyThread * proxyrunners[MAXTHREADCOUNT];
+ for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) {
+ proxyrunners[threadcount] = new ProxyThread();
+ std::thread * thread = new std::thread(std::bind(&ProxyThread::runMethodCalls, proxyrunners[threadcount]));
+ proxyrunners[threadcount]->setThread(thread);
+ }
+ for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) {
+ proxyrunners[threadcount]->getThread()->join();
+ delete proxyrunners[threadcount]->getThread();
+ proxyrunners[threadcount]->setThread(0);
+ }
+ for (unsigned int regcount = 0; regcount < MAXSERVERCOUNT; regcount++) {
+ serviceRegistered_ = runtime_->unregisterService(domain, StabilitySPStub::StubInterface::getInterface(), testAddress + std::to_string( regcount ));
+ ASSERT_TRUE(serviceRegistered_);
+ }
+}
+/**
+* @test Create a number of services and proxies and set attributes through them.
+* - Register MAXSERVERCOUNT addresses as services
+* - Create MAXTHREADCOUNT threads, each of which
+* creates a proxy for each service address and
+* then sets attributes MAXMETHODCALLS times to each.
+* - Each attribute is MESSAGESIZE bytes long.
+* - Test fails if any of the services fail to get registered
+* or if any of the proxies won't get available
+* or if the return attribute from the server is not correct
+**/
+TEST_F(StabilitySP, MultipleAttributeSets) {
+ std::shared_ptr<TestInterfaceStubDefault> testMultiRegisterStub_;
+
+ testMultiRegisterStub_ = std::make_shared<StabilitySPStub>();
+ for (unsigned int regcount = 0; regcount < MAXSERVERCOUNT; regcount++) {
+ serviceRegistered_ = runtime_->registerService(domain, testAddress + std::to_string( regcount ), testMultiRegisterStub_, serviceId);
+ ASSERT_TRUE(serviceRegistered_);
+ }
+ ProxyThread * proxyrunners[MAXTHREADCOUNT];
+ for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) {
+ proxyrunners[threadcount] = new ProxyThread();
+ std::thread * thread = new std::thread(std::bind(&ProxyThread::runSetAttributes, proxyrunners[threadcount]));
+ proxyrunners[threadcount]->setThread(thread);
+ }
+ for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) {
+ proxyrunners[threadcount]->getThread()->join();
+ delete proxyrunners[threadcount]->getThread();
+ proxyrunners[threadcount]->setThread(0);
+ }
+ for (unsigned int regcount = 0; regcount < MAXSERVERCOUNT; regcount++) {
+ serviceRegistered_ = runtime_->unregisterService(domain, StabilitySPStub::StubInterface::getInterface(), testAddress + std::to_string( regcount ));
+ ASSERT_TRUE(serviceRegistered_);
+ }
+}
+
+/**
+* @test Create a number of services and proxies and get attributes through them.
+* - Register MAXSERVERCOUNT addresses as services
+* - Set the attribute for service, at the stub side.
+* - Create MAXTHREADCOUNT threads, each of which
+* creates a proxy for each service address and
+* then gets attributes MAXMETHODCALLS times for each.
+* - Each attribute is MESSAGESIZE bytes long.
+* - Test fails if any of the services fail to get registered
+* or if any of the proxies won't get available
+* or if the returned attribute from the server is not correct
+**/
+TEST_F(StabilitySP, MultipleAttributeGets) {
+ std::shared_ptr<StabilitySPStub> testMultiRegisterStub_;
+
+ testMultiRegisterStub_ = std::make_shared<StabilitySPStub>();
+ for (unsigned int regcount = 0; regcount < MAXSERVERCOUNT; regcount++) {
+ serviceRegistered_ = runtime_->registerService(domain, testAddress + std::to_string( regcount ), testMultiRegisterStub_, serviceId);
+ ASSERT_TRUE(serviceRegistered_);
+
+ }
+ TestInterface::tArray arrayTestValue;
+
+ for (unsigned int messageindex = 0; messageindex < MESSAGESIZE; messageindex++) {
+ arrayTestValue.push_back((unsigned char)(messageindex & 0xFF));
+ }
+ testMultiRegisterStub_->setTestValues(arrayTestValue);
+
+ ProxyThread * proxyrunners[MAXTHREADCOUNT];
+ for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) {
+ proxyrunners[threadcount] = new ProxyThread();
+ std::thread * thread = new std::thread(std::bind(&ProxyThread::runGetAttributes, proxyrunners[threadcount]));
+ proxyrunners[threadcount]->setThread(thread);
+ }
+ for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) {
+ proxyrunners[threadcount]->getThread()->join();
+ delete proxyrunners[threadcount]->getThread();
+ proxyrunners[threadcount]->setThread(0);
+ }
+ for (unsigned int regcount = 0; regcount < MAXSERVERCOUNT; regcount++) {
+ serviceRegistered_ = runtime_->unregisterService(domain, StabilitySPStub::StubInterface::getInterface(), testAddress + std::to_string( regcount ));
+ ASSERT_TRUE(serviceRegistered_);
+ }
+}
+
+/**
+* @test Create a number of services and proxies and get attributes through them.
+* - Register MAXSERVERCOUNT addresses as services
+* - Set the attribute for service, at the stub side.
+* - Create MAXTHREADCOUNT threads, each of which
+* creates a proxy for each service address and
+* then gets attributes MAXMETHODCALLS times for each asynchronously
+* - Each attribute is MESSAGESIZE bytes long.
+* - Test fails if any of the services fail to get registered
+* or if any of the proxies won't get available
+* or if the callbacks are not called correct number of times
+**/
+TEST_F(StabilitySP, MultipleAttributeGetAsyncs) {
+ std::shared_ptr<StabilitySPStub> testMultiRegisterStub_;
+
+ testMultiRegisterStub_ = std::make_shared<StabilitySPStub>();
+ for (unsigned int regcount = 0; regcount < MAXSERVERCOUNT; regcount++) {
+ serviceRegistered_ = runtime_->registerService(domain, testAddress + std::to_string( regcount ), testMultiRegisterStub_, serviceId);
+ ASSERT_TRUE(serviceRegistered_);
+ }
+ TestInterface::tArray arrayTestValue;
+
+ for (unsigned int messageindex = 0; messageindex < MESSAGESIZE; messageindex++) {
+ arrayTestValue.push_back((unsigned char)(messageindex & 0xFF));
+ }
+ testMultiRegisterStub_->setTestValues(arrayTestValue);
+
+ ProxyThread * proxyrunners[MAXTHREADCOUNT];
+ for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) {
+ proxyrunners[threadcount] = new ProxyThread();
+ std::thread * thread = new std::thread(std::bind(&ProxyThread::runGetAttributesAsync, proxyrunners[threadcount]));
+ proxyrunners[threadcount]->setThread(thread);
+ }
+ for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) {
+ proxyrunners[threadcount]->getThread()->join();
+ delete proxyrunners[threadcount]->getThread();
+ proxyrunners[threadcount]->setThread(0);
+ }
+ for (unsigned int regcount = 0; regcount < MAXSERVERCOUNT; regcount++) {
+ serviceRegistered_ = runtime_->unregisterService(domain, StabilitySPStub::StubInterface::getInterface(), testAddress + std::to_string( regcount ));
+ ASSERT_TRUE(serviceRegistered_);
+ }
+}
+
+/**
+* @test Create a number of services and proxies and set attributes through them.
+* - Register MAXSERVERCOUNT addresses as services
+* - Set the attribute for service, at the stub side.
+* - Create MAXTHREADCOUNT threads, each of which
+* creates a proxy for each service address and
+* then sets attributes MAXMETHODCALLS times for each asynchronously
+* - Each attribute is MESSAGESIZE bytes long.
+* - Test fails if any of the services fail to get registered
+* or if any of the proxies won't get available
+* or if the callbacks are not called correct number of times
+**/
+TEST_F(StabilitySP, MultipleAttributeSetAsyncs) {
+ std::shared_ptr<StabilitySPStub> testMultiRegisterStub_;
+
+ testMultiRegisterStub_ = std::make_shared<StabilitySPStub>();
+ for (unsigned int regcount = 0; regcount < MAXSERVERCOUNT; regcount++) {
+ serviceRegistered_ = runtime_->registerService(domain, testAddress + std::to_string( regcount ), testMultiRegisterStub_, serviceId);
+ ASSERT_TRUE(serviceRegistered_);
+ }
+ TestInterface::tArray arrayTestValue;
+
+ for (unsigned int messageindex = 0; messageindex < MESSAGESIZE; messageindex++) {
+ arrayTestValue.push_back((unsigned char)(messageindex & 0xFF));
+ }
+ testMultiRegisterStub_->setTestValues(arrayTestValue);
+
+ ProxyThread * proxyrunners[MAXTHREADCOUNT];
+ for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) {
+ proxyrunners[threadcount] = new ProxyThread();
+ std::thread * thread = new std::thread(std::bind(&ProxyThread::runSetAttributesAsync, proxyrunners[threadcount]));
+ proxyrunners[threadcount]->setThread(thread);
+ }
+ for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) {
+ proxyrunners[threadcount]->getThread()->join();
+ delete proxyrunners[threadcount]->getThread();
+ proxyrunners[threadcount]->setThread(0);
+ }
+ for (unsigned int regcount = 0; regcount < MAXSERVERCOUNT; regcount++) {
+ serviceRegistered_ = runtime_->unregisterService(domain, StabilitySPStub::StubInterface::getInterface(), testAddress + std::to_string( regcount ));
+ ASSERT_TRUE(serviceRegistered_);
+ }
+}
+
+/**
+* @test Create a number of services and proxies and set attributes through them.
+* - Register MAXSERVERCOUNT addresses as services
+* - Set the attribute for service, at the stub side.
+* - Create MAXTHREADCOUNT threads, each of which
+* creates a proxy for each service address and
+* then sets attributes MAXMETHODCALLS times for each asynchronously
+* - Each attribute is MESSAGESIZE bytes long.
+* - Test fails if any of the services fail to get registered
+* or if any of the proxies won't get available
+* or if the callbacks are not called correct number of times
+**/
+TEST_F(StabilitySP, MultipleAttributeSubscriptions) {
+ std::shared_ptr<StabilitySPStub> testMultiRegisterStub_;
+
+ testMultiRegisterStub_ = std::make_shared<StabilitySPStub>();
+ for (unsigned int regcount = 0; regcount < MAXSERVERCOUNT; regcount++) {
+ serviceRegistered_ = runtime_->registerService(domain, testAddress + std::to_string( regcount ), testMultiRegisterStub_, serviceId);
+ ASSERT_TRUE(serviceRegistered_);
+ }
+ TestInterface::tArray arrayTestValue;
+
+ for (unsigned int messageindex = 0; messageindex < MESSAGESIZE; messageindex++) {
+ arrayTestValue.push_back((unsigned char)(messageindex & 0xFF));
+ }
+ testMultiRegisterStub_->setTestValues(arrayTestValue);
+
+ ProxyThread * proxyrunners[MAXTHREADCOUNT];
+ for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) {
+ proxyrunners[threadcount] = new ProxyThread();
+ std::thread * thread = new std::thread(std::bind(&ProxyThread::runCreateProxiesAndSubscribe, proxyrunners[threadcount]));
+ proxyrunners[threadcount]->setThread(thread);
+ }
+ for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) {
+ proxyrunners[threadcount]->getThread()->join();
+ delete proxyrunners[threadcount]->getThread();
+ proxyrunners[threadcount]->setThread(0);
+ }
+
+ // sleep here a while to let the subscriptions sink in
+ usleep(100000);
+
+ for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) {
+ std::thread * thread = new std::thread(std::bind(&ProxyThread::runSetSubscribedAttributes, proxyrunners[threadcount], threadcount));
+ proxyrunners[threadcount]->setThread(thread);
+ }
+ for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) {
+ proxyrunners[threadcount]->getThread()->join();
+ delete proxyrunners[threadcount]->getThread();
+ proxyrunners[threadcount]->setThread(0);
+ }
+ for (unsigned int regcount = 0; regcount < MAXSERVERCOUNT; regcount++) {
+ serviceRegistered_ = runtime_->unregisterService( domain, StabilitySPStub::StubInterface::getInterface(), testAddress + std::to_string( regcount ));
+ ASSERT_TRUE(serviceRegistered_);
+ }
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
+ return RUN_ALL_TESTS();
+}
+
+
diff --git a/org.genivi.commonapi.core.verification/src/THMainLoopIndependence.cpp b/org.genivi.commonapi.core.verification/src/THMainLoopIndependence.cpp
new file mode 100644
index 0000000..ae0ff52
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/THMainLoopIndependence.cpp
@@ -0,0 +1,276 @@
+/* Copyright (C) 2014 - 2015 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+/**
+* @file Threading
+*/
+
+#include <gtest/gtest.h>
+#include "CommonAPI/CommonAPI.hpp"
+#include "utils/VerificationMainLoop.h"
+#include "v1_0/commonapi/threading/TestInterfaceProxy.hpp"
+#include "v1_0/commonapi/threading/TestInterfaceStubDefault.hpp"
+#include "utils/VerificationMainLoop.h"
+
+const std::string domain = "local";
+const std::string instance6 = "my.test.commonapi.address.six";
+const std::string instance7 = "my.test.commonapi.address.seven";
+const std::string instance8 = "my.test.commonapi.address.eight";
+const std::string mainloopName1 = "client-sample";
+const std::string mainloopName2 = "service-sample";
+
+class PingPongTestStub : public v1_0::commonapi::threading::TestInterfaceStubDefault {
+ virtual void testMethod(const std::shared_ptr<CommonAPI::ClientId> _client,
+ uint8_t _x,
+ testMethodReply_t _reply) {
+
+ _reply(_x);
+ }
+};
+
+class MainLoopThreadContext {
+public:
+ void setupRuntime(std::promise<bool>& p) {
+ runtime_ = CommonAPI::Runtime::get();
+ p.set_value(true);
+ }
+
+ void setupMainLoopContext(std::promise<bool>& p, std::string mainloopName) {
+ mainLoopContext_ = std::make_shared<CommonAPI::MainLoopContext>(mainloopName);
+ mainLoop_ = new CommonAPI::VerificationMainLoop(mainLoopContext_);
+ p.set_value(true);
+ }
+
+ void setAddresses(const std::string own, const std::string other, const std::string thirdParty) {
+ ownAddress_ = own;
+
+ otherAddress_ = other;
+ thirdPartyAddress_ = thirdParty;
+ }
+
+ void createProxyAndStub() {
+ stub_ = std::make_shared<PingPongTestStub>();
+
+ ASSERT_TRUE(runtime_->registerService(domain, ownAddress_, stub_, mainLoopContext_));
+
+ proxy_ = runtime_->buildProxy<v1_0::commonapi::threading::TestInterfaceProxy>(domain, otherAddress_, mainLoopContext_);
+ ASSERT_TRUE((bool)proxy_);
+
+ proxyThirdParty_ = runtime_->buildProxy<v1_0::commonapi::threading::TestInterfaceProxy>(domain, thirdPartyAddress_, mainLoopContext_);
+ ASSERT_TRUE((bool)proxyThirdParty_);
+ }
+
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
+ std::shared_ptr<CommonAPI::MainLoopContext> mainLoopContext_;
+
+ std::string ownAddress_, otherAddress_, thirdPartyAddress_;
+ std::shared_ptr<PingPongTestStub> stub_;
+ std::shared_ptr<v1_0::commonapi::threading::TestInterfaceProxy<>> proxy_, proxyThirdParty_;
+
+ CommonAPI::VerificationMainLoop* mainLoop_;
+};
+
+class THMainLoopIndependence: public ::testing::Test {
+protected:
+ void SetUp() {
+ std::shared_ptr<CommonAPI::Runtime> runtimePtr1_, runtimePtr2_;
+
+ std::promise<bool> promiseRuntime1, promiseRuntime2;
+ std::future<bool> futureRuntime1 = promiseRuntime1.get_future();
+ std::future<bool> futureRuntime2 = promiseRuntime2.get_future();
+
+ mainLoopThread1_ = std::thread(
+ std::bind(&MainLoopThreadContext::setupRuntime, &threadCtx1_, std::move(promiseRuntime1)));
+ mainLoopThread2_ = std::thread(
+ std::bind(&MainLoopThreadContext::setupRuntime, &threadCtx2_, std::move(promiseRuntime2)));
+
+ mainLoopThread1_.detach();
+ mainLoopThread2_.detach();
+
+ futureRuntime1.wait_for(std::chrono::milliseconds(200));
+ futureRuntime2.wait_for(std::chrono::milliseconds(200));
+
+ // check that both threads have a runtime and it is the same
+ ASSERT_TRUE((bool)threadCtx1_.runtime_);
+ ASSERT_TRUE((bool)threadCtx2_.runtime_);
+ ASSERT_EQ(threadCtx1_.runtime_, threadCtx2_.runtime_);
+
+ std::promise<bool> promiseContext1, promiseContext2;
+ std::future<bool> futureContext1 = promiseContext1.get_future();
+ std::future<bool> futureContext2 = promiseContext2.get_future();
+
+ mainLoopThread1_ = std::thread(
+ std::bind(
+ &MainLoopThreadContext::setupMainLoopContext,
+ &threadCtx1_,
+ std::move(promiseContext1),
+ mainloopName1));
+ mainLoopThread2_ = std::thread(
+ std::bind(
+ &MainLoopThreadContext::setupMainLoopContext,
+ &threadCtx2_,
+ std::move(promiseContext2),
+ mainloopName2));
+ mainLoopThread1_.detach();
+ mainLoopThread2_.detach();
+
+ futureContext1.wait_for(std::chrono::milliseconds(200));
+ futureContext2.wait_for(std::chrono::milliseconds(200));
+
+ // check that both threads have an own mainloop context
+ ASSERT_TRUE((bool)threadCtx1_.mainLoopContext_);
+ ASSERT_TRUE((bool)threadCtx2_.mainLoopContext_);
+ ASSERT_NE(threadCtx1_.mainLoopContext_, threadCtx2_.mainLoopContext_);
+
+ std::promise<bool> promiseFactory1, promiseFactory2;
+ std::future<bool> futureFactory1 = promiseFactory1.get_future();
+ std::future<bool> futureFactory2 = promiseFactory2.get_future();
+
+ futureFactory1.wait_for(std::chrono::milliseconds(200));
+ futureFactory2.wait_for(std::chrono::milliseconds(200));
+
+ // set addresses
+ threadCtx1_.setAddresses(instance7, instance8, instance6);
+ threadCtx2_.setAddresses(instance8, instance7, instance6);
+
+ threadCtx1_.createProxyAndStub();
+ threadCtx2_.createProxyAndStub();
+
+ mainLoopThread1_ = std::thread([&]() { threadCtx1_.mainLoop_->run(); });
+ mainLoopThread2_ = std::thread([&]() { threadCtx2_.mainLoop_->run(); });
+
+ usleep(200000);
+
+ ASSERT_TRUE(threadCtx1_.proxy_->isAvailable());
+ ASSERT_TRUE(threadCtx2_.proxy_->isAvailable());
+
+ if (threadCtx1_.mainLoop_->isRunning()) {
+ std::future<bool> threadCtx1MainStopped = threadCtx1_.mainLoop_->stop();
+ threadCtx1MainStopped.get();
+ }
+ if (threadCtx2_.mainLoop_->isRunning()) {
+ std::future<bool> threadCtx2MainStopped = threadCtx2_.mainLoop_->stop();
+ threadCtx2MainStopped.get();
+ }
+
+ mainLoopThread1_.join();
+ mainLoopThread2_.join();
+ }
+
+ void TearDown() {
+ threadCtx1_.runtime_->unregisterService(domain, PingPongTestStub::StubInterface::getInterface(), instance6);
+ threadCtx1_.runtime_->unregisterService(domain, PingPongTestStub::StubInterface::getInterface(), instance7);
+ threadCtx2_.runtime_->unregisterService(domain, PingPongTestStub::StubInterface::getInterface(), instance8);
+ usleep(2000);
+ threadCtx1_.mainLoop_->stop();
+ threadCtx2_.mainLoop_->stop();
+
+ if (threadCtx1_.mainLoop_->isRunning()) {
+ std::future<bool> threadCtx1MainStopped = threadCtx1_.mainLoop_->stop();
+ threadCtx1MainStopped.get();
+ }
+ if (threadCtx2_.mainLoop_->isRunning()) {
+ std::future<bool> threadCtx2MainStopped = threadCtx2_.mainLoop_->stop();
+ threadCtx2MainStopped.get();
+ }
+
+ if(mainLoopThread1_.joinable()) {
+ mainLoopThread1_.join();
+ }
+ if(mainLoopThread2_.joinable()) {
+ mainLoopThread2_.join();
+ }
+ }
+
+ MainLoopThreadContext threadCtx1_, threadCtx2_;
+ std::thread mainLoopThread1_, mainLoopThread2_;
+};
+
+/**
+* @test Proxy Receives Answer Only If Stub MainLoop Runs.
+* - start proxy in thread 1 and call testPredefinedTypeMethod
+* - proxy should not receive answer, if the stub mainloop does not run
+* - run mainloop of stub
+* - now the stub mainloop also runs, so the proxy should receive the answer
+*/
+TEST_F(THMainLoopIndependence, ProxyReceivesAnswerOnlyIfStubMainLoopRuns) {
+
+ CommonAPI::CallStatus callStatus;
+
+ uint8_t x, y;
+ x = 1;
+ y = 0;
+
+ std::thread mainLoopRunnerProxy([&]() { threadCtx1_.mainLoop_->runVerification(5, true, true); });
+ mainLoopRunnerProxy.detach();
+
+ mainLoopThread1_ = std::thread([&]() { threadCtx1_.proxy_->testMethod(x, callStatus, y); });
+ mainLoopThread1_.detach();
+
+ usleep(100000);
+ // proxy should not receive answer, if the stub mainloop does not run
+ ASSERT_EQ(0, y);
+
+ mainLoopThread2_ = std::thread([&]() { threadCtx2_.mainLoop_->run(); });
+ mainLoopThread2_.detach();
+
+ sleep(1);
+
+ // now the stub mainloop also runs, so the proxy should receive the answer
+ ASSERT_EQ(1, y);
+}
+
+/**
+* @test Proxy Receives Just His Own Answers.
+* - start 2 proxies in own threads
+* - call test method in each proxy
+* - now each proxy should have received the answer to his own request
+*/
+TEST_F(THMainLoopIndependence, ProxyReceivesJustHisOwnAnswers) {
+
+ std::shared_ptr<PingPongTestStub> stubThirdParty = std::make_shared<PingPongTestStub>();
+ auto runtime = CommonAPI::Runtime::get();
+ //ASSERT_TRUE(runtime->getServicePublisher()->registerService(stubThirdParty, testAddress6, runtime->createFactory()));
+ ASSERT_TRUE(runtime->registerService(domain, instance6, stubThirdParty));
+
+ CommonAPI::CallStatus callStatusProxy1, callStatusProxy2;
+
+ uint8_t x1, y1, x2, y2;
+ x1 = 1;
+ x2 = 2;
+ y1 = y2 = 0;
+
+ std::thread mainLoopRunnerProxy1([&]() { threadCtx1_.mainLoop_->run(); });
+ std::thread mainLoopRunnerProxy2([&]() { threadCtx2_.mainLoop_->run(); });
+ mainLoopRunnerProxy1.detach();
+ mainLoopRunnerProxy2.detach();
+
+ // wait until threads are running
+ while (!threadCtx1_.mainLoop_->isRunning() || !threadCtx2_.mainLoop_->isRunning()) {
+ usleep(100);
+ }
+
+ while(!(threadCtx1_.proxyThirdParty_->isAvailable() && threadCtx2_.proxyThirdParty_->isAvailable())) {
+ usleep(10000);
+ }
+
+ mainLoopThread1_ = std::thread([&]() { threadCtx1_.proxyThirdParty_->testMethod(x1, callStatusProxy1, y1); });
+ mainLoopThread2_ = std::thread([&]() { threadCtx2_.proxyThirdParty_->testMethod(x2, callStatusProxy2, y2); });
+ mainLoopThread1_.detach();
+ mainLoopThread2_.detach();
+
+ usleep(1000000);
+ // now each proxy should have received the answer to his own request
+ ASSERT_EQ(1, y1);
+ ASSERT_EQ(2, y2);
+
+ //sleep(1);
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
diff --git a/org.genivi.commonapi.core.verification/src/THMainLoopIntegration.cpp b/org.genivi.commonapi.core.verification/src/THMainLoopIntegration.cpp
new file mode 100644
index 0000000..69b6fc0
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/THMainLoopIntegration.cpp
@@ -0,0 +1,244 @@
+/* Copyright (C) 2014 - 2015 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+/**
+* @file Threading
+*/
+
+#include <gtest/gtest.h>
+#include "CommonAPI/CommonAPI.hpp"
+#include "utils/VerificationMainLoop.h"
+#include "v1_0/commonapi/threading/TestInterfaceProxy.hpp"
+#include "utils/VerificationMainLoop.h"
+#include "stub/THMainLoopIntegrationStub.h"
+
+const std::string domain = "local";
+const std::string instance = "my.test.commonapi.address";
+const std::string connection_client = "client-sample";
+const std::string connection_service = "service-sample";
+
+class THMainLoopIntegration: public ::testing::Test {
+
+protected:
+ void SetUp() {
+
+ runtime_ = CommonAPI::Runtime::get();
+ ASSERT_TRUE((bool) runtime_);
+
+ contextForProxy_ = std::make_shared<CommonAPI::MainLoopContext>(connection_client);
+ contextForStub_ = std::make_shared<CommonAPI::MainLoopContext>(connection_service);
+
+ ASSERT_TRUE((bool) contextForProxy_);
+ ASSERT_TRUE((bool) contextForStub_);
+ ASSERT_FALSE(contextForProxy_ == contextForStub_);
+
+ mainLoopForProxy_ = new CommonAPI::VerificationMainLoop(contextForProxy_);
+ mainLoopForStub_ = new CommonAPI::VerificationMainLoop(contextForStub_);
+
+ testStub_ = std::make_shared<v1_0::commonapi::threading::THMainLoopIntegrationStub>();
+ serviceRegistered_ = runtime_->registerService(domain, instance, testStub_, contextForStub_);
+ ASSERT_TRUE(serviceRegistered_);
+
+ testProxy_ = runtime_->buildProxy<v1_0::commonapi::threading::TestInterfaceProxy>(domain, instance, contextForProxy_);
+ ASSERT_TRUE((bool) testProxy_);
+
+ callbackCalled_ = 0;
+ lastBroadcastNumber_ = 0;
+ outInt_ = 0;
+ }
+
+ void TearDown() {
+ runtime_->unregisterService(domain, v1_0::commonapi::threading::THMainLoopIntegrationStub::StubInterface::getInterface(), instance);
+
+ if (mainLoopForProxy_->isRunning()) {
+ std::future<bool> proxyStopped = mainLoopForProxy_->stop();
+ // synchronisation with stopped mainloop
+ proxyStopped.get();
+ }
+ if (mainLoopForStub_->isRunning()) {
+ std::future<bool> stubStopped = mainLoopForStub_->stop();
+ // synchronisation with stopped mainloop
+ stubStopped.get();
+ }
+
+ usleep(200);
+ delete mainLoopForProxy_;
+ delete mainLoopForStub_;
+ }
+
+ bool serviceRegistered_;
+
+ std::shared_ptr<CommonAPI::Runtime> runtime_;
+
+ std::shared_ptr<CommonAPI::MainLoopContext> contextForProxy_;
+ std::shared_ptr<CommonAPI::MainLoopContext> contextForStub_;
+ std::shared_ptr<CommonAPI::Factory> mainloopFactoryProxy_;
+ std::shared_ptr<CommonAPI::Factory> mainloopFactoryStub_;
+
+ CommonAPI::VerificationMainLoop* mainLoopForProxy_;
+ CommonAPI::VerificationMainLoop* mainLoopForStub_;
+
+ std::shared_ptr<v1_0::commonapi::threading::TestInterfaceProxy<>> testProxy_;
+ std::shared_ptr<v1_0::commonapi::threading::THMainLoopIntegrationStub> testStub_;
+
+ int callbackCalled_;
+ uint8_t lastBroadcastNumber_;
+ int outInt_;
+
+public:
+ void broadcastCallback(uint8_t value) {
+
+ // check correct order
+ lastBroadcastNumber_++;
+ ASSERT_EQ(lastBroadcastNumber_, value);
+ }
+};
+
+/**
+* @test Verifies Transport Reading When Dispatching Watches.
+* - get proxy with available flag = true
+* - generate big test data
+* - send asynchronous test message
+* - dispatch dispatchSource: the message must not be arrived
+* - dispatch watches (reads transport).
+* - dispatch dispatchSources again: now the message must be arrived.
+*/
+TEST_F(THMainLoopIntegration, VerifyCommunicationWithMainLoop) {
+
+ std::thread proxyThread;
+ std::thread stubThread;
+ proxyThread = std::thread([&](){ mainLoopForProxy_->run(); });
+ stubThread = std::thread([&](){ mainLoopForStub_->run(); });
+ proxyThread.detach();
+ stubThread.detach();
+
+ // wait until threads are running
+ while (!mainLoopForProxy_->isRunning() || !mainLoopForStub_->isRunning()) {
+ usleep(100);
+ }
+
+ for(unsigned int i = 0; !testProxy_->isAvailable() && i < 100; ++i) {
+ usleep(10000);
+ }
+ ASSERT_TRUE(testProxy_->isAvailable());
+
+ uint8_t x = 5;
+ uint8_t y = 0;
+ CommonAPI::CallStatus callStatus;
+
+ testProxy_->testMethod(x, callStatus, y);
+ EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(x, y);
+}
+
+/**
+* @test Verifies Transport Reading When Dispatching Watches.
+* - get proxy with available flag = true
+* - generate big test data
+* - send asynchronous test message
+* - dispatch dispatchSource: the message must not be arrived
+* - dispatch watches (reads transport).
+* - dispatch dispatchSources again: now the message must be arrived.
+*/
+TEST_F(THMainLoopIntegration, VerifyTransportReading) {
+
+ std::thread proxyThread = std::thread([&](){ mainLoopForProxy_->run(); });
+ std::thread stubThread = std::thread([&](){ mainLoopForStub_->run(); });
+ proxyThread.detach();
+
+ // wait until threads are running
+ while (!mainLoopForProxy_->isRunning() || !mainLoopForStub_->isRunning()) {
+ usleep(100);
+ }
+
+ for(unsigned int i = 0; !testProxy_->isAvailable() && i < 100; ++i) {
+ usleep(10000);
+ }
+ ASSERT_TRUE(testProxy_->isAvailable());
+
+ if (mainLoopForStub_->isRunning()) {
+ std::future<bool> stubStopped = mainLoopForStub_->stop();
+ // synchronisation with stopped mainloop
+ stubStopped.get();
+ }
+ if (stubThread.joinable()) {
+ stubThread.join();
+ }
+
+ uint8_t x = 5;
+ uint8_t y = 0;
+
+ std::future<CommonAPI::CallStatus> futureStatus = testProxy_->testMethodAsync(x,
+ [&] (const CommonAPI::CallStatus& status, uint8_t y) {
+ callbackCalled_++;
+ }
+ );
+
+ // 1. just dispatch watches (reads transport)
+ mainLoopForStub_->runVerification(1, true, false);
+ usleep(10000);
+ EXPECT_EQ(testStub_->x_, 0);
+
+ // 2. just dispatch dispatchSources. This should dispatch the messages already read from transport in 1.
+ mainLoopForStub_->doVerificationIteration(false, true);
+ EXPECT_EQ(testStub_->x_, x);
+}
+
+/**
+* @test Verifies Synchronous Call Message Handling Order.
+* - get proxy with available flag = true
+* - subscribe for broadcast event
+* - generate 5 test broadcasts
+* - 5 broadcasts should arrive in the right order
+*/
+TEST_F(THMainLoopIntegration, VerifySyncCallMessageHandlingOrder) {
+
+ std::thread stubThread = std::thread([&](){ mainLoopForStub_->run(3000); });
+
+ // wait until thread is running
+ while (!mainLoopForStub_->isRunning()) {
+ usleep(100);
+ }
+
+ for(unsigned int i = 0; !testProxy_->isAvailable() && i < 100; ++i) {
+ mainLoopForProxy_->doSingleIteration(3000);
+ usleep(10000);
+ }
+ ASSERT_TRUE(testProxy_->isAvailable());
+
+ auto& broadcastEvent = testProxy_->getTestBroadcastEvent();
+ broadcastEvent.subscribe(std::bind(&THMainLoopIntegration::broadcastCallback, this, std::placeholders::_1));
+
+ uint8_t x = 5;
+ uint8_t y = 0;
+ CommonAPI::CallStatus callStatus;
+
+ testProxy_->testMethod(x, callStatus, y);
+
+ for(unsigned int i = 0; i < 100; ++i) {
+ mainLoopForProxy_->doSingleIteration(30);
+ usleep(10000);
+ }
+
+ sleep(2);
+
+ if (mainLoopForStub_->isRunning()) {
+ std::future<bool> stubStopped = mainLoopForStub_->stop();
+ // synchronisation with stopped mainloop
+ stubStopped.get();
+ }
+ if (stubThread.joinable()) {
+ stubThread.join();
+ }
+
+ // in total 5 broadcasts should have been arrived
+ ASSERT_EQ(lastBroadcastNumber_, 5);
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
diff --git a/org.genivi.commonapi.core.verification/src/conf/commonapi4dbus.ini.in b/org.genivi.commonapi.core.verification/src/conf/commonapi4dbus.ini.in
new file mode 100644
index 0000000..fb35209
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/conf/commonapi4dbus.ini.in
@@ -0,0 +1,44 @@
+[default]
+binding=dbus
+
+[logging]
+console = false
+level = warning
+
+[proxy]
+local:commonapi.runtime.TestInterface:commonapi.runtime.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.communication.TestInterface:commonapi.communication.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.datatypes.primitive.TestInterface:commonapi.datatypes.primitive.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.datatypes.advanced.TestInterface:commonapi.datatypes.advanced.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.datatypes.derived.TestInterface:commonapi.datatypes.derived.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.datatypes.combined.TestInterface:commonapi.datatypes.combined.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.performance.primitive.TestInterface:commonapi.performance.primitive.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.performance.complex.TestInterface:commonapi.performance.complex.TestInterface=@GLUECODE_SO_DBUS@
+
+local:commonapi.threading.TestInterface:my.test.commonapi.address=@GLUECODE_SO_DBUS@
+local:commonapi.threading.TestInterface:my.test.commonapi.address.six=@GLUECODE_SO_DBUS@
+local:commonapi.threading.TestInterface:my.test.commonapi.address.seven=@GLUECODE_SO_DBUS@
+local:commonapi.threading.TestInterface:my.test.commonapi.address.eight=@GLUECODE_SO_DBUS@
+
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.stability.mp.ControlInterface:commonapi.stability.mp.ControlInterface=@GLUECODE_SO_DBUS@
+
+[stub]
+local:commonapi.runtime.TestInterface:commonapi.runtime.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.communication.TestInterface:commonapi.communication.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.datatypes.primitive.TestInterface:commonapi.datatypes.primitive.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.datatypes.advanced.TestInterface:commonapi.datatypes.advanced.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.datatypes.derived.TestInterface:commonapi.datatypes.derived.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.datatypes.combined.TestInterface:commonapi.datatypes.combined.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.performance.primitive.TestInterface:commonapi.performance.primitive.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.performance.complex.TestInterface:commonapi.performance.complex.TestInterface=@GLUECODE_SO_DBUS@
+
+local:commonapi.threading.TestInterface:my.test.commonapi.address=@GLUECODE_SO_DBUS@
+local:commonapi.threading.TestInterface:my.test.commonapi.address.six=@GLUECODE_SO_DBUS@
+local:commonapi.threading.TestInterface:my.test.commonapi.address.seven=@GLUECODE_SO_DBUS@
+local:commonapi.threading.TestInterface:my.test.commonapi.address.eight=@GLUECODE_SO_DBUS@
+
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface=@GLUECODE_SO_DBUS@
+local:commonapi.stability.mp.ControlInterface:commonapi.stability.mp.ControlInterface=@GLUECODE_SO_DBUS@
diff --git a/org.genivi.commonapi.core.verification/src/conf/commonapi4someip.ini.in b/org.genivi.commonapi.core.verification/src/conf/commonapi4someip.ini.in
new file mode 100644
index 0000000..7bc55f8
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/conf/commonapi4someip.ini.in
@@ -0,0 +1,121 @@
+[default]
+binding=someip
+
+[proxy]
+local:commonapi.runtime.TestInterface:commonapi.runtime.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.communication.TestInterface:commonapi.communication.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.datatypes.primitive.TestInterface:commonapi.datatypes.primitive.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.datatypes.advanced.TestInterface:commonapi.datatypes.advanced.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.datatypes.derived.TestInterface:commonapi.datatypes.derived.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.datatypes.combined.TestInterface:commonapi.datatypes.combined.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.performance.primitive.TestInterface:commonapi.performance.primitive.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.performance.complex.TestInterface:commonapi.performance.complex.TestInterface=@GLUECODE_SO_SOMEIP@
+
+local:commonapi.threading.TestInterface:my.test.commonapi.address=@GLUECODE_SO_SOMEIP@
+local:commonapi.threading.TestInterface:my.test.commonapi.address.six=@GLUECODE_SO_SOMEIP@
+local:commonapi.threading.TestInterface:my.test.commonapi.address.seven=@GLUECODE_SO_SOMEIP@
+local:commonapi.threading.TestInterface:my.test.commonapi.address.eight=@GLUECODE_SO_SOMEIP@
+
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface0=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface1=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface2=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface3=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface4=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface5=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface6=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface7=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface8=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface9=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface10=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface11=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface12=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface13=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface14=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface15=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface16=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface17=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface18=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface19=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface20=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface21=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface22=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface23=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface24=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface25=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface26=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface27=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface28=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface29=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface30=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface31=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface32=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface33=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface34=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface35=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface36=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface37=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface38=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface39=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.mp.ControlInterface:commonapi.stability.mp.ControlInterface=@GLUECODE_SO_SOMEIP@
+
+[stub]
+local:commonapi.runtime.TestInterface:commonapi.runtime.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.communication.TestInterface:commonapi.communication.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.datatypes.primitive.TestInterface:commonapi.datatypes.primitive.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.datatypes.advanced.TestInterface:commonapi.datatypes.advanced.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.datatypes.derived.TestInterface:commonapi.datatypes.derived.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.datatypes.combined.TestInterface:commonapi.datatypes.combined.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.performance.primitive.TestInterface:commonapi.performance.primitive.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.performance.complex.TestInterface:commonapi.performance.complex.TestInterface=@GLUECODE_SO_SOMEIP@
+
+local:commonapi.threading.TestInterface:my.test.commonapi.address=@GLUECODE_SO_SOMEIP@
+local:commonapi.threading.TestInterface:my.test.commonapi.address.six=@GLUECODE_SO_SOMEIP@
+local:commonapi.threading.TestInterface:my.test.commonapi.address.seven=@GLUECODE_SO_SOMEIP@
+local:commonapi.threading.TestInterface:my.test.commonapi.address.eight=@GLUECODE_SO_SOMEIP@
+
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface0=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface1=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface2=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface3=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface4=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface5=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface6=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface7=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface8=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface9=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface10=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface11=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface12=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface13=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface14=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface15=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface16=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface17=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface18=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface19=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface20=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface21=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface22=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface23=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface24=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface25=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface26=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface27=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface28=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface29=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface30=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface31=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface32=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface33=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface34=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface35=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface36=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface37=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface38=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface39=@GLUECODE_SO_SOMEIP@
+
+local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface=@GLUECODE_SO_SOMEIP@
+local:commonapi.stability.mp.ControlInterface:commonapi.stability.mp.ControlInterface=@GLUECODE_SO_SOMEIP@
diff --git a/org.genivi.commonapi.core.verification/src/stub/CMAttributesStub.cpp b/org.genivi.commonapi.core.verification/src/stub/CMAttributesStub.cpp
new file mode 100644
index 0000000..97eb137
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/CMAttributesStub.cpp
@@ -0,0 +1,31 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+#include <iostream>
+#include "CMAttributesStub.h"
+
+namespace v1_0 {
+namespace commonapi {
+namespace communication {
+
+CMAttributesStub::CMAttributesStub() {
+}
+
+CMAttributesStub::~CMAttributesStub() {
+}
+
+void CMAttributesStub::setTestValues(uint8_t x) {
+
+ setTestAttributeAttribute(x);
+ setTestAAttribute(x);
+ setTestBAttribute(x);
+ setTestCAttribute(x);
+}
+
+} /* namespace v1_0 */
+} /* namespace communication */
+} /* namespace commonapi */
+
diff --git a/org.genivi.commonapi.core.verification/src/stub/CMAttributesStub.h b/org.genivi.commonapi.core.verification/src/stub/CMAttributesStub.h
new file mode 100644
index 0000000..3de45f0
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/CMAttributesStub.h
@@ -0,0 +1,27 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+#ifndef CMATTRIBUTESSTUB_H_
+#define CMATTRIBUTESSTUB_H_
+
+#include "v1_0/commonapi/communication/TestInterfaceStubDefault.hpp"
+
+namespace v1_0 {
+namespace commonapi {
+namespace communication {
+
+class CMAttributesStub : public v1_0::commonapi::communication::TestInterfaceStubDefault {
+public:
+ CMAttributesStub();
+ virtual ~CMAttributesStub();
+ virtual void setTestValues(uint8_t);
+};
+
+} /* namespace v1_0 */
+} /* namespace communication */
+} /* namespace commonapi */
+
+#endif /* CMATTRIBUTESSTUB_H_ */
diff --git a/org.genivi.commonapi.core.verification/src/stub/CMMethodCallsStub.cpp b/org.genivi.commonapi.core.verification/src/stub/CMMethodCallsStub.cpp
new file mode 100644
index 0000000..533f458
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/CMMethodCallsStub.cpp
@@ -0,0 +1,32 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+#include <iostream>
+#include "CMMethodCallsStub.h"
+
+namespace v1_0 {
+namespace commonapi {
+namespace communication {
+
+CMMethodCallsStub::CMMethodCallsStub() {
+}
+
+CMMethodCallsStub::~CMMethodCallsStub() {
+}
+
+void CMMethodCallsStub::testMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, uint8_t x,
+ testMethodReply_t _reply) {
+ uint8_t y;
+
+ std::cout << "testMethod called." << std::endl;
+ y = x;
+ _reply(y);
+}
+
+} /* namespace v1_0 */
+} /* namespace communication */
+} /* namespace commonapi */
+
diff --git a/org.genivi.commonapi.core.verification/src/stub/CMMethodCallsStub.h b/org.genivi.commonapi.core.verification/src/stub/CMMethodCallsStub.h
new file mode 100644
index 0000000..d26d71c
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/CMMethodCallsStub.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+#ifndef CMMETHODCALLSSTUB_H_
+#define CMMETHODCALLSSTUB_H_
+
+#include "v1_0/commonapi/communication/TestInterfaceStubDefault.hpp"
+
+namespace v1_0 {
+namespace commonapi {
+namespace communication {
+
+class CMMethodCallsStub : public v1_0::commonapi::communication::TestInterfaceStubDefault {
+public:
+ CMMethodCallsStub();
+ virtual ~CMMethodCallsStub();
+
+ void testMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, uint8_t x,
+ testMethodReply_t _reply);
+};
+
+} /* namespace v1_0 */
+} /* namespace communication */
+} /* namespace commonapi */
+
+#endif /* CMMETHODCALLSSTUB_H_ */
diff --git a/org.genivi.commonapi.core.verification/src/stub/DTAdvancedStub.cpp b/org.genivi.commonapi.core.verification/src/stub/DTAdvancedStub.cpp
new file mode 100644
index 0000000..f21554b
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/DTAdvancedStub.cpp
@@ -0,0 +1,55 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+#include "DTAdvancedStub.h"
+#include <unistd.h>
+
+namespace v1_0 {
+namespace commonapi {
+namespace datatypes {
+namespace advanced {
+
+using namespace commonapi::datatypes::advanced;
+
+DTAdvancedStub::DTAdvancedStub() {
+}
+
+DTAdvancedStub::~DTAdvancedStub() {
+}
+
+void DTAdvancedStub::fTest(const std::shared_ptr<CommonAPI::ClientId> clientId,
+ TestInterface::tArray tArrayIn,
+ TestInterface::tEnumeration tEnumerationIn,
+ TestInterface::tStruct tStructIn,
+ TestInterface::tUnion tUnionIn,
+ TestInterface::tMap tMapIn,
+ TestInterface::tTypedef tTypedefIn,
+ fTestReply_t _reply) {
+
+
+ TestInterface::tArray tArrayOut = tArrayIn;
+ TestInterface::tEnumeration tEnumerationOut = tEnumerationIn;
+ TestInterface::tStruct tStructOut = tStructIn;
+ TestInterface::tUnion tUnionOut = tUnionIn;
+ TestInterface::tMap tMapOut = tMapIn;
+ TestInterface::tTypedef tTypedefOut = tTypedefIn;
+
+ _reply(tArrayOut, tEnumerationOut, tStructOut, tUnionOut, tMapOut, tTypedefOut);
+
+ fireBTestEvent(
+ tArrayOut,
+ tEnumerationOut,
+ tStructOut,
+ tUnionOut,
+ tMapOut,
+ tTypedefOut
+ );
+}
+
+} /* namespace advanced */
+} /* namespace datatypes */
+} /* namespace commonapi */
+} /* namespace v1_0 */
diff --git a/org.genivi.commonapi.core.verification/src/stub/DTAdvancedStub.h b/org.genivi.commonapi.core.verification/src/stub/DTAdvancedStub.h
new file mode 100644
index 0000000..e7e1eb9
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/DTAdvancedStub.h
@@ -0,0 +1,39 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+#ifndef DTADVANCEDSTUB_H_
+#define DTADVANCEDSTUB_H_
+
+#include "v1_0/commonapi/datatypes/advanced/TestInterfaceStubDefault.hpp"
+#include "v1_0/commonapi/datatypes/advanced/TestInterface.hpp"
+
+namespace v1_0 {
+namespace commonapi {
+namespace datatypes {
+namespace advanced {
+
+using namespace v1_0::commonapi::datatypes::advanced;
+
+class DTAdvancedStub : public TestInterfaceStubDefault {
+
+public:
+ DTAdvancedStub();
+ virtual ~DTAdvancedStub();
+
+ virtual void fTest(const std::shared_ptr<CommonAPI::ClientId> clientId,
+ TestInterface::tArray tArrayIn,
+ TestInterface::tEnumeration tEnumerationIn,
+ TestInterface::tStruct tStructIn,
+ TestInterface::tUnion tUnionIn, TestInterface::tMap tMapIn,
+ TestInterface::tTypedef tTypedefIn,
+ fTestReply_t _reply);
+};
+
+} /* namespace advanced */
+} /* namespace datatypes */
+} /* namespace commonapi */
+} /* namespace v1_0 */
+#endif /* DTADVANCEDSTUB_H_ */
diff --git a/org.genivi.commonapi.core.verification/src/stub/DTCombinedStub.cpp b/org.genivi.commonapi.core.verification/src/stub/DTCombinedStub.cpp
new file mode 100644
index 0000000..f347026
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/DTCombinedStub.cpp
@@ -0,0 +1,31 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+#include "DTCombinedStub.h"
+
+namespace v1_0 {
+namespace commonapi {
+namespace datatypes {
+namespace combined {
+
+using namespace v1_0::commonapi::datatypes::combined;
+
+DTCombinedStub::DTCombinedStub(){
+}
+
+DTCombinedStub::~DTCombinedStub(){
+}
+
+void DTCombinedStub::fTest(const std::shared_ptr<CommonAPI::ClientId> _client,
+ TestInterface::tStructL3 _tStructL3In, fTestReply_t _reply)
+{
+ _reply(_tStructL3In);
+}
+
+} /* namespace combined */
+} /* namespace datatypes */
+} /* namespace commonapi */
+} /* namespace v1_0 */
diff --git a/org.genivi.commonapi.core.verification/src/stub/DTCombinedStub.h b/org.genivi.commonapi.core.verification/src/stub/DTCombinedStub.h
new file mode 100644
index 0000000..6d94c39
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/DTCombinedStub.h
@@ -0,0 +1,35 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+#ifndef DTCOMBINEDSTUB_H_
+#define DTCOMBINEDSTUB_H_
+
+#include "v1_0/commonapi/datatypes/combined/TestInterfaceStubDefault.hpp"
+#include "v1_0/commonapi/datatypes/combined/TestInterface.hpp"
+
+namespace v1_0 {
+namespace commonapi {
+namespace datatypes {
+namespace combined {
+
+using namespace v1_0::commonapi::datatypes::combined;
+
+class DTCombinedStub : public TestInterfaceStubDefault {
+
+public:
+ DTCombinedStub();
+ virtual ~DTCombinedStub();
+
+ virtual void fTest(const std::shared_ptr<CommonAPI::ClientId> _client,
+ TestInterface::tStructL3 _tStructL3In,
+ fTestReply_t _reply);
+};
+
+} /* namespace combined */
+} /* namespace datatypes */
+} /* namespace commonapi */
+} /* namespace v1_0 */
+#endif /* DTCOMBINEDSTUB_H_ */
diff --git a/org.genivi.commonapi.core.verification/src/stub/DTDerivedStub.cpp b/org.genivi.commonapi.core.verification/src/stub/DTDerivedStub.cpp
new file mode 100644
index 0000000..7d6460b
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/DTDerivedStub.cpp
@@ -0,0 +1,48 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+#include "DTDerivedStub.h"
+#include <unistd.h>
+
+namespace v1_0 {
+namespace commonapi {
+namespace datatypes {
+namespace derived {
+
+using namespace v1_0::commonapi::datatypes::derived;
+
+DTDerivedStub::DTDerivedStub() {
+}
+
+DTDerivedStub::~DTDerivedStub() {
+}
+
+void DTDerivedStub::fTest(const std::shared_ptr<CommonAPI::ClientId> clientId,
+ TestInterface::tStructExt tStructExtIn,
+ TestInterface::tEnumExt tEnumExtIn,
+ TestInterface::tUnionExt tUnionExtIn,
+ std::shared_ptr<TestInterface::tBaseStruct> tBaseStructIn,
+ fTestReply_t _reply) {
+
+ TestInterface::tStructExt tStructExtOut = tStructExtIn;
+ TestInterface::tEnumExt tEnumExtOut = tEnumExtIn;
+ TestInterface::tUnionExt tUnionExtOut = tUnionExtIn;
+ std::shared_ptr<TestInterface::tBaseStruct> tBaseStructOut = tBaseStructIn;
+
+ _reply(tStructExtOut, tEnumExtOut, tUnionExtOut, tBaseStructOut);
+
+ fireBTestEvent(
+ tStructExtOut,
+ tEnumExtOut,
+ tUnionExtOut,
+ tBaseStructOut
+ );
+}
+
+} /* namespace derived */
+} /* namespace datatypes */
+} /* namespace commonapi */
+} /* namespace v1_0 */
diff --git a/org.genivi.commonapi.core.verification/src/stub/DTDerivedStub.h b/org.genivi.commonapi.core.verification/src/stub/DTDerivedStub.h
new file mode 100644
index 0000000..cadd627
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/DTDerivedStub.h
@@ -0,0 +1,38 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+#ifndef DTDERIVEDSTUB_H_
+#define DTDERIVEDSTUB_H_
+
+#include "v1_0/commonapi/datatypes/derived/TestInterfaceStubDefault.hpp"
+#include "v1_0/commonapi/datatypes/derived/TestInterface.hpp"
+
+namespace v1_0 {
+namespace commonapi {
+namespace datatypes {
+namespace derived {
+
+using namespace v1_0::commonapi::datatypes::derived;
+
+class DTDerivedStub : public TestInterfaceStubDefault {
+
+public:
+ DTDerivedStub();
+ virtual ~DTDerivedStub();
+
+ virtual void fTest(const std::shared_ptr<CommonAPI::ClientId> clientId,
+ TestInterface::tStructExt tStructExtIn,
+ TestInterface::tEnumExt tEnumExtIn,
+ TestInterface::tUnionExt tUnionExtIn,
+ std::shared_ptr<TestInterface::tBaseStruct> tBaseStructIn,
+ fTestReply_t _reply);
+};
+
+} /* namespace derived */
+} /* namespace datatypes */
+} /* namespace commonapi */
+} /* namespace v1_0 */
+#endif /* DTDERIVEDSTUB_H_ */
diff --git a/org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.cpp b/org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.cpp
new file mode 100644
index 0000000..c040e9a
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.cpp
@@ -0,0 +1,67 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+#include "DTPrimitiveStub.h"
+#include <unistd.h>
+
+namespace v1_0 {
+namespace commonapi {
+namespace datatypes {
+namespace primitive {
+
+DTPrimitiveStub::DTPrimitiveStub() {
+}
+
+DTPrimitiveStub::~DTPrimitiveStub() {
+}
+
+void DTPrimitiveStub::fTest(const std::shared_ptr<CommonAPI::ClientId> _client,
+ uint8_t _uint8In,
+ int8_t _int8In,
+ uint16_t _uint16In,
+ int16_t _int16In,
+ uint32_t _uint32In,
+ int32_t _int32In,
+ uint64_t _uint64In,
+ int64_t _int64In,
+ bool _booleanIn,
+ float _floatIn,
+ double _doubleIn,
+ std::string _stringIn,
+ fTestReply_t _reply) {
+ _reply(_uint8In,
+ _int8In,
+ _uint16In,
+ _int16In,
+ _uint32In,
+ _int32In,
+ _uint64In,
+ _int64In,
+ _booleanIn,
+ _floatIn,
+ _doubleIn,
+ _stringIn);
+
+ fireBTestEvent(
+ _uint8In,
+ _int8In,
+ _uint16In,
+ _int16In,
+ _uint32In,
+ _int32In,
+ _uint64In,
+ _int64In,
+ _booleanIn,
+ _floatIn,
+ _doubleIn,
+ _stringIn
+ );
+}
+
+} /* namespace primitive */
+} /* namespace datatypes */
+} /* namespace commonapi */
+} /* namespace v1_0 */
diff --git a/org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.h b/org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.h
new file mode 100644
index 0000000..ddc6b86
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+#ifndef DTPRIMITIVESTUB_H_
+#define DTPRIMITIVESTUB_H_
+
+#include "v1_0/commonapi/datatypes/primitive/TestInterfaceStubDefault.hpp"
+
+namespace v1_0 {
+namespace commonapi {
+namespace datatypes {
+namespace primitive {
+
+class DTPrimitiveStub : public v1_0::commonapi::datatypes::primitive::TestInterfaceStubDefault {
+public:
+ DTPrimitiveStub();
+ virtual ~DTPrimitiveStub();
+
+ virtual void fTest(const std::shared_ptr<CommonAPI::ClientId> _client, uint8_t _uint8In, int8_t _int8In, uint16_t _uint16In, int16_t _int16In, uint32_t _uint32In, int32_t _int32In, uint64_t _uint64In, int64_t _int64In, bool _booleanIn, float _floatIn, double _doubleIn, std::string _stringIn, fTestReply_t _reply);
+};
+
+} /* namespace primitive */
+} /* namespace datatypes */
+} /* namespace commonapi */
+} /* namespace v1_0 */
+#endif /* DTPRIMITIVESTUB_H_ */
diff --git a/org.genivi.commonapi.core.verification/src/stub/PFComplexStub.cpp b/org.genivi.commonapi.core.verification/src/stub/PFComplexStub.cpp
new file mode 100644
index 0000000..9a4e64d
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/PFComplexStub.cpp
@@ -0,0 +1,37 @@
+/* Copyright (C) 2015 Mentor Graphics
+ * Author: Felix Scherzinger (felix_scherzinger@mentor.com)
+ * 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/. */
+
+#include <iostream>
+
+#include "PFComplexStub.h"
+
+namespace v1_0 {
+namespace commonapi {
+namespace performance {
+namespace complex {
+
+
+PFComplexStub::PFComplexStub() {
+
+}
+
+PFComplexStub::~PFComplexStub() {
+
+}
+
+void PFComplexStub::testMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, TestInterface::tArray x, testMethodReply_t _reply) {
+
+ TestInterface::tArray y;
+
+ // Copy array!
+ y = x;
+ _reply(y);
+}
+
+} /* namespace complex */
+} /* namespace datatypes */
+} /* namespace commonapi */
+} /* namespace v1_0 */
diff --git a/org.genivi.commonapi.core.verification/src/stub/PFComplexStub.h b/org.genivi.commonapi.core.verification/src/stub/PFComplexStub.h
new file mode 100644
index 0000000..e261911
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/PFComplexStub.h
@@ -0,0 +1,30 @@
+/* Copyright (C) 2015 Mentor Graphics
+ * Author: Felix Scherzinger (felix_scherzinger@mentor.com)
+ * 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/. */
+
+#ifndef PFCOMPLEXSTUB_H_
+#define PFCOMPLEXSTUB_H_
+
+#include "v1_0/commonapi/performance/complex/TestInterfaceStubDefault.hpp"
+
+namespace v1_0 {
+namespace commonapi {
+namespace performance {
+namespace complex {
+
+class PFComplexStub : public TestInterfaceStubDefault {
+public:
+ PFComplexStub();
+ virtual ~PFComplexStub();
+
+ virtual void testMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, TestInterface::tArray x, testMethodReply_t _reply);
+};
+
+} /* namespace complex */
+} /* namespace datatypes */
+} /* namespace commonapi */
+} /* namespace v1_0 */
+
+#endif /* PFCOMPLEXSTUB_H_ */
diff --git a/org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.cpp b/org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.cpp
new file mode 100644
index 0000000..107d04b
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.cpp
@@ -0,0 +1,39 @@
+/* Copyright (C) 2015 Mentor Graphics
+ * Author: Felix Scherzinger (felix_scherzinger@mentor.com)
+ * 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/. */
+
+#include <iostream>
+
+#include "PFPrimitiveStub.h"
+
+namespace v1_0 {
+namespace commonapi {
+namespace performance {
+namespace primitive {
+
+
+PFPrimitiveStub::PFPrimitiveStub() {
+
+}
+
+PFPrimitiveStub::~PFPrimitiveStub() {
+
+}
+
+void PFPrimitiveStub::testMethod(const std::shared_ptr<CommonAPI::ClientId> clientId,
+ TestInterface::TestArray x, testMethodReply_t _reply) {
+
+ TestInterface::TestArray y;
+
+ // Copy array!
+ y = x;
+ _reply(y);
+}
+
+} /* namespace primitive */
+} /* namespace datatypes */
+} /* namespace commonapi */
+} /* namespace v1_0 */
+
diff --git a/org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.h b/org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.h
new file mode 100644
index 0000000..f6595f6
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.h
@@ -0,0 +1,30 @@
+/* Copyright (C) 2015 Mentor Graphics
+ * Author: Felix Scherzinger (felix_scherzinger@mentor.com)
+ * 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/. */
+
+#ifndef PFPRIMITIVESTUB_H_
+#define PFPRIMITIVESTUB_H_
+
+#include "v1_0/commonapi/performance/primitive/TestInterfaceStubDefault.hpp"
+
+namespace v1_0 {
+namespace commonapi {
+namespace performance {
+namespace primitive {
+
+class PFPrimitiveStub : public TestInterfaceStubDefault {
+public:
+ PFPrimitiveStub();
+ virtual ~PFPrimitiveStub();
+
+ virtual void testMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, TestInterface::TestArray x, testMethodReply_t _reply);
+};
+
+} /* namespace primitive */
+} /* namespace datatypes */
+} /* namespace commonapi */
+} /* namespace v1_0 */
+
+#endif /* PFPRIMITIVESTUB_H_ */
diff --git a/org.genivi.commonapi.core.verification/src/stub/StabControlStub.cpp b/org.genivi.commonapi.core.verification/src/stub/StabControlStub.cpp
new file mode 100644
index 0000000..35c390d
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/StabControlStub.cpp
@@ -0,0 +1,55 @@
+/* Copyright (C) 2015 BMW Group
+ * Author: JP Ikaheimonen (jp_ikaheimonen@mentor.com)
+ * 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/. */
+
+#include <iostream>
+#include "StabControlStub.h"
+#include <unistd.h>
+
+namespace v1_0 {
+namespace commonapi {
+namespace stability {
+namespace mp {
+
+using namespace v1_0::commonapi::stability::mp;
+
+StabControlStub::StabControlStub() {
+}
+
+StabControlStub::~StabControlStub() {
+}
+
+CommandListener StabControlStub::listener_ = 0;
+
+
+void StabControlStub::controlMethod(const std::shared_ptr<CommonAPI::ClientId> clientId,
+ uint8_t id,
+ uint32_t data,
+ controlMethodReply_t _reply)
+{
+ // client sends commands and responses through this interface.
+ // call the listener with the data.
+ uint8_t command;
+ uint32_t min;
+ uint32_t max;
+
+ if (StabControlStub::listener_) {
+ StabControlStub::listener_(id, data, command, min, max);
+ }
+ _reply(command, min, max);
+
+}
+
+void StabControlStub::registerListener(CommandListener listener ) {
+ StabControlStub::listener_ = listener;
+}
+
+} /* namespace v1_0 */
+} /* namespace mp */
+} /* namespace stability */
+} /* namespace commonapi */
+
+
+
diff --git a/org.genivi.commonapi.core.verification/src/stub/StabControlStub.h b/org.genivi.commonapi.core.verification/src/stub/StabControlStub.h
new file mode 100644
index 0000000..7b844a4
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/StabControlStub.h
@@ -0,0 +1,45 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: JP Ikaheimonen (jp_ikaheimonen@mentor.com)
+ * 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/. */
+
+#ifndef STABCONTROLSTUB_H_
+#define STABCONTROLSTUB_H_
+
+#include "v1_0/commonapi/stability/mp/ControlInterfaceStubDefault.hpp"
+#include "v1_0/commonapi/stability/mp/ControlInterface.hpp"
+
+namespace v1_0 {
+namespace commonapi {
+namespace stability {
+namespace mp {
+
+using namespace v1_0::commonapi::stability::mp;
+
+typedef std::function<void (uint8_t id, uint32_t data, uint8_t& command, uint32_t& data1, uint32_t &data2)> CommandListener;
+
+class StabControlStub : public ControlInterfaceStubDefault {
+
+public:
+ StabControlStub();
+ virtual ~StabControlStub();
+
+ virtual void controlMethod(const std::shared_ptr<CommonAPI::ClientId> clientId,
+ uint8_t id,
+ uint32_t data,
+ controlMethodReply_t _reply);
+
+ static void registerListener(CommandListener listener);
+
+ static CommandListener listener_;
+
+};
+
+} /* namespace v1_0 */
+} /* namespace mp */
+} /* namespace stability */
+} /* namespace commonapi */
+#endif /* STABCONTROLSTUB_H_ */
+
+
diff --git a/org.genivi.commonapi.core.verification/src/stub/StabilityMPStub.cpp b/org.genivi.commonapi.core.verification/src/stub/StabilityMPStub.cpp
new file mode 100644
index 0000000..482acbd
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/StabilityMPStub.cpp
@@ -0,0 +1,45 @@
+/* Copyright (C) 2015 BMW Group
+ * Author: JP Ikaheimonen (jp_ikaheimonen@mentor.com)
+ * 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/. */
+
+#include "StabilityMPStub.h"
+#include <unistd.h>
+
+namespace v1_0 {
+namespace commonapi {
+namespace stability {
+namespace mp {
+
+using namespace v1_0::commonapi::stability::mp;
+
+StabilityMPStub::StabilityMPStub() {
+}
+
+StabilityMPStub::~StabilityMPStub() {
+}
+
+void StabilityMPStub::testMethod(const std::shared_ptr<CommonAPI::ClientId> clientId,
+ TestInterface::tArray tArrayIn,
+ testMethodReply_t _reply) {
+
+ TestInterface::tArray tArrayOut;
+ tArrayOut = tArrayIn;
+
+ fireTestBroadcastEvent(
+ tArrayOut
+ );
+ _reply(tArrayOut);
+}
+
+void StabilityMPStub::setTestValues(TestInterface::tArray x) {
+ setTestAttributeAttribute(x);
+}
+
+} /* namespace v1_0 */
+} /* namespace mp */
+} /* namespace stability */
+} /* namespace commonapi */
+
+
diff --git a/org.genivi.commonapi.core.verification/src/stub/StabilityMPStub.h b/org.genivi.commonapi.core.verification/src/stub/StabilityMPStub.h
new file mode 100644
index 0000000..328f047
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/StabilityMPStub.h
@@ -0,0 +1,35 @@
+/* Copyright (C) 2015 BMW Group
+ * Author: JP Ikaheimonen (jp_ikaheimonen@mentor.com)
+ * 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/. */
+
+#ifndef STABILITYMPSTUB_H_
+#define STABILITYMPSTUB_H_
+
+#include "v1_0/commonapi/stability/mp/TestInterfaceStubDefault.hpp"
+#include "v1_0/commonapi/stability/mp/TestInterface.hpp"
+
+namespace v1_0 {
+namespace commonapi {
+namespace stability {
+namespace mp {
+
+class StabilityMPStub : public TestInterfaceStubDefault {
+
+public:
+ StabilityMPStub();
+ virtual ~StabilityMPStub();
+
+ virtual void testMethod(const std::shared_ptr<CommonAPI::ClientId> clientId,
+ TestInterface::tArray tArrayIn,
+ testMethodReply_t _reply);
+ virtual void setTestValues(TestInterface::tArray x);
+};
+
+} /* namespace v1_0 */
+} /* namespace mp */
+} /* namespace stability */
+} /* namespace commonapi */
+#endif /* STABILITYMPSTUB_H_ */
+
diff --git a/org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.cpp b/org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.cpp
new file mode 100644
index 0000000..59e89b6
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.cpp
@@ -0,0 +1,49 @@
+/* Copyright (C) 2015 BMW Group
+ * Author: JP Ikaheimonen (jp_ikaheimonen@mentor.com)
+ * 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/. */
+
+#include "StabilitySPStub.h"
+#include <unistd.h>
+
+namespace v1_0 {
+namespace commonapi {
+namespace stability {
+namespace sp {
+
+using namespace v1_0::commonapi::stability::sp;
+
+StabilitySPStub::StabilitySPStub() {
+}
+
+StabilitySPStub::~StabilitySPStub() {
+}
+
+void StabilitySPStub::testMethod(const std::shared_ptr<CommonAPI::ClientId> clientId,
+ TestInterface::tArray tArrayIn,
+ testMethodReply_t _reply) {
+
+ TestInterface::tArray tArrayOut;
+
+ tArrayOut = tArrayIn;
+
+ fireTestBroadcastEvent(
+ tArrayIn
+ );
+
+ _reply(tArrayOut);
+
+
+}
+
+void StabilitySPStub::setTestValues(TestInterface::tArray x) {
+ setTestAttributeAttribute(x);
+}
+
+} /* namespace v1_0 */
+} /* namespace sp */
+} /* namespace stability */
+} /* namespace commonapi */
+
+
diff --git a/org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.h b/org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.h
new file mode 100644
index 0000000..86b8c3c
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.h
@@ -0,0 +1,35 @@
+/* Copyright (C) 2015 BMW Group
+ * Author: JP Ikaheimonen (jp_ikaheimonen@mentor.com)
+ * 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/. */
+
+#ifndef STABILITYSPSTUB_H_
+#define STABILITYSPSTUB_H_
+
+#include "v1_0/commonapi/stability/sp/TestInterfaceStubDefault.hpp"
+#include "v1_0/commonapi/stability/sp/TestInterface.hpp"
+
+namespace v1_0 {
+namespace commonapi {
+namespace stability {
+namespace sp {
+
+class StabilitySPStub : public TestInterfaceStubDefault {
+
+public:
+ StabilitySPStub();
+ virtual ~StabilitySPStub();
+
+ virtual void testMethod(const std::shared_ptr<CommonAPI::ClientId> clientId,
+ TestInterface::tArray _x,
+ testMethodReply_t _reply);
+ virtual void setTestValues(TestInterface::tArray x);
+};
+
+} /* namespace v1_0 */
+} /* namespace sp */
+} /* namespace stability */
+} /* namespace commonapi */
+#endif /* STABILITYSPSTUB_H_ */
+
diff --git a/org.genivi.commonapi.core.verification/src/stub/THMainLoopIntegrationStub.cpp b/org.genivi.commonapi.core.verification/src/stub/THMainLoopIntegrationStub.cpp
new file mode 100644
index 0000000..794f6ab
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/THMainLoopIntegrationStub.cpp
@@ -0,0 +1,43 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+#include <iostream>
+#include "THMainLoopIntegrationStub.h"
+
+namespace v1_0 {
+namespace commonapi {
+namespace threading {
+
+THMainLoopIntegrationStub::THMainLoopIntegrationStub() {
+ x_ = 0;
+}
+
+THMainLoopIntegrationStub::~THMainLoopIntegrationStub() {
+}
+
+void THMainLoopIntegrationStub::testMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, uint8_t x, testMethodReply_t _reply) {
+
+ uint8_t y = x;
+ x_ = x;
+
+ uint8_t broadcastNumber = 0;
+ broadcastNumber++;
+ fireTestBroadcastEvent(broadcastNumber);
+ broadcastNumber++;
+ fireTestBroadcastEvent(broadcastNumber);
+ broadcastNumber++;
+ fireTestBroadcastEvent(broadcastNumber);
+ broadcastNumber++;
+ fireTestBroadcastEvent(broadcastNumber);
+ broadcastNumber++;
+ fireTestBroadcastEvent(broadcastNumber);
+
+ _reply(y);
+}
+
+} /* namespace threading */
+} /* namespace commonapi */
+} /* namespace v1_0 */
diff --git a/org.genivi.commonapi.core.verification/src/stub/THMainLoopIntegrationStub.h b/org.genivi.commonapi.core.verification/src/stub/THMainLoopIntegrationStub.h
new file mode 100644
index 0000000..1747af2
--- /dev/null
+++ b/org.genivi.commonapi.core.verification/src/stub/THMainLoopIntegrationStub.h
@@ -0,0 +1,30 @@
+/* Copyright (C) 2014 BMW Group
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * 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/. */
+
+#ifndef THMAINLOOPINTEGRATION_H_
+#define THMAINLOOPINTEGRATION_H_
+
+#include "v1_0/commonapi/threading/TestInterfaceStubDefault.hpp"
+
+namespace v1_0 {
+namespace commonapi {
+namespace threading {
+
+class THMainLoopIntegrationStub : public TestInterfaceStubDefault {
+public:
+ THMainLoopIntegrationStub();
+ virtual ~THMainLoopIntegrationStub();
+
+ void testMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, uint8_t x, testMethodReply_t _reply);
+
+ uint8_t x_;
+};
+
+} /* namespace threading */
+} /* namespace commonapi */
+} /* namespace v1_0 */
+
+#endif /* THMAINLOOPINTEGRATION_H_ */
diff --git a/org.genivi.commonapi.core.verification/src/test-derived-types.fidl b/org.genivi.commonapi.core.verification/src/test-derived-types.fidl
deleted file mode 100644
index da82e80..0000000
--- a/org.genivi.commonapi.core.verification/src/test-derived-types.fidl
+++ /dev/null
@@ -1,60 +0,0 @@
-/* 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/. */
-package commonapi.tests
-
-import commonapi.tests.* from "test-predefined-types.fidl"
-
-typeCollection DerivedTypeCollection {
-
- map TestMap { UInt32 to TestArrayTestStruct }
-
- struct TestStructExtended extends TestStruct {
- TestEnumExtended2 testEnumExtended2
- }
-
- map TestEnumMap { TestEnum to String }
-
- <** @description : Common errors. **>
- enumeration TestEnum {
- <** @description : default **>
- E_UNKNOWN = "0x00"
- <** @description : no error - positive reply **>
- E_OK = "0x01"
- <** @description : value out of range **>
- E_OUT_OF_RANGE = "0x02"
- <** @description : not used **>
- E_NOT_USED = "0x03"
- }
-
- array TestArrayTestStruct of TestStruct
-
- enumeration TestEnumExtended2 extends TestEnumExtended {
- <** @description : new error **>
- E_NEW2 = "0x05"
- }
-
- enumeration TestEnumMissingValue {
- <** @description : default **>
- E1 = "A"
- E2
- E3 = "2"
- }
-
- enumeration TestEnumExtended extends TestEnum {
- <** @description : new error **>
- E_NEW = "0x04"
- }
-
- array TestArrayUInt64 of UInt64
-
- struct TestStruct {
- <** @description : the name of the property **>
- PredefinedTypeCollection.TestString testString
-
- <** @description : the actual value **>
- UInt16 uintValue
- }
-}
-
-
diff --git a/org.genivi.commonapi.core.verification/src/test-interface-proxy.fidl b/org.genivi.commonapi.core.verification/src/test-interface-proxy.fidl
deleted file mode 100644
index 774c1a8..0000000
--- a/org.genivi.commonapi.core.verification/src/test-interface-proxy.fidl
+++ /dev/null
@@ -1,61 +0,0 @@
-/* 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/. */
-package commonapi.tests
-
-import commonapi.tests.* from "test-derived-types.fidl"
-
-interface TestInterface {
- version { major 1 minor 0 }
-
- attribute UInt32 TestPredefinedTypeAttribute
- attribute DerivedTypeCollection.TestStructExtended TestDerivedStructAttribute
- attribute DerivedTypeCollection.TestArrayUInt64 TestDerivedArrayAttribute
-
- method testEmptyMethod {
- }
-
- method testVoidPredefinedTypeMethod {
- in {
- UInt32 uint32Value
- String stringValue
- }
- }
-
- method testPredefinedTypeMethod {
- in {
- UInt32 uint32InValue
- String stringInValue
- }
- out {
- UInt32 uint32OutValue
- String stringOutValue
- }
- }
-
- method testVoidDerivedTypeMethod {
- in {
- DerivedTypeCollection.TestEnumExtended2 testEnumExtended2Value
- DerivedTypeCollection.TestMap testMapValue
- }
- }
-
- method testDerivedTypeMethod {
- in {
- DerivedTypeCollection.TestEnumExtended2 testEnumExtended2InValue
- DerivedTypeCollection.TestMap testMapInValue
- }
- out {
- DerivedTypeCollection.TestEnumExtended2 testEnumExtended2OutValue
- DerivedTypeCollection.TestMap testMapOutValue
- }
- }
-
- broadcast TestPredefinedTypeBroadcast {
- out {
- UInt32 uint32Value
- String stringValue
- }
- }
-}
-
diff --git a/org.genivi.commonapi.core.verification/src/test-predefined-types.fidl b/org.genivi.commonapi.core.verification/src/test-predefined-types.fidl
deleted file mode 100644
index 6226ed2..0000000
--- a/org.genivi.commonapi.core.verification/src/test-predefined-types.fidl
+++ /dev/null
@@ -1,22 +0,0 @@
-/* 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/. */
-package commonapi.tests
-
-typeCollection PredefinedTypeCollection {
- typedef TestUInt8 is UInt8
- typedef TestUInt16 is UInt16
- typedef TestUInt32 is UInt32
- typedef TestUInt64 is UInt64
- typedef TestInt8 is Int8
- typedef TestInt16 is Int16
- typedef TestInt32 is Int32
- typedef TestInt64 is Int64
- typedef TestBoolean is Boolean
- typedef TestByteBuffer is ByteBuffer
- typedef TestDouble is Double
- typedef TestFloat is Float
- typedef TestString is String
-}
-
-
diff --git a/CommonAPI-Ping/src/StopWatch.cpp b/org.genivi.commonapi.core.verification/src/utils/StopWatch.cpp
index cd2eef3..cd2eef3 100644
--- a/CommonAPI-Ping/src/StopWatch.cpp
+++ b/org.genivi.commonapi.core.verification/src/utils/StopWatch.cpp
diff --git a/CommonAPI-Ping/src/StopWatch.h b/org.genivi.commonapi.core.verification/src/utils/StopWatch.h
index be54b9f..be54b9f 100644
--- a/CommonAPI-Ping/src/StopWatch.h
+++ b/org.genivi.commonapi.core.verification/src/utils/StopWatch.h
diff --git a/org.genivi.commonapi.core.verification/src/utils/VerificationMainLoop.h b/org.genivi.commonapi.core.verification/src/utils/VerificationMainLoop.h
index 0c29589..2d5b72b 100644
--- a/org.genivi.commonapi.core.verification/src/utils/VerificationMainLoop.h
+++ b/org.genivi.commonapi.core.verification/src/utils/VerificationMainLoop.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
+/* Copyright (C) 2014 - 2015 BMW Group
* Author: Juergen Gehring (juergen.gehring@bmw.de)
* 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
@@ -12,7 +11,7 @@
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
#endif
-#include <CommonAPI/MainLoopContext.h>
+#include <CommonAPI/MainLoopContext.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
#include <vector>
@@ -23,7 +22,10 @@
#include <sys/eventfd.h>
#include <cassert>
#include <chrono>
+#include <sys/time.h>
+#include <future>
+const long maxTimeout = 10;
namespace CommonAPI {
@@ -54,6 +56,8 @@ class VerificationMainLoop {
std::bind(&CommonAPI::VerificationMainLoop::deregisterTimeout, this, std::placeholders::_1));
wakeupListenerSubscription_ = context_->subscribeForWakeupEvents(
std::bind(&CommonAPI::VerificationMainLoop::wakeup, this));
+
+ stopPromise = new std::promise<bool>;
}
~VerificationMainLoop() {
@@ -65,12 +69,14 @@ class VerificationMainLoop {
context_->unsubscribeForWakeupEvents(wakeupListenerSubscription_);
close(wakeFd_.fd);
+
+ delete stopPromise;
}
/**
* \brief Runs the mainloop indefinitely until stop() is called.
*
- * Runs the mainloop indefinitely until stop() is called. The given timeout (milliseconds)
+ * Runs the mainloop infinitely until stop() is called. The given timeout (milliseconds)
* will be overridden if a timeout-event is present that defines an earlier ready time.
*/
void run(const int64_t& timeoutInterval = TIMEOUT_INFINITE) {
@@ -78,25 +84,41 @@ class VerificationMainLoop {
while(running_) {
doSingleIteration(timeoutInterval);
}
+
+ if (stopPromise) {
+ stopPromise->set_value(true);
+ }
}
- void runVerification(const int64_t& timeoutInterval, bool dispatchTimeoutAndWatches = false, bool dispatchDispatchSources = false) {
+ void runVerification(const long& timeoutInterval, bool dispatchTimeoutAndWatches = false, bool dispatchDispatchSources = false) {
running_ = true;
- clock_t start = clock();
- while(running_) {
- doVerificationIteration(dispatchTimeoutAndWatches, dispatchDispatchSources);
+ prepare(maxTimeout);
+ long ti = timeoutInterval*((long)(1000/currentMinimalTimeoutInterval_));
- if(timeoutInterval != TIMEOUT_INFINITE && clock()-start > timeoutInterval*CLOCKS_PER_SEC)
- stop();
+ while (ti>0) {
+ ti--;
+ doVerificationIteration(dispatchTimeoutAndWatches, dispatchDispatchSources);
}
+ running_ = false;
+ wakeup();
}
- void stop() {
+ std::future<bool> stop() {
+ // delete old promise to secure, that always a new future object is returned
+ delete stopPromise;
+ stopPromise = new std::promise<bool>;
+
running_ = false;
wakeup();
+
+ return stopPromise->get_future();
}
+ bool isRunning() {
+ return running_;
+ }
+
/**
* \brief Executes a single cycle of the mainloop.
*
@@ -228,16 +250,16 @@ class VerificationMainLoop {
::write(wakeFd_.fd, &wake, sizeof(int64_t));
}
- void dispatchTimeouts()
- {
+ void dispatchTimeouts() {
+
for (auto timeoutIterator = timeoutsToDispatch_.begin(); timeoutIterator != timeoutsToDispatch_.end();
timeoutIterator++) {
std::get<1>(*timeoutIterator)->dispatch();
}
}
- void dispatchWatches()
- {
+ void dispatchWatches() {
+
for (auto watchIterator = watchesToDispatch_.begin();
watchIterator != watchesToDispatch_.end();
watchIterator++) {
@@ -247,29 +269,32 @@ class VerificationMainLoop {
}
}
- void dispatchSources()
- {
+ void dispatchSources() {
+
breakLoop_ = false;
for (auto dispatchSourceIterator = sourcesToDispatch_.begin();
dispatchSourceIterator != sourcesToDispatch_.end() && !breakLoop_; dispatchSourceIterator++) {
while (std::get<1>(*dispatchSourceIterator)->dispatch())
;
-
}
}
- void doVerificationIteration(bool dispatchTimeoutAndWatches, bool dispatchDispatchSources)
- {
- prepare(TIMEOUT_INFINITE);
+ void doVerificationIteration(bool dispatchTimeoutAndWatches, bool dispatchDispatchSources) {
+
+ prepare(maxTimeout);
poll();
if (dispatchTimeoutAndWatches || dispatchDispatchSources) {
+
if (check()) {
+
if (dispatchTimeoutAndWatches) {
- dispatchTimeouts();
dispatchWatches();
+ dispatchTimeouts();
}
- if (dispatchDispatchSources)
+
+ if (dispatchDispatchSources) {
dispatchSources();
+ }
}
timeoutsToDispatch_.clear();
sourcesToDispatch_.clear();
@@ -367,6 +392,8 @@ class VerificationMainLoop {
bool running_;
pollfd wakeFd_;
+
+ std::promise<bool>* stopPromise;
};
diff --git a/org.genivi.commonapi.core.verification/src/utils/VerificationTestStub.cpp b/org.genivi.commonapi.core.verification/src/utils/VerificationTestStub.cpp
deleted file mode 100644
index 6a17823..0000000
--- a/org.genivi.commonapi.core.verification/src/utils/VerificationTestStub.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-
-#include "VerificationTestStub.h"
-#include <unistd.h>
-
-namespace commonapi {
-namespace verification {
-
-void VerificationTestStub::testDerivedTypeMethod(
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue,
- commonapi::tests::DerivedTypeCollection::TestMap testMapInValue,
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue,
- commonapi::tests::DerivedTypeCollection::TestMap& testMapOutValue) {
- testEnumExtended2OutValue = testEnumExtended2InValue;
- testMapOutValue = testMapInValue;
- calledTestDerivedTypeMethod++;
-}
-
-VerificationTestStub::VerificationTestStub() :
- TestInterfaceStubDefault(), calledTestDerivedTypeMethod(0) {
-}
-
-void VerificationTestStub::testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId,
- uint32_t uint32InValue,
- std::string stringInValue,
- uint32_t& uint32OutValue,
- std::string& stringOutValue) {
- uint32OutValue = 1;
- int broadcastNumber = 1;
-
- fireTestPredefinedTypeBroadcastEvent(broadcastNumber++, "");
- fireTestPredefinedTypeBroadcastEvent(broadcastNumber++, "");
- fireTestPredefinedTypeBroadcastEvent(broadcastNumber++, "");
- fireTestPredefinedTypeBroadcastEvent(broadcastNumber++, "");
- fireTestPredefinedTypeBroadcastEvent(broadcastNumber++, "");
- sleep(5);
-}
-
-} /* namespace verification */
-} /* namespace commonapi */
diff --git a/org.genivi.commonapi.core.verification/src/utils/VerificationTestStub.h b/org.genivi.commonapi.core.verification/src/utils/VerificationTestStub.h
deleted file mode 100644
index 09d9b14..0000000
--- a/org.genivi.commonapi.core.verification/src/utils/VerificationTestStub.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-
-#ifndef VERIFICATIONTESTSTUB_H_
-#define VERIFICATIONTESTSTUB_H_
-
-#include "commonapi/tests/TestInterfaceStubDefault.h"
-
-namespace commonapi {
-namespace verification {
-
-class VerificationTestStub : public commonapi::tests::TestInterfaceStubDefault {
-public:
- VerificationTestStub();
-
- int getCalledTestDerivedTypeMethod() const {
- return calledTestDerivedTypeMethod;
- }
-private:
- virtual void testDerivedTypeMethod(
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue,
- commonapi::tests::DerivedTypeCollection::TestMap testMapInValue,
- commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue,
- commonapi::tests::DerivedTypeCollection::TestMap& testMapOutValue);
-
- virtual void testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> clientId,
- uint32_t uint32InValue,
- std::string stringInValue,
- uint32_t& uint32OutValue,
- std::string& stringOutValue);
-
- int calledTestDerivedTypeMethod;
-};
-
-} /* namespace verification */
-} /* namespace commonapi */
-#endif /* VERIFICATIONTESTSTUB_H_ */
diff --git a/org.genivi.commonapi.core/.classpath b/org.genivi.commonapi.core/.classpath
index 281e1c2..5199592 100644
--- a/org.genivi.commonapi.core/.classpath
+++ b/org.genivi.commonapi.core/.classpath
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="deployment"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="src" path="xtend-gen"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="lib" exported="true" path="lib/guava-14.0.1.jar"/>
+ <classpathentry kind="src" path="deployment"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.genivi.commonapi.core/.gitignore b/org.genivi.commonapi.core/.gitignore
index 869face..d7a41af 100644
--- a/org.genivi.commonapi.core/.gitignore
+++ b/org.genivi.commonapi.core/.gitignore
@@ -1,2 +1,5 @@
+/bin
+/src-gen
/target
-/lib/guava-14.0.1.jar \ No newline at end of file
+/xtend-gen
+*~
diff --git a/org.genivi.commonapi.core/.settings/.gitignore b/org.genivi.commonapi.core/.settings/.gitignore
deleted file mode 100644
index 3b1537c..0000000
--- a/org.genivi.commonapi.core/.settings/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/org.eclipse.jdt.core.prefs
diff --git a/org.genivi.commonapi.core/.settings/org.eclipse.core.runtime.prefs b/org.genivi.commonapi.core/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/org.genivi.commonapi.core/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.genivi.commonapi.core/LICENSE b/org.genivi.commonapi.core/LICENSE
deleted file mode 100644
index 14e2f77..0000000
--- a/org.genivi.commonapi.core/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- 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/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/org.genivi.commonapi.core/META-INF/MANIFEST.MF b/org.genivi.commonapi.core/META-INF/MANIFEST.MF
index 8d111fe..87908ce 100644
--- a/org.genivi.commonapi.core/META-INF/MANIFEST.MF
+++ b/org.genivi.commonapi.core/META-INF/MANIFEST.MF
@@ -2,20 +2,21 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: GENIVI Common API Generator
Bundle-Vendor: BMW AG
-Bundle-Version: 2.1.6.qualifier
+Bundle-Version: 3.1.1.qualifier
Bundle-SymbolicName: org.genivi.commonapi.core;singleton:=true
Bundle-ActivationPolicy: lazy
-Require-Bundle: org.eclipse.core.resources;bundle-version="3.8.0",
- org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.xtend2.lib;bundle-version="2.4.0",
- org.eclipse.xtext.generator;bundle-version="2.4.0",
- org.eclipse.xtext.util;bundle-version="2.4.0",
- org.eclipse.xtext.builder;bundle-version="2.4.0",
- org.franca.core.dsl;bundle-version="0.8.9",
- org.franca.deploymodel.dsl;bundle-version="0.8.9",
- org.eclipse.jface
-Import-Package: javax.inject;version="1.0.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Export-Package: org.genivi.commonapi.core.deployment,org.genivi.common
- api.core.generator, org.genivi.commonapi.core.preferences
-Bundle-ClassPath: .,lib/guava-14.0.1.jar
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.8.0,4.0.0)";visibility:=reexport,
+ org.eclipse.core.resources;bundle-version="[3.9.0,4.0.0)";visibility:=reexport,
+ org.eclipse.xtext;bundle-version="[2.7.0,3.0.0)";visibility:=reexport,
+ org.eclipse.xtext.generator;bundle-version="[2.7.0,3.0.0)";visibility:=reexport,
+ org.eclipse.xtext.util;bundle-version="[2.7.0,3.0.0)";visibility:=reexport,
+ com.google.guava;bundle-version="15.0.0";visibility:=reexport,
+ org.franca.core.dsl;bundle-version="[0.9.0,0.10.0)";visibility:=reexport,
+ org.franca.deploymodel.dsl;bundle-version="[0.9.0,0.10.0)";visibility:=reexport
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Export-Package: org.genivi.commonapi.core,
+ org.genivi.commonapi.core.deployment,
+ org.genivi.commonapi.core.generator,
+ org.genivi.commonapi.core.preferences,
+ org.genivi.commonapi.core.verification
+Bundle-ClassPath: .
diff --git a/org.genivi.commonapi.core/README b/org.genivi.commonapi.core/README
deleted file mode 100644
index 7f6dbbf..0000000
--- a/org.genivi.commonapi.core/README
+++ /dev/null
@@ -1,4 +0,0 @@
-To write source code for the CommonAPI-Tools and to compile them, please download
-guava-14.0.1.jar from
-http://search.maven.org/remotecontent?filepath=com/google/guava/guava/14.0.1/guava-14.0.1.jar
-and put it into a folder called "lib" in the project root directory. \ No newline at end of file
diff --git a/org.genivi.commonapi.core/build.properties b/org.genivi.commonapi.core/build.properties
index c24af96..9e7dc14 100644
--- a/org.genivi.commonapi.core/build.properties
+++ b/org.genivi.commonapi.core/build.properties
@@ -1,5 +1,6 @@
+javacDefaultEncoding.. = UTF-8
source.. = src/,\
- src-gen/,\
+ src-gen/,\
xtend-gen/,\
deployment/
bin.includes = META-INF/,\
diff --git a/org.genivi.commonapi.core/deployment/CommonAPI_deployment.fdepl b/org.genivi.commonapi.core/deployment/CommonAPI_deployment.fdepl
deleted file mode 100644
index a587bee..0000000
--- a/org.genivi.commonapi.core/deployment/CommonAPI_deployment.fdepl
+++ /dev/null
@@ -1,9 +0,0 @@
-specification org.genivi.commonapi.core.deployment.deployment {
- for interfaces {
- DefaultEnumBackingType: {UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64} (default: UInt32);
- }
-
- for enumerations {
- EnumBackingType: {UseDefault, UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64} (default: UseDefault);
- }
-}
diff --git a/org.genivi.commonapi.core/deployment/CommonAPI_deployment_spec.fdepl b/org.genivi.commonapi.core/deployment/CommonAPI_deployment_spec.fdepl
new file mode 100644
index 0000000..acc6a62
--- /dev/null
+++ b/org.genivi.commonapi.core/deployment/CommonAPI_deployment_spec.fdepl
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2015 Bayerische Motoren Werke AG (BMW).
+ * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
+ * Author: Juergen Gehring (juergen.gehring@bmw.de)
+ *
+ * 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/.
+ *
+ *
+ * CommonAPI C++ SOME/IP deployment for CommonAPI C++ 3.x
+ * Version: 1.0
+ *
+ * Generic deployment specification for CommonAPI 3.x to be used by
+ * all CommonAPI code generation tools, e.g.
+ * CommonAPI-Tools
+ * CommonAPI-DBus-Tools
+ * CommonAPI-SOMEIP-Tools
+ * and all other CommonAPI language bindings compatible to CommonAPI C++ 3.x
+ */
+
+specification org.genivi.commonapi.core.deployment {
+
+ for interfaces {
+ /*
+ * define the enumeration backing type on CommonAPI C++ level for whole interface.
+ */
+ DefaultEnumBackingType : {UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64} (default: UInt32);
+ }
+
+ for providers {
+ /*
+ * Enumerate all service instances this provider depends on (if any).
+ */
+ ClientInstanceReferences : Instance[] (optional);
+ }
+
+ for instances {
+ /*
+ * The CommonAPI address string has the format "domain:interfaceid:instanceid"
+ * according to CommonAPI specification.
+ * To avoid inconsistencies only domain and instance id can be specified during deployment,
+ * while the interface id is fixed by the interface the instance realizes.
+ */
+ Domain : String (default: "local"); // the domain part of the CommonAPI address.
+ InstanceId : String; // the instance id of the CommonAPI address.
+
+ /*
+ * Define default timeout for all methods awaiting results of an instance in seconds.
+ * 0s means no timeout/waiting forever.
+ * if the timeout elapsed without arrival of a valid result an error will be delivered to the application.
+ */
+ DefaultMethodTimeout : Integer (default:0);
+
+ /*
+ * provide properties to register for instance. use "Name=Value" as format.
+ * This deployment property is currently not supported.
+ */
+ PreregisteredProperties : String [] (optional);
+ }
+
+ for methods {
+ /*
+ * timeout for method calls in ns.
+ * If timeout is defined with value > 0, then a method call will return with a timeout error
+ * in case no result arrived before the timeout elapsed.
+ * 0 means no timeout.
+ */
+ Timeout : Integer (default: 0);
+ }
+
+ for enumerations {
+ /*
+ * define the enumeration backing type on CommonAPI C++ level for a specific enumeration.
+ * If not specified use "ApiDefaultEnumBackingType".
+ */
+ EnumBackingType : {UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64} (optional);
+ }
+} \ No newline at end of file
diff --git a/org.genivi.commonapi.core/pom.xml b/org.genivi.commonapi.core/pom.xml
index 380401a..9a43f72 100644
--- a/org.genivi.commonapi.core/pom.xml
+++ b/org.genivi.commonapi.core/pom.xml
@@ -6,8 +6,8 @@
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>commonapi</groupId>
- <artifactId>org.genivi.commonapi.releng</artifactId>
- <version>2.1.6-SNAPSHOT</version>
- <relativePath>../org.genivi.commonapi.releng</relativePath>
+ <artifactId>org.genivi.commonapi.core.releng</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
+ <relativePath>../org.genivi.commonapi.core.releng</relativePath>
</parent>
-</project> \ No newline at end of file
+</project>
diff --git a/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/deployment/DeploymentInterfacePropertyAccessor.java b/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentInterfacePropertyAccessor.java
index b2f0e5c..bfe7c5b 100644
--- a/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/deployment/DeploymentInterfacePropertyAccessor.java
+++ b/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentInterfacePropertyAccessor.java
@@ -1,15 +1,16 @@
/*******************************************************************************
* This file has been generated by Franca's FDeployGenerator.
-* Source: deployment spec 'org.genivi.commonapi.core.deployment.deployment'
+* Source: deployment spec 'org.genivi.commonapi.core.deployment'
*******************************************************************************/
-package org.genivi.commonapi.core.deployment;
+package org.genivi.commonapi.core;
-import org.franca.core.franca.FEnumerationType;
import org.franca.core.franca.FInterface;
+import org.franca.core.franca.FMethod;
+import org.franca.core.franca.FEnumerationType;
import org.franca.deploymodel.core.FDeployedInterface;
/**
- * Accessor for deployment properties for 'org.genivi.commonapi.core.deployment.deployment' specification
+ * Accessor for deployment properties for 'org.genivi.commonapi.core.deployment' specification
*/
public class DeploymentInterfacePropertyAccessor
{
@@ -48,8 +49,12 @@ public class DeploymentInterfacePropertyAccessor
return null;
}
+ public Integer getTimeout (FMethod obj) {
+ return target.getInteger(obj, "Timeout");
+ }
+
public enum EnumBackingType {
- UseDefault, UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64
+ UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64
}
public EnumBackingType getEnumBackingType (FEnumerationType obj) {
String e = target.getEnum(obj, "EnumBackingType");
@@ -57,8 +62,6 @@ public class DeploymentInterfacePropertyAccessor
return convertEnumBackingType(e);
}
private EnumBackingType convertEnumBackingType (String val) {
- if (val.equals("UseDefault"))
- return EnumBackingType.UseDefault; else
if (val.equals("UInt8"))
return EnumBackingType.UInt8; else
if (val.equals("UInt16"))
diff --git a/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentProviderPropertyAccessor.java b/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentProviderPropertyAccessor.java
new file mode 100644
index 0000000..66e58e0
--- /dev/null
+++ b/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentProviderPropertyAccessor.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+* This file has been generated by Franca's FDeployGenerator.
+* Source: deployment spec 'org.genivi.commonapi.core.deployment'
+*******************************************************************************/
+package org.genivi.commonapi.core;
+
+import java.util.List;
+
+import org.franca.core.franca.FInterface;
+import org.franca.deploymodel.core.FDeployedProvider;
+import org.franca.deploymodel.dsl.fDeploy.FDInterfaceInstance;
+import org.franca.deploymodel.dsl.fDeploy.FDProvider;
+
+/**
+ * Accessor for deployment properties for 'org.genivi.commonapi.core.deployment' specification
+ */
+public class DeploymentProviderPropertyAccessor
+{
+
+ private FDeployedProvider target;
+
+ public DeploymentProviderPropertyAccessor (FDeployedProvider target) {
+ this.target = target;
+ }
+
+ public List<FInterface> getClientInstanceReferences (FDProvider obj) {
+ return target.getInterfaceArray(obj, "ClientInstanceReferences");
+ }
+
+ public String getDomain (FDInterfaceInstance obj) {
+ return target.getString(obj, "Domain");
+ }
+
+ public String getInstanceId (FDInterfaceInstance obj) {
+ return target.getString(obj, "InstanceId");
+ }
+
+ public Integer getDefaultMethodTimeout (FDInterfaceInstance obj) {
+ return target.getInteger(obj, "DefaultMethodTimeout");
+ }
+
+ public List<String> getPreregisteredProperties (FDInterfaceInstance obj) {
+ return target.getStringArray(obj, "PreregisteredProperties");
+ }
+
+
+}
diff --git a/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentTypeCollectionPropertyAccessor.java b/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentTypeCollectionPropertyAccessor.java
new file mode 100644
index 0000000..c61328f
--- /dev/null
+++ b/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentTypeCollectionPropertyAccessor.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+* This file has been generated by Franca's FDeployGenerator.
+* Source: deployment spec 'org.genivi.commonapi.core.deployment'
+*******************************************************************************/
+package org.genivi.commonapi.core;
+
+import org.franca.core.franca.FInterface;
+import org.franca.core.franca.FEnumerationType;
+import org.franca.deploymodel.core.FDeployedTypeCollection;
+
+/**
+ * Accessor for deployment properties for 'org.genivi.commonapi.core.deployment' specification
+ */
+public class DeploymentTypeCollectionPropertyAccessor
+{
+
+ private FDeployedTypeCollection target;
+
+ public DeploymentTypeCollectionPropertyAccessor (FDeployedTypeCollection target) {
+ this.target = target;
+ }
+
+ public enum DefaultEnumBackingType {
+ UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64
+ }
+ public DefaultEnumBackingType getDefaultEnumBackingType (FInterface obj) {
+ String e = target.getEnum(obj, "DefaultEnumBackingType");
+ if (e==null) return null;
+ return convertDefaultEnumBackingType(e);
+ }
+ private DefaultEnumBackingType convertDefaultEnumBackingType (String val) {
+ if (val.equals("UInt8"))
+ return DefaultEnumBackingType.UInt8; else
+ if (val.equals("UInt16"))
+ return DefaultEnumBackingType.UInt16; else
+ if (val.equals("UInt32"))
+ return DefaultEnumBackingType.UInt32; else
+ if (val.equals("UInt64"))
+ return DefaultEnumBackingType.UInt64; else
+ if (val.equals("Int8"))
+ return DefaultEnumBackingType.Int8; else
+ if (val.equals("Int16"))
+ return DefaultEnumBackingType.Int16; else
+ if (val.equals("Int32"))
+ return DefaultEnumBackingType.Int32; else
+ if (val.equals("Int64"))
+ return DefaultEnumBackingType.Int64;
+ return null;
+ }
+
+ public enum EnumBackingType {
+ UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64
+ }
+ public EnumBackingType getEnumBackingType (FEnumerationType obj) {
+ String e = target.getEnum(obj, "EnumBackingType");
+ if (e==null) return null;
+ return convertEnumBackingType(e);
+ }
+ private EnumBackingType convertEnumBackingType (String val) {
+ if (val.equals("UInt8"))
+ return EnumBackingType.UInt8; else
+ if (val.equals("UInt16"))
+ return EnumBackingType.UInt16; else
+ if (val.equals("UInt32"))
+ return EnumBackingType.UInt32; else
+ if (val.equals("UInt64"))
+ return EnumBackingType.UInt64; else
+ if (val.equals("Int8"))
+ return EnumBackingType.Int8; else
+ if (val.equals("Int16"))
+ return EnumBackingType.Int16; else
+ if (val.equals("Int32"))
+ return EnumBackingType.Int32; else
+ if (val.equals("Int64"))
+ return EnumBackingType.Int64;
+ return null;
+ }
+
+
+}
diff --git a/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/deployment/.gitignore b/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/deployment/.gitignore
deleted file mode 100644
index 6f676af..0000000
--- a/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/deployment/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/DeploymentInterfacePropertyAccessor.java
-/DeploymentProviderPropertyAccessor.java
diff --git a/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/deployment/DeploymentProviderPropertyAccessor.java b/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/deployment/DeploymentProviderPropertyAccessor.java
deleted file mode 100644
index 790c745..0000000
--- a/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/deployment/DeploymentProviderPropertyAccessor.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
-* This file has been generated by Franca's FDeployGenerator.
-* Source: deployment spec 'org.genivi.commonapi.core.deployment.deployment'
-*******************************************************************************/
-package org.genivi.commonapi.core.deployment;
-
-import org.franca.deploymodel.core.FDeployedProvider;
-
-/**
- * Accessor for deployment properties for 'org.genivi.commonapi.core.deployment.deployment' specification
- */
-public class DeploymentProviderPropertyAccessor
-{
-
- private FDeployedProvider target;
-
- public DeploymentProviderPropertyAccessor (FDeployedProvider target) {
- this.target = target;
- }
-
-
-}
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/deployment/DeploymentInterfacePropertyAccessorWrapper.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/deployment/DeploymentInterfacePropertyAccessorWrapper.java
deleted file mode 100644
index b4f6811..0000000
--- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/deployment/DeploymentInterfacePropertyAccessorWrapper.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-package org.genivi.commonapi.core.deployment;
-
-import org.franca.core.franca.FEnumerationType;
-import org.franca.core.franca.FInterface;
-import org.franca.deploymodel.core.FDeployedInterface;
-import org.genivi.commonapi.core.deployment.DeploymentInterfacePropertyAccessor;
-
-public class DeploymentInterfacePropertyAccessorWrapper extends DeploymentInterfacePropertyAccessor {
-
- boolean encapsulate;
-
- public DeploymentInterfacePropertyAccessorWrapper(FDeployedInterface target) {
- super(target);
- encapsulate = (target == null);
- }
-
- public DefaultEnumBackingType getDefaultEnumBackingType(FInterface obj) {
- if(encapsulate) {
- return DefaultEnumBackingType.Int32;
- }
- return super.getDefaultEnumBackingType(obj);
- }
-
- public EnumBackingType getEnumBackingType (FEnumerationType obj) {
- if(encapsulate) {
- return EnumBackingType.Int32;
- }
- return super.getEnumBackingType(obj);
- }
-}
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/deployment/PropertyAccessor.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/deployment/PropertyAccessor.java
new file mode 100644
index 0000000..b733fdf
--- /dev/null
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/deployment/PropertyAccessor.java
@@ -0,0 +1,255 @@
+/* Copyright (C) 2015 BMW Group
+ * Author: Lutz Bichler (lutz.bichler@bmw.de)
+ * 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/. */
+package org.genivi.commonapi.core.deployment;
+
+import java.util.List;
+
+import org.franca.core.franca.FEnumerationType;
+import org.franca.core.franca.FInterface;
+import org.franca.core.franca.FMethod;
+import org.franca.deploymodel.core.FDeployedInterface;
+import org.franca.deploymodel.core.FDeployedProvider;
+import org.franca.deploymodel.core.FDeployedTypeCollection;
+import org.franca.deploymodel.dsl.fDeploy.FDInterfaceInstance;
+import org.franca.deploymodel.dsl.fDeploy.FDProvider;
+import org.genivi.commonapi.core.DeploymentInterfacePropertyAccessor;
+import org.genivi.commonapi.core.DeploymentProviderPropertyAccessor;
+import org.genivi.commonapi.core.DeploymentTypeCollectionPropertyAccessor;
+
+public class PropertyAccessor {
+
+ protected static Integer defaultTimeout_ = new Integer(0);
+
+ protected enum DeploymentType { NONE, INTERFACE, TYPE_COLLECTION, PROVIDER };
+ protected DeploymentType type_;
+
+ DeploymentInterfacePropertyAccessor interface_;
+ DeploymentTypeCollectionPropertyAccessor typeCollection_;
+ DeploymentProviderPropertyAccessor provider_;
+
+ // The following definitions are contained in the specific accessors
+ // for interfaces and type collections. We will simply cast them...
+ public enum DefaultEnumBackingType {
+ UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64
+ }
+
+ public enum EnumBackingType {
+ UseDefault, UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64
+ }
+
+ public PropertyAccessor() {
+ type_ = DeploymentType.NONE;
+ interface_ = null;
+ typeCollection_ = null;
+ provider_ = null;
+ }
+
+ public PropertyAccessor(FDeployedInterface _target) {
+ type_ = (_target == null ? DeploymentType.NONE : DeploymentType.INTERFACE);
+ interface_ = new DeploymentInterfacePropertyAccessor(_target);
+ typeCollection_ = null;
+ provider_ = null;
+ }
+
+ public PropertyAccessor(FDeployedTypeCollection _target) {
+ type_ = (_target == null ? DeploymentType.NONE : DeploymentType.TYPE_COLLECTION);
+ interface_ = null;
+ typeCollection_ = new DeploymentTypeCollectionPropertyAccessor(_target);
+ provider_ = null;
+ }
+
+ public PropertyAccessor(FDeployedProvider _target) {
+ type_ = (_target == null ? DeploymentType.NONE : DeploymentType.PROVIDER);
+ interface_ = null;
+ typeCollection_ = null;
+ provider_ = new DeploymentProviderPropertyAccessor(_target);
+ }
+
+ public DefaultEnumBackingType getDefaultEnumBackingType(FInterface obj) {
+ try {
+ switch (type_) {
+ case INTERFACE:
+ return from(interface_.getDefaultEnumBackingType(obj));
+ case TYPE_COLLECTION:
+ return from(typeCollection_.getDefaultEnumBackingType(obj));
+ case PROVIDER:
+ case NONE:
+ default:
+ }
+ }
+ catch (java.lang.NullPointerException e) {}
+ return DefaultEnumBackingType.Int32;
+ }
+
+ public EnumBackingType getEnumBackingType (FEnumerationType obj) {
+ try {
+ switch (type_) {
+ case INTERFACE:
+ return from(interface_.getEnumBackingType(obj));
+ case TYPE_COLLECTION:
+ return from(typeCollection_.getEnumBackingType(obj));
+ case PROVIDER:
+ case NONE:
+ default:
+ return EnumBackingType.Int32;
+ }
+ }
+ catch (java.lang.NullPointerException e) {}
+ return EnumBackingType.Int32;
+ }
+
+ public Integer getTimeout(FMethod obj) {
+ try {
+ if (type_ == DeploymentType.INTERFACE)
+ return interface_.getTimeout(obj);
+ }
+ catch (java.lang.NullPointerException e) {}
+ return defaultTimeout_;
+ }
+
+ public List<FInterface> getClientInstanceReferences (FDProvider obj) {
+ try {
+ if (type_ == DeploymentType.PROVIDER)
+ return provider_.getClientInstanceReferences(obj);
+ }
+ catch (java.lang.NullPointerException e) {}
+ return null;
+ }
+
+ public String getDomain (FDInterfaceInstance obj) {
+ try {
+ if (type_ == DeploymentType.PROVIDER)
+ return provider_.getDomain(obj);
+ }
+ catch (java.lang.NullPointerException e) {}
+ return null;
+ }
+
+ public String getInstanceId (FDInterfaceInstance obj) {
+ try {
+ if (type_ == DeploymentType.PROVIDER)
+ return provider_.getInstanceId(obj);
+ }
+ catch (java.lang.NullPointerException e) {}
+ return null;
+ }
+
+ public Integer getDefaultMethodTimeout (FDInterfaceInstance obj) {
+ try {
+ if (type_ == DeploymentType.PROVIDER)
+ return provider_.getDefaultMethodTimeout(obj);
+ }
+ catch (java.lang.NullPointerException e) {}
+ return null;
+ }
+
+ public List<String> getPreregisteredProperties (FDInterfaceInstance obj) {
+ try {
+ if (type_ == DeploymentType.PROVIDER)
+ return provider_.getPreregisteredProperties(obj);
+ }
+ catch (java.lang.NullPointerException e) {}
+ return null;
+ }
+
+ private DefaultEnumBackingType from(DeploymentInterfacePropertyAccessor.DefaultEnumBackingType _source) {
+ switch (_source) {
+ case UInt8:
+ return DefaultEnumBackingType.UInt8;
+ case UInt16:
+ return DefaultEnumBackingType.UInt16;
+ case UInt32:
+ return DefaultEnumBackingType.UInt8;
+ case UInt64:
+ return DefaultEnumBackingType.UInt8;
+ case Int8:
+ return DefaultEnumBackingType.Int8;
+ case Int16:
+ return DefaultEnumBackingType.Int16;
+ case Int32:
+ return DefaultEnumBackingType.Int32;
+ case Int64:
+ return DefaultEnumBackingType.Int64;
+ default:
+ return DefaultEnumBackingType.Int32;
+ }
+ }
+
+ private EnumBackingType from(DeploymentInterfacePropertyAccessor.EnumBackingType _source) {
+ switch (_source) {
+ case UInt8:
+ return EnumBackingType.UInt8;
+ case UInt16:
+ return EnumBackingType.UInt16;
+ case UInt32:
+ return EnumBackingType.UInt8;
+ case UInt64:
+ return EnumBackingType.UInt8;
+ case Int8:
+ return EnumBackingType.Int8;
+ case Int16:
+ return EnumBackingType.Int16;
+ case Int32:
+ return EnumBackingType.Int32;
+ case Int64:
+ return EnumBackingType.Int64;
+ default:
+ return EnumBackingType.UseDefault;
+ }
+ }
+
+ private DefaultEnumBackingType from(DeploymentTypeCollectionPropertyAccessor.DefaultEnumBackingType _source) {
+ if (_source != null) {
+ switch (_source) {
+ case UInt8:
+ return DefaultEnumBackingType.UInt8;
+ case UInt16:
+ return DefaultEnumBackingType.UInt16;
+ case UInt32:
+ return DefaultEnumBackingType.UInt8;
+ case UInt64:
+ return DefaultEnumBackingType.UInt8;
+ case Int8:
+ return DefaultEnumBackingType.Int8;
+ case Int16:
+ return DefaultEnumBackingType.Int16;
+ case Int32:
+ return DefaultEnumBackingType.Int32;
+ case Int64:
+ return DefaultEnumBackingType.Int64;
+ default:
+ return DefaultEnumBackingType.Int32;
+ }
+ }
+ return DefaultEnumBackingType.Int32;
+ }
+
+ private EnumBackingType from(DeploymentTypeCollectionPropertyAccessor.EnumBackingType _source) {
+ if (_source != null) {
+ switch (_source) {
+ case UInt8:
+ return EnumBackingType.UInt8;
+ case UInt16:
+ return EnumBackingType.UInt16;
+ case UInt32:
+ return EnumBackingType.UInt8;
+ case UInt64:
+ return EnumBackingType.UInt8;
+ case Int8:
+ return EnumBackingType.Int8;
+ case Int16:
+ return EnumBackingType.Int16;
+ case Int32:
+ return EnumBackingType.Int32;
+ case Int64:
+ return EnumBackingType.Int64;
+ default:
+ return EnumBackingType.UseDefault;
+ }
+ }
+ return EnumBackingType.UseDefault;
+ }
+}
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FDeployManager.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FDeployManager.java
new file mode 100644
index 0000000..a6c62a9
--- /dev/null
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FDeployManager.java
@@ -0,0 +1,99 @@
+package org.genivi.commonapi.core.generator;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.franca.core.dsl.FrancaImportsProvider;
+import org.franca.core.utils.ImportsProvider;
+import org.franca.deploymodel.dsl.FDeployImportsProvider;
+
+/**
+ * The FDeployManager loads models from fdepl files and from fidl files that are imported in a fdepl file.
+ * It continues to import files even it could not find all of them (e.g an unknown deployment specification).
+ *
+ * @author gutknecht
+ *
+ */
+public class FDeployManager {
+
+ private final static String fileExtension = "fdepl";
+
+ private ResourceSet resourceSet;
+
+ /**
+ * Map used to handle generically different model files.
+ */
+ private static Map<String, ImportsProvider> fileHandlerRegistry = new HashMap<String, ImportsProvider>();
+
+ public FDeployManager() {
+
+ resourceSet = new ResourceSetImpl();
+
+ // we expect fdepl files
+ fileHandlerRegistry.put(fileExtension, new FDeployImportsProvider());
+ // allow for fidl file imports
+ fileHandlerRegistry.put("fidl", new FrancaImportsProvider());
+ }
+
+ /**
+ *
+ * Load the model found in the fileName. Its dependencies (imports) can be loaded subsequently.
+ * @param uri the URI to be loaded
+ * @param root the root of the model (needed for loading multiple file models)
+ * This has to be an absolute, hierarchical URI.
+ * @return the root model or null in case of an error.
+ */
+ public EObject loadModel(URI uri, URI root) {
+ // resolve the input uri, in case it is a relative path
+ URI absURI = uri.resolve(root);
+ if (! uri.equals(absURI)) {
+ // add this pair to URI converter so that others can get the URI by its relative path
+ resourceSet.getURIConverter().getURIMap().put(uri, absURI);
+ }
+
+ // load root model
+ Resource resource = null;
+ try {
+ resource = resourceSet.getResource(absURI, true);
+ resource.load(Collections.EMPTY_MAP);
+ } catch (Exception e) {
+ // Don't show an error message here, because code may be generated from an included fidl file.
+ //System.err.println("Failed to load model from : " + absURI);
+ return null;
+ }
+ EObject model = resource.getContents().get(0);
+
+ // load all its imports recursively
+ for (Iterator<String> it = fileHandlerRegistry.get(absURI.fileExtension()).importsIterator(model); it.hasNext();) {
+ String importURIStr = it.next();
+ URI importURI = URI.createURI(importURIStr);
+ URI resolvedURI = importURI.resolve(absURI);
+
+ // add this pair to URI converter so that others can get the URI by its relative path
+ resourceSet.getURIConverter().getURIMap().put(importURI, resolvedURI);
+ //System.out.println("trying to load model " + resolvedURI);
+ model = loadModel(resolvedURI, root);
+ if(model == null) {
+ // something went wrong with this import, go on with the next one
+ continue;
+ }
+ }
+ return model;
+ }
+
+ /**
+ * @return the file extension this class will deal with (.fdepl)
+ */
+ public static String fileExtension() {
+ return fileExtension;
+ }
+
+
+}
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceGenerator.xtend
index db5f8e9..4402ac6 100644
--- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceGenerator.xtend
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceGenerator.xtend
@@ -6,32 +6,33 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.genivi.commonapi.core.generator
+import java.util.Collection
+import java.util.HashSet
import javax.inject.Inject
+import org.eclipse.core.resources.IResource
import org.eclipse.xtext.generator.IFileSystemAccess
import org.franca.core.franca.FInterface
-import org.genivi.commonapi.core.deployment.DeploymentInterfacePropertyAccessor
-import java.util.Collection
-import java.util.HashSet
import org.franca.core.franca.FMethod
-import org.eclipse.core.resources.IResource
+import org.franca.core.franca.FVersion
+import org.genivi.commonapi.core.deployment.PropertyAccessor
class FInterfaceGenerator {
@Inject private extension FTypeGenerator
@Inject private extension FTypeCommonAreaGenerator
@Inject private extension FrancaGeneratorExtensions
- def generate(FInterface fInterface, IFileSystemAccess fileSystemAccess, DeploymentInterfacePropertyAccessor deploymentAccessor, IResource modelid) {
- fileSystemAccess.generateFile(fInterface.headerPath, fInterface.generateHeader(deploymentAccessor, modelid))
+ def generate(FInterface fInterface, IFileSystemAccess fileSystemAccess, PropertyAccessor deploymentAccessor, IResource modelid) {
+ fileSystemAccess.generateFile(fInterface.headerPath, IFileSystemAccess.DEFAULT_OUTPUT, fInterface.generateHeader(modelid, deploymentAccessor))
if (fInterface.hasSourceFile)
- fileSystemAccess.generateFile(fInterface.sourcePath, fInterface.generateSource(modelid))
+ fileSystemAccess.generateFile(fInterface.sourcePath, IFileSystemAccess.DEFAULT_OUTPUT, fInterface.generateSource(modelid, deploymentAccessor))
}
- def private generateHeader(FInterface fInterface, DeploymentInterfacePropertyAccessor deploymentAccessor, IResource modelid) '''
+ def private generateHeader(FInterface fInterface, IResource modelid, PropertyAccessor deploymentAccessor) '''
«generateCommonApiLicenseHeader(fInterface, modelid)»
«FTypeGenerator::generateComments(fInterface, false)»
- #ifndef «fInterface.defineName»_H_
- #define «fInterface.defineName»_H_
+ #ifndef «fInterface.defineName.toUpperCase»_HPP_
+ #define «fInterface.defineName.toUpperCase»_HPP_
«val libraryHeaders = new HashSet<String>»
«val generatedHeaders = new HashSet<String>»
@@ -55,78 +56,74 @@ class FInterfaceGenerator {
#undef COMMONAPI_INTERNAL_COMPILATION
+ «fInterface.generateVersionNamespaceBegin»
«fInterface.model.generateNamespaceBeginDeclaration»
- class «fInterface.elementName»«IF fInterface.base != null»: public «fInterface.base.getRelativeNameReference(fInterface)»«ENDIF» {
- public:
+ class «fInterface.elementName»«IF fInterface.base != null»
+ : virtual public «fInterface.base.getTypeCollectionName(fInterface)»«ENDIF» {
+ public:
virtual ~«fInterface.elementName»() { }
- static inline const char* getInterfaceId();
+ static inline const char* getInterface();
static inline CommonAPI::Version getInterfaceVersion();
«fInterface.generateFTypeDeclarations(deploymentAccessor)»
};
- const char* «fInterface.elementName»::getInterfaceId() {
- static const char* interfaceId = "«fInterface.fullyQualifiedName»";
- return interfaceId;
+ const char* «fInterface.elementName»::getInterface() {
+ return ("«fInterface.fullyQualifiedName»");
}
CommonAPI::Version «fInterface.elementName»::getInterfaceVersion() {
- return CommonAPI::Version(«fInterface.version.major», «fInterface.version.minor»);
+ «val FVersion itsVersion = fInterface.version»
+ «IF itsVersion != null»
+ return CommonAPI::Version(«itsVersion.major», «itsVersion.minor»);
+ «ELSE»
+ return CommonAPI::Version(0, 0);
+ «ENDIF»
}
«FOR type : fInterface.types»
«FTypeGenerator::generateComments(type, false)»
«type.generateFTypeInlineImplementation(fInterface, deploymentAccessor)»
«ENDFOR»
- «FOR method : fInterface.methods.filter[errors != null]»
- «FTypeGenerator::generateComments(method, false)»
- «method.errors.generateInlineImplementation(method.errors.errorName, fInterface, fInterface.elementName, deploymentAccessor)»
- «ENDFOR»
«fInterface.model.generateNamespaceEndDeclaration»
+ «fInterface.generateVersionNamespaceEnd»
namespace CommonAPI {
- «fInterface.generateTypeWriters(deploymentAccessor)»
-
«fInterface.generateVariantComparators»
}
-
- namespace std {
- //hashes for types
- «fInterface.generateHashers(deploymentAccessor)»
-
- //hashes for error types
- «FOR method : fInterface.methods.filter[errors != null]»
- «method.errors.generateHash(method.errors.errorName, fInterface, deploymentAccessor)»
- «ENDFOR»
- }
-
- #endif // «fInterface.defineName»_H_
+ #endif // «fInterface.defineName.toUpperCase»_HPP_
'''
- def private generateSource(FInterface fInterface, IResource modelid) '''
+ def private generateSource(FInterface fInterface, IResource modelid, PropertyAccessor _accessor) '''
«generateCommonApiLicenseHeader(fInterface, modelid)»
«FTypeGenerator::generateComments(fInterface, false)»
#include "«fInterface.headerFile»"
+ «fInterface.generateVersionNamespaceBegin»
«fInterface.model.generateNamespaceBeginDeclaration»
+
+ «FOR method : fInterface.methodsWithError»
+ «method.errors.generateFTypeImplementation(method.containingInterface, _accessor)»
+ «ENDFOR»
«FOR type : fInterface.types»
«FTypeGenerator::generateComments(type,false)»
- «type.generateFTypeImplementation(fInterface)»
+ «type.generateFTypeImplementation(fInterface, _accessor)»
«ENDFOR»
«fInterface.model.generateNamespaceEndDeclaration»
+ «fInterface.generateVersionNamespaceEnd»
'''
def void getRequiredHeaderFiles(FInterface fInterface, Collection<String> generatedHeaders, Collection<String> libraryHeaders) {
- libraryHeaders.add('CommonAPI/types.h')
+ libraryHeaders.add('CommonAPI/Types.hpp')
if (!fInterface.methods.filter[errors != null].empty) {
- libraryHeaders.addAll('CommonAPI/InputStream.h', 'CommonAPI/OutputStream.h')
+ libraryHeaders.addAll('CommonAPI/InputStream.hpp', 'CommonAPI/OutputStream.hpp')
}
if (!fInterface.managedInterfaces.empty) {
generatedHeaders.add('set');
@@ -134,7 +131,7 @@ class FInterfaceGenerator {
fInterface.types.forEach[addRequiredHeaders(generatedHeaders, libraryHeaders)]
var Iterable<FMethod> errorMethods = fInterface.methods.filter[errors!=null]
if(errorMethods.size!=0){
- libraryHeaders.addAll('CommonAPI/InputStream.h', 'CommonAPI/OutputStream.h')
+ libraryHeaders.addAll('CommonAPI/InputStream.hpp', 'CommonAPI/OutputStream.hpp')
errorMethods.forEach[
if (errors.base != null) {
errors.base.addRequiredHeaders(generatedHeaders, libraryHeaders)
@@ -147,6 +144,7 @@ class FInterfaceGenerator {
def private hasSourceFile(FInterface fInterface) {
val hasTypeWithImplementation = fInterface.types.exists[hasImplementation]
- return hasTypeWithImplementation
+ val hasMethodWithError = fInterface.methods.exists[hasError]
+ return (hasTypeWithImplementation || hasMethodWithError)
}
}
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceProxyGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceProxyGenerator.xtend
index 30480a3..664b386 100644
--- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceProxyGenerator.xtend
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceProxyGenerator.xtend
@@ -7,34 +7,34 @@
package org.genivi.commonapi.core.generator
import java.util.ArrayList
+import java.util.HashSet
import javax.inject.Inject
+import org.eclipse.core.resources.IResource
import org.eclipse.xtext.generator.IFileSystemAccess
import org.franca.core.franca.FAttribute
import org.franca.core.franca.FInterface
import org.franca.core.franca.FMethod
-import org.genivi.commonapi.core.deployment.DeploymentInterfacePropertyAccessor
-
-import java.util.HashSet
-import org.eclipse.core.resources.IResource
+import org.genivi.commonapi.core.deployment.PropertyAccessor
+import org.genivi.commonapi.core.preferences.PreferenceConstants
class FInterfaceProxyGenerator {
@Inject private extension FTypeGenerator
@Inject private extension FrancaGeneratorExtensions
- def generateProxy(FInterface fInterface, IFileSystemAccess fileSystemAccess, DeploymentInterfacePropertyAccessor deploymentAccessor, IResource modelid) {
- fileSystemAccess.generateFile(fInterface.proxyBaseHeaderPath, fInterface.generateProxyBaseHeader(deploymentAccessor, modelid))
- fileSystemAccess.generateFile(fInterface.proxyHeaderPath, fInterface.generateProxyHeader(modelid))
+ def generateProxy(FInterface fInterface, IFileSystemAccess fileSystemAccess, PropertyAccessor deploymentAccessor, IResource modelid) {
+ fileSystemAccess.generateFile(fInterface.proxyBaseHeaderPath, PreferenceConstants.P_OUTPUT_PROXIES, fInterface.generateProxyBaseHeader(deploymentAccessor, modelid))
+ fileSystemAccess.generateFile(fInterface.proxyHeaderPath, PreferenceConstants.P_OUTPUT_PROXIES, fInterface.generateProxyHeader(modelid))
}
- def private generateProxyBaseHeader(FInterface fInterface, DeploymentInterfacePropertyAccessor deploymentAccessor, IResource modelid) '''
+ def private generateProxyBaseHeader(FInterface fInterface, PropertyAccessor deploymentAccessor, IResource modelid) '''
«generateCommonApiLicenseHeader(fInterface, modelid)»
«FTypeGenerator::generateComments(fInterface, false)»
- #ifndef «fInterface.defineName»_PROXY_BASE_H_
- #define «fInterface.defineName»_PROXY_BASE_H_
+ #ifndef «fInterface.defineName»_PROXY_BASE_HPP_
+ #define «fInterface.defineName»_PROXY_BASE_HPP_
- #include "«fInterface.headerFile»"
+ #include <«fInterface.headerPath»>
«IF fInterface.base != null»
- #include "«fInterface.base.proxyBaseHeaderFile»"
+ #include <«fInterface.base.proxyBaseHeaderPath»>
«ENDIF»
«val generatedHeaders = new HashSet<String>»
@@ -54,18 +54,18 @@ class FInterfaceProxyGenerator {
«ENDFOR»
«IF !fInterface.managedInterfaces.empty»
- #include <CommonAPI/ProxyManager.h>
+ #include <CommonAPI/ProxyManager.hpp>
«ENDIF»
«IF fInterface.hasAttributes»
- #include <CommonAPI/Attribute.h>
+ #include <CommonAPI/Attribute.hpp>
«ENDIF»
«IF fInterface.hasBroadcasts»
- #include <CommonAPI/Event.h>
+ #include <CommonAPI/Event.hpp>
«IF fInterface.hasSelectiveBroadcasts»
- #include <CommonAPI/SelectiveEvent.h>
+ #include <CommonAPI/SelectiveEvent.hpp>
«ENDIF»
«ENDIF»
- #include <CommonAPI/Proxy.h>
+ #include <CommonAPI/Proxy.hpp>
«IF !fInterface.methods.empty»
#include <functional>
#include <future>
@@ -73,18 +73,22 @@ class FInterfaceProxyGenerator {
#undef COMMONAPI_INTERNAL_COMPILATION
+ «fInterface.generateVersionNamespaceBegin»
«fInterface.model.generateNamespaceBeginDeclaration»
- class «fInterface.proxyBaseClassName»: virtual public «IF fInterface.base != null»«fInterface.base.proxyBaseClassName»«ELSE»CommonAPI::Proxy«ENDIF» {
- public:
+ class «fInterface.proxyBaseClassName»
+ : virtual public «IF fInterface.base != null»«fInterface.base.getTypeCollectionName(fInterface)»ProxyBase«ELSE»CommonAPI::Proxy«ENDIF» {
+ public:
«FOR attribute : fInterface.attributes»
- typedef CommonAPI::«attribute.commonApiBaseClassname»<«attribute.getTypeName(fInterface.model)»> «attribute.className»;
+ typedef CommonAPI::«attribute.commonApiBaseClassname»<«attribute.getTypeName(fInterface, true)»> «attribute.className»;
«ENDFOR»
«FOR broadcast : fInterface.broadcasts»
«IF broadcast.isSelective»
- typedef CommonAPI::SelectiveEvent<«broadcast.outArgs.map[getTypeName(fInterface.model)].join(', ')»> «broadcast.className»;
+ typedef CommonAPI::SelectiveEvent<«broadcast.outArgs.map[getTypeName(fInterface, true)].join(', ')»> «broadcast.className»;
«ELSE»
- typedef CommonAPI::Event<«broadcast.outArgs.map[getTypeName(fInterface.model)].join(', ')»> «broadcast.className»;
+ typedef CommonAPI::Event<
+ «broadcast.outArgs.map[getTypeName(fInterface, true)].join(', ')»
+ > «broadcast.className»;
«ENDIF»
«ENDFOR»
@@ -107,9 +111,9 @@ class FInterfaceProxyGenerator {
* @invariant Fire And Forget
*/
«ENDIF»
- virtual «method.generateDefinition» = 0;
+ virtual «method.generateDefinition(true)» = 0;
«IF !method.isFireAndForget»
- virtual «method.generateAsyncDefinition» = 0;
+ virtual «method.generateAsyncDefinition(true)» = 0;
«ENDIF»
«ENDFOR»
«FOR managed : fInterface.managedInterfaces»
@@ -118,20 +122,21 @@ class FInterfaceProxyGenerator {
};
«fInterface.model.generateNamespaceEndDeclaration»
-
- #endif // «fInterface.defineName»_PROXY_BASE_H_
+ «fInterface.generateVersionNamespaceEnd»
+
+ #endif // «fInterface.defineName»_PROXY_BASE_HPP_
'''
def private generateProxyHeader(FInterface fInterface, IResource modelid) '''
«generateCommonApiLicenseHeader(fInterface, modelid)»
«FTypeGenerator::generateComments(fInterface, false)»
- #ifndef «fInterface.defineName»_PROXY_H_
- #define «fInterface.defineName»_PROXY_H_
+ #ifndef «fInterface.defineName»_PROXY_HPP_
+ #define «fInterface.defineName»_PROXY_HPP_
- #include "«fInterface.proxyBaseHeaderFile»"
+ #include <«fInterface.proxyBaseHeaderPath»>
«IF fInterface.base != null»
- #include "«fInterface.base.proxyHeaderFile»"
+ #include "«fInterface.base.proxyHeaderPath»"
«ENDIF»
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
@@ -139,20 +144,21 @@ class FInterfaceProxyGenerator {
#endif
«IF fInterface.hasAttributes»
- #include <CommonAPI/AttributeExtension.h>
- #include <CommonAPI/Factory.h>
+ #include <CommonAPI/AttributeExtension.hpp>
+ #include <CommonAPI/Factory.hpp>
«ENDIF»
#undef COMMONAPI_INTERNAL_COMPILATION
+ «fInterface.generateVersionNamespaceBegin»
«fInterface.model.generateNamespaceBeginDeclaration»
template <typename ... _AttributeExtensions>
- class «fInterface.proxyClassName»: virtual public «fInterface.elementName», virtual public «fInterface.proxyBaseClassName»
- «IF fInterface.base != null»
- , virtual public «fInterface.base.proxyClassName»<_AttributeExtensions...>
- «ENDIF»
- , public _AttributeExtensions... {
+ class «fInterface.proxyClassName»
+ : virtual public «fInterface.elementName»,
+ virtual public «fInterface.proxyBaseClassName»,«IF fInterface.base != null»
+ virtual public «fInterface.base.getTypeCollectionName(fInterface)»Proxy<_AttributeExtensions...>,«ENDIF»
+ public _AttributeExtensions... {
public:
«fInterface.proxyClassName»(std::shared_ptr<CommonAPI::Proxy> delegate);
~«fInterface.proxyClassName»();
@@ -196,7 +202,7 @@ class FInterfaceProxyGenerator {
* "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
* will be set.
*/
- virtual «method.generateDefinition»;
+ virtual «method.generateDefinition(true)»;
«IF !method.isFireAndForget»
/**
* Calls «method.elementName» with asynchronous semantics.
@@ -208,7 +214,7 @@ class FInterfaceProxyGenerator {
* The std::future returned by this method will be fulfilled at arrival of the reply.
* It will provide the same value for CallStatus as will be handed to the callback.
*/
- virtual «method.generateAsyncDefinition»;
+ virtual «method.generateAsyncDefinition(true)»;
«ENDIF»
«ENDFOR»
@@ -219,22 +225,7 @@ class FInterfaceProxyGenerator {
/**
* Returns the CommonAPI address of the remote partner this proxy communicates with.
*/
- virtual std::string getAddress() const;
-
- /**
- * Returns the domain of the remote partner this proxy communicates with.
- */
- virtual const std::string& getDomain() const;
-
- /**
- * Returns the service ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getServiceId() const;
-
- /**
- * Returns the instance ID of the remote partner this proxy communicates with.
- */
- virtual const std::string& getInstanceId() const;
+ virtual const CommonAPI::Address &getAddress() const;
/**
* Returns true if the remote partner for this proxy is currently known to be available.
@@ -262,11 +253,7 @@ class FInterfaceProxyGenerator {
std::shared_ptr<«fInterface.proxyBaseClassName»> delegate_;
};
- #ifdef WIN32
- typedef «fInterface.proxyClassName»<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> «fInterface.proxyDefaultClassName»;
- #else
- typedef «fInterface.proxyClassName»<> «fInterface.proxyDefaultClassName»;
- #endif
+ typedef «fInterface.proxyClassName»<> «fInterface.proxyDefaultClassName»;
«IF fInterface.hasAttributes»
namespace «fInterface.extensionsSubnamespace» {
@@ -296,39 +283,24 @@ class FInterfaceProxyGenerator {
«FOR method : fInterface.methods»
«FTypeGenerator::generateComments(method, false)»
template <typename ... _AttributeExtensions>
- «method.generateDefinitionWithin(fInterface.proxyClassName + '<_AttributeExtensions...>')» {
+ «method.generateDefinitionWithin(fInterface.proxyClassName + '<_AttributeExtensions...>', false)» {
delegate_->«method.elementName»(«method.generateSyncVariableList»);
}
«IF !method.isFireAndForget»
template <typename ... _AttributeExtensions>
- «method.generateAsyncDefinitionWithin(fInterface.proxyClassName + '<_AttributeExtensions...>')» {
+ «method.generateAsyncDefinitionWithin(fInterface.proxyClassName + '<_AttributeExtensions...>', false)» {
return delegate_->«method.elementName»Async(«method.generateASyncVariableList»);
}
«ENDIF»
«ENDFOR»
template <typename ... _AttributeExtensions>
- std::string «fInterface.proxyClassName»<_AttributeExtensions...>::getAddress() const {
+ const CommonAPI::Address &«fInterface.proxyClassName»<_AttributeExtensions...>::getAddress() const {
return delegate_->getAddress();
}
template <typename ... _AttributeExtensions>
- const std::string& «fInterface.proxyClassName»<_AttributeExtensions...>::getDomain() const {
- return delegate_->getDomain();
- }
-
- template <typename ... _AttributeExtensions>
- const std::string& «fInterface.proxyClassName»<_AttributeExtensions...>::getServiceId() const {
- return delegate_->getServiceId();
- }
-
- template <typename ... _AttributeExtensions>
- const std::string& «fInterface.proxyClassName»<_AttributeExtensions...>::getInstanceId() const {
- return delegate_->getInstanceId();
- }
-
- template <typename ... _AttributeExtensions>
bool «fInterface.proxyClassName»<_AttributeExtensions...>::isAvailable() const {
return delegate_->isAvailable();
}
@@ -356,20 +328,21 @@ class FInterfaceProxyGenerator {
«ENDFOR»
«fInterface.model.generateNamespaceEndDeclaration»
+ «fInterface.generateVersionNamespaceEnd»
«IF fInterface.hasAttributes»
namespace CommonAPI {
template<template<typename > class _AttributeExtension>
- struct DefaultAttributeProxyFactoryHelper<«fInterface.model.generateCppNamespace»«fInterface.proxyClassName»,
+ struct DefaultAttributeProxyHelper<«fInterface.versionPrefix»«fInterface.model.generateCppNamespace»«fInterface.proxyClassName»,
_AttributeExtension> {
- typedef typename «fInterface.model.generateCppNamespace»«fInterface.proxyClassName»<
- «fInterface.attributes.map[fInterface.model.generateCppNamespace + fInterface.extensionsSubnamespace + '::' + extensionClassName + "<_AttributeExtension>"].join(", \n")»
+ typedef typename «fInterface.versionPrefix»«fInterface.model.generateCppNamespace»«fInterface.proxyClassName»<
+ «fInterface.attributes.map[fInterface.versionPrefix + fInterface.model.generateCppNamespace + fInterface.extensionsSubnamespace + '::' + extensionClassName + "<_AttributeExtension>"].join(", \n")»
> class_t;
};
}
«ENDIF»
- #endif // «fInterface.defineName»_PROXY_H_
+ #endif // «fInterface.defineName»_PROXY_HPP_
'''
def private generateExtension(FAttribute fAttribute, FInterface fInterface) '''
@@ -448,21 +421,21 @@ class FInterfaceProxyGenerator {
}
def private generateSyncVariableList(FMethod fMethod) {
- val syncVariableList = new ArrayList(fMethod.inArgs.map[elementName])
+ val syncVariableList = new ArrayList(fMethod.inArgs.map['_' + elementName])
- syncVariableList.add('callStatus')
+ syncVariableList.add('_status')
if (fMethod.hasError)
- syncVariableList.add('methodError')
-
- syncVariableList.addAll(fMethod.outArgs.map[elementName])
+ syncVariableList.add('_error')
- return syncVariableList.join(', ')
+ syncVariableList.addAll(fMethod.outArgs.map['_' + elementName])
+
+ return syncVariableList.join(', ') + ", _info"
}
def private generateASyncVariableList(FMethod fMethod) {
- var asyncVariableList = new ArrayList(fMethod.inArgs.map[elementName])
- asyncVariableList.add('callback')
- return asyncVariableList.join(', ')
+ var asyncVariableList = new ArrayList(fMethod.inArgs.map['_' + elementName])
+ asyncVariableList.add('_callback')
+ return asyncVariableList.join(', ') + ", _info"
}
}
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend
index a8f098b..c03b058 100644
--- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend
@@ -1,33 +1,42 @@
-/* Copyright (C) 2013 BMW Group
+/* Copyright (C) 2013, 2014 BMW Group
* Author: Manfred Bathelt (manfred.bathelt@bmw.de)
* Author: Juergen Gehring (juergen.gehring@bmw.de)
+ * Author: Lutz Bichler (lutz.bichler@bmw.de)
* 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/. */
package org.genivi.commonapi.core.generator
+import java.util.HashSet
import javax.inject.Inject
+import org.eclipse.core.resources.IResource
import org.eclipse.xtext.generator.IFileSystemAccess
import org.franca.core.franca.FAttribute
import org.franca.core.franca.FInterface
-import java.util.HashSet
-import org.eclipse.core.resources.IResource
+import org.genivi.commonapi.core.preferences.PreferenceConstants
+import org.genivi.commonapi.core.preferences.FPreferences
class FInterfaceStubGenerator {
@Inject private extension FTypeGenerator
@Inject private extension FrancaGeneratorExtensions
def generateStub(FInterface fInterface, IFileSystemAccess fileSystemAccess, IResource modelid) {
- fileSystemAccess.generateFile(fInterface.stubHeaderPath, fInterface.generateStubHeader(modelid))
- fileSystemAccess.generateFile(fInterface.stubDefaultHeaderPath, fInterface.generateStubDefaultHeader(modelid))
- fileSystemAccess.generateFile(fInterface.stubDefaultSourcePath, fInterface.generateStubDefaultSource(modelid))
+ fileSystemAccess.generateFile(fInterface.stubHeaderPath, PreferenceConstants.P_OUTPUT_STUBS, fInterface.generateStubHeader(modelid))
+ // should skeleton code be generated ?
+ if(FPreferences::instance.getPreference(PreferenceConstants::P_GENERATESKELETON, "false").equals("true"))
+ {
+ fileSystemAccess.generateFile(fInterface.stubDefaultHeaderPath, PreferenceConstants.P_OUTPUT_SKELETON, fInterface.generateStubDefaultHeader(modelid))
+ fileSystemAccess.generateFile(fInterface.stubDefaultSourcePath, PreferenceConstants.P_OUTPUT_SKELETON, fInterface.generateStubDefaultSource(modelid))
+ }
}
def private generateStubHeader(FInterface fInterface, IResource modelid) '''
«generateCommonApiLicenseHeader(fInterface, modelid)»
«FTypeGenerator::generateComments(fInterface, false)»
- #ifndef «fInterface.defineName»_STUB_H_
- #define «fInterface.defineName»_STUB_H_
+ #ifndef «fInterface.defineName»_STUB_HPP_
+ #define «fInterface.defineName»_STUB_HPP_
+
+ #include <functional>
«val generatedHeaders = new HashSet<String>»
«val libraryHeaders = new HashSet<String>»
@@ -40,7 +49,7 @@ class FInterfaceStubGenerator {
#include <«requiredHeaderFile»>
«ENDFOR»
- #include "«fInterface.elementName».h"
+ #include <«fInterface.headerPath»>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -50,10 +59,11 @@ class FInterfaceStubGenerator {
#include <«requiredHeaderFile»>
«ENDFOR»
- #include <CommonAPI/Stub.h>
+ #include <CommonAPI/Stub.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
+ «fInterface.generateVersionNamespaceBegin»
«fInterface.model.generateNamespaceBeginDeclaration»
/**
@@ -62,17 +72,20 @@ class FInterfaceStubGenerator {
* and attribute-changed-notifications of observable attributes as defined by this service.
* An application developer should not need to bother with this class.
*/
- class «fInterface.stubAdapterClassName»: virtual public CommonAPI::StubAdapter, public «fInterface.elementName»«IF fInterface.base != null», public virtual «fInterface.base.stubAdapterClassName»«ENDIF» {
+ class «fInterface.stubAdapterClassName»
+ : virtual public CommonAPI::StubAdapter,
+ public «fInterface.elementName»«IF fInterface.base != null»,
+ public virtual «fInterface.base.getTypeCollectionName(fInterface)»StubAdapter«ENDIF» {
public:
«FOR attribute : fInterface.attributes»
«IF attribute.isObservable»
///Notifies all remote listeners about a change of value of the attribute «attribute.elementName».
- virtual void «attribute.stubAdapterClassFireChangedMethodName»(const «attribute.getTypeName(fInterface.model)»& «attribute.elementName») = 0;
+ virtual void «attribute.stubAdapterClassFireChangedMethodName»(const «attribute.getTypeName(fInterface, true)»& «attribute.elementName») = 0;
«ENDIF»
«ENDFOR»
«FOR broadcast : fInterface.broadcasts»
- «IF !broadcast.selective.nullOrEmpty»
+ «IF broadcast.selective»
/**
* Sends a selective broadcast event for «broadcast.elementName». Should not be called directly.
* Instead, the "fire<broadcastName>Event" methods of the stub should be used.
@@ -87,7 +100,7 @@ class FInterfaceStubGenerator {
* Sends a broadcast event for «broadcast.elementName». Should not be called directly.
* Instead, the "fire<broadcastName>Event" methods of the stub should be used.
*/
- virtual void «broadcast.stubAdapterClassFireEventMethodName»(«broadcast.outArgs.map['const ' + getTypeName(fInterface.model) + '& ' + elementName].join(', ')») = 0;
+ virtual void «broadcast.stubAdapterClassFireEventMethodName»(«broadcast.outArgs.map['const ' + getTypeName(fInterface, true) + ' &_' + elementName].join(', ')») = 0;
«ENDIF»
«ENDFOR»
@@ -104,13 +117,12 @@ class FInterfaceStubGenerator {
* subscribed to the selective broadcasts
*/
«FOR broadcast : fInterface.broadcasts»
- «IF broadcast.selective != null»
+ «IF broadcast.selective»
std::shared_ptr<CommonAPI::ClientIdList> «broadcast.stubAdapterClassSubscriberListPropertyName»;
«ENDIF»
«ENDFOR»
};
-
/**
* Defines the necessary callbacks to handle remote set events related to the attributes
* defined in the IDL description for «fInterface.elementName».
@@ -123,37 +135,48 @@ class FInterfaceStubGenerator {
* This class and the one below are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
- class «fInterface.stubRemoteEventClassName»«IF fInterface.base != null»: public virtual «fInterface.base.stubRemoteEventClassName»«ENDIF» {
- public:
+ class «fInterface.stubRemoteEventClassName»
+ «IF fInterface.base != null»
+ : public virtual «fInterface.base.getTypeCollectionName(fInterface)»StubRemoteEvent
+ «ENDIF»
+ {
+ public:
virtual ~«fInterface.stubRemoteEventClassName»() { }
«FOR attribute : fInterface.attributes»
«IF !attribute.readonly»
/// Verification callback for remote set requests on the attribute «attribute.elementName»
- virtual bool «attribute.stubRemoteEventClassSetMethodName»(const std::shared_ptr<CommonAPI::ClientId> clientId, «attribute.getTypeName(fInterface.model)» «attribute.elementName») = 0;
+ virtual bool «attribute.stubRemoteEventClassSetMethodName»(const std::shared_ptr<CommonAPI::ClientId> _client, «attribute.getTypeName(fInterface, true)» «attribute.elementName») = 0;
/// Action callback for remote set requests on the attribute «attribute.elementName»
virtual void «attribute.stubRemoteEventClassChangedMethodName»() = 0;
«ENDIF»
-
«ENDFOR»
};
-
/**
* Defines the interface that must be implemented by any class that should provide
* the service «fInterface.elementName» to remote clients.
* This class and the one above are the ones an application developer needs to have
* a look at if he wants to implement a service.
*/
- class «fInterface.stubClassName»: public virtual «fInterface.stubCommonAPIClassName»«IF fInterface.base != null», public virtual «fInterface.base.stubClassName»«ENDIF» {
+ class «fInterface.stubClassName»
+ : public virtual «fInterface.stubCommonAPIClassName»«IF fInterface.base != null»,
+ public virtual «fInterface.base.getTypeCollectionName(fInterface)»Stub«ENDIF»
+ {
public:
- virtual ~«fInterface.stubClassName»() { }
+ «FOR method: fInterface.methods»
+ «IF !method.isFireAndForget»
+ typedef std::function<void («method.generateStubReplySignature()»)> «method.elementName»Reply_t;
+ «ENDIF»
+ «ENDFOR»
+
+ virtual ~«fInterface.stubClassName»() {}
virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
«FOR attribute : fInterface.attributes»
«FTypeGenerator::generateComments(attribute, false)»
/// Provides getter access to the attribute «attribute.elementName»
- virtual const «attribute.getTypeName(fInterface.model)»& «attribute.stubClassGetMethodName»(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
+ virtual const «attribute.getTypeName(fInterface, true)» &«attribute.stubClassGetMethodName»(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
«ENDFOR»
«FOR method: fInterface.methods»
@@ -163,7 +186,7 @@ class FInterfaceStubGenerator {
«ENDFOR»
«FOR broadcast : fInterface.broadcasts»
«FTypeGenerator::generateComments(broadcast, false)»
- «IF !broadcast.selective.nullOrEmpty»
+ «IF broadcast.selective»
/**
* Sends a selective broadcast event for «broadcast.elementName» to the given ClientIds.
* The ClientIds must all be out of the set of subscribed clients.
@@ -173,12 +196,12 @@ class FInterfaceStubGenerator {
/// retreives the list of all subscribed clients for «broadcast.elementName»
virtual std::shared_ptr<CommonAPI::ClientIdList> const «broadcast.stubAdapterClassSubscribersMethodName»() = 0;
/// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts.
- virtual void «broadcast.subscriptionChangedMethodName»(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event) = 0;
+ virtual void «broadcast.subscriptionChangedMethodName»(const std::shared_ptr<CommonAPI::ClientId> _client, const CommonAPI::SelectiveBroadcastSubscriptionEvent _event) = 0;
/// Hook method for reacting accepting or denying new subscriptions
- virtual bool «broadcast.subscriptionRequestedMethodName»(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
+ virtual bool «broadcast.subscriptionRequestedMethodName»(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
«ELSE»
/// Sends a broadcast event for «broadcast.elementName».
- virtual void «broadcast.stubAdapterClassFireEventMethodName»(«broadcast.outArgs.map['const ' + getTypeName(fInterface.model) + '& ' + elementName].join(', ')») = 0;
+ virtual void «broadcast.stubAdapterClassFireEventMethodName»(«broadcast.outArgs.map['const ' + getTypeName(fInterface, true) + ' &_' + elementName].join(', ')») = 0;
«ENDIF»
«ENDFOR»
@@ -195,15 +218,16 @@ class FInterfaceStubGenerator {
};
«fInterface.model.generateNamespaceEndDeclaration»
+ «fInterface.generateVersionNamespaceEnd»
- #endif // «fInterface.defineName»_STUB_H_
+ #endif // «fInterface.defineName»_STUB_HPP_
'''
def private generateStubDefaultHeader(FInterface fInterface, IResource modelid) '''
«generateCommonApiLicenseHeader(fInterface, modelid)»
«FTypeGenerator::generateComments(fInterface, false)»
- #ifndef «fInterface.defineName»_STUB_DEFAULT_H_
- #define «fInterface.defineName»_STUB_DEFAULT_H_
+ #ifndef «getHeaderDefineName(fInterface)»_HPP_
+ #define «getHeaderDefineName(fInterface)»_HPP_
«IF fInterface.base != null»
#include <«fInterface.base.stubDefaultHeaderPath»>
@@ -212,6 +236,7 @@ class FInterfaceStubGenerator {
#include <«fInterface.stubHeaderPath»>
#include <sstream>
+ «fInterface.generateVersionNamespaceBegin»
«fInterface.model.generateNamespaceBeginDeclaration»
/**
@@ -224,41 +249,42 @@ class FInterfaceStubGenerator {
* that would be defined for this service, and/or if you do not need any non-default
* behaviour.
*/
- class «fInterface.stubDefaultClassName» : public virtual «fInterface.stubClassName»«IF fInterface.base != null», public virtual «fInterface.base.stubDefaultClassName»«ENDIF» {
+ class «fInterface.stubDefaultClassName»
+ : public virtual «fInterface.stubClassName»«IF fInterface.base != null»,
+ public virtual «fInterface.base.getTypeCollectionName(fInterface)»StubDefault«ENDIF» {
public:
«fInterface.stubDefaultClassName»();
- «fInterface.stubRemoteEventClassName»* initStubAdapter(const std::shared_ptr<«fInterface.stubAdapterClassName»>& stubAdapter);
+ «fInterface.stubRemoteEventClassName»* initStubAdapter(const std::shared_ptr<«fInterface.stubAdapterClassName»> &_adapter);
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId);
+ const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
«FOR attribute : fInterface.attributes»
- virtual const «attribute.getTypeName(fInterface.model)»& «attribute.stubClassGetMethodName»();
- virtual const «attribute.getTypeName(fInterface.model)»& «attribute.stubClassGetMethodName»(const std::shared_ptr<CommonAPI::ClientId> clientId);
- virtual void «attribute.stubDefaultClassSetMethodName»(«attribute.getTypeName(fInterface.model)» value);
+ «val typeName = attribute.getTypeName(fInterface, true)»
+ virtual const «typeName»& «attribute.stubClassGetMethodName»();
+ virtual const «typeName»& «attribute.stubClassGetMethodName»(const std::shared_ptr<CommonAPI::ClientId> _client);
+ virtual void «attribute.stubDefaultClassSetMethodName»(«typeName» _value);
«IF !attribute.readonly»
- virtual void «attribute.stubDefaultClassSetMethodName»(const std::shared_ptr<CommonAPI::ClientId> clientId, «attribute.getTypeName(fInterface.model)» value);
+ virtual void «attribute.stubDefaultClassSetMethodName»(const std::shared_ptr<CommonAPI::ClientId> _client, «typeName» _value);
«ENDIF»
«ENDFOR»
«FOR method: fInterface.methods»
«FTypeGenerator::generateComments(method, false)»
virtual void «method.elementName»(«method.generateStubSignature»);
- virtual void «method.elementName»(«method.generateStubSignatureOldStyle»);
-
«ENDFOR»
- «FOR broadcast : fInterface.broadcasts»
+ «FOR broadcast : fInterface.broadcasts»
«FTypeGenerator::generateComments(broadcast, false)»
- «IF !broadcast.selective.nullOrEmpty»
+ «IF broadcast.selective»
virtual void «broadcast.stubAdapterClassFireSelectiveMethodName»(«generateSendSelectiveSignatur(broadcast, fInterface, true)»);
virtual std::shared_ptr<CommonAPI::ClientIdList> const «broadcast.stubAdapterClassSubscribersMethodName»();
/// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts.
- virtual void «broadcast.subscriptionChangedMethodName»(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event);
+ virtual void «broadcast.subscriptionChangedMethodName»(const std::shared_ptr<CommonAPI::ClientId> _client, const CommonAPI::SelectiveBroadcastSubscriptionEvent _event);
/// Hook method for reacting accepting or denying new subscriptions
- virtual bool «broadcast.subscriptionRequestedMethodName»(const std::shared_ptr<CommonAPI::ClientId> clientId);
+ virtual bool «broadcast.subscriptionRequestedMethodName»(const std::shared_ptr<CommonAPI::ClientId> _client);
«ELSE»
- virtual void «broadcast.stubAdapterClassFireEventMethodName»(«broadcast.outArgs.map['const ' + getTypeName(fInterface.model) + '& ' + elementName].join(', ')»);
+ virtual void «broadcast.stubAdapterClassFireEventMethodName»(«broadcast.outArgs.map['const ' + getTypeName(fInterface, true) + ' &_' + elementName].join(', ')»);
«ENDIF»
«ENDFOR»
@@ -271,29 +297,31 @@ class FInterfaceStubGenerator {
protected:
«FOR attribute : fInterface.attributes»
+ «val typeName = attribute.getTypeName(fInterface, true)»
«FTypeGenerator::generateComments(attribute, false)»
- virtual bool «attribute.stubDefaultClassTrySetMethodName»(«attribute.getTypeName(fInterface.model)» value);
- virtual bool «attribute.stubDefaultClassValidateMethodName»(const «attribute.getTypeName(fInterface.model)»& value);
+ virtual bool «attribute.stubDefaultClassTrySetMethodName»(«typeName» _value);
+ virtual bool «attribute.stubDefaultClassValidateMethodName»(const «typeName» &_value);
«IF !attribute.readonly»
virtual void «attribute.stubRemoteEventClassChangedMethodName»();
«ENDIF»
«ENDFOR»
class RemoteEventHandler: public virtual «fInterface.stubRemoteEventClassName»«IF fInterface.base != null», public virtual «fInterface.base.stubDefaultClassName»::RemoteEventHandler«ENDIF» {
- public:
- RemoteEventHandler(«fInterface.stubDefaultClassName»* defaultStub);
+ public:
+ RemoteEventHandler(«fInterface.stubDefaultClassName» *_defaultStub);
«FOR attribute : fInterface.attributes»
+ «val typeName = attribute.getTypeName(fInterface, true)»
«FTypeGenerator::generateComments(attribute, false)»
«IF !attribute.readonly»
- virtual bool «attribute.stubRemoteEventClassSetMethodName»(«attribute.getTypeName(fInterface.model)» value);
- virtual bool «attribute.stubRemoteEventClassSetMethodName»(const std::shared_ptr<CommonAPI::ClientId> clientId, «attribute.getTypeName(fInterface.model)» value);
+ virtual bool «attribute.stubRemoteEventClassSetMethodName»(«typeName» _value);
+ virtual bool «attribute.stubRemoteEventClassSetMethodName»(const std::shared_ptr<CommonAPI::ClientId> _client, «typeName» _value);
virtual void «attribute.stubRemoteEventClassChangedMethodName»();
«ENDIF»
«ENDFOR»
- private:
- «fInterface.stubDefaultClassName»* defaultStub_;
+ private:
+ «fInterface.stubDefaultClassName» *defaultStub_;
};
private:
«fInterface.stubDefaultClassName»::RemoteEventHandler remoteEventHandler_;
@@ -303,23 +331,26 @@ class FInterfaceStubGenerator {
«FOR attribute : fInterface.attributes»
«FTypeGenerator::generateComments(attribute, false)»
- «attribute.getTypeName(fInterface.model)» «attribute.stubDefaultClassVariableName»;
+ «attribute.getTypeName(fInterface, true)» «attribute.stubDefaultClassVariableName»;
«ENDFOR»
CommonAPI::Version interfaceVersion_;
};
«fInterface.model.generateNamespaceEndDeclaration»
+ «fInterface.generateVersionNamespaceEnd»
- #endif // «fInterface.defineName»_STUB_DEFAULT_H_
+ #endif // «getHeaderDefineName(fInterface)»
'''
def private generateStubDefaultSource(FInterface fInterface, IResource modelid) '''
«generateCommonApiLicenseHeader(fInterface, modelid)»
#include <«fInterface.stubDefaultHeaderPath»>
+ #include <assert.h>
+ «fInterface.generateVersionNamespaceBegin»
«fInterface.model.generateNamespaceBeginDeclaration»
-
+
«fInterface.stubDefaultClassName»::«fInterface.stubDefaultClassName»():
remoteEventHandler_(this),
«IF !fInterface.managedInterfaces.empty»
@@ -328,27 +359,28 @@ class FInterfaceStubGenerator {
interfaceVersion_(«fInterface.elementName»::getInterfaceVersion()) {
}
- const CommonAPI::Version& «fInterface.stubDefaultClassName»::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) {
+ const CommonAPI::Version& «fInterface.stubDefaultClassName»::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
return interfaceVersion_;
}
- «fInterface.stubRemoteEventClassName»* «fInterface.stubDefaultClassName»::initStubAdapter(const std::shared_ptr<«fInterface.stubAdapterClassName»>& stubAdapter) {
- «IF fInterface.base != null»«fInterface.base.stubDefaultClassName»::initStubAdapter(stubAdapter);«ENDIF»
- «fInterface.stubCommonAPIClassName»::stubAdapter_ = stubAdapter;
+ «fInterface.stubRemoteEventClassName»* «fInterface.stubDefaultClassName»::initStubAdapter(const std::shared_ptr<«fInterface.stubAdapterClassName»> &_adapter) {
+ «IF fInterface.base != null»«fInterface.base.stubDefaultClassName»::initStubAdapter(_adapter);«ENDIF»
+ «fInterface.stubCommonAPIClassName»::stubAdapter_ = _adapter;
return &remoteEventHandler_;
}
«FOR attribute : fInterface.attributes»
- const «attribute.getTypeName(fInterface.model)»& «fInterface.stubDefaultClassName»::«attribute.stubClassGetMethodName»() {
+ «val typeName = attribute.getTypeName(fInterface, true)»
+ const «typeName»& «fInterface.stubDefaultClassName»::«attribute.stubClassGetMethodName»() {
return «attribute.stubDefaultClassVariableName»;
}
- const «attribute.getTypeName(fInterface.model)»& «fInterface.stubDefaultClassName»::«attribute.stubClassGetMethodName»(const std::shared_ptr<CommonAPI::ClientId> clientId) {
+ const «typeName»& «fInterface.stubDefaultClassName»::«attribute.stubClassGetMethodName»(const std::shared_ptr<CommonAPI::ClientId> _client) {
return «attribute.stubClassGetMethodName»();
}
- void «fInterface.stubDefaultClassName»::«attribute.stubDefaultClassSetMethodName»(«attribute.getTypeName(fInterface.model)» value) {
- «IF attribute.isObservable»const bool valueChanged = «ENDIF»«attribute.stubDefaultClassTrySetMethodName»(std::move(value));
+ void «fInterface.stubDefaultClassName»::«attribute.stubDefaultClassSetMethodName»(«typeName» _value) {
+ «IF attribute.isObservable»const bool valueChanged = «ENDIF»«attribute.stubDefaultClassTrySetMethodName»(std::move(_value));
«IF attribute.isObservable»
if (valueChanged && stubAdapter_ != NULL) {
«IF fInterface.base != null»CommonAPI::Stub<«fInterface.stubAdapterClassName», «fInterface.stubRemoteEventClassName»>::«ENDIF»stubAdapter_->«attribute.stubAdapterClassFireChangedMethodName»(«attribute.stubDefaultClassVariableName»);
@@ -356,22 +388,22 @@ class FInterfaceStubGenerator {
«ENDIF»
}
- bool «fInterface.stubDefaultClassName»::«attribute.stubDefaultClassTrySetMethodName»(«attribute.getTypeName(fInterface.model)» value) {
- if (!«attribute.stubDefaultClassValidateMethodName»(value))
+ bool «fInterface.stubDefaultClassName»::«attribute.stubDefaultClassTrySetMethodName»(«typeName» _value) {
+ if (!«attribute.stubDefaultClassValidateMethodName»(_value))
return false;
- const bool valueChanged = («attribute.stubDefaultClassVariableName» != value);
- «attribute.stubDefaultClassVariableName» = std::move(value);
+ const bool valueChanged = («attribute.stubDefaultClassVariableName» != _value);
+ «attribute.stubDefaultClassVariableName» = std::move(_value);
return valueChanged;
}
- bool «fInterface.stubDefaultClassName»::«attribute.stubDefaultClassValidateMethodName»(const «attribute.getTypeName(fInterface.model)»& value) {
+ bool «fInterface.stubDefaultClassName»::«attribute.stubDefaultClassValidateMethodName»(const «typeName» &_value) {
return true;
}
«IF !attribute.readonly»
- void «fInterface.stubDefaultClassName»::«attribute.stubDefaultClassSetMethodName»(const std::shared_ptr<CommonAPI::ClientId> clientId, «attribute.getTypeName(fInterface.model)» value) {
- «attribute.stubDefaultClassSetMethodName»(value);
+ void «fInterface.stubDefaultClassName»::«attribute.stubDefaultClassSetMethodName»(const std::shared_ptr<CommonAPI::ClientId> _client, «typeName» _value) {
+ «attribute.stubDefaultClassSetMethodName»(_value);
}
void «fInterface.stubDefaultClassName»::«attribute.stubRemoteEventClassChangedMethodName»() {
@@ -379,15 +411,17 @@ class FInterfaceStubGenerator {
}
void «fInterface.stubDefaultClassName»::RemoteEventHandler::«attribute.stubRemoteEventClassChangedMethodName»() {
+ assert(defaultStub_ !=NULL);
defaultStub_->«attribute.stubRemoteEventClassChangedMethodName»();
}
- bool «fInterface.stubDefaultClassName»::RemoteEventHandler::«attribute.stubRemoteEventClassSetMethodName»(«attribute.getTypeName(fInterface.model)» value) {
- return defaultStub_->«attribute.stubDefaultClassTrySetMethodName»(std::move(value));
+ bool «fInterface.stubDefaultClassName»::RemoteEventHandler::«attribute.stubRemoteEventClassSetMethodName»(«typeName» _value) {
+ assert(defaultStub_ !=NULL);
+ return defaultStub_->«attribute.stubDefaultClassTrySetMethodName»(std::move(_value));
}
- bool «fInterface.stubDefaultClassName»::RemoteEventHandler::«attribute.stubRemoteEventClassSetMethodName»(const std::shared_ptr<CommonAPI::ClientId> clientId, «attribute.getTypeName(fInterface.model)» value) {
- return «attribute.stubRemoteEventClassSetMethodName»(value);
+ bool «fInterface.stubDefaultClassName»::RemoteEventHandler::«attribute.stubRemoteEventClassSetMethodName»(const std::shared_ptr<CommonAPI::ClientId> _client, «typeName» _value) {
+ return «attribute.stubRemoteEventClassSetMethodName»(_value);
}
«ENDIF»
@@ -396,64 +430,71 @@ class FInterfaceStubGenerator {
«FOR method : fInterface.methods»
«FTypeGenerator::generateComments(method, false)»
void «fInterface.stubDefaultClassName»::«method.elementName»(«method.generateStubSignature») {
- // Call old style methods in default
- «method.elementName»(«method.generateArgumentsToStubCompatibility»);
- }
- void «fInterface.stubDefaultClassName»::«method.elementName»(«method.generateStubSignatureOldStyle») {
- // No operation in default
+ «IF !method.isFireAndForget»
+ «method.generateDummyArgumentDefinitions»
+ _reply(«method.generateDummyArgumentList»);
+ «ENDIF»
}
-
+
«ENDFOR»
«FOR broadcast : fInterface.broadcasts»
«FTypeGenerator::generateComments(broadcast, false)»
- «IF !broadcast.selective.nullOrEmpty»
+ «IF broadcast.selective»
void «fInterface.stubDefaultClassName»::«broadcast.stubAdapterClassFireSelectiveMethodName»(«generateSendSelectiveSignatur(broadcast, fInterface, false)») {
- stubAdapter_->«broadcast.stubAdapterClassSendSelectiveMethodName»(«broadcast.outArgs.map[elementName].join(', ')»«IF(!broadcast.outArgs.empty)», «ENDIF»receivers);
+ assert(stubAdapter_ !=NULL);
+ stubAdapter_->«broadcast.stubAdapterClassSendSelectiveMethodName»(«broadcast.outArgs.map["_" + elementName].join(', ')»«IF(!broadcast.outArgs.empty)», «ENDIF»_receivers);
}
- void «fInterface.stubDefaultClassName»::«broadcast.subscriptionChangedMethodName»(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event) {
+ void «fInterface.stubDefaultClassName»::«broadcast.subscriptionChangedMethodName»(const std::shared_ptr<CommonAPI::ClientId> _client, const CommonAPI::SelectiveBroadcastSubscriptionEvent _event) {
// No operation in default
}
- bool «fInterface.stubDefaultClassName»::«broadcast.subscriptionRequestedMethodName»(const std::shared_ptr<CommonAPI::ClientId> clientId) {
+ bool «fInterface.stubDefaultClassName»::«broadcast.subscriptionRequestedMethodName»(const std::shared_ptr<CommonAPI::ClientId> _client) {
// Accept in default
return true;
}
std::shared_ptr<CommonAPI::ClientIdList> const «fInterface.stubDefaultClassName»::«broadcast.stubAdapterClassSubscribersMethodName»() {
+ assert(stubAdapter_ !=NULL);
return(stubAdapter_->«broadcast.stubAdapterClassSubscribersMethodName»());
}
«ELSE»
- void «fInterface.stubDefaultClassName»::«broadcast.stubAdapterClassFireEventMethodName»(«broadcast.outArgs.map['const ' + getTypeName(fInterface.model) + '& ' + elementName].join(', ')») {
- stubAdapter_->«broadcast.stubAdapterClassFireEventMethodName»(«broadcast.outArgs.map[elementName].join(', ')»);
+ void «fInterface.stubDefaultClassName»::«broadcast.stubAdapterClassFireEventMethodName»(«broadcast.outArgs.map['const ' + getTypeName(fInterface, true) + ' &_' + elementName].join(', ')») {
+ assert(stubAdapter_ !=NULL);
+ stubAdapter_->«broadcast.stubAdapterClassFireEventMethodName»(«broadcast.outArgs.map["_" + elementName].join(', ')»);
}
«ENDIF»
«ENDFOR»
«FOR managed : fInterface.managedInterfaces»
- bool «fInterface.stubDefaultClassName»::«managed.stubRegisterManagedAutoName»(std::shared_ptr<«managed.stubClassName»> stub) {
+ bool «fInterface.stubDefaultClassName»::«managed.stubRegisterManagedAutoName»(std::shared_ptr<«managed.stubClassName»> _stub) {
autoInstanceCounter_++;
std::stringstream ss;
- ss << stubAdapter_->getInstanceId() << ".i" << autoInstanceCounter_;
+ ss << stubAdapter_->getAddress().getInstance() << ".i" << autoInstanceCounter_;
std::string instance = ss.str();
- return stubAdapter_->«managed.stubRegisterManagedName»(stub, instance);
+ assert(stubAdapter_ !=NULL);
+ return stubAdapter_->«managed.stubRegisterManagedName»(_stub, instance);
}
bool «fInterface.stubDefaultClassName»::«managed.stubRegisterManagedMethodImpl» {
- return stubAdapter_->«managed.stubRegisterManagedName»(stub, instance);
+ assert(stubAdapter_ !=NULL);
+ return stubAdapter_->«managed.stubRegisterManagedName»(_stub, _instance);
}
- bool «fInterface.stubDefaultClassName»::«managed.stubDeregisterManagedName»(const std::string& instance) {
- return stubAdapter_->«managed.stubDeregisterManagedName»(instance);
+ bool «fInterface.stubDefaultClassName»::«managed.stubDeregisterManagedName»(const std::string &_instance) {
+ assert(stubAdapter_ !=NULL);
+ return stubAdapter_->«managed.stubDeregisterManagedName»(_instance);
}
std::set<std::string>& «fInterface.stubDefaultClassName»::«managed.stubManagedSetGetterName»() {
+ assert(stubAdapter_ !=NULL);
return stubAdapter_->«managed.stubManagedSetGetterName»();
}
«ENDFOR»
- «fInterface.stubDefaultClassName»::RemoteEventHandler::RemoteEventHandler(«fInterface.stubDefaultClassName»* defaultStub):
- «IF fInterface.base != null»«fInterface.base.stubDefaultClassName»::RemoteEventHandler(defaultStub),«ENDIF»
- defaultStub_(defaultStub) {
+ «fInterface.stubDefaultClassName»::RemoteEventHandler::RemoteEventHandler(«fInterface.stubDefaultClassName» *_defaultStub)
+ : «fInterface.generateBaseRemoteHandlerConstructorsCalls»
+ defaultStub_(_defaultStub) {
}
«fInterface.model.generateNamespaceEndDeclaration»
+ «fInterface.generateVersionNamespaceEnd»
'''
def private getStubDefaultClassSetMethodName(FAttribute fAttribute) {
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeCollectionGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeCollectionGenerator.xtend
index af7f286..a0ac91d 100644
--- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeCollectionGenerator.xtend
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeCollectionGenerator.xtend
@@ -6,14 +6,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.genivi.commonapi.core.generator
+import java.util.Collection
+import java.util.HashSet
import javax.inject.Inject
+import org.eclipse.core.resources.IResource
import org.eclipse.xtext.generator.IFileSystemAccess
import org.franca.core.franca.FStructType
import org.franca.core.franca.FTypeCollection
-import org.genivi.commonapi.core.deployment.DeploymentInterfacePropertyAccessor
-import java.util.HashSet
-import java.util.Collection
-import org.eclipse.core.resources.IResource
+import org.genivi.commonapi.core.deployment.PropertyAccessor
class FTypeCollectionGenerator {
@Inject private extension FTypeGenerator
@@ -22,21 +22,21 @@ class FTypeCollectionGenerator {
def generate(FTypeCollection fTypeCollection,
IFileSystemAccess fileSystemAccess,
- DeploymentInterfacePropertyAccessor deploymentAccessor,
+ PropertyAccessor deploymentAccessor,
IResource modelid) {
- fileSystemAccess.generateFile(fTypeCollection.headerPath, fTypeCollection.generateHeader(deploymentAccessor, modelid))
+ fileSystemAccess.generateFile(fTypeCollection.headerPath, IFileSystemAccess.DEFAULT_OUTPUT, fTypeCollection.generateHeader(modelid, deploymentAccessor))
if (fTypeCollection.hasSourceFile) {
- fileSystemAccess.generateFile(fTypeCollection.sourcePath, fTypeCollection.generateSource(modelid))
+ fileSystemAccess.generateFile(fTypeCollection.sourcePath, IFileSystemAccess.DEFAULT_OUTPUT, fTypeCollection.generateSource(modelid, deploymentAccessor))
}
}
- def private generateHeader(FTypeCollection fTypeCollection, DeploymentInterfacePropertyAccessor deploymentAccessor, IResource modelid) '''
+ def private generateHeader(FTypeCollection fTypeCollection, IResource modelid, PropertyAccessor deploymentAccessor) '''
«generateCommonApiLicenseHeader(fTypeCollection, modelid)»
«FTypeGenerator::generateComments(fTypeCollection, false)»
- #ifndef «fTypeCollection.defineName»_H_
- #define «fTypeCollection.defineName»_H_
+ #ifndef «fTypeCollection.defineName»_HPP_
+ #define «fTypeCollection.defineName»_HPP_
«val libraryHeaders = new HashSet<String>»
«val generatedHeaders = new HashSet<String>»
@@ -56,9 +56,10 @@ class FTypeCollectionGenerator {
#undef COMMONAPI_INTERNAL_COMPILATION
+ «fTypeCollection.generateVersionNamespaceBegin»
«fTypeCollection.model.generateNamespaceBeginDeclaration»
- namespace «fTypeCollection.elementName» {
+ struct «fTypeCollection.elementName» {
«fTypeCollection.generateFTypeDeclarations(deploymentAccessor)»
«FOR type : fTypeCollection.types»
@@ -77,14 +78,12 @@ class FTypeCollectionGenerator {
}
«ENDIF»
- } // namespace «fTypeCollection.elementName»
+ }; // struct «fTypeCollection.elementName»
«fTypeCollection.model.generateNamespaceEndDeclaration»
+ «fTypeCollection.generateVersionNamespaceEnd»
namespace CommonAPI {
-
- «fTypeCollection.generateTypeWriters(deploymentAccessor)»
-
«fTypeCollection.generateVariantComparators»
}
@@ -93,10 +92,10 @@ class FTypeCollectionGenerator {
«fTypeCollection.generateHashers(deploymentAccessor)»
}
- #endif // «fTypeCollection.defineName»_H_
+ #endif // «fTypeCollection.defineName»_HPP_
'''
- def private generateSource(FTypeCollection fTypeCollection, IResource modelid) '''
+ def private generateSource(FTypeCollection fTypeCollection, IResource modelid, PropertyAccessor _accessor) '''
«generateCommonApiLicenseHeader(fTypeCollection, modelid)»
«FTypeGenerator::generateComments(fTypeCollection, false)»
#include "«fTypeCollection.headerFile»"
@@ -105,21 +104,20 @@ class FTypeCollectionGenerator {
#include <«fStructTypeHeaderPath»>
«ENDFOR»
+ «fTypeCollection.generateVersionNamespaceBegin»
«fTypeCollection.model.generateNamespaceBeginDeclaration»
- namespace «fTypeCollection.elementName» {
«FOR type : fTypeCollection.types»
- «/*FTypeGenerator::generateComments(type.comment, false)*/»
- «type.generateFTypeImplementation(type)»
+ «type.generateFTypeImplementation(fTypeCollection, _accessor)»
«ENDFOR»
- } // namespace «fTypeCollection.elementName»
«fTypeCollection.model.generateNamespaceEndDeclaration»
+ «fTypeCollection.generateVersionNamespaceEnd»
'''
def void getRequiredHeaderFiles(FTypeCollection fInterface, Collection<String> generatedHeaders,
Collection<String> libraryHeaders) {
- libraryHeaders.add('CommonAPI/types.h')
+ libraryHeaders.add('CommonAPI/Types.hpp')
fInterface.types.forEach[addRequiredHeaders(generatedHeaders, libraryHeaders)]
generatedHeaders.remove(fInterface.headerPath)
}
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeCommonAreaGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeCommonAreaGenerator.xtend
index 7315a05..f9fccfe 100644
--- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeCommonAreaGenerator.xtend
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeCommonAreaGenerator.xtend
@@ -15,9 +15,9 @@ import org.franca.core.franca.FModel
import org.franca.core.franca.FModelElement
import org.franca.core.franca.FType
import org.franca.core.franca.FTypeCollection
-import org.franca.core.franca.FUnionType
-import org.genivi.commonapi.core.deployment.DeploymentInterfacePropertyAccessor
import org.franca.core.franca.FTypedElement
+import org.franca.core.franca.FUnionType
+import org.genivi.commonapi.core.deployment.PropertyAccessor
class FTypeCommonAreaGenerator {
@Inject private extension FrancaGeneratorExtensions
@@ -45,14 +45,6 @@ class FTypeCommonAreaGenerator {
return fType as FUnionType
}
- def generateTypeWriters(FTypeCollection fTypes, DeploymentInterfacePropertyAccessor deploymentAccessor) '''
- «FOR type: fTypes.types»
- «IF type.isFEnumerationType»
- «generateStreamImplementation(type.getFEnumerationType, type.elementName, fTypes, fTypes.elementName, deploymentAccessor)»
- «ENDIF»
- «ENDFOR»
- '''
-
def private List<String> getNamespaceAsList(FModel fModel) {
newArrayList(fModel.name.split("\\."))
}
@@ -63,50 +55,18 @@ class FTypeCommonAreaGenerator {
return (fModelElement.eContainer as FModelElement).model
}
- def private getWithNamespace(FEnumerationType fEnumerationType, String enumerationName, FModelElement parent, String parentName) {
- parent.model.namespaceAsList.join("::") + "::" + fEnumerationType.getClassNamespaceWithName(enumerationName, parent, parentName)
- }
-
- def private generateStreamImplementation(FEnumerationType fEnumerationType, String enumerationName, FModelElement parent, String parentName, DeploymentInterfacePropertyAccessor deploymentAccessor) '''
- template<>
- struct BasicTypeWriter<«fEnumerationType.getWithNamespace(enumerationName, parent, parentName)»> {
- inline static void writeType (CommonAPI::TypeOutputStream& typeStream) {
- typeStream.write«fEnumerationType.generateTypeOutput(deploymentAccessor)»Type();
- }
- };
-
- template<>
- struct InputStreamVectorHelper<«fEnumerationType.getWithNamespace(enumerationName, parent, parentName)»> {
- static void beginReadVector(InputStream& inputStream, const std::vector<«fEnumerationType.getWithNamespace(enumerationName, parent, parentName)»>& vectorValue) {
- inputStream.beginRead«fEnumerationType.generateTypeOutput(deploymentAccessor)»Vector();
- }
- };
-
- template <>
- struct OutputStreamVectorHelper<«fEnumerationType.getWithNamespace(enumerationName, parent, parentName)»> {
- static void beginWriteVector(OutputStream& outputStream, const std::vector<«fEnumerationType.getWithNamespace(enumerationName, parent, parentName)»>& vectorValue) {
- outputStream.beginWrite«fEnumerationType.generateTypeOutput(deploymentAccessor)»Vector(vectorValue.size());
- }
- };
- '''
-
- def private generateTypeOutput(FEnumerationType fEnumerationType, DeploymentInterfacePropertyAccessor deploymentAccessor) {
- FTypeGenerator::generateComments(fEnumerationType, false)
- return fEnumerationType.getBackingType(deploymentAccessor).primitiveTypeName.split("_").get(0).toUpperCase.replace("NT", "nt") + "Enum"
- }
-
def generateVariantComparators(FTypeCollection fTypes) '''
«FOR type: fTypes.types»
«IF type.isFUnionType»
«FOR base : type.getFUnionType.baseList»
- «generateComparatorImplementation(type.getFUnionType, type.elementName, base, fTypes, fTypes.elementName)»
+ «generateComparatorImplementation(type.getFUnionType, base)»
«ENDFOR»
«ENDIF»
«ENDFOR»
'''
def private getClassNamespaceWithName(FTypedElement type, String name, FModelElement parent, String parentName) {
- var reference = type.getTypeName(parent)
+ var reference = type.getTypeName(parent, false)
if (parent != null && parent != type) {
reference = parentName + '::' + reference
}
@@ -115,23 +75,25 @@ class FTypeCommonAreaGenerator {
- def private List<String> getElementTypeNames(FUnionType fUnion, String unionName, FModelElement parent, String parentName) {
+ def private List<String> getElementTypeNames(FUnionType fUnion) {
var names = new ArrayList<String>
var rev = fUnion.elements
var iter = rev.iterator
+ val parent = (fUnion.eContainer as FTypeCollection)
+
while (iter.hasNext) {
var item = iter.next
var lName = "";
if (item.type.derived != null) {
- lName = parent.model.namespaceAsList.join("::") + "::" + item.getClassNamespaceWithName(item.elementName, parent, parentName)
+ lName = parent.model.namespaceAsList.join("::") + "::" + item.getClassNamespaceWithName(item.elementName, parent, parent.name)
} else {
- lName = item.getTypeName(fUnion)
+ lName = item.getTypeName(fUnion, false)
}
names.add(lName)
}
if (fUnion.base != null) {
- for (base : fUnion.base.getElementTypeNames(fUnion.base.elementName, parent, parentName)) {
+ for (base : fUnion.base.elementTypeNames) {
names.add(base);
}
}
@@ -146,9 +108,9 @@ class FTypeCommonAreaGenerator {
if (counter > 1) {
ret = ret + " else ";
}
- ret = ret + "if (rhs.getValueType() == " + counter + ") { \n" +
- " " + item + " a = lhs.get<" + item + ">(); \n" +
- " " + item + " b = rhs.get<" + item + ">(); \n" +
+ ret = ret + "if (_rhs.getValueType() == " + counter + ") { \n" +
+ " " + item + " a = _lhs.get<" + item + ">(); \n" +
+ " " + item + " b = _rhs.get<" + item + ">(); \n" +
" " + "return (a == b); \n" +
"}"
counter = counter + 1;
@@ -156,33 +118,38 @@ class FTypeCommonAreaGenerator {
return ret
}
- def private generateComparatorImplementation(FUnionType fUnionType, String unionName, FUnionType base, FModelElement parent, String parentName) '''
+ def private generateComparatorImplementation(FUnionType _derived, FUnionType _base) '''
+ «val unionTypeName = _derived.getElementName(null, true)»
+ «val unionBaseTypeName = _base.getElementName(null, true)»
+ «val unionTypeContainerName = (_derived.eContainer as FTypeCollection).getTypeCollectionName(null)»
+ «val unionBaseTypeContainerName = (_base.eContainer as FTypeCollection).getTypeCollectionName(null)»
+
inline bool operator==(
- const «parent.model.namespaceAsList.join("::") + "::" + fUnionType.getClassNamespaceWithName(unionName, parent, parentName)»& lhs,
- const «parent.model.namespaceAsList.join("::") + "::" + base.getClassNamespaceWithName(base.elementName, parent, parentName)»& rhs) {
- if (lhs.getValueType() == rhs.getValueType()) {
- «var list = base.getElementTypeNames(unionName, parent, parentName)»
+ const «unionTypeContainerName»::«unionTypeName» &_lhs,
+ const «unionBaseTypeContainerName»::«unionBaseTypeName» &_rhs) {
+ if (_lhs.getValueType() == _rhs.getValueType()) {
+ «var list = _base.elementTypeNames»
«list.generateVariantComnparatorIf»
}
return false;
}
inline bool operator==(
- const «parent.model.namespaceAsList.join("::") + "::" + base.getClassNamespaceWithName(base.elementName, parent, parentName)»& lhs,
- const «parent.model.namespaceAsList.join("::") + "::" + fUnionType.getClassNamespaceWithName(unionName, parent, parentName)»& rhs) {
- return rhs == lhs;
+ const «unionBaseTypeContainerName»::«unionBaseTypeName» &_lhs,
+ const «unionTypeContainerName»::«unionTypeName» &_rhs) {
+ return _rhs == _lhs;
}
inline bool operator!=(
- const «parent.model.namespaceAsList.join("::") + "::" + fUnionType.getClassNamespaceWithName(unionName, parent, parentName)»& lhs,
- const «parent.model.namespaceAsList.join("::") + "::" + base.getClassNamespaceWithName(base.elementName, parent, parentName)»& rhs) {
- return lhs != rhs;
+ const «unionTypeContainerName»::«unionTypeName» &_lhs,
+ const «unionBaseTypeContainerName»::«unionBaseTypeName» &_rhs) {
+ return !(_lhs == _rhs);
}
inline bool operator!=(
- const «parent.model.namespaceAsList.join("::") + "::" + base.getClassNamespaceWithName(base.elementName, parent, parentName)»& lhs,
- const «parent.model.namespaceAsList.join("::") + "::" + fUnionType.getClassNamespaceWithName(unionName, parent, parentName)»& rhs) {
- return lhs != rhs;
+ const «unionBaseTypeContainerName»::«unionBaseTypeName» &_lhs,
+ const «unionTypeContainerName»::«unionTypeName» &_rhs) {
+ return !(_rhs == _lhs);
}
'''
@@ -198,11 +165,11 @@ class FTypeCommonAreaGenerator {
return baseList
}
- def getFQN(FType type, FTypeCollection fTypes) '''«fTypes.model.namespaceAsList.join("::")»::«type.getClassNamespaceWithName(type.elementName, fTypes, fTypes.elementName)»'''
+ def getFQN(FType type, FTypeCollection fTypes) '''«fTypes.versionPrefix»«fTypes.model.namespaceAsList.join("::")»::«type.getClassNamespaceWithName(type.elementName, fTypes, fTypes.elementName)»'''
- def getFQN(FType type, String name, FTypeCollection fTypes) '''«fTypes.model.namespaceAsList.join("::")»::«type.getClassNamespaceWithName(name, fTypes, fTypes.elementName)»'''
+ def getFQN(FType type, String name, FTypeCollection fTypes) '''«fTypes.versionPrefix»«fTypes.model.namespaceAsList.join("::")»::«type.getClassNamespaceWithName(name, fTypes, fTypes.elementName)»'''
- def generateHash (FType type, String name, FTypeCollection fTypes, DeploymentInterfacePropertyAccessor deploymentAccessor) '''
+ def generateHash (FType type, String name, FTypeCollection fTypes, PropertyAccessor deploymentAccessor) '''
//Hash for «name»
template<>
struct hash<«type.getFQN(name, fTypes)»> {
@@ -212,7 +179,7 @@ class FTypeCommonAreaGenerator {
};
'''
- def generateHash (FType type, FTypeCollection fTypes, DeploymentInterfacePropertyAccessor deploymentAccessor) '''
+ def generateHash (FType type, FTypeCollection fTypes, PropertyAccessor deploymentAccessor) '''
//Hash for «type.elementName»
template<>
struct hash<«type.getFQN(fTypes)»> {
@@ -222,7 +189,7 @@ class FTypeCommonAreaGenerator {
};
'''
- def generateHashers(FTypeCollection fTypes, DeploymentInterfacePropertyAccessor deploymentAccessor) '''
+ def generateHashers(FTypeCollection fTypes, PropertyAccessor deploymentAccessor) '''
«FOR type: fTypes.types»
«IF type.isFEnumerationType»
«type.generateHash(fTypes, deploymentAccessor)»
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeGenerator.xtend
index a7b1146..8a70e41 100644
--- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeGenerator.xtend
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeGenerator.xtend
@@ -6,11 +6,15 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.genivi.commonapi.core.generator
+import java.util.ArrayList
import java.util.Collection
import java.util.LinkedList
import java.util.List
import javax.inject.Inject
import org.eclipse.emf.common.util.EList
+import org.franca.core.franca.FAnnotation
+import org.franca.core.franca.FAnnotationBlock
+import org.franca.core.franca.FAnnotationType
import org.franca.core.franca.FArrayType
import org.franca.core.franca.FBasicTypeId
import org.franca.core.franca.FEnumerationType
@@ -18,6 +22,7 @@ import org.franca.core.franca.FEnumerator
import org.franca.core.franca.FField
import org.franca.core.franca.FInterface
import org.franca.core.franca.FMapType
+import org.franca.core.franca.FMethod
import org.franca.core.franca.FModelElement
import org.franca.core.franca.FStructType
import org.franca.core.franca.FType
@@ -25,18 +30,15 @@ import org.franca.core.franca.FTypeCollection
import org.franca.core.franca.FTypeDef
import org.franca.core.franca.FTypeRef
import org.franca.core.franca.FUnionType
-import org.genivi.commonapi.core.deployment.DeploymentInterfacePropertyAccessor
+import org.genivi.commonapi.core.deployment.PropertyAccessor
import static com.google.common.base.Preconditions.*
-import org.franca.core.franca.FAnnotationType
-import org.franca.core.franca.FAnnotationBlock
-import org.franca.core.franca.FMethod
-import java.util.ArrayList
-import org.franca.core.franca.FAnnotation
+
+import static extension org.genivi.commonapi.core.generator.FrancaGeneratorExtensions.*
class FTypeGenerator {
@Inject private extension FrancaGeneratorExtensions francaGeneratorExtensions
- static int begrenzung = 80
+ static final int CommentLineLength = 80
def static isdeprecated(FAnnotationBlock annotations) {
if(annotations == null)
@@ -48,6 +50,7 @@ class FTypeGenerator {
return false
}
+ // TODO: is this code needed ?
def static sortAnnotations(FAnnotationBlock annots) {
var ArrayList<ArrayList<FAnnotation>> ret = new ArrayList<ArrayList<FAnnotation>>(4)
ret.add(new ArrayList<FAnnotation>())
@@ -71,26 +74,42 @@ class FTypeGenerator {
}
def private static findNextBreak(String text) {
- var breakIndex = text.substring(0, begrenzung).lastIndexOf(" ");
- if (breakIndex > 0) {
+ var breakIndex = text.substring(0, CommentLineLength).lastIndexOf(" ");
+ if (breakIndex > -1) {
return breakIndex;
} else {
- breakIndex = text.substring(0, begrenzung).lastIndexOf("\n");
- if (breakIndex > -1) {
- return breakIndex;
- } else {
- return java.lang.Math.min(begrenzung, text.length);
- }
+ return Math.min(CommentLineLength, text.length);
}
}
- def static breaktext(String text, int annotation) {
+ def static breaktext(String text, FAnnotationType annotation) {
+ var commentBody = ""
+ var line = ""
+ var startIndex = 0
+ var endIndex = CommentLineLength
+ var commentText = text.replace("\r\n", " ")
+
+ commentBody += " * " + annotation.getName() + ": "
+ while(endIndex < commentText.length) {
+ line = commentText.substring(startIndex, endIndex)
+ endIndex = findNextBreak(line)
+ commentBody += commentText.substring(startIndex, startIndex + endIndex) + "\n * ";
+ startIndex += endIndex
+ endIndex = startIndex + CommentLineLength
+ }
+ commentBody += commentText.substring(startIndex, commentText.length) + "\n";
+ return commentBody;
+ }
+
+ // TODO: Does this code offer additional functionality compared to breaktext ?
+ def static breaktext_(String text, int annotation) {
var ret = ""
- var temptext = ""
- if(annotation == FAnnotationType::DESCRIPTION_VALUE && text.length > begrenzung) {
+ var temptext = ""
+
+ if(annotation == FAnnotationType::DESCRIPTION_VALUE && text.length > CommentLineLength) {
ret = " * " + text.substring(0, findNextBreak(text)) + "\n";
temptext = text.substring(findNextBreak(text));
- }else if(annotation != FAnnotationType::DESCRIPTION_VALUE && text.length > begrenzung) {
+ }else if(annotation != FAnnotationType::DESCRIPTION_VALUE && text.length > CommentLineLength) {
if(annotation == FAnnotationType::AUTHOR_VALUE) {
ret = " * @author "
}if(annotation == FAnnotationType::DEPRECATED_VALUE){
@@ -111,8 +130,8 @@ class FTypeGenerator {
ret = " * "
ret = ret + text + "\n";
}
- while(temptext.length > begrenzung) {
- try {
+ while(temptext.length > CommentLineLength) {
+ try {
ret = ret + " * " + temptext.substring(0, findNextBreak(temptext)) + "\n";
temptext = temptext.substring(findNextBreak(temptext));
}
@@ -127,6 +146,26 @@ class FTypeGenerator {
}
def static generateComments(FModelElement model, boolean inline) {
+ var intro = ""
+ var tail = ""
+ var annoCommentText = ""
+ if( model != null && model.comment != null){
+ if(!inline) {
+ intro = "/**\n"
+ tail = " */"
+ }
+ for(annoComment : model.comment.elements) {
+ if(annoComment != null){
+ annoCommentText += breaktext(annoComment.comment, annoComment.type)
+ }
+ }
+ return intro + annoCommentText + tail
+ }
+ return ""
+ }
+
+ // TODO: Does this code offer additional functionality compared to generateComments ?
+ def static generateComments_(FModelElement model, boolean inline) {
var typ = getTyp(model)
var ret = ""
var commexists = false
@@ -140,7 +179,7 @@ class FTypeGenerator {
if(!inline && !commexists)
ret = "/**\n"
commexists = true
- ret = ret + breaktext(comment.comment, comment.type.value)
+ ret = ret + breaktext(comment.comment, comment.type)
}
}
}
@@ -162,15 +201,15 @@ class FTypeGenerator {
return ModelTyp::UNKNOWN
}
- def generateFTypeDeclarations(FTypeCollection fTypeCollection, DeploymentInterfacePropertyAccessor deploymentAccessor) '''
+ def generateFTypeDeclarations(FTypeCollection fTypeCollection, PropertyAccessor deploymentAccessor) '''
«FOR type: fTypeCollection.types.sortTypes(fTypeCollection)»
«generateComments(type, false)»
«type.generateFTypeDeclaration(deploymentAccessor)»
«ENDFOR»
«IF fTypeCollection instanceof FInterface»
- «FOR method : (fTypeCollection as FInterface).methods.filter[errors != null]»
+ «FOR method : (fTypeCollection as FInterface).methodsWithError»
«generateComments(method, false)»
- «method.errors.generateDeclaration(method.errors.errorName, deploymentAccessor)»
+ «method.errors.generateDeclaration(method.errors, deploymentAccessor)»
«ENDFOR»
«ENDIF»
'''
@@ -203,84 +242,230 @@ class FTypeGenerator {
return references
}
- def dispatch generateFTypeDeclaration(FTypeDef fTypeDef, DeploymentInterfacePropertyAccessor deploymentAccessor) '''
+ def dispatch generateFTypeDeclaration(FTypeDef fTypeDef, PropertyAccessor deploymentAccessor) '''
«generateComments(fTypeDef, false)»
- typedef «fTypeDef.actualType.getNameReference(fTypeDef.eContainer)» «fTypeDef.elementName»;
+ typedef «fTypeDef.actualType.getElementType(null, true)» «fTypeDef.elementName»;
'''
- def dispatch generateFTypeDeclaration(FArrayType fArrayType, DeploymentInterfacePropertyAccessor deploymentAccessor) '''
+ def dispatch generateFTypeDeclaration(FArrayType fArrayType, PropertyAccessor deploymentAccessor) '''
«generateComments(fArrayType, false)»
«IF fArrayType.elementType.derived != null && fArrayType.elementType.derived instanceof FStructType && (fArrayType.elementType.derived as FStructType).polymorphic»
- typedef std::vector<std::shared_ptr<«fArrayType.elementType.getNameReference(fArrayType.eContainer)»>> «fArrayType.elementName»;
+ typedef std::vector<std::shared_ptr<«fArrayType.elementType.getElementType(null, true)»>> «fArrayType.elementName»;
«ELSE»
- typedef std::vector<«fArrayType.elementType.getNameReference(fArrayType.eContainer)»> «fArrayType.elementName»;
+ typedef std::vector<«fArrayType.elementType.getElementType(null, true)»> «fArrayType.elementName»;
«ENDIF»
'''
- def dispatch generateFTypeDeclaration(FMapType fMap, DeploymentInterfacePropertyAccessor deploymentAccessor) '''
+ def dispatch generateFTypeDeclaration(FMapType fMap, PropertyAccessor deploymentAccessor) '''
«generateComments(fMap, false)»
typedef std::unordered_map<«fMap.generateKeyType», «fMap.generateValueType»«fMap.generateHasher»> «fMap.elementName»;
'''
- def dispatch generateFTypeDeclaration(FStructType fStructType, DeploymentInterfacePropertyAccessor deploymentAccessor) '''
- «generateComments(fStructType, false)»
- struct «fStructType.elementName»: «fStructType.baseStructName» {
- «FOR element : fStructType.elements»
- «generateComments(element, false)»
- «element.getTypeName(fStructType)» «element.elementName»;
- «ENDFOR»
-
- «fStructType.elementName»() = default;
- «IF fStructType.allElements.size > 0»
- «fStructType.elementName»(«fStructType.allElements.map[getConstReferenceVariable(fStructType)].join(", ")»);
- «ENDIF»
-
- «IF fStructType.hasPolymorphicBase»
- enum: uint32_t { SERIAL_ID = 0x«Integer::toHexString(fStructType.serialId)» };
-
- static «fStructType.elementName»* createInstance(const uint32_t& serialId);
-
- virtual uint32_t getSerialId() const;
- virtual void createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const;
- «ENDIF»
-
- virtual void readFromInputStream(CommonAPI::InputStream& inputStream);
- virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const;
-
- static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
- «IF fStructType.base != null»
- «fStructType.baseStructName»::writeToTypeOutputStream(typeOutputStream);
- «ENDIF»
- «FOR element : fStructType.elements»
- «element.type.typeStreamSignature(deploymentAccessor, element)»
- «ENDFOR»
- }
- };
+ def dispatch generateFTypeDeclaration(FStructType fStructType, PropertyAccessor deploymentAccessor) '''
+ «generateComments(fStructType, false)»
+ «IF fStructType.polymorphic»
+ «fStructType.createSerials()»
+
+ «ENDIF»
+ «IF fStructType.hasPolymorphicBase()»
+ «IF fStructType.base == null»
+ struct «fStructType.elementName» : CommonAPI::PolymorphicStruct {
+ «ELSE»
+ struct «fStructType.elementName» : «fStructType.base.getElementName(fStructType, false)» {
+ «ENDIF»
+ «ELSE»
+ struct «fStructType.elementName» : CommonAPI::Struct<«fStructType.allElements.map[getTypeName(fStructType, false)].join(", ")»> {
+ «ENDIF»
+ «IF fStructType.hasPolymorphicBase()»
+ «IF fStructType.hasDerivedTypes() »
+ static std::shared_ptr<«fStructType.elementName»> create(CommonAPI::Serial _serial);
+ «ENDIF»
+ const CommonAPI::Serial getSerial() const { return «fStructType.elementName.toUpperCase»_SERIAL; }
+ «ENDIF»
+
+ «fStructType.elementName»() {
+ «IF fStructType.allElements.size > 0»
+ «var n = 0»
+ «FOR element : fStructType.allElements»
+ «IF element.type.predefined.equals(FBasicTypeId.BOOLEAN) && !element.array»
+ std::get<«n»>(values_) = false;
+ «ENDIF»
+ «{ n = n + 1; "" }»
+ «ENDFOR»
+ «ENDIF»
+ }
+ «IF fStructType.allElements.size > 0»
+ «fStructType.elementName»(«fStructType.allElements.map[getConstReferenceVariable(fStructType)].join(", ")»)
+ «IF fStructType.hasPolymorphicBase() && fStructType.base != null»
+ : «fStructType.base.elementName»(«fStructType.base.allElements.map["_" + elementName].join(", ")»)
+ «ENDIF»
+ {
+ «IF fStructType.hasPolymorphicBase»
+ «var i = -1»
+ «FOR element : fStructType.elements»
+ std::get<«i = i+1»>(values_) = _«element.elementName»;
+ «ENDFOR»
+ «ELSE»
+ «var i = -1»
+ «FOR element : fStructType.allElements»
+ std::get<«i = i+1»>(values_) = _«element.elementName»;
+ «ENDFOR»
+ «ENDIF»
+ }
+ «ENDIF»
+ «IF fStructType.hasPolymorphicBase()»
+ template<class _Input>
+ void readValue(CommonAPI::InputStream<_Input> &_input, const CommonAPI::EmptyDeployment *_depl) {
+ «var i = -1»
+ «FOR element : fStructType.elements»
+ _input.template readValue<CommonAPI::EmptyDeployment>(std::get<«i = i+1»>(values_));
+ «ENDFOR»
+ «IF fStructType.hasDerivedTypes()»
+ switch (getSerial()) {
+ «FOR derived : fStructType.derivedFStructTypes»
+ «derived.generateCases(null, false)»
+ static_cast<«derived.elementName» *>(this)->template readValue<_Input>(_input, _depl);
+ break;
+ «ENDFOR»
+ default:
+ break;
+ }
+ «ENDIF»
+ }
+
+ template<class _Input, class _Deployment>
+ void readValue(CommonAPI::InputStream<_Input> &_input, const _Deployment *_depl) {
+ «var j = -1»
+ «var k = fStructType.allElements.size - fStructType.elements.size - 1»
+ «FOR element : fStructType.elements»
+ _input.template readValue<>(std::get<«j = j+1»>(values_), std::get<«k = k+1»>(_depl->values_));
+ «ENDFOR»
+ «IF fStructType.hasDerivedTypes()»
+ switch (getSerial()) {
+ «FOR derived : fStructType.derivedFStructTypes»
+ «derived.generateCases(null, false)»
+ static_cast<«derived.elementName» *>(this)->template readValue<>(_input, _depl);
+ break;
+ «ENDFOR»
+ default:
+ break;
+ }
+ «ENDIF»
+ }
+
+ template<class _Output>
+ void writeType(CommonAPI::TypeOutputStream<_Output> &_output) {
+ «var l = -1»
+ «FOR element : fStructType.elements»
+ _output.writeType(std::get<«l = l+1»>(values_));
+ «ENDFOR»
+ «IF fStructType.hasDerivedTypes()»
+ switch (getSerial()) {
+ «FOR derived : fStructType.derivedFStructTypes»
+ «derived.generateCases(null, false)»
+ static_cast<«derived.elementName» *>(this)->template writeType<_Output>(_output);
+ break;
+ «ENDFOR»
+ default:
+ break;
+ }
+ «ENDIF»
+ }
+
+ template<class _Output>
+ void writeValue(CommonAPI::OutputStream<_Output> &_output, const CommonAPI::EmptyDeployment *_depl) {
+ «var m = -1»
+ «FOR element : fStructType.elements»
+ _output.template writeValue<CommonAPI::EmptyDeployment>(std::get<«m = m+1»>(values_));
+ «ENDFOR»
+ «IF fStructType.hasDerivedTypes()»
+ switch (getSerial()) {
+ «FOR derived : fStructType.derivedFStructTypes»
+ «derived.generateCases(null, false)»
+ static_cast<«derived.elementName» *>(this)->template writeValue<_Output>(_output, _depl);
+ break;
+ «ENDFOR»
+ default:
+ break;
+ }
+ «ENDIF»
+ }
+
+ template<class _Output, class _Deployment>
+ void writeValue(CommonAPI::OutputStream<_Output> &_output, const _Deployment *_depl) {
+ «var n = -1»
+ «var o = fStructType.allElements.size - fStructType.elements.size - 1»
+ «FOR element : fStructType.elements»
+ _output.template writeValue<>(std::get<«n = n+1»>(values_), _depl, std::get<«o = o + 1»>(_depl->values_));
+ «ENDFOR»
+ «IF fStructType.hasDerivedTypes()»
+ switch (getSerial()) {
+ «FOR derived : fStructType.derivedFStructTypes»
+ «derived.generateCases(null, false)»
+ static_cast<«derived.elementName» *>(this)->template writeValue<>(_output, _depl);
+ break;
+ «ENDFOR»
+ default:
+ break;
+ }
+ «ENDIF»
+ }
+ «var p = -1»
+ «FOR element : fStructType.elements»
+ «generateComments(element, false)»
+ «val String typeName = element.getTypeName(fStructType, false)»
+ inline const «typeName» &get«element.elementName.toFirstUpper»() const { return std::get<«p = p+1»>(values_); }
+ inline void set«element.elementName.toFirstUpper»(const «typeName» «IF typeName.isComplex»&«ENDIF»_value) { std::get<«p»>(values_) = _value; }
+ «ENDFOR»
+
+ «IF fStructType.hasPolymorphicBase() && fStructType.elements.size > 0»
+ std::tuple<«fStructType.elements.map[getTypeName(fStructType, false)].join(", ")»> values_;
+ «ENDIF»
+ «ELSE»
+ «var k = -1»
+ «FOR element : fStructType.allElements»
+ «generateComments(element, false)»
+ «val String typeName = element.getTypeName(fStructType, false)»
+ inline const «typeName» &get«element.elementName.toFirstUpper»() const { return std::get<«k = k+1»>(values_); }
+ inline void set«element.elementName.toFirstUpper»(const «typeName» «IF typeName.isComplex»&«ENDIF»_value) { std::get<«k»>(values_) = _value; }
+ «ENDFOR»
+ «ENDIF»
+ bool operator==(const «fStructType.name» &_other) const;
+ inline bool operator!=(const «fStructType.name» &_other) const {
+ return !((*this) == _other);
+ }
+
+ };
'''
- def dispatch generateFTypeDeclaration(FEnumerationType fEnumerationType, DeploymentInterfacePropertyAccessor deploymentAccessor) {
- generateDeclaration(fEnumerationType, fEnumerationType.elementName, deploymentAccessor)
+ def dispatch generateFTypeDeclaration(FEnumerationType fEnumerationType, PropertyAccessor deploymentAccessor) {
+ generateDeclaration(fEnumerationType, fEnumerationType, deploymentAccessor)
}
- def generateDeclaration(FEnumerationType fEnumerationType, String name, DeploymentInterfacePropertyAccessor deploymentAccessor) '''
- enum class «name»: «fEnumerationType.getBackingType(deploymentAccessor).primitiveTypeName» {
- «FOR parent : fEnumerationType.baseList SEPARATOR ',\n'»
- «FOR enumerator : parent.enumerators SEPARATOR ','»
- «enumerator.elementName» = «parent.getRelativeNameReference(fEnumerationType)»::«enumerator.elementName»
- «ENDFOR»
- «ENDFOR»
- «IF fEnumerationType.base != null && !fEnumerationType.enumerators.empty»,«ENDIF»
- «FOR enumerator : fEnumerationType.enumerators SEPARATOR ','»
- «generateComments(enumerator, false)»
- «enumerator.elementName»«enumerator.generateValue»
+ def generateDeclaration(FEnumerationType _enumeration, FModelElement _parent, PropertyAccessor _accessor) '''
+ «_enumeration.setEnumerationValues»
+ «IF _enumeration.name == null»
+ «IF _parent.name != null»
+ «_enumeration.name = _parent.name + "Enum"»
+ «ELSE»
+ «_enumeration.name = (_parent.eContainer as FModelElement).name + "Error"»
+ «ENDIF»
+ «ENDIF»
+ «val backingType = _enumeration.getBackingType(_accessor).primitiveTypeName»
+ «val baseTypeName = _enumeration.getBaseType(backingType)»
+
+ struct «_enumeration.name» : «baseTypeName» {
+ «_enumeration.name»() = default;
+ «_enumeration.name»(const «backingType» &_value)
+ : «baseTypeName»(_value) {}
+ «FOR enumerator : _enumeration.enumerators»
+ «generateComments(enumerator, false)»
+ static const «backingType» «enumPrefix»«enumerator.elementName» = «enumerator.value.enumeratorValue»;
«ENDFOR»
};
-
- // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1
- struct «name»Comparator;
'''
- def dispatch generateFTypeDeclaration(FUnionType fUnionType, DeploymentInterfacePropertyAccessor deploymentAccessor) '''
+ def dispatch generateFTypeDeclaration(FUnionType fUnionType, PropertyAccessor deploymentAccessor) '''
«generateComments(fUnionType, false)»
typedef CommonAPI::Variant<«fUnionType.getElementNames»> «fUnionType.elementName»;
'''
@@ -293,158 +478,93 @@ class FTypeGenerator {
if (names != "") {
names = ", " + names
}
- names = fUnion.elements.map[getTypeName(fUnion)].join(", ") + names
+ names = fUnion.elements.map[getTypeName(fUnion, false)].join(", ") + names
return names
}
- def dispatch generateFTypeInlineImplementation(FTypeDef fTypeDef, FModelElement parent, DeploymentInterfacePropertyAccessor deploymentAccessor) ''''''
- def dispatch generateFTypeInlineImplementation(FArrayType fArrayType, FModelElement parent, DeploymentInterfacePropertyAccessor deploymentAccessor) ''''''
- def dispatch generateFTypeInlineImplementation(FMapType fMap, FModelElement parent, DeploymentInterfacePropertyAccessor deploymentAccessor) ''''''
+ def dispatch generateFTypeInlineImplementation(FTypeDef fTypeDef, FModelElement parent, PropertyAccessor deploymentAccessor) ''''''
+ def dispatch generateFTypeInlineImplementation(FArrayType fArrayType, FModelElement parent, PropertyAccessor deploymentAccessor) ''''''
+ def dispatch generateFTypeInlineImplementation(FMapType fMap, FModelElement parent, PropertyAccessor deploymentAccessor) ''''''
- def dispatch generateFTypeInlineImplementation(FStructType fStructType, FModelElement parent, DeploymentInterfacePropertyAccessor deploymentAccessor) '''
- bool operator==(const «fStructType.getClassNamespace(parent)»& lhs, const «fStructType.getClassNamespace(parent)»& rhs);
- inline bool operator!=(const «fStructType.getClassNamespace(parent)»& lhs, const «fStructType.getClassNamespace(parent)»& rhs) {
- return !(lhs == rhs);
- }
+ def dispatch generateFTypeInlineImplementation(FStructType fStructType, FModelElement parent, PropertyAccessor deploymentAccessor) '''
'''
- def dispatch generateFTypeInlineImplementation(FEnumerationType fEnumerationType, FModelElement parent, DeploymentInterfacePropertyAccessor deploymentAccessor) {
- fEnumerationType.generateInlineImplementation(fEnumerationType.elementName, parent, parent.elementName, deploymentAccessor)
- }
-
- def generateInlineImplementation(FEnumerationType fEnumerationType, String enumerationName, FModelElement parent, String parentName, DeploymentInterfacePropertyAccessor deploymentAccessor) '''
- inline CommonAPI::InputStream& operator>>(CommonAPI::InputStream& inputStream, «fEnumerationType.getClassNamespaceWithName(enumerationName, parent, parentName)»& enumValue) {
- return inputStream.readEnumValue<«fEnumerationType.getBackingType(deploymentAccessor).primitiveTypeName»>(enumValue);
- }
-
- inline CommonAPI::OutputStream& operator<<(CommonAPI::OutputStream& outputStream, const «fEnumerationType.getClassNamespaceWithName(enumerationName, parent, parentName)»& enumValue) {
- return outputStream.writeEnumValue(static_cast<«fEnumerationType.getBackingType(deploymentAccessor).primitiveTypeName»>(enumValue));
- }
-
- struct «fEnumerationType.getClassNamespaceWithName(enumerationName, parent, parentName)»Comparator {
- inline bool operator()(const «enumerationName»& lhs, const «enumerationName»& rhs) const {
- return static_cast<«fEnumerationType.getBackingType(deploymentAccessor).primitiveTypeName»>(lhs) < static_cast<«fEnumerationType.getBackingType(deploymentAccessor).primitiveTypeName»>(rhs);
- }
- };
-
- «FOR base : fEnumerationType.baseList BEFORE "\n" SEPARATOR "\n"»
- «fEnumerationType.generateInlineOperatorWithName(enumerationName, base, parent, parentName, "==", deploymentAccessor)»
- «fEnumerationType.generateInlineOperatorWithName(enumerationName, base, parent, parentName, "!=", deploymentAccessor)»
- «ENDFOR»
+ def dispatch generateFTypeInlineImplementation(FEnumerationType fEnumerationType, FModelElement parent, PropertyAccessor deploymentAccessor) '''
'''
+
+ def dispatch generateFTypeInlineImplementation(FUnionType fUnionType, FModelElement parent, PropertyAccessor deploymentAccessor) ''''''
+
+ def dispatch generateFTypeImplementation(FTypeDef fTypeDef, FModelElement parent, PropertyAccessor _accessor) ''''''
+ def dispatch generateFTypeImplementation(FArrayType fArrayType, FModelElement parent, PropertyAccessor _accessor) ''''''
+ def dispatch generateFTypeImplementation(FMapType fMap, FModelElement parent, PropertyAccessor _accessor) ''''''
+ def dispatch generateFTypeImplementation(FEnumerationType _enumeration, FModelElement _parent, PropertyAccessor _accessor) '''
+ #ifndef WIN32
+ «FOR enumerator : _enumeration.enumerators»
+ «IF _parent != null && _parent != _enumeration»
+ const «_enumeration.getBackingType(_accessor).primitiveTypeName» «_parent.elementName»::«_enumeration.name»::«enumPrefix + enumerator.elementName»;
+ «ELSE»
+ const «_enumeration.getBackingType(_accessor).primitiveTypeName» «_enumeration.name»::«enumPrefix + enumerator.elementName»;
+ «ENDIF»
+ «ENDFOR»
+ #endif
+ '''
+
+ def dispatch generateFTypeImplementation(FStructType fStructType, FModelElement parent, PropertyAccessor _accessor) '''
+ «IF fStructType.polymorphic || (fStructType.hasPolymorphicBase() && fStructType.hasDerivedTypes())»
+ std::shared_ptr<«fStructType.getClassNamespace(parent)»> «fStructType.getClassNamespace(parent)»::create(CommonAPI::Serial _serial) {
+ switch (_serial) {
+ case «parent.elementName»::«fStructType.elementName.toUpperCase()»_SERIAL:
+ return std::make_shared<«fStructType.getClassNamespace(parent)»>();
+ «FOR derived : fStructType.derivedFStructTypes»
+ «derived.generateCases(parent, true)»
+ «IF derived.derivedFStructTypes.empty»
+ return std::make_shared<«derived.getClassNamespace(parent)»>();
+ «ELSE»
+ return «derived.getClassNamespace(parent)»::create(_serial);
+ «ENDIF»
+ «ENDFOR»
+ default:
+ break;
+ }
+ return std::shared_ptr<«fStructType.getClassNamespace(parent)»>();
+ }
+ «ENDIF»
+
+ bool «fStructType.getClassNamespace(parent)»::operator==(const «parent.elementName»::«fStructType.name»& _other) const {
+ «IF fStructType.allElements.size > 0»
+ «FOR element : fStructType.allElements BEFORE 'return (' SEPARATOR ' && ' AFTER ');'»get«element.elementName.toFirstUpper»() == _other.get«element.elementName.toFirstUpper»()«ENDFOR»
+ «ELSE»
+ return true;
+ «ENDIF»
+ }
- def dispatch generateFTypeInlineImplementation(FUnionType fUnionType, FModelElement parent, DeploymentInterfacePropertyAccessor deploymentAccessor) ''''''
-
- def dispatch generateFTypeImplementation(FTypeDef fTypeDef, FModelElement parent) ''''''
- def dispatch generateFTypeImplementation(FArrayType fArrayType, FModelElement parent) ''''''
- def dispatch generateFTypeImplementation(FMapType fMap, FModelElement parent) ''''''
- def dispatch generateFTypeImplementation(FEnumerationType fEnumerationType, FModelElement parent) ''''''
-
- def dispatch generateFTypeImplementation(FStructType fStructType, FModelElement parent) '''
- «IF fStructType.allElements.size > 0»
- «fStructType.getClassNamespace(parent)»::«fStructType.elementName»(«fStructType.allElements.map[getConstReferenceVariable(fStructType) + "Value"].join(", ")»):
- «fStructType.base?.generateBaseConstructorCall(fStructType)»
- «FOR element : fStructType.elements SEPARATOR ','»
- «element.elementName»(«element.elementName»Value)
- «ENDFOR»
- {
- }
- «ENDIF»
-
- «IF fStructType.hasPolymorphicBase»
- «fStructType.getClassNamespace(parent)»* «fStructType.getClassNamespace(parent)»::createInstance(const uint32_t& serialId) {
- if (serialId == SERIAL_ID)
- return new «fStructType.elementName»;
-
- «IF fStructType.hasDerivedFStructTypes»
- const std::function<«fStructType.elementName»*()> createDerivedInstanceFuncs[] = {
- «FOR derivedFStructType : fStructType.getDerivedFStructTypes SEPARATOR ','»
- [&]() { return «derivedFStructType.getRelativeNameReference(fStructType)»::createInstance(serialId); }
- «ENDFOR»
- };
-
- for (auto& createDerivedInstanceFunc : createDerivedInstanceFuncs) {
- «fStructType.elementName»* derivedInstance = createDerivedInstanceFunc();
- if (derivedInstance != NULL)
- return derivedInstance;
- }
-
- «ENDIF»
- return NULL;
- }
-
- uint32_t «fStructType.getClassNamespace(parent)»::getSerialId() const {
- return SERIAL_ID;
- }
-
- void «fStructType.getClassNamespace(parent)»::createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const {
- «fStructType.elementName»::writeToTypeOutputStream(typeOutputStream);
- }
- «ENDIF»
-
- bool operator==(const «fStructType.getClassNamespace(parent)»& lhs, const «fStructType.getClassNamespace(parent)»& rhs) {
- if (&lhs == &rhs)
- return true;
-
- return
- «IF fStructType.allElements.size > 0»
- «IF fStructType.base != null»
- static_cast<«fStructType.base.getClassNamespace(parent)»>(lhs) == static_cast<«fStructType.base.getClassNamespace(parent)»>(rhs) &&
- «ENDIF»
- «FOR element : fStructType.elements SEPARATOR ' &&'»
- lhs.«element.elementName» == rhs.«element.elementName»
- «ENDFOR»
- «ELSE»
- true
- «ENDIF»
- ;
- }
-
- void «fStructType.getClassNamespace(parent)»::readFromInputStream(CommonAPI::InputStream& inputStream) {
- «IF fStructType.base != null»
- «fStructType.base.getRelativeNameReference(fStructType)»::readFromInputStream(inputStream);
- «ENDIF»
- «FOR element : fStructType.elements»
- inputStream >> «element.elementName»;
- «ENDFOR»
- }
-
- void «fStructType.getClassNamespace(parent)»::writeToOutputStream(CommonAPI::OutputStream& outputStream) const {
- «IF fStructType.base != null»
- «fStructType.base.getRelativeNameReference(fStructType)»::writeToOutputStream(outputStream);
- «ENDIF»
- «FOR element : fStructType.elements»
- outputStream << «element.elementName»;
- «ENDFOR»
- }
'''
- def dispatch generateFTypeImplementation(FUnionType fUnionType, FModelElement parent) ''' '''
+ def dispatch generateFTypeImplementation(FUnionType fUnionType, FModelElement parent, PropertyAccessor _accessor) '''
+ '''
def hasImplementation(FType fType) {
- return (fType instanceof FStructType);
+ return ((fType instanceof FStructType) || (fType instanceof FEnumerationType))
}
def void generateInheritanceIncludes(FInterface fInterface, Collection<String> generatedHeaders, Collection<String> libraryHeaders) {
if(fInterface.base != null) {
generatedHeaders.add(fInterface.base.stubHeaderPath)
}
-
}
def void generateRequiredTypeIncludes(FInterface fInterface, Collection<String> generatedHeaders, Collection<String> libraryHeaders) {
-
- if (!fInterface.attributes.filter[(array != null && array.equals("[]"))].nullOrEmpty) {
+ if (!fInterface.attributes.filter[array].nullOrEmpty) {
libraryHeaders.add('vector')
}
- if (!fInterface.methods.map[inArgs.filter[(array != null && array.equals("[]"))]].nullOrEmpty) {
+ if (!fInterface.methods.map[inArgs.filter[array]].nullOrEmpty) {
libraryHeaders.add('vector')
}
- if (!fInterface.methods.map[outArgs.filter[(array != null && array.equals("[]"))]].nullOrEmpty) {
+ if (!fInterface.methods.map[outArgs.filter[array]].nullOrEmpty) {
libraryHeaders.add('vector')
}
- if (!fInterface.broadcasts.map[outArgs.filter[(array != null && array.equals("[]"))]].nullOrEmpty) {
+ if (!fInterface.broadcasts.map[outArgs.filter[array]].nullOrEmpty) {
libraryHeaders.add('vector')
}
@@ -486,19 +606,19 @@ class FTypeGenerator {
if (fStructType.base != null)
generatedHeaders.add(fStructType.base.FTypeCollection.headerPath)
else
- libraryHeaders.addAll('CommonAPI/InputStream.h', 'CommonAPI/OutputStream.h', 'CommonAPI/SerializableStruct.h')
+ libraryHeaders.addAll('CommonAPI/Deployment.hpp', 'CommonAPI/InputStream.hpp', 'CommonAPI/OutputStream.hpp', 'CommonAPI/Struct.hpp')
fStructType.elements.forEach[type.getRequiredHeaderPath(generatedHeaders, libraryHeaders)]
}
def private dispatch void addFTypeRequiredHeaders(FEnumerationType fEnumerationType, Collection<String> generatedHeaders, Collection<String> libraryHeaders) {
if (fEnumerationType.base != null)
generatedHeaders.add(fEnumerationType.base.FTypeCollection.headerPath)
- libraryHeaders.addAll('cstdint', 'CommonAPI/InputStream.h', 'CommonAPI/OutputStream.h')
+ libraryHeaders.addAll('cstdint', 'CommonAPI/InputStream.hpp', 'CommonAPI/OutputStream.hpp')
}
def private dispatch void addFTypeRequiredHeaders(FUnionType fUnionType, Collection<String> generatedHeaders, Collection<String> libraryHeaders) {
if (fUnionType.base != null)
generatedHeaders.add(fUnionType.base.FTypeCollection.headerPath)
else
- libraryHeaders.add('CommonAPI/SerializableVariant.h')
+ libraryHeaders.add('CommonAPI/Variant.hpp')
fUnionType.elements.forEach[type.getRequiredHeaderPath(generatedHeaders, libraryHeaders)]
libraryHeaders.addAll('cstdint', 'memory')
}
@@ -513,7 +633,7 @@ class FTypeGenerator {
def private void getRequiredHeaderPath(FBasicTypeId fBasicTypeId, Collection<String> generatedHeaders, Collection<String> libraryHeaders) {
switch fBasicTypeId {
case FBasicTypeId::STRING : libraryHeaders.add('string')
- case FBasicTypeId::BYTE_BUFFER : libraryHeaders.add('CommonAPI/ByteBuffer.h')
+ case FBasicTypeId::BYTE_BUFFER : libraryHeaders.add('CommonAPI/ByteBuffer.hpp')
default : libraryHeaders.add('cstdint')
}
}
@@ -529,7 +649,8 @@ class FTypeGenerator {
return reference
}
- def private generateBaseConstructorCall(FStructType parent, FStructType source) {
+ // TODO: check whether this is used anywhere....
+ def String generateBaseConstructorCall(FStructType parent, FStructType source) {
var call = parent.getRelativeNameReference(source)
call = call + "(" + parent.allElements.map[elementName + "Value"].join(", ") + ")"
if (!source.elements.empty)
@@ -539,7 +660,7 @@ class FTypeGenerator {
def private generateHasher(FMapType fMap) {
if (fMap.keyType.derived instanceof FEnumerationType) {
- return ''', CommonAPI::EnumHasher<«fMap.keyType.getNameReference(fMap.eContainer)»>'''
+ return ''', CommonAPI::EnumHasher<«fMap.keyType.getElementType(null, true)»>'''
}
return ""
@@ -547,34 +668,32 @@ class FTypeGenerator {
def private generateKeyType(FMapType fMap) {
if (fMap.keyType.polymorphic) {
- return "std::shared_ptr<" + fMap.keyType.getNameReference(fMap.eContainer) + ">"
+ return "std::shared_ptr<" + fMap.keyType.getElementType(null, true) + ">"
}
else {
- return fMap.keyType.getNameReference(fMap.eContainer)
+ return fMap.keyType.getElementType(null, true)
}
}
def private generateValueType(FMapType fMap) {
if (fMap.valueType.polymorphic) {
- return "std::shared_ptr<" + fMap.valueType.getNameReference(fMap.eContainer) + ">"
+ return "std::shared_ptr<" + fMap.valueType.getElementType(null, true) + ">"
}
else {
- return fMap.valueType.getNameReference(fMap.eContainer)
+ return fMap.valueType.getElementType(null, true)
}
}
- def private getBaseStructName(FStructType fStructType) {
- if (fStructType.base != null)
- return fStructType.base.getRelativeNameReference(fStructType)
-
+ // TODO: Check whether this is used somewhere
+ def getBaseStructName(FStructType fStructType) {
if (fStructType.hasPolymorphicBase)
- return "CommonAPI::SerializablePolymorphicStruct"
+ return "CommonAPI::PolymorphicStruct"
- return "CommonAPI::SerializableStruct"
+ return "CommonAPI::Struct"
}
def private getConstReferenceVariable(FField destination, FModelElement source) {
- "const " + destination.getTypeName(source) + "& " + destination.elementName
+ "const " + destination.getTypeName(source, false) + " &_" + destination.elementName
}
def private List<FField> getAllElements(FStructType fStructType) {
@@ -586,7 +705,8 @@ class FTypeGenerator {
return elements
}
- def private generateInlineOperatorWithName(FEnumerationType fEnumerationType, String enumerationName, FEnumerationType base, FModelElement parent, String parentName, String operator, DeploymentInterfacePropertyAccessor deploymentAccessor) '''
+ //TODO: used?
+ def generateInlineOperatorWithName(FEnumerationType fEnumerationType, String enumerationName, FEnumerationType base, FModelElement parent, String parentName, String operator, PropertyAccessor deploymentAccessor) '''
inline bool operator«operator»(const «fEnumerationType.getClassNamespaceWithName(enumerationName, parent, parentName)»& lhs, const «base.getClassNamespaceWithName(base.elementName, base.eContainer as FModelElement, (base.eContainer as FModelElement).elementName)»& rhs) {
return static_cast<«fEnumerationType.getBackingType(deploymentAccessor).primitiveTypeName»>(lhs) «operator» static_cast<«fEnumerationType.getBackingType(deploymentAccessor).primitiveTypeName»>(rhs);
}
@@ -595,7 +715,8 @@ class FTypeGenerator {
}
'''
- def private getBaseList(FEnumerationType fEnumerationType) {
+ //TODO: used?
+ def getBaseList(FEnumerationType fEnumerationType) {
val baseList = new LinkedList<FEnumerationType>
var currentBase = fEnumerationType.base
@@ -607,8 +728,9 @@ class FTypeGenerator {
return baseList
}
- def private generateValue(FEnumerator fEnumerator) {
- val parsedValue = tryParseInteger(fEnumerator.value)
+ //TODO: used?
+ def generateValue(FEnumerator fEnumerator) {
+ val parsedValue = tryParseInteger(fEnumerator.value.enumeratorValue)
if (parsedValue != null)
return ' = ' + parsedValue
return ''
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGenerator.xtend
index 35d8bf8..55e12e1 100644
--- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGenerator.xtend
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGenerator.xtend
@@ -14,15 +14,10 @@ import javax.inject.Inject
import org.eclipse.core.resources.IResource
import org.eclipse.core.resources.ResourcesPlugin
import org.eclipse.core.runtime.Path
-import org.eclipse.core.runtime.QualifiedName
-import org.eclipse.core.runtime.preferences.DefaultScope
-import org.eclipse.core.runtime.preferences.IEclipsePreferences
-import org.eclipse.core.runtime.preferences.InstanceScope
import org.eclipse.emf.ecore.resource.Resource
-import org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2
import org.eclipse.xtext.generator.IFileSystemAccess
import org.eclipse.xtext.generator.IGenerator
-import org.eclipse.xtext.generator.JavaIoFileSystemAccess
+import org.franca.core.dsl.FrancaPersistenceManager
import org.franca.core.franca.FArrayType
import org.franca.core.franca.FEnumerationType
import org.franca.core.franca.FInterface
@@ -36,15 +31,16 @@ import org.franca.core.franca.FTypeRef
import org.franca.core.franca.FUnionType
import org.franca.deploymodel.core.FDModelExtender
import org.franca.deploymodel.core.FDeployedInterface
-import org.franca.deploymodel.dsl.FDeployPersistenceManager
+import org.franca.deploymodel.core.FDeployedTypeCollection
import org.franca.deploymodel.dsl.fDeploy.FDInterface
-import org.genivi.commonapi.core.deployment.DeploymentInterfacePropertyAccessor
-import org.genivi.commonapi.core.deployment.DeploymentInterfacePropertyAccessorWrapper
+import org.franca.deploymodel.dsl.fDeploy.FDProvider
+import org.franca.deploymodel.dsl.fDeploy.FDTypes
+import org.genivi.commonapi.core.deployment.PropertyAccessor
import org.genivi.commonapi.core.preferences.FPreferences
import org.genivi.commonapi.core.preferences.PreferenceConstants
-import org.osgi.framework.FrameworkUtil
import static com.google.common.base.Preconditions.*
+import org.franca.deploymodel.dsl.fDeploy.FDModel
class FrancaGenerator implements IGenerator
{
@@ -53,31 +49,40 @@ class FrancaGenerator implements IGenerator
@Inject private extension FInterfaceProxyGenerator
@Inject private extension FInterfaceStubGenerator
@Inject private extension FrancaGeneratorExtensions
-
- @Inject private MyFrancaPersistenceManager francaPersistenceManager
- @Inject private FDeployPersistenceManager fDeployPersistenceManager
+
+ @Inject private FrancaPersistenceManager francaPersistenceManager
+ @Inject private FDeployManager fDeployManager
override doGenerate(Resource input, IFileSystemAccess fileSystemAccess)
{
var FModel fModel
var List<FDInterface> deployedInterfaces
+ var List<FDTypes> deployedTypeCollections
+ var List<FDProvider> deployedProviders
var IResource res = null
+ // load the model from a fidl file
if(input.URI.fileExtension.equals(francaPersistenceManager.fileExtension))
{
- fModel = francaPersistenceManager.loadModel(input.filePath)
+ fModel = francaPersistenceManager.loadModel(input.URI, input.URI)
deployedInterfaces = new LinkedList<FDInterface>()
}
- else if(input.URI.fileExtension.equals("fdepl"/* fDeployPersistenceManager.fileExtension */))
+ // load the model from deployment file
+ else if(input.URI.fileExtension.equals(FDeployManager.fileExtension))
{
- var fDeployedModel = fDeployPersistenceManager.loadModel(input.URI, input.URI);
- val fModelExtender = new FDModelExtender(fDeployedModel);
-
- checkArgument(fModelExtender.getFDInterfaces().size > 0, "No Interfaces were deployed, nothing to generate.")
- fModel = fModelExtender.getFDInterfaces().get(0).target.model
- deployedInterfaces = fModelExtender.getFDInterfaces()
-
+ var model = fDeployManager.loadModel(input.URI, input.URI);
+ if(model instanceof FDModel) {
+ val fModelExtender = new FDModelExtender(model);
+ checkArgument(fModelExtender.getFDInterfaces().size > 0, "No Interfaces were deployed, nothing to generate.")
+ fModel = fModelExtender.getFDInterfaces().get(0).target.model
+ deployedInterfaces = fModelExtender.getFDInterfaces()
+ deployedTypeCollections = fModelExtender.getFDTypesList()
+ deployedProviders = fModelExtender.getFDProviders()
+ } else if(model instanceof FModel) {
+ fModel = model
+ deployedInterfaces = new LinkedList<FDInterface>()
+ }
}
else
{
@@ -98,38 +103,22 @@ class FrancaGenerator implements IGenerator
}
res = ResourcesPlugin.workspace.root.findMember(pathfile)
- FPreferences::instance.addPreferences(res)
- if(FPreferences::instance.useModelSpecific(res))
- {
- var output = res.getPersistentProperty(
- new QualifiedName(PreferenceConstants::PROJECT_PAGEID, PreferenceConstants::P_OUTPUT_PROXIES))
- if(output != null && output.length != 0)
- {
- if(fileSystemAccess instanceof EclipseResourceFileSystemAccess2)
- {
- (fileSystemAccess as EclipseResourceFileSystemAccess2).setOutputPath(output)
- }
- else if(fileSystemAccess instanceof JavaIoFileSystemAccess)
- {
- (fileSystemAccess as JavaIoFileSystemAccess).setOutputPath(output)
- }
- }
- }
- doGenerateComponents(fModel, deployedInterfaces, fileSystemAccess, res)
+
+ doGenerateComponents(fModel, deployedInterfaces, deployedTypeCollections, deployedProviders, fileSystemAccess, res)
}
catch(IllegalStateException e)
{
//happens only when the cli calls the francagenerator
}
- doGenerateComponents(fModel, deployedInterfaces, fileSystemAccess, res)
-
- if(res != null)
- {
- fileSystemAccess.setFileAccessOutputPathForPreference(PreferenceConstants::P_OUTPUT_PROXIES, res)
- }
+ doGenerateComponents(fModel, deployedInterfaces, deployedTypeCollections, deployedProviders, fileSystemAccess, res)
}
- def private doGenerateComponents(FModel fModel, List<FDInterface> deployedInterfaces, IFileSystemAccess fileSystemAccess, IResource res)
+ def private doGenerateComponents(FModel fModel,
+ List<FDInterface> deployedInterfaces,
+ List<FDTypes> deployedTypeCollections,
+ List<FDProvider> deployedProviders,
+ IFileSystemAccess fileSystemAccess,
+ IResource res)
{
val allReferencedFTypes = fModel.allReferencedFTypes
@@ -143,33 +132,42 @@ class FrancaGenerator implements IGenerator
val generateInterfaces = fModel.allReferencedFInterfaces.toSet
generateInterfaces.addAll(allFTypeFInterfaces)
- val defaultDeploymentAccessor = new DeploymentInterfacePropertyAccessorWrapper(null) as DeploymentInterfacePropertyAccessor
-
- generateTypeCollections.forEach [
- generate(it, fileSystemAccess, defaultDeploymentAccessor, res)
- ]
-
- generateInterfaces.forEach [
+ val defaultDeploymentAccessor = new PropertyAccessor()
+ generateInterfaces.forEach [
val currentInterface = it
- var DeploymentInterfacePropertyAccessor deploymentAccessor
- if(deployedInterfaces.exists[it.target == currentInterface])
+ var PropertyAccessor deploymentAccessor
+ if (deployedInterfaces != null && deployedInterfaces.exists[it.target == currentInterface])
{
- deploymentAccessor = new DeploymentInterfacePropertyAccessor(
- new FDeployedInterface(deployedInterfaces.filter[it.target == currentInterface].last))
+ deploymentAccessor = new PropertyAccessor(
+ new FDeployedInterface(deployedInterfaces.filter[it.target == currentInterface].last))
}
else
{
deploymentAccessor = defaultDeploymentAccessor
}
- generate(it, fileSystemAccess, defaultDeploymentAccessor, res)
+ generate(it, fileSystemAccess, deploymentAccessor, res)
]
+
+ generateTypeCollections.forEach [
+ val currentTypeCollection = it
+ if (!(currentTypeCollection instanceof FInterface)) {
+ var PropertyAccessor deploymentAccessor
+ if (deployedTypeCollections != null && deployedTypeCollections.exists[it.target == currentTypeCollection]) {
+ deploymentAccessor = new PropertyAccessor(
+ new FDeployedTypeCollection(deployedTypeCollections.filter[it.target == currentTypeCollection].last))
+ } else {
+ deploymentAccessor = defaultDeploymentAccessor
+ }
+ generate(it, fileSystemAccess, deploymentAccessor, res)
+ }
+ ]
fModel.interfaces.forEach [
val currentInterface = it
- var DeploymentInterfacePropertyAccessor deploymentAccessor
+ var PropertyAccessor deploymentAccessor
if(deployedInterfaces.exists[it.target == currentInterface])
{
- deploymentAccessor = new DeploymentInterfacePropertyAccessor(
+ deploymentAccessor = new PropertyAccessor(
new FDeployedInterface(deployedInterfaces.filter[it.target == currentInterface].last))
}
else
@@ -177,34 +175,16 @@ class FrancaGenerator implements IGenerator
deploymentAccessor = defaultDeploymentAccessor
}
val booleanTrue = Boolean.toString(true)
- var IEclipsePreferences node
var String finalValue = booleanTrue
- if(FrameworkUtil::getBundle(this.getClass()) != null)
- {
- node = DefaultScope::INSTANCE.getNode(PreferenceConstants::SCOPE)
- finalValue = node.get(PreferenceConstants::P_GENERATEPROXY, booleanTrue)
-
- node = InstanceScope::INSTANCE.getNode(PreferenceConstants::SCOPE)
- finalValue = node.get(PreferenceConstants::P_GENERATEPROXY, finalValue)
- }
- finalValue = FPreferences::instance.getPreference(res, PreferenceConstants::P_GENERATEPROXY, finalValue)
+ finalValue = FPreferences::instance.getPreference(PreferenceConstants::P_GENERATEPROXY, finalValue)
if(finalValue.equals(booleanTrue))
{
- fileSystemAccess.setFileAccessOutputPathForPreference(PreferenceConstants.P_OUTPUT_PROXIES, res)
it.generateProxy(fileSystemAccess, deploymentAccessor, res)
}
finalValue = booleanTrue
- if(FrameworkUtil::getBundle(this.getClass()) != null)
- {
- node = DefaultScope::INSTANCE.getNode(PreferenceConstants::SCOPE)
- finalValue = node.get(PreferenceConstants::P_GENERATESTUB, booleanTrue)
- node = InstanceScope::INSTANCE.getNode(PreferenceConstants::SCOPE)
- finalValue = node.get(PreferenceConstants::P_GENERATESTUB, finalValue)
- }
- finalValue = FPreferences::instance.getPreference(res, PreferenceConstants::P_GENERATESTUB, finalValue)
+ finalValue = FPreferences::instance.getPreference(PreferenceConstants::P_GENERATESTUB, finalValue)
if(finalValue.equals(booleanTrue))
{
- fileSystemAccess.setFileAccessOutputPathForPreference(PreferenceConstants.P_OUTPUT_STUBS, res)
it.generateStub(fileSystemAccess, res)
}
]
@@ -333,19 +313,4 @@ class FrancaGenerator implements IGenerator
}
}
- def void setFileAccessOutputPathForPreference(IFileSystemAccess access, String preference, IResource res)
- {
- var defaultValue = DefaultScope::INSTANCE.getNode(PreferenceConstants::SCOPE).get(preference,
- PreferenceConstants::DEFAULT_OUTPUT);
- defaultValue = InstanceScope::INSTANCE.getNode(PreferenceConstants::SCOPE).get(preference, defaultValue)
- defaultValue = FPreferences::instance.getPreference(res, preference, defaultValue)
-
- switch (access)
- {
- EclipseResourceFileSystemAccess2:
- access.setOutputPath(defaultValue)
- JavaIoFileSystemAccess:
- access.setOutputPath(defaultValue)
- }
- }
}
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend
index 9dbf72d..0944894 100644
--- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend
@@ -10,15 +10,19 @@ import com.google.common.base.Charsets
import com.google.common.hash.Hasher
import com.google.common.hash.Hashing
import com.google.common.primitives.Ints
+import java.math.BigInteger
+import java.util.ArrayList
import java.util.Collection
+import java.util.HashMap
+import java.util.HashSet
import java.util.List
+import java.util.Map
+import java.util.Set
import org.eclipse.core.resources.IResource
import org.eclipse.core.resources.ResourcesPlugin
import org.eclipse.core.runtime.Path
import org.eclipse.core.runtime.preferences.DefaultScope
import org.eclipse.core.runtime.preferences.InstanceScope
-import org.eclipse.emf.common.util.BasicEList
-import org.eclipse.emf.common.util.EList
import org.eclipse.emf.ecore.EObject
import org.eclipse.emf.ecore.resource.Resource
import org.eclipse.emf.ecore.util.EcoreUtil
@@ -27,12 +31,16 @@ import org.franca.core.franca.FAttribute
import org.franca.core.franca.FBasicTypeId
import org.franca.core.franca.FBroadcast
import org.franca.core.franca.FEnumerationType
+import org.franca.core.franca.FEnumerator
+import org.franca.core.franca.FExpression
import org.franca.core.franca.FField
+import org.franca.core.franca.FIntegerConstant
import org.franca.core.franca.FInterface
import org.franca.core.franca.FMapType
import org.franca.core.franca.FMethod
import org.franca.core.franca.FModel
import org.franca.core.franca.FModelElement
+import org.franca.core.franca.FStringConstant
import org.franca.core.franca.FStructType
import org.franca.core.franca.FType
import org.franca.core.franca.FTypeCollection
@@ -40,23 +48,78 @@ import org.franca.core.franca.FTypeDef
import org.franca.core.franca.FTypeRef
import org.franca.core.franca.FTypedElement
import org.franca.core.franca.FUnionType
-import org.genivi.commonapi.core.deployment.DeploymentInterfacePropertyAccessor
-import org.genivi.commonapi.core.deployment.DeploymentInterfacePropertyAccessor.DefaultEnumBackingType
-import org.genivi.commonapi.core.deployment.DeploymentInterfacePropertyAccessor.EnumBackingType
+import org.franca.core.franca.FVersion
+import org.franca.core.franca.FrancaFactory
+import org.genivi.commonapi.core.deployment.PropertyAccessor
+import org.genivi.commonapi.core.deployment.PropertyAccessor.DefaultEnumBackingType
+import org.genivi.commonapi.core.deployment.PropertyAccessor.EnumBackingType
import org.genivi.commonapi.core.preferences.FPreferences
import org.genivi.commonapi.core.preferences.PreferenceConstants
import org.osgi.framework.FrameworkUtil
import static com.google.common.base.Preconditions.*
+import static extension java.lang.Integer.*
+import org.franca.core.franca.FConstantDef
+import org.franca.core.franca.FQualifiedElementRef
+import org.franca.core.franca.FInitializerExpression
+
class FrancaGeneratorExtensions {
+
+ def boolean isComplex(String _typeName) {
+ if (_typeName == "bool" ||
+ _typeName == "int8" ||
+ _typeName == "int16" ||
+ _typeName == "int32" ||
+ _typeName == "int64" ||
+ _typeName == "uint8" ||
+ _typeName == "uint16" ||
+ _typeName == "uint32" ||
+ _typeName == "uint64") {
+ return false
+ }
+ return true
+ }
+
+ def String generateIndent(int _indent) {
+ var String empty = ""
+ var int i = 0
+ while (i < _indent) {
+ empty = empty + " "
+ i = i + 1
+ }
+ return empty
+ }
+
+ def String getRelativeName(FModelElement _element) {
+ if (_element instanceof FTypeCollection)
+ return ""
+ val String next = (_element.eContainer as FModelElement).relativeName
+ if (next != "")
+ return next + "_" + _element.name
+ return _element.name
+ }
def String getFullyQualifiedName(FModelElement fModelElement) {
if (fModelElement.eContainer instanceof FModel)
return (fModelElement.eContainer as FModel).name + '.' + fModelElement.elementName
return (fModelElement.eContainer as FModelElement).fullyQualifiedName + '.' + fModelElement.elementName
}
-
+
+ def String getFullyQualifiedCppName(FModelElement fModelElement) {
+ if (fModelElement.eContainer instanceof FModel) {
+ var name = (fModelElement.eContainer as FModel).name
+ if (fModelElement instanceof FTypeCollection) {
+ val FVersion itsVersion = fModelElement.version
+ if (itsVersion != null) {
+ name = fModelElement.versionPrefix + name
+ }
+ }
+ return "::" + (name + "::" + fModelElement.elementName).replace(".", "::")
+ }
+ return "::" + ((fModelElement.eContainer as FModelElement).fullyQualifiedName + "::" + fModelElement.elementName).replace(".", "::")
+ }
+
def splitCamelCase(String string) {
string.split("(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])")
}
@@ -79,7 +142,7 @@ class FrancaGeneratorExtensions {
}
def FTypeCollection getContainingTypeCollection(FModelElement fModelElement) {
- if (fModelElement.eContainer == null || fModelElement.eContainer instanceof FModel) {
+ if (fModelElement.eContainer != null && fModelElement.eContainer instanceof FModel) {
return null
}
if (fModelElement.eContainer instanceof FTypeCollection) {
@@ -107,15 +170,14 @@ class FrancaGeneratorExtensions {
}
def getElementName(FModelElement fModelElement) {
- if(fModelElement.name.nullOrEmpty && fModelElement instanceof FTypeCollection) {
- return "AnonymousTypeCollection"
+ if ((fModelElement.name == null || fModelElement.name == "") && fModelElement instanceof FTypeCollection) {
+ return "__Anonymous__"
}
else {
return fModelElement.name
}
}
-
def private dispatch List<String> getNamespaceAsList(FModel fModel) {
newArrayList(fModel.name.split("\\."))
}
@@ -146,7 +208,7 @@ class FrancaGeneratorExtensions {
def getRelativeNameReference(FModelElement destination, EObject source) {
var nameReference = destination.elementName
- if (!destination.eContainer.equals(source)) {
+ if (destination.eContainer != null && !destination.eContainer.equals(source)) {
val subnamespaceList = destination.getSubnamespaceList(source)
if (!subnamespaceList.empty)
nameReference = subnamespaceList.join('::') + '::' + nameReference
@@ -156,11 +218,11 @@ class FrancaGeneratorExtensions {
}
def getHeaderFile(FTypeCollection fTypeCollection) {
- fTypeCollection.elementName + ".h"
+ fTypeCollection.elementName + ".hpp"
}
def getHeaderPath(FTypeCollection fTypeCollection) {
- fTypeCollection.model.directoryPath + '/' + fTypeCollection.headerFile
+ fTypeCollection.versionPathPrefix + fTypeCollection.model.directoryPath + '/' + fTypeCollection.headerFile
}
def getSourceFile(FTypeCollection fTypeCollection) {
@@ -168,15 +230,15 @@ class FrancaGeneratorExtensions {
}
def getSourcePath(FTypeCollection fTypeCollection) {
- fTypeCollection.model.directoryPath + '/' + fTypeCollection.sourceFile
+ fTypeCollection.versionPathPrefix + fTypeCollection.model.directoryPath + '/' + fTypeCollection.sourceFile
}
def getProxyBaseHeaderFile(FInterface fInterface) {
- fInterface.elementName + "ProxyBase.h"
+ fInterface.elementName + "ProxyBase.hpp"
}
def getProxyBaseHeaderPath(FInterface fInterface) {
- fInterface.model.directoryPath + '/' + fInterface.proxyBaseHeaderFile
+ fInterface.versionPathPrefix + fInterface.model.directoryPath + '/' + fInterface.proxyBaseHeaderFile
}
def getProxyBaseClassName(FInterface fInterface) {
@@ -184,31 +246,39 @@ class FrancaGeneratorExtensions {
}
def getProxyHeaderFile(FInterface fInterface) {
- fInterface.elementName + "Proxy.h"
+ fInterface.elementName + "Proxy.hpp"
}
def getProxyHeaderPath(FInterface fInterface) {
- fInterface.model.directoryPath + '/' + fInterface.proxyHeaderFile
+ fInterface.versionPathPrefix + fInterface.model.directoryPath + '/' + fInterface.proxyHeaderFile
}
def getStubDefaultHeaderFile(FInterface fInterface) {
- fInterface.elementName + "StubDefault.h"
+ fInterface.elementName + "Stub" + skeletonNamePostfix + ".hpp"
}
+ def getSkeletonNamePostfix() {
+ FPreferences::instance.getPreference(PreferenceConstants::P_SKELETONPOSTFIX, "Default")
+ }
+
+ def getHeaderDefineName(FInterface fInterface) {
+ fInterface.defineName + "_STUB_" + skeletonNamePostfix.toUpperCase()
+ }
+
def getStubDefaultHeaderPath(FInterface fInterface) {
- fInterface.model.directoryPath + '/' + fInterface.stubDefaultHeaderFile
+ fInterface.versionPathPrefix + fInterface.model.directoryPath + '/' + fInterface.stubDefaultHeaderFile
}
- def getStubDefaultClassName(FInterface fInterface) {
- fInterface.elementName + 'StubDefault'
+ def getStubDefaultClassName(FInterface fInterface) {
+ fInterface.elementName + "Stub" + skeletonNamePostfix
}
def getStubDefaultSourceFile(FInterface fInterface) {
- fInterface.elementName + "StubDefault.cpp"
+ fInterface.elementName + "Stub" + skeletonNamePostfix + ".cpp"
}
def getStubDefaultSourcePath(FInterface fInterface) {
- fInterface.model.directoryPath + '/' + fInterface.getStubDefaultSourceFile
+ fInterface.versionPathPrefix + fInterface.model.directoryPath + '/' + fInterface.getStubDefaultSourceFile
}
def getStubRemoteEventClassName(FInterface fInterface) {
@@ -224,16 +294,16 @@ class FrancaGeneratorExtensions {
}
def getStubHeaderFile(FInterface fInterface) {
- fInterface.elementName + "Stub.h"
+ fInterface.elementName + "Stub.hpp"
}
def getStubHeaderPath(FInterface fInterface) {
- fInterface.model.directoryPath + '/' + fInterface.stubHeaderFile
+ fInterface.versionPathPrefix + fInterface.model.directoryPath + '/' + fInterface.stubHeaderFile
}
def generateSelectiveBroadcastStubIncludes(FInterface fInterface, Collection<String> generatedHeaders,
Collection<String> libraryHeaders) {
- if (!fInterface.broadcasts.filter[selective.nullOrEmpty].empty) {
+ if (!fInterface.broadcasts.filter[!selective].empty) {
libraryHeaders.add("unordered_set")
}
@@ -242,8 +312,8 @@ class FrancaGeneratorExtensions {
def generateSelectiveBroadcastProxyIncludes(FInterface fInterface, Collection<String> generatedHeaders,
Collection<String> libraryHeaders) {
- if (!fInterface.broadcasts.filter[selective.nullOrEmpty].empty) {
- libraryHeaders.add("CommonAPI/types.h")
+ if (!fInterface.broadcasts.filter[!selective].empty) {
+ libraryHeaders.add("CommonAPI/Types.hpp")
}
return null
@@ -262,102 +332,178 @@ class FrancaGeneratorExtensions {
}
def hasSelectiveBroadcasts(FInterface fInterface) {
- !fInterface.broadcasts.filter[!selective.nullOrEmpty].empty
- }
-
- def generateDefinition(FMethod fMethod) {
- fMethod.generateDefinitionWithin(null)
- }
-
- def generateDefinitionWithin(FMethod fMethod, String parentClassName) {
+ !fInterface.broadcasts.filter[selective].empty
+ }
+
+ def Collection<FMethod> getMethodsWithError(FInterface _interface) {
+ val Map<String, FMethod> itsMethods = new HashMap<String, FMethod>()
+ for (method : _interface.methods.filter[errors != null]) {
+ var existing = itsMethods.get(method.name)
+ if (existing == null) {
+ itsMethods.put(method.name, method)
+ } else {
+ val List<FEnumerator> itsAdditionals = new ArrayList<FEnumerator>()
+ for (e : method.errors.enumerators) {
+ var found = false
+ for (f : existing.errors.enumerators) {
+ if (f.name == e.name) {
+ found = true
+ }
+ }
+ if (!found)
+ itsAdditionals.add(e)
+ }
+ existing.errors.enumerators.addAll(itsAdditionals)
+ }
+ }
+ return itsMethods.values
+ }
+
+ def generateDefinition(FMethod fMethod, boolean _isDefault) {
+ fMethod.generateDefinitionWithin(null, _isDefault)
+ }
+
+ def generateDefinitionWithin(FMethod fMethod, String parentClassName, boolean _isDefault) {
var definition = 'void '
if (FTypeGenerator::isdeprecated(fMethod.comment))
definition = "COMMONAPI_DEPRECATED " + definition
if (!parentClassName.nullOrEmpty)
definition = definition + parentClassName + '::'
- definition = definition + fMethod.elementName + '(' + fMethod.generateDefinitionSignature + ')'
+ definition = definition + fMethod.elementName + '(' + fMethod.generateDefinitionSignature(_isDefault) + ')'
return definition
}
- def generateDefinitionSignature(FMethod fMethod) {
- var signature = fMethod.inArgs.map['const ' + getTypeName(fMethod.model) + '& ' + elementName].join(', ')
+ def generateDefinitionSignature(FMethod fMethod, boolean _isDefault) {
+ var signature = fMethod.inArgs.map['const ' + getTypeName(fMethod, true) + ' &_' + elementName].join(', ')
if (!fMethod.inArgs.empty)
signature = signature + ', '
- signature = signature + 'CommonAPI::CallStatus& callStatus'
+ signature = signature + 'CommonAPI::CallStatus &_status'
if (fMethod.hasError)
- signature = signature + ', ' + fMethod.getErrorNameReference(fMethod.eContainer) + '& methodError'
+ signature = signature + ', ' + fMethod.getErrorNameReference(fMethod.eContainer) + ' &_error'
if (!fMethod.outArgs.empty)
- signature = signature + ', ' + fMethod.outArgs.map[getTypeName(fMethod.model) + '& ' + elementName].join(', ')
-
- return signature
- }
-
- def generateStubSignatureCompatibility(FMethod fMethod) {
- var signature = fMethod.inArgs.map[getTypeName(fMethod.model) + ' ' + elementName].join(', ')
- if (!fMethod.inArgs.empty && (fMethod.hasError || !fMethod.outArgs.empty))
- signature = signature + ', '
+ signature = signature + ', ' + fMethod.outArgs.map[getTypeName(fMethod, true) + ' &_' + elementName].join(', ')
- signature = signature + generateStubSignatureErrorsAndOutArgs(fMethod)
+ if (!fMethod.fireAndForget) {
+ signature += ", const CommonAPI::CallInfo *_info"
+ if (_isDefault)
+ signature += " = nullptr"
+ }
return signature
}
def generateStubSignature(FMethod fMethod) {
- var signature = 'const std::shared_ptr<CommonAPI::ClientId> clientId'
+ var signature = 'const std::shared_ptr<CommonAPI::ClientId> _client'
if (!fMethod.inArgs.empty)
signature = signature + ', '
- signature = signature + fMethod.inArgs.map[getTypeName(fMethod.model) + ' ' + elementName].join(', ')
-
- if (fMethod.hasError || !fMethod.outArgs.empty)
- signature = signature + ', '
-
- signature = signature + generateStubSignatureErrorsAndOutArgs(fMethod)
-
+ signature = signature + fMethod.inArgs.map[getTypeName(fMethod, true) + ' _' + elementName].join(', ')
+
+ if (!fMethod.isFireAndForget) {
+ if (signature != "")
+ signature = signature + ", ";
+ signature = signature + fMethod.elementName + "Reply_t _reply";
+ }
+
return signature
}
-
- def generateStubSignatureOldStyle(FMethod fMethod) {
+
+ def generateStubReplySignature(FMethod fMethod) {
var signature = ''
- signature = signature + fMethod.inArgs.map[getTypeName(fMethod.model) + ' ' + elementName].join(', ')
-
- if ((fMethod.hasError || !fMethod.outArgs.empty) && !fMethod.inArgs.empty)
+ if (fMethod.hasError)
+ signature = signature + fMethod.getErrorNameReference(fMethod.eContainer) + ' _error'
+ if (fMethod.hasError && !fMethod.outArgs.empty)
signature = signature + ', '
- signature = signature + generateStubSignatureErrorsAndOutArgs(fMethod)
+ if (!fMethod.outArgs.empty)
+ signature = signature + fMethod.outArgs.map[getTypeName(fMethod, true) + ' _' + elementName].join(', ')
return signature
}
+
+ def String generateDummyArgumentInitializations(FMethod fMethod) {
+ var String retval = ""
+ for(list_element : fMethod.outArgs) {
+ retval += getTypeName(list_element, fMethod, true) + ' ' + list_element.elementName
+ if (((list_element.type.derived instanceof FStructType
+ && (list_element.type.derived as FStructType).hasPolymorphicBase))
+ || list_element.array){
+ retval += " = {}"
+ } else if(list_element.type.predefined != null) {
+ // primitive types
+ switch list_element.type.predefined {
+ case FBasicTypeId::BOOLEAN: retval+= " = false"
+ case FBasicTypeId::INT8: retval += " = 0"
+ case FBasicTypeId::UINT8: retval += " = 0"
+ case FBasicTypeId::INT16: retval += " = 0"
+ case FBasicTypeId::UINT16: retval += " = 0"
+ case FBasicTypeId::INT32: retval += " = 0"
+ case FBasicTypeId::UINT32: retval += " = 0"
+ case FBasicTypeId::INT64: retval += " = 0"
+ case FBasicTypeId::UINT64: retval += " = 0"
+ case FBasicTypeId::FLOAT: retval += " = 0.0f"
+ case FBasicTypeId::DOUBLE: retval += " = 0.0"
+ case FBasicTypeId::STRING: retval += " = \"\""
+ case FBasicTypeId::BYTE_BUFFER: retval += " = {}"
+ default: {}//System.out.println("No initialization generated for" +
+ //" non-basic type: " + list_element.getName)
+ }
+ }
+ retval += ";\n"
+ }
+ return retval
+ }
+
+ def generateDummyArgumentDefinitions(FMethod fMethod) {
+ var definition = ''
+ if (fMethod.hasError)
+ definition = fMethod.getErrorNameReference(fMethod.eContainer) + ' error;\n'
+ if (!fMethod.outArgs.empty)
+ definition = definition + generateDummyArgumentInitializations(fMethod)
+ return definition
+ }
+
+ def generateDummyArgumentList(FMethod fMethod) {
+ var arguments = ''
+ if (fMethod.hasError)
+ arguments = "error"
+ if (!fMethod.outArgs.empty) {
+ if (arguments != '')
+ arguments = arguments + ', '
+ arguments = arguments + fMethod.outArgs.map[elementName].join(', ')
+ }
+ return arguments
+ }
def generateFireSelectiveSignatur(FBroadcast fBroadcast, FInterface fInterface) {
- var signature = 'const std::shared_ptr<CommonAPI::ClientId> clientId'
+ var signature = 'const std::shared_ptr<CommonAPI::ClientId> _client'
if (!fBroadcast.outArgs.empty)
signature = signature + ', '
signature = signature +
- fBroadcast.outArgs.map['const ' + getTypeName(fInterface.model) + '& ' + elementName].join(', ')
+ fBroadcast.outArgs.map['const ' + getTypeName(fInterface, true) + ' &_' + elementName].join(', ')
return signature
}
def generateSendSelectiveSignatur(FBroadcast fBroadcast, FInterface fInterface, Boolean withDefault) {
- var signature = fBroadcast.outArgs.map['const ' + getTypeName(fInterface.model) + '& ' + elementName].join(', ')
+ var signature = fBroadcast.outArgs.map['const ' + getTypeName(fInterface, true) + ' &_' + elementName].join(', ')
if (!fBroadcast.outArgs.empty)
signature = signature + ', '
- signature = signature + 'const std::shared_ptr<CommonAPI::ClientIdList> receivers'
+ signature = signature + 'const std::shared_ptr<CommonAPI::ClientIdList> _receivers'
if (withDefault)
- signature = signature + ' = NULL'
+ signature = signature + ' = nullptr'
return signature
}
@@ -366,24 +512,45 @@ class FrancaGeneratorExtensions {
var signature = ''
if (fMethod.hasError)
- signature = signature + fMethod.getErrorNameReference(fMethod.eContainer) + '& methodError'
+ signature = signature + fMethod.getErrorNameReference(fMethod.eContainer) + ' &_error'
if (fMethod.hasError && !fMethod.outArgs.empty)
signature = signature + ', '
if (!fMethod.outArgs.empty)
- signature = signature + fMethod.outArgs.map[getTypeName(fMethod.model) + '& ' + elementName].join(', ')
+ signature = signature + fMethod.outArgs.map[getTypeName(fMethod, true) + ' &_' + elementName].join(', ')
return signature
}
- def generateArgumentsToStubCompatibility(FMethod fMethod) {
+ def generateArgumentsToStub(FMethod fMethod) {
+ var arguments = ' _client'
+
+ if (!fMethod.inArgs.empty)
+ arguments = arguments + ', ' + fMethod.inArgs.map[elementName].join(', ')
+
+ if ((fMethod.hasError || !fMethod.outArgs.empty))
+ arguments = arguments + ', '
+
+ if (fMethod.hasError)
+ arguments = arguments + '_error'
+
+ if (fMethod.hasError && !fMethod.outArgs.empty)
+ arguments = arguments + ', '
+
+ if (!fMethod.outArgs.empty)
+ arguments = arguments + fMethod.outArgs.map[elementName].join(', ')
+
+ return arguments
+ }
+
+ def generateArgumentsToStubOldStyle(FMethod fMethod) {
var arguments = fMethod.inArgs.map[elementName].join(', ')
if ((fMethod.hasError || !fMethod.outArgs.empty) && !fMethod.inArgs.empty)
arguments = arguments + ', '
if (fMethod.hasError)
- arguments = arguments + 'methodError'
+ arguments = arguments + '_error'
if (fMethod.hasError && !fMethod.outArgs.empty)
arguments = arguments + ', '
@@ -393,30 +560,64 @@ class FrancaGeneratorExtensions {
return arguments
}
- def generateAsyncDefinition(FMethod fMethod) {
- fMethod.generateAsyncDefinitionWithin(null)
+ def generateAsyncDefinition(FMethod fMethod, boolean _isDefault) {
+ fMethod.generateAsyncDefinitionWithin(null, _isDefault)
}
- def generateAsyncDefinitionWithin(FMethod fMethod, String parentClassName) {
+ def generateAsyncDefinitionWithin(FMethod fMethod, String parentClassName, boolean _isDefault) {
var definition = 'std::future<CommonAPI::CallStatus> '
if (!parentClassName.nullOrEmpty) {
definition = definition + parentClassName + '::'
}
- definition = definition + fMethod.elementName + 'Async(' + fMethod.generateAsyncDefinitionSignature + ')'
+ definition = definition + fMethod.elementName + 'Async(' + fMethod.generateAsyncDefinitionSignature(_isDefault) + ')'
return definition
}
- def generateAsyncDefinitionSignature(FMethod fMethod) {
- var signature = fMethod.inArgs.map['const ' + getTypeName(fMethod.model) + '& ' + elementName].join(', ')
+ def generateAsyncDefinitionSignature(FMethod fMethod, boolean _isDefault) {
+ var signature = fMethod.inArgs.map['const ' + getTypeName(fMethod, true) + ' &_' + elementName].join(', ')
if (!fMethod.inArgs.empty) {
signature = signature + ', '
}
- return signature + fMethod.asyncCallbackClassName + ' callback'
+
+ signature += fMethod.asyncCallbackClassName + ' _callback'
+ signature += ", const CommonAPI::CallInfo *_info"
+ if (_isDefault)
+ signature += " = nullptr"
+
+ return signature
+ }
+
+ def getErrorType(FMethod _method) {
+ var errorType = ""
+ if (_method.hasError) {
+ errorType = _method.getErrorNameReference(_method.eContainer)
+ }
+ return errorType
}
+ def getInTypeList(FMethod _method) {
+ return _method.inArgs.map[getTypeName(_method, true)].join(', ')
+ }
+
+ def getOutTypeList(FMethod _method) {
+ return _method.outArgs.map[getTypeName(_method, true)].join(', ')
+ }
+
+ def getErrorAndOutTypeList(FMethod _method) {
+ val errorType = _method.errorType
+ val outTypes = _method.outTypeList
+
+ var errorAndOutTypes = errorType
+ if (errorType != "" && outTypes != "")
+ errorAndOutTypes = errorAndOutTypes + ", "
+ errorAndOutTypes = errorAndOutTypes + outTypes
+
+ return errorAndOutTypes
+ }
+
def private String getBasicMangledName(FBasicTypeId basicType) {
switch (basicType) {
case FBasicTypeId::BOOLEAN:
@@ -445,6 +646,9 @@ class FrancaGeneratorExtensions {
return "s"
case FBasicTypeId::BYTE_BUFFER:
return "au8"
+ default: {
+ return null
+ }
}
}
@@ -522,7 +726,7 @@ class FrancaGeneratorExtensions {
signature = signature + ', const ' + fMethod.getErrorNameReference(fMethod.eContainer) + '&'
if (!fMethod.outArgs.empty)
- signature = signature + ', ' + fMethod.outArgs.map['const ' + getTypeName(fMethod.model) + '&'].join(', ')
+ signature = signature + ', ' + fMethod.outArgs.map['const ' + getTypeName(fMethod, true) + '&'].join(', ')
return signature
}
@@ -540,7 +744,7 @@ class FrancaGeneratorExtensions {
def getErrorNameReference(FMethod fMethod, EObject source) {
checkArgument(fMethod.hasError, 'FMethod has no error: ' + fMethod)
if (fMethod.errorEnum != null) {
- return fMethod.errorEnum.getRelativeNameReference((source as FModelElement).model)
+ return fMethod.errorEnum.getElementName(fMethod, true)
}
var errorNameReference = fMethod.errors.errorName
@@ -595,7 +799,7 @@ class FrancaGeneratorExtensions {
def getClassName(FBroadcast fBroadcast) {
var className = fBroadcast.elementName.toFirstUpper
- if (!fBroadcast.selective.nullOrEmpty)
+ if (fBroadcast.selective)
className = className + 'Selective'
className = className + 'Event'
@@ -606,6 +810,10 @@ class FrancaGeneratorExtensions {
def generateGetMethodDefinition(FBroadcast fBroadcast) {
fBroadcast.generateGetMethodDefinitionWithin(null)
}
+
+ def String getTypes(FBroadcast _broadcast) {
+ return _broadcast.outArgs.map[getTypeName(_broadcast, true)].join(', ')
+ }
def generateGetMethodDefinitionWithin(FBroadcast fBroadcast, String parentClassName) {
var definition = fBroadcast.className + '& '
@@ -658,26 +866,28 @@ class FrancaGeneratorExtensions {
'const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success'
}
- def boolean isSelective(FBroadcast fBroadcast) {
- return !fBroadcast.selective.nullOrEmpty
- }
-
- def getTypeName(FTypedElement element, EObject source) {
- var typeName = element.type.getNameReference(source)
-
- if (element.type.derived instanceof FStructType && (element.type.derived as FStructType).hasPolymorphicBase)
+ def String getTypeName(FTypedElement _element, FModelElement _source, boolean _isOther) {
+ var String typeName = _element.type.getElementType(_source, _isOther)
+
+ if (_element.type.derived instanceof FStructType && (_element.type.derived as FStructType).hasPolymorphicBase)
typeName = 'std::shared_ptr<' + typeName + '>'
- if ("[]".equals(element.array)) {
- if (element.type.derived instanceof FStructType && (element.type.derived as FStructType).hasPolymorphicBase) {
- typeName = 'std::vector<std::shared_ptr<' + element.type.getNameReference(source) + '>>'
- } else {
- typeName = 'std::vector<' + element.type.getNameReference(source) + '>'
- }
+ if (_element.array) {
+ typeName = 'std::vector<' + typeName + '>'
}
return typeName
}
+
+ def String getElementType(FTypeRef _typeRef, FModelElement _container, boolean _isOther) {
+ var String typeName
+ if (_typeRef.derived != null) {
+ typeName = _typeRef.derived.getElementName(_container, _isOther)
+ } else if (_typeRef.predefined != null) {
+ typeName = _typeRef.predefined.primitiveTypeName
+ }
+ return typeName
+ }
def boolean isPolymorphic(FTypeRef typeRef) {
return (typeRef.derived != null && typeRef.derived instanceof FStructType && (typeRef.derived as FStructType).polymorphic)
@@ -694,7 +904,7 @@ class FrancaGeneratorExtensions {
(fMethodErrors.eContainer as FMethod).elementName + 'Error'
}
- def getBackingType(FEnumerationType fEnumerationType, DeploymentInterfacePropertyAccessor deploymentAccessor) {
+ def getBackingType(FEnumerationType fEnumerationType, PropertyAccessor deploymentAccessor) {
if (deploymentAccessor.getEnumBackingType(fEnumerationType) == EnumBackingType::UseDefault) {
if (fEnumerationType.containingInterface != null) {
switch (deploymentAccessor.getDefaultEnumBackingType(fEnumerationType.containingInterface)) {
@@ -734,11 +944,76 @@ class FrancaGeneratorExtensions {
return FBasicTypeId::INT32
case EnumBackingType::Int64:
return FBasicTypeId::INT64
+ default: {
+ return FBasicTypeId::INT32
+ }
}
- return FBasicTypeId::INT32
}
- def getPrimitiveTypeName(FBasicTypeId fBasicTypeId) {
+ def String getBaseType(FEnumerationType _enumeration, String _backingType) {
+ var String baseType
+ if (_enumeration.base != null) {
+ baseType = _enumeration.base.getElementName(_enumeration, false)
+ } else {
+ baseType = "CommonAPI::Enumeration<" + _backingType + ">"
+ }
+ return baseType
+ }
+
+ def private getMaximumEnumerationValue(FEnumerationType _enumeration) {
+ var int maximum = 0;
+ for (literal : _enumeration.enumerators) {
+ if (literal.value != null && literal.value != "") {
+ val int literalValue = Integer.parseInt(literal.value.enumeratorValue)
+ if (maximum < literalValue)
+ maximum = literalValue
+ }
+ }
+ return maximum
+ }
+
+ def void setEnumerationValues(FEnumerationType _enumeration) {
+ var int currentValue = 0
+ val predefineEnumValues = new ArrayList<String>()
+
+ // collect all predefined enum values
+ for (literal : _enumeration.enumerators) {
+ if (literal.value != null) {
+ System.out.println(literal.value)
+ predefineEnumValues.add(literal.value.enumeratorValue)
+ }
+ }
+ if (_enumeration.base != null) {
+ setEnumerationValues(_enumeration.base)
+ currentValue = getMaximumEnumerationValue(_enumeration.base) + 1
+ }
+
+ for (literal : _enumeration.enumerators) {
+ if (literal.value == null || literal.value == "") {
+ // not predefined
+ while (predefineEnumValues.contains(String.valueOf(currentValue))) {
+ // increment it, if this was found in the list of predefined values
+ currentValue += 1
+ }
+ literal.setValue(toExpression(Integer.toString(currentValue)))
+ } else {
+ var enumValue = literal.value.enumeratorValue
+ if (enumValue != null) {
+ try {
+ val int literalValue = Integer.parseInt(enumValue)
+ literal.setValue(toExpression(Integer.toString(literalValue)))
+ } catch (NumberFormatException e) {
+ literal.setValue(toExpression(Integer.toString(currentValue)))
+ }
+ } else {
+ literal.setValue(toExpression(Integer.toString(currentValue)))
+ }
+ }
+ currentValue += 1
+ }
+ }
+
+ def getPrimitiveTypeName(FBasicTypeId fBasicTypeId) {
switch fBasicTypeId {
case FBasicTypeId::BOOLEAN: "bool"
case FBasicTypeId::INT8: "int8_t"
@@ -757,8 +1032,8 @@ class FrancaGeneratorExtensions {
}
}
- def String typeStreamSignature(FTypeRef fTypeRef, DeploymentInterfacePropertyAccessor deploymentAccessor, FField forThisElement) {
- if (forThisElement.array != null && forThisElement.array.equals("[]")) {
+ def String typeStreamSignature(FTypeRef fTypeRef, PropertyAccessor deploymentAccessor, FField forThisElement) {
+ if (forThisElement.array) {
var String ret = ""
ret = ret + "typeOutputStream.beginWriteVectorType();\n"
ret = ret + fTypeRef.actualTypeStreamSignature(deploymentAccessor)
@@ -768,7 +1043,7 @@ class FrancaGeneratorExtensions {
return fTypeRef.actualTypeStreamSignature(deploymentAccessor)
}
- def String actualTypeStreamSignature(FTypeRef fTypeRef, DeploymentInterfacePropertyAccessor deploymentAccessor) {
+ def String actualTypeStreamSignature(FTypeRef fTypeRef, PropertyAccessor deploymentAccessor) {
if (fTypeRef.derived != null) {
return fTypeRef.derived.typeStreamFTypeSignature(deploymentAccessor)
}
@@ -776,6 +1051,36 @@ class FrancaGeneratorExtensions {
return fTypeRef.predefined.basicTypeStreamSignature
}
+ def String createSerials(FStructType fStructType) {
+ var String serials;
+ serials = "static const CommonAPI::Serial "
+ + fStructType.elementName.toUpperCase() + "_SERIAL = 0x"
+ + getSerialId(fStructType).toHexString.toUpperCase() + ";\n";
+ for (derived : fStructType.derivedFStructTypes)
+ serials = serials + createSerials(derived)
+ return serials
+ }
+
+ def String generateCases(FStructType fStructType, FModelElement parent, boolean qualified) {
+ var String itsCases = "case ";
+
+ if (parent != null)
+ itsCases = itsCases + parent.elementName + "::"
+
+ if (qualified) {
+ itsCases = itsCases
+ if (fStructType.containingInterface != null)
+ itsCases = itsCases + fStructType.containingInterface.elementName + "::";
+ }
+
+ itsCases = itsCases + fStructType.elementName.toUpperCase() + "_SERIAL:\n";
+
+ for (derived : fStructType.derivedFStructTypes)
+ itsCases = itsCases + derived.generateCases(parent, qualified);
+
+ return itsCases;
+ }
+
def private String getBasicTypeStreamSignature(FBasicTypeId fBasicTypeId) {
switch fBasicTypeId {
case FBasicTypeId::BOOLEAN: return "typeOutputStream.writeBoolType();"
@@ -791,46 +1096,51 @@ class FrancaGeneratorExtensions {
case FBasicTypeId::DOUBLE: return "typeOutputStream.writeDoubleType();"
case FBasicTypeId::STRING: return "typeOutputStream.writeStringType();"
case FBasicTypeId::BYTE_BUFFER: return "typeOutputStream.writeByteBufferType();"
+ default: return "UNDEFINED"
}
}
def private dispatch String typeStreamFTypeSignature(FTypeDef fTypeDef,
- DeploymentInterfacePropertyAccessor deploymentAccessor) {
+ PropertyAccessor deploymentAccessor) {
return fTypeDef.actualType.actualTypeStreamSignature(deploymentAccessor)
}
def private dispatch String typeStreamFTypeSignature(FArrayType fArrayType,
- DeploymentInterfacePropertyAccessor deploymentAccessor) {
+ PropertyAccessor deploymentAccessor) {
return 'typeOutputStream.beginWriteVectorType();\n' +
fArrayType.elementType.actualTypeStreamSignature(deploymentAccessor) + '\n' +
'typeOutputStream.endWriteVectorType();'
}
def private dispatch String typeStreamFTypeSignature(FMapType fMap,
- DeploymentInterfacePropertyAccessor deploymentAccessor) {
+ PropertyAccessor deploymentAccessor) {
return 'typeOutputStream.beginWriteMapType();\n' + fMap.keyType.actualTypeStreamSignature(deploymentAccessor) + '\n' +
fMap.valueType.actualTypeStreamSignature(deploymentAccessor) + '\n' + 'typeOutputStream.endWriteMapType();'
}
def private dispatch String typeStreamFTypeSignature(FStructType fStructType,
- DeploymentInterfacePropertyAccessor deploymentAccessor) {
+ PropertyAccessor deploymentAccessor) {
return 'typeOutputStream.beginWriteStructType();\n' +
fStructType.getElementsTypeStreamSignature(deploymentAccessor) + '\n' +
'typeOutputStream.endWriteStructType();'
}
def private dispatch String typeStreamFTypeSignature(FEnumerationType fEnumerationType,
- DeploymentInterfacePropertyAccessor deploymentAccessor) {
- return fEnumerationType.getBackingType(deploymentAccessor).basicTypeStreamSignature
+ PropertyAccessor deploymentAccessor) {
+ val backingType = fEnumerationType.getBackingType(deploymentAccessor)
+ if (backingType != FBasicTypeId.UNDEFINED)
+ return backingType.basicTypeStreamSignature
+
+ return FBasicTypeId.INT32.basicTypeStreamSignature
}
def private dispatch String typeStreamFTypeSignature(FUnionType fUnionType,
- DeploymentInterfacePropertyAccessor deploymentAccessor) {
+ PropertyAccessor deploymentAccessor) {
return 'typeOutputStream.writeVariantType();'
}
def private String getElementsTypeStreamSignature(FStructType fStructType,
- DeploymentInterfacePropertyAccessor deploymentAccessor) {
+ PropertyAccessor deploymentAccessor) {
var signature = fStructType.elements.map[type.typeStreamSignature(deploymentAccessor, it)].join
if (fStructType.base != null)
@@ -890,6 +1200,10 @@ class FrancaGeneratorExtensions {
return fStructType.base != null && fStructType.base.hasPolymorphicBase
}
+
+ def boolean hasDerivedTypes(FStructType fStructType) {
+ return !fStructType.derivedFStructTypes.empty
+ }
def getSerialId(FStructType fStructType) {
val hasher = Hashing::murmur3_32.newHasher
@@ -957,7 +1271,7 @@ class FrancaGeneratorExtensions {
return EcoreUtil.UsageCrossReferencer::find(fStructType, fStructType.model.eResource.resourceSet).map[EObject].
filter[it instanceof FStructType].map[it as FStructType].filter[base == fStructType]
}
-
+
def generateCppNamespace(FModel fModel) '''
«fModel.namespaceAsList.map[toString].join("::")»::'''
@@ -973,8 +1287,49 @@ class FrancaGeneratorExtensions {
«ENDFOR»
'''
+ def generateVersionNamespaceBegin(FTypeCollection _tc) '''
+ «var FVersion itsVersion = _tc.version»
+ «IF itsVersion != null && (itsVersion.major != 0 || itsVersion.minor != 0)»
+ namespace v«itsVersion.major.toString»_«itsVersion.minor.toString» {
+ «ENDIF»
+ '''
+
+ def generateVersionNamespaceEnd(FTypeCollection _tc) '''
+ «var FVersion itsVersion = _tc.version»
+ «IF itsVersion != null && (itsVersion.major != 0 || itsVersion.minor != 0)»
+ } // namespace v«itsVersion.major.toString»_«itsVersion.minor.toString»
+ «ENDIF»
+ '''
+
+ def generateDeploymentNamespaceBegin(FTypeCollection _tc) '''
+ namespace «_tc.elementName»_ {
+ '''
+
+ def generateDeploymentNamespaceEnd(FTypeCollection _tc) '''
+ } // namespace «_tc.elementName»_
+ '''
+
+ def getVersionPrefix(FTypeCollection _tc) {
+ var String prefix = "::"
+ var FVersion itsVersion = _tc.version
+ if (itsVersion != null && (itsVersion.major != 0 || itsVersion.minor != 0)) {
+ prefix += "v" + itsVersion.major.toString + "_" + itsVersion.minor.toString + "::"
+ }
+ return prefix
+ }
+
+ def getVersionPathPrefix(FTypeCollection _tc) {
+ var String prefix = ""
+ var FVersion itsVersion = _tc.version
+ if (itsVersion != null && (itsVersion.major != 0 || itsVersion.minor != 0)) {
+ prefix = "v" + itsVersion.major.toString + "_" + itsVersion.minor.toString + "/"
+ }
+ return prefix
+ }
+
+ // TODO: Remove the following method
def isFireAndForget(FMethod fMethod) {
- return !fMethod.fireAndForget.nullOrEmpty
+ return fMethod.fireAndForget
}
def getFilePath(Resource resource) {
@@ -991,7 +1346,7 @@ class FrancaGeneratorExtensions {
if (FrameworkUtil::getBundle(this.getClass()) != null) {
var returnValue = DefaultScope::INSTANCE.getNode(PreferenceConstants::SCOPE).get(PreferenceConstants::P_LICENSE, "")
returnValue = InstanceScope::INSTANCE.getNode(PreferenceConstants::SCOPE).get(PreferenceConstants::P_LICENSE, returnValue)
- returnValue = FPreferences::instance.getPreference(res, PreferenceConstants::P_LICENSE, returnValue)
+ returnValue = FPreferences::instance.getPreference(PreferenceConstants::P_LICENSE, returnValue)
return returnValue
}
return ""
@@ -1057,7 +1412,7 @@ class FrancaGeneratorExtensions {
}
def stubRegisterManagedMethodImpl(FInterface fInterface) {
- fInterface.stubRegisterManagedName + '(std::shared_ptr<' + fInterface.stubClassName + '> stub, const std::string& instance)'
+ fInterface.stubRegisterManagedName + '(std::shared_ptr<' + fInterface.stubClassName + '> _stub, const std::string &_instance)'
}
def stubDeregisterManagedName(FInterface fInterface) {
@@ -1071,37 +1426,276 @@ class FrancaGeneratorExtensions {
def proxyManagerMemberName(FInterface fInterface) {
'proxyManager' + fInterface.elementName + '_'
}
-
- def EList<FMethod> getInheritedMethods(FInterface fInterface) {
+
+ def Set<FInterface> getBaseInterfaces(FInterface _interface) {
+ val Set<FInterface> baseInterfaces = new HashSet<FInterface>()
+ if (_interface.base != null) {
+ baseInterfaces.add(_interface.base)
+ baseInterfaces.addAll(getBaseInterfaces(_interface.base))
+ }
+ return baseInterfaces
+ }
+
+ def generateBaseInstantiations(FInterface _interface) {
+ val Set<FInterface> baseInterfaces = getBaseInterfaces(_interface)
+ return baseInterfaces.map[getTypeCollectionName(_interface) + "(_address, _connection)"].join(',\n')
+ }
+
+ def generateDBusBaseInstantiations(FInterface _interface) {
+ val Set<FInterface> baseInterfaces = getBaseInterfaces(_interface)
+ return baseInterfaces.map[
+ getTypeCollectionName(_interface) +
+ "DBusProxy(_address, _connection)"
+ ].join(',\n')
+ }
+
+ def String generateBaseRemoteHandlerConstructorsCalls(FInterface _interface) {
+ val Set<FInterface> baseInterfaces = getBaseInterfaces(_interface)
+ var String itsCalls = ""
+ itsCalls = baseInterfaces.map[getTypeCollectionName(_interface) + "StubDefault::RemoteEventHandler(_defaultStub)"].join(', ')
+ if (itsCalls != "")
+ itsCalls = itsCalls + ','
+ return itsCalls
+ }
+
+ def List<FMethod> getInheritedMethods(FInterface fInterface) {
+ val List<FMethod> result = new ArrayList<FMethod>()
+
if(fInterface.base == null) {
- return new BasicEList()
+ return result
}
- val methods = fInterface.base.methods
- methods.addAll(fInterface.base.inheritedMethods)
+ result.addAll(fInterface.base.methods)
+ result.addAll(fInterface.base.inheritedMethods)
- return methods
+ return result
}
- def EList<FAttribute> getInheritedAttributes(FInterface fInterface) {
+ def List<FAttribute> getInheritedAttributes(FInterface fInterface) {
+ val List<FAttribute> result = new ArrayList<FAttribute>()
if(fInterface.base == null) {
- return new BasicEList()
+ return result
}
- val attributes = fInterface.base.attributes
- attributes.addAll(fInterface.base.inheritedAttributes)
+ result.addAll(fInterface.base.attributes)
+ result.addAll(fInterface.base.inheritedAttributes)
- return attributes
+ return result
}
- def EList<FBroadcast> getInheritedBroadcasts(FInterface fInterface) {
+ def List<FBroadcast> getInheritedBroadcasts(FInterface fInterface) {
+ val List<FBroadcast> result = new ArrayList<FBroadcast>()
+
if(fInterface.base == null) {
- return new BasicEList()
+ return result
}
- val broadcasts = fInterface.base.broadcasts
- broadcasts.addAll(fInterface.base.inheritedBroadcasts)
+ result.addAll(fInterface.base.broadcasts)
+ result.addAll(fInterface.base.inheritedBroadcasts)
+
+ return result
+ }
+
+ def static FExpression toExpression(String value)
+ {
+ return switch trimmedValue : if(value != null) value.trim else ""
+ {
+ case trimmedValue.length > 0:
+ {
+ try
+ {
+ FrancaFactory.eINSTANCE.createFIntegerConstant => [
+ ^val = new BigInteger(trimmedValue)
+ ]
+ }
+ catch(NumberFormatException e)
+ {
+ FrancaFactory.eINSTANCE.createFStringConstant => [
+ ^val = trimmedValue
+ ]
+ }
+ }
+ default:
+ {
+ null
+ }
+ }
+ }
+
+ def static String getEnumeratorValue(FExpression expression)
+ {
+ return switch (expression)
+ {
+ FIntegerConstant: expression.^val.toString
+ FStringConstant: expression.^val
+ FQualifiedElementRef: expression.element.constantValue
+ default: null
+ }
+ }
+
+ def static String getConstantValue(FModelElement expression)
+ {
+ return switch (expression)
+ {
+ FConstantDef: expression.rhs.constantType
+ default: null
+ }
+ }
+
+ def static String getConstantType(FInitializerExpression expression)
+ {
+ return switch (expression)
+ {
+ FIntegerConstant: expression.^val.toString
+ default: null
+ }
+ }
- return broadcasts
+ def Integer getTimeout(FMethod _method, PropertyAccessor _accessor) {
+ var timeout = 0;
+ try {
+ timeout = _accessor.getTimeout(_method)
+ }
+ catch (NullPointerException e) {
+ // intentionally empty
+ }
+ return timeout
+ }
+
+ def boolean isTheSameVersion(FVersion _mine, FVersion _other) {
+ return ((_mine == null && _other == null) ||
+ (_mine != null && _other != null &&
+ _mine.major == _other.major &&
+ _mine.minor == _other.minor));
+
+ }
+
+ def EObject getCommonContainer(EObject _me, EObject _other) {
+ if (_other == null)
+ return null
+
+ if (_me == _other)
+ return _me
+
+ if (_me instanceof FTypeCollection && _other instanceof FTypeCollection) {
+ val FTypeCollection me = _me as FTypeCollection
+ val FTypeCollection other = _other as FTypeCollection
+
+ if (me.eContainer == other.eContainer &&
+ ((me.version == null && other.version == null) ||
+ (me.version != null && other.version != null &&
+ me.version.major == other.version.major &&
+ me.version.minor == other.version.minor))) {
+ return _me;
+ }
+ }
+
+ return getCommonContainer(_me, _other.eContainer)
+ }
+
+ def String getContainerName(EObject _container) {
+ var String name = ""
+ if (_container instanceof FTypeCollection) {
+ name = _container.name
+ if (name == null) name = "__Anonymous__"
+ } else if (_container instanceof FModelElement) {
+ name = _container.name
+ } else if (_container instanceof FModel) {
+ name = _container.name
+ }
+ return name
+ }
+
+ def String getPartialName(FModelElement _me, EObject _until) {
+ var String name = _me.containerName
+ var EObject container = _me.eContainer
+ while (container != null && container != _until) {
+ if (container instanceof FModel) {
+ name = container.name + "::" + name
+ }
+ if (container instanceof FModelElement) {
+ name = container.name + "::" + name
+ }
+ container = container.eContainer
+ }
+ return name.replace(".", "::")
+ }
+
+ def String getFullName(EObject _me) {
+ var String name = ""
+ if (_me instanceof FModelElement) {
+ var String prefix = ""
+ var EObject container = _me
+ while (container != null) {
+ if (container instanceof FTypeCollection) {
+ prefix = (container as FTypeCollection).versionPrefix
+ }
+ val containerName = getContainerName(container)
+ if (containerName != null && containerName != "") {
+ if (name != "") {
+ name = containerName + "::" + name
+ } else {
+ name = containerName
+ }
+ }
+
+ container = container.eContainer
+ }
+ name = prefix + name
+ }
+ return name.replace(".", "::")
+ }
+
+ def String getElementName(FModelElement _me, FModelElement _other, boolean _isOther) {
+ if (_other == null)
+ return _me.containerName
+
+ var FVersion myVersion = null
+ if (_me instanceof FTypeCollection)
+ myVersion = _me.version
+
+ var FVersion otherVersion = null
+ if (_other instanceof FTypeCollection)
+ otherVersion = _other.version
+
+ if (isTheSameVersion(myVersion, otherVersion)) {
+ val EObject myContainer = _me.eContainer
+ val EObject otherContainer = _other.eContainer
+
+ if (myContainer == otherContainer) {
+ var String name = _me.containerName
+ if (_isOther) {
+ name = getContainerName(myContainer) + "::" + _me.containerName
+ }
+ return name
+ }
+
+ if (myContainer.getCommonContainer(otherContainer) != null) {
+ return _me.getPartialName(myContainer.eContainer)
+ }
+
+ if (otherContainer.getCommonContainer(myContainer) != null) {
+ var String name = _me.containerName
+ if (_isOther) {
+ name = getContainerName(myContainer) + "::" + name
+ }
+ return name
+ }
+ }
+
+ return _me.getFullName()
+ }
+
+ def String getTypeCollectionName(FTypeCollection _me, FTypeCollection _other) {
+ if (_other == null ||
+ _me.eContainer() != _other.eContainer() ||
+ !isTheSameVersion(_me.version, _other.version)) {
+ return _me.getFullName()
+ }
+ return _me.getContainerName()
+ }
+
+ def String getEnumPrefix(){
+ FPreferences::instance.getPreference(PreferenceConstants::P_ENUMPREFIX, "")
}
-} \ No newline at end of file
+}
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/MyFrancaPersistenceManager.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/MyFrancaPersistenceManager.java
deleted file mode 100644
index d13d3a6..0000000
--- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/MyFrancaPersistenceManager.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-
-package org.genivi.commonapi.core.generator;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.franca.core.dsl.FrancaImportsProvider;
-import org.franca.core.dsl.FrancaPersistenceManager;
-import org.franca.core.franca.FModel;
-import org.franca.core.utils.FileHelper;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-
-public class MyFrancaPersistenceManager extends FrancaPersistenceManager {
-
- private final String fileExtension = "fidl";
-
- @Inject
- private Provider<ResourceSet> resourceSetProvider;
-
- @Override
- public FModel loadModel(String filename) {
- try {
- URI uri = FileHelper.createURI(filename);
- URI fileURI = MyModelPersistenceHandler.normalizeURI(uri);
-
- if (fileURI.segmentCount() > 1) {
- return loadModel(fileURI.lastSegment(), fileURI.trimSegments(1)
- .toString() + "/");
- } else {
- return loadModel(filename, "");
- }
- } catch (Exception ex) {
- System.err.println("Error: " + ex.getMessage());
- return null;
- }
- }
-
- private FModel loadModel(String filename, String cwd) {
- String fn = filename;
-
- if (fn == null)
- return null;
- if (!fn.endsWith("." + fileExtension)) {
- fn += "." + fileExtension;
- }
-
- MyModelPersistenceHandler persistenceHandler = createMyModelPersistenceHandler(resourceSetProvider
- .get());
- return (FModel) persistenceHandler.loadModel(fn, cwd);
- }
-
- private MyModelPersistenceHandler createMyModelPersistenceHandler(
- ResourceSet resourceSet) {
- MyModelPersistenceHandler.registerFileExtensionHandler(fileExtension,
- new FrancaImportsProvider());
-
- MyModelPersistenceHandler persistenceHandler = new MyModelPersistenceHandler(
- resourceSet);
- return persistenceHandler;
- }
-}
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/MyModelPersistenceHandler.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/MyModelPersistenceHandler.java
deleted file mode 100644
index 3ead770..0000000
--- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/MyModelPersistenceHandler.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Copyright (C) 2013 BMW Group
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
- * Author: Juergen Gehring (juergen.gehring@bmw.de)
- * 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/. */
-
-package org.genivi.commonapi.core.generator;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.franca.core.utils.ImportsProvider;
-import org.franca.core.utils.ModelPersistenceHandler;
-
-public class MyModelPersistenceHandler extends ModelPersistenceHandler {
-
- private ResourceSet resourceSet;
-
- private static Map<String, ImportsProvider> fileHandlerRegistry = new HashMap<String, ImportsProvider>();
-
- public MyModelPersistenceHandler(ResourceSet newResourceSet) {
- super(newResourceSet);
- }
-
- public static void registerFileExtensionHandler(String extension,
- ImportsProvider importsProvider) {
- fileHandlerRegistry.put(extension, importsProvider);
- }
-
- @Override
- public EObject loadModel(String filename, String cwd) {
- resourceSet = super.getResourceSet();
- Path p = new Path(filename);
- URI fileURI;
- URI cwdURI;
- if (!p.isAbsolute()) {
- fileURI = normalizeURI(URI.createURI(filename));
- cwdURI = normalizeURI(URI.createURI(cwd));
- } else {
- URI absolutURI = normalizeURI(URI.createURI(filename));
- fileURI = normalizeURI(URI.createURI(absolutURI.lastSegment()));
- cwdURI = normalizeURI(URI.createURI(absolutURI.toString()
- .substring(0, absolutURI.toString().lastIndexOf("/") + 1)));
- }
- Resource resource = null;
-
- if (cwd != null && cwd.length() > 0) {
- resourceSet
- .getURIConverter()
- .getURIMap()
- .put(fileURI,
- URI.createURI((cwdURI.toString() + "/" + fileURI
- .toString()).replaceAll("/+", "/")));
- }
-
- try {
- resource = resourceSet.getResource(fileURI, true);
- resource.load(Collections.EMPTY_MAP);
- } catch (IOException e) {
- e.printStackTrace();
- return null;
- }
- EObject model = resource.getContents().get(0);
-
- for (Iterator<String> it = fileHandlerRegistry.get(
- fileURI.fileExtension()).importsIterator(model); it.hasNext();) {
- String importURI = it.next();
- this.loadModel(importURI, getCWDForImport(fileURI, cwdURI)
- .toString());
- }
- return model;
- }
-}
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/preferences/FPreferences.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/preferences/FPreferences.java
index 598e38a..5a78630 100644
--- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/preferences/FPreferences.java
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/preferences/FPreferences.java
@@ -8,29 +8,27 @@
package org.genivi.commonapi.core.preferences;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
+
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.xtext.generator.IFileSystemAccess;
+import org.eclipse.xtext.generator.OutputConfiguration;
import org.franca.core.franca.FModel;
+
public class FPreferences {
private static FPreferences instance = null;
- private Map<IResource, Map<String, String>> preferences = null;
+ private Map<String, String> preferences = null;
- private FPreferences() {
- preferences = new HashMap<IResource, Map<String, String>>();
+ public Map<String, String> getPreferences() {
+ return preferences;
+ }
+
+ private FPreferences() {
+ preferences = new HashMap<String, String>();
+ clidefPreferences();
}
public void resetPreferences(){
@@ -39,172 +37,115 @@ public class FPreferences {
public static FPreferences getInstance() {
if (instance == null) {
- return instance = new FPreferences();
+ instance = new FPreferences();
}
return instance;
}
- public void clidefPreferences(){
- Map<String, String> map = new HashMap<String, String>();
- if (preferences.get(null) == null) {
- preferences.put(null, map);
- }
+ /**
+ * Apply defaults
+ */
+ private void clidefPreferences(){
- if (!preferences.get(null).containsKey(PreferenceConstants.USEPROJECTSETTINGS)) {
- map.put(PreferenceConstants.USEPROJECTSETTINGS, Boolean.FALSE.toString());
- }
- if (!preferences.get(null).containsKey(PreferenceConstants.P_OUTPUT_PROXIES)) {
- map.put(PreferenceConstants.P_OUTPUT_PROXIES, PreferenceConstants.DEFAULT_OUTPUT);
+ if (!preferences.containsKey(PreferenceConstants.P_OUTPUT_COMMON)) {
+ preferences.put(PreferenceConstants.P_OUTPUT_COMMON, PreferenceConstants.DEFAULT_OUTPUT);
+ }
+ if (!preferences.containsKey(PreferenceConstants.P_OUTPUT_PROXIES)) {
+ preferences.put(PreferenceConstants.P_OUTPUT_PROXIES, PreferenceConstants.DEFAULT_OUTPUT);
}
- if (!preferences.get(null).containsKey(PreferenceConstants.P_OUTPUT_STUBS)) {
- map.put(PreferenceConstants.P_OUTPUT_STUBS, PreferenceConstants.DEFAULT_OUTPUT);
+ if (!preferences.containsKey(PreferenceConstants.P_OUTPUT_STUBS)) {
+ preferences.put(PreferenceConstants.P_OUTPUT_STUBS, PreferenceConstants.DEFAULT_OUTPUT);
}
- if (!preferences.get(null).containsKey(PreferenceConstants.P_LICENSE)) {
- map.put(PreferenceConstants.P_LICENSE, PreferenceConstants.DEFAULT_LICENSE);
+ if (!preferences.containsKey(PreferenceConstants.P_OUTPUT_DEFAULT)) {
+ preferences.put(PreferenceConstants.P_OUTPUT_DEFAULT, PreferenceConstants.DEFAULT_OUTPUT);
+ }
+ if (!preferences.containsKey(PreferenceConstants.P_OUTPUT_SKELETON)) {
+ preferences.put(PreferenceConstants.P_OUTPUT_SKELETON, PreferenceConstants.DEFAULT_OUTPUT);
+ }
+
+ if (!preferences.containsKey(PreferenceConstants.P_LICENSE)) {
+ preferences.put(PreferenceConstants.P_LICENSE, PreferenceConstants.DEFAULT_LICENSE);
}
- if (!preferences.get(null).containsKey(PreferenceConstants.P_GENERATESTUB)) {
- map.put(PreferenceConstants.P_GENERATESTUB, Boolean.TRUE.toString());
+ if (!preferences.containsKey(PreferenceConstants.P_GENERATESTUB)) {
+ preferences.put(PreferenceConstants.P_GENERATESTUB, "true");
}
- if (!preferences.get(null).containsKey(PreferenceConstants.P_GENERATEPROXY)) {
- map.put(PreferenceConstants.P_GENERATEPROXY, Boolean.TRUE.toString());
+ if (!preferences.containsKey(PreferenceConstants.P_GENERATEPROXY)) {
+ preferences.put(PreferenceConstants.P_GENERATEPROXY, "true");
}
- map.putAll(preferences.get(null));
- preferences.put(null, map);
- }
-
- public void addPreferences(IResource res) {
- Map<String, String> map = new HashMap<String, String>();
-
- if (res != null) {
- try {
- QualifiedName useProjectSettingsIdentifier = new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.USEPROJECTSETTINGS);
- map.put(PreferenceConstants.USEPROJECTSETTINGS, res.getPersistentProperty(useProjectSettingsIdentifier));
-
- QualifiedName outputPathIdentifier = new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_OUTPUT_PROXIES);
- map.put(PreferenceConstants.P_OUTPUT_PROXIES, res.getPersistentProperty(outputPathIdentifier));
-
- QualifiedName outputPathStubsIdentifier = new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_OUTPUT_STUBS);
- map.put(PreferenceConstants.P_OUTPUT_STUBS, res.getPersistentProperty(outputPathStubsIdentifier));
-
- QualifiedName licenseIdentifier = new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_LICENSE);
- map.put(PreferenceConstants.P_LICENSE, res.getPersistentProperty(licenseIdentifier));
-
- QualifiedName generateStubsIdentifier = new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_GENERATESTUB);
- map.put(PreferenceConstants.P_GENERATESTUB, res.getPersistentProperty(generateStubsIdentifier));
-
- QualifiedName generateProxiesIdentifier = new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.P_GENERATEPROXY);
- map.put(PreferenceConstants.P_GENERATEPROXY, res.getPersistentProperty(generateProxiesIdentifier));
-
- } catch (CoreException e) {
- e.printStackTrace();
- }
-
- } else {
- clidefPreferences();
+ if (!preferences.containsKey(PreferenceConstants.P_SKELETONPOSTFIX)) {
+ preferences.put(PreferenceConstants.P_SKELETONPOSTFIX, "Default");
}
- preferences.put(res, map);
- }
-
- public String getPreference(IResource res, String preferencename, String defaultValue) {
- Map<String, String> map = getPreferencesForResource(res);
- if (map != null
- && map.get(preferencename) != null
- && map.get(PreferenceConstants.USEPROJECTSETTINGS).equals(Boolean.TRUE.toString())) {
- return map.get(preferencename);
+ if (!preferences.containsKey(PreferenceConstants.P_GENERATESKELETON)) {
+ preferences.put(PreferenceConstants.P_GENERATESKELETON, "false");
}
- if (res instanceof IFile) {
- return getPreference(res.getProject(), preferencename, defaultValue);
+ if (!preferences.containsKey(PreferenceConstants.P_LOGOUTPUT)) {
+ preferences.put(PreferenceConstants.P_LOGOUTPUT, "true");
}
- return defaultValue;
- }
-
- public boolean useModelSpecific(IResource res) {
- Map<String, String> map = getPreferencesForResource(res);
- return map.get(PreferenceConstants.USEPROJECTSETTINGS) != null
- && map.get(PreferenceConstants.USEPROJECTSETTINGS).equals(Boolean.TRUE.toString());
- }
-
- private Map<String, String> getPreferencesForResource(IResource res) {
- return preferences.get(res);
- }
-
- public void setPreferences(String name, File file) throws IOException {
- Reader r = null;
- try {
- r = new FileReader(file);
- setPreference(name, r, "");
- } finally {
- try {
- r.close();
- } catch (IOException e) {
- }
+ if (!preferences.containsKey(PreferenceConstants.P_ENUMPREFIX)) {
+ preferences.put(PreferenceConstants.P_ENUMPREFIX, "");
}
+
}
- public void setPreference(String name, String preference) {
- if(preferences.get(null) == null) {
- preferences.put(null, new HashMap<String, String>());
- }
- preferences.get(null).put(name, preference);
+ public String getPreference(String preferencename, String defaultValue) {
+
+ if (preferences.containsKey(preferencename)) {
+ return preferences.get(preferencename);
+ }
+ System.err.println("Unknown preference " + preferencename);
+ return "";
}
- public void setPreference(String name, Reader inreader, String path) throws IOException {
- BufferedReader reader = new BufferedReader(inreader);
- StringBuilder builder = new StringBuilder();
- String line = "";
- while ((line = reader.readLine()) != null) {
- builder.append(line + "\n");
+ public void setPreference(String name, String value) {
+ if(preferences != null) {
+ preferences.put(name, value);
}
- if (preferences.get(null) == null)
- preferences.put(null, new HashMap<String, String>());
- preferences.get(null).put(name, builder.toString());
}
public String getModelPath(FModel model) {
String ret = model.eResource().getURI().toString();
return ret;
}
-
- public static void init(IPreferenceStore store, IPreferenceStore defaultstore, IProject project) {
- if (instance == null) {
- instance = new FPreferences();
- }
- String useProjectSettingsString = store.getString(PreferenceConstants.USEPROJECTSETTINGS);
- boolean useProjectSettings = useProjectSettingsString.equals(Boolean.toString(true));
- if (useProjectSettings) {
- if (instance.preferences.get(project) == null) {
- instance.preferences.put(project, new HashMap<String, String>());
- }
- instance.preferences.get(project).put(PreferenceConstants.USEPROJECTSETTINGS, Boolean.toString(true));
-
- String outputFolderProxies = store.getString(PreferenceConstants.P_OUTPUT_PROXIES);
- instance.preferences.get(project).put(PreferenceConstants.P_OUTPUT_PROXIES, outputFolderProxies);
-
- String outputFolderStubs = store.getString(PreferenceConstants.P_OUTPUT_STUBS);
- instance.preferences.get(project).put(PreferenceConstants.P_OUTPUT_STUBS, outputFolderStubs);
-
- String licenseHeader = store.getString(PreferenceConstants.P_LICENSE);
- instance.preferences.get(project).put(PreferenceConstants.P_LICENSE, licenseHeader);
-
- String generateProxy = store.getString(PreferenceConstants.P_GENERATEPROXY);
- instance.preferences.get(project).put(PreferenceConstants.P_GENERATEPROXY, generateProxy);
-
- String generatStub = store.getString(PreferenceConstants.P_GENERATESTUB);
- instance.preferences.get(project).put(PreferenceConstants.P_GENERATESTUB, generatStub);
- } else {
- if (instance.preferences.get(project) == null) {
- instance.preferences.put(project, new HashMap<String, String>());
- }
- instance.preferences.get(project).put(PreferenceConstants.P_OUTPUT_PROXIES,
- defaultstore.getString(PreferenceConstants.P_OUTPUT_PROXIES));
- instance.preferences.get(project).put(PreferenceConstants.P_OUTPUT_STUBS,
- defaultstore.getString(PreferenceConstants.P_OUTPUT_STUBS));
- instance.preferences.get(project).put(PreferenceConstants.P_LICENSE,
- defaultstore.getString(PreferenceConstants.P_LICENSE));
- instance.preferences.get(project).put(PreferenceConstants.P_GENERATEPROXY,
- defaultstore.getString(PreferenceConstants.P_GENERATEPROXY));
- instance.preferences.get(project).put(PreferenceConstants.P_GENERATESTUB,
- defaultstore.getString(PreferenceConstants.P_GENERATESTUB));
- }
+
+ /**
+ * Set the output path configurations (based on stored preference values) for file system access used in the generator.
+ * @return the map of output configurations
+ */
+ public HashMap<String, OutputConfiguration> getOutputpathConfiguration() {
+
+ String defaultDir = getPreference(PreferenceConstants.P_OUTPUT_DEFAULT, PreferenceConstants.DEFAULT_OUTPUT);
+ String outputCommonDir = getPreference(PreferenceConstants.P_OUTPUT_COMMON, defaultDir);
+ String outputProxyDir = getPreference(PreferenceConstants.P_OUTPUT_PROXIES, defaultDir);
+ String outputStubDir = getPreference(PreferenceConstants.P_OUTPUT_STUBS, defaultDir);
+ String outputSkelDir = getPreference(PreferenceConstants.P_OUTPUT_SKELETON, defaultDir);
+
+ // the map of output directory configurations
+ HashMap<String, OutputConfiguration> outputs = new HashMap<String, OutputConfiguration> ();
+
+ OutputConfiguration commonOutput = new OutputConfiguration(PreferenceConstants.P_OUTPUT_COMMON);
+ commonOutput.setDescription("Common Output Folder");
+ commonOutput.setOutputDirectory(outputCommonDir);
+ commonOutput.setCreateOutputDirectory(true);
+ outputs.put(IFileSystemAccess.DEFAULT_OUTPUT, commonOutput);
+
+ OutputConfiguration proxyOutput = new OutputConfiguration(PreferenceConstants.P_OUTPUT_PROXIES);
+ proxyOutput.setDescription("Proxy Output Folder");
+ proxyOutput.setOutputDirectory(outputProxyDir);
+ proxyOutput.setCreateOutputDirectory(true);
+ outputs.put(PreferenceConstants.P_OUTPUT_PROXIES, proxyOutput);
+
+ OutputConfiguration stubOutput = new OutputConfiguration(PreferenceConstants.P_OUTPUT_STUBS);
+ stubOutput.setDescription("Stub Output Folder");
+ stubOutput.setOutputDirectory(outputStubDir);
+ stubOutput.setCreateOutputDirectory(true);
+ outputs.put(PreferenceConstants.P_OUTPUT_STUBS, stubOutput);
+
+ OutputConfiguration skelOutput = new OutputConfiguration(PreferenceConstants.P_OUTPUT_SKELETON);
+ skelOutput.setDescription("Skeleton Output Folder");
+ skelOutput.setOutputDirectory(outputSkelDir);
+ skelOutput.setCreateOutputDirectory(true);
+ outputs.put(PreferenceConstants.P_OUTPUT_SKELETON, skelOutput);
+
+ return outputs;
}
}
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/preferences/PreferenceConstants.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/preferences/PreferenceConstants.java
index ef8af66..74dc942 100644
--- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/preferences/PreferenceConstants.java
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/preferences/PreferenceConstants.java
@@ -11,20 +11,32 @@ package org.genivi.commonapi.core.preferences;
/**
* Constant definitions for plug-in preferences
*/
-public class PreferenceConstants
+public interface PreferenceConstants
{
public static final String SCOPE = "org.genivi.commonapi.core.ui";
+ public static final String PROJECT_PAGEID = "org.genivi.commonapi.core.ui.preferences.CommonAPIPreferencePage";
+
+ // preference keys
public static final String P_LICENSE = "licenseHeader";
public static final String P_OUTPUT_PROXIES = "outputDirProxies";
public static final String P_OUTPUT_STUBS = "outputDirStubs";
- public static final String USEPROJECTSETTINGS = "useProjectSettings";
- public static final String DEFAULT_OUTPUT = "./src-gen/";
- public static final String DEFAULT_LICENSE = "This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.\n"
- + "If a copy of the MPL was not distributed with this file, You can obtain one at\n"
- + "http://mozilla.org/MPL/2.0/.";
+ public static final String P_OUTPUT_COMMON = "outputDirCommon";
+ public static final String P_OUTPUT_SKELETON = "outputDirSkeleton";
+ public static final String P_OUTPUT_DEFAULT = "outputDirDefault";
public static final String P_GENERATEPROXY = "generateproxy";
public static final String P_GENERATESTUB = "generatestub";
- public static final String PROJECT_PAGEID = "org.genivi.commonapi.core.ui.preferences.CommonAPIPreferencePage";
- public static final String FRANCA_VERSION = "francaversion";
- public static final String CORE_VERSION = "coreversion";
+ public static final String P_GENERATESKELETON = "generateskeleton";
+ public static final String P_LOGOUTPUT = "logoutput";
+ public static final String P_ENUMPREFIX = "enumprefix";
+ public static final String P_SKELETONPOSTFIX = "skeletonpostfix";
+ public static final String P_USEPROJECTSETTINGS = "useProjectSettings";
+
+ // preference values
+ public static final String DEFAULT_OUTPUT = "./src-gen/";
+ public static final String LOGLEVEL_QUIET = "quiet";
+ public static final String LOGLEVEL_VERBOSE = "verbose";
+ public static final String DEFAULT_LICENSE = "This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.\n"
+ + "If a copy of the MPL was not distributed with this file, You can obtain one at\n"
+ + "http://mozilla.org/MPL/2.0/.";
+ public static final String DEFAULT_SKELETONPOSTFIX = "Default";
}
diff --git a/org.genivi.commonapi.core.validator/src/org/genivi/commonapi/core/validator/CppKeywords.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/CppKeywords.java
index 155387a..de5c0a2 100644
--- a/org.genivi.commonapi.core.validator/src/org/genivi/commonapi/core/validator/CppKeywords.java
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/CppKeywords.java
@@ -5,7 +5,7 @@
* 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/. */
-package org.genivi.commonapi.core.validator;
+package org.genivi.commonapi.core.verification;
import java.util.ArrayList;
import java.util.List;
diff --git a/org.genivi.commonapi.core.validator/src/org/genivi/commonapi/core/validator/ValidatorCore.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/ValidatorCore.java
index 67338cf..0f4eb4c 100644
--- a/org.genivi.commonapi.core.validator/src/org/genivi/commonapi/core/validator/ValidatorCore.java
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/ValidatorCore.java
@@ -1,3 +1,4 @@
+package org.genivi.commonapi.core.verification;
/* Copyright (C) 2013 BMW Group
* Author: Manfred Bathelt (manfred.bathelt@bmw.de)
* Author: Juergen Gehring (juergen.gehring@bmw.de)
@@ -5,7 +6,7 @@
* 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/. */
-package org.genivi.commonapi.core.validator;
+
import java.io.IOException;
import java.util.ArrayList;
@@ -13,12 +14,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import java.util.Map.Entry;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
@@ -42,33 +38,27 @@ import org.franca.core.franca.FStructType;
import org.franca.core.franca.FType;
import org.franca.core.franca.FTypeCollection;
import org.franca.core.franca.FrancaPackage;
-import org.franca.core.franca.Import;
-import org.genivi.commonapi.core.ui.CommonApiUiPlugin;
-import org.genivi.commonapi.core.validator.preferencepage.ValidatorCorePreferencesPage;
import org.osgi.framework.BundleReference;
import org.osgi.framework.Version;
+/**
+ * This validator is used with the command line environment (it is not automatically triggered from the XText editor).
+ * It is meant to be called before the actual code generation. The code generation may not be executed if this
+ * validator detects errors.
+ *
+ */
public class ValidatorCore implements IFrancaExternalValidator {
- private CppKeywords cppKeywords = new CppKeywords();
+ private CppKeywords cppKeywords = new CppKeywords();
private HashMap<String, HashSet<String>> importList = new HashMap<String, HashSet<String>>();
- private Boolean hasChanged = false;
- private ResourceSet resourceSet;
+ protected ResourceSet resourceSet = new ResourceSetImpl();
@Override
public void validateModel(FModel model,
ValidationMessageAcceptor messageAcceptor) {
- if (!isValidatorEnabled()) {
- return;
- }
- resourceSet = new ResourceSetImpl();
- Resource res = model.eResource();
- final Path platformPath = new Path(res.getURI().toPlatformString(true));
- final IFile file = ResourcesPlugin.getWorkspace().getRoot()
- .getFile(platformPath);
- IPath filePath = file.getLocation();
- String cwd = filePath.removeLastSegments(1).toString();
- validateImport(model, messageAcceptor, file, filePath, cwd);
+
+ acceptInfo("model " + model.getName(), messageAcceptor);
+
List<String> interfaceTypecollectionNames = new ArrayList<String>();
for (FTypeCollection fTypeCollection : model.getTypeCollections()) {
interfaceTypecollectionNames.add(fTypeCollection.getName());
@@ -97,13 +87,18 @@ public class ValidatorCore implements IFrancaExternalValidator {
importList.clear();
}
- private void validateManagedInterfaces(
- ValidationMessageAcceptor messageAcceptor, FInterface fInterface) {
+ protected void validateManagedInterfaces(ValidationMessageAcceptor messageAcceptor, FInterface fInterface) {
ArrayList<FInterface> startI = new ArrayList<FInterface>();
int index = 0;
startI.add(fInterface);
ArrayList<FInterface> managedList = new ArrayList<FInterface>();
for (FInterface managedInterface : fInterface.getManagedInterfaces()) {
+ if(managedInterface.getName() == null) {
+ acceptError("unknown managed interface: " + managedInterface.getName(), fInterface,
+ FrancaPackage.Literals.FINTERFACE__MANAGED_INTERFACES, index, messageAcceptor);
+ } else {
+ acceptInfo("managed interface: " + managedInterface.getName(), messageAcceptor);
+ }
findCyclicManagedInterfaces(managedInterface, startI, fInterface,
messageAcceptor, index, false);
if (managedList.contains(managedInterface))
@@ -155,112 +150,67 @@ public class ValidatorCore implements IFrancaExternalValidator {
}
}
- private void validateImport(FModel model,
- ValidationMessageAcceptor messageAcceptor, final IFile file,
- IPath filePath, String cwd) {
- HashSet<String> importedFiles = new HashSet<String>();
- ArrayList<String> importUriAndNamesspace = new ArrayList<String>();
- for (Import fImport : model.getImports()) {
-
- if (importUriAndNamesspace.contains(fImport.getImportURI() + ","
- + fImport.getImportedNamespace()))
- acceptWarning("Multiple times imported!", fImport,
- FrancaPackage.Literals.IMPORT__IMPORT_URI, -1,
- messageAcceptor);
- if (fImport.getImportURI().equals(file.getName())) {
- acceptError("Class may not import itself!", fImport,
- FrancaPackage.Literals.IMPORT__IMPORT_URI, -1,
- messageAcceptor);
- } else {
- Path absoluteImportPath = new Path(fImport.getImportURI());
- if (!absoluteImportPath.isAbsolute()) {
- absoluteImportPath = new Path(cwd + "/"
- + fImport.getImportURI());
- importedFiles.add(absoluteImportPath.toString());
- } else {
- importedFiles.add(absoluteImportPath.toString()
- .replaceFirst(absoluteImportPath.getDevice() + "/",
- ""));
- }
-
- }
- importUriAndNamesspace.add(fImport.getImportURI() + ","
- + fImport.getImportedNamespace());
- }
- importUriAndNamesspace.clear();
- importList.put(filePath.toString(), importedFiles);
-
- ArrayList<String> start = new ArrayList<String>();
- try {
- importList = buildImportList(importList);
- } catch (NullPointerException e) {
- }
- start.add(filePath.toString());
- for (Import fImport : model.getImports()) {
- Path importPath = new Path(fImport.getImportURI());
- if (importPath.isAbsolute()) {
- findCyclicImports(
- importPath.toString().replaceFirst(
- importPath.getDevice() + "/", ""),
- filePath.toString(), start, fImport, messageAcceptor);
- } else {
- importPath = new Path(cwd + "/" + fImport.getImportURI());
- findCyclicImports(importPath.toString(), filePath.toString(),
- start, fImport, messageAcceptor);
- }
- }
- start.clear();
- }
-
- private HashMap<String, HashSet<String>> buildImportList(
- HashMap<String, HashSet<String>> rekImportList) {
- HashMap<String, HashSet<String>> helpMap = new HashMap<String, HashSet<String>>();
- for (Entry<String, HashSet<String>> entry : rekImportList.entrySet()) {
- for (String importedPath : entry.getValue()) {
- if (!rekImportList.containsKey(importedPath)) {
- hasChanged = true;
- HashSet<String> importedFIDL = new HashSet<String>();
- EObject resource = null;
- resource = buildResource(
- importedPath.substring(
- importedPath.lastIndexOf("/") + 1,
- importedPath.length()),
- "file:/"
- + importedPath.substring(0,
- importedPath.lastIndexOf("/") + 1));
- for (EObject imp : resource.eContents()) {
- if (imp instanceof Import) {
- Path importImportedPath = new Path(
- ((Import) imp).getImportURI());
- if (importImportedPath.isAbsolute()) {
- importedFIDL.add(importImportedPath.toString()
- .replaceFirst(
- importImportedPath.getDevice()
- + "/", ""));
- } else {
- importImportedPath = new Path(
- importedPath.substring(0,
- importedPath.lastIndexOf("/"))
- + "/"
- + ((Import) imp).getImportURI());
- importedFIDL.add(importImportedPath.toString());
- }
- }
- }
- helpMap.put(importedPath, importedFIDL);
- }
- }
- }
- if (hasChanged) {
- hasChanged = false;
- helpMap.putAll(rekImportList);
- return buildImportList(helpMap);
- } else {
- return rekImportList;
- }
- }
-
- private EObject buildResource(String filename, String cwd) {
+ // TODO: use it without workspace context
+// private void validateImport(FModel model,
+// ValidationMessageAcceptor messageAcceptor, final IFile file,
+// IPath filePath, String cwd) {
+// HashSet<String> importedFiles = new HashSet<String>();
+// ArrayList<String> importUriAndNamesspace = new ArrayList<String>();
+// for (Import fImport : model.getImports()) {
+// acceptInfo("validateImport: " + fImport.getImportedNamespace());
+// if (importUriAndNamesspace.contains(fImport.getImportURI() + ","
+// + fImport.getImportedNamespace()))
+// acceptWarning("Multiple times imported!", fImport,
+// FrancaPackage.Literals.IMPORT__IMPORT_URI, -1,
+// messageAcceptor);
+// if (fImport.getImportURI().equals(file.getName())) {
+// acceptError("Class may not import itself!", fImport,
+// FrancaPackage.Literals.IMPORT__IMPORT_URI, -1,
+// messageAcceptor);
+// } else {
+// Path absoluteImportPath = new Path(fImport.getImportURI());
+// if (!absoluteImportPath.isAbsolute()) {
+// absoluteImportPath = new Path(cwd + "/"
+// + fImport.getImportURI());
+// importedFiles.add(absoluteImportPath.toString());
+// } else {
+// importedFiles.add(absoluteImportPath.toString()
+// .replaceFirst(absoluteImportPath.getDevice() + "/",
+// ""));
+// }
+//
+// }
+// importUriAndNamesspace.add(fImport.getImportURI() + ","
+// + fImport.getImportedNamespace());
+// }
+// importUriAndNamesspace.clear();
+// importList.put(filePath.toString(), importedFiles);
+//
+// ArrayList<String> start = new ArrayList<String>();
+// try {
+// importList = buildImportList(importList);
+// } catch (NullPointerException e) {
+// }
+// start.add(filePath.toString());
+// for (Import fImport : model.getImports()) {
+// Path importPath = new Path(fImport.getImportURI());
+// if (importPath.isAbsolute()) {
+// findCyclicImports(
+// importPath.toString().replaceFirst(
+// importPath.getDevice() + "/", ""),
+// filePath.toString(), start, fImport, messageAcceptor);
+// } else {
+// importPath = new Path(cwd + "/" + fImport.getImportURI());
+// findCyclicImports(importPath.toString(), filePath.toString(),
+// start, fImport, messageAcceptor);
+// }
+// }
+// start.clear();
+// }
+
+
+
+ protected EObject buildResource(String filename, String cwd) {
URI fileURI = normalizeURI(URI.createURI(filename));
URI cwdURI = normalizeURI(URI.createURI(cwd));
Resource resource = null;
@@ -286,17 +236,20 @@ public class ValidatorCore implements IFrancaExternalValidator {
return resource.getContents().get(0);
}
- private static URI normalizeURI(URI path) {
+ protected static URI normalizeURI(URI path) {
if (path.isFile()) {
return URI.createURI(path.toString().replaceAll("\\\\", "/"));
}
return path;
}
- private void validateTypeCollectionName(
+ protected void validateTypeCollectionName(
ValidationMessageAcceptor messageAcceptor,
List<String> interfaceTypecollectionNames,
FTypeCollection fTypeCollection) {
+
+ acceptInfo("type collection: " + fTypeCollection.getName(), messageAcceptor);
+
validateName(messageAcceptor,
fTypeCollection);
if (!isFrancaVersionGreaterThan(0, 8, 9)) {
@@ -310,40 +263,7 @@ public class ValidatorCore implements IFrancaExternalValidator {
}
}
- private void findCyclicImports(String filePath, String prevFilePath,
- ArrayList<String> cyclicList, Import imp,
- ValidationMessageAcceptor messageAcceptor) {
- if (cyclicList.contains(filePath)) {
- String errorString = "";
- for (String impString : cyclicList) {
- errorString = errorString + impString + "->";
- }
- if (prevFilePath.equals(filePath)) {
- if (cyclicList.size() > 1)
- acceptError("Last file imports itself!: " + errorString
- + filePath, imp,
- FrancaPackage.Literals.IMPORT__IMPORT_URI, -1,
- messageAcceptor);
- return;
- } else {
- acceptError("Cyclic Imports: " + errorString + filePath, imp,
- FrancaPackage.Literals.IMPORT__IMPORT_URI, -1,
- messageAcceptor);
- return;
- }
- } else {
- cyclicList.add(filePath);
- if (importList.containsKey(filePath)) {
- for (String importPath : importList.get(filePath)) {
- findCyclicImports(importPath, filePath, cyclicList, imp,
- messageAcceptor);
- }
- }
- cyclicList.remove(cyclicList.size() - 1);
- }
- }
-
- private void validateTypeCollectionElements(
+ protected void validateTypeCollectionElements(
ValidationMessageAcceptor messageAcceptor,
FTypeCollection fTypeCollection) {
for (FType fType : fTypeCollection.getTypes()) {
@@ -364,8 +284,9 @@ public class ValidatorCore implements IFrancaExternalValidator {
}
}
- private void validateFInterfaceElements(
+ protected void validateFInterfaceElements(
ValidationMessageAcceptor messageAcceptor, FInterface fInterface) {
+ acceptInfo("interface elements: " + fInterface.getName(), messageAcceptor);
if (fInterface.getVersion() == null)
acceptError("Missing version! Add: version(major int minor int)",
fInterface, FrancaPackage.Literals.FMODEL_ELEMENT__NAME,
@@ -427,25 +348,22 @@ public class ValidatorCore implements IFrancaExternalValidator {
return false;
}
- public boolean isValidatorEnabled() {
- boolean enabled = CommonApiUiPlugin
- .getDefault()
- .getPreferenceStore()
- .getBoolean(ValidatorCorePreferencesPage.ENABLED_CORE_VALIDATOR);
- return enabled;
- }
-
- private void acceptError(String message, EObject object,
+ protected void acceptError(String message, EObject object,
EStructuralFeature feature, int index,
ValidationMessageAcceptor messageAcceptor) {
- messageAcceptor.acceptError("Core validation: " + message, object,
+ messageAcceptor.acceptError(message, object,
feature, index, null);
}
- private void acceptWarning(String message, EObject object,
+ protected void acceptWarning(String message, EObject object,
EStructuralFeature feature, int index,
ValidationMessageAcceptor messageAcceptor) {
- messageAcceptor.acceptWarning("Core validation: " + message, object,
+ messageAcceptor.acceptWarning(message, object,
feature, index, null);
}
+
+ protected void acceptInfo(String message, ValidationMessageAcceptor messageAcceptor) {
+ messageAcceptor.acceptInfo(message, null, null, 0, null);
+ }
+
}
diff --git a/org.genivi.commonapi.parent.releng/pom.xml b/org.genivi.commonapi.parent.releng/pom.xml
deleted file mode 100644
index fcdf731..0000000
--- a/org.genivi.commonapi.parent.releng/pom.xml
+++ /dev/null
@@ -1,158 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>commonapi</groupId>
- <artifactId>org.genivi.commonapi.parent.releng</artifactId>
- <version>2.1.6-SNAPSHOT</version>
- <packaging>pom</packaging>
- <properties>
- <tycho-version>0.19.0</tycho-version>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <forceContextQualifier>v${maven.build.timestamp}</forceContextQualifier>
- <maven.build.timestamp.format>yyyyMMdd</maven.build.timestamp.format>
- <xtend-version>2.4.3</xtend-version>
- </properties>
-
- <pluginRepositories>
- <pluginRepository>
- <id>sonatype</id>
- <url>http://repository.sonatype.org/content/groups/sonatype-public-grid/</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </pluginRepository>
-<!-- <pluginRepository>
- <id>xtend</id>
- <url>http://build.eclipse.org/common/xtend/maven/</url>
- </pluginRepository> -->
- </pluginRepositories>
-
- <repositories>
- <repository>
- <id>dbus-emf</id>
- <layout>p2</layout>
- <url>http://dbus-emf-model.eclipselabs.org.codespot.com/git/update_site/releases/0.7.8</url>
- </repository>
- <repository>
- <id>eclipse-updates</id>
- <layout>p2</layout>
- <url>http://download.eclipse.org/eclipse/updates/4.3/</url>
- </repository>
- <repository>
- <id>Kepler</id>
- <layout>p2</layout>
- <url>http://download.eclipse.org/releases/kepler</url>
- </repository>
- <repository>
- <id>Franca</id>
- <layout>p2</layout>
- <url>http://franca.eclipselabs.org.codespot.com/git/update_site/releases/0.8.10</url>
- </repository>
- <repository>
- <id>xtext</id>
- <layout>p2</layout>
- <url>http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/</url>
- </repository>
- </repositories>
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-maven-plugin</artifactId>
- <version>${tycho-version}</version>
- <extensions>true</extensions>
- <configuration>
- <environments>
- <environment>
- <os>win32</os>
- <ws>win32</ws>
- <arch>x86</arch>
- </environment>
- <environment>
- <os>win32</os>
- <ws>win32</ws>
- <arch>x86_64</arch>
- </environment>
- <environment>
- <os>linux</os>
- <ws>gtk</ws>
- <arch>x86</arch>
- </environment>
- <environment>
- <os>linux</os>
- <ws>gtk</ws>
- <arch>x86_64</arch>
- </environment>
- </environments>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>target-platform-configuration</artifactId>
- <version>${tycho-version}</version>
- <configuration>
- <target>
- <artifact>
- <groupId>yamaica</groupId>
- <artifactId>org.genivi.commonapi.target</artifactId>
- </artifact>
- </target>
- <environments>
- <environment>
- <os>win32</os>
- <ws>win32</ws>
- <arch>x86</arch>
- </environment>
- <environment>
- <os>win32</os>
- <ws>win32</ws>
- <arch>x86_64</arch>
- </environment>
- <environment>
- <os>linux</os>
- <ws>gtk</ws>
- <arch>x86</arch>
- </environment>
- <environment>
- <os>linux</os>
- <ws>gtk</ws>
- <arch>x86_64</arch>
- </environment>
- </environments>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.9.1</version>
- </plugin>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-versions-plugin</artifactId>
- <version>${tycho-version}</version>
- </plugin>
- <plugin>
- <groupId>org.eclipse.xtend</groupId>
- <artifactId>xtend-maven-plugin</artifactId>
- <version>${xtend-version}</version>
- <executions>
- <execution>
- <goals>
- <goal>compile</goal>
- </goals>
- <configuration>
- <outputDirectory>${basedir}/xtend-gen</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <modules>
- <module>../org.genivi.commonapi.releng</module>
- <module>../../ascgit017.CommonAPI-D-Bus-Tools/org.genivi.commonapi.dbus.releng</module>
- </modules>
-</project> \ No newline at end of file
diff --git a/org.genivi.commonapi.releng/.project b/org.genivi.commonapi.releng/.project
index 16a87f0..99cc852 100644
--- a/org.genivi.commonapi.releng/.project
+++ b/org.genivi.commonapi.releng/.project
@@ -8,4 +8,4 @@
</buildSpec>
<natures>
</natures>
-</projectDescription> \ No newline at end of file
+</projectDescription>
diff --git a/org.genivi.commonapi.releng/pom.xml b/org.genivi.commonapi.releng/pom.xml
index b30458e..9c673fb 100644
--- a/org.genivi.commonapi.releng/pom.xml
+++ b/org.genivi.commonapi.releng/pom.xml
@@ -3,23 +3,103 @@
<modelVersion>4.0.0</modelVersion>
<groupId>commonapi</groupId>
<artifactId>org.genivi.commonapi.releng</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
- <modules>
- <module>../org.genivi.commonapi.core</module>
- <module>../org.genivi.commonapi.core.feature</module>
- <module>../org.genivi.commonapi.core.ui</module>
- <module>../org.genivi.commonapi.core.validator</module>
- <module>../org.genivi.commonapi.core.validator.feature</module>
- <module>../org.genivi.commonapi.updatesite</module>
- <module>../org.genivi.commonapi.target</module>
- <module>../org.genivi.commonapi.cli.product</module>
- <module>../org.genivi.commonapi.core.cli</module>
- <module>../org.genivi.commonapi.core.cli.feature</module>
- </modules>
- <parent>
- <groupId>commonapi</groupId>
- <artifactId>org.genivi.commonapi.parent.releng</artifactId>
- <version>2.1.6-SNAPSHOT</version>
- <relativePath>../org.genivi.commonapi.parent.releng</relativePath>
- </parent>
-</project> \ No newline at end of file
+ <properties>
+ <tycho-version>0.22.0</tycho-version>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <forceContextQualifier>v${maven.build.timestamp}</forceContextQualifier>
+ <maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
+ <xtend-version>2.7.3</xtend-version>
+ </properties>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>sonatype</id>
+ <url>http://repository.sonatype.org/content/groups/sonatype-public-grid/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-maven-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>target-platform-configuration</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <dependency-resolution>
+ <optionalDependencies>ignore</optionalDependencies>
+ </dependency-resolution>
+ <target>
+ <artifact>
+ <groupId>commonapi</groupId>
+ <artifactId>${target.id}</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
+ </artifact>
+ </target>
+ <filters>
+ </filters>
+ <environments>
+ <environment>
+ <os>win32</os>
+ <ws>win32</ws>
+ <arch>x86</arch>
+ </environment>
+ <environment>
+ <os>win32</os>
+ <ws>win32</ws>
+ <arch>x86_64</arch>
+ </environment>
+ <environment>
+ <os>linux</os>
+ <ws>gtk</ws>
+ <arch>x86</arch>
+ </environment>
+ <environment>
+ <os>linux</os>
+ <ws>gtk</ws>
+ <arch>x86_64</arch>
+ </environment>
+ </environments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.9.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-versions-plugin</artifactId>
+ <version>${tycho-version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.xtend</groupId>
+ <artifactId>xtend-maven-plugin</artifactId>
+ <version>${xtend-version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${basedir}/xtend-gen</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/org.genivi.commonapi.target/org.genivi.commonapi.target.target b/org.genivi.commonapi.target/org.genivi.commonapi.target.target
deleted file mode 100644
index 480ce21..0000000
--- a/org.genivi.commonapi.target/org.genivi.commonapi.target.target
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?pde version="3.8"?><target name="Common API" sequenceNumber="22">
-<locations>
-<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
-<unit id="org.eclipse.xtext.sdk.feature.group" version="2.4.3.v201309030823"/>
-<unit id="org.eclipse.cdt.sdk.feature.group" version="8.2.1.201309180223"/>
-<repository location="http://download.eclipse.org/releases/kepler"/>
-</location>
-<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
-<unit id="org.eclipse.platform.sdk" version="4.3.1.M20130911-1000"/>
-<repository location="http://download.eclipse.org/eclipse/updates/4.3/"/>
-</location>
-<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
-<unit id="org.franca.dbus.feature.sdk.feature.group" version="0.8.10.201309262002"/>
-<unit id="org.franca.dbus.feature.feature.group" version="0.8.10.201309262002"/>
-<unit id="org.franca.feature.feature.group" version="0.8.10.201309262002"/>
-<unit id="org.franca.feature.sdk.feature.group" version="0.8.10.201309262002"/>
-<repository location="http://franca.eclipselabs.org.codespot.com/git/update_site/releases/0.8.10"/>
-</location>
-<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
-<unit id="model.emf.dbusxml.feature.feature.group" version="0.7.8.201401151351"/>
-<repository location="http://dbus-emf-model.eclipselabs.org.codespot.com/git/update_site/releases/0.7.8"/>
-</location>
-</locations>
-</target>
diff --git a/org.genivi.commonapi.updatesite/category.xml b/org.genivi.commonapi.updatesite/category.xml
deleted file mode 100644
index a75a139..0000000
--- a/org.genivi.commonapi.updatesite/category.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<site>
- <feature url="features/org.genivi.commonapi.core.validator.feature_2.1.6.qualifier.jar" id="org.genivi.commonapi.core.validator.feature" version="2.1.6.qualifier">
- <category name="GENIVI CommonAPI"/>
- </feature>
- <feature url="features/org.genivi.commonapi.dbus.feature_2.1.6.qualifier.jar" id="org.genivi.commonapi.dbus.feature" version="2.1.6.qualifier">
- <category name="GENIVI CommonAPI"/>
- </feature>
- <feature url="features/org.genivi.commonapi.core.feature_2.1.6.qualifier.jar" id="org.genivi.commonapi.core.feature" version="2.1.6.qualifier">
- <category name="GENIVI CommonAPI"/>
- </feature>
- <feature url="features/org.genivi.commonapi.dbus.validator.feature_2.1.6.qualifier.jar" id="org.genivi.commonapi.dbus.validator.feature" version="2.1.6.qualifier">
- <category name="GENIVI CommonAPI"/>
- </feature>
- <category-def name="GENIVI CommonAPI" label="GENIVI CommonAPI Generators">
- <description>
- The basic generator for all CommonAPI compliant middleware libraries. Creates all source code that needs to adhere the specification. Any specific middleware code is generated by seperate generators, in seperate files.
- </description>
- </category-def>
-</site>