summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevron Rees <tripzero.kev@gmail.com>2015-01-05 08:14:19 -0800
committerKevron Rees <tripzero.kev@gmail.com>2015-01-05 08:14:19 -0800
commitc1a53dde103babf4a4990e3b2bfb2f911b6a5c2b (patch)
treec764b0ca255b40b2df43fe53e3f9b9d2936db31f
parent08a201cd5e80a664a3e9594d01f07a22f9300adc (diff)
parenta3399b9c1e718dc895518a1dd7502501119968d9 (diff)
downloadautomotive-message-broker-c1a53dde103babf4a4990e3b2bfb2f911b6a5c2b.tar.gz
Merge pull request #38 from tripzero/0.130.12.903
0.12.903
-rw-r--r--CMakeLists.txt20
-rw-r--r--docs/CMakeLists.txt6
-rw-r--r--docs/Doxyfile.idl.in5
-rw-r--r--docs/Doxyfile.mainpage.in4
-rw-r--r--docs/amb.in.fidl249
-rw-r--r--docs/dbus.idl35
-rw-r--r--docs/images/AMBArchitecture.pngbin0 -> 71850 bytes
-rw-r--r--docs/mainpage.in.idl14
-rw-r--r--docs/plugins/bluemonkey/bluemonkey.idl156
-rw-r--r--lib/asyncqueue.hpp9
-rw-r--r--packaging.in/CMakeLists.txt18
-rw-r--r--packaging.in/automotive-message-broker.changes.in (renamed from packaging/automotive-message-broker.changes)0
-rw-r--r--packaging.in/automotive-message-broker.spec.in (renamed from packaging/automotive-message-broker.spec.in)41
-rw-r--r--packaging.in/debian/automotive-message-broker-plugins.debian.install5
-rw-r--r--packaging.in/debian/automotive-message-broker.debian.install3
-rw-r--r--packaging.in/debian/changelog5
-rw-r--r--packaging.in/debian/control.debian.in41
-rw-r--r--packaging.in/debian/libamb-dev.debian.install3
-rw-r--r--packaging.in/debian/libamb.debian.install1
-rwxr-xr-xpackaging.in/debian/rules19
-rw-r--r--packaging/CMakeLists.txt2
-rw-r--r--plugins/bluemonkey/CMakeLists.txt5
-rw-r--r--plugins/bluemonkey/Doxyfile.in1
-rw-r--r--plugins/bluemonkey/bluemonkey.in.idl40
-rw-r--r--plugins/database/databasesink.cpp38
-rw-r--r--plugins/database/databasesink.h2
-rw-r--r--plugins/dbus/abstractdbusinterface.cpp2
-rw-r--r--tools/CMakeLists.txt4
-rw-r--r--tools/ambctl.py8
-rw-r--r--tools/ambctl.py.orig365
30 files changed, 540 insertions, 561 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6d540623..44402266 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ include(CMakeDependentOption)
set(PROJECT_NAME "automotive-message-broker")
set(PROJECT_PRETTY_NAME "Automotive Message Broker")
-set(PROJECT_VERSION "0.12.902")
+set(PROJECT_VERSION "0.12.903")
set(PROJECT_CODENAME "agera")
set(PROJECT_QUALITY "beta")
@@ -96,25 +96,9 @@ SET(CPACK_STRIP_FILES true)
SET(CPACK_PACKAGE_CONTACT "tripzero.kev@gmail.com")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
-
# Always build .tar.gz and .sh files
SET(CPACK_GENERATOR "STGZ;TGZ;TBZ2")
-SET(CPACK_GENERATOR "${CPACK_GENERATOR};DEB")
-SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libopencv, libjson0, libltdl7")
-SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
-SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "tripzero.kev@gmail.com")
-
-find_program(rpmbuild rpmbuild /usr/bin)
-if(rpmbuild)
- SET(CPACK_GENERATOR "${CPACK_GENERATOR};RPM")
- SET(CPACK_RPM_USER_BINARY_SPECFILE "${CMAKE_SOURCE_DIR}/packaging/automotive-message-broker.spec")
- SET(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64")
-endif(rpmbuild)
-INCLUDE(CPack)
-
-configure_file (${CMAKE_CURRENT_SOURCE_DIR}/packaging.in/config.tizen.in ${CMAKE_CURRENT_BINARY_DIR}/packaging.in/config.tizen @ONLY)
-
add_subdirectory(lib)
add_subdirectory(plugins)
add_subdirectory(ambd)
@@ -123,4 +107,4 @@ add_subdirectory(tests)
add_subdirectory(tools)
add_subdirectory(examples)
add_subdirectory(xwalk)
-add_subdirectory(packaging)
+add_subdirectory(packaging.in)
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index db9b6095..445856cf 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -1,6 +1,8 @@
if(enable_docs)
install (DIRECTORY amb DESTINATION ${DOC_INSTALL_DIR} COMPONENT Docs)
install (DIRECTORY dbus DESTINATION ${DOC_INSTALL_DIR} COMPONENT Docs)
+ install (DIRECTORY html DESTINATION ${DOC_INSTALL_DIR} COMPONENT Docs)
+ install (DIRECTORY latex 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)
@@ -10,8 +12,10 @@ 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)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.mainpage.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.mainpage @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)
+ add_custom_target(mainpage_docs ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.mainpage WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs COMMENT "Generating mainpage documentation with Doxygen" VERBATIM)
#generate mappings documentation
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/libamb.in ${CMAKE_CURRENT_BINARY_DIR}/libamb.h @ONLY)
@@ -28,5 +32,5 @@ endif(DOXYGEN_FOUND)
endif(enable_docs)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/amb.in.fidl ${CMAKE_CURRENT_SOURCE_DIR}/amb.fidl @ONLY)
-configure_file (${CMAKE_CURRENT_SOURCE_DIR}/dbus.idl ${CMAKE_CURRENT_SOURCE_DIR}/dbus.idl @ONLY)
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/mainpage.in.idl ${CMAKE_CURRENT_SOURCE_DIR}/mainpage.idl @ONLY)
diff --git a/docs/Doxyfile.idl.in b/docs/Doxyfile.idl.in
index cf05b696..55235849 100644
--- a/docs/Doxyfile.idl.in
+++ b/docs/Doxyfile.idl.in
@@ -1,3 +1,6 @@
PROJECT_NAME = @PROJECT_NAME@
PROJECT_NUMBER = @PROJECT_VERSION@
-INPUT = @CMAKE_CURRENT_SOURCE_DIR@ @CMAKE_CURRENT_BINARY_DIR@/ambdbusmappings.idl
+FILE_PATTERNS = *.fidl
+EXTENSION_MAPPING = fidl=IDL
+INPUT = @CMAKE_CURRENT_SOURCE_DIR@/amb.fidl @CMAKE_CURRENT_BINARY_DIR@/ambdbusmappings.idl
+
diff --git a/docs/Doxyfile.mainpage.in b/docs/Doxyfile.mainpage.in
new file mode 100644
index 00000000..bb8e6882
--- /dev/null
+++ b/docs/Doxyfile.mainpage.in
@@ -0,0 +1,4 @@
+PROJECT_NAME = @PROJECT_NAME@
+PROJECT_NUMBER = @PROJECT_VERSION@
+INPUT = @CMAKE_SOURCE_DIR@/docs/mainpage.idl
+IMAGE_PATH = @CMAKE_SOURCE_DIR@/docs/images
diff --git a/docs/amb.in.fidl b/docs/amb.in.fidl
index 240414e4..d0381900 100644
--- a/docs/amb.in.fidl
+++ b/docs/amb.in.fidl
@@ -1,9 +1,88 @@
-/*! amb.fidl
+/*!
+* \mainpage Automotive Message Broker DBus API Documentation
+*
+* \section intro Introduction
+* AMB organizes the API into two general interface categories. First the Manager interface (see manager.txt)
+* which includes tools for using the other interfaces. Second is a number of interfaces that
+* represent vehicle data. The latter follows the schema of "org.automotive.DataType" and are
+* contained in verious DBus paths. The DBus paths are generally organized by
+* /{source}/{zone}/DataType. "source" refers to the AMB source that produces the data. "zone"
+* refers to the zone in which the data type is located in the vehicle or "0" for no zone.
+*
+* 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. 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
+*
+* It is recommended that the Manager interface be used to find the DBus Object that contains the
+* data type you need. This is done through the FindObject() call. It is expected that DBus
+* Object Paths may change and so it is not appropriate to hard code DBus Object Paths.
+*
+* Here is a pseudo-code example of how the api is to be used:
+*
+* \code
+* var manager = dbus.interface("org.automotive.Manager", "/");
+*
+* var speedObjectPaths = manager.FindObject("VehicleSpeed");
+*
+* var speedObject = dbus.interface("org.automotive.VehicleSpeed", speedObjectPaths[0]);
+*
+* console.log("Vehicle Speed: " + speedObject.Speed);
+* \endcode
+* \section automotive_manager Automotive Manager
+* Manager is a helper interface for discovering and finding available objects. Manager also helps users look up objects by zone and get additional information about a data type (ieorg.automotive.Manager.ZonesForObjectName).
+* \section zones Zones
+*
+* 'Zone' describes the position in the vehicle where the object is located. The Zone type is a bitfield of values that can be combined to describe a specific location. For example
+*
+* \code
+* Zone.Front | Zone.Left
+* \endcode
+*
+* (which is '9') may represent the driver position.
+*
+* \code
+* enumeration Zone {
+* None = 0,
+* Front = 1,
+* Middle = 1 << 1,
+* Right = 1 << 2,
+* Left = 1 << 3,
+* Rear = 1 << 4,
+* Center = 1 << 5
+* }
+* \endcode
+*
+* \section vehicle_property_type Vehicle Property Type
+* Vehicle Property Type is the common interface which all Data types are derived. This interface is as follows:
+*
+* \code
+* interface VehiclePropertyType {
+* attribute Double Time readonly
+* attribute Zone Zone readonly
+* method GetHistory(Double beginTime, Double endTime) {
+* out{ Dictionary result}
+* }
+* }
+* \endcode
+*
+* \section data_types Data types
+*
+* The data types try to conform to the [http://w3c.github.io/automotive-bg/data_spec.html W3C Automotive Business Group Vehicle Data Specification] as much as possible. There are differences in the Zone type, and this vehicle API contains some additional data types that the W3C Business Group has not yet defined. 'Time' also represents relative time in seconds rather than time in ms since epoch (DOMTimeStamp). The names of the attributes are also different because of Web vs. DBus conventions. In this Vehicle API, DBus properties use CamelCase (ie Speed vs speed) vs lowerCamelCase. Units and types are the same where possible.
+*
+* Also note that many types have been marked "deprecated" and replaced with the W3C version of the type. Deprecated types should not be used in new projects.
+*
+*/
+
+/*!
+* \file amb.fidl
* \name @PROJECT_NAME@
* \version @PROJECT_VERSION@
* \brief This document describes the DBus interfaces and data types for the
* Automotive Message Broker API. The data types are intended to as-close-as-
-* possible be compatible with the W3C vehicle <a href="https://rawgit.com/w3c/automotive-bg/master/data_spec.html>data spec</a>.
+* possible be compatible with the W3C vehicle <a href="https://rawgit.com/w3c/automotive-bg/master/data_spec.html">data spec</a>.
*/
/*!
@@ -56,7 +135,7 @@ interface VehiclePropertyType {
* \arg endTime time stamp in Seconds since Unix Epoc
*/
method GetHistory(Double beginTime, Double endTime) {
- out{ Dictionary result}
+ out{ Dictionary result}
}
}
@@ -80,7 +159,7 @@ interface org.automotive.Manager {
* \brief return supported properties
*/
method List {
- out {array of String objectNames}
+ out {array of String objectNames}
}
/*!
@@ -96,12 +175,12 @@ interface org.automotive.Manager {
* \return list of object paths that provide the given object Name.
*/
method FindObject {
- in {
- String objectName
- }
- out {
- array of String objectPaths
- }
+ in {
+ String objectName
+ }
+ out {
+ array of String objectPaths
+ }
}
/*!
@@ -110,19 +189,19 @@ interface org.automotive.Manager {
* except that it takes an addition zone argument and only return the path for that zone.
* \arg String property is the requested property to be retrieved.
* \arg Zone zone is the zone which the object
- * \return string representing the DBus Object path.
+ * \return string representing the DBus Object path.
* Possible errors:
* "org.automotive.Manager.InvalidZone"
* "org.automotive.Manager.ObjectNotFound"
*/
method FindObjectForZone {
- in {
- String objectName
- Zone zone
- }
- out {
- String objectPath
- }
+ in {
+ String objectName
+ Zone zone
+ }
+ out {
+ String objectPath
+ }
}
/*!
@@ -132,12 +211,12 @@ interface org.automotive.Manager {
* \return list of zones for the given objectName (@see Zone)
*/
method ZonesForObjectName {
- in {
- String objectName
- }
- out {
- array of UInt32 zones
- }
+ in {
+ String objectName
+ }
+ out {
+ array of UInt32 zones
+ }
}
/*!
@@ -147,12 +226,12 @@ interface org.automotive.Manager {
* \return true if Property exists
*/
method SupportsProperty {
- in {
- String propertyName
- }
- out {
- Boolean supported
- }
+ in {
+ String propertyName
+ }
+ out {
+ Boolean supported
+ }
}
}
@@ -404,7 +483,7 @@ interface org.automotive.InteriorLightStatus extends VehiclePropertyType {
/*! Status
* \brief MUST return interior light status for the zone. on = true, off = false
*/
- attribute Boolean Status
+ attribute Boolean Status
}
@@ -772,10 +851,10 @@ interface org.automotive.Sunroof extends VehiclePropertyType {
enumeration ConvertibleRoofStatus {
- closed = "closed",
- closing = "closing",
- opening = "opening",
- opened = "opened"
+ closed = "closed",
+ closing = "closing",
+ opening = "opening",
+ opened = "opened"
}
interface org.automotive.ConvertibleRoof extends VehiclePropertyType {
@@ -1264,7 +1343,7 @@ interface org.automotive.SeatPosition extends VehiclePropertyType {
*/
attribute UInt16 Recline readonly
- /*!
+ /*!
* \brief MUST return
*/
attribute UInt16 Slide readonly
@@ -1399,14 +1478,14 @@ interface org.automotive.WheelTick extends VehiclePropertyType {
interface IgnitionTime : VehicleCommonDataType {
/*!
- * \brief MUST return time at ignition on
- */
- attribute UInt64 ignitionOnTime readonly
+ * \brief MUST return time at ignition on
+ */
+ attribute UInt64 ignitionOnTime readonly
- /*!
- * \brief MUST return time at ignition off
- */
- attribute UInt64 ignitionOffTime readonly
+ /*!
+ * \brief MUST return time at ignition off
+ */
+ attribute UInt64 ignitionOffTime readonly
}
interface org.automotive.YawRate extends VehiclePropertyType {
@@ -1426,38 +1505,38 @@ interface org.automotive.BrakeOperation extends VehiclePropertyType {
}
enumeration Button {
- home = "home",
- back = "back",
- search = "search",
- call = "call",
- end_call = "end_call",
- media_play = "media_play",
- media_next = "media_next",
- media_previous = "media_previous",
- media_pause = "media_pause",
- voice_recognize = "voice_recognize",
- enter = "enter",
- left = "left",
- right = "right",
- up = "up",
- down = "down"
+ home = "home",
+ back = "back",
+ search = "search",
+ call = "call",
+ end_call = "end_call",
+ media_play = "media_play",
+ media_next = "media_next",
+ media_previous = "media_previous",
+ media_pause = "media_pause",
+ voice_recognize = "voice_recognize",
+ enter = "enter",
+ left = "left",
+ right = "right",
+ up = "up",
+ down = "down"
}
enumeration ButtonEventType {
- press = "press",
- long_press = "long_press",
- release = "release"
+ press = "press",
+ long_press = "long_press",
+ release = "release"
}
interface VehicleButton {
- /*!
- * \brief MUST return the button corresponding to the event.
- */
+ /*!
+ * \brief MUST return the button corresponding to the event.
+ */
attribute Button button readonly
- /*!
- * \brief MUST return the type of event
- */
+ /*!
+ * \brief MUST return the type of event
+ */
attribute ButtonEventType state readonly
}
@@ -1542,23 +1621,23 @@ interface org.automotive.Diagnostic extends VehiclePropertyType {
attribute UInt32 AccumulatedEngineRuntime readonly
/*!
- * \brief MUST return distance travelled since the codes were last cleared (Unit: meters)
- */
+ * \brief MUST return distance travelled since the codes were last cleared (Unit: meters)
+ */
attribute UInt32 DistanceSinceCodeCleared readonly
/*!
- * \brief MUST return distance travelled with the malfunction indicator light on (Unit: meters)
- */
+ * \brief MUST return distance travelled with the malfunction indicator light on (Unit: meters)
+ */
attribute UInt32 DistanceWithMILOn readonly
/*!
- * \brief MUST return time elapsed with the malfunction indicator light on (Unit: seconds)
- */
+ * \brief MUST return time elapsed with the malfunction indicator light on (Unit: seconds)
+ */
attribute UInt32 TimeRunMILOn readonly
/*!
- * \brief MUST return time elapsed since the trouble codes were last cleared (Unit: seconds)
- */
+ * \brief MUST return time elapsed since the trouble codes were last cleared (Unit: seconds)
+ */
attribute UInt32 TimeTroubleCodeClear readonly
}
@@ -1720,9 +1799,9 @@ interface org.automotive.AtmosphericPressure extends VehiclePropertyType {
}
enumeration LaneDepartureStatus {
- off = "off",
- pause = "pause",
- running = "running"
+ off = "off",
+ pause = "pause",
+ running = "running"
}
interface org.automotive.LaneDepartureDetection extends VehiclePropertyType {
@@ -1733,10 +1812,10 @@ interface org.automotive.LaneDepartureDetection extends VehiclePropertyType {
}
enumeration AlarmStatus {
- disarmed = "disarmed",
- prearmed = "prearmed",
- armed = "armed",
- alarmed = "alarmed"
+ disarmed = "disarmed",
+ prearmed = "prearmed",
+ armed = "armed",
+ alarmed = "alarmed"
}
interface org.automotive.Alarm extends VehiclePropertyType {
@@ -1747,9 +1826,9 @@ interface org.automotive.Alarm extends VehiclePropertyType {
}
enumeration ParkingBrakeStatus {
- inactive = "inactive",
- active = "active",
- error = "error"
+ inactive = "inactive",
+ active = "active",
+ error = "error"
}
interface org.automotive.ParkingBrake extends VehiclePropertyType {
diff --git a/docs/dbus.idl b/docs/dbus.idl
deleted file mode 100644
index 519ef9f1..00000000
--- a/docs/dbus.idl
+++ /dev/null
@@ -1,35 +0,0 @@
-/*!
-* \mainpage Automotive Message Broker DBus API Documentation
-*
-* \section intro Introduction
-* AMB organizes the API into two general interface categories. First the Manager interface (see manager.txt)
-* which includes tools for using the other interfaces. Second is a number of interfaces that
-* represent vehicle data. The latter follows the schema of "org.automotive.DataType" and are
-* contained in verious DBus paths. The DBus paths are generally organized by
-* /{source}/{zone}/DataType. "source" refers to the AMB source that produces the data. "zone"
-* refers to the zone in which the data type is located in the vehicle or "0" for no zone.
-*
-* 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. 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
-*
-* It is recommended that the Manager interface be used to find the DBus Object that contains the
-* data type you need. This is done through the FindObject() call. It is expected that DBus
-* Object Paths may change and so it is not appropriate to hard code DBus Object Paths.
-*
-* \section example Usage Example
-* Here is a pseudo-code example of how the api is to be used:
-*
-* \code
-* var manager = dbus.interface("org.automotive.Manager", "/");
-*
-* var speedObjectPaths = manager.FindObject("VehicleSpeed");
-*
-* var speedObject = dbus.interface("org.automotive.VehicleSpeed", speedObjectPaths[0]);
-*
-* console.log("Vehicle Speed: " + speedObject.Speed);
-* \endcode
-*/
diff --git a/docs/images/AMBArchitecture.png b/docs/images/AMBArchitecture.png
new file mode 100644
index 00000000..69a9a077
--- /dev/null
+++ b/docs/images/AMBArchitecture.png
Binary files differ
diff --git a/docs/mainpage.in.idl b/docs/mainpage.in.idl
new file mode 100644
index 00000000..0e29a6f1
--- /dev/null
+++ b/docs/mainpage.in.idl
@@ -0,0 +1,14 @@
+/*!
+* \mainpage Automotive Message Broker Documentation
+* \version @PROJECT_VERSION@
+* \section links AMB Documentation Sections
+* - <a href="../dbus/html/index.html">DBus API documentation</a>
+* - <a href="../amb/html/index.html">libamb internal API documentation</a>
+* - <a href="../plugins/bluemonkey/html/index.html">Bluemonkey Javascript API documentation</a>
+*
+* \section intro Introduction
+* Automotive Message Broker (AMB) is a framework for providing applications with standardized access to vehicle data.
+* It uses a plugin architecture to allow customization for different vehicles and devices. Here is a diagram of how
+* AMB is architected:
+* \image html AMBArchitecture.png
+*/
diff --git a/docs/plugins/bluemonkey/bluemonkey.idl b/docs/plugins/bluemonkey/bluemonkey.idl
new file mode 100644
index 00000000..2029c3c3
--- /dev/null
+++ b/docs/plugins/bluemonkey/bluemonkey.idl
@@ -0,0 +1,156 @@
+/*!
+ * \mainpage Automotive Message Broker Library Documentation - Bluemonkey Plugin
+ * \version 0.12.903
+ * \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);
+ * });
+ * testTimer.start();
+ * \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 automotive-message-broker Bluemonkey interface documentation
+ * \version 0.12.903
+ * \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
+ */
+
+/*!
+ * \brief Entry point for bluemonkey
+ */
+partial interface Navigator {
+ readonly attribute Bluemonkey bluemonkey;
+};
+
+/*!
+ * \brief Bluemonkey interface
+ * Bluemonkey provides AMB plugin-like interfaces and allows the loading of other modules, timers, and QObject creation.
+ * Typical usage is such:
+ * \code
+ * var speedProperty = bluemonkey.subscribeTo("VehicleSpeed");
+ * bluemonkey.log("Current speed: " + speedProperty.value);
+ * \endcode
+ */
+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/lib/asyncqueue.hpp b/lib/asyncqueue.hpp
index 3602bb97..ed0c69b4 100644
--- a/lib/asyncqueue.hpp
+++ b/lib/asyncqueue.hpp
@@ -62,6 +62,9 @@ public:
}
}
+ if(!mQueue.size())
+ throw std::runtime_error("nothing in queue");
+
auto itr = mQueue.begin();
T item = *itr;
@@ -73,9 +76,11 @@ public:
virtual void append(T item)
{
- std::lock_guard<std::mutex> lock(mutex);
+ {
+ std::lock_guard<std::mutex> lock(mutex);
- mQueue.insert(item);
+ mQueue.insert(item);
+ }
if(mBlocking)
{
diff --git a/packaging.in/CMakeLists.txt b/packaging.in/CMakeLists.txt
new file mode 100644
index 00000000..5276ca80
--- /dev/null
+++ b/packaging.in/CMakeLists.txt
@@ -0,0 +1,18 @@
+
+find_program(rpmbuild rpmbuild /usr/bin)
+if(rpmbuild)
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/automotive-message-broker.spec.in ${CMAKE_SOURCE_DIR}/packaging/automotive-message-broker.spec @ONLY)
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.tizen.in ${CMAKE_SOURCE_DIR}/packaging/config.tizen @ONLY)
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/automotive-message-broker.changes.in ${CMAKE_SOURCE_DIR}/packaging/automotive-message-broker.changes @ONLY)
+endif(rpmbuild)
+
+find_program(debuild debuild /usr/bin)
+if(debuild)
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/debian/control.debian.in ${CMAKE_SOURCE_DIR}/debian/control @ONLY)
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/debian/libamb.debian.install ${CMAKE_SOURCE_DIR}/debian/libamb.install @ONLY)
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/debian/libamb-dev.debian.install ${CMAKE_SOURCE_DIR}/debian/libamb-dev.install @ONLY)
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/debian/automotive-message-broker.debian.install ${CMAKE_SOURCE_DIR}/debian/automotive-message-broker.install @ONLY)
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/debian/automotive-message-broker-plugins.debian.install ${CMAKE_SOURCE_DIR}/debian/automotive-message-broker-plugins.install @ONLY)
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/debian/changelog ${CMAKE_SOURCE_DIR}/debian/changelog @ONLY)
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/debian/rules ${CMAKE_SOURCE_DIR}/debian/rules @ONLY)
+endif(debuild)
diff --git a/packaging/automotive-message-broker.changes b/packaging.in/automotive-message-broker.changes.in
index 7f07f346..7f07f346 100644
--- a/packaging/automotive-message-broker.changes
+++ b/packaging.in/automotive-message-broker.changes.in
diff --git a/packaging/automotive-message-broker.spec.in b/packaging.in/automotive-message-broker.spec.in
index 56266491..1ad1cf76 100644
--- a/packaging/automotive-message-broker.spec.in
+++ b/packaging.in/automotive-message-broker.spec.in
@@ -12,9 +12,10 @@ Requires: automotive-message-broker-plugins
Requires: automotive-message-broker-plugins-murphy
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
-
-Requires: default-ac-domains
-Requires: dbus-python
+Requires: default-ac-domains
+Requires: dbus-python
+Requires: python-curses
+Requires: python-gobject
BuildRequires: cmake
BuildRequires: boost-devel
BuildRequires: pkgconfig(json)
@@ -218,24 +219,24 @@ Crosswalk vehicle API extension based on the W3C Automotive Business Group Vehic
%build
%cmake \
- -Dxwalk_vehicle_extension=ON \
- -DXWALK_EXTENSION_PATH=/tizen-extensions-crosswalk \
+ -Dxwalk_vehicle_extension=ON \
+ -DXWALK_EXTENSION_PATH=/tizen-extensions-crosswalk \
%if %{with qt5}
- -Dqtmainloop=ON \
- -Dopencvlux_plugin=ON \
- -Dwebsocket_plugin=ON \
- -Dbluetooth_plugin=ON \
- -Dbluemonkey_plugin=ON \
+ -Dqtmainloop=ON \
+ -Dopencvlux_plugin=ON \
+ -Dwebsocket_plugin=ON \
+ -Dbluetooth_plugin=ON \
+ -Dbluemonkey_plugin=ON \
%endif
- -Ddatabase_plugin=ON \
- -Dmurphy_plugin=ON \
- -Dobd2_plugin=ON \
- -Dtest_plugin=ON \
- -Dgpsnmea_plugin=ON \
- -Dcangen_plugin=ON \
- -Dcansim_plugin=ON \
- -Dusebluez5=ON \
- -Denable_docs=ON
+ -Ddatabase_plugin=ON \
+ -Dmurphy_plugin=ON \
+ -Dobd2_plugin=ON \
+ -Dtest_plugin=ON \
+ -Dgpsnmea_plugin=ON \
+ -Dcangen_plugin=ON \
+ -Dcansim_plugin=ON \
+ -Dusebluez5=ON \
+ -Denable_docs=ON
%__make %{?jobs:-j%jobs}
@@ -249,7 +250,7 @@ cp packaging.in/ambd.service.systemd.tizen %{buildroot}%{_unitdir}/ambd.service
ln -s ../ambd.service %{buildroot}%{_unitdir}/network.target.wants/ambd.service
%install_service multi-user.target.wants ambd.service
-cp packaging.in/config.tizen %{buildroot}%{_sysconfdir}/ambd/
+cp packaging/config.tizen %{buildroot}%{_sysconfdir}/ambd/
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
diff --git a/packaging.in/debian/automotive-message-broker-plugins.debian.install b/packaging.in/debian/automotive-message-broker-plugins.debian.install
new file mode 100644
index 00000000..3253b6b3
--- /dev/null
+++ b/packaging.in/debian/automotive-message-broker-plugins.debian.install
@@ -0,0 +1,5 @@
+debian/tmp/@PLUGIN_INSTALL_PATH@/examplesourceplugin.so
+debian/tmp/@PLUGIN_INSTALL_PATH@/examplesinkplugin.so
+debian/tmp/@PLUGIN_INSTALL_PATH@/dbussinkplugin.so
+debian/tmp/@PLUGIN_INSTALL_PATH@/demosinkplugin.so
+debian/tmp/etc/dbus-1/system.d/amb.conf
diff --git a/packaging.in/debian/automotive-message-broker.debian.install b/packaging.in/debian/automotive-message-broker.debian.install
new file mode 100644
index 00000000..99738b44
--- /dev/null
+++ b/packaging.in/debian/automotive-message-broker.debian.install
@@ -0,0 +1,3 @@
+debian/tmp/usr/bin/ambd
+debian/tmp/usr/bin/ambctl
+debian/tmp/etc/ambd/config
diff --git a/packaging.in/debian/changelog b/packaging.in/debian/changelog
new file mode 100644
index 00000000..365f092a
--- /dev/null
+++ b/packaging.in/debian/changelog
@@ -0,0 +1,5 @@
+automotive-message-broker (@PROJECT_VERSION@) utopic; urgency=low
+
+ * @PROJECT_VERSION@ release
+
+ -- Kevron Rees <tripzero.kev@gmail.com> Tue, 30 Dec 2014 15:17:51 -0700
diff --git a/packaging.in/debian/control.debian.in b/packaging.in/debian/control.debian.in
new file mode 100644
index 00000000..6a2c5df4
--- /dev/null
+++ b/packaging.in/debian/control.debian.in
@@ -0,0 +1,41 @@
+Source: automotive-message-broker
+Section: Utilities
+Priority: extra
+Maintainer: Kevron Rees <tripzero.kev@gmail.com>
+Build-Depends: build-essential, debhelper (>= 8.0.0), cdbs, pkg-config, libltdl-dev, cmake, libboost-dev, uuid-dev, libjson-c-dev, libglib2.0-dev
+Standards-Version: 3.9.2
+Homepage: https://01.org/automotive-message-broker
+Vcs-Git: git@github.com:otcshare/automotive-message-broker.git
+Vcs-Browser: http://github.com/otcshare/automotive-message-broker.git
+
+Package: libamb
+Architecture: i386
+Version: @PROJECT_VERSION@
+Depends: ${shlibs:Depends}, ${misc:Despends}
+Description: Supporting amb library
+
+Package: libamb-dev
+Section: devel
+Architecture: i386
+Version: @PROJECT_VERSION@
+Depends: libamb, uuid-dev, libjson-c-dev
+Description: Vehicle data abstraction and multiplexing daemon
+ Vehicle data abstraction and multiplexing plugin framework
+ which provides a communications interface to CAN, OBDII and GPS devices using
+ TCP, bluetooth or USB
+
+Package: automotive-message-broker
+Architecture: i386
+Version: @PROJECT_VERSION@
+Depends: ${shlibs:Depends}, ${misc:Depends}, libamb
+Description: Vehicle data abstraction and multiplexing daemon
+ Vehicle data abstraction and multiplexing daemon implemented as
+ plugin framework that communicates to OBDII and GPS devices
+
+Package: automotive-message-broker-plugins
+Architecture: i386
+Version: @PROJECT_VERSION@
+Depends: ${shlibs:Depends}, ${misc:Depends}, libamb
+Description: Vehicle data abstraction and multiplexing daemon
+ Vehicle data abstraction and multiplexing daemon implemented as
+ plugin framework that communicates to OBDII and GPS devices
diff --git a/packaging.in/debian/libamb-dev.debian.install b/packaging.in/debian/libamb-dev.debian.install
new file mode 100644
index 00000000..455bf20a
--- /dev/null
+++ b/packaging.in/debian/libamb-dev.debian.install
@@ -0,0 +1,3 @@
+debian/tmp/@INCLUDE_INSTALL_DIR@/amb/*.h
+debian/tmp/@INCLUDE_INSTALL_DIR@/amb/*.hpp
+debian/tmp/@LIB_INSTALL_DIR@/pkgconfig/*.pc
diff --git a/packaging.in/debian/libamb.debian.install b/packaging.in/debian/libamb.debian.install
new file mode 100644
index 00000000..53f200d8
--- /dev/null
+++ b/packaging.in/debian/libamb.debian.install
@@ -0,0 +1 @@
+debian/tmp/@LIB_INSTALL_DIR@/libamb.so*
diff --git a/packaging.in/debian/rules b/packaging.in/debian/rules
new file mode 100755
index 00000000..b5f12a4a
--- /dev/null
+++ b/packaging.in/debian/rules
@@ -0,0 +1,19 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+export DH_VERBOSE=1
+
+# in template file --AC
+#%:
+# dh $@
+
+#all the rest copied from trip0's libobd debian/rules file --AC
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/cmake.mk
+
diff --git a/packaging/CMakeLists.txt b/packaging/CMakeLists.txt
deleted file mode 100644
index 8a4b84c7..00000000
--- a/packaging/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-configure_file (${CMAKE_CURRENT_SOURCE_DIR}/automotive-message-broker.spec.in ${CMAKE_SOURCE_DIR}/packaging/automotive-message-broker.spec @ONLY)
-configure_file (${CMAKE_SOURCE_DIR}/packaging.in/config.tizen.in ${CMAKE_SOURCE_DIR}/packaging/config.tizen @ONLY)
diff --git a/plugins/bluemonkey/CMakeLists.txt b/plugins/bluemonkey/CMakeLists.txt
index 797ce476..bde4e189 100644
--- a/plugins/bluemonkey/CMakeLists.txt
+++ b/plugins/bluemonkey/CMakeLists.txt
@@ -66,7 +66,7 @@ if(enable_docs)
find_package(Doxygen)
if(DOXYGEN_FOUND)
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}
+ add_custom_target(bluemonkey_docs ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating Bluemonkey javascript API documentation with Doxygen" VERBATIM)
#generate mappings documentation
@@ -75,8 +75,7 @@ if(enable_docs)
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)
+ install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION ${DOC_INSTALL_DIR}/plugins/bluemonkey COMPONENT Docs)
endif(DOXYGEN_FOUND)
endif(enable_docs)
diff --git a/plugins/bluemonkey/Doxyfile.in b/plugins/bluemonkey/Doxyfile.in
index 2a9ada12..ee0e2735 100644
--- a/plugins/bluemonkey/Doxyfile.in
+++ b/plugins/bluemonkey/Doxyfile.in
@@ -1,3 +1,4 @@
PROJECT_NAME = @PROJECT_NAME@
PROJECT_NUMBER = @PROJECT_VERSION@
+GENERATE_LATEX = NO
INPUT = @CMAKE_CURRENT_BINARY_DIR@/docs/
diff --git a/plugins/bluemonkey/bluemonkey.in.idl b/plugins/bluemonkey/bluemonkey.in.idl
index 4cef21f2..5d3b5a79 100644
--- a/plugins/bluemonkey/bluemonkey.in.idl
+++ b/plugins/bluemonkey/bluemonkey.in.idl
@@ -4,6 +4,7 @@
* \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
@@ -20,12 +21,14 @@
* //VehicleSpeed
* speedProperty.value = Math.floor((Math.random() * 100) + 1);
* });
+ * testTimer.start();
* \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.
*/
/*!
+ * \file bluemonkey.idl
* \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
@@ -33,11 +36,22 @@
* \see Qt's QMetaObject system for additional details
*/
-
+/*!
+ * \brief Entry point for bluemonkey
+ */
partial interface Navigator {
readonly attribute Bluemonkey bluemonkey;
};
+/*!
+ * \brief Bluemonkey interface
+ * Bluemonkey provides AMB plugin-like interfaces and allows the loading of other modules, timers, and QObject creation.
+ * Typical usage is such:
+ * \code
+ * var speedProperty = bluemonkey.subscribeTo("VehicleSpeed");
+ * bluemonkey.log("Current speed: " + speedProperty.value);
+ * \endcode
+ */
interface Bluemonkey {
/*!
* \brief subscribe to a property
@@ -76,12 +90,12 @@ interface Bluemonkey {
void log(DOMString text);
/*!
- * \brief
+ * \brief create a QTimer
*/
QTimer createTimer();
/*!
- * \brief
+ * \brief create a QObject
*/
QObject createQObject();
@@ -91,7 +105,7 @@ interface Bluemonkey {
void getHistory(DOMString[] properties, Date begin, Date end, HistoryCallback callback);
/*!
- * \brief
+ * \brief creates a custom property
*/
void createCustomProperty(DOMString name, any value, optional unsigned short zone);
@@ -99,41 +113,45 @@ interface Bluemonkey {
interface PropertyInterface {
/*!
- * \brief
+ * \brief type AMB property name
*/
readonly attribute DOMString type;
/*!
- * \brief
+ * \brief zone in the vehicle where this property is located
*/
readonly attribute unsigned short zone;
/*!
- * \brief
+ * \brief value of the property
*/
readonly attribute any value;
/*!
- * \brief
+ * \brief source plugin UUID for this property
*/
readonly attribute DOMString source;
/*!
- * \brief
+ * \brief timestamp when this property last changed
*/
readonly attribute DOMTimestamp timestamp;
/*!
- * \brief
+ * \brief changed signal
*/
readonly attribute Signal changed;
void getHistory(Date begin, Date end, HistoryCallback callback);
};
+/*!
+* \brief Signal represents an way to connect to Qt signals and get a javascript callback
+*/
interface Signal {
/*!
- * \brief
+ * \brief connect to this signal.
+ * callback will be called whenever the signal is emitted.
*/
void connect(ChangedCallback callback)
};
diff --git a/plugins/database/databasesink.cpp b/plugins/database/databasesink.cpp
index 9bfe5b25..b2a3ba9b 100644
--- a/plugins/database/databasesink.cpp
+++ b/plugins/database/databasesink.cpp
@@ -22,7 +22,7 @@ static void * cbFunc(Shared* shared)
{
if(!shared)
{
- throw std::runtime_error("Could not cast shared object.");
+ throw std::runtime_error("Could not get shared object.");
}
///new tripID:
@@ -61,7 +61,7 @@ static void * cbFunc(Shared* shared)
insertList.push_back(dict);
- if(insertList.size() > bufferLength)
+ if(insertList.size() >= bufferLength)
{
shared->db->exec("BEGIN IMMEDIATE TRANSACTION");
for(int i=0; i< insertList.size(); i++)
@@ -175,6 +175,7 @@ DatabaseSink::DatabaseSink(AbstractRoutingEngine *engine, map<std::string, std::
if(config.find("startOnLoad")!= config.end())
{
+ DebugOut() << "start on load? " << config["startOnLoad"] << endl;
databaseLogging->setValue(config["startOnLoad"] == "true");
}
@@ -247,6 +248,8 @@ void DatabaseSink::parseConfig()
void DatabaseSink::stopDb()
{
+ databaseLogging->setValue(false);
+
if(!shared)
return;
@@ -259,19 +262,21 @@ void DatabaseSink::stopDb()
delete shared;
shared = NULL;
+
+ routingEngine->updateProperty(databaseLogging.get(), source.uuid());
}
void DatabaseSink::startDb()
{
if(playback->value<bool>())
{
- DebugOut(0)<<"ERROR: tried to start logging during playback. Only logging or playback can be used at one time"<<endl;
+ DebugOut(DebugOut::Error)<<"ERROR: tried to start logging during playback. Only logging or playback can be used at one time"<<endl;
return;
}
if(shared)
{
- DebugOut(0)<<"WARNING: logging already started. doing nothing."<<endl;
+ DebugOut(DebugOut::Warning)<<"WARNING: logging already started. doing nothing."<<endl;
return;
}
@@ -281,6 +286,9 @@ void DatabaseSink::startDb()
thread->detach();
thread = amb::make_unique(new std::thread(cbFunc, shared));
+
+ databaseLogging->setValue(true);
+ routingEngine->updateProperty(databaseLogging.get(), source.uuid());
}
void DatabaseSink::startPlayback()
@@ -296,9 +304,7 @@ void DatabaseSink::startPlayback()
vector<vector<string> > results = shared->db->select("SELECT * FROM "+tablename);
- /// we are done with shared. clean up:
- delete shared;
- shared = NULL;
+ stopDb();
if(playbackShared)
{
@@ -339,6 +345,9 @@ void DatabaseSink::initDb()
void DatabaseSink::setDatabaseFileName(string filename)
{
+ bool isLogging = databaseLogging->value<bool>();
+
+ stopDb();
initDb();
vector<vector<string> > supportedStr = shared->db->select("SELECT DISTINCT key, zone, source FROM " + tablename);
@@ -360,8 +369,11 @@ void DatabaseSink::setDatabaseFileName(string filename)
}
}
- delete shared;
- shared = NULL;
+ if(isLogging)
+ {
+ stopDb();
+ startDb();
+ }
routingEngine->updateSupported(supported(), PropertyList(), &source);
}
@@ -404,6 +416,8 @@ void DatabaseSink::init()
setDatabaseFileName(configuration["databaseFile"]);
}
+ DebugOut() << "databaseLogging: " << databaseLogging->value<bool>() << endl;
+
routingEngine->updateSupported(supported(), PropertyList(), &source);
}
@@ -487,13 +501,13 @@ void DatabaseSink::getRangePropertyAsync(AsyncRangePropertyReply *reply)
delete db;
}
-AsyncPropertyReply *DatabaseSink::setProperty(AsyncSetPropertyRequest request)
+AsyncPropertyReply *DatabaseSink::setProperty(const AsyncSetPropertyRequest &request)
{
AsyncPropertyReply* reply = AmbPluginImpl::setProperty(request);
if(request.property == DatabaseLogging)
{
- if(request.value->value<bool>())
+ if(databaseLogging->value<bool>())
{
startDb();
}
@@ -508,7 +522,7 @@ AsyncPropertyReply *DatabaseSink::setProperty(AsyncSetPropertyRequest request)
}
else if( request.property == DatabasePlayback)
{
- if(request.value->value<bool>())
+ if(playback->value<bool>())
{
startPlayback();
}
diff --git a/plugins/database/databasesink.h b/plugins/database/databasesink.h
index 2e9709d9..8976f416 100644
--- a/plugins/database/databasesink.h
+++ b/plugins/database/databasesink.h
@@ -151,7 +151,7 @@ public:
///source role:
virtual void getRangePropertyAsync(AsyncRangePropertyReply *reply);
- virtual AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
+ virtual AsyncPropertyReply * setProperty(const AsyncSetPropertyRequest & request);
virtual void subscribeToPropertyChanges(VehicleProperty::Property property);
virtual void unsubscribeToPropertyChanges(VehicleProperty::Property property);
int supportedOperations() const { return AbstractSource::GetRanged | AbstractSource::Get | AbstractSource::Set;}
diff --git a/plugins/dbus/abstractdbusinterface.cpp b/plugins/dbus/abstractdbusinterface.cpp
index 9933be38..f4c575c1 100644
--- a/plugins/dbus/abstractdbusinterface.cpp
+++ b/plugins/dbus/abstractdbusinterface.cpp
@@ -55,7 +55,7 @@ const uint getPid(const char *owner)
if(error)
{
- throw std::runtime_error(error->message);
+ DebugOut(DebugOut::Error)<< error->message << endl;
}
uint thePid=0;
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 32f49b9f..2d1e6029 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -1,4 +1,4 @@
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/genmapping.py ${CMAKE_CURRENT_SOURCE_DIR}/genmapping @ONLY)
-configure_file (${CMAKE_CURRENT_SOURCE_DIR}/ambctl.py ${CMAKE_CURRENT_SOURCE_DIR}/ambctl @ONLY)
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/ambctl.py ${CMAKE_CURRENT_BINARY_DIR}/ambctl @ONLY)
-install (PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/ambctl DESTINATION bin)
+install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/ambctl DESTINATION bin)
diff --git a/tools/ambctl.py b/tools/ambctl.py
index ad95324f..3d79a7fe 100644
--- a/tools/ambctl.py
+++ b/tools/ambctl.py
@@ -104,6 +104,8 @@ def processCommand(command, commandArgs, noMain=True):
object = managerInterface.FindObjectForZone(objectName, zone)
propertiesInterface = dbus.Interface(bus.get_object("org.automotive.message.broker", object),"org.freedesktop.DBus.Properties")
property = propertiesInterface.Get("org.automotive."+objectName, propertyName)
+ if property.__class__ == dbus.Boolean:
+ value = value.lower() == "true"
realValue = property.__class__(value)
propertiesInterface.Set("org.automotive."+objectName, propertyName, realValue)
property = propertiesInterface.Get("org.automotive."+objectName, propertyName)
@@ -140,7 +142,7 @@ def processCommand(command, commandArgs, noMain=True):
-parser = argparse.ArgumentParser(description='Process DBus mappings.', add_help=False)
+parser = argparse.ArgumentParser(prog="ambctl", description='Process DBus mappings.', add_help=False)
parser.add_argument('command', metavar='COMMAND [help]', nargs='?', default='stdin', help='amb dbus command')
parser.add_argument('commandArgs', metavar='ARG', nargs='*',
help='amb dbus command arguments')
@@ -298,7 +300,9 @@ if args.command == "stdin":
print ""
words = data.line.split(' ')
if words[0] == "quit":
- sys.exit()
+ termios.tcsetattr(fd, termios.TCSAFLUSH, old)
+ fcntl.fcntl(fd, fcntl.F_SETFL, oldflags)
+ sys.exit()
try:
if len(words) > 1:
processCommand(words[0], words[1:])
diff --git a/tools/ambctl.py.orig b/tools/ambctl.py.orig
deleted file mode 100644
index caa754d1..00000000
--- a/tools/ambctl.py.orig
+++ /dev/null
@@ -1,365 +0,0 @@
-#!/usr/bin/python
-
-import argparse
-import dbus
-import sys
-import json
-import gobject
-import fileinput
-import termios, fcntl, os
-import glib
-import curses.ascii
-from dbus.mainloop.glib import DBusGMainLoop
-
-class bcolors:
- HEADER = '\x1b[95m'
- OKBLUE = '\x1b[94m'
- OKGREEN = '\x1b[92m'
- WARNING = '\x1b[93m'
- FAIL = '\x1b[91m'
- ENDC = '\x1b[0m'
- GREEN = '\x1b[32m'
- WHITE = '\x1b[37m'
- BLUE = '\x1b[34m'
-
-def help():
- help = ("Available commands:\n"
- +bcolors.HEADER+ "help" +bcolors.WHITE+ " Prints help data\n"
- +bcolors.HEADER+ "list" +bcolors.WHITE+ " List supported ObjectNames\n"
- +bcolors.HEADER+ "get" +bcolors.WHITE+ " Get properties from an ObjectName\n"
- +bcolors.HEADER+ "listen" +bcolors.WHITE+ " Listen for changes on an ObjectName\n"
- +bcolors.HEADER+ "set" +bcolors.WHITE+ " Set a property for an ObjectName\n"
- +bcolors.HEADER+ "getHistory" +bcolors.WHITE+ " Get logged data within a time range\n"
- +bcolors.HEADER+ "quit" +bcolors.WHITE+ " Exit ambctl\n")
- return help
-
-def changed(interface, properties, invalidated):
- print json.dumps(properties, indent=2)
-
-def processCommand(command, commandArgs, noMain=True):
-
- if command == 'help':
- print help()
- return 1
-
- dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
- bus = dbus.SystemBus()
- try:
- managerObject = bus.get_object("org.automotive.message.broker", "/");
- managerInterface = dbus.Interface(managerObject, "org.automotive.Manager")
- except:
- print "Error connecting to AMB. is AMB running?"
- return 1
-
- if command == "list" :
- supportedList = managerInterface.List()
- for objectName in supportedList:
- print objectName
- return 1
- elif command == "get":
- if commandArgs[0] == "help":
- print "ObjectName [ObjectName...]"
- return 1
-
- for objectName in commandArgs:
- objects = managerInterface.FindObject(objectName)
- print objectName
- for o in objects:
- propertiesInterface = dbus.Interface(bus.get_object("org.automotive.message.broker", o),"org.freedesktop.DBus.Properties")
- print json.dumps(propertiesInterface.GetAll("org.automotive."+objectName), indent=2)
- return 1
- elif command == "listen":
- if len(commandArgs) == 0:
- commandArgs = ['help']
- if commandArgs[0] == "help":
- print "ObjectName [ObjectName...]"
- return 1
- for objectName in commandArgs:
- objects = managerInterface.FindObject(objectName)
- for o in objects:
- bus.add_signal_receiver(changed,
- dbus_interface="org.freedesktop.DBus.Properties",
- signal_name="PropertiesChanged", path=o)
- if noMain != True:
- try:
- main_loop = gobject.MainLoop(None, False)
- main_loop.run()
- except KeyboardInterrupt:
- return 1
- elif command == "set":
- if len(commandArgs) == 0:
- commandArgs = ['help']
- if len(commandArgs) and commandArgs[0] == "help":
- print "ObjectName PropertyName VALUE [ZONE]"
- return 1
- if len(commandArgs) < 3:
- print "set requires more arguments (see set help)"
- return 1
- objectName = commandArgs[0]
- propertyName = commandArgs[1]
- value = commandArgs[2]
- zone = 0
- if len(commandArgs) == 4:
- zone = int(commandArgs[3])
- object = managerInterface.FindObjectForZone(objectName, zone)
- propertiesInterface = dbus.Interface(bus.get_object("org.automotive.message.broker", object),"org.freedesktop.DBus.Properties")
- property = propertiesInterface.Get("org.automotive."+objectName, propertyName)
- realValue = property.__class__(value)
- propertiesInterface.Set("org.automotive."+objectName, propertyName, realValue)
- property = propertiesInterface.Get("org.automotive."+objectName, propertyName)
- if property == realValue:
- print propertyName + " = ", property
- else:
- print "Error setting property"
- return 1
- elif command == "getHistory":
- if len(commandArgs) == 0:
- commandArgs = ['help']
- if commandArgs[0] == "help":
- print "ObjectName [ZONE] [STARTTIME] [ENDTIME] "
- return 1
- if len(commandArgs) < 1:
- print "getHistory requires more arguments (see getHistory help)"
- return 1
- objectName = commandArgs[0]
- start = 1
- if len(commandArgs) >= 3:
- start = float(commandArgs[2])
- end = 9999999999
- if len(commandArgs) >= 4:
- end = float(commandArgs[3])
- zone = 0
- if len(commandArgs) >= 2:
- zone = int(commandArgs[1])
- object = managerInterface.FindObjectForZone(objectName, zone);
- propertiesInterface = dbus.Interface(bus.get_object("org.automotive.message.broker", object),"org.automotive."+objectName)
- print json.dumps(propertiesInterface.GetHistory(start, end), indent=2)
- else:
- print "Invalid command"
- return 1
-
-
-
-parser = argparse.ArgumentParser(description='Process DBus mappings.', add_help=False)
-parser.add_argument('command', metavar='COMMAND [help]', nargs='?', default='stdin', help='amb dbus command')
-parser.add_argument('commandArgs', metavar='ARG', nargs='*',
- help='amb dbus command arguments')
-parser.add_argument('-h', '--help', help='print help', action='store_true')
-
-args = parser.parse_args()
-
-if args.help:
- parser.print_help()
- print
- print help()
- sys.exit()
-
-if args.command == "stdin":
-<<<<<<< HEAD
- class Data:
- history = []
- line = ""
- templine = ""
- promptAmbctl = "[ambctl]"
- promptEnd = "# "
- fullprompt = promptAmbctl + promptEnd
- curpos = 0
- historypos = -1
- def full_line_len(self):
- return len(self.fullprompt) + len(self.line)
- def insert(self, str):
- if self.curpos == len(self.line):
- self.line+=str
- self.curpos = len(self.line)
- else:
- self.line = self.line[:self.curpos] + str + self.line[self.curpos:]
- self.curpos+=1
- def arrow_back(self):
- if self.curpos > 0:
- self.curpos-=1
- return True
- return False
-
- def arrow_forward(self):
- if self.curpos < len(self.line):
- self.curpos+=1
- return True
- return False
-
- def back_space(self):
- if self.curpos > 0:
- self.curpos-=1
- self.line = self.line[:self.curpos] + self.line[self.curpos+1:]
- return True
- return False
- def delete(self):
- if self.curpos < len(self.line):
- self.line = self.line[:self.curpos] + self.line[self.curpos+2:]
- return True
- return False
-
- def save_temp(self):
- if len(self.history)-1 == 0 or len(self.history)-1 != self.historypos:
- return
- self.templine = self.line
-=======
- while True:
- line = input("ambctl>> ")
- if line == 'quit':
- sys.exit()
- words = line.split(' ')
- processCommand(words[0], words[1:])
-else:
- processCommand(args.command, args.commandArgs)
->>>>>>> use input instead of raw_input
-
- def push(self):
- self.history.append(self.line)
- self.historypos = len(self.history)-1
- self.clear()
-
- def set(self, str):
- self.line = str
- self.curpos = len(self.line)
-
- def history_up(self):
- if self.historypos >= 0:
- self.line = self.history[self.historypos]
- if self.historypos != 0:
- self.historypos-=1
- return True
- return False
-
- def history_down(self):
- if self.historypos >= 0 and self.historypos < len(self.history)-1:
- self.historypos+=1
- self.line = self.history[self.historypos]
-
- else:
- self.historypos = len(self.history)-1
- self.set(self.templine)
-
- return True
-
- def clear(self):
- self.set("")
- templist = ""
-
- def erase_line():
- sys.stdout.write('\x1b[2K\x1b[80D')
-
- def cursor_left():
- sys.stdout.write('\x1b[1D')
-
- def cursor_right():
- sys.stdout.write('\x1b[1C')
-
- def display_prompt():
- sys.stdout.write(bcolors.OKBLUE+Data.promptAmbctl+bcolors.WHITE+Data.promptEnd);
-
- def redraw(data):
- erase_line()
- display_prompt()
- sys.stdout.write(data.line)
- cursorpos = len(data.line) - data.curpos
- for x in xrange(cursorpos):
- cursor_left()
- sys.stdout.flush()
-
- def handle_keyboard(source, cond, data):
- str = source.read()
- #print "char: ", ord(str)
-
- if len(str) > 1:
- if ord(str[0]) == 27 and ord(str[1]) == 91 and ord(str[2]) == 68: #left arrow
- if data.arrow_back():
- cursor_left()
- sys.stdout.flush()
- elif ord(str[0]) == 27 and ord(str[1]) == 91 and ord(str[2]) == 67: #right arrow
- if data.arrow_forward():
- cursor_right()
- sys.stdout.flush()
- elif ord(str[0]) == 27 and ord(str[1]) == 91 and ord(str[2]) == 70: #end
- while data.arrow_forward():
- cursor_right()
- sys.stdout.flush()
- elif ord(str[0]) == 27 and ord(str[1]) == 91 and ord(str[2]) == 72: #home
- while data.arrow_back():
- cursor_left()
- sys.stdout.flush()
- elif len(str) == 4 and ord(str[0]) == 27 and ord(str[1]) == 91 and ord(str[2]) == 51 and ord(str[3]) == 126: #del
- data.delete()
- redraw(data)
- elif ord(str[0]) == 27 and ord(str[1]) == 91 and ord(str[2]) == 65:
- #up arrow
- data.save_temp()
- data.history_up()
- while data.arrow_forward():
- cursor_right()
- redraw(data)
- elif ord(str[0]) == 27 and ord(str[1]) == 91 and ord(str[2]) == 66:
- #down arrow
- data.history_down()
- while data.arrow_forward():
- cursor_right()
- redraw(data)
- elif ord(str) == 10: #enter
- if data.line == "":
- return True
- print ""
- words = data.line.split(' ')
- if words[0] == "quit":
- sys.exit()
- try:
- if len(words) > 1:
- processCommand(words[0], words[1:])
- else:
- processCommand(words[0], [])
- except dbus.exceptions.DBusException, error:
- print error
- except:
- print "Error running command ", sys.exc_info()[0]
- data.push();
- data.clear()
- redraw(data)
- elif ord(str) == 127: #backspace
- data.back_space()
- redraw(data)
- elif curses.ascii.isalnum(ord(str)) or ord(str) == curses.ascii.SP: #regular text
- data.insert(str)
- redraw(data)
-
- return True
- print "@PROJECT_PRETTY_NAME@ @PROJECT_VERSION@"
-
- data = Data()
- fd = sys.stdin.fileno()
- old = termios.tcgetattr(fd)
- new = termios.tcgetattr(fd)
- new[3] = new[3] & ~termios.ICANON & ~termios.ECHO
- termios.tcsetattr(fd, termios.TCSANOW, new)
-
- oldflags = fcntl.fcntl(fd, fcntl.F_GETFL)
- fcntl.fcntl(fd, fcntl.F_SETFL, oldflags | os.O_NONBLOCK)
-
- io_stdin = glib.IOChannel(fd)
- io_stdin.add_watch(glib.IO_IN, handle_keyboard, data)
-
- try:
- erase_line()
- display_prompt()
- sys.stdout.flush()
- main_loop = gobject.MainLoop(None, False)
- main_loop.run()
- except KeyboardInterrupt:
- sys.exit()
- finally:
- termios.tcsetattr(fd, termios.TCSAFLUSH, old)
- fcntl.fcntl(fd, fcntl.F_SETFL, oldflags)
- sys.exit()
-
-else:
- try:
- processCommand(args.command, args.commandArgs, False)
- except dbus.exceptions.DBusException, error:
- print error