add gitattributes and proper crlf handling
authorAleksandar Kanchev <kanchev@itestra.com>
Wed, 13 Feb 2013 11:59:13 +0000 (12:59 +0100)
committerAleksandar Kanchev <kanchev@itestra.com>
Wed, 13 Feb 2013 11:59:13 +0000 (12:59 +0100)
20 files changed:
.gitattributes [new file with mode: 0644]
README.html
src/CommonAPI/DBus/DBusDaemonProxy.cpp
src/CommonAPI/DBus/DBusDaemonProxy.h
src/CommonAPI/DBus/DBusFactory.cpp
src/CommonAPI/DBus/DBusFactory.h
src/CommonAPI/DBus/DBusObjectManager.cpp
src/CommonAPI/DBus/DBusObjectManager.h
src/CommonAPI/DBus/DBusProxyConnection.h
src/CommonAPI/DBus/DBusRuntime.cpp
src/CommonAPI/DBus/DBusRuntime.h
src/CommonAPI/DBus/DBusServiceRegistry.cpp
src/CommonAPI/DBus/DBusServiceRegistry.h
src/CommonAPI/DBus/DBusServiceStatusEvent.h
src/murmurhash/MurmurHash3.cpp
src/murmurhash/MurmurHash3.h
src/test/fakeLegacyService/fake.legacy.service.xml
src/test/test-derived-types.fidl
src/test/test-interface-proxy.fidl
src/test/test-predefined-types.fidl

