summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevron Rees <kevron.m.rees@intel.com>2014-12-23 18:57:13 -0800
committerKevron Rees <kevron.m.rees@intel.com>2014-12-23 18:57:13 -0800
commit6eac68d6f5d5ead78f9c250f0201189847660c48 (patch)
treebe15d8c9a0c565d0e60cfb0df65e1ab48b5b7248
parentbbbf257a0c9c8449250804b6a805f6d41750f7ea (diff)
downloadautomotive-message-broker-6eac68d6f5d5ead78f9c250f0201189847660c48.tar.gz
lots of added documentation, including bluemonkey javascript api docs
-rw-r--r--CMakeLists.txt81
-rw-r--r--docs/CMakeLists.txt31
-rw-r--r--docs/Doxyfile.idl.in3
-rw-r--r--docs/Doxyfile.in (renamed from Doxyfile.idl.in)2
-rw-r--r--docs/dbus.idl3
-rw-r--r--docs/libamb.in (renamed from lib/libamb.h)26
-rw-r--r--examples/CMakeLists.txt3
-rw-r--r--lib/CMakeLists.txt8
-rw-r--r--lib/ambplugin.h (renamed from plugins/common/ambplugin.h)20
-rw-r--r--lib/ambpluginimpl.cpp (renamed from plugins/common/ambpluginimpl.cpp)0
-rw-r--r--lib/ambpluginimpl.h (renamed from plugins/common/ambpluginimpl.h)0
-rw-r--r--plugins/bluemonkey/CMakeLists.txt62
-rw-r--r--plugins/bluemonkey/Doxyfile.in (renamed from Doxyfile.in)2
-rw-r--r--plugins/bluemonkey/README30
-rw-r--r--plugins/bluemonkey/bluemonkey.cpp39
-rw-r--r--plugins/bluemonkey/bluemonkey.h21
-rw-r--r--plugins/bluemonkey/bluemonkey.in.idl144
-rw-r--r--plugins/common/CMakeLists.txt4
-rw-r--r--plugins/database/CMakeLists.txt4
-rw-r--r--plugins/database/README27
-rw-r--r--plugins/dbus/CMakeLists.txt3
-rw-r--r--plugins/dbus/amb-qt/CMakeLists.txt5
-rw-r--r--plugins/dbus/dbusplugin.h13
-rw-r--r--plugins/dbus/environmentproperties.h8
-rw-r--r--plugins/dbus/parking.h10
-rw-r--r--plugins/dbus/personalization.h12
-rw-r--r--plugins/dbus/runningstatus.h40
-rwxr-xr-xtools/genmapping.py90
-rw-r--r--xwalk/vehicle.html80
29 files changed, 560 insertions, 211 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fbbc5afc..ee5105c7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,7 @@ set(CMAKE_BUILD_TYPE, Debug)
include(FindPkgConfig)
set(PROJECT_NAME "automotive-message-broker")
-set(PROJECT_VERSION "0.12.901")
+set(PROJECT_VERSION "0.12.902")
set(PROJECT_CODENAME "agera")
set(PROJECT_QUALITY "beta")
@@ -46,34 +46,22 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie -pie -std=c++1y")
if(opencvlux_plugin)
- message(STATUS "OpenCV Lux plugin enabled")
+ message(STATUS "OpenCV Lux plugin enabled")
endif(opencvlux_plugin)
include (CMakeForceCompiler)
if (enable_icecc)
- find_program(ICECC /usr/lib/icecc/bin/g++)
- if (ICECC)
- message(STATUS "icecc will be used for distributed compiling")
- cmake_force_cxx_compiler(${ICECC} icecc)
- else(ICECC)
- message(STATUS "Not using icecc")
- endif(ICECC)
+ find_program(ICECC /usr/lib/icecc/bin/g++)
+ if (ICECC)
+ message(STATUS "icecc will be used for distributed compiling")
+ cmake_force_cxx_compiler(${ICECC} icecc)
+ else(ICECC)
+ message(STATUS "Not using icecc")
+ endif(ICECC)
endif(enable_icecc)
-# add a target to generate API documentation with Doxygen
-if(enable_docs)
-message(STATUS "doxygen doc generation enabled")
-find_package(Doxygen)
-if(DOXYGEN_FOUND)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.idl.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.idl @ONLY)
- add_custom_target(all ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs/amb COMMENT "Generating API documentation with Doxygen" VERBATIM)
- add_custom_target(idl ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.idl WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs/dbus COMMENT "Generating DBus API documentation with Doxygen" VERBATIM)
-endif(DOXYGEN_FOUND)
-endif(enable_docs)
-
find_package(Boost REQUIRED)
@@ -86,34 +74,34 @@ set(include_dirs ${libtool_INCLUDE_DIR} ${glib_INCLUDE_DIRS} ${gio_INCLUDE_DIRS}
set(link_libraries -lamb ${glib_LIBRARIES} ${json_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib)
if(qtmainloop)
- message(STATUS "using Qt mainloop")
-
- find_package(Qt5Core)
- if(Qt5Core_FOUND)
- message(STATUS "using Qt5")
- set(QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS})
- set(QT_LIBRARIES ${Qt5Core_LIBRARIES})
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
- # if(CMAKE_SIZEOF_VOID_P MATCHES "8")
- # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcmodel=large")
- # endif(CMAKE_SIZEOF_VOID_P MATCHES "8")
- add_definitions(${Qt5Core_DEFINITIONS})
- else(Qt5Core_FOUND)
- message(STATUS "using Qt4")
- find_package( Qt4 REQUIRED )
- include(${QT_USE_FILE})
-
- endif(Qt5Core_FOUND)
-
- set(include_dirs ${include_dirs} ${QT_INCLUDE_DIRS})
- set(link_libraries ${link_libraries} ${QT_LIBRARIES})
-
- add_definitions(-DQT_NO_KEYWORDS)
- add_definitions(-DUSE_QT_CORE)
+ message(STATUS "using Qt mainloop")
+
+ find_package(Qt5Core)
+ if(Qt5Core_FOUND)
+ message(STATUS "using Qt5")
+ set(QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS})
+ set(QT_LIBRARIES ${Qt5Core_LIBRARIES})
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
+ # if(CMAKE_SIZEOF_VOID_P MATCHES "8")
+ # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcmodel=large")
+ # endif(CMAKE_SIZEOF_VOID_P MATCHES "8")
+ add_definitions(${Qt5Core_DEFINITIONS})
+ else(Qt5Core_FOUND)
+ message(STATUS "using Qt4")
+ find_package( Qt4 REQUIRED )
+ include(${QT_USE_FILE})
+
+ endif(Qt5Core_FOUND)
+
+ set(include_dirs ${include_dirs} ${QT_INCLUDE_DIRS})
+ set(link_libraries ${link_libraries} ${QT_LIBRARIES})
+
+ add_definitions(-DQT_NO_KEYWORDS)
+ add_definitions(-DUSE_QT_CORE)
endif(qtmainloop)
if(usebluez5)
- add_definitions(-DUSE_BLUEZ5)
+ add_definitions(-DUSE_BLUEZ5)
endif(usebluez5)
@@ -150,6 +138,7 @@ add_subdirectory(ambd)
add_subdirectory(plugins)
add_subdirectory(docs)
add_subdirectory(tests)
+add_subdirectory(tools)
add_subdirectory(examples)
add_subdirectory(xwalk)
add_subdirectory(packaging)
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index 4f5b0c00..2ebb4879 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -1,9 +1,32 @@
if(enable_docs)
- install (DIRECTORY amb DESTINATION ${DOC_INSTALL_DIR} COMPONENT Docs)
- install (DIRECTORY dbus DESTINATION ${DOC_INSTALL_DIR} COMPONENT Docs)
- install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/amb.fidl DESTINATION ${DOC_INSTALL_DIR}/dbus/html/ COMPONENT Docs)
- add_custom_target(doc_idl ALL mkdir -p ${CMAKE_CURRENT_SOURCE_DIR}/dbus/html/ && cp ${CMAKE_CURRENT_SOURCE_DIR}/amb.fidl ${CMAKE_CURRENT_SOURCE_DIR}/dbus/html/amb.fidl WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Moving amb.fidl" VERBATIM)
+ install (DIRECTORY amb DESTINATION ${DOC_INSTALL_DIR} COMPONENT Docs)
+ install (DIRECTORY dbus DESTINATION ${DOC_INSTALL_DIR} COMPONENT Docs)
+ install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/amb.fidl DESTINATION ${DOC_INSTALL_DIR}/dbus/html/ COMPONENT Docs)
+ add_custom_target(doc_idl ALL mkdir -p ${CMAKE_CURRENT_SOURCE_DIR}/dbus/html/ && cp ${CMAKE_CURRENT_SOURCE_DIR}/amb.fidl ${CMAKE_CURRENT_SOURCE_DIR}/dbus/html/amb.fidl WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Moving amb.fidl" VERBATIM)
+
+# add a target to generate API documentation with Doxygen
+message(STATUS "doxygen doc generation enabled")
+find_package(Doxygen)
+if(DOXYGEN_FOUND)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.idl.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.idl @ONLY)
+ add_custom_target(libamb_docs ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/amb COMMENT "Generating API documentation with Doxygen" VERBATIM)
+ add_custom_target(idl ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.idl WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/dbus COMMENT "Generating DBus API documentation with Doxygen" VERBATIM)
+
+ #generate mappings documentation
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/libamb.in ${CMAKE_CURRENT_BINARY_DIR}/libamb.h @ONLY)
+
+ add_custom_target(genmappings_libamb
+ python ${CMAKE_SOURCE_DIR}/tools/genmapping --output ${CMAKE_CURRENT_BINARY_DIR}/ambdbusmappings.idl ${dbus_mapping_headers}
+ COMMENT "running genmapping")
+ add_dependencies(libamb_docs genmappings_libamb)
+ add_dependencies(idl genmappings_libamb)
+
+endif(DOXYGEN_FOUND)
+
endif(enable_docs)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/amb.in.idl ${CMAKE_CURRENT_SOURCE_DIR}/amb.fidl @ONLY)
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/dbus.idl ${CMAKE_CURRENT_SOURCE_DIR}/dbus.idl @ONLY)
+
diff --git a/docs/Doxyfile.idl.in b/docs/Doxyfile.idl.in
new file mode 100644
index 00000000..cf05b696
--- /dev/null
+++ b/docs/Doxyfile.idl.in
@@ -0,0 +1,3 @@
+PROJECT_NAME = @PROJECT_NAME@
+PROJECT_NUMBER = @PROJECT_VERSION@
+INPUT = @CMAKE_CURRENT_SOURCE_DIR@ @CMAKE_CURRENT_BINARY_DIR@/ambdbusmappings.idl
diff --git a/Doxyfile.idl.in b/docs/Doxyfile.in
index 435603d1..ae6369e0 100644
--- a/Doxyfile.idl.in
+++ b/docs/Doxyfile.in
@@ -1,3 +1,3 @@
PROJECT_NAME = @PROJECT_NAME@
PROJECT_NUMBER = @PROJECT_VERSION@
-INPUT = @CMAKE_CURRENT_SOURCE_DIR@/docs
+INPUT = @CMAKE_SOURCE_DIR@/lib/ @CMAKE_CURRENT_BINARY_DIR@/
diff --git a/docs/dbus.idl b/docs/dbus.idl
index 29cb4683..519ef9f1 100644
--- a/docs/dbus.idl
+++ b/docs/dbus.idl
@@ -11,7 +11,8 @@
*
* The interfaces and data types are documented in <a href="amb.fidl">amb.fidl</a>. Franca IDL
* tools can be used to generate DBus introspection xml which can be used to generate bindings
-* for your language of choice.
+* for your language of choice. These interfaces types map to internal AMB properties. To understand the mappings,
+* see the <a href="ambdbusmappings_8idl.html">mapping documentation</a>
*
* \section basic_usage Basic Recommended Usage
*
diff --git a/lib/libamb.h b/docs/libamb.in
index 7a23034a..ace28a9e 100644
--- a/lib/libamb.h
+++ b/docs/libamb.in
@@ -1,14 +1,27 @@
/**
\mainpage Automotive Message Broker Library Documentation
-
+ \version @PROJECT_VERSION@
\section intro Introduction
- AMB Library documentation outlines the internal classes and structures for building
+ Automotive Message Broker (AMB) Library documentation outlines the internal classes and structures for building
plugins for AMB.
\section architecture General Architecture
AMB has 3 main parts. Source plugins which provide data, a routing engine that
routes data and sink plugins that consume the data.
+ \section properties Properties
+ AMB defines a number of properties itself. These properties are defined in vehicleproperty.h. The DBus plugin
+ will take many of these properties and combine them in DBus interfaces. The mappings of AMB internal properties
+ to DBus Interface properties can be found in the <a href="ambdbusmappings_8idl.html">mappings documentation</a>. This file will come in handy when you want to
+ implement a particular AMB DBus interface in your source plugin.
+
+ By default, for any property not explicitly
+ included in a DBus interface, the DBus plugin will generate a custom interface. The pattern is as follows:
+
+ CustomProperty = "org.automotive.CustomProperty.CustomProperty"
+
+ "org.automotive.CustomProperty is the DBus interface and CustomProperty is a DBus property in that interface.
+
\section plugins Plugins
There are two types of plugins: plugins that provide data, called "sources"
(AbstractSource) and plugins that consume data, called "sinks" (AbstractSink).
@@ -21,12 +34,19 @@
are also many different types of plugins useful for testing and development in the
plugins/ directory.
+ Various plugins have separate documentation found in @DOC_INSTALL_DIR@/plugins/.
+
+ \section plugin_creation Creating your own plugin
+ AMB allows you to create your own plugins. Plugins inherit from either AbstractSource, AbstractSink, or AmbPluginImpl.
+
+ It is recommended that new plugins be written using AmbPlugin and AmbPluginImpl.
+
\section routing_engine Routing Engine Plugins
As of 0.12, the routing engine itself can be exchanged for a plugin. This allows
users to swap in routing engines with different behaviors, additional security,
and custom throttling and filtering features.
The easiest way to get started creating a routing engine plugin would be to look at
- AbstractRoutingEngine, the base class for all routing engines and the default
+ AbstractRoutingEngine, the base class for all routing engines and the default
routing engine in ambd/core.cpp.
**/
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 4313156e..54cea0b6 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,8 +1,7 @@
-set(amb_examples configwheel databaseconfig databasesource dbusconfig exampleconfig
+set(amb_examples configwheel databasesource dbusconfig exampleconfig
gpsnmea obdsourceconfig opencvluxconfig opencvdbusconfig qtmainloopconfig websocketsink2 websocketsource2
testsourceconfig bluemonkey/bluemonkeyconfig)
-
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/configwheel.in ${CMAKE_CURRENT_SOURCE_DIR}/configwheel @ONLY)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/databasesource.in ${CMAKE_CURRENT_SOURCE_DIR}/databasesource @ONLY)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/dbusconfig.in ${CMAKE_CURRENT_SOURCE_DIR}/dbusconfig @ONLY)
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 92184b9d..0b41a490 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -1,5 +1,5 @@
-set(amb_sources abstractpropertytype.cpp abstractroutingengine.cpp listplusplus.cpp abstractsink.cpp vehicleproperty.cpp abstractsource.cpp debugout.cpp timestamp.cpp uuidhelper.cpp mappropertytype.hpp propertyinfo.hpp superptr.hpp asyncqueue.hpp)
-set(amb_headers_install abstractpropertytype.h nullptr.h abstractroutingengine.h listplusplus.h abstractsink.h vehicleproperty.h debugout.h abstractsource.h timestamp.h uuidhelper.h mappropertytype.hpp propertyinfo.hpp superptr.hpp asyncqueue.hpp)
+set(amb_sources abstractpropertytype.cpp abstractroutingengine.cpp listplusplus.cpp abstractsink.cpp vehicleproperty.cpp abstractsource.cpp debugout.cpp timestamp.cpp uuidhelper.cpp mappropertytype.hpp propertyinfo.hpp superptr.hpp asyncqueue.hpp ambpluginimpl.cpp ambplugin.h)
+set(amb_headers_install abstractpropertytype.h nullptr.h abstractroutingengine.h listplusplus.h abstractsink.h vehicleproperty.h debugout.h abstractsource.h timestamp.h uuidhelper.h mappropertytype.hpp propertyinfo.hpp superptr.hpp asyncqueue.hpp ambplugin.h ambpluginimpl.h)
add_library(amb SHARED ${amb_sources})
@@ -7,9 +7,9 @@ find_library(uuid_LIBRARY uuid DOC "Uuid libraries")
find_path(uuid_INCLUDE_DIR uuid/uuid.h DOC "Libtool headers")
if(uuid_LIBRARY)
- message(STATUS "uuid found")
+ message(STATUS "uuid found")
else(uuid_LIBRARY)
- message(FATAL_ERROR "uuid missing. please install uuid-dev")
+ message(FATAL_ERROR "uuid missing. please install uuid-dev")
endif(uuid_LIBRARY)
include_directories( ${include_dirs} ${uuid_INCLUDE_DIR})
diff --git a/plugins/common/ambplugin.h b/lib/ambplugin.h
index 04fa3b19..c150b527 100644
--- a/plugins/common/ambplugin.h
+++ b/lib/ambplugin.h
@@ -24,10 +24,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <string>
/*!
- * \defgroup ivipocbase ivipocbase static library
+ * \file ambplugin.h
* \brief Contains common code used in all IviPoC II plugins for Automotive message broker(AMB).
+ */
+
+/*!
+ * AmbPlugin class contains common code used in all IviPoC II plugins for Automotive message broker(AMB).
+ * For the AMB library API please visit <a href="https://github.com/otcshare/automotive-message-broker">Automotive message broker web page</a>.
+ *
+ * \class AmbPlugin
*
- * Example of the minimal code to write a new plugin using ivipocbase:
+ * Example of the minimal code to write a new plugin using AmbPlugin:
*
* \code
* #include "ambpluginimpl.h"
@@ -51,15 +58,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* @{
*/
-/*!
- * AmbPlugin class contains common code used in all IviPoC II plugins for Automotive message broker(AMB).
- * For the AMB library API please visit <a href="https://github.com/otcshare/automotive-message-broker">Automotive message broker web page</a>.
- *
- * \class AmbPlugin
- */
-
-//class AmbPluginImpl;
-
template<class T>
class AmbPlugin : public AbstractSource {
diff --git a/plugins/common/ambpluginimpl.cpp b/lib/ambpluginimpl.cpp
index dc646857..dc646857 100644
--- a/plugins/common/ambpluginimpl.cpp
+++ b/lib/ambpluginimpl.cpp
diff --git a/plugins/common/ambpluginimpl.h b/lib/ambpluginimpl.h
index d9482f0f..d9482f0f 100644
--- a/plugins/common/ambpluginimpl.h
+++ b/lib/ambpluginimpl.h
diff --git a/plugins/bluemonkey/CMakeLists.txt b/plugins/bluemonkey/CMakeLists.txt
index 53b621ac..113841a0 100644
--- a/plugins/bluemonkey/CMakeLists.txt
+++ b/plugins/bluemonkey/CMakeLists.txt
@@ -4,12 +4,12 @@ find_package(Qt5Core REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Qml REQUIRED)
if(Qt5Core_FOUND)
- message(STATUS "using Qt5")
+ message(STATUS "using Qt5")
- set(QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ${Qt5Qml_INCLUDE_DIRS})
- set(QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Qml_LIBRARIES})
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
- add_definitions(${Qt5Core_DEFINITIONS})
+ set(QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ${Qt5Qml_INCLUDE_DIRS})
+ set(QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Qml_LIBRARIES})
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
+ add_definitions(${Qt5Core_DEFINITIONS})
endif(Qt5Core_FOUND)
@@ -18,25 +18,25 @@ set(CMAKE_AUTOMOC ON)
find_library(communi NAMES Communi)
if(communi)
- message(STATUS "enabling irc bluemonkey module")
- set(communi_INCLUDE_DIRS /usr/include/qt5/Communi)
- set(communi_LIBRARIES -lCommuni)
- add_definitions(-DCOMMUNI_SHARED)
-
- add_library(bluemonkeyIrcModule MODULE irccoms.cpp)
- set_target_properties(bluemonkeyIrcModule PROPERTIES PREFIX "")
- target_link_libraries(bluemonkeyIrcModule ${link_libraries} amb -L${CMAKE_CURRENT_BINARY_DIR}/lib ${QT_LIBRARIES} ${communi_LIBRARIES})
- install(TARGETS bluemonkeyIrcModule LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
+ message(STATUS "enabling irc bluemonkey module")
+ set(communi_INCLUDE_DIRS /usr/include/qt5/Communi)
+ set(communi_LIBRARIES -lCommuni)
+ add_definitions(-DCOMMUNI_SHARED)
+
+ add_library(bluemonkeyIrcModule MODULE irccoms.cpp)
+ set_target_properties(bluemonkeyIrcModule PROPERTIES PREFIX "")
+ target_link_libraries(bluemonkeyIrcModule ${link_libraries} amb -L${CMAKE_CURRENT_BINARY_DIR}/lib ${QT_LIBRARIES} ${communi_LIBRARIES})
+ install(TARGETS bluemonkeyIrcModule LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
endif(communi)
find_package(Qt5Sql)
if(Qt5Sql_FOUND)
- message(STATUS "enabling database bluemonkey module")
- add_library(bluemonkeyDbModule MODULE db.cpp)
- set_target_properties(bluemonkeyDbModule PROPERTIES PREFIX "")
- target_link_libraries(bluemonkeyDbModule ${link_libraries} amb -L${CMAKE_CURRENT_BINARY_DIR}/lib ${QT_LIBRARIES} ${Qt5Sql_LIBRARIES})
- install(TARGETS bluemonkeyDbModule LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
+ message(STATUS "enabling database bluemonkey module")
+ add_library(bluemonkeyDbModule MODULE db.cpp)
+ set_target_properties(bluemonkeyDbModule PROPERTIES PREFIX "")
+ target_link_libraries(bluemonkeyDbModule ${link_libraries} amb -L${CMAKE_CURRENT_BINARY_DIR}/lib ${QT_LIBRARIES} ${Qt5Sql_LIBRARIES})
+ install(TARGETS bluemonkeyDbModule LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
endif()
include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs} ${communi_INCLUDE_DIRS} ${QT_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/plugins/common)
@@ -53,4 +53,28 @@ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.js ${CMAKE_CURRENT_BINARY_DIR
install(TARGETS bluemonkeyplugin LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
install (FILES ${config_files} DESTINATION /etc/ambd/bluemonkey)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/README ${CMAKE_CURRENT_BINARY_DIR}/bluemonkey.README @ONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/bluemonkey.in.idl ${CMAKE_CURRENT_BINARY_DIR}/docs/bluemonkey.idl @ONLY)
+
+set(bluemonkey_docs ${CMAKE_CURRENT_BINARY_DIR}/bluemonkey.README ${CMAKE_CURRENT_BINARY_DIR}/bluemonkey.idl)
+
+if(enable_docs)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
+ add_custom_target(bluemonkey_docs ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMENT "Generating Bluemonkey javascript API documentation with Doxygen" VERBATIM)
+
+ #generate mappings documentation
+ add_custom_target(genmappings_bluemonkey
+ python ${CMAKE_SOURCE_DIR}/tools/genmapping --output ${CMAKE_CURRENT_BINARY_DIR}/docs/ambdbusmappings.idl ${dbus_mapping_headers}
+ COMMENT "running genmapping")
+ add_dependencies(bluemonkey_docs genmappings_bluemonkey)
+
+ install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/html DESTINATION ${DOC_INSTALL_DIR}/plugins/bluemonkey COMPONENT Docs)
+ install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/latex DESTINATION ${DOC_INSTALL_DIR}/plugins/bluemonkey COMPONENT Docs)
+
+endif(enable_docs)
+
+install (FILES ${bluemonkey_docs} DESTINATION ${DOC_INSTALL_DIR}/plugins)
+
endif(bluemonkey_plugin)
diff --git a/Doxyfile.in b/plugins/bluemonkey/Doxyfile.in
index 015c9ad7..2a9ada12 100644
--- a/Doxyfile.in
+++ b/plugins/bluemonkey/Doxyfile.in
@@ -1,3 +1,3 @@
PROJECT_NAME = @PROJECT_NAME@
PROJECT_NUMBER = @PROJECT_VERSION@
-INPUT = @CMAKE_CURRENT_SOURCE_DIR@/lib/
+INPUT = @CMAKE_CURRENT_BINARY_DIR@/docs/
diff --git a/plugins/bluemonkey/README b/plugins/bluemonkey/README
new file mode 100644
index 00000000..27f47052
--- /dev/null
+++ b/plugins/bluemonkey/README
@@ -0,0 +1,30 @@
+Bluemonkey Source Plugin
+
+Bluemonkey is a javascript rendering engine that allows the scripting of source plugin behavior in javascript.
+
+To use the OBD-II Source plugin, add the following config to your /etc/ambd/config:
+
+
+"sources" : [
+ {
+ "name" : "bluemonkey",
+ "path" : "/usr/lib/automotive-message-broker/bluemonkeyplugin.so",
+ "config" : "/etc/ambd/bluemonkey/config.js"
+ }
+ ]
+
+Configuration Key Definitions:
+
+"name"
+name of plugin. This key is not used by the plugin at this moment.
+
+"path"
+path to plugin on the filesystem.
+
+"config"
+path to the bluemonkey configuration script.
+
+Bluemonkey Javascript API:
+
+see bluemonkey.idl (installed to ${PREFIX}share/doc/packages/automotive-meassage-broker/plugins/
+
diff --git a/plugins/bluemonkey/bluemonkey.cpp b/plugins/bluemonkey/bluemonkey.cpp
index b8c98168..48cf662d 100644
--- a/plugins/bluemonkey/bluemonkey.cpp
+++ b/plugins/bluemonkey/bluemonkey.cpp
@@ -127,6 +127,20 @@ AbstractPropertyType* qVariantToAbstractPropertyType(QString name, QVariant var)
return nullptr;
}
+QVariant toQVariant(AbstractPropertyType* val)
+{
+ QVariantMap value;
+
+ value["name"] = val->name.c_str();
+ value["zone"] = val->zone;
+ value["source"] = val->sourceUuid.c_str();
+ value["timestamp"] = val->timestamp;
+ value["sequence"] = val->sequence;
+ value["value"] = gvariantToQVariant(val->toVariant());
+
+ return value;
+}
+
BluemonkeySink::BluemonkeySink(AbstractRoutingEngine* e, map<string, string> config, AbstractSource &parent)
: QObject(0), AmbPluginImpl(e, config, parent), engine(nullptr), mSilentMode(false)
{
@@ -174,12 +188,12 @@ QObject *BluemonkeySink::subscribeTo(QString str)
return new Property(str.toStdString(), "", routingEngine, Zone::None, this);
}
-QObject *BluemonkeySink::subscribeToSource(QString str, QString srcFilter)
+QObject *BluemonkeySink::subscribeTo(QString str, int zone, QString srcFilter)
{
- return new Property(str.toStdString(), srcFilter, routingEngine, Zone::None, this);
+ return new Property(str.toStdString(), srcFilter, routingEngine, zone, this);
}
-QObject* BluemonkeySink::subscribeToZone(QString str, int zone)
+QObject* BluemonkeySink::subscribeTo(QString str, int zone)
{
return new Property(str.toStdString(), "", routingEngine, zone, this);
}
@@ -363,11 +377,9 @@ void BluemonkeySink::getHistory(QStringList properties, QDateTime begin, QDateTi
{
QVariantList list;
- for(auto itr = reply->values.begin(); itr != reply->values.end(); itr++)
+ for(auto val : reply->values)
{
- AbstractPropertyType *val = *itr;
-
- list.append(gvariantToQVariant(val->toVariant()));
+ list.append(toQVariant(val));
}
QJSValue val = cbFunction.engine()->toScriptValue<QVariantList>(list);
@@ -469,12 +481,11 @@ void Property::getHistory(QDateTime begin, QDateTime end, QJSValue cbFunction)
{
QVariantList list;
- for(auto itr = reply->values.begin(); itr != reply->values.end(); itr++)
+ for(auto val : reply->values)
{
- AbstractPropertyType *val = *itr;
-
- list.append(gvariantToQVariant(val->toVariant()));
+ list.append(toQVariant(val));
}
+
QJSValue val = cbFunction.engine()->toScriptValue<QVariantList>(list);
cbFunction.call(QJSValueList()<<val);
@@ -492,15 +503,15 @@ Property::Property(VehicleProperty::Property prop, QString srcFilter, AbstractRo
setType(prop.c_str());
}
-QString Property::type()
+QString Property::name()
{
return mValue->name.c_str();
}
void Property::setType(QString t)
{
- if(mValue && type() != "")
- routingEngine->unsubscribeToProperty(type().toStdString(), this);
+ if(mValue && name() != "")
+ routingEngine->unsubscribeToProperty(name().toStdString(), this);
routingEngine->subscribeToProperty(t.toStdString(), this);
diff --git a/plugins/bluemonkey/bluemonkey.h b/plugins/bluemonkey/bluemonkey.h
index b25daccc..7ba04d3e 100644
--- a/plugins/bluemonkey/bluemonkey.h
+++ b/plugins/bluemonkey/bluemonkey.h
@@ -47,16 +47,28 @@ Q_DECLARE_INTERFACE(ModuleInterface, "org.automotive.bluemonkey.moduleinterface"
class Property: public QObject, public AbstractSink
{
Q_OBJECT
- Q_PROPERTY(QString type READ type)
+ Q_PROPERTY(QString name READ name)
+ Q_PROPERTY(QString source READ source)
+ Q_PROPERTY(double timestamp READ timestamp)
Q_PROPERTY(QVariant value READ value WRITE setValue)
Q_PROPERTY(int zone READ zone)
public:
Property(VehicleProperty::Property, QString srcFilter, AbstractRoutingEngine* re, Zone::Type zone = Zone::None, QObject *parent = 0);
- QString type();
+ QString name();
void setType(QString t);
+ QString source()
+ {
+ return mValue->sourceUuid.c_str();
+ }
+
+ double timestamp()
+ {
+ return mValue->timestamp;
+ }
+
virtual PropertyList subscriptions() { return PropertyList(); }
virtual void supportedChanged(const PropertyList &)
{
@@ -111,8 +123,9 @@ private: //source privates
public Q_SLOTS:
QObject* subscribeTo(QString str);
- QObject* subscribeToSource(QString str, QString srcFilter);
- QObject* subscribeToZone(QString str, int zone);
+ QObject* subscribeTo(QString str, int zone);
+ QObject* subscribeTo(QString str, int zone, QString srcFilter);
+
QStringList sourcesForProperty(QString property);
QVariant zonesForProperty(QString property, QString src);
diff --git a/plugins/bluemonkey/bluemonkey.in.idl b/plugins/bluemonkey/bluemonkey.in.idl
new file mode 100644
index 00000000..4cef21f2
--- /dev/null
+++ b/plugins/bluemonkey/bluemonkey.in.idl
@@ -0,0 +1,144 @@
+/*!
+ * \mainpage Automotive Message Broker Library Documentation - Bluemonkey Plugin
+ * \version @PROJECT_VERSION@
+ * \section intro Introduction
+ * Bluemonkey is a javascript rendering engine that allows the scripting of source plugin behavior in javascript.
+ * It allows developers a quick way to prototype plugin code as well as a way to create custom properties.
+ * \section properties Properties
+ * Bluemonkey uses internal property names (not DBus API interface names). These properties are defined in
+ * lib/vehicleproperty.h. There are mappings from AMB internal property names to DBus API properties in the
+ * <a href="ambdbusmappings_8idl">mappings documentation</a>. The mappings comes in handy when you want to implement properties that are
+ * exported as an DBus API interface (ie, org.automotive.VehicleSpeed).
+ * \section example Example bluemonkey script
+ * \code
+ * var speedProperty = bluemonkey.subscribeTo("VehicleSpeed");
+ *
+ * var testTimer = bluemonkey.createTimer();
+ * testTimer.interval = 3000;
+ * testTimer.singleShot = false;
+ * testTimer.timeout.connect(function() {
+ * //VehicleSpeed
+ * speedProperty.value = Math.floor((Math.random() * 100) + 1);
+ * });
+ * \endcode
+ * \section Javascript API documentation
+ * Javascript API documentation is found in bluemonkey.idl and is described using WebIDL. Plugin configuration documentation can be found in bluemonkey.README.
+ */
+
+ /*!
+ * \name @PROJECT_NAME@ Bluemonkey interface documentation
+ * \version @PROJECT_VERSION@
+ * \brief the bluemonkey script engine is powered by Qt QML's javascript engine. It supports QObject types as well
+ * as ECMA script (javascript). All QObject properties, slots, and signals are available in javascript.
+ * \see Qt's QMetaObject system for additional details
+ */
+
+
+partial interface Navigator {
+ readonly attribute Bluemonkey bluemonkey;
+};
+
+interface Bluemonkey {
+ /*!
+ * \brief subscribe to a property
+ * \returns PropertyInterface representing the property
+ */
+ PropertyInterface subscribeTo(DOMString propertyName, optional unsigned short zone, optional DOMString source);
+
+ /*!
+ * \brief return the AMB sources that provide propertyName
+ */
+ DOMString[] sourcesForProperty(DOMString propertyName);
+
+ /*!
+ * \brief returns the available zones that contians propertyName
+ */
+ unsigned short[] zonesForProperty(DOMString propertyName);
+
+ /*!
+ * \brief return supported properties
+ */
+ DOMString[] supportedProperties();
+
+ /*!
+ * \brief load another script
+ */
+ void loadConfig(DOMString configFile);
+
+ /*!
+ * \brief load a bluemonkey module
+ */
+ void loadModule(DOMString moduleFile);
+
+ /*!
+ * \brief log text to AMB output
+ */
+ void log(DOMString text);
+
+ /*!
+ * \brief
+ */
+ QTimer createTimer();
+
+ /*!
+ * \brief
+ */
+ QObject createQObject();
+
+ /*!
+ * \brief return logged data between "begin" and "end"
+ */
+ void getHistory(DOMString[] properties, Date begin, Date end, HistoryCallback callback);
+
+ /*!
+ * \brief
+ */
+ void createCustomProperty(DOMString name, any value, optional unsigned short zone);
+
+};
+
+interface PropertyInterface {
+ /*!
+ * \brief
+ */
+ readonly attribute DOMString type;
+
+ /*!
+ * \brief
+ */
+ readonly attribute unsigned short zone;
+
+ /*!
+ * \brief
+ */
+ readonly attribute any value;
+
+ /*!
+ * \brief
+ */
+ readonly attribute DOMString source;
+
+ /*!
+ * \brief
+ */
+ readonly attribute DOMTimestamp timestamp;
+
+ /*!
+ * \brief
+ */
+ readonly attribute Signal changed;
+
+ void getHistory(Date begin, Date end, HistoryCallback callback);
+};
+
+interface Signal {
+ /*!
+ * \brief
+ */
+ void connect(ChangedCallback callback)
+};
+
+callback ChangedCallback = void(any value); ();
+
+callback HistoryCallback = void(PropertyInterface[] data); ();
+
diff --git a/plugins/common/CMakeLists.txt b/plugins/common/CMakeLists.txt
index 8a2311ac..bf18717b 100644
--- a/plugins/common/CMakeLists.txt
+++ b/plugins/common/CMakeLists.txt
@@ -1,7 +1,7 @@
set(plugins_common_sources abstractio.hpp serialport.hpp bluetoothadapterproxy.c bluetooth.hpp bluetoothmanagerproxy.c bluetoothserialproxy.c bluetooth5.cpp canadapter.cpp cansocket.cpp cansocketreader.cpp
- canbusimpl.cpp cansocketadapter.cpp logger.cpp mutex.cpp thread.cpp ambpluginimpl.cpp ambplugin.h)
+ canbusimpl.cpp cansocketadapter.cpp logger.cpp mutex.cpp thread.cpp )
set(plugins_common_headers_install abstractio.hpp serialport.hpp bluetooth.hpp bluetoothadapterproxy.h bluetoothmanagerproxy.h bluetoothserialproxy.h bluetooth5.h canbus.h canadapter.h cansocket.h cansocketreader.h
- canbusimpl.h cansocketadapter.h canobserver.h logger.h mutex.h thread.h ambplugin.h ambpluginimpl.h)
+ canbusimpl.h cansocketadapter.h canobserver.h logger.h mutex.h thread.h)
add_library(amb-plugins-common SHARED ${plugins_common_sources})
diff --git a/plugins/database/CMakeLists.txt b/plugins/database/CMakeLists.txt
index 8f977d25..2564ff2c 100644
--- a/plugins/database/CMakeLists.txt
+++ b/plugins/database/CMakeLists.txt
@@ -14,6 +14,8 @@ target_link_libraries(databasesinkplugin amb -L${CMAKE_CURRENT_BINARY_DIR}/lib $
install(TARGETS databasesinkplugin LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/README ${CMAKE_CURRENT_SOURCE_DIR}/README @ONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/README ${CMAKE_CURRENT_BINARY_DIR}/database.README @ONLY)
+
+install (FILES ${CMAKE_CURRENT_BINARY_DIR}/database.README DESTINATION ${DOC_INSTALL_DIR}/plugins)
endif(database_plugin)
diff --git a/plugins/database/README b/plugins/database/README
index f380f0ff..d18e9148 100644
--- a/plugins/database/README
+++ b/plugins/database/README
@@ -1,4 +1,5 @@
Database plugin
+Version: @PROJECT_VERSION@
This plugin logs properties in a sqlite database file. It can also be used as a source to
play back previous logs to AMB.
@@ -10,15 +11,15 @@ cmake -Ddatabase_plugin=On ..
To use the Database plugin, add the following to the "sources" array in /etc/ambd/config:
{
- "name" : "Database",
- "path" : "/usr/lib/automotive-message-broker/databasesinkplugin.so",
- "databaseFile" : "storage",
- "bufferLength" : "100",
- "properties" : "{ 'properties' : ['VehicleSpeed','EngineSpeed'] }",
- "startOnLoad" : "false",
- "playbackOnLoad" : "false",
- "playbackMultiplier" : "1",
- "frequency" : "1"
+ "name" : "Database",
+ "path" : "/usr/lib/automotive-message-broker/databasesinkplugin.so",
+ "databaseFile" : "storage",
+ "bufferLength" : "100",
+ "properties" : "{ 'properties' : ['VehicleSpeed','EngineSpeed'] }",
+ "startOnLoad" : "false",
+ "playbackOnLoad" : "false",
+ "playbackMultiplier" : "1",
+ "frequency" : "1"
}
Configuration Key Definitions:
@@ -35,7 +36,7 @@ path to log file
Default: "storage"
"bufferLength"
-Number of logged items to keep in memory before flushing to the database file.
+Number of logged items to keep in memory before flushing to the database file.
A higher number will reduce writes and improve performance.
Default: 100
@@ -63,7 +64,7 @@ Default: 1
"frequency"
Frequency in Hz in which the database will write contents. Only the newest values
-will be written. Other values are discarded. If bufferLength is not full,the
+will be written. Other values are discarded. If bufferLength is not full,the
database will not be written to until it is.
Default: 1
@@ -72,7 +73,7 @@ AMB Properties:
DatabaseFile
Type: string
-File to be used to log or play back.
+File to be used to log or play back.
corresponds to configuration option "databaseFile".
@@ -91,7 +92,7 @@ Type: bool
Access: read/write
Indicates whether database playback is occuring. Set to true to turn on playback.
-Set to false to turn off playback. This property is mutually exclusive with the
+Set to false to turn off playback. This property is mutually exclusive with the
DatabaseLogging property. Setting this to true will turn off logging.
Default: false when configuration option "playbackOnLoad" is not set.
diff --git a/plugins/dbus/CMakeLists.txt b/plugins/dbus/CMakeLists.txt
index 7bc4fd79..fc3b6e54 100644
--- a/plugins/dbus/CMakeLists.txt
+++ b/plugins/dbus/CMakeLists.txt
@@ -17,4 +17,7 @@ install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/amb.conf DESTINATION /etc/dbus-1/syst
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/amb.conf ${CMAKE_CURRENT_SOURCE_DIR}/amb.conf)
+set(dbus_mapping_headers ${CMAKE_CURRENT_SOURCE_DIR}/runningstatus.h ${CMAKE_CURRENT_SOURCE_DIR}/environmentproperties.h ${CMAKE_CURRENT_SOURCE_DIR}/vehicleinfo.h ${CMAKE_CURRENT_SOURCE_DIR}/maintenance.h ${CMAKE_CURRENT_SOURCE_DIR}/parking.h ${CMAKE_CURRENT_SOURCE_DIR}/drivingsafety.h ${CMAKE_CURRENT_SOURCE_DIR}/personalization.h
+ CACHE INTERNAL "dbus mapping headers")
+
add_subdirectory(amb-qt)
diff --git a/plugins/dbus/amb-qt/CMakeLists.txt b/plugins/dbus/amb-qt/CMakeLists.txt
index 1bf54b79..a1ae739c 100644
--- a/plugins/dbus/amb-qt/CMakeLists.txt
+++ b/plugins/dbus/amb-qt/CMakeLists.txt
@@ -10,11 +10,6 @@ if(Qt5Core_FOUND)
set(QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} ${Qt5Quick_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS})
set(QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Quick_LIBRARIES} ${Qt5DBus_LIBRARIES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
- message(STATUS "size of void_p: ${CMAKE_SIZEOF_VOID_P}")
- if(CMAKE_SIZEOF_VOID_P MATCHES "8")
- message(STATUS "can has 64bits")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcmodel=large")
- endif(CMAKE_SIZEOF_VOID_P MATCHES "8")
add_definitions(${Qt5Core_DEFINITIONS})
set(CMAKE_AUTOMOC ON)
endif(Qt5Core_FOUND)
diff --git a/plugins/dbus/dbusplugin.h b/plugins/dbus/dbusplugin.h
index d26394c3..74128dfe 100644
--- a/plugins/dbus/dbusplugin.h
+++ b/plugins/dbus/dbusplugin.h
@@ -64,19 +64,6 @@ public:
}
protected:
- template <typename T>
- void wantProperty(VehicleProperty::Property property, std::string propertyName, std::string signature, AbstractProperty::Access access)
- {
- //propertyDBusMap[property] = new VariantType(routingEngine, signature, property, propertyName, access);
- propertyDBusMap.push_back( new VariantType(routingEngine, property, propertyName, access));
- }
-
-
- void wantPropertyString(VehicleProperty::Property property, std::string propertyName, std::string signature, AbstractProperty::Access access)
- {
- //propertyDBusMap[property] = new VariantType(routingEngine, signature, property, propertyName, access);
- propertyDBusMap.push_back( new VariantType(routingEngine, property, propertyName, access));
- }
void wantPropertyVariant(VehicleProperty::Property ambProperty, std::string propertyName, std::string signature, AbstractProperty::Access access)
{
diff --git a/plugins/dbus/environmentproperties.h b/plugins/dbus/environmentproperties.h
index a235f976..be54b125 100644
--- a/plugins/dbus/environmentproperties.h
+++ b/plugins/dbus/environmentproperties.h
@@ -18,7 +18,7 @@ public:
* @access readonly
* @attributeComment \brief Must return the brightness outside the vehicle in lux.
*/
- wantPropertyVariant(VehicleProperty::ExteriorBrightness,"ExteriorBrightness", "q", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::ExteriorBrightness, "ExteriorBrightness", "q", AbstractProperty::Read);
}
};
@@ -207,7 +207,7 @@ public:
WindowStatusProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("WindowStatus", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::WindowStatus,"Openness", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::WindowStatus, "Openness", AbstractProperty::ReadWrite);
wantPropertyVariant(VehicleProperty::Defrost, "Defrost", AbstractProperty::ReadWrite);
}
};
@@ -218,7 +218,7 @@ public:
SideWindowStatusProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("SideWindow", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::WindowStatus,"Openness", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::WindowStatus, "Openness", AbstractProperty::ReadWrite);
wantPropertyVariant(VehicleProperty::WindowLockStatus, "Lock", AbstractProperty::ReadWrite);
}
};
@@ -229,7 +229,7 @@ public:
DefrostProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("Defrost", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::DefrostWindow,"DefrostWindow", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::DefrostWindow, "DefrostWindow", AbstractProperty::ReadWrite);
wantPropertyVariant(VehicleProperty::DefrostMirror, "DefrostMirror", AbstractProperty::ReadWrite);
}
};
diff --git a/plugins/dbus/parking.h b/plugins/dbus/parking.h
index 483fd259..7355b487 100644
--- a/plugins/dbus/parking.h
+++ b/plugins/dbus/parking.h
@@ -13,7 +13,7 @@ public:
SecurityAlertProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("SecurityAlert", re, connection, map<string, string>())
{
- wantProperty<Security::Status>(VehicleProperty::SecurityAlertStatus,"SecurityAlert", "i", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::SecurityAlertStatus, "SecurityAlert", "i", AbstractProperty::Read);
}
};
@@ -29,9 +29,9 @@ public:
* @access readonly
* @attributeComment must return status of parking brake: Engaged = true, Disengaged = false.
**/
- wantProperty<bool>(VehicleProperty::ParkingBrakeStatus,"ParkingBrake", "b", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::ParkingBrakeStatus, "ParkingBrake", "b", AbstractProperty::Read);
- wantPropertyVariant(VehicleProperty::ParkingBrakeStatusW3C,"Status", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::ParkingBrakeStatusW3C, "Status", AbstractProperty::Read);
}
@@ -50,7 +50,7 @@ public:
* @access readonly
* @attributeComment must return status of parking light: Engaged = true, Disengaged = false.
**/
- wantProperty<bool>(VehicleProperty::ParkingLightStatus,"ParkingLight", "b", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::ParkingLightStatus, "ParkingLight", "b", AbstractProperty::Read);
}
};
@@ -66,7 +66,7 @@ public:
* @access readonly
* @attributeComment must return status of hazard light: Engaged = true, Disengaged = false.
**/
- wantProperty<bool>(VehicleProperty::HazardLightStatus,"HazardLight", "b", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::HazardLightStatus, "HazardLight", "b", AbstractProperty::ReadWrite);
}
};
diff --git a/plugins/dbus/personalization.h b/plugins/dbus/personalization.h
index f6bc518a..9bba7b85 100644
--- a/plugins/dbus/personalization.h
+++ b/plugins/dbus/personalization.h
@@ -61,12 +61,12 @@ public:
SeatAdjustment(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("SeatAdjustment", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::SeatPositionBackCushion,"SeatBackCushion", AbstractProperty::ReadWrite);
- wantPropertyVariant(VehicleProperty::SeatPositionRecline,"SeatReclineBack", AbstractProperty::ReadWrite);
- wantPropertyVariant(VehicleProperty::SeatPositionSlide,"SeatSlide", AbstractProperty::ReadWrite);
- wantPropertyVariant(VehicleProperty::SeatPositionCushionHeight,"SeatCushionHeight", AbstractProperty::ReadWrite);
- wantPropertyVariant(VehicleProperty::SeatPositionHeadrest,"SeatHeadrest", AbstractProperty::ReadWrite);
- wantPropertyVariant(VehicleProperty::SeatPositionSideCushion,"SeatSideCushion", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SeatPositionBackCushion, "SeatBackCushion", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SeatPositionRecline, "SeatReclineBack", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SeatPositionSlide, "SeatSlide", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SeatPositionCushionHeight, "SeatCushionHeight", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SeatPositionHeadrest, "SeatHeadrest", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SeatPositionSideCushion, "SeatSideCushion", AbstractProperty::ReadWrite);
}
};
diff --git a/plugins/dbus/runningstatus.h b/plugins/dbus/runningstatus.h
index 4d5825c9..f9deaf45 100644
--- a/plugins/dbus/runningstatus.h
+++ b/plugins/dbus/runningstatus.h
@@ -35,10 +35,10 @@ public:
* @access readonly
* @attributeComment \brief Must return Vehicle Speed in kilometers per hour.
**/
- wantPropertyVariant(VehicleProperty::VehicleSpeed,"Speed", "i", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::VehicleSpeed, "Speed", AbstractProperty::Read);
/// Deprecated:
- wantPropertyVariant(VehicleProperty::VehicleSpeed,"VehicleSpeed", "i", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::VehicleSpeed, "VehicleSpeed", AbstractProperty::Read);
}
@@ -57,10 +57,10 @@ public:
* @access readonly
* @attributeComment \brief Must return Engine Speed in rotations per minute.
**/
- wantPropertyVariant(VehicleProperty::EngineSpeed,"Speed", "i", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::EngineSpeed, "Speed", AbstractProperty::Read);
/// Deprecated:
- wantPropertyVariant(VehicleProperty::EngineSpeed,"EngineSpeed", "i", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::EngineSpeed, "EngineSpeed", AbstractProperty::Read);
}
@@ -131,17 +131,13 @@ public:
:DBusSink("Transmission", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::TransmissionShiftPosition,
- "ShiftPosition", "y", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::TransmissionShiftPosition, "ShiftPosition", "y", AbstractProperty::Read);
- wantPropertyVariant(VehicleProperty::TransmissionGearPosition,
- "GearPosition", "y", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::TransmissionGearPosition, "GearPosition", "y", AbstractProperty::Read);
- wantPropertyVariant(VehicleProperty::TransmissionGearPosition,
- "Gear", "y", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::TransmissionGearPosition, "Gear", "y", AbstractProperty::Read);
- wantPropertyVariant(VehicleProperty::TransmissionModeW3C,
- "Mode", "y", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::TransmissionModeW3C, "Mode", "y", AbstractProperty::Read);
wantPropertyVariant(VehicleProperty::TransmissionGearType, "Type", "q", AbstractProperty::Read);
}
@@ -242,8 +238,8 @@ public:
:DBusSink("Horn", re, connection, map<string, string>())
{
/// TODO: deprecated remove in 0.14
- wantPropertyVariant(VehicleProperty::Horn,"On",AbstractProperty::Read);
- wantPropertyVariant(VehicleProperty::Horn,"Status",AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::Horn, "On", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::Horn, "Status", AbstractProperty::Read);
}
};
@@ -255,21 +251,21 @@ public:
FuelProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("Fuel", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::FuelLevel,"Level", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::FuelLevel, "Level", AbstractProperty::Read);
- wantPropertyVariant(VehicleProperty::FuelRange,"Range", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::FuelRange, "Range", AbstractProperty::Read);
- wantPropertyVariant(VehicleProperty::FuelConsumption,"InstantConsumption", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::FuelConsumption, "InstantConsumption", AbstractProperty::Read);
- wantPropertyVariant(VehicleProperty::FuelEconomy,"InstantEconomy", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::FuelEconomy, "InstantEconomy", AbstractProperty::Read);
- wantPropertyVariant(VehicleProperty::FuelAverageEconomy,"AverageEconomy", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::FuelAverageEconomy, "AverageEconomy", AbstractProperty::ReadWrite);
- wantPropertyVariant(VehicleProperty::FuelAverageConsumption,"AverageConsumption", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::FuelAverageConsumption, "AverageConsumption", AbstractProperty::ReadWrite);
- wantPropertyVariant(VehicleProperty::FuelConsumptionSinceRestart,"FuelConsumedSinceRestart", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::FuelConsumptionSinceRestart, "FuelConsumedSinceRestart", AbstractProperty::ReadWrite);
- wantPropertyVariant(VehicleProperty::FuelTimeSinceRestart,"TimeSinceRestart", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::FuelTimeSinceRestart, "TimeSinceRestart", AbstractProperty::ReadWrite);
}
};
diff --git a/tools/genmapping.py b/tools/genmapping.py
new file mode 100755
index 00000000..143a67fc
--- /dev/null
+++ b/tools/genmapping.py
@@ -0,0 +1,90 @@
+#!/usr/bin/python
+
+import os
+import argparse
+
+parser = argparse.ArgumentParser(description='Process DBus mappings.')
+parser.add_argument('mappingFiles', metavar='N', nargs='+',
+ help='dbus headers to find mappings in')
+parser.add_argument('--output', dest='output',
+ help='output file to write idl to')
+args = parser.parse_args()
+print "parsing"
+print args.mappingFiles
+
+interfaces = []
+
+class Member:
+ ambName = ""
+ memberName = ""
+
+ def __repr__(self):
+ return "Member"
+ def toString(self):
+ return "{" + self.ambName + " => " + self.memberName + "}"
+ def toIdl(self):
+ return ' const DOMString ' + self.ambName + ' = "' + self.memberName + '";\n'
+
+class Interface:
+ def __init__(self):
+ self.name = ""
+ self.members = []
+ def __repr__(self):
+ return "Interface('" + name + "')"
+ def toString(self):
+ output = self.name + ":"
+ for member in self.members:
+ output += member.toString() + ","
+ return output
+ def toIdl(self):
+ output = "interface " + self.name + " {\n"
+ for member in self.members:
+ output += member.toIdl()
+ output += "\n};\n"
+ return output
+
+for input in args.mappingFiles:
+ try: file = open(input)
+ except IOError:
+ print "Failed to open " + input
+ with file:
+ for line in file:
+ i = line.find("DBusSink(\"");
+ if i != -1:
+ interface = Interface()
+ ifaceNameBeg = line.find('("')
+ ifaceNameEnd = line.find('",')
+ interface.name = line[ifaceNameBeg+2 : ifaceNameEnd]
+ interfaces.append(interface)
+ wantPropertyVariant = 'wantPropertyVariant('
+ i = line.find(wantPropertyVariant)
+ if i!= -1:
+ member = Member()
+ ambNameEnd = line.find(', "')-2
+ member.ambName = line[i+len(wantPropertyVariant) : i + ambNameEnd].replace("VehicleProperty::", "")
+ memberNameBeg = line.find(', "')+3
+ memberNameEnd = line.find('",')
+ member.memberName = line[memberNameBeg : memberNameEnd]
+ interfaces[-1].members.append(member)
+ file.close()
+
+try: outputFile = open(args.output, 'w')
+except IOError:
+ print "Error could not open output file: " + args.output
+with outputFile:
+ header =("/*!\n"
+ " * \\name AMB to AMB-DBus Mapping Tables\n"
+ " * \\file " + os.path.basename(args.output) + "\n"
+ " * \\brief This describes the AMB internal property names to AMB DBus interface property names\n"
+ " * AMB internal property names are designed to be flat variable names (ie, 'ConvertableRoofStatus'). The DBus\n"
+ " * properties however follow the naming scheme defined in the W3C automotive business group vehicle <a href='http://w3c.github.io/automotive-bg/data_spec.html'>data specification</a>\n"
+ " * The pattern each interface is 'const DOMString AMBProperty = DBusProperty' where 'AMBProperty' is the internal name and 'DBusProperty' is the DBus property name")
+ header += " */\n\n"
+ outputFile.write(header)
+ for iface in interfaces:
+ outputFile.write(iface.toIdl())
+ outputFile.write("\n")
+ outputFile.close()
+
+
+
diff --git a/xwalk/vehicle.html b/xwalk/vehicle.html
index 19d9c218..dd8961a3 100644
--- a/xwalk/vehicle.html
+++ b/xwalk/vehicle.html
@@ -10,21 +10,41 @@ vehicle = navigator.vehicle;
function get(objName) {
- if(!vehicle[objName].get) {
- debug("no get() method for " + objName);
- return;
- }
-
- vehicle[objName].get().then(function(data) {
- try {
- debug("get " + objName + ": " + JSON.stringify(data));
- } catch(error) {
- debug("error " + error.message);
- }
- },
- function(error) {
- debug("error getting " + objName + ": " + error.message);
- });
+ if(!vehicle[objName].get) {
+ debug("Error no get() method for " + objName);
+ return;
+ }
+
+ var zones = vehicle[objName].zones;
+ if(zones.length !== 0)
+ {
+ for(var zone in zones)
+ {
+ vehicle[objName].get(zone).then(function(data) {
+ try {
+ debug("get " + objName + ": " + JSON.stringify(data));
+ } catch(error) {
+ debug("error " + error.message);
+ }
+ },
+ function(error) {
+ debug("error getting " + objName + ": " + error.message);
+ });
+ }
+ }
+ else
+ {
+ vehicle[objName].get().then(function(data) {
+ try {
+ debug("get " + objName + ": " + JSON.stringify(data));
+ } catch(error) {
+ debug("error " + error.message);
+ }
+ },
+ function(error) {
+ debug("error getting " + objName + ": " + error.message);
+ });
+ }
}
debug("testing zones...");
@@ -50,34 +70,34 @@ debug("testing subscribe()");
var subReplies = 0;
var handle = vehicle.vehicleSpeed.subscribe(function(data) {
- console.log("got subscribe callback");
- debug("Vehicle speed changed: " + data.speed);
- subReplies++;
-
- if (subReplies === 5) {
- debug("unsubscribing");
- vehicle.vehicleSpeed.unsubscribe(handle);
- }
+ console.log("got subscribe callback");
+ debug("Vehicle speed changed: " + data.speed);
+ subReplies++;
+
+ if (subReplies === 5) {
+ debug("unsubscribing");
+ vehicle.vehicleSpeed.unsubscribe(handle);
+ }
});
debug("test invalid zone error");
vehicle.vehicleSpeed.get("invalidzone").then(function() { },
- function(error) { debug("Invalid zone: " + error.message); });
+ function(error) { debug("Invalid zone: " + error.message); });
///test set()
debug("testing set()");
vehicle.lightStatus.set({"fog" : false}).then(function() {
- debug("set success!");
+ debug("set success!");
}, function(error) {
- debug("set fail! " + error.message);
+ debug("set fail! " + error.message);
});
for(var propName in vehicle) {
- if(typeof(obj[propName]) != "undefined") {
- debug("vehicle." + propName);
- get(propName);
- }
+ if(typeof(vehicle[propName]) != "undefined") {
+ debug("vehicle." + propName);
+ get(propName);
+ }
}
</script>