From 6665267741d67500c64d5e792991bbc1c5f861f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Gehring?= Date: Fri, 4 Nov 2016 09:19:27 -0700 Subject: [PATCH] CommonAPI-D-Bus-Tools 3.1.10 --- CHANGES | 10 + INSTALL | 36 +-- .../feature.xml | 2 +- org.genivi.commonapi.dbus.cli.feature/pom.xml | 2 +- .../commonapi_dbus_cli.product | 9 +- org.genivi.commonapi.dbus.cli.product/pom.xml | 2 +- org.genivi.commonapi.dbus.cli/.classpath | 10 +- .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 6 +- org.genivi.commonapi.dbus.cli/pom.xml | 2 +- org.genivi.commonapi.dbus.feature/feature.xml | 2 +- org.genivi.commonapi.dbus.feature/pom.xml | 2 +- org.genivi.commonapi.dbus.releng/pom.xml | 2 +- .../org.genivi.commonapi.dbus.target.target | 3 +- org.genivi.commonapi.dbus.target/pom.xml | 2 +- org.genivi.commonapi.dbus.ui/.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 8 +- org.genivi.commonapi.dbus.ui/pom.xml | 2 +- .../Build CommonAPI-DBus Tools.launch | 1 + .../category.xml | 4 +- org.genivi.commonapi.dbus.updatesite/pom.xml | 2 +- .../feature.xml | 2 +- .../pom.xml | 2 +- .../.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 8 +- org.genivi.commonapi.dbus.validator/pom.xml | 2 +- .../CMakeLists.txt | 8 +- org.genivi.commonapi.dbus/.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 6 +- org.genivi.commonapi.dbus/pom.xml | 2 +- .../dbus/deployment/PropertyAccessor.java | 4 + .../FInterfaceDBusProxyGenerator.xtend | 59 +++- .../FInterfaceDBusStubAdapterGenerator.xtend | 120 ++++++--- .../FrancaDBusGeneratorExtensions.xtend | 10 + org.genivi.commonapi.releng/pom.xml | 8 +- test/src/DemoMainLoop.hpp | 253 ++++++++++++------ 39 files changed, 408 insertions(+), 217 deletions(-) create mode 100644 CHANGES create mode 100644 org.genivi.commonapi.dbus.cli/.settings/org.eclipse.jdt.core.prefs create mode 100644 org.genivi.commonapi.dbus.ui/.settings/org.eclipse.jdt.core.prefs create mode 100644 org.genivi.commonapi.dbus.validator/.settings/org.eclipse.jdt.core.prefs create mode 100644 org.genivi.commonapi.dbus/.settings/org.eclipse.jdt.core.prefs diff --git a/CHANGES b/CHANGES new file mode 100644 index 0000000..c5b77e1 --- /dev/null +++ b/CHANGES @@ -0,0 +1,10 @@ +Changes +======= + +v3.1.10 +- Upgrade to JDK-1.8. +- Moved mutex lock in 'DemoMainLoop::registerWatch' to avoid deadlock. The mutex was moved after registering the file descriptor. Otherwise a deadlock can occur when 'DemoMainLoop::unregisterWatch' is called in parallel. +- Support DBus message type Error. It is now possible to deploy a broadcast with type 'error'. An error broadcast signals an occured error due to a method call and needs an appropriate error name. +- Replace polling mechanism in Windows main-loop. The current polling mechanism of the main-loops is not reliable under Windows. It is replaced with a WSAPoll on the file descriptors instead of WSAWaitForMultipleEvents on wsa events. +- Fix merge of core type deployments to interfaces and type collections. + diff --git a/INSTALL b/INSTALL index 5f871da..305df24 100644 --- a/INSTALL +++ b/INSTALL @@ -1,35 +1 @@ -= IPC CommonAPI D-Bus Tools C++ - -:doctitle: IPC CommonAPI D-Bus Tools C++ -:version: - -== Copyright -Copyright (C) 2015,2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG). -Copyright (C) 2015,2016 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.dbus.releng of your CommonAPI-D-Bus-Tools directory. Then call: ----- -mvn -DCOREPATH= -Dtarget.id=org.genivi.commonapi.dbus.target clean verify ----- -COREPATH is the directory, that contains the target definition folder: org.genivi.commonapi.core.target. - - -After the successful build you will find the commond-line generators archived in org.genivi.commonapi.dbus.cli.product/target/products/commonapi_dbus_generator.zip and the update-sites in org.genivi.commonapi.dbus.updatesite/target. +Please refer to README.md for the installation instructions. diff --git a/org.genivi.commonapi.dbus.cli.feature/feature.xml b/org.genivi.commonapi.dbus.cli.feature/feature.xml index 666f8b5..98d1ded 100644 --- a/org.genivi.commonapi.dbus.cli.feature/feature.xml +++ b/org.genivi.commonapi.dbus.cli.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/org.genivi.commonapi.dbus.cli.feature/pom.xml b/org.genivi.commonapi.dbus.cli.feature/pom.xml index eb6ff9f..1e93fba 100644 --- a/org.genivi.commonapi.dbus.cli.feature/pom.xml +++ b/org.genivi.commonapi.dbus.cli.feature/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.dbus.releng - 3.1.9-SNAPSHOT + 3.1.10-SNAPSHOT ../org.genivi.commonapi.dbus.releng \ No newline at end of file diff --git a/org.genivi.commonapi.dbus.cli.product/commonapi_dbus_cli.product b/org.genivi.commonapi.dbus.cli.product/commonapi_dbus_cli.product index b694407..acc9f7d 100644 --- a/org.genivi.commonapi.dbus.cli.product/commonapi_dbus_cli.product +++ b/org.genivi.commonapi.dbus.cli.product/commonapi_dbus_cli.product @@ -1,13 +1,13 @@ - + - -Dosgi.requiredJavaVersion=1.7 -Xms512m -Xmx512m -XX:PermSize=128m + -Dosgi.requiredJavaVersion=1.8 -Xms512m -Xmx512m -XX:PermSize=128m -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts @@ -23,7 +23,10 @@ - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7 + org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 + org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 + org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 + org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 diff --git a/org.genivi.commonapi.dbus.cli.product/pom.xml b/org.genivi.commonapi.dbus.cli.product/pom.xml index cb4eb03..5911d6c 100644 --- a/org.genivi.commonapi.dbus.cli.product/pom.xml +++ b/org.genivi.commonapi.dbus.cli.product/pom.xml @@ -131,7 +131,7 @@ commonapi org.genivi.commonapi.dbus.releng - 3.1.9-SNAPSHOT + 3.1.10-SNAPSHOT ../org.genivi.commonapi.dbus.releng diff --git a/org.genivi.commonapi.dbus.cli/.classpath b/org.genivi.commonapi.dbus.cli/.classpath index fdae74c..eca7bdb 100644 --- a/org.genivi.commonapi.dbus.cli/.classpath +++ b/org.genivi.commonapi.dbus.cli/.classpath @@ -1,7 +1,7 @@ - - - - - \ No newline at end of file + + + + + diff --git a/org.genivi.commonapi.dbus.cli/.settings/org.eclipse.jdt.core.prefs b/org.genivi.commonapi.dbus.cli/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0c68a61 --- /dev/null +++ b/org.genivi.commonapi.dbus.cli/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/org.genivi.commonapi.dbus.cli/META-INF/MANIFEST.MF b/org.genivi.commonapi.dbus.cli/META-INF/MANIFEST.MF index 331ba1d..8d256bb 100644 --- a/org.genivi.commonapi.dbus.cli/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.dbus.cli/META-INF/MANIFEST.MF @@ -2,14 +2,14 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: commonapi D-Bus generator Console Interface Bundle-SymbolicName: org.genivi.commonapi.dbus.cli;singleton:=true -Bundle-Version: 3.1.9.qualifier +Bundle-Version: 3.1.10.qualifier Bundle-Activator: org.genivi.commonapi.dbus.cli.Activator Require-Bundle: org.eclipse.core.runtime, 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.console, - org.genivi.commonapi.dbus;bundle-version="3.1.9" + org.genivi.commonapi.dbus;bundle-version="3.1.10" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: BMW AG diff --git a/org.genivi.commonapi.dbus.cli/pom.xml b/org.genivi.commonapi.dbus.cli/pom.xml index 1053c15..96ee89a 100644 --- a/org.genivi.commonapi.dbus.cli/pom.xml +++ b/org.genivi.commonapi.dbus.cli/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.dbus.releng - 3.1.9-SNAPSHOT + 3.1.10-SNAPSHOT ../org.genivi.commonapi.dbus.releng \ No newline at end of file diff --git a/org.genivi.commonapi.dbus.feature/feature.xml b/org.genivi.commonapi.dbus.feature/feature.xml index c4f6e51..39bfae4 100644 --- a/org.genivi.commonapi.dbus.feature/feature.xml +++ b/org.genivi.commonapi.dbus.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/org.genivi.commonapi.dbus.feature/pom.xml b/org.genivi.commonapi.dbus.feature/pom.xml index cf2477f..0dc3e22 100644 --- a/org.genivi.commonapi.dbus.feature/pom.xml +++ b/org.genivi.commonapi.dbus.feature/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.dbus.releng - 3.1.9-SNAPSHOT + 3.1.10-SNAPSHOT ../org.genivi.commonapi.dbus.releng diff --git a/org.genivi.commonapi.dbus.releng/pom.xml b/org.genivi.commonapi.dbus.releng/pom.xml index 485ac6a..cb34ef5 100644 --- a/org.genivi.commonapi.dbus.releng/pom.xml +++ b/org.genivi.commonapi.dbus.releng/pom.xml @@ -20,7 +20,7 @@ commonapi org.genivi.commonapi.releng - 3.1.9-SNAPSHOT + 3.1.10-SNAPSHOT ../org.genivi.commonapi.releng diff --git a/org.genivi.commonapi.dbus.target/org.genivi.commonapi.dbus.target.target b/org.genivi.commonapi.dbus.target/org.genivi.commonapi.dbus.target.target index 5bb4306..4d7645b 100644 --- a/org.genivi.commonapi.dbus.target/org.genivi.commonapi.dbus.target.target +++ b/org.genivi.commonapi.dbus.target/org.genivi.commonapi.dbus.target.target @@ -1,5 +1,5 @@ - + @@ -21,4 +21,5 @@ + diff --git a/org.genivi.commonapi.dbus.target/pom.xml b/org.genivi.commonapi.dbus.target/pom.xml index ee92069..58f4389 100644 --- a/org.genivi.commonapi.dbus.target/pom.xml +++ b/org.genivi.commonapi.dbus.target/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.releng - 3.1.9-SNAPSHOT + 3.1.10-SNAPSHOT ../org.genivi.commonapi.releng diff --git a/org.genivi.commonapi.dbus.ui/.classpath b/org.genivi.commonapi.dbus.ui/.classpath index 1fa3e68..eca7bdb 100644 --- a/org.genivi.commonapi.dbus.ui/.classpath +++ b/org.genivi.commonapi.dbus.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/org.genivi.commonapi.dbus.ui/.settings/org.eclipse.jdt.core.prefs b/org.genivi.commonapi.dbus.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0c68a61 --- /dev/null +++ b/org.genivi.commonapi.dbus.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/org.genivi.commonapi.dbus.ui/META-INF/MANIFEST.MF b/org.genivi.commonapi.dbus.ui/META-INF/MANIFEST.MF index d7974a3..2df3a52 100644 --- a/org.genivi.commonapi.dbus.ui/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.dbus.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GENIVI Common API DBus UI Bundle-SymbolicName: org.genivi.commonapi.dbus.ui;singleton:=true -Bundle-Version: 3.1.9.qualifier +Bundle-Version: 3.1.10.qualifier Bundle-Activator: org.genivi.commonapi.dbus.ui.CommonApiDBusUiPlugin Bundle-Vendor: BMW AG Require-Bundle: org.eclipse.ui, @@ -14,11 +14,11 @@ Require-Bundle: org.eclipse.ui, 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", - org.genivi.commonapi.core.ui;bundle-version="3.1.9";visibility:=reexport, - org.genivi.commonapi.dbus;bundle-version="3.1.9";visibility:=reexport, + org.genivi.commonapi.core.ui;bundle-version="3.1.10";visibility:=reexport, + org.genivi.commonapi.dbus;bundle-version="3.1.10";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-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Import-Package: javax.inject Export-Package: org.genivi.commonapi.dbus.ui diff --git a/org.genivi.commonapi.dbus.ui/pom.xml b/org.genivi.commonapi.dbus.ui/pom.xml index ca22d62..ec4a1af 100644 --- a/org.genivi.commonapi.dbus.ui/pom.xml +++ b/org.genivi.commonapi.dbus.ui/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.dbus.releng - 3.1.9-SNAPSHOT + 3.1.10-SNAPSHOT ../org.genivi.commonapi.dbus.releng diff --git a/org.genivi.commonapi.dbus.updatesite/Build CommonAPI-DBus Tools.launch b/org.genivi.commonapi.dbus.updatesite/Build CommonAPI-DBus Tools.launch index e3f4160..b8a23bf 100644 --- a/org.genivi.commonapi.dbus.updatesite/Build CommonAPI-DBus Tools.launch +++ b/org.genivi.commonapi.dbus.updatesite/Build CommonAPI-DBus Tools.launch @@ -15,5 +15,6 @@ + diff --git a/org.genivi.commonapi.dbus.updatesite/category.xml b/org.genivi.commonapi.dbus.updatesite/category.xml index 449ff9e..5864f82 100644 --- a/org.genivi.commonapi.dbus.updatesite/category.xml +++ b/org.genivi.commonapi.dbus.updatesite/category.xml @@ -1,9 +1,9 @@ - + - + diff --git a/org.genivi.commonapi.dbus.updatesite/pom.xml b/org.genivi.commonapi.dbus.updatesite/pom.xml index e44e00d..c80fa6c 100644 --- a/org.genivi.commonapi.dbus.updatesite/pom.xml +++ b/org.genivi.commonapi.dbus.updatesite/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.dbus.releng - 3.1.9-SNAPSHOT + 3.1.10-SNAPSHOT ../org.genivi.commonapi.dbus.releng \ No newline at end of file diff --git a/org.genivi.commonapi.dbus.validator.feature/feature.xml b/org.genivi.commonapi.dbus.validator.feature/feature.xml index 65451c1..c71cf06 100644 --- a/org.genivi.commonapi.dbus.validator.feature/feature.xml +++ b/org.genivi.commonapi.dbus.validator.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/org.genivi.commonapi.dbus.validator.feature/pom.xml b/org.genivi.commonapi.dbus.validator.feature/pom.xml index 05af349..6d2afa6 100644 --- a/org.genivi.commonapi.dbus.validator.feature/pom.xml +++ b/org.genivi.commonapi.dbus.validator.feature/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.dbus.releng - 3.1.9-SNAPSHOT + 3.1.10-SNAPSHOT ../org.genivi.commonapi.dbus.releng \ No newline at end of file diff --git a/org.genivi.commonapi.dbus.validator/.classpath b/org.genivi.commonapi.dbus.validator/.classpath index 1fa3e68..eca7bdb 100644 --- a/org.genivi.commonapi.dbus.validator/.classpath +++ b/org.genivi.commonapi.dbus.validator/.classpath @@ -1,6 +1,6 @@ - + diff --git a/org.genivi.commonapi.dbus.validator/.settings/org.eclipse.jdt.core.prefs b/org.genivi.commonapi.dbus.validator/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0c68a61 --- /dev/null +++ b/org.genivi.commonapi.dbus.validator/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/org.genivi.commonapi.dbus.validator/META-INF/MANIFEST.MF b/org.genivi.commonapi.dbus.validator/META-INF/MANIFEST.MF index 8bdfd0b..a9fbec2 100644 --- a/org.genivi.commonapi.dbus.validator/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.dbus.validator/META-INF/MANIFEST.MF @@ -2,12 +2,12 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Commonapi DBus Validator Bundle-SymbolicName: org.genivi.commonapi.dbus.validator;singleton:=true -Bundle-Version: 3.1.9.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-Version: 3.1.10.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: BMW AG Require-Bundle: 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, org.eclipse.xtext.ui;bundle-version="[2.7.0,3.0.0)";visibility:=reexport, - org.genivi.commonapi.core;bundle-version="3.1.9";visibility:=reexport, - org.genivi.commonapi.dbus.ui;bundle-version="3.1.9";visibility:=reexport + org.genivi.commonapi.core;bundle-version="3.1.10";visibility:=reexport, + org.genivi.commonapi.dbus.ui;bundle-version="3.1.10";visibility:=reexport Export-Package: org.genivi.commonapi.dbus.validator diff --git a/org.genivi.commonapi.dbus.validator/pom.xml b/org.genivi.commonapi.dbus.validator/pom.xml index 4916e32..1df628d 100644 --- a/org.genivi.commonapi.dbus.validator/pom.xml +++ b/org.genivi.commonapi.dbus.validator/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.dbus.releng - 3.1.9-SNAPSHOT + 3.1.10-SNAPSHOT ../org.genivi.commonapi.dbus.releng \ No newline at end of file diff --git a/org.genivi.commonapi.dbus.verification/CMakeLists.txt b/org.genivi.commonapi.dbus.verification/CMakeLists.txt index 901e53f..3c756fa 100644 --- a/org.genivi.commonapi.dbus.verification/CMakeLists.txt +++ b/org.genivi.commonapi.dbus.verification/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT(libdbusglue) SET( ${PROJECT_NAME}_MAJOR_VERSION 3 ) SET( ${PROJECT_NAME}_MINOR_VERSION 1 ) -SET( ${PROJECT_NAME}_PATCH_LEVEL 9 ) +SET( ${PROJECT_NAME}_PATCH_LEVEL 10 ) message("Project name: ${PROJECT_NAME}") @@ -164,8 +164,7 @@ if (MSVC) "src-gen/v1/commonapi/threading/*.cpp" "src-gen/v1/commonapi/performance/primitive/*.cpp" "src-gen/v1/commonapi/performance/complex/*.cpp" - "src-gen/v1/commonapi/stability/sp/*.cpp" - "src-gen/v1/commonapi/multiprocess/bselective/*.cpp") + "src-gen/v1/commonapi/stability/sp/*.cpp") else() # source files file(GLOB GLUE_SRCS "src-gen/v1/commonapi/runtime/*DBus*.cpp" @@ -181,8 +180,7 @@ else() "src-gen/v1/commonapi/threading/*DBus*.cpp" "src-gen/v1/commonapi/performance/primitive/*DBus*.cpp" "src-gen/v1/commonapi/performance/complex/*DBus*.cpp" - "src-gen/v1/commonapi/stability/sp/*DBus*.cpp" - "src-gen/v1/commonapi/multiprocess/bselective/*DBus*.cpp") + "src-gen/v1/commonapi/stability/sp/*DBus*.cpp") endif() # CommonAPI-DBus library diff --git a/org.genivi.commonapi.dbus/.classpath b/org.genivi.commonapi.dbus/.classpath index 751bfd4..bc001b4 100644 --- a/org.genivi.commonapi.dbus/.classpath +++ b/org.genivi.commonapi.dbus/.classpath @@ -1,6 +1,6 @@ - + diff --git a/org.genivi.commonapi.dbus/.settings/org.eclipse.jdt.core.prefs b/org.genivi.commonapi.dbus/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0c68a61 --- /dev/null +++ b/org.genivi.commonapi.dbus/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/org.genivi.commonapi.dbus/META-INF/MANIFEST.MF b/org.genivi.commonapi.dbus/META-INF/MANIFEST.MF index 3196e05..a881bdd 100644 --- a/org.genivi.commonapi.dbus/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.dbus/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GENIVI Common API D-Bus C++ Generator Bundle-Vendor: BMW AG -Bundle-Version: 3.1.9.qualifier +Bundle-Version: 3.1.10.qualifier Bundle-SymbolicName: org.genivi.commonapi.dbus;singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0", @@ -10,9 +10,9 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0", org.eclipse.xtext.util;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.9";visibility:=reexport, + org.genivi.commonapi.core;bundle-version="3.1.10";visibility:=reexport, org.eclipse.core.resources;bundle-version="[3.9.0,4.0.0)" -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Export-Package: org.genivi.commonapi.dbus.generator, org.genivi.commonapi.dbus.preferences, org.genivi.commonapi.dbus.verification diff --git a/org.genivi.commonapi.dbus/pom.xml b/org.genivi.commonapi.dbus/pom.xml index bc8dfe0..5a7f810 100644 --- a/org.genivi.commonapi.dbus/pom.xml +++ b/org.genivi.commonapi.dbus/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.dbus.releng - 3.1.9-SNAPSHOT + 3.1.10-SNAPSHOT ../org.genivi.commonapi.dbus.releng diff --git a/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/deployment/PropertyAccessor.java b/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/deployment/PropertyAccessor.java index 3aafe95..dccfad5 100644 --- a/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/deployment/PropertyAccessor.java +++ b/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/deployment/PropertyAccessor.java @@ -296,5 +296,9 @@ public Boolean getDBusPredefined (FDInterfaceInstance obj) { if (isDBusPredefined == null) isDBusPredefined = false; return isDBusPredefined; } + + public static void BroadcastType() { + throw new UnsupportedOperationException("TODO: auto-generated method stub"); + } } diff --git a/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/generator/FInterfaceDBusProxyGenerator.xtend b/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/generator/FInterfaceDBusProxyGenerator.xtend index e6fc511..229e33c 100644 --- a/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/generator/FInterfaceDBusProxyGenerator.xtend +++ b/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/generator/FInterfaceDBusProxyGenerator.xtend @@ -26,6 +26,7 @@ import org.genivi.commonapi.dbus.preferences.FPreferencesDBus import java.util.List import org.franca.deploymodel.dsl.fDeploy.FDProvider import org.franca.deploymodel.core.FDeployedProvider +import java.util.LinkedList class FInterfaceDBusProxyGenerator { @Inject private extension FrancaGeneratorExtensions @@ -123,7 +124,7 @@ class FInterfaceDBusProxyGenerator { «ENDFOR» «FOR broadcast : fInterface.broadcasts» - virtual «broadcast.generateGetMethodDefinition»; + virtual «broadcast.generateGetMethodDefinition»; «ENDFOR» «FOR method : fInterface.methods» @@ -189,7 +190,13 @@ class FInterfaceDBusProxyGenerator { «ENDFOR» «FOR broadcast : fInterface.broadcasts» - «broadcast.dbusClassName(deploymentAccessor, fInterface)» «broadcast.dbusClassVariableName»; + «IF !broadcast.isErrorType(deploymentAccessor)» + «broadcast.dbusClassName(deploymentAccessor, fInterface)» «broadcast.dbusClassVariableName»; + «ELSE» + + typedef «broadcast.dbusErrorEventClassName(deploymentAccessor, fInterface)» «broadcast.dbusErrorEventTypedefName(deploymentAccessor)»; + «broadcast.dbusErrorEventTypedefName(deploymentAccessor)» «broadcast.dbusClassVariableName»; + «ENDIF» «ENDFOR» «FOR managed : fInterface.managedInterfaces» @@ -248,8 +255,12 @@ class FInterfaceDBusProxyGenerator { «attribute.generateDBusVariableInit(deploymentAccessor, fInterface)» «ENDFOR» «FOR broadcast : fInterface.broadcasts BEFORE ',' SEPARATOR ','» - «broadcast.dbusClassVariableName»(*this, "«broadcast.elementName»", "«broadcast.dbusSignature(deploymentAccessor)»", «broadcast. - getDeployments(fInterface, deploymentAccessor)») + «IF !broadcast.isErrorType(deploymentAccessor)» + «broadcast.dbusClassVariableName»(*this, "«broadcast.elementName»", "«broadcast.dbusSignature(deploymentAccessor)»", «broadcast. + getDeployments(fInterface, deploymentAccessor)») + «ELSE» + «broadcast.dbusClassVariableName»(«broadcast.dbusErrorEventTypedefName(deploymentAccessor)»("«deploymentAccessor.getErrorName(broadcast)»"«IF !broadcast.errorArgs(deploymentAccessor).empty», std::make_tuple(«broadcast.errorArgs(deploymentAccessor).map[getDeploymentRef(it.array, broadcast, fInterface, deploymentAccessor)].join(', ')»)«ENDIF»)) + «ENDIF» «ENDFOR» «FOR managed : fInterface.managedInterfaces BEFORE ',' SEPARATOR ','» «managed.proxyManagerMemberName»(*this, "«managed.fullyQualifiedName».«managed.interfaceVersion»","«managed.fullyQualifiedNameWithVersion»") @@ -275,9 +286,15 @@ class FInterfaceDBusProxyGenerator { «broadcast.generateGetMethodDefinitionWithin(fInterface.dbusProxyClassName)» { return «broadcast.dbusClassVariableName»; } - «ENDFOR» + «ENDFOR» «FOR method : fInterface.methods» + «var errorClasses = new LinkedList()» + «FOR broadcast : fInterface.broadcasts» + «IF broadcast.isErrorType(method, deploymentAccessor)» + «{errorClasses.add('&' + broadcast.dbusClassVariableName);""}» + «ENDIF» + «ENDFOR» «val timeout = method.getTimeout(deploymentAccessor)» «val inParams = method.generateInParams(deploymentAccessor)» «IF generateSyncCalls || method.isFireAndForget» @@ -300,7 +317,8 @@ class FInterfaceDBusProxyGenerator { «IF inParams != ""»«inParams»,«ENDIF» _internalCallStatus«IF method.hasError», deploy_error«ENDIF»«IF outParams != ""», - «outParams»«ENDIF»); + «outParams»«ENDIF»«IF !method.isFireAndForget && !errorClasses.empty», + «'std::make_tuple(' + errorClasses.map[it].join(', ') + ')'»«ENDIF»); «method.generateOutParamsValue(deploymentAccessor)» } «ENDIF» @@ -316,7 +334,8 @@ class FInterfaceDBusProxyGenerator { "«method.dbusInSignature(deploymentAccessor)»", (_info ? _info : «IF timeout != 0»&info«ELSE»&CommonAPI::DBus::defaultCallInfo«ENDIF»), «IF inParams != ""»«inParams»,«ENDIF» - «method.generateCallback(fInterface, deploymentAccessor)»); + «method.generateCallback(fInterface, deploymentAccessor)»«IF !errorClasses.empty», + «'std::make_tuple(' + errorClasses.map[it].join(', ') + ')'»«ENDIF»); } «ENDIF» «ENDFOR» @@ -358,6 +377,12 @@ class FInterfaceDBusProxyGenerator { return classVariableName } + + def private dbusErrorEventTypedefName(FBroadcast fBroadcast, PropertyAccessor deploymentAccessor) { + checkArgument(fBroadcast.isErrorType(deploymentAccessor), 'FBroadcast is no error type: ' + fBroadcast) + + return 'DBus' + fBroadcast.className + } def private dbusProxyHeaderFile(FInterface fInterface) { fInterface.elementName + "DBusProxy.hpp" @@ -381,6 +406,12 @@ class FInterfaceDBusProxyGenerator { def private generateDBusProxyHelperClass(FMethod fMethod, FInterface _interface, PropertyAccessor _accessor) ''' + «var errorEventTypedefs = new LinkedList()» + «FOR broadcast : _interface.broadcasts» + «IF broadcast.isErrorType(fMethod, _accessor)» + «{errorEventTypedefs.add(broadcast.dbusErrorEventTypedefName(_accessor));""}» + «ENDIF» + «ENDFOR» CommonAPI::DBus::DBusProxyHelper< CommonAPI::DBus::DBusSerializableArguments< «FOR a : fMethod.inArgs» @@ -394,7 +425,8 @@ class FInterfaceDBusProxyGenerator { «FOR a : fMethod.outArgs» CommonAPI::Deployable< «a.getTypeName(fMethod, true)»,«a.getDeploymentType(_interface, true)»>«IF a != fMethod.outArgs.last»,«ENDIF» «ENDFOR» - > + >«IF !errorEventTypedefs.empty»,«ENDIF» + «errorEventTypedefs.map[it].join(',\n')» >''' def private dbusClassName(FAttribute fAttribute, PropertyAccessor deploymentAccessor, FInterface fInterface) { @@ -466,6 +498,17 @@ class FInterfaceDBusProxyGenerator { return ret } + + def private dbusErrorEventClassName(FBroadcast fBroadcast, PropertyAccessor deploymentAccessor, FInterface fInterface) { + checkArgument(fBroadcast.isErrorType(deploymentAccessor), 'FBroadcast is no error type: ' + fBroadcast) + + var ret = 'CommonAPI::DBus::DBusErrorEvent<\n' + if (fBroadcast.outArgs.size > 1) { + ret = ret + ' std::tuple< ' + fBroadcast.errorArgs(deploymentAccessor).map[it.getTypeName(fInterface, true)].join(', ') + '>,\n' + ret = ret + ' std::tuple< ' + fBroadcast.errorArgs(deploymentAccessor).map[it.getDeploymentType(fInterface, true)].join(', ') + '>\n' + } + return ret + '>' + } def private generateProxyHelperDeployments(FMethod _method, FInterface _interface, boolean _isAsync, diff --git a/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/generator/FInterfaceDBusStubAdapterGenerator.xtend b/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/generator/FInterfaceDBusStubAdapterGenerator.xtend index 46094ce..bcb8e54 100644 --- a/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/generator/FInterfaceDBusStubAdapterGenerator.xtend +++ b/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/generator/FInterfaceDBusStubAdapterGenerator.xtend @@ -24,6 +24,7 @@ import org.genivi.commonapi.dbus.preferences.FPreferencesDBus import java.util.List import org.franca.deploymodel.dsl.fDeploy.FDProvider import org.franca.deploymodel.core.FDeployedProvider +import java.util.LinkedList class FInterfaceDBusStubAdapterGenerator { @Inject private extension FrancaGeneratorExtensions @@ -120,7 +121,9 @@ class FInterfaceDBusStubAdapterGenerator { void «broadcast.unsubscribeSelectiveMethodName»(const std::shared_ptr clientId); std::shared_ptr const «broadcast.stubAdapterClassSubscribersMethodName»(); «ELSE» - void «broadcast.stubAdapterClassFireEventMethodName»(«broadcast.outArgs.map['const ' + getTypeName(fInterface, true) + '& ' + elementName].join(', ')»); + «IF !broadcast.isErrorType(deploymentAccessor)» + void «broadcast.stubAdapterClassFireEventMethodName»(«broadcast.outArgs.map['const ' + getTypeName(fInterface, true) + '& ' + elementName].join(', ')»); + «ENDIF» «ENDIF» «ENDFOR» @@ -185,7 +188,7 @@ class FInterfaceDBusStubAdapterGenerator { «var counterMap = new HashMap()» «var methodnumberMap = new HashMap()» «FOR method : fInterface.methods» - «generateMethodDispatcherDeclarations(method, fInterface, counterMap, methodnumberMap)» + «generateMethodDispatcherDeclarations(method, fInterface, counterMap, methodnumberMap, deploymentAccessor)» «ENDFOR» «FOR broadcast: fInterface.broadcasts» @@ -262,12 +265,14 @@ class FInterfaceDBusStubAdapterGenerator { «ENDIF» «ENDFOR» «FOR broadcast : fInterface.broadcasts» - «FTypeGenerator::generateComments(broadcast, false)» - "\n" - «FOR outArg : broadcast.outArgs» - "\n" - «ENDFOR» - "\n" + «IF !broadcast.isErrorType(deploymentAccessor)» + «FTypeGenerator::generateComments(broadcast, false)» + "\n" + «FOR outArg : broadcast.outArgs» + "\n" + «ENDFOR» + "\n" + «ENDIF» «ENDFOR» «FOR method : fInterface.methods» «FTypeGenerator::generateComments(method, false)» @@ -410,32 +415,34 @@ class FInterfaceDBusStubAdapterGenerator { return std::make_shared(*«broadcast.stubAdapterClassSubscriberListPropertyName»); } «ELSE» - template - void «fInterface.dbusStubAdapterClassNameInternal»<_Stub, _Stubs...>::«broadcast.stubAdapterClassFireEventMethodName»(«broadcast.outArgs.map['const ' + getTypeName(fInterface, true) + '& ' + elementName].join(', ')») { - CommonAPI::DBus::DBusStubSignalHelper - «ELSE» - «outArg.getTypeName(fInterface, true)» - «ENDIF» - «ENDFOR» - >>::sendSignal( - *this, - "«broadcast.elementName»", - "«broadcast.dbusSignature(deploymentAccessor)»"«IF broadcast.outArgs.size > 0»,«ENDIF» - «FOR outArg : broadcast.outArgs SEPARATOR ","» - «val String deploymentType = outArg.getDeploymentType(fInterface, true)» - «IF deploymentType != "CommonAPI::EmptyDeployment" && deploymentType != ""» - «val String deployment = outArg.getDeploymentRef(outArg.array, broadcast, fInterface, deploymentAccessor)» - CommonAPI::Deployable< «outArg.getTypeName(fInterface, true)», «deploymentType»>(«outArg.name», «deployment») - «ELSE» - «outArg.name» - «ENDIF» - «ENDFOR» - ); - } + «IF !broadcast.isErrorType(deploymentAccessor)» + template + void «fInterface.dbusStubAdapterClassNameInternal»<_Stub, _Stubs...>::«broadcast.stubAdapterClassFireEventMethodName»(«broadcast.outArgs.map['const ' + getTypeName(fInterface, true) + '& ' + elementName].join(', ')») { + CommonAPI::DBus::DBusStubSignalHelper + «ELSE» + «outArg.getTypeName(fInterface, true)» + «ENDIF» + «ENDFOR» + >>::sendSignal( + *this, + "«broadcast.elementName»", + "«broadcast.dbusSignature(deploymentAccessor)»"«IF broadcast.outArgs.size > 0»,«ENDIF» + «FOR outArg : broadcast.outArgs SEPARATOR ","» + «val String deploymentType = outArg.getDeploymentType(fInterface, true)» + «IF deploymentType != "CommonAPI::EmptyDeployment" && deploymentType != ""» + «val String deployment = outArg.getDeploymentRef(outArg.array, broadcast, fInterface, deploymentAccessor)» + CommonAPI::Deployable< «outArg.getTypeName(fInterface, true)», «deploymentType»>(«outArg.name», «deployment») + «ELSE» + «outArg.name» + «ENDIF» + «ENDFOR» + ); + } + «ENDIF» «ENDIF» «ENDFOR» @@ -534,17 +541,25 @@ class FInterfaceDBusStubAdapterGenerator { «ENDIF» ''' - def private generateMethodDispatcherDeclarations(FMethod fMethod, FInterface fInterface, HashMap counterMap, HashMap methodnumberMap) ''' + def private generateMethodDispatcherDeclarations(FMethod fMethod, FInterface fInterface, HashMap counterMap, HashMap methodnumberMap, PropertyAccessor deploymentAccessor) ''' «FTypeGenerator::generateComments(fMethod, false)» «val accessor = getAccessor(fInterface)» - «IF !fMethod.isFireAndForget» + «var errorReplyTypes = new LinkedList()» + «FOR broadcast : fInterface.broadcasts» + «IF broadcast.isErrorType(fMethod, deploymentAccessor)» + «{errorReplyTypes.add(broadcast.errorReplyTypes(fMethod, deploymentAccessor));""}» + «broadcast.generateErrorReplyCallback(fInterface, fMethod, deploymentAccessor)» + «ENDIF» + «ENDFOR» + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< «fInterface.stubFullClassName», std::tuple< «fMethod.allInTypes»>, std::tuple< «fMethod.allOutTypes»>, std::tuple< «fMethod.inArgs.getDeploymentTypes(fInterface, accessor)»>, - std::tuple< «IF fMethod.hasError»«fMethod.getErrorDeploymentType(true)»«ENDIF»«fMethod.outArgs.getDeploymentTypes(fInterface, accessor)»> + std::tuple< «IF fMethod.hasError»«fMethod.getErrorDeploymentType(true)»«ENDIF»«fMethod.outArgs.getDeploymentTypes(fInterface, accessor)»>«IF errorReplyTypes.size > 0»,«ENDIF» + «errorReplyTypes.map['std::function< void (' + it + ')>'].join(',\n')» «IF !(counterMap.containsKey(fMethod.dbusStubDispatcherVariable))» «{counterMap.put(fMethod.dbusStubDispatcherVariable, 0); methodnumberMap.put(fMethod, 0);""}» @@ -622,25 +637,36 @@ class FInterfaceDBusStubAdapterGenerator { «val accessor = getAccessor(fInterface)» «FTypeGenerator::generateComments(fMethod, false)» «IF !fMethod.isFireAndForget» + «var errorReplyTypes = new LinkedList()» + «var errorReplyCallbacks = new LinkedList()» + «FOR broadcast : fInterface.broadcasts» + «IF broadcast.isErrorType(fMethod, deploymentAccessor)» + «{errorReplyTypes.add(broadcast.errorReplyTypes(fMethod, deploymentAccessor));""}» + «{errorReplyCallbacks.add('std::bind(&' + fInterface.dbusStubAdapterClassNameInternal + '<_Stub, _Stubs...>::' + + broadcast.errorReplyCallbackName(deploymentAccessor) + ', ' + broadcast.errorReplyCallbackBindArgs(deploymentAccessor) + ')' + );""}» + «ENDIF» + «ENDFOR» template CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< «fInterface.stubFullClassName», std::tuple< «fMethod.allInTypes»>, std::tuple< «fMethod.allOutTypes»>, std::tuple< «fMethod.inArgs.getDeploymentTypes(fInterface, accessor)»>, - std::tuple< «IF fMethod.hasError»«fMethod.getErrorDeploymentType(true)»«ENDIF»«fMethod.outArgs.getDeploymentTypes(fInterface, accessor)»> + std::tuple< «IF fMethod.hasError»«fMethod.getErrorDeploymentType(true)»«ENDIF»«fMethod.outArgs.getDeploymentTypes(fInterface, accessor)»>«IF errorReplyTypes.size > 0»,«ENDIF» + «errorReplyTypes.map['std::function< void (' + it + ')>'].join(',\n')» «IF !(counterMap.containsKey(fMethod.dbusStubDispatcherVariable))» «{counterMap.put(fMethod.dbusStubDispatcherVariable, 0); methodnumberMap.put(fMethod, 0);""}» > «fInterface.dbusStubAdapterClassNameInternal»<_Stub, _Stubs...>::«fMethod.dbusStubDispatcherVariable»( &«fInterface.stubClassName + "::" + fMethod.elementName», "«fMethod.dbusOutSignature(deploymentAccessor)»", «fMethod.getDeployments(fInterface, accessor, true, false)», - «fMethod.getDeployments(fInterface, accessor, false, true)»); + «fMethod.getDeployments(fInterface, accessor, false, true)»«IF errorReplyCallbacks.size > 0»,«'\n' + errorReplyCallbacks.map[it].join(',\n')»«ENDIF»); «ELSE» «{counterMap.put(fMethod.dbusStubDispatcherVariable, counterMap.get(fMethod.dbusStubDispatcherVariable) + 1); methodnumberMap.put(fMethod, counterMap.get(fMethod.dbusStubDispatcherVariable));""}» > «fInterface.dbusStubAdapterClassNameInternal»<_Stub, _Stubs...>::«fMethod.dbusStubDispatcherVariable»«Integer::toString(counterMap.get(fMethod.dbusStubDispatcherVariable))»(&«fInterface.stubClassName + "::" + fMethod.elementName», "«fMethod.dbusOutSignature(deploymentAccessor)»", «fMethod.getDeployments(fInterface, accessor, true, false)», - «fMethod.getDeployments(fInterface, accessor, false, true)»); + «fMethod.getDeployments(fInterface, accessor, false, true)»«IF errorReplyCallbacks.size > 0»,«'\n' + errorReplyCallbacks.map[it].join(',\n')»«ENDIF»); «ENDIF» «ELSE» template @@ -865,4 +891,18 @@ class FInterfaceDBusStubAdapterGenerator { «IF fAttribute.readonly»(CommonAPI::DBus::DBusSetFreedesktopAttributeStubDispatcher<«fInterface.stubFullClassName», int>*)NULL«ELSE»&«fInterface.absoluteNamespace»::«fInterface.dbusStubAdapterClassNameInternal»<_Stub, _Stubs...>::«fAttribute.dbusSetStubDispatcherVariable»«ENDIF» ); ''' + + def private generateErrorReplyCallback(FBroadcast fBroadcast, FInterface fInterface, FMethod fMethod, PropertyAccessor deploymentAccessor) ''' + + static void «fBroadcast.errorReplyCallbackName(deploymentAccessor)»(«fBroadcast.generateErrorReplyCallbackSignature(fMethod, deploymentAccessor)») { + «IF fBroadcast.errorArgs(deploymentAccessor).size > 1» + auto args = std::make_tuple( + «fBroadcast.errorArgs(deploymentAccessor).map[it.getDeployable(fInterface, deploymentAccessor) + '(' + '_' + it.elementName + ', ' + getDeploymentRef(it.array, fBroadcast, fInterface, deploymentAccessor) + ')'].join(",\n") + ");"» + «ELSE» + auto args = std::make_tuple(); + «ENDIF» + sayHelloStubDispatcher.sendErrorReply(_callId, "«fBroadcast.dbusErrorReplyOutSignature(fMethod, deploymentAccessor)»", _«fBroadcast.errorName(deploymentAccessor)», args); + } + ''' + } diff --git a/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/generator/FrancaDBusGeneratorExtensions.xtend b/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/generator/FrancaDBusGeneratorExtensions.xtend index 12d0ec7..97d0b33 100644 --- a/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/generator/FrancaDBusGeneratorExtensions.xtend +++ b/org.genivi.commonapi.dbus/src/org/genivi/commonapi/dbus/generator/FrancaDBusGeneratorExtensions.xtend @@ -79,6 +79,16 @@ class FrancaDBusGeneratorExtensions { return fMethod.errors.dbusFTypeSignature(deploymentAccessor) } + + def dbusErrorReplyOutSignature(FBroadcast fBroadcast, FMethod fMethod, PropertyAccessor deploymentAccessor) { + checkArgument(fBroadcast.isErrorType(deploymentAccessor), 'FBroadcast is no valid error type: ' + fBroadcast) + + var signature = "s"; + if(!fBroadcast.errorArgs(deploymentAccessor).empty) { + signature = fBroadcast.errorArgs(deploymentAccessor).map[getTypeDbusSignature(deploymentAccessor)].join; + } + return signature + } def dbusSetMethodName(FAttribute fAttribute) { 'set' + fAttribute.className diff --git a/org.genivi.commonapi.releng/pom.xml b/org.genivi.commonapi.releng/pom.xml index 1e046b2..ff92c88 100644 --- a/org.genivi.commonapi.releng/pom.xml +++ b/org.genivi.commonapi.releng/pom.xml @@ -3,7 +3,7 @@ 4.0.0 commonapi org.genivi.commonapi.releng - 3.1.9-SNAPSHOT + 3.1.10-SNAPSHOT pom 0.22.0 @@ -13,7 +13,7 @@ 2.7.3 - + sonatype http://repository.sonatype.org/content/groups/sonatype-public-grid/ @@ -46,7 +46,7 @@ commonapi ${target.id} - 3.1.9-SNAPSHOT + 3.1.10-SNAPSHOT @@ -88,7 +88,7 @@ org.eclipse.xtend xtend-maven-plugin - ${xtend-version} + ${xtend-version} diff --git a/test/src/DemoMainLoop.hpp b/test/src/DemoMainLoop.hpp index 8c189cf..37540a8 100644 --- a/test/src/DemoMainLoop.hpp +++ b/test/src/DemoMainLoop.hpp @@ -29,8 +29,6 @@ namespace CommonAPI { -typedef pollfd DemoMainLoopPollFd; - class MainLoop { public: MainLoop() = delete; @@ -47,10 +45,131 @@ class MainLoop { isBroken_(false) { #ifdef WIN32 - wsaEvents_.push_back(WSACreateEvent()); - if (wsaEvents_[0] == WSA_INVALID_EVENT) { - printf("Invalid Event Created!"); + WSADATA wsaData; + int iResult; + + SOCKET ListenSocket = INVALID_SOCKET; + + struct addrinfo *result = NULL; + struct addrinfo hints; + + // Initialize Winsock + iResult = WSAStartup(MAKEWORD(2, 2), &wsaData); + if (iResult != 0) { + printf("WSAStartup failed with error: %d\n", iResult); + } + + ZeroMemory(&hints, sizeof(hints)); + hints.ai_family = AF_INET; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + hints.ai_flags = AI_PASSIVE; + + // Resolve the server address and port + iResult = getaddrinfo(NULL, "0", &hints, &result); + if (iResult != 0) { + printf("getaddrinfo failed with error: %d\n", iResult); + WSACleanup(); + } + + // Create a SOCKET for connecting to server + ListenSocket = socket(result->ai_family, result->ai_socktype, result->ai_protocol); + if (ListenSocket == INVALID_SOCKET) { + printf("socket failed with error: %ld\n", WSAGetLastError()); + freeaddrinfo(result); + WSACleanup(); + } + + // Setup the TCP listening socket + iResult = bind(ListenSocket, result->ai_addr, (int)result->ai_addrlen); + if (iResult == SOCKET_ERROR) { + printf("bind failed with error: %d\n", WSAGetLastError()); + freeaddrinfo(result); + closesocket(ListenSocket); + WSACleanup(); + } + + sockaddr* connected_addr = new sockaddr(); + USHORT port = 0; + int namelength = sizeof(sockaddr); + iResult = getsockname(ListenSocket, connected_addr, &namelength); + if (iResult == SOCKET_ERROR) { + printf("getsockname failed with error: %d\n", WSAGetLastError()); + } else if (connected_addr->sa_family == AF_INET) { + port = ((struct sockaddr_in*)connected_addr)->sin_port; + } + delete connected_addr; + + freeaddrinfo(result); + + iResult = listen(ListenSocket, SOMAXCONN); + if (iResult == SOCKET_ERROR) { + printf("listen failed with error: %d\n", WSAGetLastError()); + closesocket(ListenSocket); + WSACleanup(); + } + + wsaData; + wakeFd_.fd = INVALID_SOCKET; + struct addrinfo *ptr = NULL; + + // Initialize Winsock + iResult = WSAStartup(MAKEWORD(2, 2), &wsaData); + if (iResult != 0) { + printf("WSAStartup failed with error: %d\n", iResult); + } + + ZeroMemory(&hints, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + + // Resolve the server address and port + iResult = getaddrinfo("127.0.0.1", std::to_string(ntohs(port)).c_str(), &hints, &result); + if (iResult != 0) { + printf("getaddrinfo failed with error: %d\n", iResult); + WSACleanup(); + } + + // Attempt to connect to an address until one succeeds + for (ptr = result; ptr != NULL; ptr = ptr->ai_next) { + + // Create a SOCKET for connecting to server + wakeFd_.fd = socket(ptr->ai_family, ptr->ai_socktype, + ptr->ai_protocol); + if (wakeFd_.fd == INVALID_SOCKET) { + printf("socket failed with error: %ld\n", WSAGetLastError()); + WSACleanup(); + } + + // Connect to server. + iResult = connect(wakeFd_.fd, ptr->ai_addr, (int)ptr->ai_addrlen); + if (iResult == SOCKET_ERROR) { + printf("connect failed with error: %ld\n", WSAGetLastError()); + closesocket(wakeFd_.fd); + wakeFd_.fd = INVALID_SOCKET; + continue; + } + break; + } + + freeaddrinfo(result); + + if (wakeFd_.fd == INVALID_SOCKET) { + printf("Unable to connect to server!\n"); + WSACleanup(); + } + + // Accept a client socket + sendFd_.fd = accept(ListenSocket, NULL, NULL); + if (sendFd_.fd == INVALID_SOCKET) { + printf("accept failed with error: %d\n", WSAGetLastError()); + closesocket(ListenSocket); + WSACleanup(); } + + wakeFd_.events = POLLIN; + registerFileDescriptor(wakeFd_); #else wakeFd_.fd = eventfd(0, EFD_SEMAPHORE | EFD_NONBLOCK); wakeFd_.events = POLLIN; @@ -77,9 +196,7 @@ class MainLoop { } ~MainLoop() { - #ifndef WIN32 unregisterFileDescriptor (wakeFd_); - #endif context_->unsubscribeForDispatchSources( dispatchSourceListenerSubscription_); @@ -87,11 +204,21 @@ class MainLoop { context_->unsubscribeForTimeouts(timeoutSourceListenerSubscription_); context_->unsubscribeForWakeupEvents(wakeupListenerSubscription_); -#ifdef WIN32 - WSACloseEvent(wsaEvents_[0]); -#else - close(wakeFd_.fd); -#endif + #ifdef WIN32 + // shutdown the connection since no more data will be sent + int iResult = shutdown(wakeFd_.fd, SD_SEND); + if (iResult == SOCKET_ERROR) { + printf("shutdown failed with error: %d\n", WSAGetLastError()); + closesocket(wakeFd_.fd); + WSACleanup(); + } + + // cleanup + closesocket(wakeFd_.fd); + WSACleanup(); + #else + close(wakeFd_.fd); + #endif cleanup(); } @@ -323,11 +450,7 @@ class MainLoop { } void poll() { - #ifdef WIN32 int managedFileDescriptorOffset = 0; - #else - int managedFileDescriptorOffset = 1; - #endif { std::lock_guard itsLock(fileDescriptorsMutex_); for (auto fileDescriptor = managedFileDescriptors_.begin() + managedFileDescriptorOffset; fileDescriptor != managedFileDescriptors_.end(); ++fileDescriptor) { @@ -336,24 +459,7 @@ class MainLoop { } #ifdef WIN32 - int numReadyFileDescriptors = 0; - - int errorCode = WSAWaitForMultipleEvents((DWORD)wsaEvents_.size(), wsaEvents_.data(), FALSE, (DWORD)currentMinimalTimeoutInterval_, FALSE); - - if (errorCode == WSA_WAIT_IO_COMPLETION) { - printf("WSAWaitForMultipleEvents failed with error: WSA_WAIT_IO_COMPLETION"); - } - else if (errorCode == WSA_WAIT_FAILED) { - printf("WSAWaitForMultipleEvents failed with error: %ld\n", WSAGetLastError()); - } - else { - for (uint32_t i = 0; i < managedFileDescriptors_.size(); i++) { - if (WaitForSingleObjectEx(wsaEvents_[i + 1], 0, true) != WAIT_TIMEOUT) { - numReadyFileDescriptors++; - managedFileDescriptors_[i].revents = POLLIN; - } - } - } + int numReadyFileDescriptors = WSAPoll(&managedFileDescriptors_[0], managedFileDescriptors_.size(), int(currentMinimalTimeoutInterval_)); #else int numReadyFileDescriptors = ::poll(&(managedFileDescriptors_[0]), managedFileDescriptors_.size(), int(currentMinimalTimeoutInterval_)); @@ -389,23 +495,14 @@ class MainLoop { } } - #ifdef WIN32 - wakeupAck(); - #else // If the wakeup descriptor woke us up, we must acknowledge if (managedFileDescriptors_[0].revents) { wakeupAck(); } - #endif } bool check() { - //The first file descriptor always is the loop's wakeup-descriptor (but not for windows anymore). All others need to be linked to a watch. - #ifdef WIN32 - int managedFileDescriptorOffset = 0; - #else int managedFileDescriptorOffset = 1; - #endif { std::lock_guard itsLock(fileDescriptorsMutex_); for (auto fileDescriptor = managedFileDescriptors_.begin() + managedFileDescriptorOffset; @@ -457,27 +554,41 @@ class MainLoop { void wakeup() { #ifdef WIN32 - if (!WSASetEvent(wsaEvents_[0])) - { - printf("SetEvent failed (%d)\n", GetLastError()); - return; + // Send an initial buffer + char *sendbuf = "1"; + + int iResult = send(sendFd_.fd, sendbuf, (int)strlen(sendbuf), 0); + if (iResult == SOCKET_ERROR) { + int error = WSAGetLastError(); + + if (error != WSANOTINITIALISED) { + printf("send failed with error: %d\n", error); + } } #else int64_t wake = 1; if(::write(wakeFd_.fd, &wake, sizeof(int64_t)) == -1) { - std::perror("VerificationMainLoop::wakeup"); + std::perror("MainLoop::wakeup"); } #endif } void wakeupAck() { #ifdef WIN32 - for (unsigned int i = 0; i < wsaEvents_.size(); i++) { - if (!WSAResetEvent(wsaEvents_[i])) - { - printf("ResetEvent failed (%d)\n", GetLastError()); - return; - } + // Receive until the peer closes the connection + int iResult; + char recvbuf[DEFAULT_BUFLEN]; + int recvbuflen = DEFAULT_BUFLEN; + + iResult = recv(wakeFd_.fd, recvbuf, recvbuflen, 0); + if (iResult > 0) { + //printf("Bytes received from %d: %d\n", wakeFd_.fd, iResult); + } + else if (iResult == 0) { + printf("Connection closed\n"); + } + else { + printf("recv failed with error: %d\n", WSAGetLastError()); } #else int64_t buffer; @@ -616,24 +727,6 @@ class MainLoop { } } -#ifdef WIN32 - void registerEvent( - const HANDLE& wsaEvent) { - wsaEvents_.push_back(wsaEvent); - } - - void unregisterEvent( - const HANDLE& wsaEvent) { - for (auto it = wsaEvents_.begin(); - it != wsaEvents_.end(); it++) { - if ((*it) == wsaEvent) { - wsaEvents_.erase(it); - break; - } - } - } -#endif - void registerDispatchSource(DispatchSource* dispatchSource, const DispatchPriority dispatchPriority) { DispatchSourceToDispatchStruct* dispatchSourceStruct = new DispatchSourceToDispatchStruct(dispatchSource, @@ -663,14 +756,11 @@ class MainLoop { void registerWatch(Watch* watch, const DispatchPriority dispatchPriority) { - std::lock_guard itsLock(watchesMutex_); pollfd fdToRegister = watch->getAssociatedFileDescriptor(); - #ifdef WIN32 - registerEvent(watch->getAssociatedEvent()); - #endif - registerFileDescriptor(fdToRegister); + + std::lock_guard itsLock(watchesMutex_); std::mutex* mtx = new std::mutex; WatchToDispatchStruct* watchStruct = new WatchToDispatchStruct(fdToRegister.fd, watch, mtx, false, false); @@ -681,9 +771,6 @@ class MainLoop { std::lock_guard itsLock(watchesMutex_); unregisterFileDescriptor(watch->getAssociatedFileDescriptor()); - #ifdef WIN32 - unregisterEvent(watch->getAssociatedEvent()); - #endif for (auto watchIterator = registeredWatches_.begin(); watchIterator != registeredWatches_.end(); watchIterator++) { @@ -805,11 +892,11 @@ class MainLoop { bool running_; #ifdef WIN32 - std::vector wsaEvents_; -#else - pollfd wakeFd_; + pollfd sendFd_; #endif + pollfd wakeFd_; + bool isBroken_; std::promise* stopPromise;