diff --git a/.gitattributes b/.gitattributes
new file mode 100644 (file)
index 0000000..4f3cc44
--- /dev/null
@@ -0,0 +1,43 @@
+# set default behaviour, in case users don't have core.autocrlf set.
+* text=auto
+
+# Explicitly declare text files we want to always be normalized and converted 
+# to native line endings on checkout.
+*.am text
+*.ac text
+*.m4 text
+*.in text
+
+*.c text
+*.cpp text
+*.h text
+*.hpp text
+
+*.fidl text
+*.java text
+*.xtend text
+
+*.html text
+*.xml text
+
+*.properties text
+
+*.patch text
+
+AUTHORS text
+LICENSE* text
+README text
+
+# Eclipse
+.autotools text
+.cproject text
+.project text
+org.eclipse.core.resources.prefs text
+*.MF text
+
+# Declare files that will always have CRLF line endings on checkout.
+*.sln text eol=crlf
+
+# Denote all files that are truly binary and should not be modified.
+*.png binary
+*.jpg binary
index 825ca85..3da4e2d 100644 (file)
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"\r
-    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\r
-<head>\r
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
-<meta name="generator" content="AsciiDoc 8.4.5" />\r
-<title>GENIVI_CommonAPI-D-Bus</title>\r
-<style type="text/css">\r
-/* Debug borders */\r
-p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {\r
-/*\r
-  border: 1px solid red;\r
-*/\r
-}\r
-\r
-body {\r
-  margin: 1em 5% 1em 5%;\r
-}\r
-\r
-a {\r
-  color: blue;\r
-  text-decoration: underline;\r
-}\r
-a:visited {\r
-  color: fuchsia;\r
-}\r
-\r
-em {\r
-  font-style: italic;\r
-  color: navy;\r
-}\r
-\r
-strong {\r
-  font-weight: bold;\r
-  color: #083194;\r
-}\r
-\r
-tt {\r
-  color: navy;\r
-}\r
-\r
-h1, h2, h3, h4, h5, h6 {\r
-  color: #527bbd;\r
-  font-family: sans-serif;\r
-  margin-top: 1.2em;\r
-  margin-bottom: 0.5em;\r
-  line-height: 1.3;\r
-}\r
-\r
-h1, h2, h3 {\r
-  border-bottom: 2px solid silver;\r
-}\r
-h2 {\r
-  padding-top: 0.5em;\r
-}\r
-h3 {\r
-  float: left;\r
-}\r
-h3 + * {\r
-  clear: left;\r
-}\r
-\r
-div.sectionbody {\r
-  font-family: serif;\r
-  margin-left: 0;\r
-}\r
-\r
-hr {\r
-  border: 1px solid silver;\r
-}\r
-\r
-p {\r
-  margin-top: 0.5em;\r
-  margin-bottom: 0.5em;\r
-}\r
-\r
-ul, ol, li > p {\r
-  margin-top: 0;\r
-}\r
-\r
-pre {\r
-  padding: 0;\r
-  margin: 0;\r
-}\r
-\r
-span#author {\r
-  color: #527bbd;\r
-  font-family: sans-serif;\r
-  font-weight: bold;\r
-  font-size: 1.1em;\r
-}\r
-span#email {\r
-}\r
-span#revnumber, span#revdate, span#revremark {\r
-  font-family: sans-serif;\r
-}\r
-\r
-div#footer {\r
-  font-family: sans-serif;\r
-  font-size: small;\r
-  border-top: 2px solid silver;\r
-  padding-top: 0.5em;\r
-  margin-top: 4.0em;\r
-}\r
-div#footer-text {\r
-  float: left;\r
-  padding-bottom: 0.5em;\r
-}\r
-div#footer-badges {\r
-  float: right;\r
-  padding-bottom: 0.5em;\r
-}\r
-\r
-div#preamble {\r
-  margin-top: 1.5em;\r
-  margin-bottom: 1.5em;\r
-}\r
-div.tableblock, div.imageblock, div.exampleblock, div.verseblock,\r
-div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,\r
-div.admonitionblock {\r
-  margin-top: 1.5em;\r
-  margin-bottom: 1.5em;\r
-}\r
-div.admonitionblock {\r
-  margin-top: 2.5em;\r
-  margin-bottom: 2.5em;\r
-}\r
-\r
-div.content { /* Block element content. */\r
-  padding: 0;\r
-}\r
-\r
-/* Block element titles. */\r
-div.title, caption.title {\r
-  color: #527bbd;\r
-  font-family: sans-serif;\r
-  font-weight: bold;\r
-  text-align: left;\r
-  margin-top: 1.0em;\r
-  margin-bottom: 0.5em;\r
-}\r
-div.title + * {\r
-  margin-top: 0;\r
-}\r
-\r
-td div.title:first-child {\r
-  margin-top: 0.0em;\r
-}\r
-div.content div.title:first-child {\r
-  margin-top: 0.0em;\r
-}\r
-div.content + div.title {\r
-  margin-top: 0.0em;\r
-}\r
-\r
-div.sidebarblock > div.content {\r
-  background: #ffffee;\r
-  border: 1px solid silver;\r
-  padding: 0.5em;\r
-}\r
-\r
-div.listingblock > div.content {\r
-  border: 1px solid silver;\r
-  background: #f4f4f4;\r
-  padding: 0.5em;\r
-}\r
-\r
-div.quoteblock {\r
-  padding-left: 2.0em;\r
-  margin-right: 10%;\r
-}\r
-div.quoteblock > div.attribution {\r
-  padding-top: 0.5em;\r
-  text-align: right;\r
-}\r
-\r
-div.verseblock {\r
-  padding-left: 2.0em;\r
-  margin-right: 10%;\r
-}\r
-div.verseblock > div.content {\r
-  white-space: pre;\r
-}\r
-div.verseblock > div.attribution {\r
-  padding-top: 0.75em;\r
-  text-align: left;\r
-}\r
-/* DEPRECATED: Pre version 8.2.7 verse style literal block. */\r
-div.verseblock + div.attribution {\r
-  text-align: left;\r
-}\r
-\r
-div.admonitionblock .icon {\r
-  vertical-align: top;\r
-  font-size: 1.1em;\r
-  font-weight: bold;\r
-  text-decoration: underline;\r
-  color: #527bbd;\r
-  padding-right: 0.5em;\r
-}\r
-div.admonitionblock td.content {\r
-  padding-left: 0.5em;\r
-  border-left: 2px solid silver;\r
-}\r
-\r
-div.exampleblock > div.content {\r
-  border-left: 2px solid silver;\r
-  padding: 0.5em;\r
-}\r
-\r
-div.imageblock div.content { padding-left: 0; }\r
-span.image img { border-style: none; }\r
-a.image:visited { color: white; }\r
-\r
-dl {\r
-  margin-top: 0.8em;\r
-  margin-bottom: 0.8em;\r
-}\r
-dt {\r
-  margin-top: 0.5em;\r
-  margin-bottom: 0;\r
-  font-style: normal;\r
-  color: navy;\r
-}\r
-dd > *:first-child {\r
-  margin-top: 0.1em;\r
-}\r
-\r
-ul, ol {\r
-    list-style-position: outside;\r
-}\r
-ol.arabic {\r
-  list-style-type: decimal;\r
-}\r
-ol.loweralpha {\r
-  list-style-type: lower-alpha;\r
-}\r
-ol.upperalpha {\r
-  list-style-type: upper-alpha;\r
-}\r
-ol.lowerroman {\r
-  list-style-type: lower-roman;\r
-}\r
-ol.upperroman {\r
-  list-style-type: upper-roman;\r
-}\r
-\r
-div.compact ul, div.compact ol,\r
-div.compact p, div.compact p,\r
-div.compact div, div.compact div {\r
-  margin-top: 0.1em;\r
-  margin-bottom: 0.1em;\r
-}\r
-\r
-div.tableblock > table {\r
-  border: 3px solid #527bbd;\r
-}\r
-thead {\r
-  font-family: sans-serif;\r
-  font-weight: bold;\r
-}\r
-tfoot {\r
-  font-weight: bold;\r
-}\r
-td > div.verse {\r
-  white-space: pre;\r
-}\r
-p.table {\r
-  margin-top: 0;\r
-}\r
-/* Because the table frame attribute is overriden by CSS in most browsers. */\r
-div.tableblock > table[frame="void"] {\r
-  border-style: none;\r
-}\r
-div.tableblock > table[frame="hsides"] {\r
-  border-left-style: none;\r
-  border-right-style: none;\r
-}\r
-div.tableblock > table[frame="vsides"] {\r
-  border-top-style: none;\r
-  border-bottom-style: none;\r
-}\r
-\r
-\r
-div.hdlist {\r
-  margin-top: 0.8em;\r
-  margin-bottom: 0.8em;\r
-}\r
-div.hdlist tr {\r
-  padding-bottom: 15px;\r
-}\r
-dt.hdlist1.strong, td.hdlist1.strong {\r
-  font-weight: bold;\r
-}\r
-td.hdlist1 {\r
-  vertical-align: top;\r
-  font-style: normal;\r
-  padding-right: 0.8em;\r
-  color: navy;\r
-}\r
-td.hdlist2 {\r
-  vertical-align: top;\r
-}\r
-div.hdlist.compact tr {\r
-  margin: 0;\r
-  padding-bottom: 0;\r
-}\r
-\r
-.comment {\r
-  background: yellow;\r
-}\r
-\r
-@media print {\r
-  div#footer-badges { display: none; }\r
-}\r
-\r
-div#toctitle {\r
-  color: #527bbd;\r
-  font-family: sans-serif;\r
-  font-size: 1.1em;\r
-  font-weight: bold;\r
-  margin-top: 1.0em;\r
-  margin-bottom: 0.1em;\r
-}\r
-\r
-div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {\r
-  margin-top: 0;\r
-  margin-bottom: 0;\r
-}\r
-div.toclevel2 {\r
-  margin-left: 2em;\r
-  font-size: 0.9em;\r
-}\r
-div.toclevel3 {\r
-  margin-left: 4em;\r
-  font-size: 0.9em;\r
-}\r
-div.toclevel4 {\r
-  margin-left: 6em;\r
-  font-size: 0.9em;\r
-}\r
-/* Workarounds for IE6's broken and incomplete CSS2. */\r
-\r
-div.sidebar-content {\r
-  background: #ffffee;\r
-  border: 1px solid silver;\r
-  padding: 0.5em;\r
-}\r
-div.sidebar-title, div.image-title {\r
-  color: #527bbd;\r
-  font-family: sans-serif;\r
-  font-weight: bold;\r
-  margin-top: 0.0em;\r
-  margin-bottom: 0.5em;\r
-}\r
-\r
-div.listingblock div.content {\r
-  border: 1px solid silver;\r
-  background: #f4f4f4;\r
-  padding: 0.5em;\r
-}\r
-\r
-div.quoteblock-attribution {\r
-  padding-top: 0.5em;\r
-  text-align: right;\r
-}\r
-\r
-div.verseblock-content {\r
-  white-space: pre;\r
-}\r
-div.verseblock-attribution {\r
-  padding-top: 0.75em;\r
-  text-align: left;\r
-}\r
-\r
-div.exampleblock-content {\r
-  border-left: 2px solid silver;\r
-  padding-left: 0.5em;\r
-}\r
-\r
-/* IE6 sets dynamically generated links as visited. */\r
-div#toc a:visited { color: blue; }\r
-</style>\r
-</head>\r
-<body>\r
-<div id="header">\r
-<h1>GENIVI_CommonAPI-D-Bus</h1>\r
-<span id="author">Juergen Gehring - juergen.gehring@bmw.de, Manfred Bathelt - manfred.bathelt@bmw.de</span><br />\r
-</div>\r
-<h2 id="_copyright">Copyright</h2>\r
-<div class="sectionbody">\r
-<div class="paragraph"><p>Copyright &#169; 2013, GENIVI Alliance, Inc.\r
-Copyright &#169; 2013, BMW AG</p></div>\r
-<div class="paragraph"><p>This file is part of GENIVI Project IPC Common API.</p></div>\r
-<div class="paragraph"><p>Contributions are licensed to the GENIVI Alliance under one or more\r
-Contribution License Agreements or MPL 2.0 .</p></div>\r
-<div class="paragraph"><p>&#169; Copyright\r
-This Source Code Form is subject to the terms of the\r
-Mozilla Public License, v. 2.0. If a  copy of the MPL was not distributed with\r
-this file, You can obtain one at <a href="http://mozilla.org/MPL/2.0/">http://mozilla.org/MPL/2.0/</a>.</p></div>\r
-<div class="paragraph"><p>For further information see <a href="https://collab.genivi.org/wiki/display/genivi/SysInfraEGCommonIDLCommonAPIGuide">https://collab.genivi.org/wiki/display/genivi/SysInfraEGCommonIDLCommonAPIGuide</a></p></div>\r
-</div>\r
-<h2 id="_license">License</h2>\r
-<div class="sectionbody">\r
-<div class="paragraph"><p>This project is licensed under MPL 2.0</p></div>\r
-<div class="paragraph"><p>Contribution is done under GENIVI CLA or MPL2.0.</p></div>\r
-</div>\r
-<h2 id="_version">Version</h2>\r
-<div class="sectionbody">\r
-<div class="paragraph"><p>The current version can be taken from the git.</p></div>\r
-</div>\r
-<h2 id="_common_api_overview">Common API Overview</h2>\r
-<div class="sectionbody">\r
-<div class="paragraph"><p>Common API and its mechanism specific bindings (e.g. Common API D-Bus) provide a set of libraries and tools to work with\r
-RPC communication in a way independent of wich mechanism is used. It consist currently consists of four subprojects:</p></div>\r
-<div class="listingblock">\r
-<div class="content">\r
-<pre><tt>CommonAPI - This is the base C++ library, which provides the application interface for users and can\r
-            load runtime bindings such as dbus.\r
-CommonAPI-Tools - The eclipse based tools for CommonAPI. This is essentially the code generator for\r
-                  Franca -&gt; Common API C++ code.\r
-CommonAPI-D-Bus - This is the D-Bus binding C++ library, which provides the necesary code to communicate\r
-                  over D-Bus. This is invisible to the application code, and simply needs to be linked against.\r
-                  (This is the current package.)\r
-CommonAPI-D-Bus-Tools - The eclipse based tools for CommonAPI D-Bus. This is the code generator for\r
-                        Franca -&gt; Common API D-Bus C++ code.</tt></pre>\r
-</div></div>\r
-</div>\r
-<h2 id="_build_instructions">Build Instructions</h2>\r
-<div class="sectionbody">\r
-<h3 id="_requirements">Requirements</h3><div style="clear:left"></div>\r
-<div class="paragraph"><p>To build this package the CommonAPI library and a version of libdbus patched with the marshaling patch must be available through PkgConfig.</p></div>\r
-<div class="paragraph"><p>Instructions for making a patched version of libdbus available in /usr/local:</p></div>\r
-<div class="listingblock">\r
-<div class="content">\r
-<pre><tt># wget http://dbus.freedesktop.org/releases/dbus/dbus-1.4.16.tar.gz\r
-\r
-# tar -xzf dbus-1.4.16.tar.gz\r
-\r
-# cd dbus-1.4.16\r
-\r
-# patch -p1 &lt; /path/to/dbus-DBusMessage-add-support-for-custom-marshaling.patch\r
-\r
-# ./configure --prefix=/usr/local\r
-\r
-# make -C dbus\r
-\r
-# sudo make -C dbus install\r
-# sudo make install-pkgconfigDATA</tt></pre>\r
-</div></div>\r
-<div class="paragraph"><p>The path to CommonAPI and patched libdbus pkgconfig files must be added to the PKG_CONFIG_PATH for the entire build process.</p></div>\r
-<div class="paragraph"><p>For example, if CommonAPI and patched dbus are available in /usr/local, set the PKG_CONFIG_PATH variable as follows:</p></div>\r
-<div class="listingblock">\r
-<div class="content">\r
-<pre><tt># export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"</tt></pre>\r
-</div></div>\r
-<h3 id="_instructions">Instructions</h3><div style="clear:left"></div>\r
-<div class="paragraph"><p>Use autotools to build this package withthe above requirements available through Pkgconfig :</p></div>\r
-<div class="listingblock">\r
-<div class="content">\r
-<pre><tt># ./autoreconf -i\r
-# ./configure\r
-# make\r
-# sudo make install (or alternative install process, eg. checkinstall on debian-based distributions, such as Ubuntu)</tt></pre>\r
-</div></div>\r
-<div class="paragraph"><p>If the environment variable GTEST_CONFIG is set to the path of the gtest-config script in a Gtest tree test will also be built.</p></div>\r
-</div>\r
-<h2 id="_working_on_the_code_amp_contribution">Working on the code &amp; contribution</h2>\r
-<div class="sectionbody">\r
-<div class="literalblock">\r
-<div class="title">First get the code from the git:</div>\r
-<div class="content">\r
-<pre><tt>git clone</tt></pre>\r
-</div></div>\r
-<div class="literalblock">\r
-<div class="title">Get an overview of all branches:</div>\r
-<div class="content">\r
-<pre><tt>git branch</tt></pre>\r
-</div></div>\r
-<div class="literalblock">\r
-<div class="title">Switch to the branch you want to work on (master is the feature branch) and verify that it has switched (* changed)</div>\r
-<div class="content">\r
-<pre><tt>git checkout &lt;your branch&gt;\r
-git branch</tt></pre>\r
-</div></div>\r
-<div class="literalblock">\r
-<div class="title">Best practice is to create a local branch based on the current branch:</div>\r
-<div class="content">\r
-<pre><tt>git branch working_branch</tt></pre>\r
-</div></div>\r
-<div class="paragraph"><p>Start working, best practice is to commit smaller, compilable pieces during the development process that makes it easier to handle later on.</p></div>\r
-<div class="literalblock">\r
-<div class="title">If you want to commit you changes, send them to the author, you can create a patch like this:</div>\r
-<div class="content">\r
-<pre><tt>git format-patch working_branch &lt;your branch&gt;</tt></pre>\r
-</div></div>\r
-<div class="paragraph"><p>This creates a set of patches that are published via the mailing list.The patches will be discussed and then merged &amp; uploaded on the git by the maintainer.</p></div>\r
-<div class="paragraph"><p>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 <a href="http://gerrit.googlecode.com/svn/documentation/2.0/user-signedoffby.html">http://gerrit.googlecode.com/svn/documentation/2.0/user-signedoffby.html</a></p></div>\r
-</div>\r
-<div id="footer">\r
-<div id="footer-text">\r
-Last updated 2013-01-21 14:49:07 CEST\r
-</div>\r
-</div>\r
-</body>\r
-</html>\r
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta name="generator" content="AsciiDoc 8.4.5" />
+<title>GENIVI_CommonAPI-D-Bus</title>
+<style type="text/css">
+/* Debug borders */
+p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
+/*
+  border: 1px solid red;
+*/
+}
+
+body {
+  margin: 1em 5% 1em 5%;
+}
+
+a {
+  color: blue;
+  text-decoration: underline;
+}
+a:visited {
+  color: fuchsia;
+}
+
+em {
+  font-style: italic;
+  color: navy;
+}
+
+strong {
+  font-weight: bold;
+  color: #083194;
+}
+
+tt {
+  color: navy;
+}
+
+h1, h2, h3, h4, h5, h6 {
+  color: #527bbd;
+  font-family: sans-serif;
+  margin-top: 1.2em;
+  margin-bottom: 0.5em;
+  line-height: 1.3;
+}
+
+h1, h2, h3 {
+  border-bottom: 2px solid silver;
+}
+h2 {
+  padding-top: 0.5em;
+}
+h3 {
+  float: left;
+}
+h3 + * {
+  clear: left;
+}
+
+div.sectionbody {
+  font-family: serif;
+  margin-left: 0;
+}
+
+hr {
+  border: 1px solid silver;
+}
+
+p {
+  margin-top: 0.5em;
+  margin-bottom: 0.5em;
+}
+
+ul, ol, li > p {
+  margin-top: 0;
+}
+
+pre {
+  padding: 0;
+  margin: 0;
+}
+
+span#author {
+  color: #527bbd;
+  font-family: sans-serif;
+  font-weight: bold;
+  font-size: 1.1em;
+}
+span#email {
+}
+span#revnumber, span#revdate, span#revremark {
+  font-family: sans-serif;
+}
+
+div#footer {
+  font-family: sans-serif;
+  font-size: small;
+  border-top: 2px solid silver;
+  padding-top: 0.5em;
+  margin-top: 4.0em;
+}
+div#footer-text {
+  float: left;
+  padding-bottom: 0.5em;
+}
+div#footer-badges {
+  float: right;
+  padding-bottom: 0.5em;
+}
+
+div#preamble {
+  margin-top: 1.5em;
+  margin-bottom: 1.5em;
+}
+div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
+div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
+div.admonitionblock {
+  margin-top: 1.5em;
+  margin-bottom: 1.5em;
+}
+div.admonitionblock {
+  margin-top: 2.5em;
+  margin-bottom: 2.5em;
+}
+
+div.content { /* Block element content. */
+  padding: 0;
+}
+
+/* Block element titles. */
+div.title, caption.title {
+  color: #527bbd;
+  font-family: sans-serif;
+  font-weight: bold;
+  text-align: left;
+  margin-top: 1.0em;
+  margin-bottom: 0.5em;
+}
+div.title + * {
+  margin-top: 0;
+}
+
+td div.title:first-child {
+  margin-top: 0.0em;
+}
+div.content div.title:first-child {
+  margin-top: 0.0em;
+}
+div.content + div.title {
+  margin-top: 0.0em;
+}
+
+div.sidebarblock > div.content {
+  background: #ffffee;
+  border: 1px solid silver;
+  padding: 0.5em;
+}
+
+div.listingblock > div.content {
+  border: 1px solid silver;
+  background: #f4f4f4;
+  padding: 0.5em;
+}
+
+div.quoteblock {
+  padding-left: 2.0em;
+  margin-right: 10%;
+}
+div.quoteblock > div.attribution {
+  padding-top: 0.5em;
+  text-align: right;
+}
+
+div.verseblock {
+  padding-left: 2.0em;
+  margin-right: 10%;
+}
+div.verseblock > div.content {
+  white-space: pre;
+}
+div.verseblock > div.attribution {
+  padding-top: 0.75em;
+  text-align: left;
+}
+/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
+div.verseblock + div.attribution {
+  text-align: left;
+}
+
+div.admonitionblock .icon {
+  vertical-align: top;
+  font-size: 1.1em;
+  font-weight: bold;
+  text-decoration: underline;
+  color: #527bbd;
+  padding-right: 0.5em;
+}
+div.admonitionblock td.content {
+  padding-left: 0.5em;
+  border-left: 2px solid silver;
+}
+
+div.exampleblock > div.content {
+  border-left: 2px solid silver;
+  padding: 0.5em;
+}
+
+div.imageblock div.content { padding-left: 0; }
+span.image img { border-style: none; }
+a.image:visited { color: white; }
+
+dl {
+  margin-top: 0.8em;
+  margin-bottom: 0.8em;
+}
+dt {
+  margin-top: 0.5em;
+  margin-bottom: 0;
+  font-style: normal;
+  color: navy;
+}
+dd > *:first-child {
+  margin-top: 0.1em;
+}
+
+ul, ol {
+    list-style-position: outside;
+}
+ol.arabic {
+  list-style-type: decimal;
+}
+ol.loweralpha {
+  list-style-type: lower-alpha;
+}
+ol.upperalpha {
+  list-style-type: upper-alpha;
+}
+ol.lowerroman {
+  list-style-type: lower-roman;
+}
+ol.upperroman {
+  list-style-type: upper-roman;
+}
+
+div.compact ul, div.compact ol,
+div.compact p, div.compact p,
+div.compact div, div.compact div {
+  margin-top: 0.1em;
+  margin-bottom: 0.1em;
+}
+
+div.tableblock > table {
+  border: 3px solid #527bbd;
+}
+thead {
+  font-family: sans-serif;
+  font-weight: bold;
+}
+tfoot {
+  font-weight: bold;
+}
+td > div.verse {
+  white-space: pre;
+}
+p.table {
+  margin-top: 0;
+}
+/* Because the table frame attribute is overriden by CSS in most browsers. */
+div.tableblock > table[frame="void"] {
+  border-style: none;
+}
+div.tableblock > table[frame="hsides"] {
+  border-left-style: none;
+  border-right-style: none;
+}
+div.tableblock > table[frame="vsides"] {
+  border-top-style: none;
+  border-bottom-style: none;
+}
+
+
+div.hdlist {
+  margin-top: 0.8em;
+  margin-bottom: 0.8em;
+}
+div.hdlist tr {
+  padding-bottom: 15px;
+}
+dt.hdlist1.strong, td.hdlist1.strong {
+  font-weight: bold;
+}
+td.hdlist1 {
+  vertical-align: top;
+  font-style: normal;
+  padding-right: 0.8em;
+  color: navy;
+}
+td.hdlist2 {
+  vertical-align: top;
+}
+div.hdlist.compact tr {
+  margin: 0;
+  padding-bottom: 0;
+}
+
+.comment {
+  background: yellow;
+}
+
+@media print {
+  div#footer-badges { display: none; }
+}
+
+div#toctitle {
+  color: #527bbd;
+  font-family: sans-serif;
+  font-size: 1.1em;
+  font-weight: bold;
+  margin-top: 1.0em;
+  margin-bottom: 0.1em;
+}
+
+div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
+  margin-top: 0;
+  margin-bottom: 0;
+}
+div.toclevel2 {
+  margin-left: 2em;
+  font-size: 0.9em;
+}
+div.toclevel3 {
+  margin-left: 4em;
+  font-size: 0.9em;
+}
+div.toclevel4 {
+  margin-left: 6em;
+  font-size: 0.9em;
+}
+/* Workarounds for IE6's broken and incomplete CSS2. */
+
+div.sidebar-content {
+  background: #ffffee;
+  border: 1px solid silver;
+  padding: 0.5em;
+}
+div.sidebar-title, div.image-title {
+  color: #527bbd;
+  font-family: sans-serif;
+  font-weight: bold;
+  margin-top: 0.0em;
+  margin-bottom: 0.5em;
+}
+
+div.listingblock div.content {
+  border: 1px solid silver;
+  background: #f4f4f4;
+  padding: 0.5em;
+}
+
+div.quoteblock-attribution {
+  padding-top: 0.5em;
+  text-align: right;
+}
+
+div.verseblock-content {
+  white-space: pre;
+}
+div.verseblock-attribution {
+  padding-top: 0.75em;
+  text-align: left;
+}
+
+div.exampleblock-content {
+  border-left: 2px solid silver;
+  padding-left: 0.5em;
+}
+
+/* IE6 sets dynamically generated links as visited. */
+div#toc a:visited { color: blue; }
+</style>
+</head>
+<body>
+<div id="header">
+<h1>GENIVI_CommonAPI-D-Bus</h1>
+<span id="author">Juergen Gehring - juergen.gehring@bmw.de, Manfred Bathelt - manfred.bathelt@bmw.de</span><br />
+</div>
+<h2 id="_copyright">Copyright</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>Copyright &#169; 2013, GENIVI Alliance, Inc.
+Copyright &#169; 2013, BMW AG</p></div>
+<div class="paragraph"><p>This file is part of GENIVI Project IPC Common API.</p></div>
+<div class="paragraph"><p>Contributions are licensed to the GENIVI Alliance under one or more
+Contribution License Agreements or MPL 2.0 .</p></div>
+<div class="paragraph"><p>&#169; Copyright
+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 <a href="http://mozilla.org/MPL/2.0/">http://mozilla.org/MPL/2.0/</a>.</p></div>
+<div class="paragraph"><p>For further information see <a href="https://collab.genivi.org/wiki/display/genivi/SysInfraEGCommonIDLCommonAPIGuide">https://collab.genivi.org/wiki/display/genivi/SysInfraEGCommonIDLCommonAPIGuide</a></p></div>
+</div>
+<h2 id="_license">License</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>This project is licensed under MPL 2.0</p></div>
+<div class="paragraph"><p>Contribution is done under GENIVI CLA or MPL2.0.</p></div>
+</div>
+<h2 id="_version">Version</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>The current version can be taken from the git.</p></div>
+</div>
+<h2 id="_common_api_overview">Common API Overview</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>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. It consist currently consists of four subprojects:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>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 -&gt; Common API C++ code.
+CommonAPI-D-Bus - This is the D-Bus binding C++ library, which provides the necesary code to communicate
+                  over D-Bus. This is invisible to the application code, and simply needs to be linked against.
+                  (This is the current package.)
+CommonAPI-D-Bus-Tools - The eclipse based tools for CommonAPI D-Bus. This is the code generator for
+                        Franca -&gt; Common API D-Bus C++ code.</tt></pre>
+</div></div>
+</div>
+<h2 id="_build_instructions">Build Instructions</h2>
+<div class="sectionbody">
+<h3 id="_requirements">Requirements</h3><div style="clear:left"></div>
+<div class="paragraph"><p>To build this package the CommonAPI library and a version of libdbus patched with the marshaling patch must be available through PkgConfig.</p></div>
+<div class="paragraph"><p>Instructions for making a patched version of libdbus available in /usr/local:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt># 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 &lt; /path/to/dbus-DBusMessage-add-support-for-custom-marshaling.patch
+
+# ./configure --prefix=/usr/local
+
+# make -C dbus
+
+# sudo make -C dbus install
+# sudo make install-pkgconfigDATA</tt></pre>
+</div></div>
+<div class="paragraph"><p>The path to CommonAPI and patched libdbus pkgconfig files must be added to the PKG_CONFIG_PATH for the entire build process.</p></div>
+<div class="paragraph"><p>For example, if CommonAPI and patched dbus are available in /usr/local, set the PKG_CONFIG_PATH variable as follows:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt># export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"</tt></pre>
+</div></div>
+<h3 id="_instructions">Instructions</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Use autotools to build this package withthe above requirements available through Pkgconfig :</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt># ./autoreconf -i
+# ./configure
+# make
+# sudo make install (or alternative install process, eg. checkinstall on debian-based distributions, such as Ubuntu)</tt></pre>
+</div></div>
+<div class="paragraph"><p>If the environment variable GTEST_CONFIG is set to the path of the gtest-config script in a Gtest tree test will also be built.</p></div>
+</div>
+<h2 id="_working_on_the_code_amp_contribution">Working on the code &amp; contribution</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="title">First get the code from the git:</div>
+<div class="content">
+<pre><tt>git clone</tt></pre>
+</div></div>
+<div class="literalblock">
+<div class="title">Get an overview of all branches:</div>
+<div class="content">
+<pre><tt>git branch</tt></pre>
+</div></div>
+<div class="literalblock">
+<div class="title">Switch to the branch you want to work on (master is the feature branch) and verify that it has switched (* changed)</div>
+<div class="content">
+<pre><tt>git checkout &lt;your branch&gt;
+git branch</tt></pre>
+</div></div>
+<div class="literalblock">
+<div class="title">Best practice is to create a local branch based on the current branch:</div>
+<div class="content">
+<pre><tt>git branch working_branch</tt></pre>
+</div></div>
+<div class="paragraph"><p>Start working, best practice is to commit smaller, compilable pieces during the development process that makes it easier to handle later on.</p></div>
+<div class="literalblock">
+<div class="title">If you want to commit you changes, send them to the author, you can create a patch like this:</div>
+<div class="content">
+<pre><tt>git format-patch working_branch &lt;your branch&gt;</tt></pre>
+</div></div>
+<div class="paragraph"><p>This creates a set of patches that are published via the mailing list.The patches will be discussed and then merged &amp; uploaded on the git by the maintainer.</p></div>
+<div class="paragraph"><p>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 <a href="http://gerrit.googlecode.com/svn/documentation/2.0/user-signedoffby.html">http://gerrit.googlecode.com/svn/documentation/2.0/user-signedoffby.html</a></p></div>
+</div>
+<div id="footer">
+<div id="footer-text">
+Last updated 2013-01-21 14:49:07 CEST
+</div>
+</div>
+</body>
+</html>
index 9ed2ba6..8eaa807 100644 (file)
-/* Copyright (C) 2013 BMW Group\r
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)\r
- * Author: Juergen Gehring (juergen.gehring@bmw.de)\r
- * This Source Code Form is subject to the terms of the Mozilla Public\r
- * License, v. 2.0. If a copy of the MPL was not distributed with this\r
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
-#include "DBusDaemonProxy.h"\r
-#include "DBusProxyHelper.h"\r
-\r
-\r
-namespace CommonAPI {\r
-namespace DBus {\r
-\r
-DBusDaemonProxy::DBusDaemonProxy(const std::shared_ptr<DBusProxyConnection>& connection):\r
-                DBusProxy(getInterfaceName(), "org.freedesktop.DBus", "/org/freedesktop/DBus", connection, true),\r
-                nameOwnerChangedEvent_(*this, "NameOwnerChanged", "sss") {\r
-}\r
-\r
-DBusDaemonProxy::NameOwnerChangedEvent& DBusDaemonProxy::getNameOwnerChangedEvent() {\r
-    return nameOwnerChangedEvent_;\r
-}\r
-\r
-void DBusDaemonProxy::listNames(CommonAPI::CallStatus& callStatus, std::vector<std::string>& busNames) const {\r
-    DBusMessage dbusMethodCall = createMethodCall("ListNames", "");\r
-\r
-    DBusError dbusError;\r
-    DBusMessage dbusMessageReply = getDBusConnection()->sendDBusMessageWithReplyAndBlock(\r
-                    dbusMethodCall,\r
-                    dbusError);\r
-\r
-    if (dbusError || !dbusMessageReply.isMethodReturnType()) {\r
-        callStatus = CallStatus::REMOTE_ERROR;\r
-        return;\r
-    }\r
-\r
-    DBusInputStream inputStream(dbusMessageReply);\r
-    const bool success = DBusSerializableArguments<std::vector<std::string>>::deserialize(inputStream, busNames);\r
-    if (!success) {\r
-        callStatus = CallStatus::REMOTE_ERROR;\r
-        return;\r
-    }\r
-    callStatus = CallStatus::SUCCESS;\r
-\r
-}\r
-\r
-std::future<CallStatus> DBusDaemonProxy::listNamesAsync(ListNamesAsyncCallback listNamesAsyncCallback) const {\r
-    DBusMessage dbusMessage = createMethodCall("ListNames", "");\r
-\r
-    return getDBusConnection()->sendDBusMessageWithReplyAsync(\r
-                    dbusMessage,\r
-                    DBusProxyAsyncCallbackHandler<std::vector<std::string>>::create(listNamesAsyncCallback));\r
-}\r
-\r
-void DBusDaemonProxy::nameHasOwner(const std::string& busName, CommonAPI::CallStatus& callStatus, bool& hasOwner) const {\r
-\r
-    DBusMessage dbusMethodCall = createMethodCall("NameHasOwner", "s");\r
-\r
-    DBusOutputStream outputStream(dbusMethodCall);\r
-    bool success = DBusSerializableArguments<std::string>::serialize(outputStream, busName);\r
-    if (!success) {\r
-        callStatus = CallStatus::OUT_OF_MEMORY;\r
-        return;\r
-    }\r
-    outputStream.flush();\r
-\r
-    DBusError dbusError;\r
-    DBusMessage dbusMessageReply = getDBusConnection()->sendDBusMessageWithReplyAndBlock(\r
-                    dbusMethodCall,\r
-                    dbusError);\r
-    if (dbusError || !dbusMessageReply.isMethodReturnType()) {\r
-        callStatus = CallStatus::REMOTE_ERROR;\r
-        return;\r
-    }\r
-\r
-    DBusInputStream inputStream(dbusMessageReply);\r
-    success = DBusSerializableArguments<bool>::deserialize(inputStream, hasOwner);\r
-    if (!success) {\r
-        callStatus = CallStatus::REMOTE_ERROR;\r
-        return;\r
-    }\r
-    callStatus = CallStatus::SUCCESS;\r
-\r
-}\r
-\r
-std::future<CallStatus> DBusDaemonProxy::nameHasOwnerAsync(const std::string& busName, NameHasOwnerAsyncCallback nameHasOwnerAsyncCallback) const {\r
-\r
-    DBusMessage dbusMessage = createMethodCall("NameHasOwner", "s");\r
-\r
-    DBusOutputStream outputStream(dbusMessage);\r
-    const bool success = DBusSerializableArguments<std::string>::serialize(outputStream, busName);\r
-    if (!success) {\r
-        std::promise<CallStatus> promise;\r
-        promise.set_value(CallStatus::OUT_OF_MEMORY);\r
-        return promise.get_future();\r
-    }\r
-    outputStream.flush();\r
-\r
-    return getDBusConnection()->sendDBusMessageWithReplyAsync(\r
-                    dbusMessage,\r
-                    DBusProxyAsyncCallbackHandler<bool>::create(nameHasOwnerAsyncCallback));\r
-\r
-}\r
-\r
-void DBusDaemonProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {\r
-}\r
-\r
-} // namespace DBus\r
-} // namespace CommonAPI\r
+/* 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 "DBusDaemonProxy.h"
+#include "DBusProxyHelper.h"
+
+
+namespace CommonAPI {
+namespace DBus {
+
+DBusDaemonProxy::DBusDaemonProxy(const std::shared_ptr<DBusProxyConnection>& connection):
+                DBusProxy(getInterfaceName(), "org.freedesktop.DBus", "/org/freedesktop/DBus", connection, true),
+                nameOwnerChangedEvent_(*this, "NameOwnerChanged", "sss") {
+}
+
+DBusDaemonProxy::NameOwnerChangedEvent& DBusDaemonProxy::getNameOwnerChangedEvent() {
+    return nameOwnerChangedEvent_;
+}
+
+void DBusDaemonProxy::listNames(CommonAPI::CallStatus& callStatus, std::vector<std::string>& busNames) const {
+    DBusMessage dbusMethodCall = createMethodCall("ListNames", "");
+
+    DBusError dbusError;
+    DBusMessage dbusMessageReply = getDBusConnection()->sendDBusMessageWithReplyAndBlock(
+                    dbusMethodCall,
+                    dbusError);
+
+    if (dbusError || !dbusMessageReply.isMethodReturnType()) {
+        callStatus = CallStatus::REMOTE_ERROR;
+        return;
+    }
+
+    DBusInputStream inputStream(dbusMessageReply);
+    const bool success = DBusSerializableArguments<std::vector<std::string>>::deserialize(inputStream, busNames);
+    if (!success) {
+        callStatus = CallStatus::REMOTE_ERROR;
+        return;
+    }
+    callStatus = CallStatus::SUCCESS;
+
+}
+
+std::future<CallStatus> DBusDaemonProxy::listNamesAsync(ListNamesAsyncCallback listNamesAsyncCallback) const {
+    DBusMessage dbusMessage = createMethodCall("ListNames", "");
+
+    return getDBusConnection()->sendDBusMessageWithReplyAsync(
+                    dbusMessage,
+                    DBusProxyAsyncCallbackHandler<std::vector<std::string>>::create(listNamesAsyncCallback));
+}
+
+void DBusDaemonProxy::nameHasOwner(const std::string& busName, CommonAPI::CallStatus& callStatus, bool& hasOwner) const {
+
+    DBusMessage dbusMethodCall = createMethodCall("NameHasOwner", "s");
+
+    DBusOutputStream outputStream(dbusMethodCall);
+    bool success = DBusSerializableArguments<std::string>::serialize(outputStream, busName);
+    if (!success) {
+        callStatus = CallStatus::OUT_OF_MEMORY;
+        return;
+    }
+    outputStream.flush();
+
+    DBusError dbusError;
+    DBusMessage dbusMessageReply = getDBusConnection()->sendDBusMessageWithReplyAndBlock(
+                    dbusMethodCall,
+                    dbusError);
+    if (dbusError || !dbusMessageReply.isMethodReturnType()) {
+        callStatus = CallStatus::REMOTE_ERROR;
+        return;
+    }
+
+    DBusInputStream inputStream(dbusMessageReply);
+    success = DBusSerializableArguments<bool>::deserialize(inputStream, hasOwner);
+    if (!success) {
+        callStatus = CallStatus::REMOTE_ERROR;
+        return;
+    }
+    callStatus = CallStatus::SUCCESS;
+
+}
+
+std::future<CallStatus> DBusDaemonProxy::nameHasOwnerAsync(const std::string& busName, NameHasOwnerAsyncCallback nameHasOwnerAsyncCallback) const {
+
+    DBusMessage dbusMessage = createMethodCall("NameHasOwner", "s");
+
+    DBusOutputStream outputStream(dbusMessage);
+    const bool success = DBusSerializableArguments<std::string>::serialize(outputStream, busName);
+    if (!success) {
+        std::promise<CallStatus> promise;
+        promise.set_value(CallStatus::OUT_OF_MEMORY);
+        return promise.get_future();
+    }
+    outputStream.flush();
+
+    return getDBusConnection()->sendDBusMessageWithReplyAsync(
+                    dbusMessage,
+                    DBusProxyAsyncCallbackHandler<bool>::create(nameHasOwnerAsyncCallback));
+
+}
+
+void DBusDaemonProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
+}
+
+} // namespace DBus
+} // namespace CommonAPI
index 307bfc8..175b1cb 100644 (file)
@@ -1,57 +1,57 @@
-/* Copyright (C) 2013 BMW Group\r
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)\r
- * Author: Juergen Gehring (juergen.gehring@bmw.de)\r
- * This Source Code Form is subject to the terms of the Mozilla Public\r
- * License, v. 2.0. If a copy of the MPL was not distributed with this\r
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
-#ifndef COMMONAPI_DBUS_DBUS_DAEMON_PROXY_H_\r
-#define COMMONAPI_DBUS_DBUS_DAEMON_PROXY_H_\r
-\r
-#include "DBusProxy.h"\r
-#include "DBusEvent.h"\r
-\r
-#include "DBusServiceStatusEvent.h"\r
-\r
-#include <string>\r
-#include <vector>\r
-\r
-namespace CommonAPI {\r
-namespace DBus {\r
-\r
-class DBusServiceStatusEvent;\r
-\r
-class DBusDaemonProxy: public DBusProxy {\r
-\r
- public:\r
-       typedef Event<std::string, std::string, std::string> NameOwnerChangedEvent;\r
-       typedef std::function<void(const CommonAPI::CallStatus&, std::vector<std::string>)> ListNamesAsyncCallback;\r
-       typedef std::function<void(const CommonAPI::CallStatus&, bool)> NameHasOwnerAsyncCallback;\r
-\r
-\r
-       DBusDaemonProxy(const std::shared_ptr<DBusProxyConnection>& connection);\r
-\r
-    inline const char* getInterfaceName() const;\r
-\r
-    NameOwnerChangedEvent& getNameOwnerChangedEvent();\r
-\r
-    void listNames(CommonAPI::CallStatus& callStatus, std::vector<std::string>& busNames) const;\r
-    std::future<CallStatus> listNamesAsync(ListNamesAsyncCallback listNamesAsyncCallback) const;\r
-\r
-    void nameHasOwner(const std::string& busName, CommonAPI::CallStatus& callStatus, bool& hasOwner) const;\r
-    std::future<CallStatus> nameHasOwnerAsync(const std::string& busName, NameHasOwnerAsyncCallback nameHasOwnerAsyncCallback) const;\r
-\r
- protected:\r
-    void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;\r
-\r
- private:\r
-    DBusEvent<NameOwnerChangedEvent> nameOwnerChangedEvent_;\r
-};\r
-\r
-const char* DBusDaemonProxy::getInterfaceName() const {\r
-    return "org.freedesktop.DBus";\r
-}\r
-\r
-} // namespace DBus\r
-} // namespace CommonAPI\r
-\r
-#endif // COMMONAPI_DBUS_DBUS_DAEMON_PROXY_H_\r
+/* 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_DBUS_DBUS_DAEMON_PROXY_H_
+#define COMMONAPI_DBUS_DBUS_DAEMON_PROXY_H_
+
+#include "DBusProxy.h"
+#include "DBusEvent.h"
+
+#include "DBusServiceStatusEvent.h"
+
+#include <string>
+#include <vector>
+
+namespace CommonAPI {
+namespace DBus {
+
+class DBusServiceStatusEvent;
+
+class DBusDaemonProxy: public DBusProxy {
+
+ public:
+       typedef Event<std::string, std::string, std::string> NameOwnerChangedEvent;
+       typedef std::function<void(const CommonAPI::CallStatus&, std::vector<std::string>)> ListNamesAsyncCallback;
+       typedef std::function<void(const CommonAPI::CallStatus&, bool)> NameHasOwnerAsyncCallback;
+
+
+       DBusDaemonProxy(const std::shared_ptr<DBusProxyConnection>& connection);
+
+    inline const char* getInterfaceName() const;
+
+    NameOwnerChangedEvent& getNameOwnerChangedEvent();
+
+    void listNames(CommonAPI::CallStatus& callStatus, std::vector<std::string>& busNames) const;
+    std::future<CallStatus> listNamesAsync(ListNamesAsyncCallback listNamesAsyncCallback) const;
+
+    void nameHasOwner(const std::string& busName, CommonAPI::CallStatus& callStatus, bool& hasOwner) const;
+    std::future<CallStatus> nameHasOwnerAsync(const std::string& busName, NameHasOwnerAsyncCallback nameHasOwnerAsyncCallback) const;
+
+ protected:
+    void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
+
+ private:
+    DBusEvent<NameOwnerChangedEvent> nameOwnerChangedEvent_;
+};
+
+const char* DBusDaemonProxy::getInterfaceName() const {
+    return "org.freedesktop.DBus";
+}
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUS_DAEMON_PROXY_H_
index 82cb280..52a8737 100644 (file)
-/* Copyright (C) 2013 BMW Group\r
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)\r
- * Author: Juergen Gehring (juergen.gehring@bmw.de)\r
- * This Source Code Form is subject to the terms of the Mozilla Public\r
- * License, v. 2.0. If a copy of the MPL was not distributed with this\r
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
-#include "DBusProxy.h"\r
-#include "DBusConnection.h"\r
-#include "DBusFactory.h"\r
-#include "DBusAddressTranslator.h"\r
-#include "DBusServiceRegistry.h"\r
-#include "DBusUtils.h"\r
-\r
-#include <algorithm>\r
-#include <cassert>\r
-#include <sstream>\r
-#include <unordered_map>\r
-#include <vector>\r
-\r
-namespace CommonAPI {\r
-namespace DBus {\r
-\r
-std::unordered_map<std::string, DBusProxyFactoryFunction>* registeredProxyFactoryFunctions_;\r
-std::unordered_map<std::string, DBusAdapterFactoryFunction>* registeredAdapterFactoryFunctions_;\r
-\r
-\r
-void DBusFactory::registerProxyFactoryMethod(std::string interfaceName, DBusProxyFactoryFunction proxyFactoryMethod) {\r
-    if(!registeredProxyFactoryFunctions_) {\r
-        registeredProxyFactoryFunctions_ = new std::unordered_map<std::string, DBusProxyFactoryFunction>();\r
-    }\r
-    registeredProxyFactoryFunctions_->insert({interfaceName, proxyFactoryMethod});\r
-}\r
-\r
-void DBusFactory::registerAdapterFactoryMethod(std::string interfaceName, DBusAdapterFactoryFunction adapterFactoryMethod) {\r
-    if(!registeredAdapterFactoryFunctions_) {\r
-        registeredAdapterFactoryFunctions_ = new std::unordered_map<std::string, DBusAdapterFactoryFunction>();\r
-    }\r
-    registeredAdapterFactoryFunctions_->insert({interfaceName, adapterFactoryMethod});\r
-}\r
-\r
-\r
-\r
-DBusFactory::DBusFactory(std::shared_ptr<Runtime> runtime, const MiddlewareInfo* middlewareInfo) :\r
-                CommonAPI::Factory(runtime, middlewareInfo),\r
-                dbusConnection_(CommonAPI::DBus::DBusConnection::getSessionBus()),\r
-                acquiredConnectionName_("") {\r
-    dbusConnection_->connect();\r
-}\r
-\r
-DBusFactory::~DBusFactory() {\r
-}\r
-\r
-\r
-std::vector<std::string> DBusFactory::getAvailableServiceInstances(const std::string& serviceName,\r
-                                                                   const std::string& domainName) {\r
-    return dbusConnection_->getDBusServiceRegistry()->getAvailableServiceInstances(serviceName, domainName);\r
-}\r
-\r
-\r
-bool DBusFactory::isServiceInstanceAlive(const std::string& serviceAddress) {\r
-    std::vector<std::string> parts = split(serviceAddress, ':');\r
-    assert(parts[0] == "local");\r
-\r
-    std::string interfaceName;\r
-    std::string connectionName;\r
-    std::string objectPath;\r
-    DBusAddressTranslator::getInstance().searchForDBusAddress(serviceAddress, interfaceName, connectionName, objectPath);\r
-\r
-    return dbusConnection_->getDBusServiceRegistry()->isServiceInstanceAlive(interfaceName, connectionName, objectPath);\r
-}\r
-\r
-\r
-bool DBusFactory::isServiceInstanceAlive(const std::string& participantId,\r
-                                         const std::string& serviceName,\r
-                                         const std::string& domainName) {\r
-    std::string serviceAddress = domainName + ":" + serviceName + ":" + participantId;\r
-    return isServiceInstanceAlive(serviceAddress);\r
-}\r
-\r
-std::shared_ptr<Proxy> DBusFactory::createProxy(const char* interfaceId,\r
-                                                const std::string& participantId,\r
-                                                const std::string& serviceName,\r
-                                                const std::string& domain) {\r
-    std::string commonApiAddress = domain + ":" + serviceName + ":" + participantId;\r
-\r
-    std::string interfaceName;\r
-    std::string connectionName;\r
-    std::string objectPath;\r
-\r
-    DBusAddressTranslator::getInstance().searchForDBusAddress(commonApiAddress, interfaceName, connectionName, objectPath);\r
-\r
-    if(!registeredProxyFactoryFunctions_) {\r
-        registeredProxyFactoryFunctions_ = new std::unordered_map<std::string, DBusProxyFactoryFunction> {};\r
-    }\r
-\r
-    for (auto it = registeredProxyFactoryFunctions_->begin(); it != registeredProxyFactoryFunctions_->end(); ++it) {\r
-        if(it->first == interfaceId) {\r
-            return (it->second)(commonApiAddress, interfaceName, connectionName, objectPath, dbusConnection_);\r
-        }\r
-    }\r
-\r
-    return NULL;\r
-}\r
-\r
-std::shared_ptr<StubAdapter> DBusFactory::createAdapter(std::shared_ptr<StubBase> stubBase,\r
-                                                        const char* interfaceId,\r
-                                                        const std::string& participantId,\r
-                                                        const std::string& serviceName,\r
-                                                        const std::string& domain) {\r
-    assert(dbusConnection_->isConnected());\r
-\r
-    std::string commonApiAddress = domain + ":" + serviceName + ":" + participantId;\r
-\r
-    std::string interfaceName;\r
-    std::string connectionName;\r
-    std::string objectPath;\r
-\r
-    DBusAddressTranslator::getInstance().searchForDBusAddress(commonApiAddress, interfaceName, connectionName, objectPath);\r
-\r
-    if(acquiredConnectionName_ == "") {\r
-        dbusConnection_->requestServiceNameAndBlock(connectionName);\r
-        acquiredConnectionName_ = connectionName;\r
-    } else if (acquiredConnectionName_ != connectionName) {\r
-        return NULL;\r
-    }\r
-\r
-    if(!registeredAdapterFactoryFunctions_) {\r
-        registeredAdapterFactoryFunctions_ = new std::unordered_map<std::string, DBusAdapterFactoryFunction> {};\r
-    }\r
-\r
-    for (auto it = registeredAdapterFactoryFunctions_->begin(); it != registeredAdapterFactoryFunctions_->end(); ++it) {\r
-        if(it->first == interfaceId) {\r
-            std::shared_ptr<DBusStubAdapter> dbusStubAdapter =  (it->second)(commonApiAddress, interfaceName, connectionName, objectPath, dbusConnection_, stubBase);\r
-            dbusStubAdapter->init();\r
-            return dbusStubAdapter;\r
-        }\r
-    }\r
-\r
-    return NULL;\r
-}\r
-\r
-\r
-} // namespace DBus\r
-} // namespace CommonAPI\r
+/* 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 "DBusProxy.h"
+#include "DBusConnection.h"
+#include "DBusFactory.h"
+#include "DBusAddressTranslator.h"
+#include "DBusServiceRegistry.h"
+#include "DBusUtils.h"
+
+#include <algorithm>
+#include <cassert>
+#include <sstream>
+#include <unordered_map>
+#include <vector>
+
+namespace CommonAPI {
+namespace DBus {
+
+std::unordered_map<std::string, DBusProxyFactoryFunction>* registeredProxyFactoryFunctions_;
+std::unordered_map<std::string, DBusAdapterFactoryFunction>* registeredAdapterFactoryFunctions_;
+
+
+void DBusFactory::registerProxyFactoryMethod(std::string interfaceName, DBusProxyFactoryFunction proxyFactoryMethod) {
+    if(!registeredProxyFactoryFunctions_) {
+        registeredProxyFactoryFunctions_ = new std::unordered_map<std::string, DBusProxyFactoryFunction>();
+    }
+    registeredProxyFactoryFunctions_->insert({interfaceName, proxyFactoryMethod});
+}
+
+void DBusFactory::registerAdapterFactoryMethod(std::string interfaceName, DBusAdapterFactoryFunction adapterFactoryMethod) {
+    if(!registeredAdapterFactoryFunctions_) {
+        registeredAdapterFactoryFunctions_ = new std::unordered_map<std::string, DBusAdapterFactoryFunction>();
+    }
+    registeredAdapterFactoryFunctions_->insert({interfaceName, adapterFactoryMethod});
+}
+
+
+
+DBusFactory::DBusFactory(std::shared_ptr<Runtime> runtime, const MiddlewareInfo* middlewareInfo) :
+                CommonAPI::Factory(runtime, middlewareInfo),
+                dbusConnection_(CommonAPI::DBus::DBusConnection::getSessionBus()),
+                acquiredConnectionName_("") {
+    dbusConnection_->connect();
+}
+
+DBusFactory::~DBusFactory() {
+}
+
+
+std::vector<std::string> DBusFactory::getAvailableServiceInstances(const std::string& serviceName,
+                                                                   const std::string& domainName) {
+    return dbusConnection_->getDBusServiceRegistry()->getAvailableServiceInstances(serviceName, domainName);
+}
+
+
+bool DBusFactory::isServiceInstanceAlive(const std::string& serviceAddress) {
+    std::vector<std::string> parts = split(serviceAddress, ':');
+    assert(parts[0] == "local");
+
+    std::string interfaceName;
+    std::string connectionName;
+    std::string objectPath;
+    DBusAddressTranslator::getInstance().searchForDBusAddress(serviceAddress, interfaceName, connectionName, objectPath);
+
+    return dbusConnection_->getDBusServiceRegistry()->isServiceInstanceAlive(interfaceName, connectionName, objectPath);
+}
+
+
+bool DBusFactory::isServiceInstanceAlive(const std::string& participantId,
+                                         const std::string& serviceName,
+                                         const std::string& domainName) {
+    std::string serviceAddress = domainName + ":" + serviceName + ":" + participantId;
+    return isServiceInstanceAlive(serviceAddress);
+}
+
+std::shared_ptr<Proxy> DBusFactory::createProxy(const char* interfaceId,
+                                                const std::string& participantId,
+                                                const std::string& serviceName,
+                                                const std::string& domain) {
+    std::string commonApiAddress = domain + ":" + serviceName + ":" + participantId;
+
+    std::string interfaceName;
+    std::string connectionName;
+    std::string objectPath;
+
+    DBusAddressTranslator::getInstance().searchForDBusAddress(commonApiAddress, interfaceName, connectionName, objectPath);
+
+    if(!registeredProxyFactoryFunctions_) {
+        registeredProxyFactoryFunctions_ = new std::unordered_map<std::string, DBusProxyFactoryFunction> {};
+    }
+
+    for (auto it = registeredProxyFactoryFunctions_->begin(); it != registeredProxyFactoryFunctions_->end(); ++it) {
+        if(it->first == interfaceId) {
+            return (it->second)(commonApiAddress, interfaceName, connectionName, objectPath, dbusConnection_);
+        }
+    }
+
+    return NULL;
+}
+
+std::shared_ptr<StubAdapter> DBusFactory::createAdapter(std::shared_ptr<StubBase> stubBase,
+                                                        const char* interfaceId,
+                                                        const std::string& participantId,
+                                                        const std::string& serviceName,
+                                                        const std::string& domain) {
+    assert(dbusConnection_->isConnected());
+
+    std::string commonApiAddress = domain + ":" + serviceName + ":" + participantId;
+
+    std::string interfaceName;
+    std::string connectionName;
+    std::string objectPath;
+
+    DBusAddressTranslator::getInstance().searchForDBusAddress(commonApiAddress, interfaceName, connectionName, objectPath);
+
+    if(acquiredConnectionName_ == "") {
+        dbusConnection_->requestServiceNameAndBlock(connectionName);
+        acquiredConnectionName_ = connectionName;
+    } else if (acquiredConnectionName_ != connectionName) {
+        return NULL;
+    }
+
+    if(!registeredAdapterFactoryFunctions_) {
+        registeredAdapterFactoryFunctions_ = new std::unordered_map<std::string, DBusAdapterFactoryFunction> {};
+    }
+
+    for (auto it = registeredAdapterFactoryFunctions_->begin(); it != registeredAdapterFactoryFunctions_->end(); ++it) {
+        if(it->first == interfaceId) {
+            std::shared_ptr<DBusStubAdapter> dbusStubAdapter =  (it->second)(commonApiAddress, interfaceName, connectionName, objectPath, dbusConnection_, stubBase);
+            dbusStubAdapter->init();
+            return dbusStubAdapter;
+        }
+    }
+
+    return NULL;
+}
+
+
+} // namespace DBus
+} // namespace CommonAPI
index 144fc5e..b31a36f 100644 (file)
@@ -1,57 +1,57 @@
-/* Copyright (C) 2013 BMW Group\r
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)\r
- * Author: Juergen Gehring (juergen.gehring@bmw.de)\r
- * This Source Code Form is subject to the terms of the Mozilla Public\r
- * License, v. 2.0. If a copy of the MPL was not distributed with this\r
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
-#ifndef COMMONAPI_DBUS_DBUS_FACTORY_H_\r
-#define COMMONAPI_DBUS_DBUS_FACTORY_H_\r
-\r
-#include <thread>\r
-\r
-#include <CommonAPI/Factory.h>\r
-\r
-#include "CommonAPI/DBus/DBusStubAdapter.h"\r
-#include "DBusConnection.h"\r
-\r
-namespace CommonAPI {\r
-namespace DBus {\r
-\r
-typedef std::shared_ptr<DBusProxy> (*DBusProxyFactoryFunction) (const std::string& commonApiAddress,\r
-                                                                const std::string& interfaceName,\r
-                                                                const std::string& busName,\r
-                                                                const std::string& objectPath,\r
-                                                                const std::shared_ptr<DBusProxyConnection>& dbusProxyConnection);\r
-typedef std::shared_ptr<DBusStubAdapter> (*DBusAdapterFactoryFunction) (const std::string& commonApiAddress,\r
-                                                                        const std::string& interfaceName,\r
-                                                                        const std::string& busName,\r
-                                                                        const std::string& objectPath,\r
-                                                                        const std::shared_ptr<DBusProxyConnection>& dbusProxyConnection,\r
-                                                                        const std::shared_ptr<StubBase>& stubBase);\r
-\r
-class DBusFactory: public Factory {\r
- public:\r
-    DBusFactory(std::shared_ptr<Runtime> runtime, const MiddlewareInfo* middlewareInfo);\r
-    virtual ~DBusFactory();\r
-\r
-    static void registerProxyFactoryMethod(std::string interfaceName, DBusProxyFactoryFunction proxyFactoryFunction);\r
-    static void registerAdapterFactoryMethod(std::string interfaceName, DBusAdapterFactoryFunction adapterFactoryMethod);\r
-\r
-    virtual std::vector<std::string> getAvailableServiceInstances(const std::string& serviceInterfaceName, const std::string& serviceDomainName = "local");\r
-\r
-    virtual bool isServiceInstanceAlive(const std::string& serviceAddress);\r
-    virtual bool isServiceInstanceAlive(const std::string& serviceInstanceID, const std::string& serviceInterfaceName, const std::string& serviceDomainName = "local");\r
-\r
- protected:\r
-    virtual std::shared_ptr<Proxy> createProxy(const char* interfaceId, const std::string& participantId, const std::string& serviceName, const std::string& domain);\r
-    virtual std::shared_ptr<StubAdapter> createAdapter(std::shared_ptr<StubBase> stubBase, const char* interfaceId, const std::string& participantId, const std::string& serviceName, const std::string& domain);\r
-\r
- private:\r
-    std::shared_ptr<CommonAPI::DBus::DBusConnection> dbusConnection_;\r
-    std::string acquiredConnectionName_;\r
-};\r
-\r
-} // namespace DBus\r
-} // namespace CommonAPI\r
-\r
-#endif // COMMONAPI_DBUS_DBUS_FACTORY_H_\r
+/* 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_DBUS_DBUS_FACTORY_H_
+#define COMMONAPI_DBUS_DBUS_FACTORY_H_
+
+#include <thread>
+
+#include <CommonAPI/Factory.h>
+
+#include "CommonAPI/DBus/DBusStubAdapter.h"
+#include "DBusConnection.h"
+
+namespace CommonAPI {
+namespace DBus {
+
+typedef std::shared_ptr<DBusProxy> (*DBusProxyFactoryFunction) (const std::string& commonApiAddress,
+                                                                const std::string& interfaceName,
+                                                                const std::string& busName,
+                                                                const std::string& objectPath,
+                                                                const std::shared_ptr<DBusProxyConnection>& dbusProxyConnection);
+typedef std::shared_ptr<DBusStubAdapter> (*DBusAdapterFactoryFunction) (const std::string& commonApiAddress,
+                                                                        const std::string& interfaceName,
+                                                                        const std::string& busName,
+                                                                        const std::string& objectPath,
+                                                                        const std::shared_ptr<DBusProxyConnection>& dbusProxyConnection,
+                                                                        const std::shared_ptr<StubBase>& stubBase);
+
+class DBusFactory: public Factory {
+ public:
+    DBusFactory(std::shared_ptr<Runtime> runtime, const MiddlewareInfo* middlewareInfo);
+    virtual ~DBusFactory();
+
+    static void registerProxyFactoryMethod(std::string interfaceName, DBusProxyFactoryFunction proxyFactoryFunction);
+    static void registerAdapterFactoryMethod(std::string interfaceName, DBusAdapterFactoryFunction adapterFactoryMethod);
+
+    virtual std::vector<std::string> getAvailableServiceInstances(const std::string& serviceInterfaceName, const std::string& serviceDomainName = "local");
+
+    virtual bool isServiceInstanceAlive(const std::string& serviceAddress);
+    virtual bool isServiceInstanceAlive(const std::string& serviceInstanceID, const std::string& serviceInterfaceName, const std::string& serviceDomainName = "local");
+
+ protected:
+    virtual std::shared_ptr<Proxy> createProxy(const char* interfaceId, const std::string& participantId, const std::string& serviceName, const std::string& domain);
+    virtual std::shared_ptr<StubAdapter> createAdapter(std::shared_ptr<StubBase> stubBase, const char* interfaceId, const std::string& participantId, const std::string& serviceName, const std::string& domain);
+
+ private:
+    std::shared_ptr<CommonAPI::DBus::DBusConnection> dbusConnection_;
+    std::string acquiredConnectionName_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUS_FACTORY_H_
index 9d4323d..f4f65f7 100644 (file)
-/* Copyright (C) 2013 BMW Group\r
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)\r
- * Author: Juergen Gehring (juergen.gehring@bmw.de)\r
- * This Source Code Form is subject to the terms of the Mozilla Public\r
- * License, v. 2.0. If a copy of the MPL was not distributed with this\r
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
-#include "DBusObjectManager.h"\r
-#include "DBusOutputStream.h"\r
-\r
-#include <cassert>\r
-\r
-namespace CommonAPI {\r
-namespace DBus {\r
-\r
-DBusObjectManager::DBusObjectManager(const std::shared_ptr<DBusConnection>& dbusConnection):\r
-        dbusConnection_(dbusConnection) {\r
-\r
-    registerInterfaceHandler("/",\r
-                             "org.freedesktop.DBus.ObjectManager",\r
-                             std::bind(&DBusObjectManager::onGetDBusObjectManagerData, this, std::placeholders::_1));\r
-}\r
-\r
-DBusInterfaceHandlerToken DBusObjectManager::registerInterfaceHandler(const std::string& objectPath,\r
-                                                                      const std::string& interfaceName,\r
-                                                                      const DBusMessageInterfaceHandler& dbusMessageInterfaceHandler) {\r
-    DBusInterfaceHandlerPath handlerPath(objectPath, interfaceName);\r
-    bool noSuchHandlerRegistered = dbusRegisteredObjectsTable_.find(handlerPath) == dbusRegisteredObjectsTable_.end();\r
-\r
-    assert(noSuchHandlerRegistered);\r
-\r
-    dbusRegisteredObjectsTable_.insert({handlerPath, dbusMessageInterfaceHandler});\r
-    dbusConnection_->registerObjectPath(objectPath);\r
-\r
-    return handlerPath;\r
-}\r
-\r
-void DBusObjectManager::unregisterInterfaceHandler(const DBusInterfaceHandlerToken& dbusInterfaceHandlerToken) {\r
-    const std::string& objectPath = dbusInterfaceHandlerToken.first;\r
-\r
-    dbusConnection_->unregisterObjectPath(objectPath);\r
-\r
-    dbusRegisteredObjectsTable_.erase(dbusInterfaceHandlerToken);\r
-}\r
-\r
-bool DBusObjectManager::handleMessage(const DBusMessage& dbusMessage) const {\r
-    const char* objectPath = dbusMessage.getObjectPath();\r
-    const char* interfaceName = dbusMessage.getInterfaceName();\r
-\r
-    assert(objectPath);\r
-    assert(interfaceName);\r
-\r
-    DBusInterfaceHandlerPath handlerPath(objectPath, interfaceName);\r
-    auto handlerIterator = dbusRegisteredObjectsTable_.find(handlerPath);\r
-    const bool foundDBusInterfaceHandler = handlerIterator != dbusRegisteredObjectsTable_.end();\r
-    bool dbusMessageHandled = false;\r
-\r
-    if (foundDBusInterfaceHandler) {\r
-        const DBusMessageInterfaceHandler& interfaceHandlerDBusMessageHandler = handlerIterator->second;\r
-        dbusMessageHandled = interfaceHandlerDBusMessageHandler(dbusMessage);\r
-    }\r
-\r
-    return dbusMessageHandled;\r
-}\r
-\r
-bool DBusObjectManager::onGetDBusObjectManagerData(const DBusMessage& callMessage) {\r
-\r
-    DBusObjectToInterfaceDict dictToSend;\r
-\r
-    const char* interfaceName = callMessage.getInterfaceName();\r
-    const char* signature = callMessage.getSignatureString();\r
-\r
-    assert(!strcmp(interfaceName, "org.freedesktop.DBus.ObjectManager"));\r
-    assert(!strcmp(signature, ""));\r
-    assert(callMessage.getType() == DBusMessage::Type::MethodCall);\r
-\r
-    auto registeredObjectsIterator = dbusRegisteredObjectsTable_.begin();\r
-\r
-    while(registeredObjectsIterator != dbusRegisteredObjectsTable_.end()) {\r
-        DBusInterfaceHandlerPath handlerPath = registeredObjectsIterator->first;\r
-        auto foundDictEntry = dictToSend.find(handlerPath.first);\r
-\r
-        if(foundDictEntry == dictToSend.end()) {\r
-            dictToSend.insert( { handlerPath.first, { { handlerPath.second, {} } } } );\r
-        } else {\r
-            foundDictEntry->second.insert( {handlerPath.second, {} } );\r
-        }\r
-\r
-        ++registeredObjectsIterator;\r
-    }\r
-\r
-    DBusMessage replyMessage = callMessage.createMethodReturn(DBusServiceRegistry::getManagedObjectsDBusSignature_);\r
-\r
-    DBusOutputStream outStream(replyMessage);\r
-    outStream << dictToSend;\r
-    outStream.flush();\r
-    return dbusConnection_->sendDBusMessage(replyMessage);\r
-}\r
-\r
-\r
-} // namespace DBus\r
-} // namespace CommonAPI\r
+/* 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 "DBusObjectManager.h"
+#include "DBusOutputStream.h"
+
+#include <cassert>
+
+namespace CommonAPI {
+namespace DBus {
+
+DBusObjectManager::DBusObjectManager(const std::shared_ptr<DBusConnection>& dbusConnection):
+        dbusConnection_(dbusConnection) {
+
+    registerInterfaceHandler("/",
+                             "org.freedesktop.DBus.ObjectManager",
+                             std::bind(&DBusObjectManager::onGetDBusObjectManagerData, this, std::placeholders::_1));
+}
+
+DBusInterfaceHandlerToken DBusObjectManager::registerInterfaceHandler(const std::string& objectPath,
+                                                                      const std::string& interfaceName,
+                                                                      const DBusMessageInterfaceHandler& dbusMessageInterfaceHandler) {
+    DBusInterfaceHandlerPath handlerPath(objectPath, interfaceName);
+    bool noSuchHandlerRegistered = dbusRegisteredObjectsTable_.find(handlerPath) == dbusRegisteredObjectsTable_.end();
+
+    assert(noSuchHandlerRegistered);
+
+    dbusRegisteredObjectsTable_.insert({handlerPath, dbusMessageInterfaceHandler});
+    dbusConnection_->registerObjectPath(objectPath);
+
+    return handlerPath;
+}
+
+void DBusObjectManager::unregisterInterfaceHandler(const DBusInterfaceHandlerToken& dbusInterfaceHandlerToken) {
+    const std::string& objectPath = dbusInterfaceHandlerToken.first;
+
+    dbusConnection_->unregisterObjectPath(objectPath);
+
+    dbusRegisteredObjectsTable_.erase(dbusInterfaceHandlerToken);
+}
+
+bool DBusObjectManager::handleMessage(const DBusMessage& dbusMessage) const {
+    const char* objectPath = dbusMessage.getObjectPath();
+    const char* interfaceName = dbusMessage.getInterfaceName();
+
+    assert(objectPath);
+    assert(interfaceName);
+
+    DBusInterfaceHandlerPath handlerPath(objectPath, interfaceName);
+    auto handlerIterator = dbusRegisteredObjectsTable_.find(handlerPath);
+    const bool foundDBusInterfaceHandler = handlerIterator != dbusRegisteredObjectsTable_.end();
+    bool dbusMessageHandled = false;
+
+    if (foundDBusInterfaceHandler) {
+        const DBusMessageInterfaceHandler& interfaceHandlerDBusMessageHandler = handlerIterator->second;
+        dbusMessageHandled = interfaceHandlerDBusMessageHandler(dbusMessage);
+    }
+
+    return dbusMessageHandled;
+}
+
+bool DBusObjectManager::onGetDBusObjectManagerData(const DBusMessage& callMessage) {
+
+    DBusObjectToInterfaceDict dictToSend;
+
+    const char* interfaceName = callMessage.getInterfaceName();
+    const char* signature = callMessage.getSignatureString();
+
+    assert(!strcmp(interfaceName, "org.freedesktop.DBus.ObjectManager"));
+    assert(!strcmp(signature, ""));
+    assert(callMessage.getType() == DBusMessage::Type::MethodCall);
+
+    auto registeredObjectsIterator = dbusRegisteredObjectsTable_.begin();
+
+    while(registeredObjectsIterator != dbusRegisteredObjectsTable_.end()) {
+        DBusInterfaceHandlerPath handlerPath = registeredObjectsIterator->first;
+        auto foundDictEntry = dictToSend.find(handlerPath.first);
+
+        if(foundDictEntry == dictToSend.end()) {
+            dictToSend.insert( { handlerPath.first, { { handlerPath.second, {} } } } );
+        } else {
+            foundDictEntry->second.insert( {handlerPath.second, {} } );
+        }
+
+        ++registeredObjectsIterator;
+    }
+
+    DBusMessage replyMessage = callMessage.createMethodReturn(DBusServiceRegistry::getManagedObjectsDBusSignature_);
+
+    DBusOutputStream outStream(replyMessage);
+    outStream << dictToSend;
+    outStream.flush();
+    return dbusConnection_->sendDBusMessage(replyMessage);
+}
+
+
+} // namespace DBus
+} // namespace CommonAPI
index 2424fab..712605a 100644 (file)
@@ -1,57 +1,57 @@
-/* Copyright (C) 2013 BMW Group\r
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)\r
- * Author: Juergen Gehring (juergen.gehring@bmw.de)\r
- * This Source Code Form is subject to the terms of the Mozilla Public\r
- * License, v. 2.0. If a copy of the MPL was not distributed with this\r
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
-#ifndef COMMONAPI_DBUS_DBUS_OBJECT_MANAGER_H_\r
-#define COMMONAPI_DBUS_DBUS_OBJECT_MANAGER_H_\r
-\r
-#include "DBusMessage.h"\r
-#include "DBusConnection.h"\r
-\r
-namespace CommonAPI {\r
-namespace DBus {\r
-\r
-// objectPath, interfaceName\r
-typedef std::function<bool(const DBusMessage&)> DBusMessageInterfaceHandler;\r
-typedef std::pair<std::string, std::string> DBusInterfaceHandlerPath;\r
-typedef DBusInterfaceHandlerPath DBusInterfaceHandlerToken;\r
-\r
-class DBusConnection;\r
-\r
-class DBusObjectManager {\r
- public:\r
-    DBusObjectManager(const std::shared_ptr<DBusConnection>&);\r
-\r
-    void init();\r
-\r
-    const DBusInterfaceHandlerToken registerInterfaceHandlerForDBusObject(const std::string& objectPath,\r
-                                                                          const std::string& interfaceName,\r
-                                                                          const DBusMessageInterfaceHandler& dbusMessageInterfaceHandler);\r
-\r
-    DBusInterfaceHandlerToken registerInterfaceHandler(const std::string& objectPath,\r
-                                                       const std::string& interfaceName,\r
-                                                       const DBusMessageInterfaceHandler& dbusMessageInterfaceHandler);\r
-\r
-    void unregisterInterfaceHandler(const DBusInterfaceHandlerToken& dbusInterfaceHandlerToken);\r
-\r
-    bool handleMessage(const DBusMessage&) const;\r
-\r
-\r
- private:\r
-    void addLibdbusObjectPathHandler(const std::string& objectPath);\r
-    void removeLibdbusObjectPathHandler(const std::string& objectPath);\r
-\r
-    bool onGetDBusObjectManagerData(const DBusMessage& callMessage);\r
-\r
-    typedef std::unordered_map<DBusInterfaceHandlerPath, DBusMessageInterfaceHandler> DBusRegisteredObjectsTable;\r
-    DBusRegisteredObjectsTable dbusRegisteredObjectsTable_;\r
-\r
-    std::shared_ptr<DBusConnection> dbusConnection_;\r
-};\r
-\r
-} // namespace DBus\r
-} // namespace CommonAPI\r
-\r
-#endif // COMMONAPI_DBUS_DBUS_OBJECT_MANAGER_H_\r
+/* 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_DBUS_DBUS_OBJECT_MANAGER_H_
+#define COMMONAPI_DBUS_DBUS_OBJECT_MANAGER_H_
+
+#include "DBusMessage.h"
+#include "DBusConnection.h"
+
+namespace CommonAPI {
+namespace DBus {
+
+// objectPath, interfaceName
+typedef std::function<bool(const DBusMessage&)> DBusMessageInterfaceHandler;
+typedef std::pair<std::string, std::string> DBusInterfaceHandlerPath;
+typedef DBusInterfaceHandlerPath DBusInterfaceHandlerToken;
+
+class DBusConnection;
+
+class DBusObjectManager {
+ public:
+    DBusObjectManager(const std::shared_ptr<DBusConnection>&);
+
+    void init();
+
+    const DBusInterfaceHandlerToken registerInterfaceHandlerForDBusObject(const std::string& objectPath,
+                                                                          const std::string& interfaceName,
+                                                                          const DBusMessageInterfaceHandler& dbusMessageInterfaceHandler);
+
+    DBusInterfaceHandlerToken registerInterfaceHandler(const std::string& objectPath,
+                                                       const std::string& interfaceName,
+                                                       const DBusMessageInterfaceHandler& dbusMessageInterfaceHandler);
+
+    void unregisterInterfaceHandler(const DBusInterfaceHandlerToken& dbusInterfaceHandlerToken);
+
+    bool handleMessage(const DBusMessage&) const;
+
+
+ private:
+    void addLibdbusObjectPathHandler(const std::string& objectPath);
+    void removeLibdbusObjectPathHandler(const std::string& objectPath);
+
+    bool onGetDBusObjectManagerData(const DBusMessage& callMessage);
+
+    typedef std::unordered_map<DBusInterfaceHandlerPath, DBusMessageInterfaceHandler> DBusRegisteredObjectsTable;
+    DBusRegisteredObjectsTable dbusRegisteredObjectsTable_;
+
+    std::shared_ptr<DBusConnection> dbusConnection_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUS_OBJECT_MANAGER_H_
index 5077ee9..3d2c00e 100644 (file)
@@ -1,97 +1,97 @@
-/* Copyright (C) 2013 BMW Group\r
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)\r
- * Author: Juergen Gehring (juergen.gehring@bmw.de)\r
- * This Source Code Form is subject to the terms of the Mozilla Public\r
- * License, v. 2.0. If a copy of the MPL was not distributed with this\r
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
-#ifndef COMMONAPI_DBUS_DBUS_PROXY_CONNECTION_H_\r
-#define COMMONAPI_DBUS_DBUS_PROXY_CONNECTION_H_\r
-\r
-#include "DBusError.h"\r
-#include "DBusMessage.h"\r
-\r
-#include "DBusFunctionalHash.h"\r
-#include "DBusServiceStatusEvent.h"\r
-\r
-#include <CommonAPI/types.h>\r
-#include <CommonAPI/Attribute.h>\r
-#include <CommonAPI/Event.h>\r
-\r
-#include <cstdint>\r
-#include <functional>\r
-#include <future>\r
-#include <memory>\r
-#include <tuple>\r
-#include <unordered_map>\r
-#include <utility>\r
-#include <vector>\r
-\r
-namespace CommonAPI {\r
-namespace DBus {\r
-\r
-\r
-typedef std::function<void(const DBusMessage&)> DBusMessageHandler;\r
-\r
-class DBusDaemonProxy;\r
-class DBusServiceRegistry;\r
-class DBusObjectManager;\r
-\r
-\r
-class DBusProxyConnection {\r
- public:\r
-    class DBusMessageReplyAsyncHandler {\r
-     public:\r
-       virtual ~DBusMessageReplyAsyncHandler() { }\r
-       virtual std::future<CallStatus> getFuture() = 0;\r
-       virtual void onDBusMessageReply(const CallStatus&, const DBusMessage&) = 0;\r
-    };\r
-\r
-    class DBusSignalHandler {\r
-     public:\r
-        virtual ~DBusSignalHandler() { }\r
-        virtual SubscriptionStatus onSignalDBusMessage(const DBusMessage&) = 0;\r
-    };\r
-\r
-    // objectPath, interfaceName, interfaceMemberName, interfaceMemberSignature\r
-    typedef std::tuple<std::string, std::string, std::string, std::string> DBusSignalHandlerPath;\r
-    typedef std::unordered_multimap<DBusSignalHandlerPath, DBusSignalHandler*> DBusSignalHandlerTable;\r
-    typedef DBusSignalHandlerPath DBusSignalHandlerToken;\r
-\r
-\r
-       virtual ~DBusProxyConnection() { }\r
-\r
-       virtual bool isConnected() const =  0;\r
-\r
-       virtual bool sendDBusMessage(const DBusMessage& dbusMessage, uint32_t* allocatedSerial = NULL) const = 0;\r
-\r
-       static const int kDefaultSendTimeoutMs = 100 * 1000;\r
-\r
-       virtual std::future<CallStatus> sendDBusMessageWithReplyAsync(\r
-                       const DBusMessage& dbusMessage,\r
-                       std::unique_ptr<DBusMessageReplyAsyncHandler> dbusMessageReplyAsyncHandler,\r
-                       int timeoutMilliseconds = kDefaultSendTimeoutMs) const = 0;\r
-\r
-       virtual DBusMessage sendDBusMessageWithReplyAndBlock(\r
-                       const DBusMessage& dbusMessage,\r
-                       DBusError& dbusError,\r
-                       int timeoutMilliseconds = kDefaultSendTimeoutMs) const = 0;\r
-\r
-       virtual DBusSignalHandlerToken addSignalMemberHandler(\r
-                       const std::string& objectPath,\r
-                       const std::string& interfaceName,\r
-                       const std::string& interfaceMemberName,\r
-                       const std::string& interfaceMemberSignature,\r
-                       DBusSignalHandler* dbusSignalHandler) = 0;\r
-\r
-       virtual void removeSignalMemberHandler(const DBusSignalHandlerToken& dbusSignalHandlerToken) = 0;\r
-\r
-    virtual const std::shared_ptr<DBusDaemonProxy>& getDBusDaemonProxy() = 0;\r
-    virtual const std::shared_ptr<DBusServiceRegistry>& getDBusServiceRegistry() = 0;\r
-    virtual const std::shared_ptr<DBusObjectManager>& getDBusObjectManager() = 0;\r
-};\r
-\r
-\r
-} // namespace DBus\r
-} // namespace CommonAPI\r
-\r
-#endif //COMMONAPI_DBUS_DBUS_PROXY_CONNECTION_H_\r
+/* 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_DBUS_DBUS_PROXY_CONNECTION_H_
+#define COMMONAPI_DBUS_DBUS_PROXY_CONNECTION_H_
+
+#include "DBusError.h"
+#include "DBusMessage.h"
+
+#include "DBusFunctionalHash.h"
+#include "DBusServiceStatusEvent.h"
+
+#include <CommonAPI/types.h>
+#include <CommonAPI/Attribute.h>
+#include <CommonAPI/Event.h>
+
+#include <cstdint>
+#include <functional>
+#include <future>
+#include <memory>
+#include <tuple>
+#include <unordered_map>
+#include <utility>
+#include <vector>
+
+namespace CommonAPI {
+namespace DBus {
+
+
+typedef std::function<void(const DBusMessage&)> DBusMessageHandler;
+
+class DBusDaemonProxy;
+class DBusServiceRegistry;
+class DBusObjectManager;
+
+
+class DBusProxyConnection {
+ public:
+    class DBusMessageReplyAsyncHandler {
+     public:
+       virtual ~DBusMessageReplyAsyncHandler() { }
+       virtual std::future<CallStatus> getFuture() = 0;
+       virtual void onDBusMessageReply(const CallStatus&, const DBusMessage&) = 0;
+    };
+
+    class DBusSignalHandler {
+     public:
+        virtual ~DBusSignalHandler() { }
+        virtual SubscriptionStatus onSignalDBusMessage(const DBusMessage&) = 0;
+    };
+
+    // objectPath, interfaceName, interfaceMemberName, interfaceMemberSignature
+    typedef std::tuple<std::string, std::string, std::string, std::string> DBusSignalHandlerPath;
+    typedef std::unordered_multimap<DBusSignalHandlerPath, DBusSignalHandler*> DBusSignalHandlerTable;
+    typedef DBusSignalHandlerPath DBusSignalHandlerToken;
+
+
+       virtual ~DBusProxyConnection() { }
+
+       virtual bool isConnected() const =  0;
+
+       virtual bool sendDBusMessage(const DBusMessage& dbusMessage, uint32_t* allocatedSerial = NULL) const = 0;
+
+       static const int kDefaultSendTimeoutMs = 100 * 1000;
+
+       virtual std::future<CallStatus> sendDBusMessageWithReplyAsync(
+                       const DBusMessage& dbusMessage,
+                       std::unique_ptr<DBusMessageReplyAsyncHandler> dbusMessageReplyAsyncHandler,
+                       int timeoutMilliseconds = kDefaultSendTimeoutMs) const = 0;
+
+       virtual DBusMessage sendDBusMessageWithReplyAndBlock(
+                       const DBusMessage& dbusMessage,
+                       DBusError& dbusError,
+                       int timeoutMilliseconds = kDefaultSendTimeoutMs) const = 0;
+
+       virtual DBusSignalHandlerToken addSignalMemberHandler(
+                       const std::string& objectPath,
+                       const std::string& interfaceName,
+                       const std::string& interfaceMemberName,
+                       const std::string& interfaceMemberSignature,
+                       DBusSignalHandler* dbusSignalHandler) = 0;
+
+       virtual void removeSignalMemberHandler(const DBusSignalHandlerToken& dbusSignalHandlerToken) = 0;
+
+    virtual const std::shared_ptr<DBusDaemonProxy>& getDBusDaemonProxy() = 0;
+    virtual const std::shared_ptr<DBusServiceRegistry>& getDBusServiceRegistry() = 0;
+    virtual const std::shared_ptr<DBusObjectManager>& getDBusObjectManager() = 0;
+};
+
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif //COMMONAPI_DBUS_DBUS_PROXY_CONNECTION_H_
index 5d80530..da1b272 100644 (file)
@@ -1,32 +1,32 @@
-/* Copyright (C) 2013 BMW Group\r
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)\r
- * Author: Juergen Gehring (juergen.gehring@bmw.de)\r
- * This Source Code Form is subject to the terms of the Mozilla Public\r
- * License, v. 2.0. If a copy of the MPL was not distributed with this\r
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
-#include "DBusRuntime.h"\r
-\r
-namespace CommonAPI {\r
-namespace DBus {\r
-\r
-const MiddlewareInfo DBusRuntime::middlewareInfo_("DBus", &DBusRuntime::getInstance);\r
-\r
-__attribute__((constructor)) void registerDBusMiddleware(void) {\r
-    Runtime::registerRuntimeLoader("DBus", &DBusRuntime::getInstance);\r
-}\r
-\r
-std::shared_ptr<Runtime> DBusRuntime::getInstance() {\r
-    static std::shared_ptr<Runtime> singleton_;\r
-    if(!singleton_) {\r
-        singleton_ = std::make_shared<DBusRuntime>();\r
-    }\r
-    return singleton_;\r
-}\r
-\r
-std::shared_ptr<Factory> DBusRuntime::createFactory() {\r
-    auto factory = std::make_shared<DBusFactory>(this->shared_from_this(), &middlewareInfo_);\r
-    return factory;\r
-}\r
-\r
-} // namespace DBus\r
-} // namespace CommonAPI\r
+/* 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 "DBusRuntime.h"
+
+namespace CommonAPI {
+namespace DBus {
+
+const MiddlewareInfo DBusRuntime::middlewareInfo_("DBus", &DBusRuntime::getInstance);
+
+__attribute__((constructor)) void registerDBusMiddleware(void) {
+    Runtime::registerRuntimeLoader("DBus", &DBusRuntime::getInstance);
+}
+
+std::shared_ptr<Runtime> DBusRuntime::getInstance() {
+    static std::shared_ptr<Runtime> singleton_;
+    if(!singleton_) {
+        singleton_ = std::make_shared<DBusRuntime>();
+    }
+    return singleton_;
+}
+
+std::shared_ptr<Factory> DBusRuntime::createFactory() {
+    auto factory = std::make_shared<DBusFactory>(this->shared_from_this(), &middlewareInfo_);
+    return factory;
+}
+
+} // namespace DBus
+} // namespace CommonAPI
index 82584f6..b91f304 100644 (file)
@@ -1,36 +1,36 @@
-/* Copyright (C) 2013 BMW Group\r
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)\r
- * Author: Juergen Gehring (juergen.gehring@bmw.de)\r
- * This Source Code Form is subject to the terms of the Mozilla Public\r
- * License, v. 2.0. If a copy of the MPL was not distributed with this\r
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
-#ifndef COMMONAPI_DBUS_DBUS_RUNTIME_H_\r
-#define COMMONAPI_DBUS_DBUS_RUNTIME_H_\r
-\r
-#include "CommonAPI/Runtime.h"\r
-\r
-#include "DBusFactory.h"\r
-\r
-namespace CommonAPI {\r
-namespace DBus {\r
-\r
-class DBusRuntime: public Runtime, public std::enable_shared_from_this<DBusRuntime> {\r
- public:\r
-    static std::shared_ptr<Runtime> getInstance();\r
-\r
-    std::shared_ptr<Factory> createFactory();\r
-\r
-    static const MiddlewareInfo middlewareInfo_;\r
-};\r
-\r
-} // namespace DBus\r
-} // namespace CommonAPI\r
-\r
-\r
-extern "C" {\r
-\r
-CommonAPI::MiddlewareInfo middlewareInfo = CommonAPI::DBus::DBusRuntime::middlewareInfo_;\r
-\r
-}\r
-\r
-#endif // COMMONAPI_DBUS_DBUS_RUNTIME_H_\r
+/* 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_DBUS_DBUS_RUNTIME_H_
+#define COMMONAPI_DBUS_DBUS_RUNTIME_H_
+
+#include "CommonAPI/Runtime.h"
+
+#include "DBusFactory.h"
+
+namespace CommonAPI {
+namespace DBus {
+
+class DBusRuntime: public Runtime, public std::enable_shared_from_this<DBusRuntime> {
+ public:
+    static std::shared_ptr<Runtime> getInstance();
+
+    std::shared_ptr<Factory> createFactory();
+
+    static const MiddlewareInfo middlewareInfo_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+
+extern "C" {
+
+CommonAPI::MiddlewareInfo middlewareInfo = CommonAPI::DBus::DBusRuntime::middlewareInfo_;
+
+}
+
+#endif // COMMONAPI_DBUS_DBUS_RUNTIME_H_
index 2c67c44..80cc4e2 100644 (file)
-/* Copyright (C) 2013 BMW Group\r
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)\r
- * Author: Juergen Gehring (juergen.gehring@bmw.de)\r
- * This Source Code Form is subject to the terms of the Mozilla Public\r
- * License, v. 2.0. If a copy of the MPL was not distributed with this\r
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
-#include <utility>\r
-#include <sstream>\r
-#include <string>\r
-#include <tuple>\r
-#include <unistd.h>\r
-\r
-#include "DBusServiceRegistry.h"\r
-#include "DBusInputStream.h"\r
-#include "DBusDaemonProxy.h"\r
-#include "DBusConnection.h"\r
-#include "DBusUtils.h"\r
-\r
-\r
-namespace CommonAPI {\r
-namespace DBus {\r
-\r
-\r
-DBusServiceRegistry::DBusServiceRegistry(std::shared_ptr<DBusConnection> dbusConnection) :\r
-                dbusConnection_(dbusConnection),\r
-                ready(false),\r
-                serviceStatusEvent_(std::shared_ptr<DBusServiceRegistry>(this)),\r
-                readyPromise_(),\r
-                readyMutex_()\r
-{\r
-    readyFuture_ = readyPromise_.get_future();\r
-    cacheAllServices();\r
-    dbusNameOwnerChangedEventSubscription_ =\r
-                    dbusConnection_->getDBusDaemonProxy()->getNameOwnerChangedEvent().subscribe(\r
-                                    std::bind(&DBusServiceRegistry::onDBusNameOwnerChangedEvent,\r
-                                                    this,\r
-                                                    std::placeholders::_1,\r
-                                                    std::placeholders::_2,\r
-                                                    std::placeholders::_3));\r
-    std::thread(std::bind(&DBusServiceRegistry::isReadyBlocking, this)).detach();\r
-}\r
-\r
-void DBusServiceRegistry::registerAvailabilityListener(const std::string& service, const std::function<void(bool)>& listener) {\r
-    availabilityCallbackList.insert({service, listener});\r
-}\r
-\r
-DBusServiceStatusEvent& DBusServiceRegistry::getServiceStatusEvent() {\r
-    return serviceStatusEvent_;\r
-}\r
-\r
-DBusServiceRegistry::~DBusServiceRegistry() {\r
-    dbusConnection_->getDBusDaemonProxy()->getNameOwnerChangedEvent().unsubscribe(dbusNameOwnerChangedEventSubscription_);\r
-}\r
-\r
-std::future<bool>& DBusServiceRegistry::getReadyFuture() {\r
-    return readyFuture_;\r
-}\r
-\r
-bool DBusServiceRegistry::isReadyBlocking() const {\r
-    if (!ready) {\r
-        readyMutex_.lock();\r
-        auto status = readyFuture_.wait_for(std::chrono::seconds(1));\r
-        if (checkReady(status)) {\r
-            ready = true;\r
-        } else {\r
-            ready = true;\r
-            readyPromise_.set_value(true);\r
-        }\r
-        readyMutex_.unlock();\r
-    }\r
-    return ready;\r
-}\r
-\r
-bool DBusServiceRegistry::isReady() const {\r
-       return ready;\r
-}\r
-\r
-std::vector<std::string> DBusServiceRegistry::getAvailableServiceInstances(const std::string& serviceName,\r
-                                                                           const std::string& domainName) {\r
-\r
-       if (!isReadyBlocking()) {\r
-               return std::vector<std::string>();\r
-       }\r
-\r
-    if (domainName != "local" || !dbusConnection_->isConnected()) {\r
-        return std::vector<std::string>();\r
-    }\r
-\r
-    std::vector<std::string> addressesOfKnownServiceInstances;\r
-    auto knownServiceInstancesIteratorPair = dbusCachedProvidersForInterfaces_.equal_range(serviceName);\r
-\r
-    while(knownServiceInstancesIteratorPair.first != knownServiceInstancesIteratorPair.second) {\r
-        const DBusInstanceId& dbusServiceInstanceId = knownServiceInstancesIteratorPair.first->second;\r
-        const std::string& connectionName = dbusServiceInstanceId.first;\r
-        const std::string& objectPath = dbusServiceInstanceId.second;\r
-\r
-        std::string commonApiAddress;\r
-        DBusAddressTranslator::getInstance().searchForCommonAddress(serviceName, connectionName, objectPath, commonApiAddress);\r
-\r
-        addressesOfKnownServiceInstances.push_back(std::move(commonApiAddress));\r
-        ++knownServiceInstancesIteratorPair.first;\r
-    }\r
-\r
-    return addressesOfKnownServiceInstances;\r
-}\r
-\r
-void DBusServiceRegistry::onManagedPathsList(const CallStatus& status, DBusObjectToInterfaceDict managedObjects,\r
-        std::list<std::string>::iterator iter, std::shared_ptr<std::list<std::string>> list) {\r
-\r
-    auto objectPathIterator = managedObjects.begin();\r
-\r
-    while (objectPathIterator != managedObjects.end()) {\r
-        const std::string& serviceObjPath = objectPathIterator->first;\r
-        auto interfaceNameIterator = objectPathIterator->second.begin();\r
-\r
-        while (interfaceNameIterator != objectPathIterator->second.end()) {\r
-            const std::string& interfaceName = interfaceNameIterator->first;\r
-            dbusCachedProvidersForInterfaces_.insert( { interfaceName, { *iter, serviceObjPath } });\r
-            ++interfaceNameIterator;\r
-        }\r
-        ++objectPathIterator;\r
-    }\r
-\r
-    list->erase(iter);\r
-\r
-    if (list->size() == 0) {\r
-        readyMutex_.lock();\r
-        if (!ready) {\r
-            readyPromise_.set_value(true);\r
-            ready = true;\r
-        }\r
-        readyMutex_.unlock();\r
-    }\r
-}\r
-\r
-\r
-bool DBusServiceRegistry::isServiceInstanceAlive(const std::string& dbusInterfaceName,\r
-                                                 const std::string& dbusConnectionName,\r
-                                                 const std::string& dbusObjectPath) {\r
-\r
-    if (!dbusConnection_->isConnected()) {\r
-        return false;\r
-    }\r
-\r
-\r
-    DBusInstanceId serviceInstanceId(dbusConnectionName, dbusObjectPath);\r
-\r
-    if (isReady()) {\r
-        auto knownInstancesForInterfaceIteratorPair = dbusCachedProvidersForInterfaces_.equal_range(dbusInterfaceName);\r
-\r
-        while (knownInstancesForInterfaceIteratorPair.first != knownInstancesForInterfaceIteratorPair.second) {\r
-            DBusInstanceId knownServiceId = knownInstancesForInterfaceIteratorPair.first->second;\r
-            if (knownServiceId == serviceInstanceId) {\r
-                return true;\r
-            }\r
-            ++knownInstancesForInterfaceIteratorPair.first;\r
-        }\r
-    }\r
-\r
-    if (dbusLivingServiceBusNames_.find(dbusConnectionName) != dbusLivingServiceBusNames_.end()) {\r
-        std::promise<bool>* pathPromise = new std::promise<bool>();\r
-        std::future<bool> pathFuture = pathPromise->get_future();\r
-\r
-        getManagedObjects(dbusConnectionName, pathPromise);\r
-\r
-        auto status = pathFuture.wait_for(std::chrono::seconds(1));\r
-        if (checkReady(status)) {\r
-            delete pathPromise;\r
-            auto knownInstancesForInterfaceIteratorPair = dbusCachedProvidersForInterfaces_.equal_range(\r
-                            dbusInterfaceName);\r
-\r
-            while (knownInstancesForInterfaceIteratorPair.first != knownInstancesForInterfaceIteratorPair.second) {\r
-                DBusInstanceId knownServiceId = knownInstancesForInterfaceIteratorPair.first->second;\r
-                if (knownServiceId == serviceInstanceId) {\r
-                    return true;\r
-                }\r
-                ++knownInstancesForInterfaceIteratorPair.first;\r
-            }\r
-        }\r
-\r
-        //If all else fails we have a con name\r
-        return true;\r
-    }\r
-    return false;\r
-}\r
-\r
-\r
-void DBusServiceRegistry::getManagedObjects(const std::string& dbusWellKnownBusName, std::promise<bool>* returnPromise) {\r
-    auto callMessage = DBusMessage::createMethodCall(\r
-                    dbusWellKnownBusName.c_str(),\r
-                    "/",\r
-                    "org.freedesktop.DBus.ObjectManager",\r
-                    "GetManagedObjects",\r
-                    "");\r
-    dbusConnection_->sendDBusMessageWithReplyAsync(\r
-                    callMessage,\r
-                    DBusProxyAsyncCallbackHandler<DBusObjectToInterfaceDict>::create(\r
-                                    std::bind(\r
-                                                    &DBusServiceRegistry::onManagedPaths,\r
-                                                    this,\r
-                                                    std::placeholders::_1,\r
-                                                    std::placeholders::_2,\r
-                                                    dbusWellKnownBusName,\r
-                                                    returnPromise)), 100);\r
-\r
-}\r
-\r
-\r
-void DBusServiceRegistry::onManagedPaths(const CallStatus& status, DBusObjectToInterfaceDict managedObjects,\r
-               std::string dbusWellKnownBusName, std::promise<bool>* returnPromise) {\r
-\r
-       auto objectPathIterator = managedObjects.begin();\r
-\r
-       while (objectPathIterator != managedObjects.end()) {\r
-               const std::string& serviceObjPath = objectPathIterator->first;\r
-               auto interfaceNameIterator = objectPathIterator->second.begin();\r
-\r
-               while (interfaceNameIterator != objectPathIterator->second.end()) {\r
-                       const std::string& interfaceName = interfaceNameIterator->first;\r
-                       dbusCachedProvidersForInterfaces_.insert( { interfaceName, { dbusWellKnownBusName, serviceObjPath } } );\r
-                       updateListeners(dbusWellKnownBusName, serviceObjPath, interfaceName, true);\r
-                       ++interfaceNameIterator;\r
-               }\r
-\r
-               ++objectPathIterator;\r
-       }\r
-       if (returnPromise != 0) {\r
-           returnPromise->set_value(true);\r
-       }\r
-}\r
-\r
-void DBusServiceRegistry::updateListeners(const std::string& conName,\r
-                                          const std::string& objName,\r
-                                          const std::string& intName,\r
-                                          bool available) {\r
-    std::string commonAPIAddress;\r
-    DBusAddressTranslator::getInstance().searchForCommonAddress(conName, objName, intName, commonAPIAddress);\r
-    auto found = availabilityCallbackList.equal_range(std::move(commonAPIAddress));\r
-    auto foundIter = found.first;\r
-    while (foundIter != found.second) {\r
-        foundIter->second(true);\r
-        foundIter++;\r
-    }\r
-\r
-}\r
-\r
-void DBusServiceRegistry::addProvidedServiceInstancesToCache(const std::string& dbusNames) {\r
-       getManagedObjects(dbusNames);\r
-}\r
-\r
-void DBusServiceRegistry::addProvidedServiceInstancesToCache(const std::set<std::string>& dbusNames) {\r
-\r
-    std::shared_ptr<std::list<std::string>> dbusList = std::make_shared<std::list<std::string>>(dbusNames.begin(), dbusNames.end());\r
-\r
-    auto iter = dbusList->begin();\r
-\r
-    while (iter != dbusList->end()) {\r
-\r
-            auto callMessage = DBusMessage::createMethodCall(\r
-                            iter->c_str(),\r
-                            "/",\r
-                            "org.freedesktop.DBus.ObjectManager",\r
-                            "GetManagedObjects",\r
-                            "");\r
-            dbusConnection_->sendDBusMessageWithReplyAsync(\r
-                            callMessage,\r
-                            DBusProxyAsyncCallbackHandler<DBusObjectToInterfaceDict>::create(\r
-                                            std::bind(\r
-                                                            &DBusServiceRegistry::onManagedPathsList,\r
-                                                            this,\r
-                                                            std::placeholders::_1,\r
-                                                            std::placeholders::_2,\r
-                                                            iter,\r
-                                                            dbusList)), 10);\r
-            iter++;\r
-    }\r
-}\r
-\r
-\r
-inline const bool isServiceName(const std::string& name) {\r
-    return name[0] != ':';\r
-}\r
-\r
-void DBusServiceRegistry::onDBusNameOwnerChangedEvent(const std::string& affectedName,\r
-                                                      const std::string& oldOwner,\r
-                                                      const std::string& newOwner) {\r
-    if (isServiceName(affectedName)) {\r
-        if(!oldOwner.empty()) {\r
-            removeProvidedServiceInstancesFromCache(affectedName);\r
-        }\r
-\r
-        if (!newOwner.empty()) {\r
-            addProvidedServiceInstancesToCache(affectedName);\r
-        }\r
-    }\r
-}\r
-\r
-\r
-void DBusServiceRegistry::removeProvidedServiceInstancesFromCache(const std::string& dbusWellKnownBusName) {\r
-    auto providersForInterfacesIteratorPair = dbusCachedProvidersForInterfaces_.equal_range(dbusWellKnownBusName);\r
-\r
-    //Iteriere Ã¼ber (interfaceName, (serviceInstanceId))\r
-    while(providersForInterfacesIteratorPair.first != providersForInterfacesIteratorPair.second) {\r
-\r
-        DBusInstanceId dbusInstanceId = providersForInterfacesIteratorPair.first->second;\r
-        if(std::get<0>(dbusInstanceId) == dbusWellKnownBusName) {\r
-            auto toErase = providersForInterfacesIteratorPair.first;\r
-            ++providersForInterfacesIteratorPair.first;\r
-            dbusCachedProvidersForInterfaces_.erase(toErase);\r
-        }\r
-\r
-        ++providersForInterfacesIteratorPair.first;\r
-    }\r
-}\r
-\r
-void DBusServiceRegistry::onListNames(const CommonAPI::CallStatus& callStatus, std::vector<std::string> existingBusConnections) {\r
-\r
-       if (callStatus == CallStatus::SUCCESS) {\r
-               for (const std::string& connectionName : existingBusConnections) {\r
-                       const bool isWellKnownName = (connectionName[0] != ':');\r
-\r
-                       if (isWellKnownName) {\r
-                               dbusLivingServiceBusNames_.insert(connectionName);\r
-                       }\r
-               }\r
-               addProvidedServiceInstancesToCache(dbusLivingServiceBusNames_);\r
-       }\r
-}\r
-\r
-void DBusServiceRegistry::cacheAllServices() {\r
-    CommonAPI::CallStatus callStatus;\r
-    std::vector<std::string> existingBusConnections;\r
-    dbusConnection_->getDBusDaemonProxy()->listNames(callStatus, existingBusConnections);\r
-    onListNames(callStatus, existingBusConnections);\r
-}\r
-\r
-\r
-}// namespace DBus\r
-}// namespace CommonAPI\r
+/* 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 <utility>
+#include <sstream>
+#include <string>
+#include <tuple>
+#include <unistd.h>
+
+#include "DBusServiceRegistry.h"
+#include "DBusInputStream.h"
+#include "DBusDaemonProxy.h"
+#include "DBusConnection.h"
+#include "DBusUtils.h"
+
+
+namespace CommonAPI {
+namespace DBus {
+
+
+DBusServiceRegistry::DBusServiceRegistry(std::shared_ptr<DBusConnection> dbusConnection) :
+                dbusConnection_(dbusConnection),
+                ready(false),
+                serviceStatusEvent_(std::shared_ptr<DBusServiceRegistry>(this)),
+                readyPromise_(),
+                readyMutex_()
+{
+    readyFuture_ = readyPromise_.get_future();
+    cacheAllServices();
+    dbusNameOwnerChangedEventSubscription_ =
+                    dbusConnection_->getDBusDaemonProxy()->getNameOwnerChangedEvent().subscribe(
+                                    std::bind(&DBusServiceRegistry::onDBusNameOwnerChangedEvent,
+                                                    this,
+                                                    std::placeholders::_1,
+                                                    std::placeholders::_2,
+                                                    std::placeholders::_3));
+    std::thread(std::bind(&DBusServiceRegistry::isReadyBlocking, this)).detach();
+}
+
+void DBusServiceRegistry::registerAvailabilityListener(const std::string& service, const std::function<void(bool)>& listener) {
+    availabilityCallbackList.insert({service, listener});
+}
+
+DBusServiceStatusEvent& DBusServiceRegistry::getServiceStatusEvent() {
+    return serviceStatusEvent_;
+}
+
+DBusServiceRegistry::~DBusServiceRegistry() {
+    dbusConnection_->getDBusDaemonProxy()->getNameOwnerChangedEvent().unsubscribe(dbusNameOwnerChangedEventSubscription_);
+}
+
+std::future<bool>& DBusServiceRegistry::getReadyFuture() {
+    return readyFuture_;
+}
+
+bool DBusServiceRegistry::isReadyBlocking() const {
+    if (!ready) {
+        readyMutex_.lock();
+        auto status = readyFuture_.wait_for(std::chrono::seconds(1));
+        if (checkReady(status)) {
+            ready = true;
+        } else {
+            ready = true;
+            readyPromise_.set_value(true);
+        }
+        readyMutex_.unlock();
+    }
+    return ready;
+}
+
+bool DBusServiceRegistry::isReady() const {
+       return ready;
+}
+
+std::vector<std::string> DBusServiceRegistry::getAvailableServiceInstances(const std::string& serviceName,
+                                                                           const std::string& domainName) {
+
+       if (!isReadyBlocking()) {
+               return std::vector<std::string>();
+       }
+
+    if (domainName != "local" || !dbusConnection_->isConnected()) {
+        return std::vector<std::string>();
+    }
+
+    std::vector<std::string> addressesOfKnownServiceInstances;
+    auto knownServiceInstancesIteratorPair = dbusCachedProvidersForInterfaces_.equal_range(serviceName);
+
+    while(knownServiceInstancesIteratorPair.first != knownServiceInstancesIteratorPair.second) {
+        const DBusInstanceId& dbusServiceInstanceId = knownServiceInstancesIteratorPair.first->second;
+        const std::string& connectionName = dbusServiceInstanceId.first;
+        const std::string& objectPath = dbusServiceInstanceId.second;
+
+        std::string commonApiAddress;
+        DBusAddressTranslator::getInstance().searchForCommonAddress(serviceName, connectionName, objectPath, commonApiAddress);
+
+        addressesOfKnownServiceInstances.push_back(std::move(commonApiAddress));
+        ++knownServiceInstancesIteratorPair.first;
+    }
+
+    return addressesOfKnownServiceInstances;
+}
+
+void DBusServiceRegistry::onManagedPathsList(const CallStatus& status, DBusObjectToInterfaceDict managedObjects,
+        std::list<std::string>::iterator iter, std::shared_ptr<std::list<std::string>> list) {
+
+    auto objectPathIterator = managedObjects.begin();
+
+    while (objectPathIterator != managedObjects.end()) {
+        const std::string& serviceObjPath = objectPathIterator->first;
+        auto interfaceNameIterator = objectPathIterator->second.begin();
+
+        while (interfaceNameIterator != objectPathIterator->second.end()) {
+            const std::string& interfaceName = interfaceNameIterator->first;
+            dbusCachedProvidersForInterfaces_.insert( { interfaceName, { *iter, serviceObjPath } });
+            ++interfaceNameIterator;
+        }
+        ++objectPathIterator;
+    }
+
+    list->erase(iter);
+
+    if (list->size() == 0) {
+        readyMutex_.lock();
+        if (!ready) {
+            readyPromise_.set_value(true);
+            ready = true;
+        }
+        readyMutex_.unlock();
+    }
+}
+
+
+bool DBusServiceRegistry::isServiceInstanceAlive(const std::string& dbusInterfaceName,
+                                                 const std::string& dbusConnectionName,
+                                                 const std::string& dbusObjectPath) {
+
+    if (!dbusConnection_->isConnected()) {
+        return false;
+    }
+
+
+    DBusInstanceId serviceInstanceId(dbusConnectionName, dbusObjectPath);
+
+    if (isReady()) {
+        auto knownInstancesForInterfaceIteratorPair = dbusCachedProvidersForInterfaces_.equal_range(dbusInterfaceName);
+
+        while (knownInstancesForInterfaceIteratorPair.first != knownInstancesForInterfaceIteratorPair.second) {
+            DBusInstanceId knownServiceId = knownInstancesForInterfaceIteratorPair.first->second;
+            if (knownServiceId == serviceInstanceId) {
+                return true;
+            }
+            ++knownInstancesForInterfaceIteratorPair.first;
+        }
+    }
+
+    if (dbusLivingServiceBusNames_.find(dbusConnectionName) != dbusLivingServiceBusNames_.end()) {
+        std::promise<bool>* pathPromise = new std::promise<bool>();
+        std::future<bool> pathFuture = pathPromise->get_future();
+
+        getManagedObjects(dbusConnectionName, pathPromise);
+
+        auto status = pathFuture.wait_for(std::chrono::seconds(1));
+        if (checkReady(status)) {
+            delete pathPromise;
+            auto knownInstancesForInterfaceIteratorPair = dbusCachedProvidersForInterfaces_.equal_range(
+                            dbusInterfaceName);
+
+            while (knownInstancesForInterfaceIteratorPair.first != knownInstancesForInterfaceIteratorPair.second) {
+                DBusInstanceId knownServiceId = knownInstancesForInterfaceIteratorPair.first->second;
+                if (knownServiceId == serviceInstanceId) {
+                    return true;
+                }
+                ++knownInstancesForInterfaceIteratorPair.first;
+            }
+        }
+
+        //If all else fails we have a con name
+        return true;
+    }
+    return false;
+}
+
+
+void DBusServiceRegistry::getManagedObjects(const std::string& dbusWellKnownBusName, std::promise<bool>* returnPromise) {
+    auto callMessage = DBusMessage::createMethodCall(
+                    dbusWellKnownBusName.c_str(),
+                    "/",
+                    "org.freedesktop.DBus.ObjectManager",
+                    "GetManagedObjects",
+                    "");
+    dbusConnection_->sendDBusMessageWithReplyAsync(
+                    callMessage,
+                    DBusProxyAsyncCallbackHandler<DBusObjectToInterfaceDict>::create(
+                                    std::bind(
+                                                    &DBusServiceRegistry::onManagedPaths,
+                                                    this,
+                                                    std::placeholders::_1,
+                                                    std::placeholders::_2,
+                                                    dbusWellKnownBusName,
+                                                    returnPromise)), 100);
+
+}
+
+
+void DBusServiceRegistry::onManagedPaths(const CallStatus& status, DBusObjectToInterfaceDict managedObjects,
+               std::string dbusWellKnownBusName, std::promise<bool>* returnPromise) {
+
+       auto objectPathIterator = managedObjects.begin();
+
+       while (objectPathIterator != managedObjects.end()) {
+               const std::string& serviceObjPath = objectPathIterator->first;
+               auto interfaceNameIterator = objectPathIterator->second.begin();
+
+               while (interfaceNameIterator != objectPathIterator->second.end()) {
+                       const std::string& interfaceName = interfaceNameIterator->first;
+                       dbusCachedProvidersForInterfaces_.insert( { interfaceName, { dbusWellKnownBusName, serviceObjPath } } );
+                       updateListeners(dbusWellKnownBusName, serviceObjPath, interfaceName, true);
+                       ++interfaceNameIterator;
+               }
+
+               ++objectPathIterator;
+       }
+       if (returnPromise != 0) {
+           returnPromise->set_value(true);
+       }
+}
+
+void DBusServiceRegistry::updateListeners(const std::string& conName,
+                                          const std::string& objName,
+                                          const std::string& intName,
+                                          bool available) {
+    std::string commonAPIAddress;
+    DBusAddressTranslator::getInstance().searchForCommonAddress(conName, objName, intName, commonAPIAddress);
+    auto found = availabilityCallbackList.equal_range(std::move(commonAPIAddress));
+    auto foundIter = found.first;
+    while (foundIter != found.second) {
+        foundIter->second(true);
+        foundIter++;
+    }
+
+}
+
+void DBusServiceRegistry::addProvidedServiceInstancesToCache(const std::string& dbusNames) {
+       getManagedObjects(dbusNames);
+}
+
+void DBusServiceRegistry::addProvidedServiceInstancesToCache(const std::set<std::string>& dbusNames) {
+
+    std::shared_ptr<std::list<std::string>> dbusList = std::make_shared<std::list<std::string>>(dbusNames.begin(), dbusNames.end());
+
+    auto iter = dbusList->begin();
+
+    while (iter != dbusList->end()) {
+
+            auto callMessage = DBusMessage::createMethodCall(
+                            iter->c_str(),
+                            "/",
+                            "org.freedesktop.DBus.ObjectManager",
+                            "GetManagedObjects",
+                            "");
+            dbusConnection_->sendDBusMessageWithReplyAsync(
+                            callMessage,
+                            DBusProxyAsyncCallbackHandler<DBusObjectToInterfaceDict>::create(
+                                            std::bind(
+                                                            &DBusServiceRegistry::onManagedPathsList,
+                                                            this,
+                                                            std::placeholders::_1,
+                                                            std::placeholders::_2,
+                                                            iter,
+                                                            dbusList)), 10);
+            iter++;
+    }
+}
+
+
+inline const bool isServiceName(const std::string& name) {
+    return name[0] != ':';
+}
+
+void DBusServiceRegistry::onDBusNameOwnerChangedEvent(const std::string& affectedName,
+                                                      const std::string& oldOwner,
+                                                      const std::string& newOwner) {
+    if (isServiceName(affectedName)) {
+        if(!oldOwner.empty()) {
+            removeProvidedServiceInstancesFromCache(affectedName);
+        }
+
+        if (!newOwner.empty()) {
+            addProvidedServiceInstancesToCache(affectedName);
+        }
+    }
+}
+
+
+void DBusServiceRegistry::removeProvidedServiceInstancesFromCache(const std::string& dbusWellKnownBusName) {
+    auto providersForInterfacesIteratorPair = dbusCachedProvidersForInterfaces_.equal_range(dbusWellKnownBusName);
+
+    //Iteriere Ã¼ber (interfaceName, (serviceInstanceId))
+    while(providersForInterfacesIteratorPair.first != providersForInterfacesIteratorPair.second) {
+
+        DBusInstanceId dbusInstanceId = providersForInterfacesIteratorPair.first->second;
+        if(std::get<0>(dbusInstanceId) == dbusWellKnownBusName) {
+            auto toErase = providersForInterfacesIteratorPair.first;
+            ++providersForInterfacesIteratorPair.first;
+            dbusCachedProvidersForInterfaces_.erase(toErase);
+        }
+
+        ++providersForInterfacesIteratorPair.first;
+    }
+}
+
+void DBusServiceRegistry::onListNames(const CommonAPI::CallStatus& callStatus, std::vector<std::string> existingBusConnections) {
+
+       if (callStatus == CallStatus::SUCCESS) {
+               for (const std::string& connectionName : existingBusConnections) {
+                       const bool isWellKnownName = (connectionName[0] != ':');
+
+                       if (isWellKnownName) {
+                               dbusLivingServiceBusNames_.insert(connectionName);
+                       }
+               }
+               addProvidedServiceInstancesToCache(dbusLivingServiceBusNames_);
+       }
+}
+
+void DBusServiceRegistry::cacheAllServices() {
+    CommonAPI::CallStatus callStatus;
+    std::vector<std::string> existingBusConnections;
+    dbusConnection_->getDBusDaemonProxy()->listNames(callStatus, existingBusConnections);
+    onListNames(callStatus, existingBusConnections);
+}
+
+
+}// namespace DBus
+}// namespace CommonAPI
index 4a806f1..7d8d7d3 100644 (file)
-/* Copyright (C) 2013 BMW Group\r
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)\r
- * Author: Juergen Gehring (juergen.gehring@bmw.de)\r
- * This Source Code Form is subject to the terms of the Mozilla Public\r
- * License, v. 2.0. If a copy of the MPL was not distributed with this\r
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
-#ifndef COMMONAPI_DBUS_DBUS_SERVICE_REGISTRY_H_\r
-#define COMMONAPI_DBUS_DBUS_SERVICE_REGISTRY_H_\r
-\r
-\r
-#include <CommonAPI/types.h>\r
-#include <CommonAPI/Attribute.h>\r
-\r
-#include "DBusConnection.h"\r
-#include "DBusAddressTranslator.h"\r
-\r
-#include <unordered_map>\r
-#include <map>\r
-#include <unordered_set>\r
-#include <string>\r
-#include <vector>\r
-#include <memory>\r
-#include <list>\r
-#include <mutex>\r
-#include <algorithm>\r
-#include <set>\r
-\r
-namespace CommonAPI {\r
-namespace DBus {\r
-\r
-typedef Event<std::string, std::string, std::string> NameOwnerChangedEvent;\r
-typedef Event<std::string, std::string, std::string>::Subscription NameOwnerChangedEventSubscription;\r
-\r
-//connectionName, objectPath\r
-typedef std::pair<std::string, std::string> DBusInstanceId;\r
-\r
-typedef std::unordered_map<std::string, int> PropertyDictStub;\r
-typedef std::unordered_map<std::string, PropertyDictStub> InterfaceToPropertyDict;\r
-typedef std::unordered_map<std::string, InterfaceToPropertyDict> DBusObjectToInterfaceDict;\r
-\r
-class DBusConnection;\r
-class DBusDaemonProxy;\r
-\r
-\r
-class DBusServiceRegistry {\r
- public:\r
-    static constexpr const char* getManagedObjectsDBusSignature_ = "a{oa{sa{sv}}}";\r
-\r
-    DBusServiceRegistry() = delete;\r
-    DBusServiceRegistry(const DBusServiceRegistry&) = delete;\r
-    DBusServiceRegistry& operator=(const DBusServiceRegistry&) = delete;\r
-\r
-    DBusServiceRegistry(std::shared_ptr<DBusConnection> connection);\r
-    ~DBusServiceRegistry();\r
-\r
-    std::vector<std::string> getAvailableServiceInstances(const std::string& interfaceName,\r
-                                                          const std::string& domainName = "local");\r
-\r
-    bool isServiceInstanceAlive(const std::string& dbusInterfaceName,\r
-                                const std::string& dbusConnectionName,\r
-                                const std::string& dbusObjectPath);\r
-    bool isConnectionAlive(const std::string& dbusConnectionName) const;\r
-\r
-    bool isReady() const;\r
-\r
-    bool isReadyBlocking() const;\r
-\r
-    void registerAvailabilityListener(const std::string& service, const std::function<void(bool)>& listener);\r
-\r
-    std::future<bool>& getReadyFuture();\r
-\r
-    DBusServiceStatusEvent& getServiceStatusEvent();\r
-\r
- private:\r
-    void cacheAllServices();\r
-\r
-    void removeProvidedServiceInstancesFromCache(const std::string& serviceBusName);\r
-    void addProvidedServiceInstancesToCache(const std::set<std::string>& dbusNames);\r
-    void addProvidedServiceInstancesToCache(const std::string& dbusNames);\r
-    void addAllProvidedServiceInstancesToCache(const std::vector<std::string>& serviceBusNames);\r
-\r
-    void getManagedObjects(const std::string& serviceBusName, std::promise<bool>* returnPromise = 0);\r
-\r
-    void onDBusNameOwnerChangedEvent(const std::string& name, const std::string& oldOwner, const std::string& newOwner);\r
-\r
-    bool isRemoteServiceVersionMatchingLocalVersion(const std::string& serviceBusName, const std::string& serviceInterfaceName);\r
-    bool isServiceInstanceAliveHelper(const std::string& connectionName) const;\r
-\r
-    void onManagedPaths(const CallStatus& status, DBusObjectToInterfaceDict replyMessage, std::string dbusWellKnownBusName, std::promise<bool>* returnPromise = 0);\r
-    void onManagedPathsList(const CallStatus& status, DBusObjectToInterfaceDict managedObjects, std::list<std::string>::iterator iter, std::shared_ptr<std::list<std::string>> list);\r
-\r
-    void onListNames(const CommonAPI::CallStatus&, std::vector<std::string>);\r
-    void updateListeners(const std::string& conName, const std::string& objName, const std::string& intName , bool available);\r
-\r
-    std::multimap<std::string, DBusInstanceId> dbusCachedProvidersForInterfaces_;\r
-    std::set<std::string> dbusLivingServiceBusNames_;\r
-\r
-    std::shared_ptr<DBusConnection> dbusConnection_;\r
-\r
-    std::unordered_multimap<std::string, std::function<void(bool)>> availabilityCallbackList;\r
-\r
-    NameOwnerChangedEvent::Subscription dbusNameOwnerChangedEventSubscription_;\r
-\r
-    mutable bool ready;\r
-    mutable std::future<bool> readyFuture_;\r
-    mutable std::promise<bool> readyPromise_;\r
-\r
-    mutable std::mutex readyMutex_;\r
-\r
-    DBusServiceStatusEvent serviceStatusEvent_;\r
-};\r
-\r
-} // namespace DBus\r
-} // namespace CommonAPI\r
-\r
-#endif // COMMONAPI_DBUS_DBUS_SERVICE_REGISTRY_H_\r
+/* 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_DBUS_DBUS_SERVICE_REGISTRY_H_
+#define COMMONAPI_DBUS_DBUS_SERVICE_REGISTRY_H_
+
+
+#include <CommonAPI/types.h>
+#include <CommonAPI/Attribute.h>
+
+#include "DBusConnection.h"
+#include "DBusAddressTranslator.h"
+
+#include <unordered_map>
+#include <map>
+#include <unordered_set>
+#include <string>
+#include <vector>
+#include <memory>
+#include <list>
+#include <mutex>
+#include <algorithm>
+#include <set>
+
+namespace CommonAPI {
+namespace DBus {
+
+typedef Event<std::string, std::string, std::string> NameOwnerChangedEvent;
+typedef Event<std::string, std::string, std::string>::Subscription NameOwnerChangedEventSubscription;
+
+//connectionName, objectPath
+typedef std::pair<std::string, std::string> DBusInstanceId;
+
+typedef std::unordered_map<std::string, int> PropertyDictStub;
+typedef std::unordered_map<std::string, PropertyDictStub> InterfaceToPropertyDict;
+typedef std::unordered_map<std::string, InterfaceToPropertyDict> DBusObjectToInterfaceDict;
+
+class DBusConnection;
+class DBusDaemonProxy;
+
+
+class DBusServiceRegistry {
+ public:
+    static constexpr const char* getManagedObjectsDBusSignature_ = "a{oa{sa{sv}}}";
+
+    DBusServiceRegistry() = delete;
+    DBusServiceRegistry(const DBusServiceRegistry&) = delete;
+    DBusServiceRegistry& operator=(const DBusServiceRegistry&) = delete;
+
+    DBusServiceRegistry(std::shared_ptr<DBusConnection> connection);
+    ~DBusServiceRegistry();
+
+    std::vector<std::string> getAvailableServiceInstances(const std::string& interfaceName,
+                                                          const std::string& domainName = "local");
+
+    bool isServiceInstanceAlive(const std::string& dbusInterfaceName,
+                                const std::string& dbusConnectionName,
+                                const std::string& dbusObjectPath);
+    bool isConnectionAlive(const std::string& dbusConnectionName) const;
+
+    bool isReady() const;
+
+    bool isReadyBlocking() const;
+
+    void registerAvailabilityListener(const std::string& service, const std::function<void(bool)>& listener);
+
+    std::future<bool>& getReadyFuture();
+
+    DBusServiceStatusEvent& getServiceStatusEvent();
+
+ private:
+    void cacheAllServices();
+
+    void removeProvidedServiceInstancesFromCache(const std::string& serviceBusName);
+    void addProvidedServiceInstancesToCache(const std::set<std::string>& dbusNames);
+    void addProvidedServiceInstancesToCache(const std::string& dbusNames);
+    void addAllProvidedServiceInstancesToCache(const std::vector<std::string>& serviceBusNames);
+
+    void getManagedObjects(const std::string& serviceBusName, std::promise<bool>* returnPromise = 0);
+
+    void onDBusNameOwnerChangedEvent(const std::string& name, const std::string& oldOwner, const std::string& newOwner);
+
+    bool isRemoteServiceVersionMatchingLocalVersion(const std::string& serviceBusName, const std::string& serviceInterfaceName);
+    bool isServiceInstanceAliveHelper(const std::string& connectionName) const;
+
+    void onManagedPaths(const CallStatus& status, DBusObjectToInterfaceDict replyMessage, std::string dbusWellKnownBusName, std::promise<bool>* returnPromise = 0);
+    void onManagedPathsList(const CallStatus& status, DBusObjectToInterfaceDict managedObjects, std::list<std::string>::iterator iter, std::shared_ptr<std::list<std::string>> list);
+
+    void onListNames(const CommonAPI::CallStatus&, std::vector<std::string>);
+    void updateListeners(const std::string& conName, const std::string& objName, const std::string& intName , bool available);
+
+    std::multimap<std::string, DBusInstanceId> dbusCachedProvidersForInterfaces_;
+    std::set<std::string> dbusLivingServiceBusNames_;
+
+    std::shared_ptr<DBusConnection> dbusConnection_;
+
+    std::unordered_multimap<std::string, std::function<void(bool)>> availabilityCallbackList;
+
+    NameOwnerChangedEvent::Subscription dbusNameOwnerChangedEventSubscription_;
+
+    mutable bool ready;
+    mutable std::future<bool> readyFuture_;
+    mutable std::promise<bool> readyPromise_;
+
+    mutable std::mutex readyMutex_;
+
+    DBusServiceStatusEvent serviceStatusEvent_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUS_SERVICE_REGISTRY_H_
index a21e575..b2be5da 100644 (file)
@@ -1,42 +1,42 @@
-/* Copyright (C) 2013 BMW Group\r
- * Author: Manfred Bathelt (manfred.bathelt@bmw.de)\r
- * Author: Juergen Gehring (juergen.gehring@bmw.de)\r
- * This Source Code Form is subject to the terms of the Mozilla Public\r
- * License, v. 2.0. If a copy of the MPL was not distributed with this\r
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
-#ifndef COMMONAPI_DBUS_DBUS_SERVICE_STATUS_EVENT_H_\r
-#define COMMONAPI_DBUS_DBUS_SERVICE_STATUS_EVENT_H_\r
-\r
-#include "DBusMultiEvent.h"\r
-\r
-#include <CommonAPI/Event.h>\r
-#include <CommonAPI/types.h>\r
-\r
-#include <string>\r
-#include <memory>\r
-\r
-namespace CommonAPI {\r
-namespace DBus {\r
-\r
-\r
-class DBusServiceRegistry;\r
-\r
-class DBusServiceStatusEvent: public DBusMultiEvent<AvailabilityStatus> {\r
- public:\r
-       DBusServiceStatusEvent(std::shared_ptr<DBusServiceRegistry> registry);\r
-\r
- protected:\r
-       void onFirstListenerAdded(const std::string& commonApiServiceName, const Listener& listener);\r
-       void onListenerAdded(const std::string& commonApiServiceName, const Listener& listener);\r
-\r
- private:\r
-       void availabilityEvent(const std::string& commonApiServiceName, const bool& available);\r
-\r
-       std::shared_ptr<DBusServiceRegistry> registry_;\r
-};\r
-\r
-} // namespace DBus\r
-} // namespace CommonAPI\r
-\r
-#endif // COMMONAPI_DBUS_DBUS_SERVICE_STATUS_EVENT_H_\r
-\r
+/* 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_DBUS_DBUS_SERVICE_STATUS_EVENT_H_
+#define COMMONAPI_DBUS_DBUS_SERVICE_STATUS_EVENT_H_
+
+#include "DBusMultiEvent.h"
+
+#include <CommonAPI/Event.h>
+#include <CommonAPI/types.h>
+
+#include <string>
+#include <memory>
+
+namespace CommonAPI {
+namespace DBus {
+
+
+class DBusServiceRegistry;
+
+class DBusServiceStatusEvent: public DBusMultiEvent<AvailabilityStatus> {
+ public:
+       DBusServiceStatusEvent(std::shared_ptr<DBusServiceRegistry> registry);
+
+ protected:
+       void onFirstListenerAdded(const std::string& commonApiServiceName, const Listener& listener);
+       void onListenerAdded(const std::string& commonApiServiceName, const Listener& listener);
+
+ private:
+       void availabilityEvent(const std::string& commonApiServiceName, const bool& available);
+
+       std::shared_ptr<DBusServiceRegistry> registry_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DBUS_DBUS_SERVICE_STATUS_EVENT_H_
+
index c2d2fb7..3ee5885 100644 (file)
-//-----------------------------------------------------------------------------\r
-// MurmurHash3 was written by Austin Appleby, and is placed in the public\r
-// domain. The author hereby disclaims copyright to this source code.\r
-\r
-// Note - The x86 and x64 versions do _not_ produce the same results, as the\r
-// algorithms are optimized for their respective platforms. You can still\r
-// compile and run any of them on any platform, but your performance with the\r
-// non-native version will be less than optimal.\r
-\r
-#include "MurmurHash3.h"\r
-\r
-//-----------------------------------------------------------------------------\r
-// Platform-specific functions and macros\r
-\r
-// Microsoft Visual Studio\r
-\r
-#if defined(_MSC_VER)\r
-\r
-#define FORCE_INLINE   __forceinline\r
-\r
-#include <stdlib.h>\r
-\r
-#define ROTL32(x,y)    _rotl(x,y)\r
-#define ROTL64(x,y)    _rotl64(x,y)\r
-\r
-#define BIG_CONSTANT(x) (x)\r
-\r
-// Other compilers\r
-\r
-#else  // defined(_MSC_VER)\r
-\r
-#define        FORCE_INLINE __attribute__((always_inline))\r
-\r
-inline uint32_t rotl32 ( uint32_t x, int8_t r )\r
-{\r
-  return (x << r) | (x >> (32 - r));\r
-}\r
-\r
-inline uint64_t rotl64 ( uint64_t x, int8_t r )\r
-{\r
-  return (x << r) | (x >> (64 - r));\r
-}\r
-\r
-#define        ROTL32(x,y)     rotl32(x,y)\r
-#define ROTL64(x,y)    rotl64(x,y)\r
-\r
-#define BIG_CONSTANT(x) (x##LLU)\r
-\r
-#endif // !defined(_MSC_VER)\r
-\r
-//-----------------------------------------------------------------------------\r
-// Block read - if your platform needs to do endian-swapping or can only\r
-// handle aligned reads, do the conversion here\r
-\r
-inline uint32_t getblock ( const uint32_t * p, int i )\r
-{\r
-  return p[i];\r
-}\r
-\r
-inline uint64_t getblock ( const uint64_t * p, int i )\r
-{\r
-  return p[i];\r
-}\r
-\r
-//-----------------------------------------------------------------------------\r
-// Finalization mix - force all bits of a hash block to avalanche\r
-\r
-inline uint32_t fmix ( uint32_t h )\r
-{\r
-  h ^= h >> 16;\r
-  h *= 0x85ebca6b;\r
-  h ^= h >> 13;\r
-  h *= 0xc2b2ae35;\r
-  h ^= h >> 16;\r
-\r
-  return h;\r
-}\r
-\r
-//----------\r
-\r
-inline uint64_t fmix ( uint64_t k )\r
-{\r
-  k ^= k >> 33;\r
-  k *= BIG_CONSTANT(0xff51afd7ed558ccd);\r
-  k ^= k >> 33;\r
-  k *= BIG_CONSTANT(0xc4ceb9fe1a85ec53);\r
-  k ^= k >> 33;\r
-\r
-  return k;\r
-}\r
-\r
-//-----------------------------------------------------------------------------\r
-\r
-void MurmurHash3_x86_32 ( const void * key, int len,\r
-                          uint32_t seed, void * out )\r
-{\r
-  const uint8_t * data = (const uint8_t*)key;\r
-  const int nblocks = len / 4;\r
-\r
-  uint32_t h1 = seed;\r
-\r
-  uint32_t c1 = 0xcc9e2d51;\r
-  uint32_t c2 = 0x1b873593;\r
-\r
-  //----------\r
-  // body\r
-\r
-  const uint32_t * blocks = (const uint32_t *)(data + nblocks*4);\r
-\r
-  for(int i = -nblocks; i; i++)\r
-  {\r
-    uint32_t k1 = getblock(blocks,i);\r
-\r
-    k1 *= c1;\r
-    k1 = ROTL32(k1,15);\r
-    k1 *= c2;\r
-    \r
-    h1 ^= k1;\r
-    h1 = ROTL32(h1,13); \r
-    h1 = h1*5+0xe6546b64;\r
-  }\r
-\r
-  //----------\r
-  // tail\r
-\r
-  const uint8_t * tail = (const uint8_t*)(data + nblocks*4);\r
-\r
-  uint32_t k1 = 0;\r
-\r
-  switch(len & 3)\r
-  {\r
-  case 3: k1 ^= tail[2] << 16;\r
-  case 2: k1 ^= tail[1] << 8;\r
-  case 1: k1 ^= tail[0];\r
-          k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;\r
-  };\r
-\r
-  //----------\r
-  // finalization\r
-\r
-  h1 ^= len;\r
-\r
-  h1 = fmix(h1);\r
-\r
-  *(uint32_t*)out = h1;\r
-} \r
-\r
-//-----------------------------------------------------------------------------\r
-\r
-void MurmurHash3_x86_128 ( const void * key, const int len,\r
-                           uint32_t seed, void * out )\r
-{\r
-  const uint8_t * data = (const uint8_t*)key;\r
-  const int nblocks = len / 16;\r
-\r
-  uint32_t h1 = seed;\r
-  uint32_t h2 = seed;\r
-  uint32_t h3 = seed;\r
-  uint32_t h4 = seed;\r
-\r
-  uint32_t c1 = 0x239b961b; \r
-  uint32_t c2 = 0xab0e9789;\r
-  uint32_t c3 = 0x38b34ae5; \r
-  uint32_t c4 = 0xa1e38b93;\r
-\r
-  //----------\r
-  // body\r
-\r
-  const uint32_t * blocks = (const uint32_t *)(data + nblocks*16);\r
-\r
-  for(int i = -nblocks; i; i++)\r
-  {\r
-    uint32_t k1 = getblock(blocks,i*4+0);\r
-    uint32_t k2 = getblock(blocks,i*4+1);\r
-    uint32_t k3 = getblock(blocks,i*4+2);\r
-    uint32_t k4 = getblock(blocks,i*4+3);\r
-\r
-    k1 *= c1; k1  = ROTL32(k1,15); k1 *= c2; h1 ^= k1;\r
-\r
-    h1 = ROTL32(h1,19); h1 += h2; h1 = h1*5+0x561ccd1b;\r
-\r
-    k2 *= c2; k2  = ROTL32(k2,16); k2 *= c3; h2 ^= k2;\r
-\r
-    h2 = ROTL32(h2,17); h2 += h3; h2 = h2*5+0x0bcaa747;\r
-\r
-    k3 *= c3; k3  = ROTL32(k3,17); k3 *= c4; h3 ^= k3;\r
-\r
-    h3 = ROTL32(h3,15); h3 += h4; h3 = h3*5+0x96cd1c35;\r
-\r
-    k4 *= c4; k4  = ROTL32(k4,18); k4 *= c1; h4 ^= k4;\r
-\r
-    h4 = ROTL32(h4,13); h4 += h1; h4 = h4*5+0x32ac3b17;\r
-  }\r
-\r
-  //----------\r
-  // tail\r
-\r
-  const uint8_t * tail = (const uint8_t*)(data + nblocks*16);\r
-\r
-  uint32_t k1 = 0;\r
-  uint32_t k2 = 0;\r
-  uint32_t k3 = 0;\r
-  uint32_t k4 = 0;\r
-\r
-  switch(len & 15)\r
-  {\r
-  case 15: k4 ^= tail[14] << 16;\r
-  case 14: k4 ^= tail[13] << 8;\r
-  case 13: k4 ^= tail[12] << 0;\r
-           k4 *= c4; k4  = ROTL32(k4,18); k4 *= c1; h4 ^= k4;\r
-\r
-  case 12: k3 ^= tail[11] << 24;\r
-  case 11: k3 ^= tail[10] << 16;\r
-  case 10: k3 ^= tail[ 9] << 8;\r
-  case  9: k3 ^= tail[ 8] << 0;\r
-           k3 *= c3; k3  = ROTL32(k3,17); k3 *= c4; h3 ^= k3;\r
-\r
-  case  8: k2 ^= tail[ 7] << 24;\r
-  case  7: k2 ^= tail[ 6] << 16;\r
-  case  6: k2 ^= tail[ 5] << 8;\r
-  case  5: k2 ^= tail[ 4] << 0;\r
-           k2 *= c2; k2  = ROTL32(k2,16); k2 *= c3; h2 ^= k2;\r
-\r
-  case  4: k1 ^= tail[ 3] << 24;\r
-  case  3: k1 ^= tail[ 2] << 16;\r
-  case  2: k1 ^= tail[ 1] << 8;\r
-  case  1: k1 ^= tail[ 0] << 0;\r
-           k1 *= c1; k1  = ROTL32(k1,15); k1 *= c2; h1 ^= k1;\r
-  };\r
-\r
-  //----------\r
-  // finalization\r
-\r
-  h1 ^= len; h2 ^= len; h3 ^= len; h4 ^= len;\r
-\r
-  h1 += h2; h1 += h3; h1 += h4;\r
-  h2 += h1; h3 += h1; h4 += h1;\r
-\r
-  h1 = fmix(h1);\r
-  h2 = fmix(h2);\r
-  h3 = fmix(h3);\r
-  h4 = fmix(h4);\r
-\r
-  h1 += h2; h1 += h3; h1 += h4;\r
-  h2 += h1; h3 += h1; h4 += h1;\r
-\r
-  ((uint32_t*)out)[0] = h1;\r
-  ((uint32_t*)out)[1] = h2;\r
-  ((uint32_t*)out)[2] = h3;\r
-  ((uint32_t*)out)[3] = h4;\r
-}\r
-\r
-//-----------------------------------------------------------------------------\r
-\r
-void MurmurHash3_x64_128 ( const void * key, const int len,\r
-                           const uint32_t seed, void * out )\r
-{\r
-  const uint8_t * data = (const uint8_t*)key;\r
-  const int nblocks = len / 16;\r
-\r
-  uint64_t h1 = seed;\r
-  uint64_t h2 = seed;\r
-\r
-  uint64_t c1 = BIG_CONSTANT(0x87c37b91114253d5);\r
-  uint64_t c2 = BIG_CONSTANT(0x4cf5ad432745937f);\r
-\r
-  //----------\r
-  // body\r
-\r
-  const uint64_t * blocks = (const uint64_t *)(data);\r
-\r
-  for(int i = 0; i < nblocks; i++)\r
-  {\r
-    uint64_t k1 = getblock(blocks,i*2+0);\r
-    uint64_t k2 = getblock(blocks,i*2+1);\r
-\r
-    k1 *= c1; k1  = ROTL64(k1,31); k1 *= c2; h1 ^= k1;\r
-\r
-    h1 = ROTL64(h1,27); h1 += h2; h1 = h1*5+0x52dce729;\r
-\r
-    k2 *= c2; k2  = ROTL64(k2,33); k2 *= c1; h2 ^= k2;\r
-\r
-    h2 = ROTL64(h2,31); h2 += h1; h2 = h2*5+0x38495ab5;\r
-  }\r
-\r
-  //----------\r
-  // tail\r
-\r
-  const uint8_t * tail = (const uint8_t*)(data + nblocks*16);\r
-\r
-  uint64_t k1 = 0;\r
-  uint64_t k2 = 0;\r
-\r
-  switch(len & 15)\r
-  {\r
-  case 15: k2 ^= uint64_t(tail[14]) << 48;\r
-  case 14: k2 ^= uint64_t(tail[13]) << 40;\r
-  case 13: k2 ^= uint64_t(tail[12]) << 32;\r
-  case 12: k2 ^= uint64_t(tail[11]) << 24;\r
-  case 11: k2 ^= uint64_t(tail[10]) << 16;\r
-  case 10: k2 ^= uint64_t(tail[ 9]) << 8;\r
-  case  9: k2 ^= uint64_t(tail[ 8]) << 0;\r
-           k2 *= c2; k2  = ROTL64(k2,33); k2 *= c1; h2 ^= k2;\r
-\r
-  case  8: k1 ^= uint64_t(tail[ 7]) << 56;\r
-  case  7: k1 ^= uint64_t(tail[ 6]) << 48;\r
-  case  6: k1 ^= uint64_t(tail[ 5]) << 40;\r
-  case  5: k1 ^= uint64_t(tail[ 4]) << 32;\r
-  case  4: k1 ^= uint64_t(tail[ 3]) << 24;\r
-  case  3: k1 ^= uint64_t(tail[ 2]) << 16;\r
-  case  2: k1 ^= uint64_t(tail[ 1]) << 8;\r
-  case  1: k1 ^= uint64_t(tail[ 0]) << 0;\r
-           k1 *= c1; k1  = ROTL64(k1,31); k1 *= c2; h1 ^= k1;\r
-  };\r
-\r
-  //----------\r
-  // finalization\r
-\r
-  h1 ^= len; h2 ^= len;\r
-\r
-  h1 += h2;\r
-  h2 += h1;\r
-\r
-  h1 = fmix(h1);\r
-  h2 = fmix(h2);\r
-\r
-  h1 += h2;\r
-  h2 += h1;\r
-\r
-  ((uint64_t*)out)[0] = h1;\r
-  ((uint64_t*)out)[1] = h2;\r
-}\r
-\r
-//-----------------------------------------------------------------------------\r
-\r
+//-----------------------------------------------------------------------------
+// MurmurHash3 was written by Austin Appleby, and is placed in the public
+// domain. The author hereby disclaims copyright to this source code.
+
+// Note - The x86 and x64 versions do _not_ produce the same results, as the
+// algorithms are optimized for their respective platforms. You can still
+// compile and run any of them on any platform, but your performance with the
+// non-native version will be less than optimal.
+
+#include "MurmurHash3.h"
+
+//-----------------------------------------------------------------------------
+// Platform-specific functions and macros
+
+// Microsoft Visual Studio
+
+#if defined(_MSC_VER)
+
+#define FORCE_INLINE   __forceinline
+
+#include <stdlib.h>
+
+#define ROTL32(x,y)    _rotl(x,y)
+#define ROTL64(x,y)    _rotl64(x,y)
+
+#define BIG_CONSTANT(x) (x)
+
+// Other compilers
+
+#else  // defined(_MSC_VER)
+
+#define        FORCE_INLINE __attribute__((always_inline))
+
+inline uint32_t rotl32 ( uint32_t x, int8_t r )
+{
+  return (x << r) | (x >> (32 - r));
+}
+
+inline uint64_t rotl64 ( uint64_t x, int8_t r )
+{
+  return (x << r) | (x >> (64 - r));
+}
+
+#define        ROTL32(x,y)     rotl32(x,y)
+#define ROTL64(x,y)    rotl64(x,y)
+
+#define BIG_CONSTANT(x) (x##LLU)
+
+#endif // !defined(_MSC_VER)
+
+//-----------------------------------------------------------------------------
+// Block read - if your platform needs to do endian-swapping or can only
+// handle aligned reads, do the conversion here
+
+inline uint32_t getblock ( const uint32_t * p, int i )
+{
+  return p[i];
+}
+
+inline uint64_t getblock ( const uint64_t * p, int i )
+{
+  return p[i];
+}
+
+//-----------------------------------------------------------------------------
+// Finalization mix - force all bits of a hash block to avalanche
+
+inline uint32_t fmix ( uint32_t h )
+{
+  h ^= h >> 16;
+  h *= 0x85ebca6b;
+  h ^= h >> 13;
+  h *= 0xc2b2ae35;
+  h ^= h >> 16;
+
+  return h;
+}
+
+//----------
+
+inline uint64_t fmix ( uint64_t k )
+{
+  k ^= k >> 33;
+  k *= BIG_CONSTANT(0xff51afd7ed558ccd);
+  k ^= k >> 33;
+  k *= BIG_CONSTANT(0xc4ceb9fe1a85ec53);
+  k ^= k >> 33;
+
+  return k;
+}
+
+//-----------------------------------------------------------------------------
+
+void MurmurHash3_x86_32 ( const void * key, int len,
+                          uint32_t seed, void * out )
+{
+  const uint8_t * data = (const uint8_t*)key;
+  const int nblocks = len / 4;
+
+  uint32_t h1 = seed;
+
+  uint32_t c1 = 0xcc9e2d51;
+  uint32_t c2 = 0x1b873593;
+
+  //----------
+  // body
+
+  const uint32_t * blocks = (const uint32_t *)(data + nblocks*4);
+
+  for(int i = -nblocks; i; i++)
+  {
+    uint32_t k1 = getblock(blocks,i);
+
+    k1 *= c1;
+    k1 = ROTL32(k1,15);
+    k1 *= c2;
+    
+    h1 ^= k1;
+    h1 = ROTL32(h1,13); 
+    h1 = h1*5+0xe6546b64;
+  }
+
+  //----------
+  // tail
+
+  const uint8_t * tail = (const uint8_t*)(data + nblocks*4);
+
+  uint32_t k1 = 0;
+
+  switch(len & 3)
+  {
+  case 3: k1 ^= tail[2] << 16;
+  case 2: k1 ^= tail[1] << 8;
+  case 1: k1 ^= tail[0];
+          k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
+  };
+
+  //----------
+  // finalization
+
+  h1 ^= len;
+
+  h1 = fmix(h1);
+
+  *(uint32_t*)out = h1;
+} 
+
+//-----------------------------------------------------------------------------
+
+void MurmurHash3_x86_128 ( const void * key, const int len,
+                           uint32_t seed, void * out )
+{
+  const uint8_t * data = (const uint8_t*)key;
+  const int nblocks = len / 16;
+
+  uint32_t h1 = seed;
+  uint32_t h2 = seed;
+  uint32_t h3 = seed;
+  uint32_t h4 = seed;
+
+  uint32_t c1 = 0x239b961b; 
+  uint32_t c2 = 0xab0e9789;
+  uint32_t c3 = 0x38b34ae5; 
+  uint32_t c4 = 0xa1e38b93;
+
+  //----------
+  // body
+
+  const uint32_t * blocks = (const uint32_t *)(data + nblocks*16);
+
+  for(int i = -nblocks; i; i++)
+  {
+    uint32_t k1 = getblock(blocks,i*4+0);
+    uint32_t k2 = getblock(blocks,i*4+1);
+    uint32_t k3 = getblock(blocks,i*4+2);
+    uint32_t k4 = getblock(blocks,i*4+3);
+
+    k1 *= c1; k1  = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
+
+    h1 = ROTL32(h1,19); h1 += h2; h1 = h1*5+0x561ccd1b;
+
+    k2 *= c2; k2  = ROTL32(k2,16); k2 *= c3; h2 ^= k2;
+
+    h2 = ROTL32(h2,17); h2 += h3; h2 = h2*5+0x0bcaa747;
+
+    k3 *= c3; k3  = ROTL32(k3,17); k3 *= c4; h3 ^= k3;
+
+    h3 = ROTL32(h3,15); h3 += h4; h3 = h3*5+0x96cd1c35;
+
+    k4 *= c4; k4  = ROTL32(k4,18); k4 *= c1; h4 ^= k4;
+
+    h4 = ROTL32(h4,13); h4 += h1; h4 = h4*5+0x32ac3b17;
+  }
+
+  //----------
+  // tail
+
+  const uint8_t * tail = (const uint8_t*)(data + nblocks*16);
+
+  uint32_t k1 = 0;
+  uint32_t k2 = 0;
+  uint32_t k3 = 0;
+  uint32_t k4 = 0;
+
+  switch(len & 15)
+  {
+  case 15: k4 ^= tail[14] << 16;
+  case 14: k4 ^= tail[13] << 8;
+  case 13: k4 ^= tail[12] << 0;
+           k4 *= c4; k4  = ROTL32(k4,18); k4 *= c1; h4 ^= k4;
+
+  case 12: k3 ^= tail[11] << 24;
+  case 11: k3 ^= tail[10] << 16;
+  case 10: k3 ^= tail[ 9] << 8;
+  case  9: k3 ^= tail[ 8] << 0;
+           k3 *= c3; k3  = ROTL32(k3,17); k3 *= c4; h3 ^= k3;
+
+  case  8: k2 ^= tail[ 7] << 24;
+  case  7: k2 ^= tail[ 6] << 16;
+  case  6: k2 ^= tail[ 5] << 8;
+  case  5: k2 ^= tail[ 4] << 0;
+           k2 *= c2; k2  = ROTL32(k2,16); k2 *= c3; h2 ^= k2;
+
+  case  4: k1 ^= tail[ 3] << 24;
+  case  3: k1 ^= tail[ 2] << 16;
+  case  2: k1 ^= tail[ 1] << 8;
+  case  1: k1 ^= tail[ 0] << 0;
+           k1 *= c1; k1  = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
+  };
+
+  //----------
+  // finalization
+
+  h1 ^= len; h2 ^= len; h3 ^= len; h4 ^= len;
+
+  h1 += h2; h1 += h3; h1 += h4;
+  h2 += h1; h3 += h1; h4 += h1;
+
+  h1 = fmix(h1);
+  h2 = fmix(h2);
+  h3 = fmix(h3);
+  h4 = fmix(h4);
+
+  h1 += h2; h1 += h3; h1 += h4;
+  h2 += h1; h3 += h1; h4 += h1;
+
+  ((uint32_t*)out)[0] = h1;
+  ((uint32_t*)out)[1] = h2;
+  ((uint32_t*)out)[2] = h3;
+  ((uint32_t*)out)[3] = h4;
+}
+
+//-----------------------------------------------------------------------------
+
+void MurmurHash3_x64_128 ( const void * key, const int len,
+                           const uint32_t seed, void * out )
+{
+  const uint8_t * data = (const uint8_t*)key;
+  const int nblocks = len / 16;
+
+  uint64_t h1 = seed;
+  uint64_t h2 = seed;
+
+  uint64_t c1 = BIG_CONSTANT(0x87c37b91114253d5);
+  uint64_t c2 = BIG_CONSTANT(0x4cf5ad432745937f);
+
+  //----------
+  // body
+
+  const uint64_t * blocks = (const uint64_t *)(data);
+
+  for(int i = 0; i < nblocks; i++)
+  {
+    uint64_t k1 = getblock(blocks,i*2+0);
+    uint64_t k2 = getblock(blocks,i*2+1);
+
+    k1 *= c1; k1  = ROTL64(k1,31); k1 *= c2; h1 ^= k1;
+
+    h1 = ROTL64(h1,27); h1 += h2; h1 = h1*5+0x52dce729;
+
+    k2 *= c2; k2  = ROTL64(k2,33); k2 *= c1; h2 ^= k2;
+
+    h2 = ROTL64(h2,31); h2 += h1; h2 = h2*5+0x38495ab5;
+  }
+
+  //----------
+  // tail
+
+  const uint8_t * tail = (const uint8_t*)(data + nblocks*16);
+
+  uint64_t k1 = 0;
+  uint64_t k2 = 0;
+
+  switch(len & 15)
+  {
+  case 15: k2 ^= uint64_t(tail[14]) << 48;
+  case 14: k2 ^= uint64_t(tail[13]) << 40;
+  case 13: k2 ^= uint64_t(tail[12]) << 32;
+  case 12: k2 ^= uint64_t(tail[11]) << 24;
+  case 11: k2 ^= uint64_t(tail[10]) << 16;
+  case 10: k2 ^= uint64_t(tail[ 9]) << 8;
+  case  9: k2 ^= uint64_t(tail[ 8]) << 0;
+           k2 *= c2; k2  = ROTL64(k2,33); k2 *= c1; h2 ^= k2;
+
+  case  8: k1 ^= uint64_t(tail[ 7]) << 56;
+  case  7: k1 ^= uint64_t(tail[ 6]) << 48;
+  case  6: k1 ^= uint64_t(tail[ 5]) << 40;
+  case  5: k1 ^= uint64_t(tail[ 4]) << 32;
+  case  4: k1 ^= uint64_t(tail[ 3]) << 24;
+  case  3: k1 ^= uint64_t(tail[ 2]) << 16;
+  case  2: k1 ^= uint64_t(tail[ 1]) << 8;
+  case  1: k1 ^= uint64_t(tail[ 0]) << 0;
+           k1 *= c1; k1  = ROTL64(k1,31); k1 *= c2; h1 ^= k1;
+  };
+
+  //----------
+  // finalization
+
+  h1 ^= len; h2 ^= len;
+
+  h1 += h2;
+  h2 += h1;
+
+  h1 = fmix(h1);
+  h2 = fmix(h2);
+
+  h1 += h2;
+  h2 += h1;
+
+  ((uint64_t*)out)[0] = h1;
+  ((uint64_t*)out)[1] = h2;
+}
+
+//-----------------------------------------------------------------------------
+
index 58e9820..54e9d3f 100644 (file)
@@ -1,37 +1,37 @@
-//-----------------------------------------------------------------------------\r
-// MurmurHash3 was written by Austin Appleby, and is placed in the public\r
-// domain. The author hereby disclaims copyright to this source code.\r
-\r
-#ifndef _MURMURHASH3_H_\r
-#define _MURMURHASH3_H_\r
-\r
-//-----------------------------------------------------------------------------\r
-// Platform-specific functions and macros\r
-\r
-// Microsoft Visual Studio\r
-\r
-#if defined(_MSC_VER)\r
-\r
-typedef unsigned char uint8_t;\r
-typedef unsigned long uint32_t;\r
-typedef unsigned __int64 uint64_t;\r
-\r
-// Other compilers\r
-\r
-#else  // defined(_MSC_VER)\r
-\r
-#include <stdint.h>\r
-\r
-#endif // !defined(_MSC_VER)\r
-\r
-//-----------------------------------------------------------------------------\r
-\r
-void MurmurHash3_x86_32  ( const void * key, int len, uint32_t seed, void * out );\r
-\r
-void MurmurHash3_x86_128 ( const void * key, int len, uint32_t seed, void * out );\r
-\r
-void MurmurHash3_x64_128 ( const void * key, int len, uint32_t seed, void * out );\r
-\r
-//-----------------------------------------------------------------------------\r
-\r
-#endif // _MURMURHASH3_H_\r
+//-----------------------------------------------------------------------------
+// MurmurHash3 was written by Austin Appleby, and is placed in the public
+// domain. The author hereby disclaims copyright to this source code.
+
+#ifndef _MURMURHASH3_H_
+#define _MURMURHASH3_H_
+
+//-----------------------------------------------------------------------------
+// Platform-specific functions and macros
+
+// Microsoft Visual Studio
+
+#if defined(_MSC_VER)
+
+typedef unsigned char uint8_t;
+typedef unsigned long uint32_t;
+typedef unsigned __int64 uint64_t;
+
+// Other compilers
+
+#else  // defined(_MSC_VER)
+
+#include <stdint.h>
+
+#endif // !defined(_MSC_VER)
+
+//-----------------------------------------------------------------------------
+
+void MurmurHash3_x86_32  ( const void * key, int len, uint32_t seed, void * out );
+
+void MurmurHash3_x86_128 ( const void * key, int len, uint32_t seed, void * out );
+
+void MurmurHash3_x64_128 ( const void * key, int len, uint32_t seed, void * out );
+
+//-----------------------------------------------------------------------------
+
+#endif // _MURMURHASH3_H_
index bb40a96..81b4e60 100644 (file)
-<!--  Auto-Generated interface from Rhapsody: 'Repository::ssw_LifecycleSupport::NodeStateManagement::Concept::Interface::INSM_Consumer' -->\r
-<!--  Created at 2012-06-01 09:36:05 by uid65904 -->\r
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"\r
-       "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">\r
-<node>\r
-<interface name="org.freedesktop.DBus.Introspectable">\r
-       <method name="Introspect">\r
-               <arg name="data" direction="out" type="s"/>\r
-       </method>\r
-</interface>\r
-<interface name="org.freedesktop.DBus.Properties">\r
-       <method name="Get">\r
-               <arg name="interface" direction="in" type="s"/>\r
-               <arg name="propname" direction="in" type="s"/>\r
-               <arg name="value" direction="out" type="v"/>\r
-       </method>\r
-       \r
-       <method name="Set">\r
-               <arg name="interface" direction="in" type="s"/>\r
-               <arg name="propname" direction="in" type="s"/>\r
-               <arg name="value" direction="in" type="v"/>\r
-       </method>\r
-       \r
-       <method name="GetAll">\r
-               <arg name="interface" direction="in" type="s"/>\r
-               <arg name="props" direction="out" type="a{sv}"/>\r
-       </method>\r
-</interface>\r
- <!--\r
-       org.genivi.NodeStateManager.Consumer:\r
-       @short_description: "Consumer" interface of the NodeStateManager.\r
-       \r
-       This interface contains functions which are not safety critical and can be accessed by "every" client without further restrictions.\r
-  -->\r
-  <interface name="org.genivi.NodeStateManager.Consumer">\r
-    <!--\r
-        RestartReason: This property informs clients about the reason for the last restart. The values are based upon the enummeration NsmRestartReason_e. Note: The value is only set once at start-up.\r
-    -->\r
-    <property name="RestartReason" type="i" access="read"/>\r
-\r
-    <!--\r
-        ShutdownReason: This property informs clients about the reason for the last shutdown. The values are based upon the enummeration NsmShutdownReason_e. Note: The value is only set once at start-up.\r
-    -->\r
-    <property name="ShutdownReason" type="i" access="read"/>\r
-\r
-    <!--\r
-        WakeUpReason: This property informs clients about the recent reason for waking up the target. The values are based upon the enummeration NsmWakeUpReason_e. Note: The value is only set once at start-up.\r
-    -->\r
-    <property name="WakeUpReason" type="i" access="read"/>\r
-\r
-    <!--\r
-        BootMode: This property informs clients about the recent BootMode of the target. The values will be defined by a third party header, which has not been delivered yet. The description needs to be updated as soon as the header is available.\r
-    -->\r
-    <property name="BootMode" type="i" access="read"/>\r
-\r
-    <!--\r
-          NodeState:\r
-          @NodeState: Numeric value for the current NodeState, defined in NsmNodeState_e.\r
-\r
-          Clients can register for notifications when the NodeState is updated inside the NodeStateManager. This signal is sent to registered clients and will include the current NodeState as a parameter.\r
-    -->\r
-    <signal name="NodeState">\r
-      <arg name="NodeState" type="i"/>\r
-    </signal>\r
-\r
-    <!--\r
-          NodeApplicationMode:\r
-          @ApplicationModeId: Numeric value for the current ApplicationMode, defined in NsmAplicationMode_e.\r
-\r
-          Clients can register for notifications when the NodeApplicationMode is updated inside the NodeStateManager. This signal is sent to registered clients and will include the current NodeApplicationMode as a parameter.\r
-    -->\r
-    <signal name="NodeApplicationMode">\r
-      <arg name="ApplicationModeId" type="i"/>\r
-    </signal>\r
-\r
-    <!--\r
-       SessionStateChanged:\r
-       @SessionStateName: The SessionName will be based upon either the pre-defined platform SessionNames or using a newly added product defined session name.\r
-       @SeatID:           This parameter will be based upon the enum NsmSeat_e.\r
-       @SessionState:     This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional session states.\r
-    \r
-       This signal is sent to registered clients when a particular session is state is changed. The client can register for notification about a specific session through the use of the SessionName, as a "match rule".\r
-    -->\r
-    <signal name="SessionStateChanged">\r
-      <arg name="SessionStateName" type="s"/>\r
-      <arg name="SeatID" type="i"/>\r
-      <arg name="SessionState" type="i"/>\r
-    </signal>\r
-\r
-    <!-- \r
-       GetNodeState:\r
-       @NodeStateId: Will be based on the NsmNodeState_e.\r
-       @ErrorCode:   Return value passed to the caller, based upon NsmErrorStatus_e.\r
-    \r
-       The method is used by other applications to get the NodeState without the need of registration to the signal.\r
-    -->\r
-    <method name="GetNodeState">\r
-      <arg name="NodeStateId" direction="out" type="i"/>\r
-      <arg name="ErrorCode" direction="out" type="i"/>\r
-    </method>\r
-\r
-    <!--\r
-       SetSessionState:\r
-       @SessionName:  The SessionName will be based upon either the pre-defined platform SessionNames (see NSM content page) or using a newly added product defined session name.\r
-       @SessionOwner: This parameter defines the name of the application that is setting the state of the session. This must be the applications systemd unit filename.\r
-       @SeatID:       This parameter will be based upon the enum NsmSeat_e\r
-       @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional SessionStates.\r
-       @ErrorCode:    Return value passed to the caller, based upon NsmErrorStatus_e.\r
-    \r
-       The method is used by applications to set the state of a session.\r
-    -->\r
-    <method name="SetSessionState">\r
-      <arg name="SessionName" direction="in" type="s"/>\r
-      <arg name="SessionOwner" direction="in" type="s"/>\r
-      <arg name="SeatID" direction="in" type="i"/>\r
-      <arg name="SessionState" direction="in" type="i"/>\r
-      <arg name="ErrorCode" direction="out" type="i"/>\r
-    </method>\r
-\r
-    <!--\r
-       GetSessionState:\r
-       @SessionName:  The SessionName will be based upon either the pre-defined platform session names (see NSM content page) or using a newly added product defined SessionName.\r
-       @SeatID:       This parameter will be based upon the enum NsmSeat_e.\r
-       @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional SessionStates.\r
-       @ErrorCode:    Return value passed to the caller, based upon NsmErrorStatus_e.\r
-    \r
-       The method is used by applications to get the state of a session.\r
-    -->\r
-    <method name="GetSessionState">\r
-      <arg name="SessionName" direction="in" type="s"/>\r
-      <arg name="SeatID" direction="in" type="i"/>\r
-      <arg name="SessionState" direction="out" type="i"/>\r
-      <arg name="ErrorCode" direction="out" type="i"/>\r
-    </method>\r
-\r
-    <!--\r
-       GetApplicationMode:\r
-       @ApplicationModeId: This parameter will be based upon the NsmNodeApplicationMode_e.\r
-       @ErrorCode:         Return value passed to the caller, based upon NsmErrorStatus_e.\r
-\r
-       The method is used by other applications to get the application mode.\r
-    -->\r
-    <method name="GetApplicationMode">\r
-      <arg name="ApplicationModeId" direction="out" type="i"/>\r
-      <arg name="ErrorCode" direction="out" type="i"/>\r
-    </method>\r
-\r
-    <!--\r
-        RegisterShutdownClient:\r
-       @BusName:      Bus name of remote application.\r
-       @ObjName:      Object name of remote object that provides the shutdown interface.\r
-       @ShutdownMode: Shutdown mode for which client wants to be informed (i.e normal, fast etc).\r
-       @TimeoutMs:    Max. Timeout to wait for response from shutdown client in ms.\r
-       @ErrorCode:    Return value passed to the caller, based upon NsmErrorStatus_e.\r
-    \r
-       The method is used by other applications to register themselves as shutdown client. Any client that registers must provide a method in their D-Bus object called "LifecycleRequest". This method will take one parameter which is the RequestType (NSM_SHUTDOWNTYPE_NORMAL, NSM_SHUTDOWNTYPE_FAST). For an example of the required client interface please see the BootManager component who will be a client of the NSM.\r
-       -->\r
-    <method name="RegisterShutdownClient">\r
-      <arg name="BusName" direction="in" type="s"/>\r
-      <arg name="ObjName" direction="in" type="s"/>\r
-      <arg name="ShutdownMode" direction="in" type="u"/>\r
-      <arg name="TimeoutMs" direction="in" type="u"/>\r
-      <arg name="ErrorCode" direction="out" type="i"/>\r
-    </method>\r
-\r
-    <!--\r
-       UnRegisterShutdownClient:\r
-       @BusName:      Bus name of remote application.\r
-       @ObjName:      Object name of remote object that provides the shutdown interface.\r
-       @ShutdownMode: Shutdown mode for which client wants to unregister (NSM_SHUTDOWNTYPE_NORMAL, NSM_SHUTDOWNTYPE_FAST).\r
-       @ErrorCode:    Return value passed to the caller, based upon NsmErrorStatus_e.\r
-    \r
-       The method is used by other applications to unregister themselves as shutdown client.\r
-    -->\r
-    <method name="UnRegisterShutdownClient">\r
-      <arg name="BusName" direction="in" type="s"/>\r
-      <arg name="ObjName" direction="in" type="s"/>\r
-      <arg name="ShutdownMode" direction="in" type="u"/>\r
-      <arg name="ErrorCode" direction="out" type="i"/>\r
-    </method>\r
-\r
-    <!--\r
-           RegisterSession:\r
-       @SessionName:  The SessionName will be based upon either the pre-defined platform session names (see NSM content page) or using a newly added product defined SessionName.\r
-       @SessionOwner: This is the name of the application that is registering the new session (this must be the applications systemd unit filename).\r
-       @SeatID:       This parameter will be based upon the enum NsmSeatId_e\r
-       @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional session states.\r
-       @ErrorCode:    Return value passed to the caller, based upon NsmErrorStatus_e.\r
-    \r
-       The method is used by other applications to register a new session whose state should be observed and distributed by the NSM.\r
-       -->\r
-    <method name="RegisterSession">\r
-      <arg name="SessionName" direction="in" type="s"/>\r
-      <arg name="SessionOwner" direction="in" type="s"/>\r
-      <arg name="SeatID" direction="in" type="i"/>\r
-      <arg name="SessionState" direction="in" type="i"/>\r
-      <arg name="ErrorCode" direction="out" type="i"/>\r
-    </method>\r
-\r
-    <!--\r
-       UnRegisterSession:\r
-       @SessionName:  The SessionName will be based upon either the pre-defined platform session names (see NSM content page) or using a newly added product defined SessionName.\r
-       @SessionOwner: This is the name of the application that originally registered the session. It will be validated that this value matches the stored value from the registration.\r
-       @SeatID:       This parameter will be based upon the enum NsmSeat_e.\r
-       @ErrorCode:    Return value passed to the caller, based upon NsmErrorStatus_e.\r
-    \r
-       The method is used by other applications to remove a new session from the session list hosted by NSM.\r
-    -->\r
-    <method name="UnRegisterSession">\r
-      <arg name="SessionName" direction="in" type="s"/>\r
-      <arg name="SessionOwner" direction="in" type="s"/>\r
-      <arg name="SeatID" direction="in" type="i"/>\r
-      <arg name="ErrorCode" direction="out" type="i"/>\r
-    </method>\r
-\r
-    <!--\r
-       GetAppHealthCount:\r
-       @Count: Return value passed to the caller. Number of applications that crashed or terminated accidentally.\r
-       \r
-       The method returns the number of applications that crashed or terminated accidentally, within the current life cycle. It can be used to observe the system state.\r
-    -->\r
-    <method name="GetAppHealthCount">\r
-      <arg name="Count" direction="out" type="u"/>\r
-    </method>\r
-\r
-    <!--\r
-       GetInterfaceVersion:\r
-       @Version: Unsigned integer that represents the version number of the Node State Manager.\r
-       \r
-       The method returns the version number of the Node State Manager. The number is organized in four bytes:\r
-    \r
-       Version: VVV.RRR.PPP.BBB\r
-    \r
-       <literallayout>\r
-               VVV => Version  [1..255]\r
-               RRR => Release  [0..255]\r
-               PPP => Patch    [0..255]\r
-               BBB => Build    [0..255]\r
-       </literallayout>\r
-    -->\r
-    <method name="GetInterfaceVersion">\r
-      <arg name="Version" direction="out" type="u"/>\r
-    </method>\r
-\r
-    <!--    \r
-        LifecycleRequestComplete:\r
-        @RequestId: The request Id of the called life cycle client. The value has been passed when "LifecycleRequest" was called.\r
-        @Status:    The result of the call to "LifecycleRequest". NsmErrorStatus_Ok: Request successfully processed. NsmErrorStatus_Error: An error occured while processing the "LifecycleRequest".\r
-        @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.\r
-        \r
-        The function has to be called by a "asynchrounous" lifecycle client, when he processed the "LifecycleRequest".\r
-    --> \r
-    <method name="LifecycleRequestComplete">\r
-      <arg name="RequestId" direction="in" type="u"/>\r
-      <arg name="Status"    direction="in" type="i"/>\r
-      <arg name="ErrorCode" direction="out" type="i"/>\r
-    </method>\r
-  </interface>\r
-</node>\r
+<!--  Auto-Generated interface from Rhapsody: 'Repository::ssw_LifecycleSupport::NodeStateManagement::Concept::Interface::INSM_Consumer' -->
+<!--  Created at 2012-06-01 09:36:05 by uid65904 -->
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+       "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+<interface name="org.freedesktop.DBus.Introspectable">
+       <method name="Introspect">
+               <arg name="data" direction="out" type="s"/>
+       </method>
+</interface>
+<interface name="org.freedesktop.DBus.Properties">
+       <method name="Get">
+               <arg name="interface" direction="in" type="s"/>
+               <arg name="propname" direction="in" type="s"/>
+               <arg name="value" direction="out" type="v"/>
+       </method>
+       
+       <method name="Set">
+               <arg name="interface" direction="in" type="s"/>
+               <arg name="propname" direction="in" type="s"/>
+               <arg name="value" direction="in" type="v"/>
+       </method>
+       
+       <method name="GetAll">
+               <arg name="interface" direction="in" type="s"/>
+               <arg name="props" direction="out" type="a{sv}"/>
+       </method>
+</interface>
+ <!--
+       org.genivi.NodeStateManager.Consumer:
+       @short_description: "Consumer" interface of the NodeStateManager.
+       
+       This interface contains functions which are not safety critical and can be accessed by "every" client without further restrictions.
+  -->
+  <interface name="org.genivi.NodeStateManager.Consumer">
+    <!--
+        RestartReason: This property informs clients about the reason for the last restart. The values are based upon the enummeration NsmRestartReason_e. Note: The value is only set once at start-up.
+    -->
+    <property name="RestartReason" type="i" access="read"/>
+
+    <!--
+        ShutdownReason: This property informs clients about the reason for the last shutdown. The values are based upon the enummeration NsmShutdownReason_e. Note: The value is only set once at start-up.
+    -->
+    <property name="ShutdownReason" type="i" access="read"/>
+
+    <!--
+        WakeUpReason: This property informs clients about the recent reason for waking up the target. The values are based upon the enummeration NsmWakeUpReason_e. Note: The value is only set once at start-up.
+    -->
+    <property name="WakeUpReason" type="i" access="read"/>
+
+    <!--
+        BootMode: This property informs clients about the recent BootMode of the target. The values will be defined by a third party header, which has not been delivered yet. The description needs to be updated as soon as the header is available.
+    -->
+    <property name="BootMode" type="i" access="read"/>
+
+    <!--
+          NodeState:
+          @NodeState: Numeric value for the current NodeState, defined in NsmNodeState_e.
+
+          Clients can register for notifications when the NodeState is updated inside the NodeStateManager. This signal is sent to registered clients and will include the current NodeState as a parameter.
+    -->
+    <signal name="NodeState">
+      <arg name="NodeState" type="i"/>
+    </signal>
+
+    <!--
+          NodeApplicationMode:
+          @ApplicationModeId: Numeric value for the current ApplicationMode, defined in NsmAplicationMode_e.
+
+          Clients can register for notifications when the NodeApplicationMode is updated inside the NodeStateManager. This signal is sent to registered clients and will include the current NodeApplicationMode as a parameter.
+    -->
+    <signal name="NodeApplicationMode">
+      <arg name="ApplicationModeId" type="i"/>
+    </signal>
+
+    <!--
+       SessionStateChanged:
+       @SessionStateName: The SessionName will be based upon either the pre-defined platform SessionNames or using a newly added product defined session name.
+       @SeatID:           This parameter will be based upon the enum NsmSeat_e.
+       @SessionState:     This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional session states.
+    
+       This signal is sent to registered clients when a particular session is state is changed. The client can register for notification about a specific session through the use of the SessionName, as a "match rule".
+    -->
+    <signal name="SessionStateChanged">
+      <arg name="SessionStateName" type="s"/>
+      <arg name="SeatID" type="i"/>
+      <arg name="SessionState" type="i"/>
+    </signal>
+
+    <!-- 
+       GetNodeState:
+       @NodeStateId: Will be based on the NsmNodeState_e.
+       @ErrorCode:   Return value passed to the caller, based upon NsmErrorStatus_e.
+    
+       The method is used by other applications to get the NodeState without the need of registration to the signal.
+    -->
+    <method name="GetNodeState">
+      <arg name="NodeStateId" direction="out" type="i"/>
+      <arg name="ErrorCode" direction="out" type="i"/>
+    </method>
+
+    <!--
+       SetSessionState:
+       @SessionName:  The SessionName will be based upon either the pre-defined platform SessionNames (see NSM content page) or using a newly added product defined session name.
+       @SessionOwner: This parameter defines the name of the application that is setting the state of the session. This must be the applications systemd unit filename.
+       @SeatID:       This parameter will be based upon the enum NsmSeat_e
+       @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional SessionStates.
+       @ErrorCode:    Return value passed to the caller, based upon NsmErrorStatus_e.
+    
+       The method is used by applications to set the state of a session.
+    -->
+    <method name="SetSessionState">
+      <arg name="SessionName" direction="in" type="s"/>
+      <arg name="SessionOwner" direction="in" type="s"/>
+      <arg name="SeatID" direction="in" type="i"/>
+      <arg name="SessionState" direction="in" type="i"/>
+      <arg name="ErrorCode" direction="out" type="i"/>
+    </method>
+
+    <!--
+       GetSessionState:
+       @SessionName:  The SessionName will be based upon either the pre-defined platform session names (see NSM content page) or using a newly added product defined SessionName.
+       @SeatID:       This parameter will be based upon the enum NsmSeat_e.
+       @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional SessionStates.
+       @ErrorCode:    Return value passed to the caller, based upon NsmErrorStatus_e.
+    
+       The method is used by applications to get the state of a session.
+    -->
+    <method name="GetSessionState">
+      <arg name="SessionName" direction="in" type="s"/>
+      <arg name="SeatID" direction="in" type="i"/>
+      <arg name="SessionState" direction="out" type="i"/>
+      <arg name="ErrorCode" direction="out" type="i"/>
+    </method>
+
+    <!--
+       GetApplicationMode:
+       @ApplicationModeId: This parameter will be based upon the NsmNodeApplicationMode_e.
+       @ErrorCode:         Return value passed to the caller, based upon NsmErrorStatus_e.
+
+       The method is used by other applications to get the application mode.
+    -->
+    <method name="GetApplicationMode">
+      <arg name="ApplicationModeId" direction="out" type="i"/>
+      <arg name="ErrorCode" direction="out" type="i"/>
+    </method>
+
+    <!--
+        RegisterShutdownClient:
+       @BusName:      Bus name of remote application.
+       @ObjName:      Object name of remote object that provides the shutdown interface.
+       @ShutdownMode: Shutdown mode for which client wants to be informed (i.e normal, fast etc).
+       @TimeoutMs:    Max. Timeout to wait for response from shutdown client in ms.
+       @ErrorCode:    Return value passed to the caller, based upon NsmErrorStatus_e.
+    
+       The method is used by other applications to register themselves as shutdown client. Any client that registers must provide a method in their D-Bus object called "LifecycleRequest". This method will take one parameter which is the RequestType (NSM_SHUTDOWNTYPE_NORMAL, NSM_SHUTDOWNTYPE_FAST). For an example of the required client interface please see the BootManager component who will be a client of the NSM.
+       -->
+    <method name="RegisterShutdownClient">
+      <arg name="BusName" direction="in" type="s"/>
+      <arg name="ObjName" direction="in" type="s"/>
+      <arg name="ShutdownMode" direction="in" type="u"/>
+      <arg name="TimeoutMs" direction="in" type="u"/>
+      <arg name="ErrorCode" direction="out" type="i"/>
+    </method>
+
+    <!--
+       UnRegisterShutdownClient:
+       @BusName:      Bus name of remote application.
+       @ObjName:      Object name of remote object that provides the shutdown interface.
+       @ShutdownMode: Shutdown mode for which client wants to unregister (NSM_SHUTDOWNTYPE_NORMAL, NSM_SHUTDOWNTYPE_FAST).
+       @ErrorCode:    Return value passed to the caller, based upon NsmErrorStatus_e.
+    
+       The method is used by other applications to unregister themselves as shutdown client.
+    -->
+    <method name="UnRegisterShutdownClient">
+      <arg name="BusName" direction="in" type="s"/>
+      <arg name="ObjName" direction="in" type="s"/>
+      <arg name="ShutdownMode" direction="in" type="u"/>
+      <arg name="ErrorCode" direction="out" type="i"/>
+    </method>
+
+    <!--
+           RegisterSession:
+       @SessionName:  The SessionName will be based upon either the pre-defined platform session names (see NSM content page) or using a newly added product defined SessionName.
+       @SessionOwner: This is the name of the application that is registering the new session (this must be the applications systemd unit filename).
+       @SeatID:       This parameter will be based upon the enum NsmSeatId_e
+       @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional session states.
+       @ErrorCode:    Return value passed to the caller, based upon NsmErrorStatus_e.
+    
+       The method is used by other applications to register a new session whose state should be observed and distributed by the NSM.
+       -->
+    <method name="RegisterSession">
+      <arg name="SessionName" direction="in" type="s"/>
+      <arg name="SessionOwner" direction="in" type="s"/>
+      <arg name="SeatID" direction="in" type="i"/>
+      <arg name="SessionState" direction="in" type="i"/>
+      <arg name="ErrorCode" direction="out" type="i"/>
+    </method>
+
+    <!--
+       UnRegisterSession:
+       @SessionName:  The SessionName will be based upon either the pre-defined platform session names (see NSM content page) or using a newly added product defined SessionName.
+       @SessionOwner: This is the name of the application that originally registered the session. It will be validated that this value matches the stored value from the registration.
+       @SeatID:       This parameter will be based upon the enum NsmSeat_e.
+       @ErrorCode:    Return value passed to the caller, based upon NsmErrorStatus_e.
+    
+       The method is used by other applications to remove a new session from the session list hosted by NSM.
+    -->
+    <method name="UnRegisterSession">
+      <arg name="SessionName" direction="in" type="s"/>
+      <arg name="SessionOwner" direction="in" type="s"/>
+      <arg name="SeatID" direction="in" type="i"/>
+      <arg name="ErrorCode" direction="out" type="i"/>
+    </method>
+
+    <!--
+       GetAppHealthCount:
+       @Count: Return value passed to the caller. Number of applications that crashed or terminated accidentally.
+       
+       The method returns the number of applications that crashed or terminated accidentally, within the current life cycle. It can be used to observe the system state.
+    -->
+    <method name="GetAppHealthCount">
+      <arg name="Count" direction="out" type="u"/>
+    </method>
+
+    <!--
+       GetInterfaceVersion:
+       @Version: Unsigned integer that represents the version number of the Node State Manager.
+       
+       The method returns the version number of the Node State Manager. The number is organized in four bytes:
+    
+       Version: VVV.RRR.PPP.BBB
+    
+       <literallayout>
+               VVV => Version  [1..255]
+               RRR => Release  [0..255]
+               PPP => Patch    [0..255]
+               BBB => Build    [0..255]
+       </literallayout>
+    -->
+    <method name="GetInterfaceVersion">
+      <arg name="Version" direction="out" type="u"/>
+    </method>
+
+    <!--    
+        LifecycleRequestComplete:
+        @RequestId: The request Id of the called life cycle client. The value has been passed when "LifecycleRequest" was called.
+        @Status:    The result of the call to "LifecycleRequest". NsmErrorStatus_Ok: Request successfully processed. NsmErrorStatus_Error: An error occured while processing the "LifecycleRequest".
+        @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
+        
+        The function has to be called by a "asynchrounous" lifecycle client, when he processed the "LifecycleRequest".
+    --> 
+    <method name="LifecycleRequestComplete">
+      <arg name="RequestId" direction="in" type="u"/>
+      <arg name="Status"    direction="in" type="i"/>
+      <arg name="ErrorCode" direction="out" type="i"/>
+    </method>
+  </interface>
+</node>
index 051b438..7b8c477 100644 (file)
@@ -1,56 +1,56 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public\r
- * License, v. 2.0. If a copy of the MPL was not distributed with this\r
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
-package commonapi.tests\r
-\r
-import commonapi.tests.* from "test-predefined-types.fidl"\r
-\r
-typeCollection DerivedTypeCollection {\r
-       <** @description : Common errors. **>\r
-       enumeration TestEnum {\r
-                <** @description : default **>\r
-               E_UNKNOWN = "0x00"\r
-               <** @description : no error - positive reply **>\r
-               E_OK = "0x01"\r
-               <** @description : value out of range **>\r
-               E_OUT_OF_RANGE = "0x02"\r
-           <** @description : not used **>\r
-               E_NOT_USED = "0x03"\r
-       }\r
-       \r
-       enumeration TestEnumMissingValue {\r
-                <** @description : default **>\r
-               E1 = "A"\r
-               E2\r
-               E3 = "2"\r
-       }\r
-       \r
-       enumeration TestEnumExtended extends TestEnum {\r
-               <** @description : new error **>\r
-               E_NEW = "0x04"\r
-       }\r
-       \r
-       enumeration TestEnumExtended2 extends TestEnumExtended {\r
-               <** @description : new error **>\r
-               E_NEW2 = "0x05"\r
-       }\r
-       \r
-       struct TestStruct {\r
-               <** @description : the name of the property **>\r
-               PredefinedTypeCollection.TestString testString\r
-\r
-               <** @description : the actual value **>\r
-               UInt16 uintValue\r
-       }\r
-       \r
-       struct TestStructExtended extends TestStruct {\r
-               TestEnumExtended2 testEnumExtended2\r
-       }\r
-       \r
-       array TestArrayUInt64 of UInt64\r
-       array TestArrayTestStruct of TestStruct\r
-\r
-       map TestMap { UInt32 to TestArrayTestStruct }\r
-}\r
-\r
-\r
+/* 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 }
+}
+
+
index f23fb7a..88d4874 100644 (file)
@@ -1,58 +1,58 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public\r
- * License, v. 2.0. If a copy of the MPL was not distributed with this\r
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
-package commonapi.tests\r
-\r
-import commonapi.tests.* from "test-derived-types.fidl"\r
-\r
-interface TestInterface {\r
-       version { major 1 minor 0 }\r
-\r
-       attribute UInt32 TestPredefinedTypeAttribute\r
-       attribute DerivedTypeCollection.TestStructExtended TestDerivedStructAttribute\r
-       attribute DerivedTypeCollection.TestArrayUInt64 TestDerivedArrayAttribute\r
-\r
-       method testVoidPredefinedTypeMethod {\r
-               in {\r
-                       UInt32 uint32Value\r
-                       String stringValue\r
-               }\r
-       }\r
-\r
-       method testPredefinedTypeMethod {\r
-               in {\r
-                       UInt32 uint32InValue\r
-                       String stringInValue\r
-               }\r
-               out {\r
-                       UInt32 uint32OutValue\r
-                       String stringOutValue\r
-               }\r
-       }\r
-\r
-       method testVoidDerivedTypeMethod {\r
-               in {\r
-                       DerivedTypeCollection.TestEnumExtended2 testEnumExtended2Value\r
-                       DerivedTypeCollection.TestMap testMapValue\r
-               }\r
-       }\r
-\r
-       method testDerivedTypeMethod {\r
-               in {\r
-                       DerivedTypeCollection.TestEnumExtended2 testEnumExtended2InValue\r
-                       DerivedTypeCollection.TestMap testMapInValue\r
-               }\r
-               out {\r
-                       DerivedTypeCollection.TestEnumExtended2 testEnumExtended2OutValue\r
-                       DerivedTypeCollection.TestMap testMapOutValue\r
-               }\r
-       }\r
-\r
-       broadcast TestPredefinedTypeBroadcast {\r
-               out {\r
-                       UInt32 uint32Value\r
-                       String stringValue\r
-               }\r
-       }\r
-}\r
-\r
+/* 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
+               }
+       }
+
+       broadcast TestPredefinedTypeBroadcast {
+               out {
+                       UInt32 uint32Value
+                       String stringValue
+               }
+       }
+}
+
index 8a69103..6226ed2 100644 (file)
@@ -1,22 +1,22 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public\r
- * License, v. 2.0. If a copy of the MPL was not distributed with this\r
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
-package commonapi.tests\r
-\r
-typeCollection PredefinedTypeCollection {\r
-       typedef TestUInt8 is UInt8\r
-       typedef TestUInt16 is UInt16\r
-       typedef TestUInt32 is UInt32\r
-       typedef TestUInt64 is UInt64\r
-       typedef TestInt8 is Int8\r
-       typedef TestInt16 is Int16\r
-       typedef TestInt32 is Int32\r
-       typedef TestInt64 is Int64\r
-       typedef TestBoolean is Boolean\r
-       typedef TestByteBuffer is ByteBuffer\r
-       typedef TestDouble is Double\r
-       typedef TestFloat is Float\r
-       typedef TestString is String\r
-}\r
-\r
-\r
+/* 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
+}
+
+