summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevron Rees <tripzero.kev@gmail.com>2014-12-15 08:23:24 -0800
committerKevron Rees <tripzero.kev@gmail.com>2014-12-15 08:23:24 -0800
commitd821768a27b1e29f4c3a1da95f8a0fef8f3ba852 (patch)
tree07cc52ab7eedb6807f3bc728b5e372ae3713f21a
parentbbab61812737add4854fa7f0a7a6bb2d3e2bec56 (diff)
parent047d17b55433dc092a008aab90a92dd62e2ca3cf (diff)
downloadautomotive-message-broker-d821768a27b1e29f4c3a1da95f8a0fef8f3ba852.tar.gz
Merge pull request #35 from tripzero/master0.12.900
0.12.900 Beta
-rw-r--r--CMakeLists.txt9
-rw-r--r--RELEASE9
-rw-r--r--ambd/core.cpp51
-rw-r--r--ambd/core.h3
-rw-r--r--ambd/main.cpp12
-rw-r--r--docs/CMakeLists.txt8
-rw-r--r--docs/amb.in.idl (renamed from docs/amb.idl)598
-rw-r--r--docs/dbus.idl6
-rw-r--r--examples/websocketsink2.in2
-rw-r--r--lib/abstractpropertytype.h107
-rw-r--r--lib/abstractroutingengine.cpp3
-rw-r--r--lib/abstractroutingengine.h4
-rw-r--r--lib/abstractsource.h30
-rw-r--r--lib/asyncqueue.hpp22
-rw-r--r--lib/vehicleproperty.cpp121
-rw-r--r--lib/vehicleproperty.h263
-rw-r--r--packaging/CMakeLists.txt1
-rw-r--r--packaging/automotive-message-broker.changes874
-rw-r--r--packaging/automotive-message-broker.spec.in385
-rw-r--r--plugins/CMakeLists.txt3
-rw-r--r--plugins/bluemonkey/CMakeLists.txt4
-rw-r--r--plugins/bluemonkey/bluemonkey.cpp93
-rw-r--r--plugins/bluemonkey/bluemonkey.h2
-rw-r--r--plugins/bluemonkey/config.js158
-rw-r--r--plugins/bluemonkey/irccoms.h4
-rw-r--r--plugins/cansimplugin/cansimplugin.cpp2
-rw-r--r--plugins/common/ambplugin.h4
-rw-r--r--plugins/common/ambpluginimpl.cpp14
-rw-r--r--plugins/common/ambpluginimpl.h2
-rw-r--r--plugins/common/bluetooth5.cpp54
-rw-r--r--plugins/common/bluetooth5.h2
-rw-r--r--plugins/database/databasesink.cpp20
-rw-r--r--plugins/database/databasesink.h164
-rw-r--r--plugins/dbus/abstractproperty.h8
-rw-r--r--plugins/dbus/dbusinterfacemanager.cpp254
-rw-r--r--plugins/dbus/dbusinterfacemanager.h2
-rw-r--r--plugins/dbus/dbusplugin.cpp7
-rw-r--r--plugins/dbus/dbussignaller.h2
-rw-r--r--plugins/dbus/drivingsafety.h91
-rw-r--r--plugins/dbus/environmentproperties.h106
-rw-r--r--plugins/dbus/maintenance.h36
-rw-r--r--plugins/dbus/parking.h45
-rw-r--r--plugins/dbus/personalization.h80
-rw-r--r--plugins/dbus/runningstatus.h52
-rw-r--r--plugins/dbus/varianttype.cpp3
-rw-r--r--plugins/dbus/vehicleinfo.h24
-rw-r--r--plugins/exampleplugin.cpp6
-rw-r--r--plugins/testplugin/testplugin.cpp34
-rw-r--r--plugins/tpms/CMakeLists.txt18
-rw-r--r--plugins/tpms/README41
-rw-r--r--plugins/tpms/tpmsplugin.cpp352
-rw-r--r--plugins/tpms/tpmsplugin.h62
-rw-r--r--plugins/websocket/common.cpp2
-rw-r--r--plugins/websocket/test/test.js93
-rw-r--r--plugins/websocket/test/vehicle.js46
-rw-r--r--plugins/websocket/websocketsink.cpp11
-rw-r--r--plugins/websocket/websocketsink.h4
-rw-r--r--plugins/websocket/websocketsinkmanager.cpp31
-rw-r--r--plugins/websocket/websocketsinkmanager.h4
-rw-r--r--plugins/websocketsink/CMakeLists.txt16
-rw-r--r--plugins/websocketsink/protocol25
-rw-r--r--plugins/websocketsink/test/events.js130
-rw-r--r--plugins/websocketsink/test/index.html17
-rw-r--r--plugins/websocketsink/test/servertest/client.html17
-rw-r--r--plugins/websocketsink/test/servertest/server.html22
-rw-r--r--plugins/websocketsink/test/servertest/server.js312
-rw-r--r--plugins/websocketsink/test/style.css182
-rw-r--r--plugins/websocketsink/test/test.js328
-rw-r--r--plugins/websocketsink/test/vehicle.js409
-rw-r--r--plugins/websocketsink/websocketsink.cpp94
-rw-r--r--plugins/websocketsink/websocketsink.h46
-rw-r--r--plugins/websocketsink/websocketsinkmanager.cpp769
-rw-r--r--plugins/websocketsink/websocketsinkmanager.h56
-rw-r--r--plugins/websocketsourceplugin/CMakeLists.txt16
-rw-r--r--plugins/websocketsourceplugin/websocketsource.cpp638
-rw-r--r--plugins/websocketsourceplugin/websocketsource.h69
-rw-r--r--tests/CMakeLists.txt11
-rwxr-xr-xtests/amb-get-history.py (renamed from tests/amb-get-history)0
-rwxr-xr-xtests/amb-get.py (renamed from tests/amb-get)0
-rwxr-xr-xtests/amb-listen.py (renamed from tests/amb-listen)0
-rwxr-xr-xtests/amb-set.py (renamed from tests/amb-set)14
-rwxr-xr-xtests/gen-set.py (renamed from tests/gen-set)0
-rw-r--r--xwalk/CMakeLists.txt7
-rw-r--r--xwalk/common/picojson.h1211
-rw-r--r--xwalk/vehicle.cc31
-rw-r--r--xwalk/vehicle.html58
-rw-r--r--xwalk/vehicle_api.js34
-rw-r--r--xwalk/vehicle_instance.cc21
88 files changed, 3692 insertions, 5289 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b5d8b3e5..d62d3408 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,9 +6,9 @@ set(CMAKE_BUILD_TYPE, Debug)
include(FindPkgConfig)
set(PROJECT_NAME "automotive-message-broker")
-set(PROJECT_VERSION "0.12.803")
+set(PROJECT_VERSION "0.12.900")
set(PROJECT_CODENAME "agera")
-set(PROJECT_QUALITY "alpha")
+set(PROJECT_QUALITY "beta")
add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
add_definitions(-DPROJECT_NAME="${PROJECT_NAME}")
@@ -23,8 +23,6 @@ set (DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/packages/${PROJECT_NAME}
option(qtmainloop "Use QCoreApplication mainloop " OFF)
option(websocket_plugin "websocket source and sink plugins" OFF)
-option(websocketold_plugin "old websocket sink plugin" OFF)
-option(tpms_plugin "TPMS plugin " OFF)
option(obd2_plugin "OBD-II plugin" OFF)
option(database_plugin "Database plugins" OFF)
option(qt_bindings "AMB Qt DBus bindings" OFF)
@@ -45,7 +43,7 @@ set(XWALK_EXTENSION_PATH "/automotive-message-broker/xwalk" CACHE PATH "director
#turn on -fpic/-fpie:
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie -pie -std=c++11")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie -pie -std=c++1y")
if(opencvlux_plugin)
message(STATUS "OpenCV Lux plugin enabled")
@@ -154,3 +152,4 @@ add_subdirectory(docs)
add_subdirectory(tests)
add_subdirectory(examples)
add_subdirectory(xwalk)
+add_subdirectory(packaging)
diff --git a/RELEASE b/RELEASE
index 83e6e029..d7a921d1 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1,12 +1,17 @@
Release notes for release 0.13
New features:
-- [OpenCV plugin] code updated to the new 3.0 API
-- [OpenCV plugin] driver drowsiness detection test code
- [xwalk extension] implements full W3C automotive BG vehicle and data APIs
+- [OpenCV plugin] code updated to the new 3.0 beta API
+- [OpenCV plugin] driver drowsiness detection test code
- [Bluemonkey plugin] support for zones in JS API.
+- [Bluemonkey plugin] database module.
Changes:
- OpenCV plugin experimental options for cuda and kinect are removed
+- Removed unmaintained plugins: tpms, websocket{sink,source}
Fixes:
+- [DBus plugin] Fix exporting properties in zones that really don't have support
+- [xwalk extension] fixed set() for some types did not work because of invalid GVariant creation.
+- [websocket plugin] Updated html test page. Fixed protocol usage.
diff --git a/ambd/core.cpp b/ambd/core.cpp
index 277ba5a6..645e6307 100644
--- a/ambd/core.cpp
+++ b/ambd/core.cpp
@@ -117,18 +117,23 @@ void Core::updateSupported(PropertyList added, PropertyList removed, AbstractSou
/// add the newly supported to master list
- handleAddSupported(added, source);
+ if(added.size())
+ handleAddSupported(added, source);
/// removed no longer supported properties from master list.
-
- handleRemoveSupported(removed, source);
+ if(removed.size())
+ handleRemoveSupported(removed, source);
/// tell all sinks about the newly supported properties.
+ PropertyList s = supported();
+
+ if(!s.size()) return;
+
for(auto itr = mSinks.begin(); itr != mSinks.end(); ++itr)
{
AbstractSink* sink = *itr;
- sink->supportedChanged(supported());
+ sink->supportedChanged(s);
}
}
@@ -136,13 +141,17 @@ PropertyList Core::supported()
{
PropertyList supportedProperties;
- transform(mMasterPropertyList.begin(), mMasterPropertyList.end(), back_inserter(supportedProperties),
- [](const std::multimap<AbstractSource*, VehicleProperty::Property>::value_type& itr) { return itr.second; }
- );
+ std::transform(mMasterPropertyList.begin(), mMasterPropertyList.end(), std::back_inserter(supportedProperties),
+ [](const std::multimap<AbstractSource*, VehicleProperty::Property>::value_type& itr)
+ {
+ return itr.second;
+ });
// remove duplicates:
std::sort(supportedProperties.begin(), supportedProperties.end());
- std::unique(supportedProperties.begin(), supportedProperties.end());
+ auto itr = std::unique(supportedProperties.begin(), supportedProperties.end());
+
+ supportedProperties.erase(itr,supportedProperties.end());
return supportedProperties;
}
@@ -466,21 +475,14 @@ PropertyInfo Core::getPropertyInfo(const VehicleProperty::Property &property, co
return (*theSource)->getPropertyInfo(property);
}
-std::list<string> Core::sourcesForProperty(const VehicleProperty::Property & property)
+std::vector<string> Core::sourcesForProperty(const VehicleProperty::Property & property)
{
- std::list<std::string> list;
+ std::vector<std::string> list;
- auto itr = mMasterPropertyList.begin();
- while(itr != mMasterPropertyList.end())
+ for(auto src : mSources)
{
- if(itr->second == property) {
- AbstractSource* src = itr->first;
+ if(contains(src->supported(), property))
list.push_back(src->uuid());
- itr = mMasterPropertyList.upper_bound(src);
- }
- else{
- ++itr;
- }
}
return list;
@@ -501,13 +503,10 @@ void Core::handleAddSupported(const PropertyList& added, AbstractSource* source)
for(auto property : added)
{
- mMasterPropertyList.emplace(source, property);// TODO: no check for duplicated properties from the same source - is it needed ?
+ if(!sourceForProperty(property, source->uuid()))
+ mMasterPropertyList.emplace(source, property);
// Subscribe to property in a new source if such property was subscribed. This catches newly supported properties in the process.
- //
- // TODO: is this sufficient to:
- // Iterate through subscribed properties and resubscribe. This catches newly supported properties in the process.
- // which was originally located at the end of the setSupported and updateSupported functions? I think it is sufficient.
if( propertySinkMap.find(property) != propertySinkMap.end()){
source->subscribeToPropertyChanges(property);
}
@@ -563,7 +562,9 @@ AbstractSource* Core::sourceForProperty(const VehicleProperty::Property& propert
auto temp = find_if(
range.first, // the first property in source
range.second, // one item right after the last property in source
- [&property](const std::multimap<AbstractSource*, VehicleProperty::Property>::value_type& it) { return it.second == property; }
+ [&property](const std::multimap<AbstractSource*, VehicleProperty::Property>::value_type& it)
+ {
+ return it.second == property; }
);
if (temp != range.second)// property was found
diff --git a/ambd/core.h b/ambd/core.h
index 7bdcc886..ed0872b7 100644
--- a/ambd/core.h
+++ b/ambd/core.h
@@ -57,7 +57,7 @@ public:
PropertyList supported();
PropertyInfo getPropertyInfo(const VehicleProperty::Property &,const std::string &sourceUuid);
- std::list<std::string> sourcesForProperty(const VehicleProperty::Property & property);
+ std::vector<std::string> sourcesForProperty(const VehicleProperty::Property & property);
struct Performance {
Performance(): propertiesPerSecond(0), firedPropertiesPerSecond(0) {}
@@ -81,7 +81,6 @@ private:
// to support zone filtering replace VehicleProperty::Property with ZonePropertyType
std::multimap<AbstractSource*, VehicleProperty::Property> mMasterPropertyList;
- // K = AbstractSource::uuid(), T = AbstractSource*
std::unordered_set<AbstractSource*> mSources;
std::unordered_set<AbstractSink*> mSinks;
diff --git a/ambd/main.cpp b/ambd/main.cpp
index 6d91e5b0..f6f1b407 100644
--- a/ambd/main.cpp
+++ b/ambd/main.cpp
@@ -83,6 +83,16 @@ void printVersion()
DebugOut(0)<<"Version: "<<PROJECT_VERSION<<" ( "<<PROJECT_CODENAME<<" "<<PROJECT_QUALITY<<" )"<<endl;
}
+static void glibLogHandler(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
+{
+ if(log_level == G_LOG_LEVEL_CRITICAL)
+ DebugOut(DebugOut::Error) << message << endl;
+ else if(log_level == G_LOG_LEVEL_WARNING)
+ DebugOut(DebugOut::Warning) << message << endl;
+ else
+ DebugOut() << message << endl;
+}
+
int main(int argc, char **argv)
{
@@ -93,6 +103,8 @@ int main(int argc, char **argv)
ofstream logfile;
string logfn;
+ g_log_set_handler(G_LOG_DOMAIN, GLogLevelFlags(G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL), glibLogHandler, nullptr);
+
while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)
{
switch (optc)
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index 69e99af3..4f5b0c00 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -1,9 +1,9 @@
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.idl 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.idl ${CMAKE_CURRENT_SOURCE_DIR}/dbus/html/amb.idl WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Moving amb.idl" VERBATIM)
-
- configure_file (${CMAKE_CURRENT_SOURCE_DIR}/amb.idl ${CMAKE_CURRENT_SOURCE_DIR}/amb.idl @ONLY)
+ 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)
endif(enable_docs)
+
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/amb.in.idl ${CMAKE_CURRENT_SOURCE_DIR}/amb.fidl @ONLY)
diff --git a/docs/amb.idl b/docs/amb.in.idl
index 4ac47c5c..0d57e836 100644
--- a/docs/amb.idl
+++ b/docs/amb.in.idl
@@ -1,5 +1,7 @@
/*! amb.idl
-* /brief This document describes the DBus interfaces and data types for the
+* \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>.
*/
@@ -48,7 +50,7 @@ interface VehiclePropertyType {
attribute Zone Zone readonly
/*!
- * \brief returns dictionary of objectName and values for data between
+ * \brief return dictionary of objectName and values for data between
* 'beginTime' and 'endTime'
* \arg beginTime time stamp in Seconds since Unix Epoc
* \arg endTime time stamp in Seconds since Unix Epoc
@@ -77,7 +79,7 @@ enumeration Zone {
interface org.automotive.Manager {
/*! List
- * \brief returns supported properties
+ * \brief return supported properties
*/
method List {
out { String[] }
@@ -93,7 +95,7 @@ interface org.automotive.Manager {
* when the last proccess that calls Find* disconnects from DBus.
*
* \arg String objectName to find
- * \returns list of object paths that provide the given object Name.
+ * \return list of object paths that provide the given object Name.
*/
method FindObject {
in {
@@ -107,10 +109,11 @@ interface org.automotive.Manager {
/*!
* FindObjectForZone
* \brief find the DBus object path which matches "objectName" and "zone". This has the same behavior as FindObject
- * except that it takes an addition zone argument and only returns the path for that zone.
+ * 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
- * \returns string representing the DBus Object path. Possible errors:
+ * \return string representing the DBus Object path.
+ * Possible errors:
* "org.automotive.Manager.InvalidZone"
* "org.automotive.Manager.ObjectNotFound"
*/
@@ -128,7 +131,7 @@ interface org.automotive.Manager {
* ZonesForObjectName
* \brief get a list of zones for a given objectName.
* \arg String objectName object name.
- * \returns list of zones for the given objectName (@see Zone)
+ * \return list of zones for the given objectName (@see Zone)
*/
method ZonesForObjectName {
in {
@@ -143,7 +146,7 @@ interface org.automotive.Manager {
* SupportsProperty
* \brief check whether a Property exists.
* \arg propertyName name of property of Object
- * \returns true if Property exists
+ * \return true if Property exists
*/
method SupportsProperty {
in {
@@ -163,7 +166,7 @@ interface org.automotive.Manager {
interface org.automotive.VehicleSpeed extends VehiclePropertyType {
/*! Speed
- * \brief Must return Vehicle Speed in kilometers per hour.
+ * \brief MUST return Vehicle Speed in kilometers per hour.
*/
attribute UInt16 Speed readonly
}
@@ -175,7 +178,7 @@ interface org.automotive.VehicleSpeed extends VehiclePropertyType {
interface org.automotive.EngineSpeed extends VehiclePropertyType {
/*! EngineSpeed
- * \brief Must return Engine Speed in rotations per minute.
+ * \brief MUST return Engine Speed in rotations per minute.
*/
attribute UInt16 Speed readonly
}
@@ -190,7 +193,7 @@ enumeration PowerMode {
interface org.automotive.VehiclePowerMode extends VehiclePropertyType {
/*! VehiclePowerMode
- * \brief Must return vehicle power mode
+ * \brief MUST return vehicle power mode
*/
attribute PowerMode VehiclePowerMode readonly
}
@@ -202,9 +205,9 @@ interface org.automotive.VehiclePowerMode extends VehiclePropertyType {
interface org.automotive.TripMeter extends VehiclePropertyType {
/*! TripMeters
- * \brief Must return trip meters. Changing any items in the array will reset the item's value to '0'.
+ * \brief MUST return trip meters. Changing any items in the array will reset the item's value to '0'.
*/
- attribute UInt16[] TripMeters
+ attribute array TripMeters of UInt16;
}
/*! org.automotive.Acceleration
@@ -270,7 +273,7 @@ enumeration TransmissionGearType
interface org.automotive.Transmission extends VehiclePropertyType {
/*! GearPosition
- * \brief Must return transmission gear position (see TRANSMISSIONPOSITION) Deprecated. Replaced with Gear
+ * \brief MUST return transmission gear position (see TRANSMISSIONPOSITION) Deprecated. Replaced with Gear
*/
attribute TransmissionPosition GearPosition readonly
@@ -281,12 +284,12 @@ interface org.automotive.Transmission extends VehiclePropertyType {
attribute TransmissionGearType Type;
/*! Gear
- * \brief Must return transmission gear position 1-10
+ * \brief MUST return transmission gear position 1-10
*/
attribute UInt8 Gear readonly
/*! Mode
- * \brief Must return transmission Mode
+ * \brief MUST return transmission Mode
*/
attribute TransmissionMode Mode readonly
}
@@ -295,17 +298,17 @@ interface org.automotive.Transmission extends VehiclePropertyType {
interface org.automotive.CruiseControlStatus extends VehiclePropertyType {
/*! Activated
- * \brief Must return whether or not the Cruise Control system is active (true) or inactive (false). Depricated. Remove in 0.14. Use "Status"
+ * \brief MUST return whether or not the Cruise Control system is active (true) or inactive (false). Depricated. Remove in 0.14. Use "Status"
*/
attribute Boolean Activated readonly
/*! Speed
- * \brief Must return target Cruise Control speed in kilometers per hour (kph).
+ * \brief MUST return target Cruise Control speed in kilometers per hour (kph).
*/
attribute UInt16 Speed readonly
/*! Status
- * \brief Must return whether or not the Cruise Control system is active (true) or inactive (false).
+ * \brief MUST return whether or not the Cruise Control system is active (true) or inactive (false).
*/
attribute Boolean Status readonly
}
@@ -316,7 +319,7 @@ interface org.automotive.CruiseControlStatus extends VehiclePropertyType {
interface org.automotive.WheelBrake extends VehiclePropertyType {
/*! Engaged
- * \brief Must return Wheel Brake status: Engaged = true, disengaged = false
+ * \brief MUST return Wheel Brake status: Engaged = true, disengaged = false
*/
attribute Boolean Engaged readonly
}
@@ -324,7 +327,7 @@ interface org.automotive.WheelBrake extends VehiclePropertyType {
interface org.automotive.BrakeOperation extends VehiclePropertyType {
/*! BrakePedalDepressed
- * \brief must return whether brake pedal is depressed or not. true: brake pedal is depressed, false: brake pedal is not depressed
+ * \brief MUST return whether brake pedal is depressed or not. true: brake pedal is depressed, false: brake pedal is not depressed
*/
attribute Boolean BrakePedalDepressed readonly
}
@@ -332,52 +335,52 @@ interface org.automotive.BrakeOperation extends VehiclePropertyType {
interface org.automotive.LightStatus extends VehiclePropertyType {
/*! Head
- * \brief Must return headlight status: on = true, off = false.
+ * \brief MUST return headlight status: on = true, off = false.
*/
attribute Boolean Head
/*! RightTurn
- * \brief Must return right turn signal status: on = true, off = false.
+ * \brief MUST return right turn signal status: on = true, off = false.
*/
attribute Boolean RightTurn
/*! LeftTurn
- * \brief Must return left turn signal status: on = true, off = false.
+ * \brief MUST return left turn signal status: on = true, off = false.
*/
attribute Boolean LeftTurn
/*! Brake
- * \brief Must return brake signal light status: on = true, off = false.
+ * \brief MUST return brake signal light status: on = true, off = false.
*/
attribute Boolean Brake
/*! Fog
- * \brief Must return fog light status: on = true, off = false.
+ * \brief MUST return fog light status: on = true, off = false.
*/
attribute Boolean Fog
/*! Hazard
- * \brief Must return hazard light status: on = true, off = false.
+ * \brief MUST return hazard light status: on = true, off = false.
*/
attribute Boolean Hazard
/*! Parking
- * \brief Must return parking light status: on = true, off = false.
+ * \brief MUST return parking light status: on = true, off = false.
*/
attribute Boolean Parking
/*! HighBeam
- * \brief Must return high beam status: on = true, off = false.
+ * \brief MUST return high beam status: on = true, off = false.
*/
attribute Boolean HighBeam
/*! AutomaticHeadlights
- * \brief Must return automatic headlight status: on = true, off = false.
+ * \brief MUST return automatic headlight status: on = true, off = false.
*/
attribute Boolean AutomaticHeadlights
/*! DynamicHighBeam
- * \brief Must return dynamic high beam status: on = true, off = false.
+ * \brief MUST return dynamic high beam status: on = true, off = false.
*/
attribute Boolean DynamicHighBeam
}
@@ -386,22 +389,22 @@ interface org.automotive.LightStatus extends VehiclePropertyType {
interface org.automotive.InteriorLightStatus extends VehiclePropertyType {
/*! Passenger
- * \brief Must return passenger interior light status: on = true, off = false. Deprecated. Remove in 0.14. Use status and zone.
+ * \brief MUST return passenger interior light status: on = true, off = false. Deprecated. Remove in 0.14. Use status and zone.
*/
attribute Boolean Passenger readonly
/*! Driver
- * \brief Must return driver interior light status: on = true, off = false. Deprecated. Remove in 0.14. Use status and zone.
+ * \brief MUST return driver interior light status: on = true, off = false. Deprecated. Remove in 0.14. Use status and zone.
*/
attribute Boolean Driver readonly
/*! Center
- * \brief Must return center interior light status: on = true, off = false. Deprecated. Remove in 0.14. Use status and zone.
+ * \brief MUST return center interior light status: on = true, off = false. Deprecated. Remove in 0.14. Use status and zone.
*/
attribute Boolean Center readonly
/*! Status
- * \brief Must return interior light status for the zone. on = true, off = false
+ * \brief MUST return interior light status for the zone. on = true, off = false
*/
attribute Boolean Status
}
@@ -410,7 +413,7 @@ interface org.automotive.InteriorLightStatus extends VehiclePropertyType {
interface org.automotive.Horn extends VehiclePropertyType {
/*! On
- * \brief Must return horn status: on = true, off = false
+ * \brief MUST return horn status: on = true, off = false
*/
attribute Boolean On readonly
}
@@ -419,42 +422,42 @@ interface org.automotive.Horn extends VehiclePropertyType {
interface org.automotive.Fuel extends VehiclePropertyType {
/*! Level
- * \brief Must return fuel level as a percentage of fullness.
+ * \brief MUST return fuel level as a percentage of fullness.
*/
attribute UInt16 Level readonly
/*! Range
- * \brief Must return estimated fuel range in meters.
+ * \brief MUST return estimated fuel range in meters.
*/
attribute UInt32 Range readonly
/*! InstantConsumption
- * \brief Must return instant fuel consumption in per distance travelled (Unit: milliliters per 100 kilometers).
+ * \brief MUST return instant fuel consumption in per distance travelled (Unit: milliliters per 100 kilometers).
*/
attribute UInt32 InstantConsumption readonly
/*! InstantEconomy
- * \brief Must return instant fuel 'economy' in kilometers per liter of fuel.
+ * \brief MUST return instant fuel 'economy' in kilometers per liter of fuel.
*/
attribute UInt16 InstantEconomy readonly
/*! AverageEconomy
- * \brief Must return average fuel 'economy' in kilometers per liter of fuel since last reset. Setting this to any value should reset the counter to '0'
+ * \brief MUST return average fuel 'economy' in kilometers per liter of fuel since last reset. Setting this to any value should reset the counter to '0'
*/
attribute UInt16 AverageEconomy;
/*! AverageConsumption
- * \brief Must return average fuel consumption in per distance travelled (Unit: milliliters per 100 kilometers). Setting this to any value should reset the counter to '0'
+ * \brief MUST return average fuel consumption in per distance travelled (Unit: milliliters per 100 kilometers). Setting this to any value should reset the counter to '0'
*/
attribute UInt32 AverageConsumption;
/*! FuelConsumedSinceRestart
- * \brief must return fuel consumed since engine start; (Unit: milliliters per 100 kilometers) resets to 0 each restart
+ * \brief MUST return fuel consumed since engine start; (Unit: milliliters per 100 kilometers) resets to 0 each restart
*/
attribute UInt32 FuelConsumedSinceRestart readonly;
/*! TimeSinceRestart
- * \brief must return time elapsed since vehicle restart (Unit: seconds)
+ * \brief MUST return time elapsed since vehicle restart (Unit: seconds)
*/
attribute UInt32 TimeSinceRestart readonly;
}
@@ -463,32 +466,32 @@ interface org.automotive.Fuel extends VehiclePropertyType {
interface org.automotive.EngineOil extends VehiclePropertyType {
/*! Remaining
- * \brief Must return remaining engine oil as percentage of fullness. Deprecated. Remove in 0.14. Use "Level"
+ * \brief MUST return remaining engine oil as percentage of fullness. Deprecated. Remove in 0.14. Use "Level"
*/
attribute UInt16 Remaining readonly
/*! Temperature
- * \brief Must return Engine Oil Temperature in Celcius.
+ * \brief MUST return Engine Oil Temperature in Celcius.
*/
attribute long Temperature readonly
/*! Pressure
- * \brief Must return Engine Oil Pressure in kPa.
+ * \brief MUST return Engine Oil Pressure in kPa.
*/
attribute UInt16 Pressure readonly
/*! Level
- * \brief Must return engine oil level (Unit: percentage, 0%: empty, 100%: full
+ * \brief MUST return engine oil level (Unit: percentage, 0%: empty, 100%: full
*/
attribute UInt16 Level readonly
/*! Change
- * \brief Must return engine oil change indicator status: change oil (true) or no change (false)
+ * \brief MUST return engine oil change indicator status: change oil (true) or no change (false)
*/
attribute boolean Change readonly
/*! LifeRemaining
- * \brief Must return engine oil change indicator status: change oil (true) or no change (false)
+ * \brief MUST return engine oil change indicator status: change oil (true) or no change (false)
*/
attribute boolean LifeRemaining readonly
@@ -498,22 +501,22 @@ interface org.automotive.EngineOil extends VehiclePropertyType {
interface org.automotive.Location extends VehiclePropertyType {
/*! Latitude
- * \brief Must return latitude in Deg.Min (-180, +180)
+ * \brief MUST return latitude in Deg.Min (-180, +180)
*/
attribute Double Latitude readonly
/*! Longitude
- * \brief Must return longitude in Deg.Min (-90, +90)
+ * \brief MUST return longitude in Deg.Min (-90, +90)
*/
attribute Double Longitude readonly
/*! Altitude
- * \brief Must return altitude in meters above sea-level (0).
+ * \brief MUST return altitude in meters above sea-level (0).
*/
attribute Double Altitude readonly
/*! Direction
- * \brief Must return direction in Degrees (0-360)
+ * \brief MUST return direction in Degrees (0-360)
*/
attribute UInt16 Direction readonly
}
@@ -522,7 +525,7 @@ interface org.automotive.Location extends VehiclePropertyType {
interface org.automotive.ExteriorBrightness extends VehiclePropertyType {
/*! ExteriorBrightness
- * \brief Must return the brightness outside the vehicle in lux.
+ * \brief MUST return the brightness outside the vehicle in lux.
*/
attribute UInt16 ExteriorBrightness readonly
}
@@ -531,24 +534,24 @@ interface org.automotive.ExteriorBrightness extends VehiclePropertyType {
interface org.automotive.Temperature extends VehiclePropertyType {
/*! Interior
- * \brief Must return the temperature of the interior of the vehicle in celcius.
+ * \brief MUST return the temperature of the interior of the vehicle in celcius.
*/
/// Deprecated. Use InteriorTemperature. Remove in 0.14
attribute signed short Interior readonly
/*! Exterior
- * \brief Must return the temperature of the exterior of the vehicle in celcius.
+ * \brief MUST return the temperature of the exterior of the vehicle in celcius.
*/
/// Deprecated. Use ExteriorTemperature. Remove in 0.14
attribute signed short Exterior readonly
/*! Interior
- * \brief Must return the temperature of the interior of the vehicle in celcius.
+ * \brief MUST return the temperature of the interior of the vehicle in celcius.
*/
attribute signed short InteriorTemperature readonly
/*! Exterior
- * \brief Must return the temperature of the exterior of the vehicle in celcius.
+ * \brief MUST return the temperature of the exterior of the vehicle in celcius.
*/
attribute signed short ExteriorTemperature readonly
}
@@ -557,22 +560,50 @@ interface org.automotive.Temperature extends VehiclePropertyType {
interface org.automotive.RainSensor extends VehiclePropertyType {
/*! RainSensor
- * \brief Must return level of rain intensity 0: No Rain - 10: Heaviest Rain.
+ * \brief MUST return level of rain intensity 0: No Rain - 10: Heaviest Rain.
+ * Deprecated in 0.14. Use rainIntensity
*/
attribute UInt16 RainSensor readonly
+
+ /*! RainIntensity
+ * \brief MUST return level of rain intensity 0: No Rain - 10: Heaviest Rain.
+ */
+ attribute UInt16 RainIntensity readonly
}
+/// TODO: Depricated in 0.14 Use WiperStatus
interface org.automotive.WindshieldWiper extends VehiclePropertyType {
- const UInt16 WIPERSPEED_OFF = 0;
- const UInt16 WIPERSPEED_SLOWEST= 1;
- const UInt16 WIPERSPEED_FASTEST = 5;
- const UInt16 WIPERSPEED_AUTO = 10;
/*! WindshieldWiper
- * \brief Must return Level of windshield whiper speed (see WIPERSPEED)
+ * \brief MUST return Level of windshield whiper speed (0-10)
*/
attribute UInt16 WindshieldWiper readonly
+
+}
+
+enumeration WiperControl {
+ off = "off",
+ once = "once",
+ slowest = "slowest",
+ slow = "slow",
+ middle = "middle",
+ fast = "fast",
+ fastest = "fastest",
+ auto = "auto"
+};
+
+interface org.automotive.WiperStatus extends VehiclePropertyType {
+
+ /*! WiperSpeed
+ * \brief MUST return current speed interval of wiping windshield
+ */
+ attribute WiperControl WiperSpeed readonly
+
+ /*! WiperSetting
+ * \brief MUST return current setting of the front wiper controller. It can be used to send user's request for changing setting.
+ */
+ attribute WiperControl WiperSetting
}
/*! Deprecated. Use ClimateControl interface. Remove in 0.14
@@ -584,47 +615,47 @@ interface org.automotive.HVAC extends VehiclePropertyType {
const UInt16 AIRFLOWDIRECTION_DEFROSTER = 0x04;
/*! AirflowDirection
- * \brief Must return airflow direction. See
+ * \brief MUST return airflow direction. See
*/
attribute UInt16 AirflowDirection;
/*! FanSpeed
- * \brief Must return speed of the fan (0-7)
+ * \brief MUST return speed of the fan (0-7)
*/
attribute UInt16 FanSpeed;
/*! TargetTemperature
- * \brief Must return target desired temperature in celcius.
+ * \brief MUST return target desired temperature in celcius.
*/
attribute UInt16 TargetTemperature;
/*! AirConditioning
- * \brief Must return air conditioning on (true) / off (false).
+ * \brief MUST return air conditioning on (true) / off (false).
*/
attribute Boolean AirConditioning;
/*! AirRecirculation
- * \brief Must return air recirculation on (true) / off (false).
+ * \brief MUST return air recirculation on (true) / off (false).
*/
attribute Boolean AirRecirculation;
/*! Heater
- * \brief Must return heater on (true) / off (false).
+ * \brief MUST return heater on (true) / off (false).
*/
attribute Boolean Heater;
/*! SteeringWheelHeater
- * \brief Must return air recirculation on (true) / off (false).
+ * \brief MUST return air recirculation on (true) / off (false).
*/
attribute Boolean SteeringWheelHeater;
/*! SeatHeater
- * \brief Must return seat heater status: 0-100%.
+ * \brief MUST return seat heater status: 0-100%.
*/
attribute UInt16 SeatHeater;
/*! SeatCooler
- * \brief Must return seat heater status: on (true) / off (false).
+ * \brief MUST return seat heater status: on (true) / off (false).
*/
attribute Boolean SeatCooler;
}
@@ -639,76 +670,90 @@ enumeration AirflowDirectionType
interface org.automotive.ClimateControl extends VehiclePropertyType {
/*! AirflowDirection
- * \brief Must return current status of the direction of the air flow through the ventilation system
+ * \brief MUST return current status of the direction of the air flow through the ventilation system
*/
attribute AirflowDirectionType AirflowDirection;
/*! FanSpeedLevel
- * \brief Must return seat heater status: on (true) / off (false).
+ * \brief MUST return seat heater status: on (true) / off (false).
*/
attribute UInt8 FanSpeedLevel;
/*! TargetTemperature
- * \brief Must return current setting of the desired temperature (Unit: celsius)
+ * \brief MUST return current setting of the desired temperature (Unit: celsius)
*/
attribute Int8 TargetTemperature;
/*! AirConditioning
- * \brief Must return current status of the air conditioning system: on (true) or off (false)
+ * \brief MUST return current status of the air conditioning system: on (true) or off (false)
*/
attribute Boolean AirConditioning;
/*! Heater
- * \brief Must return current status of the heating system: on (true) or off (false)
+ * \brief MUST return current status of the heating system: on (true) or off (false)
*/
attribute Boolean Heater;
/*! SeatHeater
- * \brief Must return current status of the seat warmer ( 0: off, 1: least warm, 10: warmest )
+ * \brief MUST return current status of the seat warmer ( 0: off, 1: least warm, 10: warmest )
*/
attribute UInt8 SeatHeater;
/*! SeatCooler
- * \brief Must return current status of the seat ventilation ( 0: off, 1: least warm, 10: warmest )
+ * \brief MUST return current status of the seat ventilation ( 0: off, 1: least warm, 10: warmest )
*/
attribute UInt8 SeatCooler;
/*! AirRecirculation
- * \brief Must return current setting of air recirculation: on (true) or pulling in outside air (false).
+ * \brief MUST return current setting of air recirculation: on (true) or pulling in outside air (false).
*/
attribute Boolean AirRecirculation;
/*! SteeringWheelHeater
- * \brief Must return current status of steering wheel heater ( 0: off, 1: least warm, 10: warmest ).
+ * \brief MUST return current status of steering wheel heater ( 0: off, 1: least warm, 10: warmest ).
*/
attribute UInt8 SteeringWheelHeater;
}
+/// Deprecated in 0.14. Use SideWindow
interface org.automotive.WindowStatus extends VehiclePropertyType {
/*! Openness
- * \brief Must return window openness percentage (100% fully open, 0% fully closed)
+ * \brief MUST return window openness percentage (100% fully open, 0% fully closed)
* for the window location see "zone" attribute
*/
attribute UInt16 Openness;
/*! Defrost
- * \brief Must return the defroster status of the window. On = true, Off = false.
+ * \brief MUST return the defroster status of the window. On = true, Off = false.
* Deprecated. Use Defrost interface. Remove in 0.14.
*/
attribute Boolean Defrost;
}
+interface org.automotive.SideWindow extends VehiclePropertyType {
+
+ /*! Openness
+ * \brief MUST return window openness percentage (100% fully open, 0% fully closed)
+ */
+ attribute UInt16 Openness;
+
+ /*! Lock
+ * \brief MUST return whether or not the window is locked (true) or unlocked (false)
+ */
+ attribute Boolean Lock;
+}
+
interface org.automotive.Defrost extends VehiclePropertyType {
/*! DefrostWindow
- * \brief Must return current status of the defrost switch for mirrors. It can be
+ * \brief MUST return current status of the defrost switch for mirrors. It can be
* used to send user's request for changing setting.
*/
attribute Boolean DefrostWindow;
/*! DefrostMirrors
- * \brief Must return current status of the defrost switch for window. It can be
+ * \brief MUST return current status of the defrost switch for window. It can be
* used to send user's request for changing setting.
*/
attribute Boolean DefrostMirrors;
@@ -717,23 +762,36 @@ interface org.automotive.Defrost extends VehiclePropertyType {
interface org.automotive.Sunroof extends VehiclePropertyType {
/*! Openness
- * \brief Must return window status for sunroof openness percentage.
+ * \brief MUST return window status for sunroof openness percentage.
*/
attribute UInt16 Openness;
/*! Tilt
- * \brief Must return tilt status for sunroof percentage.
+ * \brief MUST return tilt status for sunroof percentage.
*/
attribute UInt16 Tilt;
}
+enumeration ConvertibleRoofStatus {
+ closed = "closed",
+ closing = "closing",
+ opening = "opening",
+ opened = "opened"
+};
+
interface org.automotive.ConvertibleRoof extends VehiclePropertyType {
+ /*! Status
+ * \brief MUST return current status of Convertible Roof.
+ *
+ */
+ attribute ConvertibleRoofStatus Status readonly;
- /*! Openness
- * \brief Must return convertible roof openness percentage.
+ /*! Setting
+ * \brief MUST return current setting of Convertible Roof. This is used to open (true) and close (false).
+ *
*/
- attribute UInt16 Openness;
+ attribute Boolean Setting;
}
@@ -817,7 +875,7 @@ interface org.automotive.Doors extends VehiclePropertyType {
* Example a common mini-van may have Doors[0] = 2 doors,
* Doors[1] = 1 (side door), Doors[2] = 1 (trunk).
*/
- attribute Array<UInt16> DoorsPerRow readonly
+ attribute array DoorsPerRow of UInt16 readonly
}
@@ -945,20 +1003,25 @@ interface org.automotive.SecurityAlert extends VehiclePropertyType {
attribute Boolean SecurityAlert readonly
}
-/// Deprecated. Use LightStatus. remove in 0.14
interface org.automotive.ParkingBrake extends VehiclePropertyType {
/*! ParkingBrake
- * must return status of parking brake: Engaged = true, Disengaged = false.
+ * MUST return status of parking brake: Engaged = true, Disengaged = false.
+ TODO: Deprecated in 0.14. Use Status
*/
attribute Boolean ParkingBrake readonly
+
+ /*!
+ * \brief MUST return the current status of parking brake.
+ */
+ attribute ParkingBrakeStatus Status;
}
/// Deprecated. Use LightStatus. remove in 0.14
interface org.automotive.ParkingLight extends VehiclePropertyType {
/*! ParkingLight
- * must return status of parking light: Engaged = true, Disengaged = false.
+ * MUST return status of parking light: Engaged = true, Disengaged = false.
*/
attribute Boolean ParkingLight readonly
}
@@ -967,7 +1030,7 @@ interface org.automotive.ParkingLight extends VehiclePropertyType {
interface org.automotive.HazardLight extends VehiclePropertyType {
/*! HazardLight
- * must return status of hazard light: Engaged = true, Disengaged = false.
+ * MUST return status of hazard light: Engaged = true, Disengaged = false.
*/
attribute Boolean HazardLight readonly
}
@@ -977,8 +1040,19 @@ interface org.automotive.AntilockBrakingSystem extends VehiclePropertyType {
/*! AntilockBrakingSystem
* \brief MUST return whether Antilock Braking System is Idle (false) or Engaged (true)
+ * TODO: Deprecated. Use Engaged. Remove in 0.14
*/
attribute Boolean AntilockBrakingSystem readonly
+
+ /*!
+ * \brief MUST return whether or not the ABS Setting is enabled: enabled (true) or disabled (false)
+ */
+ attribute Boolean Enabled readonly;
+
+ /*!
+ * \brief MUST return whether or not the ABS is engaged: engaged (true) or idle (false)
+ */
+ attribute Boolean Engaged readonly;
}
@@ -986,15 +1060,26 @@ interface org.automotive.TractionControlSystem extends VehiclePropertyType {
/*! TractionControlSystem
* \brief MUST return whether Traction Control System is Off (false) or On (true)
+ * TODO: Deprecated. Use Engaged. Remove in 0.14
*/
attribute Boolean TractionControlSystem readonly
+
+ /*!
+ * \brief MUST return whether or not the TCS Setting is enabled: enabled (true) or disabled (false)
+ */
+ attribute Boolean Enabled readonly;
+
+ /*!
+ * \brief MUST return whether or not the TCS is engaged: engaged (true) or idle (false)
+ */
+ attribute Boolean Engaged readonly;
}
interface org.automotive.VehicleTopSpeedLimit extends VehiclePropertyType {
/*! VehicleTopSpeedLimit
- * \brief MUST returns top rated speed in km/h. 0 = no limit
+ * \brief MUST return top rated speed in km/h. 0 = no limit
*/
attribute UInt16 VehicleTopSpeedLimit readonly
}
@@ -1002,16 +1087,24 @@ interface org.automotive.VehicleTopSpeedLimit extends VehiclePropertyType {
interface org.automotive.AirbagStatus extends VehiclePropertyType {
- const UInt16 AIRBAGSTATUS_INACTIVE = 0;
- const UInt16 AIRBAGSTATUS_ACTIVE = 1;
- const UInt16 AIRBAGSTATUS_DEPLOYED = 2;
-
/*! AirbagStatus
- * \brief MUST returns Airbag status (byte) (see AIRBAGSTATUS_*)
+ * \brief MUST return Airbag status (byte) (see AIRBAGSTATUS_*)
+ * TODO: deprecated. Remove in 0.14
*/
attribute UInt16 AirbagStatus readonly
+
+ /*!
+ * \brief MUST return whether or not the airbag is activaged: activated (true) or deactivated (false)
+ */
+ attribute Boolean Activated readonly;
+
+ /*!
+ * \brief MUST return whether the airbag is deployed: deployed (true) or not (false)
+ */
+ attribute Boolean Deployed readonly;
}
+/// TODO: deprecated. Remove in 0.14
enumeration AirbagStatus {
inactive = 0,
active = 1,
@@ -1023,10 +1116,8 @@ enumeration AirbagStatus {
*/
interface org.automotive.DoorStatus extends VehiclePropertyType {
-
-
/*! DoorStatus
- * \brief MUST returns Door status (byte).
+ * \brief MUST return Door status (byte).
* CLOSED = 0
* OPEN = 1
* AJAR = 2
@@ -1034,15 +1125,16 @@ interface org.automotive.DoorStatus extends VehiclePropertyType {
attribute UInt16 DoorStatus readonly
/*! DoorLockStatus
- * \brief MUST returns Door status (bool locked = true, unlocked = false).
+ * \brief MUST return Door status (bool locked = true, unlocked = false).
*/
attribute Boolean DoorLockStatus;
/*! ChildLockStatus
- * \brief MUST returns Child lock status of rear doors. active = true, inactive = false.
+ * \brief MUST return Child lock status of rear doors. active = true, inactive = false.
* Setting this to 'true' will prevent the rear doors from being opened
* from the inside.
*/
+ ///TODO: Deprecated in 0.14. Use org.automotive.ChildLockStatus
attribute Boolean ChildLockStatus;
}
@@ -1055,24 +1147,24 @@ enumeration DoorStatus {
interface org.automotive.Door extends VehiclePropertyType {
/*! Status
- * \brief MUST returns Door status (byte). See DOORSTATUS_*
+ * \brief MUST return Door status (byte). See DOORSTATUS_*
*/
attribute DoorStatus Status readonly
/*! Lock
- * \brief MUST returns Door status (bool locked = true, unlocked = false).
+ * \brief MUST return Door status (bool locked = true, unlocked = false).
*/
attribute Boolean Lock;
/*! ChildLock
- * \brief MUST returns Child lock status of rear doors. active = true, inactive = false.
+ * \brief MUST return Child lock status of rear doors. active = true, inactive = false.
* Setting this to 'true' will prevent the rear doors from being opened
* from the inside.
*/
attribute Boolean ChildLock;
}
-
+///TODO: Deprecated in 0.14. Use org.automotive.Seat
interface org.automotive.SeatBelt extends VehiclePropertyType {
/*! Status
@@ -1081,11 +1173,11 @@ interface org.automotive.SeatBelt extends VehiclePropertyType {
attribute Boolean Status readonly
}
-
+///TODO: Deprecated in 0.14. Use org.automotive.Seat
interface org.automotive.OccupantStatus extends VehiclePropertyType {
/*! OccupantStatus
- * \brief MUST returns status of Occupant (byte, see
+ * \brief MUST return status of Occupant (byte, see
*/
attribute UInt16 OccupantStatus readonly
}
@@ -1094,7 +1186,7 @@ interface org.automotive.OccupantStatus extends VehiclePropertyType {
interface org.automotive.ObstacleDistance extends VehiclePropertyType {
/*! ObstacleDistance
- * \brief MUST returns Distance Sensor distance (Double) in m.
+ * \brief MUST return Distance Sensor distance (Double) in m.
*/
attribute Double ObstacleDistance readonly
}
@@ -1123,7 +1215,7 @@ interface org.automotive.DrivingMode extends VehiclePropertyType {
attribute UInt16 DrivingMode readonly
/*!
- * \brief must return true if vehicle is in driving mode
+ * \brief MUST return true if vehicle is in driving mode
*/
attribute Boolean Mode readonly
}
@@ -1155,16 +1247,18 @@ interface org.automotive.MeasurementSystem extends VehiclePropertyType {
}
+///TODO Deprecated. Use org.automotive.Mirror. Remove in 0.14
interface org.automotive.MirrorSetting extends VehiclePropertyType {
/*!
* \brief MUST return
*/
- attribute UInt16 Pan readonly
- attribute UInt16 Tilt readonly
+ attribute UInt8 Pan readonly
+ attribute UInt8 Tilt readonly
}
+///TODO Deprecated. Use org.automotive.SeadAdjustment. Remove in 0.14
interface org.automotive.SeatPosition extends VehiclePropertyType {
/*!
@@ -1221,7 +1315,7 @@ interface org.automotive.DashboardIllumination extends VehiclePropertyType {
attribute UInt16 DashboardIllumination readonly
}
-
+///TODO Deprecated. Use org.automotive.VehicleSound. Remove in 0.14
interface org.automotive.GeneratedVehicleSoundMode extends VehiclePropertyType {
/*!
@@ -1308,7 +1402,7 @@ interface org.automotive.EngineCoolant extends VehiclePropertyType {
interface org.automotive.PowertrainTorque extends VehiclePropertyType {
/*!
- * \brief must return powertrain torque (Unit: newton meters)
+ * \brief MUST return powertrain torque (Unit: newton meters)
*/
attribute UInt16 Value readonly
}
@@ -1316,7 +1410,7 @@ interface org.automotive.PowertrainTorque extends VehiclePropertyType {
interface org.automotive.AcceleratorPedalPosition extends VehiclePropertyType {
/*!
- * \brief must return accelerator pedal position as a percentage (Unit: percentage, 0%: released pedal, 100%: fully depressed)
+ * \brief MUST return accelerator pedal position as a percentage (Unit: percentage, 0%: released pedal, 100%: fully depressed)
*/
attribute UInt8 Value readonly
}
@@ -1324,19 +1418,19 @@ interface org.automotive.AcceleratorPedalPosition extends VehiclePropertyType {
interface org.automotive.WheelTick extends VehiclePropertyType {
/*!
- * \brief must return number of ticks per second (Unit: ticks per second)
+ * \brief MUST return number of ticks per second (Unit: ticks per second)
*/
attribute UInt8 Value readonly
}
interface IgnitionTime : VehicleCommonDataType {
/*!
- * \brief must return time at ignition on
+ * \brief MUST return time at ignition on
*/
attribute UInt64 ignitionOnTime readonly
/*!
- * \brief must return time at ignition off
+ * \brief MUST return time at ignition off
*/
attribute UInt64 ignitionOffTime readonly
};
@@ -1344,7 +1438,7 @@ interface IgnitionTime : VehicleCommonDataType {
interface org.automotive.YawRate extends VehiclePropertyType {
/*!
- * \brief must return yaw rate of vehicle. (Unit: degrees per second)
+ * \brief MUST return yaw rate of vehicle. (Unit: degrees per second)
*/
attribute Int16 Value readonly
}
@@ -1352,12 +1446,12 @@ interface org.automotive.YawRate extends VehiclePropertyType {
interface org.automotive.BrakeOperation extends VehiclePropertyType {
/*!
- * \brief must return whether brake pedal is depressed or not. true: brake pedal is depressed, false: brake pedal is not depressed
+ * \brief MUST return whether brake pedal is depressed or not. true: brake pedal is depressed, false: brake pedal is not depressed
*/
attribute Boolean BrakePedalDepressed readonly
}
-enum Button {
+enumeration Button {
home = "home",
back = "back",
search = "search",
@@ -1375,7 +1469,7 @@ enum Button {
down = "down"
}
-enum ButtonEventType {
+enumeration ButtonEventType {
press = "press",
long_press = "long_press",
release = "release"
@@ -1383,12 +1477,12 @@ enum ButtonEventType {
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;
}
@@ -1396,7 +1490,7 @@ interface VehicleButton {
interface org.automotive.ButtonEvent extends VehiclePropertyType {
/*!
- * \brief must return the button events that occured. This supports multiple simultanious button events.
+ * \brief MUST return the button events that occured. This supports multiple simultanious button events.
*/
attribute array Button of VehicleButton readonly;
}
@@ -1404,12 +1498,12 @@ interface org.automotive.ButtonEvent extends VehiclePropertyType {
interface org.automotive.TransmissionOil extends VehiclePropertyType {
/*!
- * \brief must return current temperature of the transmission oil(Unit: celsius).
+ * \brief MUST return current temperature of the transmission oil(Unit: celsius).
*/
attribute Int8 Temperature readonly;
/*!
- * \brief must return transmission oil wear (Unit: percentage, 0: no wear, 100: completely worn).
+ * \brief MUST return transmission oil wear (Unit: percentage, 0: no wear, 100: completely worn).
*/
attribute UInt8 Wear readonly;
}
@@ -1417,7 +1511,7 @@ interface org.automotive.TransmissionOil extends VehiclePropertyType {
interface org.automotive.TransmissionClutch extends VehiclePropertyType {
/*!
- * \brief must return transmission clutch wear (Unit: percentage, 0: no wear, 100: completely worn).
+ * \brief MUST return transmission clutch wear (Unit: percentage, 0: no wear, 100: completely worn).
*/
attribute UInt8 Wear readonly;
}
@@ -1425,22 +1519,22 @@ interface org.automotive.TransmissionClutch extends VehiclePropertyType {
interface org.automotive.BrakeMaintenance extends VehiclePropertyType {
/*!
- * \brief must return brake pad wear (Unit: percentage, 0%: no wear, 100%: completely worn).
+ * \brief MUST return brake pad wear (Unit: percentage, 0%: no wear, 100%: completely worn).
*/
attribute UInt8 PadWear readonly;
/*!
- * \brief must return brake fluid level (Unit: percentage, 0%: empty, 100%: full).
+ * \brief MUST return brake fluid level (Unit: percentage, 0%: empty, 100%: full).
*/
attribute UInt8 FluidLevel readonly;
/*!
- * \brief must return true if brake fluid level: low (true), not low (false)
+ * \brief MUST return true if brake fluid level: low (true), not low (false)
*/
attribute Boolean FluidLevelLow readonly;
/*!
- * \brief must return true if brakes are worn: worn (true), not worn (false)
+ * \brief MUST return true if brakes are worn: worn (true), not worn (false)
*/
attribute Boolean BrakesWorn readonly;
}
@@ -1448,12 +1542,12 @@ interface org.automotive.BrakeMaintenance extends VehiclePropertyType {
interface org.automotive.WasherFluid extends VehiclePropertyType {
/*!
- * \brief must return washer fluid level (Unit: percentage, 0%: empty, 100%: full).
+ * \brief MUST return washer fluid level (Unit: percentage, 0%: empty, 100%: full).
*/
attribute UInt8 Level readonly;
/*!
- * \brief must return true if washer fluid level is low: low (true), not low: (false)
+ * \brief MUST return true if washer fluid level is low: low (true), not low: (false)
*/
attribute Boolean LevelLow readonly;
}
@@ -1461,10 +1555,232 @@ interface org.automotive.WasherFluid extends VehiclePropertyType {
interface org.automotive.MalfunctionIndicator extends VehiclePropertyType {
/*!
- * \brief must return true if washer fluid level is low: low (true), not low: (false)
+ * \brief MUST return true if washer fluid level is low: low (true), not low: (false)
*/
attribute Boolean On readonly;
}
+interface org.automotive.Diagnostic extends VehiclePropertyType {
+
+ /*!
+ * \brief MUST return engine runtime (Unit: seconds)
+ */
+ attribute UInt32 AccumulatedEngineRuntime readonly;
+
+ /*!
+ * \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)
+ */
+ attribute UInt32 DistanceWithMILOn readonly;
+
+ /*!
+ * \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)
+ */
+ attribute UInt32 TimeTroubleCodeClear readonly;
+}
+
+interface org.automotive.Mirror extends VehiclePropertyType {
+
+ /*!
+ * \brief MUST return mirror pan position in percentage distance travelled, from left to right position (Unit: percentage, %0: center position, -100%: fully left, 100%: fully right)
+ */
+ attribute UInt8 MirrorPan;
+
+ /*!
+ * \brief MUST return mirror tilt position in percentage distance travelled, from downward-facing to upward-facing position (Unit: percentage, 0%:center position, -100%:fully downward, 100%:full upward)
+ */
+ attribute UInt8 MirrorTilt;
+}
+
+interface org.automotive.SeatAdjustment extends VehiclePropertyType {
+
+ /*!
+ * \brief MUST return seat back recline position as percent to completely reclined (Unit: percentage, 0%: fully forward, 100%: fully reclined)
+ */
+ attribute UInt8 ReclineSeatBack;
+
+ /*!
+ * \brief MUST return seat slide position as percentage of distance travelled away from forwardmost position (Unit: percentage, 0%: farthest forward, 100%: farthest back)
+ */
+ attribute UInt8 SeatSlide;
+
+ /*!
+ * \brief MUST return seat cushion height position as a percentage of upward distance travelled (Unit: percentage, 0%:lowest. 100%:highest)
+ */
+ attribute UInt8 SeatCushionHeight;
+
+ /*!
+ * \brief MUST return headrest position as a percentage of upward distance travelled (Unit: percentage, 0%: lowest, 100%: highest)
+ */
+ attribute UInt8 SeatHeadrest;
+
+ /*!
+ * \brief MUST return back cushion position as a percentage of lumbar curvature (Unit: percentage, 0%: flat, 100%: maximum curvature)
+ */
+ attribute UInt8 SeatBackCushion;
+
+ /*!
+ * \brief MUST return sides of back cushion position as a percentage of curvature (Unit: percentage, 0%: flat, 100%: maximum curvature)
+ */
+ attribute UInt8 SeatSideCushion;
+}
+
+enumeration DriveModeType {
+ comfort = "comfort",
+ auto = "auto",
+ sport = "sport",
+ eco = "eco",
+ manual = "manual",
+ winter = "winter"
+};
+
+interface org.automotive.DriveMode extends VehiclePropertyType {
+ /*!
+ * \brief MUST return vehicle drive mode. See http://w3c.github.io/automotive-bg/data_spec.html#idl-def-DriveModeEnum
+ */
+ attribute DriveModeType DriveMode;
+}
+
+interface org.automotive.DashboardIllumination extends VehiclePropertyType {
+ /*!
+ * \brief MUST return illumination of dashboard as a percentage (Unit: percentage, 0%: none, 100%: maximum illumination)
+ */
+ attribute UInt8 DashboardIllumination;
+}
+
+interface org.automotive.VehicleSound extends VehiclePropertyType {
+ /*!
+ * \brief MUST return active noise control status: not-activated (false), activated (true)
+ */
+ attribute Boolean ActiveNoiseControlMode;
+
+ /*!
+ * \brief MUST return active noise control status: not-activated (false), activated (true)
+ */
+ attribute Boolean EngineSoundEnhancementMode;
+
+ /*!
+ * \brief MUST return array of available sounds. See EngineSoundEnhancementMode
+ */
+ attribute array EngineSoundEnhancementMode of String readonly;
+}
+
+interface org.automotive.ElectronicStabilityControl extends VehiclePropertyType {
+ /*!
+ * \brief MUST return whether or not the ESC Setting is enabled: enabled (true) or disabled (false)
+ */
+ attribute Boolean Enabled readonly;
+
+ /*!
+ * \brief MUST return whether or not the ESC is engaged: engaged (true) or idle (false)
+ */
+ attribute Boolean Engaged readonly;
+}
+
+interface org.automotive.TopSpeedLimit extends VehiclePropertyType {
+ /*!
+ * \brief MUST return whether or not the ESC Setting is enabled: enabled (true) or disabled (false)
+ */
+ attribute UInt16 Speed readonly;
}
+interface org.automotive.ChildSafetyLock extends VehiclePropertyType {
+ /*!
+ * \brief MUST return whether or not the Child Safety Lock is locked: locked (true) or unlocked (false)
+ */
+ attribute Boolean Lock;
+}
+
+enumeration OccupantStatus {
+ adult = "adult",
+ child = "child",
+ vacant = "vacant"
+};
+
+enumeration IdentificationTypeEnum {
+ pin = "pin",
+ keyfob = "keyfob",
+ Bluetooth = "Bluetooth",
+ NFC = "NFC",
+ fingerprint = "fingerprint",
+ camera = "camera",
+ voice = "voice"
+};
+
+interface org.automotive.Seat extends VehiclePropertyType {
+ /*!
+ * \brief MUST return the status of seat occupant
+ */
+ attribute OccupantStatus Occupant;
+
+ /*!
+ * \brief MUST return whether or not the seat belt is fastened: fastened (true) or unfastened (false)
+ */
+ attribute Boolean SeatBelt;
+
+ /*!
+ * \brief MUST return occupant identifier
+ */
+ attribute String OccupantName;
+
+ /*!
+ * \brief MUST return identification type
+ */
+ attribute IdentificationTypeEnum IdentificationType;
+}
+
+interface org.automotive.AtmosphericPressure extends VehiclePropertyType {
+ /*!
+ * \brief MUST return the current atmospheric pressure outside of the vehicle (Unit: hectopascal)
+ */
+ attribute UInt16 Pressure;
+}
+
+enumeration LaneDepartureStatus {
+ off = "off",
+ pause = "pause",
+ running = "running"
+};
+
+interface org.automotive.LaneDepartureDetection extends VehiclePropertyType {
+ /*!
+ * \brief MUST return current status of Lane departure warning function.
+ */
+ attribute LaneDepartureStatus Status readonly;
+}
+
+enumeration AlarmStatus {
+ disarmed = "disarmed",
+ prearmed = "prearmed",
+ armed = "armed",
+ alarmed = "alarmed"
+};
+
+interface org.automotive.Alarm extends VehiclePropertyType {
+ /*!
+ * \brief MUST return the current status of vehicle Alarm System.
+ */
+ attribute AlarmStatus Status;
+}
+
+enumeration ParkingBrakeStatus {
+ inactive = "inactive",
+ active = "active",
+ error = "error"
+};
+
+interface org.automotive.ParkingBrake extends VehiclePropertyType {
+ /*!
+ * \brief MUST return the current status of vehicle Alarm System.
+ */
+ attribute ParkingBrakeStatus Status readonly;
+}
diff --git a/docs/dbus.idl b/docs/dbus.idl
index a14ac1e0..29cb4683 100644
--- a/docs/dbus.idl
+++ b/docs/dbus.idl
@@ -9,15 +9,15 @@
* /{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.idl">amb.idl</a>. Franca IDL
+* 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.
*
* \section basic_usage Basic Recommended Usage
*
-* It is recomended that the Manager interface be used to find the DBus Object that contains the
+* 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.
+* 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:
diff --git a/examples/websocketsink2.in b/examples/websocketsink2.in
index 8e631781..b326dbba 100644
--- a/examples/websocketsink2.in
+++ b/examples/websocketsink2.in
@@ -3,7 +3,7 @@
{
"name" : "ExampleSouce",
"path" : "@PLUGIN_INSTALL_PATH@/examplesourceplugin.so",
- "delay" : "6"
+ "delay" : "10000"
}
],
"sinks": [
diff --git a/lib/abstractpropertytype.h b/lib/abstractpropertytype.h
index 340b66f5..0157b530 100644
--- a/lib/abstractpropertytype.h
+++ b/lib/abstractpropertytype.h
@@ -34,6 +34,7 @@
#include "timestamp.h"
#include <debugout.h>
#include <boost/algorithm/string.hpp>
+#include <superptr.hpp>
class Zone {
@@ -291,38 +292,6 @@ public:
};
template <>
-class GVS<uint8_t>
-{
-public:
- static const char* signature() { return "y"; }
-
- static uint8_t value(GVariant* v)
- {
- return g_variant_get_byte(v);
- }
- static std::string stringize(std::string v)
- {
- return v;
- }
-};
-
-template <>
-class GVS<int8_t>
-{
-public:
- static const char* signature() { return "q"; }
-
- static int8_t value(GVariant* v)
- {
- return g_variant_get_int16(v);
- }
- static std::string stringize(std::string v)
- {
- return v;
- }
-};
-
-template <>
class GVS<uint16_t>
{
public:
@@ -453,7 +422,8 @@ public:
{
mValue = T();
}
- BasicPropertyType(BasicPropertyType const &other)
+
+ BasicPropertyType(BasicPropertyType const & other)
:AbstractPropertyType(other.name)
{
setValue(other.value<T>());
@@ -726,7 +696,7 @@ public:
}
};
-template <class T>
+template <class T = AbstractPropertyType>
class ListPropertyType: public AbstractPropertyType
{
public:
@@ -737,19 +707,19 @@ public:
}
- ListPropertyType(std::string propertyName, AbstractPropertyType *value)
+ ListPropertyType(std::string propertyName, T value)
: AbstractPropertyType(propertyName), initialized(false)
{
- appendPriv(value->copy());
+ appendPriv(value);
}
ListPropertyType(ListPropertyType & other)
:AbstractPropertyType(other.name),initialized(false)
{
- std::list<AbstractPropertyType*> l = other.list();
- for(auto itr = l.begin(); itr != l.end(); itr++)
+ std::vector<T> l = other.list();
+ for(auto i : l)
{
- append(*itr);
+ append(i);
}
timestamp = other.timestamp;
@@ -764,25 +734,18 @@ public:
clear();
}
- /** append - appends a property to the list
+ /** \brief append - appends a property to the list
* @arg property - property to be appended.
- * ListPropertyType makes a copy of the property.
- * You are responsible for freeing property.
**/
- void append(AbstractPropertyType* property)
+ void append(T property)
{
if(!initialized)
{
- for(auto itr = mList.begin(); itr != mList.end(); itr++)
- {
- AbstractPropertyType *p = *itr;
- delete p;
- }
mList.clear();
initialized = true;
}
- appendPriv(property->copy());
+ appendPriv(property);
}
uint count()
@@ -795,6 +758,18 @@ public:
return new ListPropertyType(*this);
}
+ void quickCopy(AbstractPropertyType* other)
+ {
+ AbstractPropertyType::quickCopy(other);
+ ListPropertyType<T>* v = static_cast<ListPropertyType<T>*>(other);
+ if(!v)
+ {
+ DebugOut(DebugOut::Error) << "ListPropertyType Quick Copy failed" << endl;
+ return;
+ }
+ mList = v->list();
+ }
+
std::string toString() const
{
std::string str = "[";
@@ -804,9 +779,9 @@ public:
if(str != "[")
str += ",";
- AbstractPropertyType* t = *itr;
+ T t = *itr;
- str += t->toString();
+ str += t.toString();
}
str += "]";
@@ -822,13 +797,11 @@ public:
if(!str.length())
return;
- if(str[0] != '[' && str[str.length()-1] != ']')
+ if(str[0] == '[' && str[str.length()-1] == ']')
{
- return;
+ str = str.substr(1,str.length() - 2);
}
- str = str.substr(1,str.length() - 2);
-
std::vector<std::string> elements;
std::istringstream f(str);
@@ -837,8 +810,9 @@ public:
while(std::getline(f,element,','))
{
T foo("", element);
- append (&foo);
+ append (foo);
}
+ timestamp = amb::currentTime();
}
@@ -850,11 +824,10 @@ public:
for(auto itr = mList.begin(); itr != mList.end(); itr++)
{
- AbstractPropertyType* t = *itr;
- GVariant *var = t->toVariant();
- GVariant *newvar = g_variant_new("v",var);
+ T t = *itr;
+ auto var = t.toVariant();
+ GVariant *newvar = g_variant_new("v", var);
g_variant_builder_add_value(&params, newvar);
-
}
GVariant* var = g_variant_builder_end(&params);
@@ -873,33 +846,29 @@ public:
{
GVariant *childvariant = g_variant_get_child_value(v,i);
GVariant *innervariant = g_variant_get_variant(childvariant);
- T *t = new T("");
- t->fromVariant(innervariant);
+ T t;
+ t.fromVariant(innervariant);
appendPriv(t);
}
}
- std::list<AbstractPropertyType*> list() { return mList; }
+ std::vector<T> list() { return mList; }
private:
void clear()
{
- for(auto itr = mList.begin(); itr != mList.end(); itr++)
- {
- delete *itr;
- }
mList.clear();
}
- void appendPriv(AbstractPropertyType* i)
+ void appendPriv(T i)
{
mList.push_back(i);
}
bool initialized;
- std::list<AbstractPropertyType*> mList;
+ std::vector<T> mList;
};
#endif
diff --git a/lib/abstractroutingengine.cpp b/lib/abstractroutingengine.cpp
index 5012272a..0ebfb473 100644
--- a/lib/abstractroutingengine.cpp
+++ b/lib/abstractroutingengine.cpp
@@ -63,7 +63,8 @@ void AsyncPropertyReply::setTimeout()
thisReply->error = Timeout;
if(thisReply->timedout)
thisReply->timedout(thisReply);
- thisReply->completed(thisReply);
+ if(thisReply->completed)
+ thisReply->completed(thisReply);
}
return 0;
};
diff --git a/lib/abstractroutingengine.h b/lib/abstractroutingengine.h
index 5605ef4f..7afae61d 100644
--- a/lib/abstractroutingengine.h
+++ b/lib/abstractroutingengine.h
@@ -349,9 +349,9 @@ public:
/**
* /brief sourcesForProperty
* /param property
- * /return list of source uuid's that support the "property"
+ * /return vector of source uuid's that support the "property"
*/
- virtual std::list<std::string> sourcesForProperty(const VehicleProperty::Property & property) = 0;
+ virtual std::vector<std::string> sourcesForProperty(const VehicleProperty::Property & property) = 0;
/**
* /brief getPropertyAsync requests a property value from a source. This call has a timeout and the callback specified in the request will always be called.
diff --git a/lib/abstractsource.h b/lib/abstractsource.h
index eebabec0..5868dbf1 100644
--- a/lib/abstractsource.h
+++ b/lib/abstractsource.h
@@ -1,19 +1,19 @@
/*
- Copyright (C) 2012 Intel Corporation
+ Copyright (C) 2012 Intel Corporation
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -53,7 +53,7 @@ public:
AbstractSource(AbstractRoutingEngine* engine, map<string, string> config);
virtual ~AbstractSource();
-
+
///pure virtual methods:
/*!
@@ -107,7 +107,7 @@ public:
* \return a PropertyInfo object.
*/
virtual PropertyInfo getPropertyInfo(const VehicleProperty::Property & property);
-
+
/*!
* \brief supported
* \return returns the supported properties.
@@ -120,7 +120,7 @@ protected:
* @see AbstractRoutingEngine
*/
AbstractRoutingEngine* routingEngine;
-
+
private:
AbstractSource():AbstractSink(nullptr, std::map<std::string,std::string>()) { }
};
diff --git a/lib/asyncqueue.hpp b/lib/asyncqueue.hpp
index 42447b4e..3602bb97 100644
--- a/lib/asyncqueue.hpp
+++ b/lib/asyncqueue.hpp
@@ -22,6 +22,7 @@
#include "listplusplus.h"
#include <mutex>
+#include <condition_variable>
#include <unordered_set>
namespace amb
@@ -31,10 +32,12 @@ template <typename T, class Pred = std::equal_to<T> >
class Queue
{
public:
- Queue()
+ Queue(bool blocking = false)
+ :mBlocking(blocking)
{
}
+
virtual ~Queue()
{
@@ -49,7 +52,15 @@ public:
T pop()
{
- std::lock_guard<std::mutex> lock(mutex);
+ std::unique_lock<std::mutex> lock(mutex);
+
+ if(mBlocking)
+ {
+ while(!mQueue.size())
+ {
+ cond.wait(lock);
+ }
+ }
auto itr = mQueue.begin();
@@ -65,6 +76,11 @@ public:
std::lock_guard<std::mutex> lock(mutex);
mQueue.insert(item);
+
+ if(mBlocking)
+ {
+ cond.notify_one();
+ }
}
void remove(T item)
@@ -74,7 +90,9 @@ public:
}
protected:
+ bool mBlocking;
std::mutex mutex;
+ std::condition_variable cond;
std::unordered_set<T, std::hash<T>, Pred> mQueue;
};
diff --git a/lib/vehicleproperty.cpp b/lib/vehicleproperty.cpp
index 87230800..35b58cc6 100644
--- a/lib/vehicleproperty.cpp
+++ b/lib/vehicleproperty.cpp
@@ -64,11 +64,57 @@ const char* Door::W3C::Closed = "closed";
const char* Door::W3C::Open = "open";
const char* Door::W3C::Ajar = "ajar";
+const char* Seat::W3C::Vacant = "vacant";
+const char* Seat::W3C::Child = "child";
+const char* Seat::W3C::Adult = "adult";
+
+const char* Seat::W3C::Pin = "pin";
+const char* Seat::W3C::Keyfob = "keyfob";
+const char* Seat::W3C::Bluetooth = "Bluetooth";
+const char* Seat::W3C::NFC = "NFC";
+const char* Seat::W3C::Fingerprint = "fingerprint";
+const char* Seat::W3C::Camera = "camera";
+const char* Seat::W3C::Voice = "voice";
+
const char* HVAC::W3C::FloorPanel = "floorpanel";
const char* HVAC::W3C::FloorDuct = "floorduct";
const char* HVAC::W3C::Bilevel = "bilevel";
const char* HVAC::W3C::DefrostFloor = "defrostfloor";
+const char* Drive::W3C::Auto = "auto";
+const char* Drive::W3C::Comfort = "comfort";
+const char* Drive::W3C::Sport = "sport";
+const char* Drive::W3C::Eco = "eco";
+const char* Drive::W3C::Manual = "manual";
+const char* Drive::W3C::Winter = "winter";
+
+const char * WiperSpeedSetting::W3C::Off = "off";
+const char * WiperSpeedSetting::W3C::Once = "once";
+const char * WiperSpeedSetting::W3C::Slowest = "slowest";
+const char * WiperSpeedSetting::W3C::Slow = "slow";
+const char * WiperSpeedSetting::W3C::Middle = "middle";
+const char * WiperSpeedSetting::W3C::Fast = "fast";
+const char * WiperSpeedSetting::W3C::Fastest = "fastest";
+const char * WiperSpeedSetting::W3C::Auto = "auto";
+
+const char * ConvertibleRoofW3C::Closed = "closed";
+const char * ConvertibleRoofW3C::Closing = "closing";
+const char * ConvertibleRoofW3C::Opened = "opened";
+const char * ConvertibleRoofW3C::Opening = "opening";
+
+const char * LaneDeparture::W3C::Off = "off";
+const char * LaneDeparture::W3C::Pause = "pause";
+const char * LaneDeparture::W3C::Running = "running";
+
+const char * Security::W3C::Alarmed = "alarmed";
+const char * Security::W3C::Armed = "armed";
+const char * Security::W3C::Disarmed = "disarmed";
+const char * Security::W3C::Prearmed = "prearmed";
+
+const char * ParkingBrake::W3C::Inactive = "inactive";
+const char * ParkingBrake::W3C::Active = "active";
+const char * ParkingBrake::W3C::Error = "error";
+
const VehicleProperty::Property VehicleProperty::NoValue = "NoValue";
const VehicleProperty::Property VehicleProperty::VehicleSpeed = "VehicleSpeed";
const VehicleProperty::Property VehicleProperty::EngineSpeed = "EngineSpeed";
@@ -161,11 +207,16 @@ const VehicleProperty::Property VehicleProperty::WasherFluidLevel = "WasherFluid
const VehicleProperty::Property VehicleProperty::WasherFluidLevelLow = "WasherFluidLevelLow";
const VehicleProperty::Property VehicleProperty::SecurityAlertStatus = "SecurityAlertStatus";
const VehicleProperty::Property VehicleProperty::ParkingBrakeStatus = "ParkingBrakeStatus";
+const VehicleProperty::Property VehicleProperty::ParkingBrakeStatusW3C = "ParkingBrakeStatusW3C";
const VehicleProperty::Property VehicleProperty::ParkingLightStatus = "ParkingLightStatus";
const VehicleProperty::Property VehicleProperty::HazardLightStatus = "HazardLightStatus";
const VehicleProperty::Property VehicleProperty::AirbagStatus = "AirbagStatus";
+const VehicleProperty::Property VehicleProperty::AirbagDeployed = "AirbagDeployed";
+const VehicleProperty::Property VehicleProperty::AirbagActivated = "AirbagActivated";
const VehicleProperty::Property VehicleProperty::AntilockBrakingSystem = "AntilockBrakingSystem";
+const VehicleProperty::Property VehicleProperty::AntilockBrakingSystemEnabled = "AntilockBrakingSystemEnabled";
const VehicleProperty::Property VehicleProperty::TractionControlSystem = "TractionControlSystem";
+const VehicleProperty::Property VehicleProperty::TractionControlSystemEnabled = "TractionControlSystemEnabled";
const VehicleProperty::Property VehicleProperty::VehicleTopSpeedLimit = "VehicleTopSpeedLimit";
const VehicleProperty::Property VehicleProperty::DoorStatus = "DoorStatus";
const VehicleProperty::Property VehicleProperty::DoorStatusW3C = "DoorStatusW3C";
@@ -174,9 +225,12 @@ const VehicleProperty::Property VehicleProperty::ChildLockStatus = "ChildLockSta
const VehicleProperty::Property VehicleProperty::SeatBeltStatus = "SeatBeltStatus";
const VehicleProperty::Property VehicleProperty::WindowLockStatus = "WindowLockStatus";
const VehicleProperty::Property VehicleProperty::OccupantStatus = "OccupantStatus";
+const VehicleProperty::Property VehicleProperty::OccupantStatusW3C = "OccupantStatusW3C";
const VehicleProperty::Property VehicleProperty::ObstacleDistance = "ObstacleDistance";
const VehicleProperty::Property VehicleProperty::RainSensor = "RainSensor";
const VehicleProperty::Property VehicleProperty::WindshieldWiper = "WindshieldWiper";
+const VehicleProperty::Property VehicleProperty::WindshieldWiperSpeed = "WindshieldWiperSpeed";
+const VehicleProperty::Property VehicleProperty::WindshieldWiperSetting = "WindshieldWiperSetting";
const VehicleProperty::Property VehicleProperty::AirflowDirection = "AirflowDirection";
const VehicleProperty::Property VehicleProperty::AirflowDirectionW3C = "AirflowDirectionW3C";
const VehicleProperty::Property VehicleProperty::FanSpeed = "FanSpeed";
@@ -194,14 +248,15 @@ const VehicleProperty::Property VehicleProperty::WindowStatus = "WindowStatus";
const VehicleProperty::Property VehicleProperty::Sunroof = "Sunroof";
const VehicleProperty::Property VehicleProperty::SunroofTilt = "SunroofTilt";
const VehicleProperty::Property VehicleProperty::ConvertibleRoof = "ConvertibleRoof";
+const VehicleProperty::Property VehicleProperty::ConvertibleRoofStatus = "ConvertibleRoofStatus";
const VehicleProperty::Property VehicleProperty::NightMode = "NightMode";
const VehicleProperty::Property VehicleProperty::DrivingMode = "DrivingMode";
const VehicleProperty::Property VehicleProperty::DrivingModeW3C = "DrivingModeW3C";
const VehicleProperty::Property VehicleProperty::KeyId = "KeyId";
const VehicleProperty::Property VehicleProperty::Language = "Language";
const VehicleProperty::Property VehicleProperty::MeasurementSystem = "MeasurementSystem";
-const VehicleProperty::Property VehicleProperty::MirrorSettingPan = "MirrorPanSetting";
-const VehicleProperty::Property VehicleProperty::MirrorSettingTilt= "MirrorTiltSetting";
+const VehicleProperty::Property VehicleProperty::MirrorSettingPan = "MirrorSettingPan";
+const VehicleProperty::Property VehicleProperty::MirrorSettingTilt= "MirrorSettingTilt";
const VehicleProperty::Property VehicleProperty::SteeringWheelPositionSlide = "SteeringWheelPositionSlide";
const VehicleProperty::Property VehicleProperty::SteeringWheelPositionTilt = "SteeringWheelPositionTilt";
const VehicleProperty::Property VehicleProperty::SeatPositionRecline = "SeatPositionRecline";
@@ -227,6 +282,22 @@ const VehicleProperty::Property VehicleProperty::TransmissionClutchWear = "Trans
const VehicleProperty::Property VehicleProperty::BrakePadWear = "BrakePadWear";
const VehicleProperty::Property VehicleProperty::BrakeFluidLevelLow = "BrakeFluidLevelLow";
const VehicleProperty::Property VehicleProperty::MalfunctionIndicatorOn = "MalfunctionIndicatorOn";
+const VehicleProperty::Property VehicleProperty::AccumulatedEngineRuntime = "AccumulatedEngineRuntime";
+const VehicleProperty::Property VehicleProperty::DistanceSinceCodeCleared = "DistanceSinceCodeCleared";
+const VehicleProperty::Property VehicleProperty::DistanceWithMILOn = "DistanceWithMILOn";
+const VehicleProperty::Property VehicleProperty::TimeRunMILOn = "TimeRunMILOn";
+const VehicleProperty::Property VehicleProperty::TimeTroubleCodeClear = "TimeTroubleCodeClear";
+const VehicleProperty::Property VehicleProperty::VehicleDriveMode = "VehicleDriveMode";
+const VehicleProperty::Property VehicleProperty::ActiveNoiseControlMode = "ActiveNoiseControlMode";
+const VehicleProperty::Property VehicleProperty::AvailableSounds = "AvailableSounds";
+const VehicleProperty::Property VehicleProperty::EngineSoundEnhancementMode = "EngineSoundEnhancementMode";
+const VehicleProperty::Property VehicleProperty::ElectronicStabilityControlEnabled = "ElectronicStabilityControlEnabled";
+const VehicleProperty::Property VehicleProperty::ElectronicStabilityControlEngaged = "ElectronicStabilityControlEngaged";
+const VehicleProperty::Property VehicleProperty::OccupantIdentificationType = "OccupantIdentificationType";
+const VehicleProperty::Property VehicleProperty::OccupantName = "OccupantName";
+const VehicleProperty::Property VehicleProperty::AtmosphericPressure = "AtmosphericPressure";
+const VehicleProperty::Property VehicleProperty::LaneDepartureStatus = "LaneDepartureStatus";
+const VehicleProperty::Property VehicleProperty::AlarmStatus = "AlarmStatus";
PropertyList VehicleProperty::mCapabilities;
PropertyList VehicleProperty::mCustomProperties;
@@ -274,7 +345,7 @@ VehicleProperty::VehicleProperty()
registerPropertyPriv(TripMeters, [](){
TripMetersType* t = new TripMetersType();
BasicPropertyType<uint16_t> v(0);
- t->append(&v);
+ t->append(v);
return t;
});
@@ -315,7 +386,12 @@ VehicleProperty::VehicleProperty()
REGISTERPROPERTY(Altitude, 0);
REGISTERPROPERTY(Direction, 0);
REGISTERPROPERTY(VehicleType, Vehicle::Unknown);
- registerPropertyPriv(DoorsPerRow, []() { BasicPropertyType<uint16_t> d(0); return new DoorsPerRowType(&d); });
+ registerPropertyPriv(DoorsPerRow, []() {
+ BasicPropertyType<uint16_t> d(0);
+ DoorsPerRowType* doors = new DoorsPerRowType();
+ doors->append(d);
+ return doors;
+ });
REGISTERPROPERTY(TransmissionGearType, Transmission::Unknown);
REGISTERPROPERTY(FrontWheelRadius, 0);
REGISTERPROPERTY(RearWheelRadius, 0);
@@ -330,12 +406,18 @@ VehicleProperty::VehicleProperty()
REGISTERPROPERTY(WasherFluidLevelLow, false);
REGISTERPROPERTY(SecurityAlertStatus, Security::Idle);
REGISTERPROPERTY(ParkingBrakeStatus, false);
+ REGISTERPROPERTY(ParkingBrakeStatusW3C, "");
REGISTERPROPERTY(ParkingLightStatus, false);
REGISTERPROPERTY(HazardLightStatus, false);
+ /// TODO: deprecated in 0.14
REGISTERPROPERTY(AirbagStatus, Airbag::Inactive);
+ REGISTERPROPERTY(AirbagActivated, false);
+ REGISTERPROPERTY(AirbagDeployed, false);
REGISTERPROPERTY(AntilockBrakingSystem, false);
+ REGISTERPROPERTY(AntilockBrakingSystemEnabled, false);
REGISTERPROPERTY(TractionControlSystem, false);
+ REGISTERPROPERTY(TractionControlSystemEnabled, false);
REGISTERPROPERTY(VehicleTopSpeedLimit, 0);
REGISTERPROPERTY(DoorStatus, Door::Closed);
@@ -343,12 +425,16 @@ VehicleProperty::VehicleProperty()
REGISTERPROPERTY(DoorLockStatus, false);
REGISTERPROPERTY(ChildLockStatus, false);
REGISTERPROPERTY(SeatBeltStatus, false);
+ /// TODO: deprecated in 0.14
REGISTERPROPERTY(OccupantStatus, Seat::Vacant);
+ REGISTERPROPERTY(OccupantStatusW3C, Seat::W3C::Vacant);
REGISTERPROPERTY(WindowLockStatus, false);
REGISTERPROPERTY(ObstacleDistance, 0);
REGISTERPROPERTY(RainSensor, 0);
REGISTERPROPERTY(WindshieldWiper, Window::Off);
+ REGISTERPROPERTY(WindshieldWiperSpeed, WiperSpeedSetting::W3C::Off);
+ REGISTERPROPERTY(WindshieldWiperSetting, WiperSpeedSetting::W3C::Off);
REGISTERPROPERTY(AirflowDirection, HVAC::Front);
REGISTERPROPERTY(AirflowDirectionW3C, HVAC::W3C::FloorPanel);
REGISTERPROPERTY(FanSpeed, 0);
@@ -368,6 +454,8 @@ VehicleProperty::VehicleProperty()
REGISTERPROPERTY(Sunroof, 0);
REGISTERPROPERTY(SunroofTilt, 0);
REGISTERPROPERTY(ConvertibleRoof, false);
+ REGISTERPROPERTY(ConvertibleRoofStatus, "");
+
REGISTERPROPERTY(NightMode, false);
REGISTERPROPERTY(DrivingMode, Driving::None);
REGISTERPROPERTY(DrivingModeW3C, false);
@@ -400,13 +488,33 @@ VehicleProperty::VehicleProperty()
t->append(k, v);
return t;
});
-
REGISTERPROPERTY(TransmissionOilWear, 0);
REGISTERPROPERTY(TransmissionOilTemperature, 0);
REGISTERPROPERTY(TransmissionClutchWear, 0);
REGISTERPROPERTY(BrakePadWear, 0);
REGISTERPROPERTY(BrakeFluidLevelLow, false);
- REGISTERPROPERTY(MalfunctionIndicatorOn, false)
+ REGISTERPROPERTY(MalfunctionIndicatorOn, false);
+ REGISTERPROPERTY(AccumulatedEngineRuntime, 0);
+ REGISTERPROPERTY(DistanceSinceCodeCleared, 0);
+ REGISTERPROPERTY(DistanceWithMILOn, 0);
+ REGISTERPROPERTY(TimeRunMILOn, 0);
+ REGISTERPROPERTY(TimeTroubleCodeClear, 0);
+ REGISTERPROPERTY(VehicleDriveMode, "");
+ REGISTERPROPERTY(ActiveNoiseControlMode, false);
+ registerPropertyPriv(AvailableSounds, [](){
+ AvailableSoundsType* t = new AvailableSoundsType();
+ StringPropertyType v;
+ t->append(v);
+ return t;
+ });
+ REGISTERPROPERTY(EngineSoundEnhancementMode, "");
+ REGISTERPROPERTY(ElectronicStabilityControlEnabled, false);
+ REGISTERPROPERTY(ElectronicStabilityControlEngaged, false);
+ REGISTERPROPERTY(OccupantIdentificationType, Seat::W3C::Pin);
+ REGISTERPROPERTY(OccupantName, "");
+ REGISTERPROPERTY(AtmosphericPressure, 0);
+ REGISTERPROPERTY(LaneDepartureStatus, "");
+ REGISTERPROPERTY(AlarmStatus, "");
}
void VehicleProperty::factory()
@@ -476,3 +584,4 @@ bool VehicleProperty::registerPropertyPriv(VehicleProperty::Property name, Vehic
}
+
diff --git a/lib/vehicleproperty.h b/lib/vehicleproperty.h
index 1140d2d1..08792cdf 100644
--- a/lib/vehicleproperty.h
+++ b/lib/vehicleproperty.h
@@ -99,7 +99,7 @@ enum TransmissionPositions
Park = 255
};
-/** TODO: deprecate in 0.13. Replaced with Drive::Mode: **/
+/** TODO: deprecate in 0.14. Replaced with Drive::Mode: **/
enum Mode {
Normal=0,
Sports = 1,
@@ -133,7 +133,7 @@ namespace Power {
* Accessory2 = Vehicle is off and key is in Accessory2 position.
* Run = Vehichle is running. Key is in the running position.
*/
-enum PowerModes
+enum Modes
{
Off = 0,
Accessory1 = 1,
@@ -188,6 +188,15 @@ enum Status
Armed,
AlarmDetected
};
+
+namespace W3C
+{
+extern const char * Disarmed;
+extern const char * Prearmed;
+extern const char * Armed;
+extern const char * Alarmed;
+}
+
}
namespace Airbag {
@@ -226,23 +235,26 @@ enum Occupant
Child,
Adult
};
+namespace W3C
+{
+extern const char * Vacant;
+extern const char * Child;
+extern const char * Adult;
+
+extern const char * Pin;
+extern const char * Keyfob;
+extern const char * Bluetooth;
+extern const char * NFC ;
+extern const char * Fingerprint;
+extern const char * Camera;
+extern const char * Voice;
+}
+
+
}
namespace Window
{
-enum Location
-{
- Driver = 0,
- Passenger,
- LeftRear,
- RightRear,
- Sunroof,
- Windshield,
- SideMirrorLeft,
- SideMirrorRight,
- Rear
-};
-
enum WiperSpeed
{
Off = 0,
@@ -250,7 +262,29 @@ enum WiperSpeed
Fastest = 5,
Auto = 10
};
+}
+
+namespace ConvertibleRoofW3C
+{
+extern const char * Opened;
+extern const char * Opening;
+extern const char * Closed;
+extern const char * Closing;
+}
+namespace WiperSpeedSetting
+{
+namespace W3C
+{
+extern const char * Off;
+extern const char * Once;
+extern const char * Slowest;
+extern const char * Slow;
+extern const char * Middle;
+extern const char * Fast;
+extern const char * Fastest;
+extern const char * Auto;
+}
}
namespace HVAC
@@ -291,6 +325,17 @@ enum Mode {
OEMCustom1 = 3,
OEMCustom2 = 4
};
+
+namespace W3C
+{
+extern const char* Comfort;
+extern const char* Auto;
+extern const char* Sport;
+extern const char* Eco;
+extern const char* Manual;
+extern const char* Winter;
+}
+
}
namespace Measurement
@@ -303,6 +348,26 @@ enum Type
};
}
+namespace LaneDeparture
+{
+namespace W3C
+{
+extern const char * Off;
+extern const char * Pause;
+extern const char * Running;
+}
+}
+
+namespace ParkingBrake
+{
+namespace W3C
+{
+extern const char * Inactive;
+extern const char * Active;
+extern const char * Error;
+}
+}
+
#include <boost/preprocessor/comma.hpp>
#define PROPERTYTYPE(property, propertyType, baseClass, valueType) \
@@ -347,7 +412,6 @@ class VehicleProperty
public:
-
/*!
* \brief factory constructs a static instance of VehicleProperty. This should be called once before VehicleProperty is used in the app
*/
@@ -402,7 +466,7 @@ public:
BasicPropertyType<Transmission::TransmissionPositions>, Transmission::TransmissionPositions)
//typedef BasicPropertyType<Transmission::TransmissionPositions> TransmissionGearPositionType;
- /// TODO: deprecate in 0.13. Replaced by Drive::Mode
+ /// TODO: deprecate in 0.14. Replaced by Drive::Mode
static const Property TransmissionMode;
PROPERTYTYPE(TransmissionMode, TransmissionModeType,
BasicPropertyType<Transmission::Mode>, Transmission::Mode)
@@ -429,12 +493,12 @@ public:
//typedef BasicPropertyType<uint16_t> WheelBrakePressureType;
/**< Steering wheel angle (0-359)
- * TODO: Deprecate in 0.13. Replace with SteeringWheelAngleW3C
+ * TODO: Deprecate in 0.14. Replace with SteeringWheelAngleW3C
*/
static const Property SteeringWheelAngle;
PROPERTYTYPE(SteeringWheelAngle, SteeringWheelAngleType, BasicPropertyType<uint16_t>, uint16_t)
- /// TODO: Rename to "SteeringWheel" in 0.13
+ /// TODO: Rename to "SteeringWheel" in 0.14
static const Property SteeringWheelAngleW3C;
PROPERTYTYPEBASIC(SteeringWheelAngleW3C, int16_t)
@@ -477,6 +541,7 @@ public:
/**< Button Event @see ButtonEvents::ButtonEventType */
///TODO: deprecated. Use ButtonEventW3C. Remove in 0.14
+ [[deprecated("Depricated in 0.14. Use ButtonEventW3C")]]
static const Property ButtonEvent;
PROPERTYTYPE(ButtonEvent, ButtonEventType, BasicPropertyType<ButtonEvents::ButtonEventType>, ButtonEvents::ButtonEventType)
@@ -488,9 +553,6 @@ public:
};
-
-
-
/**< Air intake temperature in degrees celcius */
static const Property AirIntakeTemperature;
PROPERTYTYPE(AirIntakeTemperature, AirIntakeTemperatureType, BasicPropertyType<int>, int)
@@ -524,7 +586,7 @@ public:
PROPERTYTYPEBASIC(EngineOilRemaining, uint16_t)
static const Property EngineOilLifeRemaining;
- PROPERTYTYPEBASIC(EngineOilLifeRemaining, uint8_t)
+ PROPERTYTYPEBASIC(EngineOilLifeRemaining, uint16_t)
static const Property EngineOilChangeIndicator;
PROPERTYTYPEBASIC(EngineOilChangeIndicator, bool)
@@ -552,14 +614,14 @@ public:
PROPERTYTYPEBASIC(TireTemperature, int16_t)
/**< Vehicle Power Mode.
- *@see Power::PowerModes
+ *@see Power::Modes
*/
static const Property VehiclePowerMode;
- PROPERTYTYPE(VehiclePowerMode, VehiclePowerModeType, BasicPropertyType<Power::PowerModes> ,Power::PowerModes)
+ PROPERTYTYPE(VehiclePowerMode, VehiclePowerModeType, BasicPropertyType<Power::Modes>, Power::Modes)
//typedef BasicPropertyType<Power::PowerModes> VehiclePowerModeType;
static const Property TripMeters;
- PROPERTYTYPE(TripMeters, TripMetersType, ListPropertyType<BasicPropertyType<uint16_t> >, AbstractPropertyType*)
+ PROPERTYTYPE(TripMeters, TripMetersType, ListPropertyType<BasicPropertyType<uint16_t> >, uint16_t)
//typedef ListPropertyType<BasicPropertyType<uint16_t> > TripMetersType;
static const Property CruiseControlActive;
@@ -661,35 +723,28 @@ public:
PROPERTYTYPE(VehicleHeight, VehicleHeightType, BasicPropertyType<uint>, uint)
static const Property VehicleLength;
PROPERTYTYPE(VehicleLength, VehicleLengthType, BasicPropertyType<uint>, uint)
- //typedef BasicPropertyType<uint> VehicleSizeType;
static const Property VehicleType;
PROPERTYTYPE(VehicleType, VehicleTypeType, BasicPropertyType<Vehicle::Type>, Vehicle::Type)
- //typedef BasicPropertyType<Vehicle::Type> VehicleTypeType;
static const Property DoorsPerRow;
- PROPERTYTYPE(DoorsPerRow, DoorsPerRowType, ListPropertyType<BasicPropertyType<uint16_t> >, AbstractPropertyType*)
- //typedef ListPropertyType<BasicPropertyType<uint16_t> > DoorsPerRowType;
+ PROPERTYTYPE(DoorsPerRow, DoorsPerRowType, ListPropertyType<BasicPropertyType<uint16_t> >, uint16_t)
static const Property TransmissionGearType;
PROPERTYTYPE(TransmissionGearType, TransmissionGearTypeType, BasicPropertyType<Transmission::Type>, Transmission::Type)
- //typedef BasicPropertyType<Transmission::Type> TransmissionGearTypeType;
static const Property FrontWheelRadius;
PROPERTYTYPE(FrontWheelRadius, FrontWheelRadiusType, BasicPropertyType<uint16_t>, uint16_t)
static const Property RearWheelRadius;
PROPERTYTYPE(RearWheelRadius, RearWheelRadiusType, BasicPropertyType<uint16_t>, uint16_t)
-// /typedef BasicPropertyType<uint16_t> WheelRadiusType;
static const Property WheelTrack;
PROPERTYTYPE(WheelTrack, WheelTrackType, BasicPropertyType<uint>, uint)
-// typedef BasicPropertyType<uint> WheelTrackType;
static const Property BrakePressure;
PROPERTYTYPEBASIC(BrakePressure, uint16_t)
- //typedef BasicPropertyType<uint16_t> BrakePressureType;
- /// TODO: deprecated. remove in 0.13. Use DistanceTotal
+ /// TODO: deprecated. remove in 0.14. Use DistanceTotal
static const Property Odometer;
PROPERTYTYPEBASIC(Odometer, uint)
@@ -705,40 +760,44 @@ public:
PROPERTYTYPEBASIC(TransmissionFluidLevel, uint16_t)
static const Property TransmissionOilWear;
- PROPERTYTYPEBASIC(TransmissionOilWear, uint8_t)
+ PROPERTYTYPEBASIC(TransmissionOilWear, uint16_t)
static const Property TransmissionOilTemperature;
- PROPERTYTYPEBASIC(TransmissionOilTemperature, int8_t)
+ PROPERTYTYPEBASIC(TransmissionOilTemperature, int16_t)
static const Property TransmissionClutchWear;
- PROPERTYTYPEBASIC(TransmissionClutchWear, uint8_t)
+ PROPERTYTYPEBASIC(TransmissionClutchWear, uint16_t)
/**< Brake Fluid Level 0-100%.
**/
static const Property BrakeFluidLevel;
- PROPERTYTYPEBASIC(BrakeFluidLevel, uint8_t)
+ PROPERTYTYPEBASIC(BrakeFluidLevel, uint16_t)
/**< Washer Fluid Level 0-100%.
**/
static const Property WasherFluidLevel;
- PROPERTYTYPEBASIC(WasherFluidLevel, uint8_t)
+ PROPERTYTYPEBASIC(WasherFluidLevel, uint16_t)
static const Property WasherFluidLevelLow;
PROPERTYTYPEBASIC(WasherFluidLevelLow, bool)
- /**< Securty Alert Status
- * status of security alert
- * @see Security::Status
- */
+ ///TODO: Depreciated in 0.14. Use AlarmStatus
static const Property SecurityAlertStatus;
PROPERTYTYPEBASIC(SecurityAlertStatus, Security::Status)
/**< Parking Brake Status
* status of parking break active (true) or inactive (false)
+ * TODO: Deprecated in 0.14.
*/
static const Property ParkingBrakeStatus;
PROPERTYTYPEBASIC(ParkingBrakeStatus, bool)
+ /*!
+ * \brief ParkingBrakeStatusW3C use with ParkingBrake::W3C::*
+ */
+ static const Property ParkingBrakeStatusW3C;
+ PROPERTYTYPE(ParkingBrakeStatusW3C, ParkingBrakeStatusW3CType, StringPropertyType, std::string)
+
/**< Parking Light Status
* status of parking lights active (true) or inactive (false)
*/
@@ -750,28 +809,39 @@ public:
*/
static const Property HazardLightStatus;
PROPERTYTYPEBASIC(HazardLightStatus, bool)
- //typedef BasicPropertyType<bool> HazardLightStatusType;
static const Property AntilockBrakingSystem;
PROPERTYTYPEBASIC(AntilockBrakingSystem, bool)
- //typedef BasicPropertyType<bool> AntilockBrakingSystemType;
+
+ static const Property AntilockBrakingSystemEnabled;
+ PROPERTYTYPEBASIC(AntilockBrakingSystemEnabled, bool)
static const Property TractionControlSystem;
PROPERTYTYPEBASIC(TractionControlSystem, bool)
- //typedef BasicPropertyType<bool> TractionControlSystemType;
+
+ static const Property TractionControlSystemEnabled;
+ PROPERTYTYPEBASIC(TractionControlSystemEnabled, bool)
static const Property VehicleTopSpeedLimit;
PROPERTYTYPEBASIC(VehicleTopSpeedLimit,uint16_t)
- //typedef BasicPropertyType<uint16_t> VehicleTopSpeedLimitType;
+ ///TODO: Deprecated in 0.14
static const Property AirbagStatus;
PROPERTYTYPEBASIC(AirbagStatus, Airbag::Status)
- /// TODO: deprecate in 0.13. Use DoorStatusW3C
+ static const Property AirbagActivated;
+ PROPERTYTYPEBASIC(AirbagActivated, bool)
+
+ static const Property AirbagDeployed;
+ PROPERTYTYPEBASIC(AirbagDeployed, bool)
+
+ /// TODO: deprecate in 0.14. Use DoorStatusW3C
static const Property DoorStatus;
PROPERTYTYPEBASIC(DoorStatus, Door::Status)
- /** use with Door::W3C::*
+ /*!
+ * \brief DoorStatusW3C
+ * use with Door::W3C::*
*/
static const Property DoorStatusW3C;
PROPERTYTYPE(DoorStatusW3C, DoorStatusW3CType, StringPropertyType, std::string)
@@ -788,21 +858,38 @@ public:
static const Property WindowLockStatus;
PROPERTYTYPEBASIC(WindowLockStatus, bool)
+ ///TODO Deprecated in 0.14
static const Property OccupantStatus;
PROPERTYTYPEBASIC(OccupantStatus, Seat::Occupant)
+ static const Property OccupantStatusW3C;
+ PROPERTYTYPE(OccupantStatusW3C, OccupantStatusW3CType, StringPropertyType, std::string)
+
static const Property ObstacleDistance;
PROPERTYTYPEBASIC(ObstacleDistance, double)
static const Property RainSensor;
PROPERTYTYPEBASIC(RainSensor, uint16_t)
- //typedef BasicPropertyType<uint16_t> RainSensorType;
+ ///TODO Deprecated in 0.14. Use WinshieldWiperSpeed
static const Property WindshieldWiper;
- PROPERTYTYPEBASIC(WindshieldWiper,Window::WiperSpeed)
- //typedef BasicPropertyType<Window::WiperSpeed> WindshieldWiperType;
+ PROPERTYTYPEBASIC(WindshieldWiper, Window::WiperSpeed)
+
+ /*!
+ * \brief WindshieldWiperSpeed
+ * Use WiperSpeedSetting::W3C::* for value
+ */
+ static const Property WindshieldWiperSpeed;
+ PROPERTYTYPE(WindshieldWiperSpeed, WindshieldWiperSpeedType, StringPropertyType, std::string)
+
+ /*!
+ * \brief WindshieldWiperSetting
+ * Use WiperSpeedSetting::W3C::* for value
+ */
+ static const Property WindshieldWiperSetting;
+ PROPERTYTYPE(WindshieldWiperSetting, WindshieldWiperSettingType, StringPropertyType, std::string)
- /// TODO: Deprecated. Remove in 0.13
+ /// TODO: Deprecated. Remove in 0.14
static const Property AirflowDirection;
PROPERTYTYPEBASIC(AirflowDirection,HVAC::AirflowDirection)
@@ -824,7 +911,7 @@ public:
static const Property Heater;
PROPERTYTYPEBASIC(Heater, bool)
- /// TODO: deprecated. remove in 0.13
+ /// TODO: deprecated. remove in 0.14
static const Property Defrost;
PROPERTYTYPEBASIC(Defrost, bool )
@@ -859,7 +946,12 @@ public:
static const Property ConvertibleRoof;
PROPERTYTYPEBASIC(ConvertibleRoof, bool)
- //typedef BasicPropertyType<bool> ConvertibleRoofType;
+
+ /*!
+ * \brief ConvertibleRoofStatus use with ConvertibleRoofW3C::*
+ */
+ static const Property ConvertibleRoofStatus;
+ PROPERTYTYPE(ConvertibleRoofStatus, ConvertibleRoofStatusType, StringPropertyType, std::string)
static const Property NightMode;
PROPERTYTYPEBASIC(NightMode, bool)
@@ -918,7 +1010,7 @@ public:
PROPERTYTYPEBASIC(PowertrainTorque, uint16_t)
static const Property AcceleratorPedalPosition;
- PROPERTYTYPEBASIC(AcceleratorPedalPosition, uint8_t)
+ PROPERTYTYPEBASIC(AcceleratorPedalPosition, uint16_t)
static const Property Chime;
PROPERTYTYPEBASIC(Chime, bool)
@@ -936,7 +1028,7 @@ public:
PROPERTYTYPEBASIC(YawRate, int16_t)
static const Property BrakePadWear;
- PROPERTYTYPEBASIC(BrakePadWear, uint8_t)
+ PROPERTYTYPEBASIC(BrakePadWear, uint16_t)
static const Property BrakeFluidLevelLow;
PROPERTYTYPEBASIC(BrakeFluidLevelLow, bool)
@@ -947,8 +1039,60 @@ public:
static const Property MalfunctionIndicatorOn;
PROPERTYTYPEBASIC(MalfunctionIndicatorOn, bool)
- /** END PROPERTIES **/
+ static const Property AccumulatedEngineRuntime;
+ PROPERTYTYPEBASIC(AccumulatedEngineRuntime, uint32_t)
+
+ static const Property DistanceSinceCodeCleared;
+ PROPERTYTYPEBASIC(DistanceSinceCodeCleared, uint32_t)
+
+ static const Property DistanceWithMILOn;
+ PROPERTYTYPEBASIC(DistanceWithMILOn, uint32_t)
+
+ static const Property TimeRunMILOn;
+ PROPERTYTYPEBASIC(TimeRunMILOn, uint32_t)
+
+ static const Property TimeTroubleCodeClear;
+ PROPERTYTYPEBASIC(TimeTroubleCodeClear, uint32_t)
+
+ static const Property VehicleDriveMode;
+ PROPERTYTYPE(VehicleDriveMode, VehicleDriveModeType, StringPropertyType, std::string)
+
+ static const Property ActiveNoiseControlMode;
+ PROPERTYTYPEBASIC(ActiveNoiseControlMode, bool)
+
+ static const Property AvailableSounds;
+ PROPERTYTYPE(AvailableSounds, AvailableSoundsType, ListPropertyType<StringPropertyType>, StringPropertyType)
+
+ static const Property EngineSoundEnhancementMode;
+ PROPERTYTYPE(EngineSoundEnhancementMode, EngineSoundEnhancementModeType, StringPropertyType, std::string)
+
+ static const Property ElectronicStabilityControlEnabled;
+ PROPERTYTYPEBASIC(ElectronicStabilityControlEnabled, bool)
+
+ static const Property ElectronicStabilityControlEngaged;
+ PROPERTYTYPEBASIC(ElectronicStabilityControlEngaged, bool)
+ static const Property OccupantIdentificationType;
+ PROPERTYTYPE(OccupantIdentificationType, OccupantIdentificationTypeType, StringPropertyType, std::string)
+
+ static const Property OccupantName;
+ PROPERTYTYPE(OccupantName, OccupantNameType, StringPropertyType, std::string)
+
+ static const Property AtmosphericPressure;
+ PROPERTYTYPEBASIC(AtmosphericPressure, uint16_t)
+
+ static const Property LaneDepartureStatus;
+ PROPERTYTYPE(LaneDepartureStatus, LaneDepartureStatusType, StringPropertyType, std::string)
+
+ /*!
+ * \brief AlarmStatus. Use with Security::W3C*
+ */
+ static const Property AlarmStatus;
+ PROPERTYTYPE(AlarmStatus, AlarmStatusType, StringPropertyType, std::string)
+
+ //static const Property Lane
+
+ /** END PROPERTIES **/
/*!
* \brief capabilities
@@ -1006,3 +1150,4 @@ private:
#endif // VEHICLEPROPERTY_H
+
diff --git a/packaging/CMakeLists.txt b/packaging/CMakeLists.txt
new file mode 100644
index 00000000..cdadb9be
--- /dev/null
+++ b/packaging/CMakeLists.txt
@@ -0,0 +1 @@
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/automotive-message-broker.spec.in ${CMAKE_CURRENT_SOURCE_DIR}/automotive-message-broker.spec @ONLY)
diff --git a/packaging/automotive-message-broker.changes b/packaging/automotive-message-broker.changes
new file mode 100644
index 00000000..7f07f346
--- /dev/null
+++ b/packaging/automotive-message-broker.changes
@@ -0,0 +1,874 @@
+* Thu Nov 05 2014 tripzero <kevron.m.rees@intel.com> submit/tizen/20141029.180744-6-gfa57967
+- updated docs. added deleted callback
+- updated chlog
+- fixed obd2 disconnect bug
+- fixed bluemonkey config path
+- fixed spec to install qtmainloop with bluemonkey plugin
+- fixed FanSpeedLevel name
+- update cache of dbus properties even if not currently registered
+- fixed battery ChargeLevel type error
+- fixed Temperature interface name
+- updated spec
+- version bump 0.11.904
+- fixed regression in cangen plugin
+- fixed regression in cangen plugin
+- version bump 0.11.904
+- dbus plugin will cache. updating release notes
+- fixed Obd2Connected
+- fixed database playback
+- 0.12 final
+- added mainpage for lib documentation
+- disable dbus property rules
+
+* Mon Oct 13 2014 tripzero <kevron.m.rees@intel.com> submit/tizen_ivi/20141001.165128-11-g4c16abd
+- some opencvlux fixes
+- use pure dlopen to open source/sink plugins
+- additional fixes to opencv plugin
+- version bump 0.11.903
+- updated release notes
+- cleaned up unused code block
+- updated chlog and spec version
+- removed all libtool usage
+- use set instead of list in cmake for better compatibility
+- 0.11.903 bump
+
+* Wed Oct 01 2014 tripzero <kevron.m.rees@intel.com> submit/tizen/20140919.161146-9-g0e92e8f
+- fix lib install dir for qtmainloop plugin
+- reference amb.idl in dbus docs
+- fixed obd2 bluetooth for bluez5
+- updated chlog
+- fixed opencvlux plugin
+- version bump 0.11.902
+- use smart pointer in opencvlux
+- fixed install path for amb.idl
+
+* Fri Sep 19 2014 tripzero <kevron.m.rees@intel.com> submit/tizen/20140916.213438-15-g734500b
+- bump version
+- fixed up bluez5 support code
+- bluemonkey enhancements
+- multi-arch support
+- multi-arch support
+- add usebluez5 flag to cmake
+- fixes for bluemonkey and wheel
+- disabled irc in bluemonkey
+- removed generated files
+- point at franca docs for dbus
+- convert bluemonkey script to be qml based engine
+- version bump
+- fixed up bluemonkey configuration
+- manual merge
+- fixed crash in murphy plugin
+- fix to spec
+- fixed lib install dir for qtmainloop plugin
+- updated spec for 0.11.901
+
+* Tue Sep 02 2014 tripzero <kevron.m.rees@intel.com> submit/tizen/20140820.174605-9-g7f1852a
+- DBus signaller will combine duplicate signals for same object path
+- Fixed issue with Murphy plugin using wronge type for certain Properties.
+- Some fixes and performance tweaks.
+- version bump 0.11.812
+- fixed periodic crash when sending dbus signal
+- cleaned up debug output
+- updated to upstream 0.11.812
+- fixed up test plugin
+- made some of the dbus API compliant with w3c auto-bg specification
+- enginecoolant should be signed
+- version bump 0.11.900. We are now beta
+- fix for wheel plugin
+- fixed frequency option in dbus plugin
+- fixed up database plugin
+
+* Wed Aug 20 2014 tripzero <kevron.m.rees@intel.com> submit/tizen_ivi/20140612.200613@a721703
+- Merge branch '0.12' into tizen
+- Merge pull request #19 from tripzero/master
+- Merge branch '0.12' into tizen
+- version bump 0.11.811
+- removed docs
+- Update RELEASE
+- Version bump 0.11.811
+- added tools
+- priority queues
+- cleaned up documents. idl is the authority
+- added asyncqueue. Made updateProperty() thread safe
+- updated docs
+- created franca idl doc
+- some performance tweaks to core and dbussignaller
+- add rule to only generate dbus docs from idl
+- fixed crash when gpsnmea gets blank gprmc messages
+- removed client library stubs
+- cleaned up debug output
+- fixed periodic crash when sending dbus signal
+- version bump 0.11.812
+- Some fixes and performance tweaks.
+- Fixed issue with Murphy plugin using wronge type for certain Properties.
+- DBus signaller will combine duplicate signals for same object path
+- Merge pull request #17 from tripzero/master
+- automotive-message-broker should not depend on qt
+- removed docs
+- Update RELEASE
+- Version bump 0.11.811
+- added tools
+- priority queues
+- cleaned up documents. idl is the authority
+- added asyncqueue. Made updateProperty() thread safe
+- updated docs
+- created franca idl doc
+- some performance tweaks to core and dbussignaller
+- add rule to only generate dbus docs from idl
+- fixed crash when gpsnmea gets blank gprmc messages
+- removed client library stubs
+- Merge branch '0.12' into tizen
+- multiple dbus properties can support the same amb property
+- Merge branch '0.12' into tizen
+- fixed missing symbol
+- Merge branch '0.12' into tizen
+- use const string ref
+- Updated spec
+- Merge branch '0.12' into tizen
+- fix libamb label
+- added support for lambda subscriptions. initial bluetooth5 support in obd2 plugin
+- updated docs to reflect change to vehicle and engine speed
+- updated Vehicle and EngineSpeed interfaces to match w3c vehicle data draft spec. Old attributes exist for compatibility
+- version bump 0.11.810
+- added SteeringWheelAngle
+- added stub ambclient code
+- Merge branch '0.12' into tizen
+- added more debug to bluetooth
+- Merge branch '0.12' into tizen
+- use gio for watching fd
+- Merge branch '0.12' into tizen
+- updated method signature
+- got bluez5 client somewhat working
+- Merge branch '0.12' into tizen
+- updated spec
+- fixed a GVS error
+- Merge branch '0.12' into tizen
+- add ambbt service file
+- added service record for spp
+- Merge branch '0.12' into tizen
+- added dbus system config
+- door lock are not readonly
+- Merge branch '0.12' into tizen
+- registerProfile after registering the dbus object
+- Merge branch '0.12' into tizen
+- corrected signature call to RegisterProfile
+- Merge branch '0.12' into tizen
+- updated spec to install bluetooth plugin
+- load non-SinkManager plugins
+- Merge branch '0.12' into tizen
+- check if registerProfile is valid
+- initial bluetooth plugin
+- fix cmake file
+- manual merge
+- reworked tests in gpsnmea
+- deprecated gpsd plugin
+- fixed checksum()
+- make unhandled nmea messages level 7 to avoid spamming
+- change to example and dbus plugins
+- removed mcmodel compile option. added VideoLogging property to opencv plugin
+- Merge branch '0.12' into tizen
+- fixed crasher in gpsnmea
+- Merge branch '0.12' into tizen
+- fixed compile errors in database and murphy plugins
+- Merge branch '0.12' into tizen
+- fixed compile errors in obd2 plugin
+- Merge branch '0.12' into tizen
+- install canobserver header
+- fixed some compile errors
+- updated some docs and added testing document
+- Update README
+- updated changelog and spec
+- added velocity text to framewriter
+- use vector where possible
+
+* Wed Apr 16 2014 tripzero <kevron.m.rees@intel.com> submit/tizen/20140326.195506@13f13b0
+- use debugout for errors instead of cerr
+- use mjpg codec
+- enable usage of different routing engines via config
+- version bump 0.11.809
+- use monotonic clock
+- removed build files from src
+- use c++11 chrono for time
+- updated spec
+- minor tweak to readme
+- Merge pull request #16 from OlivierDelbeke/master
+- Merge branch '0.12' into tizen
+- fixed up gpsnmea to work with devices with very fragmented nmea messages
+- Added the possibility to specify the baudrate of the GPS NMEA device
+- fixed runtime errors and warnings with dbus plugin
+- Updated plugins to work without the now deprecated setSupported() call.
+- fixed compile errors in various plugins
+- Update README
+- Merge pull request #15 from e8johan/master
+- some core changes as well as additions to opencv plugin
+- added SimCommand backdoor to the gen plugin
+- added cangen example config
+- Merge branch '0.12' into tizen
+- fixed invalidating of iterator in ranged for looop
+- updated chlog
+- Fixed warning about enabling c++11 for C sources
+- Removed stray files.
+- Fixed error messages for libtool to indicate that it is libltdl that is missing.
+
+* Fri Mar 21 2014 tripzero <kevron.m.rees@intel.com> submit/tizen/20140320.231725@5748dc3
+- added cansim plugin
+- added cansim, cangen plugins
+
+* Thu Mar 20 2014 tripzero <kevron.m.rees@intel.com> submit/tizen/20140319.172635@8669b09
+- version bump 0.11.808
+- fixed issue with complex objects only firing the last property and dropping all others
+- fixed throw when trying to parse empty speed
+- do not crash if connection has not been established
+- version bump 0.11.807
+- only listen to specified paths
+- reenabled ico vehicle plugin
+- Added incomplete message to gpsnmea test
+- playing with videowriter in cv plugin
+- updated chlog and spec
+
+* Thu Mar 13 2014 tripzero <kevron.m.rees@intel.com> submit/tizen/20140305.213149@afb8a15
+- fixed random crash when process subscribes to an object interface
+- fixed debug output statement
+- added more debug output to murphy plugin
+
+* Wed Mar 05 2014 tripzero <kevron.m.rees@intel.com> submit/tizen/20140224.190956@6425ef6
+- Merge branch '0.12' into tizen
+- Remove performance from dbusconfig. fix crasher in varianttype.
+- added more debug to gpsnmea. example source default return for set operations.
+- added support for string and double in amb-set
+- make startOnLoad and playbackOnLoad work with 'true' or 'false'
+- fixed amb-set
+- amb-listen works. zone attribute included in all signals.
+- updated chlog
+
+* Thu Feb 24 2014 - <kevron.m.rees@intel.com>
+- 0.11.805 release
+- updated smack rules to allow murphy socket connection
+
+* Fri Feb 14 2014 - <kevron.m.rees@intel.com>
+- 0.11.804 release
+
+* Tue Feb 11 2014 - <kevron.m.rees@intel.com>
+- 0.11.803 release
+
+* Wed Feb 05 2014 - <kevron.m.rees@intel.com>
+- fixed missing symbol issue in murphy plugin
+
+* Tue Feb 04 2014 - <kevron.m.rees@intel.com>
+- 0.11.802 release
+
+* Fri Jan 31 2014 - <kevron.m.rees@intel.com>
+- 0.11.801 release
+
+* Tue Jan 28 2014 - <kevron.m.rees@intel.com>
+- 0.11.800 release
+
+* Wed Jan 09 2014 - <kevron.m.rees@intel.com>
+- Fixed up tree so obs can build it
+
+* Wed Jan 08 23:41:34 UTC 2014 - tracy.graydon@intel.com
+- Fix the date in the previous changelog entry to make OBS happy
+
+* Wed Jan 08 2014 - <kevron.m.rees@intel.com>
+- Upstream 0.10.902
+- Temporarily install rule-less manifest so security=none works
+
+* Thu Dec 19 2013 - <kevron.m.rees@intel.com>
+- New upstream release 0.10.901
+- Fixed packaging to install manifests for all subpackages
+- Fix for TIVI-2324
+
+* Mon Dec 16 2013 - <kevron.m.rees@intel.com>
+- New upstream release 0.10.900 ("challenger" beta)
+- Fixed manifest so ambd now runs as new AMB domain
+- Cleaned up tree
+
+* Fri Nov 22 2013 - <kevron.m.rees@intel.com>
+- New upstream release 0.10.805 ("challenger" alpha)
+- Install smack manifest file
+
+* Thu Nov 21 2013 - <kevron.m.rees@intel.com>
+- New upstream release 0.10.804 ("challenger" alpha)
+- Fixes TIVI-2081, TIVI-2122
+- Cleaned up branch with new release patches
+
+* Fri Nov 11 2013 - <kevron.m.rees@intel.com>
+- New upstream release 0.10.803 ("challenger" alpha)
+
+* Thu Nov 04 2013 - <kevron.m.rees@intel.com>
+- New upstream release 0.10.802 ("challenger" alpha)
+- added tizen specialized systemd service file
+
+* Tue Oct 16 2013 - <kevron.m.rees@intel.com>
+- New upstream release 0.10.800 ("challenger" alpha)
+- Changes DBus API with the concent of zones
+- New location plugin that uses nmea devices
+- updated packaging
+- lots more docs are now available in the docs package
+
+* Thu Sep 12 2013 - <kevron.m.rees@intel.com>
+- Official 0.10.0 ("chevelle") release
+- added LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so to fix opencvlux plugin issues
+
+* Tue Sep 10 2013 - <kevron.m.rees@intel.com>
+- New upstream release 0.9.19 ("chevelle" beta).
+- upstream changed time and sequence data types.
+
+* Mon Sep 09 2013 - <kevron.m.rees@intel.com>
+- New upstream release 0.9.18 ("chevelle" beta).
+- upstream added "sequence" properties to dbus api.
+- Make manager interface register last (workaround for dbus race condition).
+
+* Thu Sep 05 2013 - <kevron.m.rees@intel.com>
+- New upstream release 0.9.17 ("chevelle" beta)
+- new version fixes systemd race condition with dbus
+
+* Tue Sep 03 2013 - <kevron.m.rees@intel.com>
+- Fixed TIVI-1708
+- New upstream release 0.9.16 ("chevelle" beta)
+
+
+* Thu Aug 23 2013 - <kevron.m.rees@intel.com>
+- New upstream 0.9.15 ("chevelle" beta)
+- new GetHistory call
+- fixed some minor issues with properties registering on dbus
+- added smack manifest with AMB domain (disabled currently)
+- reenabled murphy plugin
+
+* Tue Aug 13 2013 - <kevron.m.rees@intel.com>
+- New upstream release 0.9.13 ("chevelle" beta)
+- Enabled murphy plugin by default
+- Fixed memory smashing bug with json parsing
+- Added support for additional buttons in wheel plugin
+
+* Tue Jul 30 2013 - <kevron.m.rees@intel.com>
+- New upstreadm release 0.9.11 ("chevelle" beta)
+
+* Tue Jul 30 2013 - <kevron.m.rees@intel.com>
+- Fixed rmplint errors
+
+* Mon Jul 29 2013 - <kevron.m.rees@intel.com
+- fixed findProperty call to return object names not objects that match amb property names
+- added list dbus call
+
+* Fri Jul 19 15:09:00 PST 2013 - <kevron.m.rees@intel.com>
+- readded .gbs.conf file to point to upstream branch
+- set upstream branch to track upstream so gbs will stop complaining
+- recreated tizen branch from upstream
+- submitting to tizen build
+- added fix for compiling with gcc 4.7.0
+
+* Thu Jul 18 10:39:00 PST 2013 - <kevron.m.rees@intel.com>
+- version 0.9.9 ("chevelle" beta)
+
+* Wed Jul 17 13:21:00 PST 2013 - <kevron.m.rees@intel.com>
+- Fix for bug TIVI-1427
+
+* Thu Jul 11 11:13:00 PST 2013 - <kevron.m.rees@intel.com>
+- Fix for bug TIVI-1175
+
+* Mon Jul 08 18:48:00 PST 2013 - <kevron.m.rees@intel.com>
+- Fixed dbus policy example
+
+* Fri Jun 28 11:06:00 PST 2013 - <kevron.m.rees@intel.com>
+- Fixed segfault on timeout reply
+
+* Wed Jun 26 13:40:00 UTC 2013 - <kevron.m.rees@intel.com>
+- Fixed systemd startup issue
+- Merged in latest upstream fixes from the 0.10 branch
+
+* Thu Jun 20 22:38:34 UTC 2013 - tracy.graydon@intel.com
+- Fix up a couple of deps and a spec parsing issue
+
+* Tue Jun 18 11:12:00 PST 2013 - <kevron.m.rees@intel.com>
+- New upstream version 0.9.8 (0.10 alpha) "chevelle"
+
+* Mon Jun 03 10:47:00 PST 2013 - <kevron.m.rees@intel.com>
+- submitting to tizen build
+
+* Tue May 21 11:19:00 PST 2013 - <kevron.m.rees@intel.com>
+- Updated to latest upstream on the 0.9 branch
+- disabled gpsd plugin since we don't have a modern version of gpsd on tizen
+
+* Thu Mar 21 16:02:00 PST 2013 - <kevron.m.rees@intel.com>
+- Fix for performance issues in opencvlux plugin
+- Murphy code added but not built by default yet
+
+* Tue Mar 19 11:09:00 PST 2013 - <kevron.m.rees@intel.com>
+- Fix for JIRA TIVI-525
+
+* Mon Mar 18 14:23:00 PST 2013 - <kevron.m.rees@intel.com>
+- Merged upstream bug fixes from 0.8.0 branch.
+
+* Thu Mar 07 13:40:00 PST 2013 - <kevron.m.rees@intel.com>
+- new beta releast 0.7.9
+
+* Wed Feb 06 10:38:00 PST 2013 - <kevron.m.rees@intel.com>
+- dbus fixes
+- compiler fixes
+
+* Thu Jan 24 14:44:00 UTC 2013 - <kevron_m_rees@linux.intel.com>
+- memory usage fixes
+
+* Mon Jan 21 10:57:00 UTC 2013 - <kevron_m_rees@linux.intel.com>
+- updated to 0.6.9
+
+
+* Wed Jan 3 10:57:00 UTC 2013 - <kevron_m_rees@linux.intel.com> 3718d3f
+- updated spec to include database package
+
+* Fri Dec 7 23:19:19 UTC 2012 - tracy.graydon@intel.com
+- Add libuuid-devel dep and a couple of minor spec changes to fix build issue
+
+* Thu Dec 06 2012 tripzero <kevron_m_rees@linux.intel.com> b1870c5
+- version bump and install sysvinit
+- uuidhelper
+- fixed initiation of sequence and timestamp defaults
+- example requests ranged from 10s ago after 10s timeout
+- do not blow up if baud is empty
+- version bump 0.6.0
+- fixed tpms plugin
+- Updated todo
+- worked out some bugs with websocket source and sink
+- getRanged works with database sink
+- database plugin works
+- set precision before writing to debug
+- refactored how timestamp and sequence are stored: moved to AbstractProperty
+- fixed merge
+- Merge branch 'malcom'
+- register air intake
+- Change so websocketsink now reports the proper list of supported properties
+- Fix for WMI pid being returned as true when engine coolant temp is selected
+- fixed potential Obd2Amb bug
+- Change for updateProperty shouldn't be called if there is a pending reply
+- check for property changed in core, but don't use right now
+- Change so getPropertyAsync is properly replied to in obd2source
+- fixed currenttime bugs
+- added multisource test script in examples and added --log option
+- worked some debug messages
+- added air intake temp property to obd2source
+- Fix for CopyMe<T> having an error in its constructor paramter
+- Change so re-subscribing to a pid, removes it from the blacklist if it has been tagged as invalid
+- Change for blacklisting OBD2 pids that return NODATA
+- Change for debugging random disconnects
+- Addition for using the bluez bluetooth disconnect feature when OBD disconnects
+- added disconnect call to bluetooth
+- Change so BT rfcomm port name is re-reqested every time a connect is requested
+- register OBD2Connect property
+- Change for removing extra debug output, and fixing disconnect on device removal
+- Fix for an issue where a NODATA response from an OBD2 tool would cause a disconnect
+- Addition of feature to disconnect from OBD port on failure, and reconnect only on new incoming subscriptions
+- Addition of getPropertyAsync and setProperty support through websocketsource
+- Addition of getPropertyAsync and setProperty support through websocketsource
+- initial sequence and timestamp support
+- fixed tryParse returning false issue
+- stub databasekink
+- Fix copy/paste issue preventing OBD2Source from supporting Engine Speed
+- endl
+- Fix for high CPU usage due to change in how updateProperties was called
+- clean up sources and sinks
+- Addition of method for shutting down OBD thread upon closure
+- fixed example config
+- enabled obd2 by default for now
+- fixed include
+- Addition of disconnect on last unsubscribe and extra debugging
+- Continuation of Kevron's refactoring, including connect on first subscribe
+- initial placeholder for database plugin
+- Update plugins/obd2plugin/README
+- Merge branch 'master' of https://github.com/otcshare/automotive-message-broker
+- updated obd2source readme
+- start of obd2 refactoring
+- fixed todo merge
+- todo updated
+
+* Mon Dec 03 2012 tripzero <kevron_m_rees@linux.intel.com> submit/release/20121112.191808@cbfefb5
+- version bump in spec
+- version bump 0.6.0
+- updated changes
+- todo updated
+
+* Fri Nov 02 2012 tripzero <kevron_m_rees@linux.intel.com> 1.0_branch@7de9474
+- new version
+- Manual merge
+- Merge branch 'master' of github.com:otcshare/automotive-message-broker into release
+- version bump 0.5.0
+- added getHistory support to websocket sink plugin and added api to test api.js
+- Adding json-glib as a runtime requirement.
+- added a bunch of properties and consolodated some things in obd2source
+- updated tpms plugin so it compiles
+- refactored setProperty: made it async with callback
+- updated todo
+- some enhancements to obd2source
+- updated TODO
+- configurable bt adapter
+- Update TODO
+- Update README
+- Update spec file: - Use valid Tizen Group - Fix typo - Use macro instead of hardcoded path in %install section
+- Merge branch 'master' of https://github.com/otcshare/automotive-message-broker
+- report why cannot connect to obdII device
+- solved possible memory leak in websocketsink
+- TPMS compile switch with default OFF
+- fixed websocketsource. possibly removed mem leak
+- gracefully handle no-root and no-device situations
+- added light status and updated fuel docs
+- cruise control properties
+- fix kPa
+- pressures all in kPa
+- updates to support all 4 tires and pressures
+- some basic info about the plugin
+- convert tire types to float
+- merge
+- merge
+- fix typo
+- add tire temperature parameters
+- tire temperature values added
+- tire temperature values added
+- tire temperature values added
+- working USB TPMS sensor reading
+- only export dbus properties that are supported
+- USB module compile & link from TPMS plugin
+- added trip meter property
+- changed trip meter to finite set of trips
+- made adding properties more straightforward
+- cleanup
+- adding files for TPMS USB framework
+- basic TPMS plugin framework without USB sensor interaction
+- changes to allow build on Ubuntu 12.04
+- added property registration system
+- Merge branch 'master' of github.com:otcshare/automotive-message-broker
+- property changes
+- removed 100ms delay
+- Merge branch 'master' of https://github.com/otcshare/automotive-message-broker
+- removed 500ms blocking call when sending things to obd2
+- fixed spec from merge
+- more changes to changes
+- Merge changes
+- Merge changes
+- Merge changes
+- Merge "added maketag"
+- Merge changes Ibab9e115,I4028a068,Iaec87c6c,I03a7ebde,I2ca0262d,I65c6147e,Ie1f8ec4e,I8bf5640b,I8a6ed52b,Iba369a37
+- Merge changes Iba9f4a4a,Ic07308c7,Icfe8b20e,Ic0d8a7d4
+- Merge "Update README"
+- Merge "added tire pressure properties"
+- Merge "fixed up engine coolant down button"
+- updated chlog
+- Merge branch 'upstream' into release
+- mkdir first
+- Merge branch 'upstream' into release
+- make link
+- Merge branch 'upstream' into release
+- updated version number in spec
+- updated chlog
+- updated spec
+- Merge branch 'upstream' into release
+- updated chlog
+- Merge branch 'upstream' into release
+- updated changelog
+- Merge branch 'upstream' into release
+- changelog update
+
+* Mon Oct 01 2012 tripzero <kevron_m_rees@linux.intel.com> submit/release/20121001.202146@cd77669
+- fixed merge
+- changes
+- Merge branch 'upstream' into release
+- added packaging directory
+
+* Mon Oct 01 2012 tripzero <kevron_m_rees@linux.intel.com> submit/release/20120926.232908@e180e9d
+- updated spec version
+- Merge branch 'upstream' into release
+- changes
+- version bump
+- report out property updates per second
+- removed glibmm requirement
+- made obd2 updates happen on an idle callback
+- obdII is b0rked but getting closer
+- Update docs/runningstatus.txt
+- only sleep if list is empty
+- integrated obdII source with mainloop
+- updated draft running status dbus doc
+- updated TODO
+- Added debug output confirming set working
+- Fix for "set" requests
+- added maketag
+- updated chlog
+- mkdir first
+- make link
+- updated version number in spec
+- updated chlog
+- updated spec
+- updated chlog
+- updated changelog
+- changelog update
+- added packaging directory
+
+* Wed Sep 26 2012 tripzero <kevron_m_rees@linux.intel.com> ba9f4a4
+- atsp0 ftw
+- fixed compile errors introduced by foolishly merging
+- fixed mergers
+- obd source support bluetooth devices
+- Update README
+- config required to construct plugins. device config added to wheel plugin
+- added tire pressure properties
+- fixed up engine coolant down button
+- added maketag
+- updated chlog
+- mkdir first
+- make link
+- updated version number in spec
+- updated chlog
+- updated spec
+- updated chlog
+- updated changelog
+- changelog update
+- added packaging directory
+
+* Fri Sep 14 2012 tripzero <kevron_m_rees@linux.intel.com> submit/release/20120912.232202@8d10311
+- Merge branch 'upstream' into release
+- fixed config
+- mkdir first
+- Merge branch 'upstream' into release
+- make link
+- don't do dbus by default
+- don't install service in wrong place
+- Merge branch 'upstream' into release
+- updated version number in spec
+- install service in right place so it starts
+- version bump 0.3
+- Add button event generation for Button[1-4]Preset to wheel plugin Make demo sink plugin listen for the above ButtonEvents Make rundemo script react to the above buttons
+- Add hard-coded calibration values to wheel plugin for G27 racing wheel
+- Fixed one last printf
+- Merge remote-tracking branch 'origin/master'
+- added debug
+- Fix for const_iterator that should be iterator
+- Fix for const_iterator that should be iterator
+- fixed capabilities
+- Fix for only a single subscription being operated on
+- Fix for only a single subscription being operated on
+- added mg to example plugin
+- updated chlog
+
+* Wed Sep 12 2012 tripzero <kevron_m_rees@linux.intel.com> submit/release/20120912.231933@81ea024
+- updated spec
+- Merge branch 'upstream' into release
+- updated chlog
+- fixed compile error
+
+* Wed Sep 12 2012 tripzero <kevron_m_rees@linux.intel.com> submit/release/20120911.205626@03b4484
+- Merge branch 'upstream' into release
+- Merge branch 'mal'
+- made awesome debugout
+- Code cleanup, comments, and change of ALL printf's to DebugOut() calls
+- adding democonfig
+- Fix for typo in config
+- Addition of obdsource
+- Change for websocket options
+- simple rundemo script
+- Addition of all OBD2 properties in the TODO file, async and standard requests
+- updated changelog
+- Fix
+
+* Tue Sep 11 2012 tripzero <kevron_m_rees@linux.intel.com> submit/release/20120911.205626@d545a4c
+- Merge branch 'upstream' into release
+- updated examples with more properties
+- demosink uses strings for turn signal
+- added wheel example and fixed example websocketsource config
+- fixed enums in wheel
+- Merge branch 'mal'
+- Merge branch 'master' of https://github.com/malcom2073/automotive-message-broker into mal
+- fixed up AbstractPropertyType so it can use enums
+- Fix for bug involving websocket messages being incomplete
+- changelog update
+- Merge branch 'master' of https://github.com/malcom2073/automotive-message-broker into mal
+- Fix for bad if/else statements found by Kevron
+- Addition of new obd2 plugin
+
+* Mon Sep 10 2012 tripzero <kevron_m_rees@linux.intel.com> submit/release/20120910.223349@2021380
+- Merge branch 'upstream' into release
+- const value()
+- fixed websocketsource cmake
+- added packaging directory
+- added more properties
+- Addition of only requesting OBD2 values after a subscription request
+- Change in the libwebsocket_write call to fix string length, due to passing a pointer in the middle of a string.
+- Fix for huge memory leak, and more config changes
+- Changes for new config values
+- made setConfiguration virtual
+- Change for setConfiguration to be handled properly for settings
+- new configuration format
+- added button events
+- Fix compile error due to const iterator issues in websocketsinkmanager
+- added todo
+- moved example configs to subfolder. updated readme
+- fix the target_link_library for example plugins
+- Code cleanup
+- Fix for GIOChannel watch's hanging around longer than they should be
+- fixed parallalel building and make install
+- install all the files
+- fixed printhelp() with config option. thanks geoffroy
+- Fix for gioPolling final
+- Fix for some weird issues with the switch
+- Change for gioPollingFunc to keep it from blocking
+- Changed where obd2plugin looks for obdlib.h
+- Merge branch 'master' of https://github.com/malcom2073/automotive-message-broker into mal2
+- Change for switch falling through
+- Change for GIO to only poll libwebsockets when it actually needs to
+- Change for GIO to only poll libwebsockets when it actually needs to
+- fixed type for transshift/gear part 2
+- fixed type for transshift/gear
+- Fix for bad if/else statements found by Kevron
+- Fix for bad if/else statements found by Kevron
+- Fix for bad if/else statements found by Kevron
+- use nullptr.h
+- define nullptr if using < gcc 4.6
+- Addition of new obd2 plugin
+- Addition of new obd2 plugin
+- fixed dbus plugin not to use the temp pointer
+- some additional updates
+- use pointer to avoid implicit casting fail
+- Merge branch 'mal'; commit '1aad5d5' into propertytype
+- Fixes for new AbstractPropertyType
+- it compiles
+- added missings
+- more updating. still broken
+- Add two new configs for source/sink websocket tests
+- sinks auto-register with the routing engine
+- Fixes for issues concerning subscriptions and websocketsource
+- example sink reacts to supported changed
+- Changes to allow websocketsourceplugin to operate properly, and load from a config file
+- subscribeToProperty being called on the source now
+- some more changes
+- Addition of new websocketsource plugin
+- Fixing a bug where a AMBD property request was being replied as a genivi request
+- major breakage ahead...
+- example supports engine coolant
+- example does throttle
+- Fix for subscriptions not working properly due to non-standard AMB properties not being supported
+- Addition of handling of generic string properties. If they're supported by AMBD, they'll be supported through
+- added capabilities call to VehicleProperty
+- checked in a small fix to the api.js to handle when the service doesn't return the proper acknowledgement on unsubscribe
+- added signal handler for sigterm and sigint
+- fixed types expressed in the example source plugin
+- updated example to produce fake data for wheel and transmission shift properties
+- Merge pull request #7 from malcom2073/master
+- Addition of new debugging output, and better error handling
+- Added unsubscribe supportedeventtype
+- Addition of getSupportedEventTypes with no data field for listing supported properties
+- Code formatting cleanup
+- Changes for unsubscribe to work properly, as well as getSupportedEventTypes
+- Fix for current subscription changes to api.js. Added steering wheel angle and transmission status
+- Clean up the boost::any casting a bit Fulfill property get requests
+- Add event propogation of all data items from the wheel
+- change get and set to allow an array of events, added subscribe and unsubscribe for an array of events, upgraded the index.html tester to all selecting a list of any events to do get, subscribe, and unsubscribe on. Added an input field for each event to allow the tester to set the value to whatever they want. The fields update on get or a valuechanged event on subscribe, when the value changes it flashes red so you can confirm the data is coming in easily.
+- Change for subscription requests to now operate properly
+- Make the boost::any conversions actually work in WheelSource
+- fixed unsubscribe
+- Make WheelPlugin actually read JS events, print out event info Make basic framework for processing received JS events TODO: Button/Axis mapping to VehicleProperty values
+- Add PropertySet typedef to VehicleProperty
+- made VehicleProperty::Property strings
+- added vehiclespeed property
+- Merge remote-tracking branch 'origin/master' into wheelsource
+- Make wheelsourceplugin actually read JS events (currently just prints out)
+- Merge pull request #6 from malcom2073/master
+- Slight change to support uuid string transactionids from the client websocket
+- Changes to support latest websocket protocol api. Now supports running_status_speedometer and running_status_engine_speed
+- in api.js, changed transactionid to a uuid
+- in api.js, changed transactionid to a uuid
+- added better comments to api.js and moved server test code into subdir
+- added better comments to api.js and moved server test code into subdir
+- made websockets work out of the box
+- made websockets work out of the box
+- Additions for creating new WebsockSink class instances per tcp connection
+- missing files added
+- missing files added
+- added check header so cmake will fail if you are missing libwebsockets
+- added check header so cmake will fail if you are missing libwebsockets
+- added set functionality, the basics are in place for hooking up the backend service
+- added set functionality, the basics are in place for hooking up the backend service
+- latest vehicle api supports getevent types and get
+- latest vehicle api supports getevent types and get
+- Update README
+- Update README
+- Update README
+- Update README
+- Merge pull request #5 from malcom2073/master
+- Update README
+- Update README
+- Update README
+- Update README
+- Name change for tcpsink to be websocketsink
+- Merge pull request #4 from malcom2073/master
+- Change for websocket port to be 7681
+- Merge remote-tracking branch 'origin'
+- Add opening of joystick dev file, and reading of various JS info
+- Add opening of joystick dev file, and reading of various JS info
+- Changes for api.js to set protocol, config to include tcpsink plugin, and tcpsinkplugin to handle incoming json requests
+- initial working dbus plugin
+- Merge branch 'par_build_fix'
+- added properties to support wheel
+- Fix parallel build issue (issue #3)
+- mikeleib'd
+- adding missing files
+- updated dbus plugin
+- Fix tcpsinkplugin build on glib 2.32.3
+- Update README
+- added reference/test javascript api to websocket plugin
+- dbus plugin updates
+- added dbus sink subdir
+- Merge pull request #2 from malcom2073/master
+- Initial commit of tcpsink, a websocket providing sink plugin.
+- added dbus plugin
+- Merge pull request #1 from jausmus/wheelsource
+- Add wheel plugin subdir for wheel source plugin Modify plugins/CMakeLists.txt to include wheel subdir
+- added some properties to support the logitec wheel
+- changed async reply callback argument
+- added async and sync property getter
+- fixed compile error due to hardcoded path
+- missing this
+- basic routing working
+- adding example config
+- use map instead of unordered_map
+- cleaned up headers
+- added abstract routing engine class
+- revamped plugin interfaces
+- more progress on core
+- missed these files
+- more progress
+- more code added to core
+- started core routing engine
+- plugins load ftw
+- Merge branch 'master' of https://github.com/otcshare/automotive-message-broker
+- updated architecture presentation
+- initial config reading
+- a bit more progress on the plugin loader
+- some serious changes
+- acceleration type double
+- set default values for each property
+- fixed dbus signal emition
+- Fixed pkgconfig and header issues
+- Merge branch 'master' of github.com:otcshare/automotive-message-broker
+- Version bump 0.2
+- Version bump 0.2
+- removed wheeltick from docs
+- removed wheeltick
+- more properties added to running status
+- added engine oil property stub
+- added new properties and assignment overloads
+- lots of new properties to running status
+- trip meter property
+- Merge branch 'master' of github.com:otcshare/automotive-message-broker
+- some changes to abstract property
+- Updated readme with project description.
+- added explainatory presentation document
+- added fuel economy property
+- added EngineSpeed and VehiclePowerMode properties
+- some updates to docs
+- added README
+- added COPYING file with license
+- all files have license comments
+- fixed compile errors and added dist target
+- fixed crasher; implemented setProperty; updated Docs
+- added runtime options
+- cleanup and project rename
+- initial add
+- initial project import from KDevelop
+
diff --git a/packaging/automotive-message-broker.spec.in b/packaging/automotive-message-broker.spec.in
new file mode 100644
index 00000000..25850843
--- /dev/null
+++ b/packaging/automotive-message-broker.spec.in
@@ -0,0 +1,385 @@
+%bcond_without qt5
+
+Name: automotive-message-broker
+Summary: Automotive Message Broker is a vehicle network abstraction system
+Version: @PROJECT_VERSION@
+Release: 0
+Group: Automotive/Service
+License: LGPL-2.1
+URL: https://github.com/otcshare/automotive-message-broker
+Source0: %{name}-%{version}.tar.bz2
+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
+BuildRequires: cmake
+BuildRequires: boost-devel
+BuildRequires: pkgconfig(json)
+BuildRequires: libtool-ltdl-devel
+BuildRequires: pkgconfig(libwebsockets)
+BuildRequires: pkgconfig(uuid)
+BuildRequires: pkgconfig(sqlite3)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(opencv)
+BuildRequires: murphy
+BuildRequires: pkgconfig(murphy-glib)
+BuildRequires: pkgconfig(dbus-1)
+%if %{with qt5}
+BuildRequires: qt5-qtcore-devel
+BuildRequires: qt5-qtconcurrent-devel
+BuildRequires: qt5-qtdbus-devel
+BuildRequires: qt5-qtnetwork-devel
+BuildRequires: qt5-qtdeclarative-devel
+BuildRequires: qt5-plugin-bearer-generic
+BuildRequires: qt5-plugin-bearer-connman
+BuildRequires: qt5-plugin-bearer-nm
+BuildRequires: qt5-plugin-sqldriver-sqlite
+%endif
+
+%description
+Automotive Message Broker is a vehicle network abstraction system.
+It brokers information from the vehicle to applications.
+
+%package devel
+Summary: Automotive Message Broker development files
+Group: Automotive/API
+Requires: %{name} = %{version}-%{release}
+Requires: libuuid-devel
+Requires: boost-devel
+
+%description devel
+Development files for the automotive-message-broker
+
+%package doc
+Summary: Documentation for the automotive-message-broker API
+Group: Automotive/Documentation
+Requires: %{name} = %{version}-%{release}
+
+%description doc
+Document files that describe the D-Bus API exposed by automotive-message-broker
+
+%if %{with qt5}
+%package plugins-qtmainloop
+Summary: qt5 mainloop plugin
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: qt5-qtcore
+
+%description plugins-qtmainloop
+Qt mainloop plugin enables qt-based source and sink plugins to run using qt mainloop
+
+%package plugins-websocket
+Summary: Websocket source and sink plugins
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: libwebsockets
+Requires: qt5-qtcore
+
+%description plugins-websocket
+websocket source and sink plugins
+
+%package plugins-opencvlux
+Summary: Plugin for simulating ExteriorBrightness using a common webcam
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: opencv
+
+%description plugins-opencvlux
+Plugin for simulating ExteriorBrightness using a common webcam
+
+%package plugins-bluetooth
+Summary: Interface to AMB over bluetooth
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description plugins-bluetooth
+Bluetooth SPP server interface
+%endif
+
+%package plugins
+Summary: Various plugins for automotive-message-broker
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description plugins
+Collection of plugins for automotive-message-broker. Contains example, demo and dbus plugins.
+
+%package plugins-common
+Summary: Common plugin library
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description plugins-common
+library containing a kitchen-sink of common utility functions
+
+%package plugins-obd2
+Summary: OBD-II plugin
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: %{name}-plugins-common = %{version}-%{release}
+
+%description plugins-obd2
+OBD-II plugin that uses ELM 327-compatible scantools to access vehicle data
+
+%package plugins-wheel
+Summary: Source plugin for using the Logitech G27 racing wheel
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description plugins-wheel
+source plugin for using the Logitech G27 racing wheel package
+
+%package plugins-database
+Summary: Database logging plugin for automotive-message-broker
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: sqlite
+
+%description plugins-database
+Database logging plugin for automotive-message-broker package
+
+%package plugins-murphy
+Summary: Plugin for integration with the murphy policy system
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: murphy
+
+%description plugins-murphy
+Plugin for integration with the murphy policy system package
+
+%package plugins-gpsnmea
+Summary: Plugin that provides gps data from nmea devices
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description plugins-gpsnmea
+Plugin that provides location data from nmea devices including bluetooth
+
+%package plugins-test
+Summary: Plugin that tests AMB code
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description plugins-test
+Plugin that tests some internal AMB code and plugin functionality. This plugin will assert if something is wrong.
+
+%package plugins-cangen
+Summary: Plugin that generates CAN data
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description plugins-cangen
+CAN frames generator plug-in for the AMB CAN Simulator
+
+%package plugins-cansim
+Summary: CAN frames listener plug-in for the AMB CAN Simulator
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description plugins-cansim
+CAN frames listener plug-in for the AMB CAN Simulator package
+
+%if %{with qt5}
+%package plugins-bluemonkey
+Summary: javascript plugin engine
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: qt5-qtdeclarative
+Requires: %{name}-plugins-qtmainloop
+
+%description plugins-bluemonkey
+Engine for creating scriptable plugins for AMB
+
+%package -n bluemonkey-modules-db
+Summary: javascript plugin engine db module
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: qt5-plugin-sqldriver-sqlite
+
+%description -n bluemonkey-modules-db
+Engine for creating scriptable plugins for AMB
+
+%endif
+
+%package xwalk-vehicle-extension
+Summary: crosswalk vehicle API extension
+Group: Automotive/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: crosswalk
+
+%description xwalk-vehicle-extension
+Crosswalk vehicle API extension based on the W3C Automotive Business Group Vehicle and Data API Specification
+
+%prep
+%setup -q -n %{name}-%{version}
+
+%build
+%cmake \
+ -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 \
+%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
+
+
+%__make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+mkdir -p %{buildroot}%{_unitdir}/network.target.wants
+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/
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%post plugins -p /sbin/ldconfig
+%postun plugins -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest
+%config %{_sysconfdir}/ambd/config
+%config %{_sysconfdir}/ambd/config.tizen
+%config %{_sysconfdir}/ambd/examples/*
+%{_bindir}/ambd
+%{_libdir}/libamb.so*
+%{_unitdir}/ambd.service
+%{_unitdir}/network.target.wants/ambd.service
+%{_unitdir}/multi-user.target.wants/ambd.service
+%{_bindir}/amb-get
+%{_bindir}/amb-get-history
+%{_bindir}/amb-set
+%{_bindir}/amb-listen
+
+%files devel
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%{_includedir}/amb/*.h
+%{_includedir}/amb/*.hpp
+%{_libdir}/pkgconfig/*.pc
+
+%if %{with qt5}
+%files plugins-qtmainloop
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/%{name}/qtmainloopplugin.so
+
+%files plugins-websocket
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/%{name}/websocketsource.so
+%{_libdir}/%{name}/websocketsink.so
+
+%files plugins-opencvlux
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/%{name}/opencvluxplugin.so
+
+%files plugins-bluetooth
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/%{name}/bluetoothplugin.so
+%config %{_sysconfdir}/dbus-1/system.d/ambbt.conf
+%endif
+
+%files plugins
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/%{name}/examplesourceplugin.so
+%{_libdir}/%{name}/examplesinkplugin.so
+%{_libdir}/%{name}/dbussinkplugin.so
+%{_libdir}/%{name}/demosinkplugin.so
+%config %{_sysconfdir}/dbus-1/system.d/amb.conf
+
+%files plugins-common
+%manifest packaging.in/amb.manifest.plugins
+%defattr(-,root,root,-)
+%{_libdir}/libamb-plugins-common.so
+
+%files plugins-wheel
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/%{name}/wheelsourceplugin.so
+
+%files plugins-obd2
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/%{name}/obd2sourceplugin.so
+
+%files plugins-database
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/%{name}/databasesinkplugin.so
+
+%files plugins-murphy
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/%{name}/murphysourceplugin.so
+
+%files plugins-gpsnmea
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/%{name}/gpsnmea.so
+
+%files doc
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%doc %{_docdir}/%{name}/*
+
+%files plugins-test
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/%{name}/testplugin.so
+
+%files plugins-cangen
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/%{name}/cangenplugin.so
+%{_bindir}/gen-set
+
+%files plugins-cansim
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/%{name}/cansimplugin.so
+
+
+%if %{with qt5}
+
+%files plugins-bluemonkey
+%defattr(-,root,root,-)
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/%{name}/bluemonkeyplugin.so
+%config %{_sysconfdir}/ambd/bluemonkey
+
+%files -n bluemonkey-modules-db
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/%{name}/bluemonkeyDbModule.so
+
+%endif
+
+%files xwalk-vehicle-extension
+%manifest packaging.in/amb.manifest.plugins
+%{_libdir}/tizen-extensions-crosswalk/*
+%{_datadir}/%{name}/xwalk/examples/*
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index f75c5277..b7b9b245 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -24,11 +24,8 @@ add_subdirectory(common)
add_subdirectory(wheel)
add_subdirectory(dbus)
add_subdirectory(websocket)
-add_subdirectory(websocketsink)
-add_subdirectory(websocketsourceplugin)
add_subdirectory(obd2plugin)
add_subdirectory(demosink)
-add_subdirectory(tpms)
add_subdirectory(database)
add_subdirectory(opencvlux)
add_subdirectory(murphyplugin)
diff --git a/plugins/bluemonkey/CMakeLists.txt b/plugins/bluemonkey/CMakeLists.txt
index 6fdbae3d..53b621ac 100644
--- a/plugins/bluemonkey/CMakeLists.txt
+++ b/plugins/bluemonkey/CMakeLists.txt
@@ -25,7 +25,7 @@ if(communi)
add_library(bluemonkeyIrcModule MODULE irccoms.cpp)
set_target_properties(bluemonkeyIrcModule PROPERTIES PREFIX "")
- target_link_libraries(bluemonkeyIrcModule ${link_libraries} ${QT_LIBRARIES} ${communi_LIBRARIES})
+ 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)
@@ -35,7 +35,7 @@ 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} ${QT_LIBRARIES} ${Qt5Sql_LIBRARIES})
+ 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()
diff --git a/plugins/bluemonkey/bluemonkey.cpp b/plugins/bluemonkey/bluemonkey.cpp
index 081ec317..38d39a6d 100644
--- a/plugins/bluemonkey/bluemonkey.cpp
+++ b/plugins/bluemonkey/bluemonkey.cpp
@@ -81,9 +81,9 @@ QVariant gvariantToQVariant(GVariant *value)
{
gsize dictsize = g_variant_n_children(value);
QVariantList list;
- for (int i=0;i<dictsize;i++)
+ for (int i=0; i<dictsize; i++)
{
- GVariant *childvariant = g_variant_get_child_value(value,i);
+ GVariant *childvariant = g_variant_get_child_value(value, i);
GVariant *innervariant = g_variant_get_variant(childvariant);
list.append(gvariantToQVariant(innervariant));
}
@@ -95,14 +95,51 @@ QVariant gvariantToQVariant(GVariant *value)
}
+AbstractPropertyType* qVariantToAbstractPropertyType(QString name, QVariant var)
+{
+ if(!var.isValid())
+ return nullptr;
+
+ if(var.type() == QVariant::UInt)
+ return new BasicPropertyType<uint>(name.toStdString(), var.toUInt());
+ else if(var.type() == QVariant::Double)
+ return new BasicPropertyType<double>(name.toStdString(), var.toDouble());
+ else if(var.type() == QVariant::Bool)
+ return new BasicPropertyType<bool>(name.toStdString(), var.toBool());
+ else if(var.type() == QVariant::Int)
+ return new BasicPropertyType<int>(name.toStdString(), var.toInt());
+ else if(var.type() == QVariant::String)
+ return new StringPropertyType(name.toStdString(), var.toString().toStdString());
+ else if(var.type() == QVariant::List && var.toList().count())
+ {
+ QVariant subVariant = var.toList().at(0);
+ if(subVariant.type() == QVariant::UInt)
+ return new ListPropertyType<BasicPropertyType<uint>>(name.toStdString(), subVariant.toUInt());
+ else if(subVariant.type() == QVariant::Double)
+ return new ListPropertyType<BasicPropertyType<double>>(name.toStdString(), subVariant.toDouble());
+ else if(subVariant.type() == QVariant::Bool)
+ return new ListPropertyType<BasicPropertyType<bool>>(name.toStdString(), subVariant.toBool());
+ else if(subVariant.type() == QVariant::Int)
+ return new ListPropertyType<BasicPropertyType<int>>(name.toStdString(), subVariant.toInt());
+ else if(subVariant.type() == QVariant::String)
+ return new ListPropertyType<StringPropertyType>(name.toStdString(), subVariant.toString().toStdString());
+ }
+ return nullptr;
+}
+
BluemonkeySink::BluemonkeySink(AbstractRoutingEngine* e, map<string, string> config, AbstractSource &parent): QObject(0), AmbPluginImpl(e, config, parent), engine(nullptr), mSilentMode(false)
{
QTimer::singleShot(1,this,SLOT(reloadEngine()));
auth = new Authenticate(config, this);
+}
- qmlRegisterType<QTimer>("", 1, 0, "QTimer");
- qmlRegisterType<QObject>("", 1, 0, "QObject");
+BluemonkeySink::~BluemonkeySink()
+{
+ Q_FOREACH(void* module, modules)
+ {
+ dlclose(module);
+ }
}
@@ -149,11 +186,11 @@ QObject* BluemonkeySink::subscribeToZone(QString str, int zone)
QStringList BluemonkeySink::sourcesForProperty(QString property)
{
- std::list<std::string> list = routingEngine->sourcesForProperty(property.toStdString());
+ std::vector<std::string> list = routingEngine->sourcesForProperty(property.toStdString());
QStringList strList;
- for(auto itr = list.begin(); itr != list.end(); itr++)
+ for(auto itr : list)
{
- strList<<(*itr).c_str();
+ strList<<itr.c_str();
}
return strList;
@@ -195,6 +232,13 @@ void BluemonkeySink::loadConfig(QString str)
QJSValue val = engine->evaluate(script);
DebugOut()<<val.toString().toStdString()<<endl;
+
+ if(val.isError())
+ {
+ DebugOut(DebugOut::Error) << val.property("name").toString().toStdString() << endl;
+ DebugOut(DebugOut::Error) << val.property("message").toString().toStdString() << endl;
+ DebugOut(DebugOut::Error) << str.toStdString() << ":" <<val.property("lineNumber").toString().toStdString() << endl;
+ }
}
bool BluemonkeySink::loadModule(QString path)
@@ -207,6 +251,11 @@ bool BluemonkeySink::loadModule(QString path)
return false;
}
+ if(modules.contains(handle))
+ return false;
+
+ modules.push_back(handle);
+
void* c = dlsym(handle, "create");
if(!c)
@@ -221,8 +270,12 @@ bool BluemonkeySink::loadModule(QString path)
for(auto i : exports)
{
- QJSValue val = engine->newQObject(i.second);
- engine->globalObject().setProperty(i.first.c_str(), val);
+ std::string obj = i.first;
+ if(!engine->globalObject().hasProperty(obj.c_str()))
+ {
+ QJSValue val = engine->newQObject(i.second);
+ engine->globalObject().setProperty(obj.c_str(), val);
+ }
}
return true;
@@ -332,23 +385,11 @@ void BluemonkeySink::createCustomProperty(QString name, QJSValue defaultValue, i
{
QVariant var = defaultValue.toVariant();
- auto create = [defaultValue, name, var]() -> AbstractPropertyType*
- {
- if(!var.isValid())
- return nullptr;
-
- if(var.type() == QVariant::UInt)
- return new BasicPropertyType<uint>(name.toStdString(), var.toUInt());
- else if(var.type() == QVariant::Double)
- return new BasicPropertyType<double>(name.toStdString(), var.toDouble());
- else if(var.type() == QVariant::Bool)
- return new BasicPropertyType<bool>(name.toStdString(), var.toBool());
- else if(var.type() == QVariant::Int)
- return new BasicPropertyType<int>(name.toStdString(), var.toInt());
- else if(var.type() == QVariant::String)
- return new StringPropertyType(name.toStdString(), var.toString().toStdString());
+ DebugOut() << "Variant value for: " << name.toStdString() << " is " << defaultValue.toString().toStdString() << endl;
- return nullptr;
+ auto create = [name, var]() -> AbstractPropertyType*
+ {
+ return qVariantToAbstractPropertyType(name, var);
};
addPropertySupport(zone, create);
@@ -356,7 +397,7 @@ void BluemonkeySink::createCustomProperty(QString name, QJSValue defaultValue, i
AsyncSetPropertyRequest request;
request.property = name.toStdString();
request.zoneFilter = zone;
- request.value = VehicleProperty::getPropertyTypeForPropertyNameValue(name.toStdString(), var.toString().toStdString());
+ request.value = VehicleProperty::getPropertyTypeForPropertyNameValue(name.toStdString(), defaultValue.toString().toStdString());
routingEngine->updateSupported(supported(), PropertyList(), &source);
routingEngine->setProperty(request);
diff --git a/plugins/bluemonkey/bluemonkey.h b/plugins/bluemonkey/bluemonkey.h
index 8617f7e9..b25daccc 100644
--- a/plugins/bluemonkey/bluemonkey.h
+++ b/plugins/bluemonkey/bluemonkey.h
@@ -94,6 +94,7 @@ public:
using QObject::setProperty;
BluemonkeySink(AbstractRoutingEngine* e, map<string, string> config, AbstractSource& parent);
+ ~BluemonkeySink();
virtual PropertyList subscriptions();
virtual void supportedChanged(const PropertyList & supportedProperties);
virtual void propertyChanged(AbstractPropertyType* value);
@@ -148,6 +149,7 @@ public Q_SLOTS:
void createCustomProperty(QString name, QJSValue defaultValue, int zone);
private:
+ QList<void*> modules;
QJSEngine* engine;
QStringList configsToLoad;
diff --git a/plugins/bluemonkey/config.js b/plugins/bluemonkey/config.js
index c4a69879..a1dfd572 100644
--- a/plugins/bluemonkey/config.js
+++ b/plugins/bluemonkey/config.js
@@ -12,6 +12,8 @@ var Zone = {
BackSide : 1 << 9
};
+Zone.Driver = Zone.Front | Zone.Left;
+
bluemonkey.loadModule("");
bluemonkey.createCustomProperty("VehicleSpeed", 10);
@@ -83,6 +85,160 @@ bluemonkey.createCustomProperty("WasherFluidLevelLow", false);
bluemonkey.createCustomProperty("MalfunctionIndicatorOn", false);
+bluemonkey.createCustomProperty("AccumulatedEngineRuntime", 0);
+bluemonkey.createCustomProperty("DistanceWithMILOn", 0);
+bluemonkey.createCustomProperty("DistanceSinceCodeCleared", 0);
+bluemonkey.createCustomProperty("TimeRunMILOn", 0);
+bluemonkey.createCustomProperty("TimeTroubleCodeClear", 0);
+
+bluemonkey.createCustomProperty("BatteryVoltage", 13);
+bluemonkey.createCustomProperty("BatteryCurrent", 1);
+bluemonkey.createCustomProperty("BatteryChargeLevel", 100);
+
+bluemonkey.createCustomProperty("TirePressure", 200, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("TirePressureLow", false, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("TireTemperature", 20, Zone.Front | Zone.Right);
+
+bluemonkey.createCustomProperty("TirePressure", 200, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("TirePressureLow", false, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("TireTemperature", 20, Zone.Front | Zone.Left);
+
+bluemonkey.createCustomProperty("TirePressure", 200, Zone.Rear| Zone.Right);
+bluemonkey.createCustomProperty("TirePressureLow", false, Zone.Rear | Zone.Right);
+bluemonkey.createCustomProperty("TireTemperature", 20, Zone.Rear | Zone.Right);
+
+bluemonkey.createCustomProperty("TirePressure", 200, Zone.Rear | Zone.Left);
+bluemonkey.createCustomProperty("TirePressureLow", false, Zone.Rear | Zone.Left);
+bluemonkey.createCustomProperty("TireTemperature", 20, Zone.Rear | Zone.Left);
+
+bluemonkey.createCustomProperty("ActiveNoiseControlMode", false);
+bluemonkey.createCustomProperty("AvailableSounds", ["LightSpeed", "v8"]);
+bluemonkey.createCustomProperty("EngineSoundEnhancementMode", "");
+
+bluemonkey.createCustomProperty("SeatPositionBackCushion", 0, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("SeatPositionRecline", 0, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("SeatPositionSlide", 0, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("SeatPositionCushionHeight", 0, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("SeatPositionHeadrest", 0, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("SeatPositionSideCushion", 0, Zone.Front | Zone.Right);
+
+bluemonkey.createCustomProperty("SeatPositionBackCushion", 0, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("SeatPositionRecline", 0, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("SeatPositionSlide", 0, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("SeatPositionCushionHeight", 0, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("SeatPositionHeadrest", 0, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("SeatPositionSideCushion", 0, Zone.Front | Zone.Left);
+
+bluemonkey.createCustomProperty("VehicleDriveMode", "auto");
+
+bluemonkey.createCustomProperty("MirrorSettingPan", 0, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("MirrorSettingTilt", 0, Zone.Front | Zone.Left);
+
+bluemonkey.createCustomProperty("MirrorSettingPan", 0, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("MirrorSettingTilt", 0, Zone.Front | Zone.Right);
+
+bluemonkey.createCustomProperty("DashboardIllumination", 5);
+
+bluemonkey.createCustomProperty("AntilockBreakingSystem", false);
+bluemonkey.createCustomProperty("AntilockBreakingSystemEnabled", true);
+
+bluemonkey.createCustomProperty("TractionControlSystem", true);
+bluemonkey.createCustomProperty("TractionControlSystemEnabled", true);
+
+bluemonkey.createCustomProperty("ElectronicStabilityControlEnabled", true);
+bluemonkey.createCustomProperty("ElectronicStabilityControlEngaged", true);
+
+bluemonkey.createCustomProperty("VehicleTopSpeedLimit", 150);
+
+bluemonkey.createCustomProperty("AirbagActivated", true, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("AirbagDeployed", false, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("AirbagActivated", true, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("AirbagDeployed", false, Zone.Front | Zone.Right);
+
+bluemonkey.createCustomProperty("ChildSafetyLock", false, Zone.Rear | Zone.Left);
+bluemonkey.createCustomProperty("ChildSafetyLock", true, Zone.Rear | Zone.Right);
+
+bluemonkey.createCustomProperty("AntilockBrakingSystem", false);
+bluemonkey.createCustomProperty("AntilockBrakingSystemEnabled", true);
+
+bluemonkey.createCustomProperty("DoorStatusW3C", "closed", Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("DoorStatusW3C", "closed", Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("DoorStatusW3C", "closed", Zone.Rear | Zone.Right);
+bluemonkey.createCustomProperty("DoorStatusW3C", "closed", Zone.Rear | Zone.Left);
+bluemonkey.createCustomProperty("DoorLockStatus", true, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("DoorLockStatus", true, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("DoorLockStatus", true, Zone.Rear | Zone.Right);
+bluemonkey.createCustomProperty("DoorLockStatus", true, Zone.Rear | Zone.Left);
+
+bluemonkey.createCustomProperty("OccupantStatusW3C", "adult", Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("OccupantStatusW3C", "adult", Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("OccupantStatusW3C", "child", Zone.Rear | Zone.Right);
+bluemonkey.createCustomProperty("OccupantStatusW3C", "child", Zone.Rear | Zone.Left);
+bluemonkey.createCustomProperty("SeatBeltStatus", true, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("SeatBeltStatus", true, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("SeatBeltStatus", true, Zone.Rear | Zone.Right);
+bluemonkey.createCustomProperty("SeatBeltStatus", true, Zone.Rear | Zone.Left);
+bluemonkey.createCustomProperty("OccupantName", "Kevron", Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("OccupantName", "Irene", Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("OccupantName", "Miggie", Zone.Rear | Zone.Right);
+bluemonkey.createCustomProperty("OccupantName", "Emma", Zone.Rear | Zone.Left);
+bluemonkey.createCustomProperty("OccupantIdentificationType", "camera", Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("OccupantIdentificationType", "Bluetooth", Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("OccupantIdentificationType", "pin", Zone.Rear | Zone.Right);
+bluemonkey.createCustomProperty("OccupantIdentificationType", "pin", Zone.Rear | Zone.Left);
+
+bluemonkey.createCustomProperty("TargetTemperature", 20);
+bluemonkey.createCustomProperty("FanSpeed", 1);
+bluemonkey.createCustomProperty("AirConditioning", false);
+bluemonkey.createCustomProperty("Heater", false);
+bluemonkey.createCustomProperty("AirflowDirection", 0);
+bluemonkey.createCustomProperty("AirRecirculation", false);
+
+bluemonkey.createCustomProperty("TargetTemperature", 20, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("AirRecirculation", false, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("SteeringWheelHeater", 0, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("SeatHeater", 0, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("SeatCooler", 0, Zone.Front | Zone.Left);
+
+bluemonkey.createCustomProperty("AirflowDirection", 0, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("TargetTemperature", 25, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("SeatHeater", 0, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("SeatCooler", 0, Zone.Front | Zone.Right);
+
+bluemonkey.createCustomProperty("ExteriorTemperature", 30.0);
+bluemonkey.createCustomProperty("InteriorTemperature", 23.0);
+
+bluemonkey.createCustomProperty("DefrostWindow", false, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("DefrostMirrors", false, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("DefrostWindow", false, Zone.Front | Zone.Left);
+bluemonkey.createCustomProperty("DefrostMirrors", false, Zone.Front | Zone.Left);
+
+bluemonkey.createCustomProperty("RainSensor", 0);
+
+bluemonkey.createCustomProperty("WindsheildWiperSpeed", "off");
+bluemonkey.createCustomProperty("WindsheildWiperSetting", "auto");
+
+bluemonkey.createCustomProperty("ConvertableRoof", false);
+bluemonkey.createCustomProperty("ConvertableRoofStatus", "closed");
+
+bluemonkey.createCustomProperty("Sunroof", 0);
+bluemonkey.createCustomProperty("SunroofTilt", 0);
+
+bluemonkey.createCustomProperty("WindowStatus", 100, Zone.Driver);
+bluemonkey.createCustomProperty("WindowLockStatus", false, Zone.Driver);
+bluemonkey.createCustomProperty("WindowStatus", 100, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("WindowLockStatus", false, Zone.Front | Zone.Right);
+bluemonkey.createCustomProperty("WindowStatus", 100, Zone.Rear| Zone.Right);
+bluemonkey.createCustomProperty("WindowLockStatus", true, Zone.Rear | Zone.Right);
+bluemonkey.createCustomProperty("WindowStatus", 100, Zone.Rear| Zone.Left);
+bluemonkey.createCustomProperty("WindowLockStatus", true, Zone.Rear | Zone.Left);
+
+bluemonkey.createCustomProperty("AtmosphericPressure", 1013);
+
+bluemonkey.createCustomProperty("LaneDepartureStatus", "running");
+bluemonkey.createCustomProperty("AlarmStatus", "prearmed");
+bluemonkey.createCustomProperty("ParkingBrakeStatusW3C", "inactive");
+
var speedProperty = bluemonkey.subscribeTo("VehicleSpeed");
var testTimer = bluemonkey.createTimer();
@@ -92,3 +248,5 @@ var testTimer = bluemonkey.createTimer();
//VehicleSpeed
speedProperty.value = Math.floor((Math.random() * 100) + 1);
});
+
+//testTimer.start();
diff --git a/plugins/bluemonkey/irccoms.h b/plugins/bluemonkey/irccoms.h
index 0adc53ca..cf0ef0b8 100644
--- a/plugins/bluemonkey/irccoms.h
+++ b/plugins/bluemonkey/irccoms.h
@@ -14,7 +14,7 @@ class IrcCommunication: public IrcSession
{
Q_OBJECT
Q_PROPERTY(QStringList channels READ channels WRITE setChannels)
- Q_PROPERTY(bool ssl WRITE setSsl)
+ Q_PROPERTY(bool ssl READ ssl WRITE setSsl)
public:
IrcCommunication(std::map<std::string, std::string> config, QObject* parent=0);
QStringList channels() { return mChannels; }
@@ -22,6 +22,8 @@ public:
void announceDequeue();
+ bool ssl() { return isSecure(); }
+
public Q_SLOTS:
void respond(QString target, QString msg);
void announce(QString);
diff --git a/plugins/cansimplugin/cansimplugin.cpp b/plugins/cansimplugin/cansimplugin.cpp
index 28aeb0da..319104a6 100644
--- a/plugins/cansimplugin/cansimplugin.cpp
+++ b/plugins/cansimplugin/cansimplugin.cpp
@@ -227,7 +227,7 @@ void CANSimPlugin::createMappingTable(const PropertyList& /*supported*/)
{
VehicleProperty::Property propertyName(*propIt);
- std::list<std::string> sources(routingEngine->sourcesForProperty(propertyName));
+ std::vector<std::string> sources(routingEngine->sourcesForProperty(propertyName));
size_t size = sources.size();
bool IAmTheSource = contains(sources, uuid());
diff --git a/plugins/common/ambplugin.h b/plugins/common/ambplugin.h
index 47fc94e4..04fa3b19 100644
--- a/plugins/common/ambplugin.h
+++ b/plugins/common/ambplugin.h
@@ -134,7 +134,7 @@ public:
* \param property the property to get info for.
* \return a PropertyInfo object.
*/
- virtual PropertyInfo getPropertyInfo(VehicleProperty::Property property);
+ virtual PropertyInfo getPropertyInfo(const VehicleProperty::Property & property);
// from AbstractSink
public:
@@ -239,7 +239,7 @@ int AmbPlugin<T>::supportedOperations()
}
template<typename T>
-PropertyInfo AmbPlugin<T>::getPropertyInfo(VehicleProperty::Property property)
+PropertyInfo AmbPlugin<T>::getPropertyInfo(const VehicleProperty::Property &property)
{
return d ? d->getPropertyInfo(property) : PropertyInfo::invalid();
}
diff --git a/plugins/common/ambpluginimpl.cpp b/plugins/common/ambpluginimpl.cpp
index 66f6ee6f..ec678f7b 100644
--- a/plugins/common/ambpluginimpl.cpp
+++ b/plugins/common/ambpluginimpl.cpp
@@ -81,11 +81,8 @@ AsyncPropertyReply *AmbPluginImpl::setProperty(const AsyncSetPropertyRequest& re
AbstractPropertyType *value = findPropertyType(request.property, request.zoneFilter);
if (value && request.value) {
DebugOut(2) << "updating property "<< request.property << " to: " << request.value->toString() << endl;
- value->fromString(request.value->toString());
- DebugOut(2) << "New value of property "<< request.property << " is: " << value->toString() << endl;
- value->timestamp = amb::currentTime();
+ value->quickCopy(request.value);
routingEngine->updateProperty(value, uuid());
-
reply->success = true;
reply->error = AsyncPropertyReply::NoError;
}
@@ -101,12 +98,7 @@ AsyncPropertyReply *AmbPluginImpl::setProperty(const AsyncSetPropertyRequest& re
void AmbPluginImpl::subscribeToPropertyChanges(const VehicleProperty::Property& property)
{
- std::list<Zone::Type> zones = getPropertyInfo(property).zones();
- for( auto it=zones.begin(); it!=zones.end(); ++it) {
- AbstractPropertyType *value = findPropertyType(property, *it);
- if(value)
- routingEngine->updateProperty(value, uuid());
- }
+
}
PropertyList AmbPluginImpl::supported() const
@@ -168,7 +160,7 @@ std::shared_ptr<AbstractPropertyType> AmbPluginImpl::addPropertySupport(Zone::Ty
return propertyType;
}
-PropertyInfo AmbPluginImpl::getPropertyInfo(const VehicleProperty::Property& property) const
+PropertyInfo AmbPluginImpl::getPropertyInfo(const VehicleProperty::Property & property)
{
auto it = properties.find(property);
if(it != properties.end()) {
diff --git a/plugins/common/ambpluginimpl.h b/plugins/common/ambpluginimpl.h
index 27c2dcda..070b6d10 100644
--- a/plugins/common/ambpluginimpl.h
+++ b/plugins/common/ambpluginimpl.h
@@ -102,7 +102,7 @@ public:
* \param property the property to get info for.
* \return a PropertyInfo object.
*/
- virtual PropertyInfo getPropertyInfo(const VehicleProperty::Property& property) const;
+ virtual PropertyInfo getPropertyInfo(const VehicleProperty::Property & property);
// aka AbstractSink:
public:
diff --git a/plugins/common/bluetooth5.cpp b/plugins/common/bluetooth5.cpp
index 474955b9..06f0e0f1 100644
--- a/plugins/common/bluetooth5.cpp
+++ b/plugins/common/bluetooth5.cpp
@@ -199,35 +199,43 @@ std::string findDevice(std::string address, std::string adapterPath="")
Bluetooth5::Bluetooth5()
{
- GError* error = NULL;
+ GError* errorIntrospection = NULL;
- GDBusNodeInfo* introspection = g_dbus_node_info_new_for_xml(introspection_xml, &error);
+ GDBusNodeInfo* introspection = g_dbus_node_info_new_for_xml(introspection_xml, &errorIntrospection);
- if(error)
+ auto errorIntrospectionPtr = amb::make_super(errorIntrospection);
+
+ if(errorIntrospectionPtr)
{
- DebugOut(DebugOut::Error)<<"in instrospection xml: "<<error->message<<endl;
- g_error_free(error);
- throw -1;
+ DebugOut(DebugOut::Error)<<"in instrospection xml: "<<errorIntrospectionPtr->message<<endl;
+ return;
}
+ GError* errorBus = nullptr;
+
GDBusInterfaceInfo* mInterfaceInfo = g_dbus_node_info_lookup_interface(introspection, "org.bluez.Profile1");
- GDBusConnection *mConnection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &error);
+ mConnection = amb::make_super(g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &errorBus));
- if(error)
+ auto errorBusPtr = amb::make_super(errorBus);
+
+ if(errorBusPtr)
{
- DebugOut(DebugOut::Error)<<"getting system bus: "<<error->message<<endl;
- g_error_free(error);
- throw -1;
+ DebugOut(DebugOut::Error)<<"getting system bus: "<<errorBusPtr->message<<endl;
+ return;
}
- int regId = g_dbus_connection_register_object(mConnection, "/org/bluez/spp", mInterfaceInfo, &interfaceVTable, this, NULL, &error);
- g_dbus_node_info_unref(introspection);
+ GError* errorRegister = nullptr;
+
+ int regId = g_dbus_connection_register_object(mConnection.get(), "/org/bluez/spp", mInterfaceInfo, &interfaceVTable, this, NULL, &errorRegister);
- if(error)
+ auto errorRegisterPtr = amb::make_super(errorRegister);
+
+ if(errorRegisterPtr)
{
- g_error_free(error);
- throw -1;
+
+ DebugOut(DebugOut::Error)<<"Registering org.bluez.Profile1 Interface: "<<errorRegisterPtr->message<<endl;
+ return;
}
GVariantBuilder builder;
@@ -237,18 +245,22 @@ Bluetooth5::Bluetooth5()
g_variant_builder_add(&builder, "{sv}", "Role", g_variant_new("s","client"));
g_variant_builder_add(&builder, "{sv}", "AutoConnect", g_variant_new("b",true));
- g_dbus_connection_call_sync(mConnection,
+ GError* errorRegisterCall = nullptr;
+
+ g_dbus_connection_call_sync(mConnection.get(),
"org.bluez",
"/org/bluez",
"org.bluez.ProfileManager1",
"RegisterProfile",
g_variant_new("(osa{sv})", "/org/bluez/spp", "00001101-0000-1000-8000-00805F9B34FB", &builder),
- nullptr, G_DBUS_CALL_FLAGS_NONE, -1, nullptr, &error);
+ nullptr, G_DBUS_CALL_FLAGS_NONE, -1, nullptr, &errorRegisterCall);
+
+ auto errorRegisterCallPtr = amb::make_super(errorRegisterCall);
- if(error)
+ if(errorRegisterCallPtr)
{
- DebugOut(DebugOut::Error)<<"RegisterProfile failed: "<<error->message<<endl;
- throw -1;
+ DebugOut(DebugOut::Error)<<"RegisterProfile failed: "<<errorRegisterCallPtr->message<<endl;
+ return;
}
}
diff --git a/plugins/common/bluetooth5.h b/plugins/common/bluetooth5.h
index d540e1de..d737d521 100644
--- a/plugins/common/bluetooth5.h
+++ b/plugins/common/bluetooth5.h
@@ -3,6 +3,7 @@
#include <string>
#include <functional>
+#include <superptr.hpp>
typedef std::function<void(int)> ConnectedCallback;
@@ -22,6 +23,7 @@ public:
private:
ConnectedCallback mConnected;
+ amb::super_ptr<GDBusConnection> mConnection;
std::string mPath;
};
diff --git a/plugins/database/databasesink.cpp b/plugins/database/databasesink.cpp
index ae18d36a..75d7033e 100644
--- a/plugins/database/databasesink.cpp
+++ b/plugins/database/databasesink.cpp
@@ -2,6 +2,9 @@
#include "abstractroutingengine.h"
#include "listplusplus.h"
#include "superptr.hpp"
+#include "uuidhelper.h"
+
+#include <thread>
int bufferLength = 100;
int timeout=1000;
@@ -11,15 +14,16 @@ extern "C" AbstractSinkManager * create(AbstractRoutingEngine* routingengine, ma
return new DatabaseSinkManager(routingengine, config);
}
-void * cbFunc(gpointer data)
+void * cbFunc(Shared* shared)
{
- Shared *shared = static_cast<Shared*>(data);
-
if(!shared)
{
throw std::runtime_error("Could not cast shared object.");
}
+ ///new tripID:
+ shared->tripId = amb::createUuid();
+
vector<DictionaryList<string> > insertList;
while(1)
@@ -41,6 +45,7 @@ void * cbFunc(gpointer data)
NameValuePair<string> zone("zone", boost::lexical_cast<string>(obj.zone));
NameValuePair<string> four("time", boost::lexical_cast<string>(obj.time));
NameValuePair<string> five("sequence", boost::lexical_cast<string>(obj.sequence));
+ NameValuePair<string> six("tripId", boost::lexical_cast<string>(shared->tripId));
dict.push_back(one);
dict.push_back(two);
@@ -48,6 +53,7 @@ void * cbFunc(gpointer data)
dict.push_back(zone);
dict.push_back(four);
dict.push_back(five);
+ dict.push_back(six);
insertList.push_back(dict);
@@ -127,11 +133,11 @@ int getNextEvent(gpointer data)
}
DatabaseSink::DatabaseSink(AbstractRoutingEngine *engine, map<std::string, std::string> config)
- :AbstractSource(engine,config),thread(NULL),shared(NULL),playback(false),playbackShared(NULL), playbackMultiplier(1)
+ :AbstractSource(engine,config),shared(nullptr),playback(false),playbackShared(nullptr), playbackMultiplier(1)
{
databaseName = "storage";
tablename = "data";
- tablecreate = "CREATE TABLE IF NOT EXISTS data (key TEXT, value BLOB, source TEXT, zone REAL, time REAL, sequence REAL)";
+ tablecreate = "CREATE TABLE IF NOT EXISTS data (key TEXT, value BLOB, source TEXT, zone REAL, time REAL, sequence REAL, tripId TEXT)";
if(config.find("databaseFile") != config.end())
{
@@ -267,7 +273,7 @@ void DatabaseSink::stopDb()
obj.quit = true;
shared->queue.append(obj);
- g_thread_join(thread);
+ thread.join();
delete shared;
shared = NULL;
@@ -289,7 +295,7 @@ void DatabaseSink::startDb()
initDb();
- thread = g_thread_new("dbthread", cbFunc, shared);
+ thread = std::thread(cbFunc, shared);
}
void DatabaseSink::startPlayback()
diff --git a/plugins/database/databasesink.h b/plugins/database/databasesink.h
index bb9697ae..6933612c 100644
--- a/plugins/database/databasesink.h
+++ b/plugins/database/databasesink.h
@@ -23,169 +23,80 @@
#include "abstractsink.h"
#include "abstractsource.h"
#include "basedb.hpp"
+#include <asyncqueue.hpp>
#include "listplusplus.h"
#include <glib.h>
#include <functional>
+#include <thread>
+#include <mutex>
+#include <condition_variable>
#include <unordered_map>
const std::string DatabaseLogging = "DatabaseLogging";
const std::string DatabasePlayback = "DatabasePlayback";
const std::string DatabaseFile = "DatabaseFile";
-template <typename T>
-class Queue
-{
+class DBObject {
public:
- Queue()
- {
- g_mutex_init(&mutex);
- g_cond_init(&cond);
- }
- virtual ~Queue()
- {
-
- }
-
- int count()
- {
- g_mutex_lock(&mutex);
- int ret = mQueue.count();
- g_mutex_unlock(&mutex);
+ DBObject(): zone(0), time(0), sequence(0), quit(false) {}
+ std::string key;
+ std::string value;
+ std::string source;
+ int32_t zone;
+ double time;
+ int32_t sequence;
+ std::string tripId;
- return ret;
- }
+ bool quit;
- T pop()
+ bool operator ==(const DBObject & other) const
{
- g_mutex_lock(&mutex);
-
- while(!mQueue.size())
- {
- g_cond_wait(&cond, &mutex);
- }
-
- auto itr = mQueue.begin();
-
- T item = *itr;
-
- mQueue.erase(itr);
-
- g_mutex_unlock(&mutex);
-
- return item;
+ return (key == other.key && source == other.source && zone == other.zone &&
+ value == other.value && sequence == other.sequence && time == other.time);
}
- virtual void append(T item)
+ bool operator != (const DBObject & other)
{
- g_mutex_lock(&mutex);
-
- g_cond_signal(&cond);
-
- mQueue.push_back(item);
-
- g_mutex_unlock(&mutex);
+ return (*this == other) == false;
}
-
-protected:
- GMutex mutex;
- GCond cond;
- std::vector<T> mQueue;
};
-template <typename T>
-class UniqueQueue
+namespace amb
{
-public:
- UniqueQueue()
- {
- g_mutex_init(&mutex);
- g_cond_init(&cond);
- }
- virtual ~UniqueQueue()
- {
- }
-
- int count()
- {
- g_mutex_lock(&mutex);
- int ret = mQueue.count();
- g_mutex_unlock(&mutex);
-
- return ret;
- }
-
- T pop()
- {
- g_mutex_lock(&mutex);
-
- while(!mQueue.size())
- {
- g_cond_wait(&cond, &mutex);
- }
-
- auto itr = mQueue.begin();
-
- T item = (*itr);
-
- mQueue.erase(itr);
-
- g_mutex_unlock(&mutex);
-
- return item;
- }
-
- void append(T item)
+struct DBObjectCompare
+{
+ bool operator()(DBObject const & lhs, DBObject & rhs) const
{
- g_mutex_lock(&mutex);
-
- g_cond_signal(&cond);
-
- if(contains(mQueue, item))
+ if (lhs == rhs)
{
- /// remove old one. We only want the freshest of values
- mQueue.erase(std::find(mQueue.begin(), mQueue.end(), item));
+ return true;
}
- mQueue.push_back(item);
- g_mutex_unlock(&mutex);
+ return false;
}
-private:
- GMutex mutex;
- GCond cond;
- std::vector<T> mQueue;
};
-class DBObject {
-public:
- DBObject(): zone(0), time(0), sequence(0), quit(false) {}
- std::string key;
- std::string value;
- std::string source;
- int32_t zone;
- double time;
- int32_t sequence;
- bool quit;
+}
- bool operator ==(const DBObject & other) const
+namespace std {
+ template <> struct hash<DBObject>
+ {
+ size_t operator()(const DBObject & x) const
{
- return (key == other.key && source == other.source && zone == other.zone &&
- value == other.value && sequence == other.sequence && time == other.time);
+ return x.key.length();
}
-
- bool operator != (const DBObject & other)
- {
- return (*this == other) == false;
- }
-};
+ };
+}
class Shared
{
public:
Shared()
+ :queue(true)
{
db = new BaseDB;
}
@@ -195,7 +106,8 @@ public:
}
BaseDB * db;
- UniqueQueue<DBObject> queue;
+ amb::Queue<DBObject, amb::DBObjectCompare> queue;
+ std::string tripId;
};
class PlaybackShared
@@ -259,7 +171,7 @@ private: //methods:
private:
PropertyList mSubscriptions;
Shared *shared;
- GThread* thread;
+ std::thread thread;
//std::string databaseName;
std::string tablename;
std::string tablecreate;
diff --git a/plugins/dbus/abstractproperty.h b/plugins/dbus/abstractproperty.h
index fb40fa6b..181375d7 100644
--- a/plugins/dbus/abstractproperty.h
+++ b/plugins/dbus/abstractproperty.h
@@ -88,7 +88,13 @@ public:
}
void setSourceFilter(std::string filter) { mSourceFilter = filter; }
- void setZoneFilter(Zone::Type zone) { mZoneFilter = zone; }
+ void setZoneFilter(Zone::Type zone)
+ {
+ if(mValue)
+ mValue->zone = zone;
+
+ mZoneFilter = zone;
+ }
std::string sourceFilter() { return mSourceFilter; }
Zone::Type zoneFilter() { return mZoneFilter; }
diff --git a/plugins/dbus/dbusinterfacemanager.cpp b/plugins/dbus/dbusinterfacemanager.cpp
index ad7039b2..d70e1d29 100644
--- a/plugins/dbus/dbusinterfacemanager.cpp
+++ b/plugins/dbus/dbusinterfacemanager.cpp
@@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "listplusplus.h"
#include "automotivemanager.h"
+#include <unordered_set>
///properties:
#include "runningstatus.h"
@@ -36,24 +37,25 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "drivingsafety.h"
#include "personalization.h"
-std::map<std::string, std::map<Zone::Type, bool> > getUniqueSourcesList(AbstractRoutingEngine *re, PropertyList implementedProperties)
+
+std::unordered_map<std::string, std::unordered_set<Zone::Type>> getUniqueSourcesList(AbstractRoutingEngine *re, PropertyList implementedProperties)
{
- std::map<std::string, std::map<Zone::Type, bool>> uniqueSourcesList;
+ std::unordered_map<std::string, std::unordered_set<Zone::Type>> uniqueSourcesList;
for(auto itr = implementedProperties.begin(); itr != implementedProperties.end(); itr++)
{
VehicleProperty::Property property = *itr;
- std::list<std::string> sources = re->sourcesForProperty(property);
+ std::vector<std::string> sources = re->sourcesForProperty(property);
for(auto itr2 = sources.begin(); itr2 != sources.end(); itr2++)
{
std::string source = *itr2;
- PropertyInfo info = re->getPropertyInfo(property,source);
+ PropertyInfo info = re->getPropertyInfo(property, source);
- std::map<Zone::Type, bool> uniqueZoneList;
+ std::unordered_set<Zone::Type> uniqueZoneList;
- if(uniqueSourcesList.find(source) != uniqueSourcesList.end())
+ if(uniqueSourcesList.count(source))
{
uniqueZoneList = uniqueSourcesList[source];
}
@@ -62,12 +64,12 @@ std::map<std::string, std::map<Zone::Type, bool> > getUniqueSourcesList(Abstract
if(!zoneList.size())
{
- uniqueZoneList[Zone::None] = true;
+ uniqueZoneList.emplace(Zone::None);
}
- for(auto zoneItr = zoneList.begin(); zoneItr != zoneList.end(); zoneItr++)
+ for(auto zoneItr : zoneList)
{
- uniqueZoneList[*zoneItr] = true;
+ uniqueZoneList.emplace(zoneItr);
}
uniqueSourcesList[source] = uniqueZoneList;
@@ -78,79 +80,50 @@ std::map<std::string, std::map<Zone::Type, bool> > getUniqueSourcesList(Abstract
}
template <typename T>
-void exportProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
+void exportProperty(VehicleProperty::Property prop, AbstractRoutingEngine *re, GDBusConnection *connection)
{
- T* t = new T(re, connection);
+ T* t = new T(prop, re, connection);
+
+ prop = t->objectName();
/// check if we need more than one instance:
PropertyList implementedProperties = t->wantsProperties();
- std::map<std::string, std::map<Zone::Type, bool> > uniqueSourcesList = getUniqueSourcesList(re, implementedProperties);
+ std::unordered_map<std::string, std::unordered_set<Zone::Type> > uniqueSourcesList = getUniqueSourcesList(re, implementedProperties);
delete t;
- for(auto itr = uniqueSourcesList.begin(); itr != uniqueSourcesList.end(); itr++)
+ PropertyList supported = re->supported();
+
+ for(auto itr : uniqueSourcesList)
{
- std::map<Zone::Type, bool> zones = (*itr).second;
+ std::unordered_set<Zone::Type> zones = itr.second;
- std::string source = (*itr).first;
+ std::string source = itr.first;
std::string objectPath = "/" + source;
boost::algorithm::erase_all(objectPath, "-");
- for(auto zoneItr = zones.begin(); zoneItr != zones.end(); zoneItr++)
+ for(auto zone : zones)
{
- Zone::Type zone = (*zoneItr).first;
- T* t = new T(re, connection);
+ T* t = new T(prop, re, connection);
std::stringstream fullobjectPath;
fullobjectPath<< objectPath << "/" << zone << "/" <<t->objectName();
t->setObjectPath(fullobjectPath.str());
t->setSourceFilter(source);
t->setZoneFilter(zone);
- t->supportedChanged(re->supported());
+ t->supportedChanged(supported);
}
}
}
template <typename T>
-void exportProperty(VehicleProperty::Property prop, AbstractRoutingEngine *re, GDBusConnection *connection)
+void exportProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
{
- T* t = new T(prop, re, connection);
-
- /// check if we need more than one instance:
-
- PropertyList implementedProperties = t->wantsProperties();
-
- std::map<std::string, std::map<Zone::Type, bool> > uniqueSourcesList = getUniqueSourcesList(re, implementedProperties);
-
- delete t;
-
- for(auto itr = uniqueSourcesList.begin(); itr != uniqueSourcesList.end(); itr++)
- {
- std::map<Zone::Type, bool> zones = (*itr).second;
-
- std::string source = (*itr).first;
-
- std::string objectPath = "/" + source;
-
- boost::algorithm::erase_all(objectPath, "-");
-
- for(auto zoneItr = zones.begin(); zoneItr != zones.end(); zoneItr++)
- {
- Zone::Type zone = (*zoneItr).first;
- T* t = new T(prop, re, connection);
- std::stringstream fullobjectPath;
- fullobjectPath<< objectPath << "/" << zone << "/" <<t->objectName();
- t->setObjectPath(fullobjectPath.str());
- t->setSourceFilter(source);
- t->setZoneFilter(zone);
- t->supportedChanged(re->supported());
- }
-
- }
+ exportProperty<T>("", re, connection);
}
static void
@@ -162,74 +135,7 @@ on_bus_acquired (GDBusConnection *connection, const gchar *name, gpointer user_d
new AutomotiveManager(connection);
- /// properties:
- exportProperty<AccelerationProperty>(iface->re,connection);
- exportProperty<VehicleSpeedProperty>(iface->re, connection);
- exportProperty<TireProperty>(iface->re, connection);
- exportProperty<EngineSpeedProperty>(iface->re, connection);
- exportProperty<VehiclePowerModeProperty>(iface->re, connection);
- exportProperty<TripMeterProperty>(iface->re, connection);
- exportProperty<TransmissionProperty>(iface->re, connection);
- exportProperty<CruiseControlProperty>(iface->re, connection);
- exportProperty<WheelBrakeProperty>(iface->re, connection);
- exportProperty<BrakeOperation>(iface->re, connection);
- exportProperty<LightStatusProperty>(iface->re, connection);
- exportProperty<HornProperty>(iface->re, connection);
- exportProperty<FuelProperty>(iface->re, connection);
- exportProperty<EngineOilProperty>(iface->re, connection);
- exportProperty<ExteriorBrightnessProperty>(iface->re, connection);
- exportProperty<Temperature>(iface->re, connection);
- exportProperty<RainSensor>(iface->re, connection);
- exportProperty<WindshieldWiper>(iface->re, connection);
- exportProperty<HVACProperty>(iface->re, connection);
- exportProperty<ClimateControlProperty>(iface->re, connection);
- exportProperty<WindowStatusProperty>(iface->re, connection);
- exportProperty<DefrostProperty>(iface->re, connection);
- exportProperty<Sunroof>(iface->re, connection);
- exportProperty<ConvertibleRoof>(iface->re, connection);
- exportProperty<VehicleId>(iface->re, connection);
- exportProperty<VehicleTypeProperty>(iface->re, connection);
- exportProperty<FuelInfoProperty>(iface->re, connection);
- exportProperty<SizeProperty>(iface->re, connection);
- exportProperty<DoorsProperty>(iface->re, connection);
- exportProperty<WheelInformationProperty>(iface->re, connection);
- exportProperty<OdometerProperty>(iface->re, connection);
- exportProperty<FluidProperty>(iface->re, connection);
- exportProperty<BatteryProperty>(iface->re, connection);
- exportProperty<BatteryStatusProperty>(iface->re, connection);
- exportProperty<SecurityAlertProperty>(iface->re, connection);
- exportProperty<ParkingBrakeProperty>(iface->re, connection);
- exportProperty<ParkingLightProperty>(iface->re, connection);
- exportProperty<HazardLightProperty>(iface->re, connection);
- exportProperty<LocationProperty>(iface->re, connection);
- exportProperty<AntilockBrakingSystemProperty>(iface->re, connection);
- exportProperty<TractionControlSystemProperty>(iface->re, connection);
- exportProperty<VehicleTopSpeedLimitProperty>(iface->re, connection);
- exportProperty<AirbagStatusProperty>(iface->re, connection);
- exportProperty<DoorStatusProperty>(iface->re, connection);
- exportProperty<SeatBeltStatusProperty>(iface->re, connection);
- exportProperty<OccupantStatusProperty>(iface->re, connection);
- exportProperty<ObstacleDistanceProperty>(iface->re, connection);
- exportProperty<SeatPostionProperty>(iface->re, connection);
- exportProperty<SteeringWheelPositionProperty>(iface->re, connection);
- exportProperty<SteeringWheel>(iface->re, connection);
- exportProperty<MirrorSettingProperty>(iface->re, connection);
- exportProperty<ThrottlePosition>(iface->re, connection);
- exportProperty<EngineCoolant>(iface->re, connection);
- exportProperty<NightMode>(iface->re, connection);
- exportProperty<DrivingMode>(iface->re, connection);
- exportProperty<PowertrainTorque>(iface->re, connection);
- exportProperty<AcceleratorPedalPosition>(iface->re, connection);
- exportProperty<Chime>(iface->re, connection);
- exportProperty<WheelTick>(iface->re, connection);
- exportProperty<IgnitionTime>(iface->re, connection);
- exportProperty<YawRate>(iface->re, connection);
- exportProperty<TransmissionClutch>(iface->re, connection);
- exportProperty<TransmissionOil>(iface->re, connection);
- exportProperty<BrakeMaintenance>(iface->re, connection);
- exportProperty<WasherFluid>(iface->re, connection);
-
- iface->registerCustomTypes();
+ iface->registerTypes();
}
static void
@@ -257,13 +163,13 @@ DBusInterfaceManager::DBusInterfaceManager(AbstractRoutingEngine* engine,std::ma
{
DBusSink::dbusConfig = config;
ownerId = g_bus_own_name(G_BUS_TYPE_SYSTEM,
- DBusServiceName,
- G_BUS_NAME_OWNER_FLAGS_NONE,
- on_bus_acquired,
- on_name_acquired,
- on_name_lost,
- this,
- NULL);
+ DBusServiceName,
+ G_BUS_NAME_OWNER_FLAGS_NONE,
+ on_bus_acquired,
+ on_name_acquired,
+ on_name_lost,
+ this,
+ NULL);
}
@@ -280,18 +186,98 @@ void DBusInterfaceManager::supportedChanged(const PropertyList &supportedPropert
return;
}
- registerCustomTypes();
+ registerTypes();
}
-void DBusInterfaceManager::registerCustomTypes()
+void DBusInterfaceManager::registerTypes()
{
+ /// properties:
+ exportProperty<AccelerationProperty>(re, connection);
+ exportProperty<VehicleSpeedProperty>(re, connection);
+ exportProperty<TireProperty>(re, connection);
+ exportProperty<EngineSpeedProperty>(re, connection);
+ exportProperty<VehiclePowerModeProperty>(re, connection);
+ exportProperty<TripMeterProperty>(re, connection);
+ exportProperty<TransmissionProperty>(re, connection);
+ exportProperty<CruiseControlProperty>(re, connection);
+ exportProperty<WheelBrakeProperty>(re, connection);
+ exportProperty<BrakeOperation>(re, connection);
+ exportProperty<LightStatusProperty>(re, connection);
+ exportProperty<HornProperty>(re, connection);
+ exportProperty<FuelProperty>(re, connection);
+ exportProperty<EngineOilProperty>(re, connection);
+ exportProperty<ExteriorBrightnessProperty>(re, connection);
+ exportProperty<Temperature>(re, connection);
+ exportProperty<RainSensor>(re, connection);
+ exportProperty<WindshieldWiper>(re, connection);
+ exportProperty<HVACProperty>(re, connection);
+ exportProperty<ClimateControlProperty>(re, connection);
+ exportProperty<WindowStatusProperty>(re, connection);
+ exportProperty<DefrostProperty>(re, connection);
+ exportProperty<Sunroof>(re, connection);
+ exportProperty<ConvertibleRoof>(re, connection);
+ exportProperty<VehicleId>(re, connection);
+ exportProperty<VehicleTypeProperty>(re, connection);
+ exportProperty<FuelInfoProperty>(re, connection);
+ exportProperty<SizeProperty>(re, connection);
+ exportProperty<DoorsProperty>(re, connection);
+ exportProperty<WheelInformationProperty>(re, connection);
+ exportProperty<OdometerProperty>(re, connection);
+ exportProperty<FluidProperty>(re, connection);
+ exportProperty<BatteryProperty>(re, connection);
+ exportProperty<BatteryStatusProperty>(re, connection);
+ exportProperty<SecurityAlertProperty>(re, connection);
+ exportProperty<ParkingBrakeProperty>(re, connection);
+ exportProperty<ParkingLightProperty>(re, connection);
+ exportProperty<HazardLightProperty>(re, connection);
+ exportProperty<LocationProperty>(re, connection);
+ exportProperty<AntilockBrakingSystemProperty>(re, connection);
+ exportProperty<TractionControlSystemProperty>(re, connection);
+ exportProperty<VehicleTopSpeedLimitProperty>(re, connection);
+ exportProperty<AirbagStatusProperty>(re, connection);
+ exportProperty<DoorStatusProperty>(re, connection);
+ exportProperty<SeatBeltStatusProperty>(re, connection);
+ exportProperty<OccupantStatusProperty>(re, connection);
+ exportProperty<ObstacleDistanceProperty>(re, connection);
+ exportProperty<SeatPostionProperty>(re, connection);
+ exportProperty<SteeringWheelPositionProperty>(re, connection);
+ exportProperty<SteeringWheel>(re, connection);
+ exportProperty<MirrorSettingProperty>(re, connection);
+ exportProperty<ThrottlePosition>(re, connection);
+ exportProperty<EngineCoolant>(re, connection);
+ exportProperty<NightMode>(re, connection);
+ exportProperty<DrivingMode>(re, connection);
+ exportProperty<PowertrainTorque>(re, connection);
+ exportProperty<AcceleratorPedalPosition>(re, connection);
+ exportProperty<Chime>(re, connection);
+ exportProperty<WheelTick>(re, connection);
+ exportProperty<IgnitionTime>(re, connection);
+ exportProperty<YawRate>(re, connection);
+ exportProperty<TransmissionClutch>(re, connection);
+ exportProperty<TransmissionOil>(re, connection);
+ exportProperty<BrakeMaintenance>(re, connection);
+ exportProperty<WasherFluid>(re, connection);
+ exportProperty<MalfunctionIndicator>(re, connection);
+ exportProperty<Diagnostics>(re, connection);
+ exportProperty<MirrorProperty>(re, connection);
+ exportProperty<SeatAdjustment>(re, connection);
+ exportProperty<DriveMode>(re, connection);
+ exportProperty<VehicleSound>(re, connection);
+ exportProperty<ElectronicStabilityControl>(re, connection);
+ exportProperty<ChildSafetyLock>(re, connection);
+ exportProperty<SeatProperty>(re, connection);
+ exportProperty<DoorProperty>(re, connection);
+ exportProperty<WindshieldWiperStatus>(re, connection);
+ exportProperty<SideWindowStatusProperty>(re, connection);
+ exportProperty<AtmosphericPressure>(re, connection);
+ exportProperty<LaneDepartureStatus>(re, connection);
+ exportProperty<AlarmStatus>(re, connection);
+
PropertyList list = VehicleProperty::customProperties();
PropertyList implemented = AbstractDBusInterface::implementedProperties();
- for (auto itr = list.begin(); itr != list.end(); itr++)
+ for (auto prop : list)
{
- VehicleProperty::Property prop = *itr;
-
if(!contains(implemented, prop))
{
exportProperty<CustomPropertyInterface>(prop, re, connection);
@@ -314,5 +300,3 @@ void DBusInterfaceManager::registerCustomTypes()
}
}
}
-
-
diff --git a/plugins/dbus/dbusinterfacemanager.h b/plugins/dbus/dbusinterfacemanager.h
index 72a48082..4e306fd7 100644
--- a/plugins/dbus/dbusinterfacemanager.h
+++ b/plugins/dbus/dbusinterfacemanager.h
@@ -41,7 +41,7 @@ public:
GDBusConnection * connection;
- void registerCustomTypes();
+ void registerTypes();
private:
diff --git a/plugins/dbus/dbusplugin.cpp b/plugins/dbus/dbusplugin.cpp
index 3e9fc86a..e95644ed 100644
--- a/plugins/dbus/dbusplugin.cpp
+++ b/plugins/dbus/dbusplugin.cpp
@@ -57,6 +57,13 @@ void DBusSink::supportedChanged(const PropertyList &supportedProperties)
{
if(contains(supportedProperties, itr->ambPropertyName()))
{
+ PropertyInfo info = re->getPropertyInfo(itr->ambPropertyName(), mSourceFilter);
+
+ if (!info.isValid() || !contains(info.zones(), zoneFilter))
+ {
+ continue;
+ }
+
VariantType* prop = itr;
prop->setSourceFilter(mSourceFilter);
prop->setZoneFilter(zoneFilter);
diff --git a/plugins/dbus/dbussignaller.h b/plugins/dbus/dbussignaller.h
index 5cb10f6f..60d25cf4 100644
--- a/plugins/dbus/dbussignaller.h
+++ b/plugins/dbus/dbussignaller.h
@@ -117,7 +117,7 @@ private:
variantMap[property->name()] = val;
variantMap[sequenceName] = g_variant_new("i", property->sequence());
variantMap["Time"] = g_variant_new("d", property->timestamp());
- variantMap["Zone"] = g_variant_new("i", property->value()->zone);
+ variantMap["Zone"] = g_variant_new("i", property->zoneFilter());
}
GVariantBuilder builder;
diff --git a/plugins/dbus/drivingsafety.h b/plugins/dbus/drivingsafety.h
index 80806386..4fec8c7b 100644
--- a/plugins/dbus/drivingsafety.h
+++ b/plugins/dbus/drivingsafety.h
@@ -8,20 +8,26 @@
class AntilockBrakingSystemProperty: public DBusSink
{
public:
- AntilockBrakingSystemProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ AntilockBrakingSystemProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("AntilockBrakingSystem", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::AntilockBrakingSystem, "AntilockBrakingSystem", "b", AbstractProperty::Read);
+ /// TODO: Deprecated. Remove in 0.14
+ wantPropertyVariant(VehicleProperty::AntilockBrakingSystem, "AntilockBrakingSystem", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::AntilockBrakingSystem, "Engaged", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::AntilockBrakingSystemEnabled, "Enabled", AbstractProperty::Read);
}
};
class TractionControlSystemProperty: public DBusSink
{
public:
- TractionControlSystemProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ TractionControlSystemProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("TractionControlSystem", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::TractionControlSystem, "TractionControlSystem", "b", AbstractProperty::Read);
+ /// TODO: Deprecated. Remove in 0.14
+ wantPropertyVariant(VehicleProperty::TractionControlSystem, "TractionControlSystem", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::TractionControlSystemEnabled, "Enabled", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::TractionControlSystem, "Engaged", AbstractProperty::Read);
}
};
@@ -29,81 +35,124 @@ public:
class VehicleTopSpeedLimitProperty: public DBusSink
{
public:
- VehicleTopSpeedLimitProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ VehicleTopSpeedLimitProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("VehicleTopSpeedLimit", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::VehicleTopSpeedLimit, "VehicleTopSpeedLimit", "q", AbstractProperty::Read);
+ /// TODO: Deprecated. Remove in 0.14
+ wantPropertyVariant(VehicleProperty::VehicleTopSpeedLimit, "VehicleTopSpeedLimit", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::VehicleTopSpeedLimit, "Speed", AbstractProperty::Read);
}
};
class AirbagStatusProperty: public DBusSink
{
public:
- AirbagStatusProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ AirbagStatusProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("AirbagStatus", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::AirbagStatus, "AirbagStatus", "y", AbstractProperty::Read);
+ /// TODO: Deprecated in 0.14
+ wantPropertyVariant(VehicleProperty::AirbagStatus, "AirbagStatus", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::AirbagActivated, "AirbagActivated", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::AirbagDeployed, "AirbagDeployed", AbstractProperty::Read);
}
};
-/// TODO: deprecated. remove in 0.13
+/// TODO: deprecated. remove in 0.14
class DoorStatusProperty: public DBusSink
{
public:
- DoorStatusProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ DoorStatusProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("DoorStatus", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::DoorStatus, "DoorStatus", "b", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::DoorStatus, "DoorStatus", AbstractProperty::Read);
- wantPropertyVariant(VehicleProperty::DoorLockStatus, "DoorLockStatus", "b", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::DoorLockStatus, "DoorLockStatus", AbstractProperty::Read);
- wantPropertyVariant(VehicleProperty::ChildLockStatus, "ChildLockStatus", "b", AbstractProperty::Read);
+ ///TODO: Deprecated in 0.14
+ wantPropertyVariant(VehicleProperty::ChildLockStatus, "ChildLockStatus", AbstractProperty::Read);
}
};
class DoorProperty: public DBusSink
{
public:
- DoorProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ DoorProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("Door", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::DoorStatusW3C, "Status", AbstractProperty::Read);
- wantPropertyVariant(VehicleProperty::DoorLockStatus, "Lock", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::DoorLockStatus, "Lock", AbstractProperty::ReadWrite);
+ ///TODO: Deprecated in 0.14
wantPropertyVariant(VehicleProperty::ChildLockStatus, "ChildLock", AbstractProperty::Read);
}
};
+/// TODO: Deprecated in 0.14
class SeatBeltStatusProperty: public DBusSink
{
public:
- SeatBeltStatusProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ SeatBeltStatusProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("SeatBelt", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::SeatBeltStatus, "Status", "b", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::SeatBeltStatus, "Status", AbstractProperty::Read);
}
};
+/// TODO: Deprecated in 0.14
class OccupantStatusProperty: public DBusSink
{
public:
- OccupantStatusProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ OccupantStatusProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("OccupantStatus", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::OccupantStatus, "OccupantStatus", "i", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::OccupantStatus, "OccupantStatus", AbstractProperty::Read);
}
};
class ObstacleDistanceProperty: public DBusSink
{
public:
- ObstacleDistanceProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ ObstacleDistanceProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("ObstacleDistance", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::ObstacleDistance, "ObstacleDistance", "d", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::ObstacleDistance, "ObstacleDistance", AbstractProperty::Read);
+ }
+};
+
+class ElectronicStabilityControl: public DBusSink
+{
+public:
+ ElectronicStabilityControl(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
+ :DBusSink("ElectronicStabilityControl", re, connection, map<string, string>())
+ {
+ wantPropertyVariant(VehicleProperty::ElectronicStabilityControlEnabled, "Enabled", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::ElectronicStabilityControlEngaged, "Engaged", AbstractProperty::Read);
+ }
+};
+
+class ChildSafetyLock: public DBusSink
+{
+public:
+ ChildSafetyLock(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
+ :DBusSink("ChildSafetyLock", re, connection, map<string, string>())
+ {
+ wantPropertyVariant(VehicleProperty::ChildLockStatus, "Lock", AbstractProperty::ReadWrite);
+ }
+};
+
+class SeatProperty: public DBusSink
+{
+public:
+ SeatProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
+ :DBusSink("Seat", re, connection, map<string, string>())
+ {
+ wantPropertyVariant(VehicleProperty::OccupantStatusW3C, "Occupant", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SeatBeltStatus, "SeatBelt", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::OccupantName, "OccupantName", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::OccupantIdentificationType, "IdentificationType", AbstractProperty::ReadWrite);
}
};
diff --git a/plugins/dbus/environmentproperties.h b/plugins/dbus/environmentproperties.h
index 3815152d..a235f976 100644
--- a/plugins/dbus/environmentproperties.h
+++ b/plugins/dbus/environmentproperties.h
@@ -9,7 +9,7 @@
class ExteriorBrightnessProperty: public DBusSink
{
public:
- ExteriorBrightnessProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ ExteriorBrightnessProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("ExteriorBrightness", re, connection, map<string, string>())
{
/**
@@ -27,25 +27,16 @@ public:
class Temperature: public DBusSink
{
public:
- Temperature(AbstractRoutingEngine* re, GDBusConnection* connection)
+ Temperature(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("Temperature", re, connection, map<string, string>())
{
- /**
- * @attributeName Interior
- * @type signed long
- * @access readonly
- * @attributeComment \brief Must return the temperature of the interior of the vehicle in celcius.
- */
+
+ ///TODO Depricated in 0.14. Use InteriorTemperature
wantPropertyVariant(VehicleProperty::InteriorTemperature, "Interior", AbstractProperty::Read);
wantPropertyVariant(VehicleProperty::InteriorTemperature, "InteriorTemperature", AbstractProperty::Read);
- /**
- * @attributeName Exterior
- * @type signed long
- * @access readonly
- * @attributeComment \brief Must return the temperature of the exterior of the vehicle in celcius.
- */
+ ///TODO Depricated in 0.14. Use ExteriorTemperature
wantPropertyVariant(VehicleProperty::ExteriorTemperature, "Exterior", AbstractProperty::Read);
wantPropertyVariant(VehicleProperty::ExteriorTemperature, "ExteriorTemperature", AbstractProperty::Read);
@@ -58,50 +49,44 @@ public:
class RainSensor: public DBusSink
{
public:
- RainSensor(AbstractRoutingEngine* re, GDBusConnection* connection)
+ RainSensor(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("RainSensor", re, connection, map<string, string>())
{
- /**
- * @attributeName RainSensor
- * @type unsigned short
- * @access readonly
- * @attributeComment \brief Must return level of rain intensity 0: No Rain - 10: Heaviest Rain.
- */
- wantPropertyVariant(VehicleProperty::RainSensor, "RainSensor", "q", AbstractProperty::Read);
-
+ ///TODO: Depricated in 0.14
+ wantPropertyVariant(VehicleProperty::RainSensor, "RainSensor", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::RainSensor, "RainIntensity", AbstractProperty::Read);
}
};
/** @interface WindshieldWiper : VehiclePropertyType **/
+///TODO: depricated in 0.14
class WindshieldWiper: public DBusSink
{
public:
- WindshieldWiper(AbstractRoutingEngine* re, GDBusConnection* connection)
+ WindshieldWiper(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("WindshieldWiper", re, connection, map<string, string>())
{
- /**
- * @enum const unsigned short WIPERSPEED_OFF = 0;
- * @enum const unsigned short WIPERSPEED_SLOWEST= 1;
- * @enum const unsigned short WIPERSPEED_FASTEST = 5;
- * @enum const unsigned short WIPERSPEED_AUTO = 10;
- **/
-
- /**
- * @attributeName WindshieldWiper
- * @type unsigned short
- * @access readonly
- * @attributeComment \brief Must return Level of windshield whiper speed (see WIPERSPEED_)
- */
- wantPropertyVariant(VehicleProperty::RainSensor, "WindshieldWiper", "y", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::WindshieldWiper, "WindshieldWiper", AbstractProperty::ReadWrite);
+ }
+};
+class WindshieldWiperStatus: public DBusSink
+{
+public:
+ WindshieldWiperStatus(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
+ :DBusSink("WiperStatus", re, connection, map<string, string>())
+ {
+ wantPropertyVariant(VehicleProperty::WindshieldWiperSpeed, "WiperSpeed", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::WindshieldWiperSetting, "WiperSetting", AbstractProperty::ReadWrite);
}
};
/** @interface HVAC : VehiclePropertyType **/
+///TODO Depricated in 0.14. Use ClimateControl
class HVACProperty: public DBusSink
{
public:
- HVACProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ HVACProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("HVAC", re, connection, map<string, string>())
{
/**
@@ -118,7 +103,7 @@ public:
* @attributeComment \brief Must return airflow direction. See AIRFLOWDIRECTION_*.
*/
/// TODO: Deprecated. Remove in 0.13
- wantPropertyVariant(VehicleProperty::AirflowDirection, "AirflowDirection", "y", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::AirflowDirection, "AirflowDirection", AbstractProperty::ReadWrite);
/**
* @attributeName FanSpeed
@@ -191,7 +176,7 @@ public:
class ClimateControlProperty: public DBusSink
{
public:
- ClimateControlProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ ClimateControlProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("ClimateControl", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::AirflowDirectionW3C, "AirflowDirection", AbstractProperty::ReadWrite);
@@ -215,10 +200,11 @@ public:
};
/** @interface WindowStatus : VehiclePropertyType **/
+/// TODO: Depricated in 0.14. Use SideWindow
class WindowStatusProperty: public DBusSink
{
public:
- WindowStatusProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ WindowStatusProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("WindowStatus", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::WindowStatus,"Openness", AbstractProperty::ReadWrite);
@@ -226,10 +212,21 @@ public:
}
};
+class SideWindowStatusProperty: public DBusSink
+{
+public:
+ SideWindowStatusProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
+ :DBusSink("SideWindow", re, connection, map<string, string>())
+ {
+ wantPropertyVariant(VehicleProperty::WindowStatus,"Openness", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::WindowLockStatus, "Lock", AbstractProperty::ReadWrite);
+ }
+};
+
class DefrostProperty: public DBusSink
{
public:
- DefrostProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ DefrostProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("Defrost", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::DefrostWindow,"DefrostWindow", AbstractProperty::ReadWrite);
@@ -241,13 +238,11 @@ public:
class Sunroof: public DBusSink
{
public:
- Sunroof(AbstractRoutingEngine* re, GDBusConnection* connection)
+ Sunroof(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("Sunroof", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::Sunroof, "Openness", "y", AbstractProperty::ReadWrite);
-
- wantPropertyVariant(VehicleProperty::SunroofTilt, "Tilt", "y", AbstractProperty::ReadWrite);
-
+ wantPropertyVariant(VehicleProperty::Sunroof, "Openness", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SunroofTilt, "Tilt", AbstractProperty::ReadWrite);
}
};
@@ -255,10 +250,21 @@ public:
class ConvertibleRoof: public DBusSink
{
public:
- ConvertibleRoof(AbstractRoutingEngine* re, GDBusConnection* connection)
+ ConvertibleRoof(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("ConvertibleRoof", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::ConvertibleRoof, "Openness", "y", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::ConvertibleRoof, "Setting", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::ConvertibleRoofStatus, "Status", AbstractProperty::Read);
+ }
+};
+
+class AtmosphericPressure: public DBusSink
+{
+public:
+ AtmosphericPressure(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
+ :DBusSink("AtmosphericPressure", re, connection, map<string, string>())
+ {
+ wantPropertyVariant(VehicleProperty::AtmosphericPressure, "Pressure", AbstractProperty::ReadWrite);
}
};
#endif
diff --git a/plugins/dbus/maintenance.h b/plugins/dbus/maintenance.h
index 180b7c12..318921ba 100644
--- a/plugins/dbus/maintenance.h
+++ b/plugins/dbus/maintenance.h
@@ -10,7 +10,7 @@
class OdometerProperty: public DBusSink
{
public:
- OdometerProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ OdometerProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("Odometer", re, connection, map<string, string>())
{
/** @attributeName Odometer
@@ -30,7 +30,7 @@ public:
class FluidProperty : public DBusSink
{
public:
- FluidProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ FluidProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("Fluid", re, connection, map<string, string>())
{
/** @attributeName Transmission
@@ -63,7 +63,7 @@ public:
class BatteryProperty: public DBusSink
{
public:
- BatteryProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ BatteryProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("Battery", re, connection, map<string, string>())
{
/** @attributeName Voltage
@@ -87,7 +87,7 @@ public:
class BatteryStatusProperty: public DBusSink
{
public:
- BatteryStatusProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ BatteryStatusProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("BatteryStatus", re, connection, map<string, string>())
{
/** @attributeName Voltage
@@ -113,7 +113,7 @@ public:
class TireProperty: public DBusSink
{
public:
- TireProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ TireProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("Tire", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::TirePressure, "Pressure", AbstractProperty::Read);
@@ -126,7 +126,7 @@ public:
class EngineCoolant: public DBusSink
{
public:
- EngineCoolant(AbstractRoutingEngine* re, GDBusConnection* connection)
+ EngineCoolant(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("EngineCoolant", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::EngineCoolantLevel, "Level", AbstractProperty::Read);
@@ -137,7 +137,7 @@ public:
class TransmissionOil: public DBusSink
{
public:
- TransmissionOil(AbstractRoutingEngine* re, GDBusConnection* connection)
+ TransmissionOil(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("TransmissionOil", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::TransmissionOilWear, "Wear", AbstractProperty::Read);
@@ -148,7 +148,7 @@ public:
class TransmissionClutch: public DBusSink
{
public:
- TransmissionClutch(AbstractRoutingEngine* re, GDBusConnection* connection)
+ TransmissionClutch(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("TransmissionClutch", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::TransmissionClutchWear, "Wear", AbstractProperty::Read);
@@ -158,7 +158,7 @@ public:
class BrakeMaintenance: public DBusSink
{
public:
- BrakeMaintenance(AbstractRoutingEngine* re, GDBusConnection* connection)
+ BrakeMaintenance(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("BrakeMaintenance", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::BrakePadWear, "PadWear", AbstractProperty::Read);
@@ -170,7 +170,7 @@ public:
class WasherFluid: public DBusSink
{
public:
- WasherFluid(AbstractRoutingEngine* re, GDBusConnection* connection)
+ WasherFluid(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("WasherFluid", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::WasherFluidLevel, "Level", AbstractProperty::Read);
@@ -181,11 +181,25 @@ public:
class MalfunctionIndicator: public DBusSink
{
public:
- MalfunctionIndicator(AbstractRoutingEngine* re, GDBusConnection* connection)
+ MalfunctionIndicator(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("MalfunctionIndicator", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::MalfunctionIndicatorOn, "On", AbstractProperty::Read);
}
};
+class Diagnostics: public DBusSink
+{
+public:
+ Diagnostics(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
+ :DBusSink("Diagnostics", re, connection, map<string, string>())
+ {
+ wantPropertyVariant(VehicleProperty::AccumulatedEngineRuntime, "AccumulatedEngineRuntime", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::DistanceWithMILOn, "DistanceWithMILOn", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::DistanceSinceCodeCleared, "DistanceSinceCodeCleared", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::TimeRunMILOn, "TimeRunMILOn", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::TimeTroubleCodeClear, "TimeTroubleCodeClear", AbstractProperty::Read);
+ }
+};
+
#endif
diff --git a/plugins/dbus/parking.h b/plugins/dbus/parking.h
index 95707afd..483fd259 100644
--- a/plugins/dbus/parking.h
+++ b/plugins/dbus/parking.h
@@ -6,22 +6,14 @@
#include "abstractdbusinterface.h"
#include "abstractroutingengine.h"
-/** @interface SecurityAlert : VehiclePropertyType **/
+///TODO Deprecated in 0.14. Use AlarmStatus
class SecurityAlertProperty: public DBusSink
{
public:
- SecurityAlertProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ SecurityAlertProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("SecurityAlert", re, connection, map<string, string>())
{
-
- /** @attributeName SecurityAlert
- * @type boolean
- * @access readonly
- * @attributeComment \brief MUST return
- **/
wantProperty<Security::Status>(VehicleProperty::SecurityAlertStatus,"SecurityAlert", "i", AbstractProperty::Read);
-
-
}
};
@@ -29,7 +21,7 @@ public:
class ParkingBrakeProperty: public DBusSink
{
public:
- ParkingBrakeProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ ParkingBrakeProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("ParkingBrake", re, connection, map<string, string>())
{
/** @attributeName ParkingBrake
@@ -39,15 +31,18 @@ public:
**/
wantProperty<bool>(VehicleProperty::ParkingBrakeStatus,"ParkingBrake", "b", AbstractProperty::Read);
-
+ wantPropertyVariant(VehicleProperty::ParkingBrakeStatusW3C,"Status", AbstractProperty::Read);
+
+
}
};
/** @interface ParkingLight : VehiclePropertyType **/
+///TODO: Deprecated in 0.14
class ParkingLightProperty: public DBusSink
{
public:
- ParkingLightProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ ParkingLightProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("ParkingLight", re, connection, map<string, string>())
{
/** @attributeName ParkingLight
@@ -56,8 +51,6 @@ public:
* @attributeComment must return status of parking light: Engaged = true, Disengaged = false.
**/
wantProperty<bool>(VehicleProperty::ParkingLightStatus,"ParkingLight", "b", AbstractProperty::Read);
-
-
}
};
@@ -65,7 +58,7 @@ public:
class HazardLightProperty: public DBusSink
{
public:
- HazardLightProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ HazardLightProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("HazardLight", re, connection, map<string, string>())
{
/** @attributeName HazardLight
@@ -74,8 +67,26 @@ public:
* @attributeComment must return status of hazard light: Engaged = true, Disengaged = false.
**/
wantProperty<bool>(VehicleProperty::HazardLightStatus,"HazardLight", "b", AbstractProperty::ReadWrite);
+ }
+};
-
+class LaneDepartureStatus: public DBusSink
+{
+public:
+ LaneDepartureStatus(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
+ :DBusSink("LaneDepartureDetection", re, connection, map<string, string>())
+ {
+ wantPropertyVariant(VehicleProperty::LaneDepartureStatus, "Status", AbstractProperty::Read);
+ }
+};
+
+class AlarmStatus: public DBusSink
+{
+public:
+ AlarmStatus(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
+ :DBusSink("Alarm", re, connection, map<string, string>())
+ {
+ wantPropertyVariant(VehicleProperty::AlarmStatus, "Status", AbstractProperty::ReadWrite);
}
};
diff --git a/plugins/dbus/personalization.h b/plugins/dbus/personalization.h
index 5489054f..f6bc518a 100644
--- a/plugins/dbus/personalization.h
+++ b/plugins/dbus/personalization.h
@@ -5,43 +5,93 @@
#include "abstractdbusinterface.h"
#include "abstractroutingengine.h"
+///TODO Deprecated. Remove in 0.14
class SeatPostionProperty: public DBusSink
{
public:
- SeatPostionProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ SeatPostionProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("SeatPosition", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::SeatPositionBackCushion,"BackCushion", "i", AbstractProperty::ReadWrite);
- wantPropertyVariant(VehicleProperty::SeatPositionRecline,"Recline", "i", AbstractProperty::ReadWrite);
- wantPropertyVariant(VehicleProperty::SeatPositionSlide,"Slide", "i", AbstractProperty::ReadWrite);
- wantPropertyVariant(VehicleProperty::SeatPositionCushionHeight,"CushionHeight", "i", AbstractProperty::ReadWrite);
- wantPropertyVariant(VehicleProperty::SeatPositionHeadrest,"Headrest", "i", AbstractProperty::ReadWrite);
- wantPropertyVariant(VehicleProperty::SeatPositionSideCushion,"SideCushion", "i", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SeatPositionBackCushion, "BackCushion", "i", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SeatPositionRecline, "Recline", "i", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SeatPositionSlide, "Slide", "i", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SeatPositionCushionHeight, "CushionHeight", "i", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SeatPositionHeadrest, "Headrest", "i", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SeatPositionSideCushion, "SideCushion", "i", AbstractProperty::ReadWrite);
}
-
-
};
class SteeringWheelPositionProperty: public DBusSink
{
public:
- SteeringWheelPositionProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ SteeringWheelPositionProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("SteeringWheelPosition", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::SteeringWheelPositionSlide,"Slide", "i", AbstractProperty::ReadWrite);
- wantPropertyVariant(VehicleProperty::SteeringWheelPositionTilt,"Tilt", "i", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SteeringWheelPositionSlide, "Slide", "i", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::SteeringWheelPositionTilt, "Tilt", "i", AbstractProperty::ReadWrite);
}
};
+///TODO Deprecated. Remove in 0.14
class MirrorSettingProperty: public DBusSink
{
public:
- MirrorSettingProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ MirrorSettingProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("MirrorSetting", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::MirrorSettingPan,"Pan", "i", AbstractProperty::ReadWrite);
- wantPropertyVariant(VehicleProperty::MirrorSettingTilt,"Tilt", "i", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::MirrorSettingPan, "Pan", "i", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::MirrorSettingTilt, "Tilt", "i", AbstractProperty::ReadWrite);
+ }
+};
+
+class MirrorProperty: public DBusSink
+{
+public:
+ MirrorProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
+ :DBusSink("Mirror", re, connection, map<string, string>())
+ {
+ wantPropertyVariant(VehicleProperty::MirrorSettingPan, "MirrorPan", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::MirrorSettingTilt, "MirrorTilt", AbstractProperty::ReadWrite);
+ }
+};
+
+class SeatAdjustment: public DBusSink
+{
+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);
}
};
+class DriveMode: public DBusSink
+{
+public:
+ DriveMode(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
+ :DBusSink("DriveMode", re, connection, map<string, string>())
+ {
+ wantPropertyVariant(VehicleProperty::VehicleDriveMode, "DriveMode", AbstractProperty::ReadWrite);
+ }
+};
+
+class VehicleSound: public DBusSink
+{
+public:
+ VehicleSound(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
+ :DBusSink("VehicleSound", re, connection, map<string, string>())
+ {
+ wantPropertyVariant(VehicleProperty::ActiveNoiseControlMode, "ActiveNoiseControlMode", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::EngineSoundEnhancementMode, "EngineSoundEnhancementMode", AbstractProperty::ReadWrite);
+ wantPropertyVariant(VehicleProperty::AvailableSounds, "AvailableSounds", AbstractProperty::ReadWrite);
+ }
+};
+
+
+
#endif
diff --git a/plugins/dbus/runningstatus.h b/plugins/dbus/runningstatus.h
index b557f486..4d5825c9 100644
--- a/plugins/dbus/runningstatus.h
+++ b/plugins/dbus/runningstatus.h
@@ -27,7 +27,7 @@
class VehicleSpeedProperty: public DBusSink
{
public:
- VehicleSpeedProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ VehicleSpeedProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("VehicleSpeed", re, connection, map<string, string>())
{
/** @attributeName VehicleSpeed
@@ -49,7 +49,7 @@ public:
class EngineSpeedProperty: public DBusSink
{
public:
- EngineSpeedProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ EngineSpeedProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("EngineSpeed", re, connection, map<string, string>())
{
/** @attributeName EngineSpeed
@@ -71,7 +71,7 @@ public:
class VehiclePowerModeProperty: public DBusSink
{
public:
- VehiclePowerModeProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ VehiclePowerModeProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("VehiclePowerMode", re, connection, map<string, string>())
{
/**
@@ -96,7 +96,7 @@ public:
class TripMeterProperty: public DBusSink
{
public:
- TripMeterProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
+ TripMeterProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("TripMeter", re, connection, map<string, string>())
{
/** @attributeName TripMeters
@@ -113,7 +113,7 @@ public:
class AccelerationProperty: public DBusSink
{
public:
- AccelerationProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
+ AccelerationProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("Acceleration", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::AccelerationX, "X", AbstractProperty::Read);
@@ -127,7 +127,7 @@ public:
class TransmissionProperty: public DBusSink
{
public:
- TransmissionProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
+ TransmissionProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("Transmission", re, connection, map<string, string>())
{
@@ -151,7 +151,7 @@ public:
class CruiseControlProperty: public DBusSink
{
public:
- CruiseControlProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
+ CruiseControlProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("CruiseControlStatus", re, connection, map<string, string>())
{
///TODO: deprecate Activated. Remove in 0.14
@@ -166,7 +166,7 @@ public:
class WheelBrakeProperty: public DBusSink
{
public:
- WheelBrakeProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
+ WheelBrakeProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("WheelBrake", re, connection, map<string, string>())
{
/** @attributeName Engaged
@@ -183,7 +183,7 @@ public:
class BrakeOperation: public DBusSink
{
public:
- BrakeOperation(AbstractRoutingEngine *re, GDBusConnection *connection)
+ BrakeOperation(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("BrakeOperation", re, connection, map<string, string>())
{
/** @attributeName Engaged
@@ -200,7 +200,7 @@ public:
class LightStatusProperty: public DBusSink
{
public:
- LightStatusProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
+ LightStatusProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("LightStatus", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::LightHead, "Head", "b", AbstractProperty::ReadWrite);
@@ -220,7 +220,7 @@ public:
class InteriorLightStatusProperty: public DBusSink
{
public:
- InteriorLightStatusProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
+ InteriorLightStatusProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("InteriorLightStatus", re, connection, map<string, string>())
{
/// TODO: deprecated remove in 0.14
@@ -238,7 +238,7 @@ public:
class HornProperty: public DBusSink
{
public:
- HornProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
+ HornProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("Horn", re, connection, map<string, string>())
{
/// TODO: deprecated remove in 0.14
@@ -252,7 +252,7 @@ public:
class FuelProperty: public DBusSink
{
public:
- FuelProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
+ FuelProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("Fuel", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::FuelLevel,"Level", AbstractProperty::Read);
@@ -278,7 +278,7 @@ public:
class EngineOilProperty: public DBusSink
{
public:
- EngineOilProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
+ EngineOilProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("EngineOil", re, connection, map<string, string>())
{
///TODO depricated. Use Level. Remove in 0.14
@@ -296,7 +296,7 @@ public:
class LocationProperty: public DBusSink
{
public:
- LocationProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
+ LocationProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("Location", re, connection, map<string, string>())
{
/** @attributeName Latitude
@@ -333,7 +333,7 @@ public:
class SteeringWheel: public DBusSink
{
public:
- SteeringWheel(AbstractRoutingEngine *re, GDBusConnection *connection)
+ SteeringWheel(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("SteeringWheel", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::SteeringWheelAngleW3C, "Angle", AbstractProperty::Read);
@@ -343,7 +343,7 @@ public:
class ThrottlePosition: public DBusSink
{
public:
- ThrottlePosition(AbstractRoutingEngine *re, GDBusConnection *connection)
+ ThrottlePosition(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("ThrottlePosition", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::ThrottlePosition, "Value", AbstractProperty::Read);
@@ -353,7 +353,7 @@ public:
class NightMode: public DBusSink
{
public:
- NightMode(AbstractRoutingEngine *re, GDBusConnection *connection)
+ NightMode(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("NightMode", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::NightMode, "NightMode", "b", AbstractProperty::Read);
@@ -364,7 +364,7 @@ public:
class DrivingMode: public DBusSink
{
public:
- DrivingMode(AbstractRoutingEngine *re, GDBusConnection *connection)
+ DrivingMode(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("DrivingMode", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::DrivingMode, "DrivingMode", "i", AbstractProperty::Read);
@@ -375,7 +375,7 @@ public:
class PowertrainTorque: public DBusSink
{
public:
- PowertrainTorque(AbstractRoutingEngine *re, GDBusConnection *connection)
+ PowertrainTorque(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("PowertrainTorque", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::PowertrainTorque, "Value", AbstractProperty::Read);
@@ -385,7 +385,7 @@ public:
class AcceleratorPedalPosition: public DBusSink
{
public:
- AcceleratorPedalPosition(AbstractRoutingEngine *re, GDBusConnection *connection)
+ AcceleratorPedalPosition(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("AcceleratorPedalPosition", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::AcceleratorPedalPosition, "Value", AbstractProperty::Read);
@@ -395,7 +395,7 @@ public:
class Chime: public DBusSink
{
public:
- Chime(AbstractRoutingEngine *re, GDBusConnection *connection)
+ Chime(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("Chime", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::Chime, "Status", AbstractProperty::Read);
@@ -405,7 +405,7 @@ public:
class WheelTick: public DBusSink
{
public:
- WheelTick(AbstractRoutingEngine *re, GDBusConnection *connection)
+ WheelTick(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("WheelTick", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::WheelTick, "Value", AbstractProperty::Read);
@@ -415,7 +415,7 @@ public:
class IgnitionTime: public DBusSink
{
public:
- IgnitionTime(AbstractRoutingEngine *re, GDBusConnection *connection)
+ IgnitionTime(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("IgnitionTime", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::IgnitionTimeOn, "IgnitionTimeOn", AbstractProperty::Read);
@@ -426,7 +426,7 @@ public:
class YawRate: public DBusSink
{
public:
- YawRate(AbstractRoutingEngine *re, GDBusConnection *connection)
+ YawRate(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("YawRate", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::YawRate, "Value", AbstractProperty::Read);
@@ -436,7 +436,7 @@ public:
class ButtonEvent: public DBusSink
{
public:
- ButtonEvent(AbstractRoutingEngine *re, GDBusConnection *connection)
+ ButtonEvent(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection)
:DBusSink("ButtonEvent", re, connection, map<string, string>())
{
wantPropertyVariant(VehicleProperty::YawRate, "Value", AbstractProperty::Read);
diff --git a/plugins/dbus/varianttype.cpp b/plugins/dbus/varianttype.cpp
index 933eccad..6af9d03d 100644
--- a/plugins/dbus/varianttype.cpp
+++ b/plugins/dbus/varianttype.cpp
@@ -68,8 +68,7 @@ void VariantType::fromGVariant(GVariant *val)
{
DebugOut(DebugOut::Error)<<"SetProperty fail: "<<reply->error<<endl;
}
- ///TODO: we segfault here.
- ///if(v) delete v;
+
delete reply;
};
diff --git a/plugins/dbus/vehicleinfo.h b/plugins/dbus/vehicleinfo.h
index 4071adc1..e1120d80 100644
--- a/plugins/dbus/vehicleinfo.h
+++ b/plugins/dbus/vehicleinfo.h
@@ -10,7 +10,7 @@
class VehicleId: public DBusSink
{
public:
- VehicleId(AbstractRoutingEngine* re, GDBusConnection* connection)
+ VehicleId(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("VehicleId", re, connection, map<string, string>())
{
/** @attributeName WMI
@@ -28,7 +28,7 @@ public:
**/
wantPropertyVariant(VehicleProperty::VIN, "VIN", "s", AbstractProperty::Read);
-
+
}
};
@@ -36,7 +36,7 @@ public:
class SizeProperty: public DBusSink
{
public:
- SizeProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ SizeProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("Size", re, connection, map<string, string>())
{
/** @attributeName Width
@@ -60,7 +60,7 @@ public:
**/
wantPropertyVariant(VehicleProperty::VehicleLength, "Length", "u", AbstractProperty::Read);
-
+
}
};
@@ -68,7 +68,7 @@ public:
class FuelInfoProperty: public DBusSink
{
public:
- FuelInfoProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ FuelInfoProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("FuelInfo", re, connection, map<string, string>())
{
/**
@@ -100,7 +100,7 @@ public:
**/
wantPropertyVariant(VehicleProperty::FuelPositionSide, "RefuelPosition", "y", AbstractProperty::Read);
-
+
}
};
@@ -108,7 +108,7 @@ public:
class VehicleTypeProperty: public DBusSink
{
public:
- VehicleTypeProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ VehicleTypeProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("VehicleType", re, connection, map<string, string>())
{
/**
@@ -127,7 +127,7 @@ public:
**/
wantPropertyVariant(VehicleProperty::VehicleType, "Type", "y", AbstractProperty::Read);
-
+
}
};
@@ -135,7 +135,7 @@ public:
class DoorsProperty: public DBusSink
{
public:
- DoorsProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ DoorsProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("Doors", re, connection, map<string, string>())
{
/** @attributeName DoorsPerRow
@@ -148,7 +148,7 @@ public:
**/
wantPropertyVariant(VehicleProperty::DoorsPerRow, "DoorsPerRow", "ay", AbstractProperty::Read);
-
+
}
};
@@ -156,7 +156,7 @@ public:
class WheelInformationProperty: public DBusSink
{
public:
- WheelInformationProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ WheelInformationProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("WheelInformation", re, connection, map<string, string>())
{
@@ -187,8 +187,6 @@ public:
* @attributeComment \brief MUST return Antilock Brake System status: on = true, off = false.
**/
wantPropertyVariant(VehicleProperty::AntilockBrakingSystem, "AntilockBrakingSystem", "b", AbstractProperty::Read);
-
-
}
};
diff --git a/plugins/exampleplugin.cpp b/plugins/exampleplugin.cpp
index 2e59d295..ecfefaba 100644
--- a/plugins/exampleplugin.cpp
+++ b/plugins/exampleplugin.cpp
@@ -201,9 +201,9 @@ void ExampleSourcePlugin::getPropertyAsync(AsyncPropertyReply *reply)
BasicPropertyType<uint16_t> row2(2);
BasicPropertyType<uint16_t> row3(1);
- temp.append(&row1);
- temp.append(&row2);
- temp.append(&row3);
+ temp.append(row1);
+ temp.append(row2);
+ temp.append(row3);
reply->value = &temp;
reply->success = true;
diff --git a/plugins/testplugin/testplugin.cpp b/plugins/testplugin/testplugin.cpp
index be3c9acb..58f35159 100644
--- a/plugins/testplugin/testplugin.cpp
+++ b/plugins/testplugin/testplugin.cpp
@@ -64,37 +64,30 @@ bool beginsWith(std::string a, std::string b)
bool TestPlugin::testCoreSetSupported()
{
PropertyList supported(routingEngine->supported());
- TEST(contains(supported,TestProptertyName1) == false);
- std::list<std::string> sources(routingEngine->sourcesForProperty(TestProptertyName1));
- TEST(contains(sources,uuid()) == false);
-
- // if we were registered in Core, it will ask us and we will return it valid, but we haven't registered yet
- TEST(routingEngine->getPropertyInfo(TestProptertyName1, uuid()).isValid() == false);
+ TEST(contains(supported, TestProptertyName1) == false);
//
// CALL setSupported
//
- routingEngine->updateSupported(m_supportedProperties, PropertyList(), nullptr);// invalid input
- TEST(routingEngine->getPropertyInfo(TestProptertyName1, uuid()).isValid() == false);
// valid call
- routingEngine->updateSupported(m_supportedProperties, PropertyList(), this);// we are register as source from now
+ routingEngine->updateSupported(m_supportedProperties, PropertyList(), this);
TEST(routingEngine->getPropertyInfo(TestProptertyName1, uuid()).isValid() == true);
Zone::ZoneList zones(routingEngine->getPropertyInfo(TestProptertyName1, uuid()).zones());
TEST(contains(zones, Zone::LeftSide) == true);
supported = routingEngine->supported();
- TEST(contains(supported,TestProptertyName1) == true);
- TEST(contains(supported,TestProptertyName2) == true);
- TEST(contains(supported,VehicleProperty::ClutchStatus) == false);
+ TEST(contains(supported, TestProptertyName1) == true);
+ TEST(contains(supported, TestProptertyName2) == true);
+ TEST(contains(supported, VehicleProperty::ClutchStatus) == false);
- sources = routingEngine->sourcesForProperty(TestProptertyName1);
+ std::vector<std::string> sources = routingEngine->sourcesForProperty(TestProptertyName1);
TEST(contains(sources,uuid()) == true);
TEST(routingEngine->getPropertyInfo(TestProptertyName2, uuid()).isValid() == true);
zones = routingEngine->getPropertyInfo(TestProptertyName2, uuid()).zones();
- TEST(contains(zones,Zone::FrontSide) == true);
+ TEST(contains(zones, Zone::FrontSide) == true);
return true;
}
@@ -346,16 +339,19 @@ TestPlugin::TestPlugin(AbstractRoutingEngine *re, map<string, string> config)
BasicPropertyType<uint16_t> v1(0);
BasicPropertyType<uint16_t> v2(5);
BasicPropertyType<uint16_t> v3(10);
- tfirst->append(&v1);
- tfirst->append(&v2);
- tfirst->append(&v3);
+ tfirst->append(v1);
+ tfirst->append(v2);
+ tfirst->append(v3);
tsecond->fromVariant(tfirst->toVariant());
- g_assert (tfirst->toString() == tsecond->toString());
+ GVariant* testGVSVariant = g_variant_new("i", 9);
+ TEST(GVS<int>::value(testGVSVariant) == 9);
+
+ TEST (tfirst->toString() == tsecond->toString());
testBooleanToStringFromString();
- g_assert (testCoreUpdateSupported());
+ TEST (testCoreUpdateSupported());
testSubscription();
diff --git a/plugins/tpms/CMakeLists.txt b/plugins/tpms/CMakeLists.txt
deleted file mode 100644
index c879d433..00000000
--- a/plugins/tpms/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-if(tpms_plugin)
-
- include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs})
-
- pkg_check_modules(libusb REQUIRED libusb-1.0)
- set(link_libraries ${link_libraries} ${libusb_LIBRARIES})
- include_directories(${libusb_INCLUDE_DIRS})
-#check_include_files(libusb.h HAVE_USB)
-#set(CMAKE_CXX_FLAGS "-g -I/usr/include/libusb-1.0/ -lusb-1.0")
-
- set(tpmsplugin_headers tpmsplugin.h)
- set(tpmsplugin_sources tpmsplugin.cpp)
-
- add_library(tpmsplugin MODULE ${tpmsplugin_sources})
- set_target_properties(tpmsplugin PROPERTIES PREFIX "")
- target_link_libraries(tpmsplugin amb -L${CMAKE_CURRENT_BINARY_DIR}/lib ${link_libraries})
-
-endif(tpms_plugin) \ No newline at end of file
diff --git a/plugins/tpms/README b/plugins/tpms/README
deleted file mode 100644
index be4aa493..00000000
--- a/plugins/tpms/README
+++ /dev/null
@@ -1,41 +0,0 @@
-TPMS - Tire Pressure Monitoring System
-
-INTRO
-=====
-This plugin is a source module to support four-wheel tire pressure and temperature reading.
-Right now, it only supports the USB TPMS module available here:
-http://store.mp3car.com/USB_TPMS_Version_2_20_4_Sensor_Kit_p/com-090.htm (also available
-on Amazon).
-
-CONFIGURATION
-=============
-The configuration for the module is contained within the source code, so all that is required
-to run is adding the following source module to an ambd config file:
- "sources" : [
- {
- "name" : "Tpms",
- "path" : "/usr/local/lib/automotive-message-broker/tpmsplugin.so",
- }
- ],
-
-HOW TO USE
-==========
-Depending on system configuration, the ambd module may need to be run as root to get access
-to the USB driver. Once loaded, the module reads data every 5 seconds for broadcasting. The
-tire pressure is in kPa and the tire temperature in degrees Celsius.
-
-KNOWN ISSUES
-============
-This is very much an alpha version. Things which should probably be looked at:
-1) Better handling when root access is required
-2) Usage of mode strings from USB module
-3) Generalizing the framework somewhat more to allow usage of other modules (I am not aware
-of any others with easy USB though)
-4) Pulling hardcoded configuration parameters into the ambd config file, e.g. device pids,
-which scale to use, read interval, etc.
-5) Others I'm sure...
-
-
-Enjoy!
-Tim Trampedach
-tim@timtt.com \ No newline at end of file
diff --git a/plugins/tpms/tpmsplugin.cpp b/plugins/tpms/tpmsplugin.cpp
deleted file mode 100644
index 2dea1fdb..00000000
--- a/plugins/tpms/tpmsplugin.cpp
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
-Copyright (C) 2012 Intel Corporation
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#include "tpmsplugin.h"
-
-#include <iostream>
-#include <boost/assert.hpp>
-#include <glib.h>
-#include <libusb.h>
-
-using namespace std;
-
-#include "debugout.h"
-#include "timestamp.h"
-
-#define ENDPOINT_IN 0x81
-#define ENDPOINT_OUT 0x01
-
-#define DEVICE_VID 0x0000
-#define DEVICE_PID 0x0001
-
-#define MAX_SENSORS 4
-
-//timeout for performing interrupt r/w operations in milliseconds
-#define INTR_TIMEOUT 1000
-
-#define PSI_MULTIPLIER 14.5038
-#define KPA_MULTIPLIER 100
-#define PRESSURE_SCALE 0.025
-
-#define FARENHEIT_MULTIPLIER 1.8
-
-
-static gboolean timeoutCallback(gpointer data)
-{
- TpmsPlugin* src = (TpmsPlugin*)data;
-
- int r = src->readValues();
-
- return true;
-}
-
-TpmsPlugin::TpmsPlugin(AbstractRoutingEngine* re, map<string, string> config)
-:AbstractSource(re, config)
-{
- lfPressure = rfPressure = lrPressure = rrPressure = 0;
- lfTemperature = rfTemperature = lrTemperature = rrTemperature = 0;
-
- int r = 1;
-
- r = libusb_init(NULL);
- if (r < 0) {
- DebugOut() << "TPMS: Plugin load failure. Failed to initialize libusb" << endl;
- }
- else {
- r = findDevice();
- if (r < 0) {
- DebugOut() << "TPMS: Plugin load failure. Could not find/open device - run as root?" << endl;
- }
- else {
- // need to detach device from kernel driver before claiming the interface
- r = detachDevice();
- if (r < 0) {
- DebugOut() << "TPMS: Plugin load failure. USB device detach failed with code " << r << endl;
- }
- else {
- r = libusb_claim_interface(mDeviceHandle, 0);
- if (r < 0) {
- DebugOut() << "TPMS: Plugin load failure. usb_claim_interface error " << r << endl;
- }
- else {
- DebugOut() << "TPMS: USB interface initialized" << endl;
-
- re->setSupported(supported(), this);
- g_timeout_add(5000, timeoutCallback, this );
- DebugOut() << "TPMS: set to read sensor every 5 seconds" << endl;
- }
- }
- }
- }
-}
-
-
-extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map<string, string> config)
-{
- return new TpmsPlugin(routingengine, config);
-
-}
-
-const string TpmsPlugin::uuid()
-{
- return "5e896a00-15b3-11e3-8ffd-0800200c9a66";
-}
-
-
-void TpmsPlugin::getPropertyAsync(AsyncPropertyReply *reply)
-{
- DebugOut() << "TPMS: getPropertyAsync called for property: " << reply->property << endl;
-
- if(reply->property == VehicleProperty::TirePressureLeftFront) {
- VehicleProperty::TirePressureLeftFrontType temp(lfPressure);
- reply->success = true;
- reply->value = &temp;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::TirePressureRightFront) {
- VehicleProperty::TirePressureRightFrontType temp(rfPressure);
- reply->success = true;
- reply->value = &temp;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::TirePressureLeftRear) {
- VehicleProperty::TirePressureLeftRearType temp(lrPressure);
- reply->success = true;
- reply->value = &temp;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::TirePressureRightRear) {
- VehicleProperty::TirePressureRightRearType temp(rrPressure);
- reply->success = true;
- reply->value = &temp;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::TireTemperatureLeftFront) {
- VehicleProperty::TireTemperatureLeftFrontType temp(lfTemperature);
- reply->success = true;
- reply->value = &temp;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::TireTemperatureRightFront) {
- VehicleProperty::TireTemperatureRightFrontType temp(rfTemperature);
- reply->success = true;
- reply->value = &temp;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::TireTemperatureLeftRear) {
- VehicleProperty::TireTemperatureLeftRearType temp(lrTemperature);
- reply->success = true;
- reply->value = &temp;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::TireTemperatureRightRear) {
- VehicleProperty::TireTemperatureRightRearType temp(rrTemperature);
- reply->success = true;
- reply->value = &temp;
- reply->completed(reply);
- }
-
- else {
- DebugOut() << "TPMS: no such getProperty type: " << reply->property << endl;
- reply->success = false;
- reply->error = AsyncPropertyReply::InvalidOperation;
- reply->value = nullptr;
- reply->completed(reply);
- }
-}
-
-void TpmsPlugin::getRangePropertyAsync(AsyncRangePropertyReply *reply)
-{
- ///not supported
- reply->completed(reply);
-}
-
-AsyncPropertyReply *TpmsPlugin::setProperty(AsyncSetPropertyRequest request )
-{
- return NULL;
-}
-
-void TpmsPlugin::subscribeToPropertyChanges(VehicleProperty::Property property)
-{
- mRequests.push_back(property);
-}
-
-PropertyList TpmsPlugin::supported()
-{
- PropertyList props;
- props.push_back(VehicleProperty::TirePressureLeftFront);
- props.push_back(VehicleProperty::TirePressureRightFront);
- props.push_back(VehicleProperty::TirePressureLeftRear);
- props.push_back(VehicleProperty::TirePressureRightRear);
- props.push_back(VehicleProperty::TireTemperatureLeftFront);
- props.push_back(VehicleProperty::TireTemperatureRightFront);
- props.push_back(VehicleProperty::TireTemperatureLeftRear);
- props.push_back(VehicleProperty::TireTemperatureRightRear);
-
- return props;
-}
-
-void TpmsPlugin::unsubscribeToPropertyChanges(VehicleProperty::Property property)
-{
- mRequests.remove(property);
-}
-
-int TpmsPlugin::findDevice(void)
-{
- int deviceVid = DEVICE_VID;
- int devicePid = DEVICE_PID;
-
- DebugOut() << "TPMS: Trying to open USB device with VID: " << deviceVid << " PID: " << devicePid << endl;
- mDeviceHandle = libusb_open_device_with_vid_pid(NULL, DEVICE_VID, DEVICE_PID);
-
- return mDeviceHandle ? 0 : -1;
-}
-
-
-int TpmsPlugin::detachDevice(void)
-{
- int r;
- r = libusb_kernel_driver_active(mDeviceHandle, 0);
- if (r == 1) {
- DebugOut() << "TPMS: USB device seems to be kernel driven, trying to detach" << endl;
- r = libusb_detach_kernel_driver(mDeviceHandle, 0);
- }
- return r;
-}
-
-
-int TpmsPlugin::exitClean(int deinit)
-{
- if (deinit) {
- libusb_release_interface(mDeviceHandle, 0);
- libusb_attach_kernel_driver(mDeviceHandle, 0);
- libusb_close(mDeviceHandle);
- }
- libusb_exit(NULL);
-}
-
-
-int TpmsPlugin::readValues()
-{
- int snum;
- unsigned char buf[4];
-
- // Sensor 1 = Left Front
- // Sensor 2 = Right Front
- // Sensor 3 = Left Rear
- // Sensor 4 = Right Rear
-
- for (snum = 1; snum <= MAX_SENSORS; snum++) {
- readUsbSensor(snum, buf);
-
- // only do this if sensor is available
- if (buf[3] != 0xff) {
- string mode_string;
- char print_string[100];
-
- switch (snum) {
- case 1:
- lfPressure = ((float)buf[0]-40) * PRESSURE_SCALE * KPA_MULTIPLIER;
- lfTemperature = (float)buf[1]-40;
- sprintf(print_string, "TPMS: Left front pressure = %5.1f kPa, temperature = %5.1f degrees Celsius", lfPressure, lfTemperature);
- DebugOut() << print_string << endl;
- break;
- case 2:
- rfPressure = (buf[0]-40) * PRESSURE_SCALE * KPA_MULTIPLIER;
- rfTemperature = buf[1]-40;
- sprintf(print_string, "TPMS: Right front pressure = %5.1f kPa, temperature = %5.1f degrees Celsius", rfPressure, rfTemperature);
- DebugOut() << print_string << endl;
- break;
- case 3:
- lrPressure = (buf[0]-40) * PRESSURE_SCALE * KPA_MULTIPLIER;
- lrTemperature = buf[1]-40;
- sprintf(print_string, "TPMS: Left rear pressure = %5.1f kPa, temperature = %5.1f degrees Celsius", lrPressure, lrTemperature);
- DebugOut() << print_string << endl;
- break;
- case 4:
- rrPressure = (buf[0]-40) * PRESSURE_SCALE * KPA_MULTIPLIER;
- rrTemperature = buf[1]-40;
- sprintf(print_string, "TPMS: Right rear pressure = %5.1f kPa, temperature = %5.1f degrees Celsius", rrPressure, rrTemperature);
- DebugOut() << print_string << endl;
- break;
- }
-
- // make sensor mode human-readable
- // FIXME: for future reference, modes not being used
- switch (buf[3]) {
- case 0x01: mode_string = "normal"; break;
- case 0x02: mode_string = "pressure_alert"; break;
- // more to add here...
- default: mode_string = "unknown"; break;
- }
- }
- else {
- DebugOut() << "TPMS: Unable to read sensor " << sensorNumberToString(snum) << " (" << snum << ")" << endl;
- }
- }
-
- VehicleProperty::TirePressureLeftFrontType lfPres(lfPressure);
- VehicleProperty::TirePressureRightFrontType rfPres(rfPressure);
- VehicleProperty::TirePressureLeftRearType lrPres(lrPressure);
- VehicleProperty::TirePressureRightRearType rrPres(rrPressure);
- VehicleProperty::TireTemperatureLeftFrontType lfTemp(lfTemperature);
- VehicleProperty::TireTemperatureRightFrontType rfTemp(rfTemperature);
- VehicleProperty::TireTemperatureLeftRearType lrTemp(lrTemperature);
- VehicleProperty::TireTemperatureRightRearType rrTemp(rrTemperature);
-
- routingEngine->updateProperty(&lfPres, uuid());
- routingEngine->updateProperty(&rfPres, uuid());
- routingEngine->updateProperty(&lrPres, uuid());
- routingEngine->updateProperty(&rrPres, uuid());
- routingEngine->updateProperty(&lfTemp, uuid());
- routingEngine->updateProperty(&rfTemp, uuid());
- routingEngine->updateProperty(&lrTemp, uuid());
- routingEngine->updateProperty(&rrTemp, uuid());
-
- return 0;
-}
-
-int TpmsPlugin::readUsbSensor(int sid, unsigned char *buf)
-{
- int r, transferred;
-
- buf[0] = 0x20 + sid;
- r = libusb_interrupt_transfer(mDeviceHandle, ENDPOINT_OUT, buf, 1, &transferred, INTR_TIMEOUT);
- if (r < 0) {
- DebugOut() << "TPMS: USB write interrupt failed, code " << r << endl;
- }
-
- r = libusb_interrupt_transfer(mDeviceHandle, ENDPOINT_IN, buf, 4, &transferred, INTR_TIMEOUT);
- if (r < 0) {
- DebugOut() << "TPMS: USB read interrupt failed, code " << r << endl;
- }
-
- return r;
-}
-
-
-string TpmsPlugin::sensorNumberToString(int snid)
-{
- switch (snid) {
- case 1: return "left front"; break;
- case 2: return "right front"; break;
- case 3: return "left rear"; break;
- case 4: return "right rear"; break;
- default: return "unknown";
- }
-}
diff --git a/plugins/tpms/tpmsplugin.h b/plugins/tpms/tpmsplugin.h
deleted file mode 100644
index 7ed87af2..00000000
--- a/plugins/tpms/tpmsplugin.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-Copyright (C) 2012 Tim Trampedach
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef TPMSPLUGIN_H
-#define TPMSPLUGIN_H
-
-#include <abstractsource.h>
-#include <string>
-
-using namespace std;
-
-class TpmsPlugin: public AbstractSource
-{
-
-public:
- TpmsPlugin(AbstractRoutingEngine* re, map<string, string> config);
-
- const string uuid();
- void getPropertyAsync(AsyncPropertyReply *reply);
- void getRangePropertyAsync(AsyncRangePropertyReply *reply);
- AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
- void subscribeToPropertyChanges(VehicleProperty::Property property);
- void unsubscribeToPropertyChanges(VehicleProperty::Property property);
- PropertyList supported();
-
- void supportedChanged(PropertyList) {}
-
- int readValues();
-
- int supportedOperations() { return Get; }
-
-private:
- PropertyList mRequests;
- float lfPressure, rfPressure, lrPressure, rrPressure;
- float lfTemperature, rfTemperature, lrTemperature, rrTemperature;
- struct libusb_device_handle *mDeviceHandle;
-
- int findDevice();
- int detachDevice();
- int exitClean(int deinit);
-
- int readUsbSensor(int sid, unsigned char *buf);
-
- string sensorNumberToString(int snid);
-};
-
-#endif // TPMSPLUGIN_H
diff --git a/plugins/websocket/common.cpp b/plugins/websocket/common.cpp
index fea31d3e..8021be48 100644
--- a/plugins/websocket/common.cpp
+++ b/plugins/websocket/common.cpp
@@ -17,7 +17,7 @@ int lwsWrite(libwebsocket *lws, QByteArray d, int len)
QByteArray temp = d;
int numframes = 1;
- int framesize = 122;
+ int framesize = 512;
if(d.length() > framesize)
{
diff --git a/plugins/websocket/test/test.js b/plugins/websocket/test/test.js
index 9d54cc66..67c942dd 100644
--- a/plugins/websocket/test/test.js
+++ b/plugins/websocket/test/test.js
@@ -76,46 +76,23 @@ function updateInput(input, value) {
}, false);
}
-function getValue(eventlist) {
- var zoneList = getZone(eventlist);
- var types = window.vehicle.get(eventlist, zoneList,
+function getValue(event) {
+ var zone = getZone(event);
+ var types = window.vehicle.get(event, zone,
function(data) {
if (data) {
PRINT.pass("values received:");
- if (eventlist.length > 1 && !! data.length && data.length > 0) {
- var list = [];
- for (var i = 0; i < data.length; i++) {
- list[i] = data[i].property;
- //list[i] = data[i].name; ???
- PRINT.log(data[i].property + ": " + data[i].value + ", zone: " + data[i].zone);
- //PRINT.log(data[i].name+": "+data[i].value); ???
- }
+ PRINT.log(data.property + ": " + data.value + ", zone: " + data.zone);
var elements = document.getElementsByClassName('proptest');
for (var i = 0; i < elements.length; i++) {
var propinfo = elements[i].getElementsByClassName('propinfo')[0];
var name = propinfo.innerHTML;
- var idx = list.indexOf(name);
- if (idx >= 0) {
- var zone = elements[i].getElementsByTagName('input')[1];
- updateInput(zone, zone.value);
- var input = elements[i].getElementsByTagName('input')[0];
- updateInput(input, data[idx].value);
- }
+ var zone = elements[i].getElementsByTagName('input')[1];
+ updateInput(zone, zone.value);
+ var input = elements[i].getElementsByTagName('input')[0];
+ updateInput(input, data.value);
}
- } else {
- PRINT.log(JSON.stringify(data));
- var elements = document.getElementsByClassName('proptest');
- for (var i = 0; i < elements.length; i++) {
- var propinfo = elements[i].getElementsByClassName('propinfo')[0];
- if (data.property == propinfo.innerHTML) {
- var zone = elements[i].getElementsByTagName('input')[1];
- updateInput(zone, zone.value);
- var input = elements[i].getElementsByTagName('input')[0];
- updateInput(input, data.value);
- }
- }
- }
} else {
PRINT.fail("no values retrieved for " + eventlist);
}
@@ -177,13 +154,7 @@ function subscribe(event) {
window.vehicle.subscribe(event, zoneList,
function(data) {
PRINT.pass("Subscribe success for: " + data);
- for (var i = 0; i < data.length; i++) {
- var sub = data[i] + "_subscribe";
- var unsub = data[i] + "_unsubscribe";
- // document.getElementById(sub).className = "testbutton subscribe disable"
- // document.getElementById(unsub).className = "testbutton unsubscribe";
- document.addEventListener(data[i], eventListener, false);
- }
+ document.addEventListener(data, eventListener, false);
},
function(msg) {
PRINT.fail("Subscribe failed for: " + msg);
@@ -191,21 +162,15 @@ function subscribe(event) {
);
}
-function unsubscribe(event, zoneList) {
- zoneList = getZone(event);
+function unsubscribe(event, zone) {
+ zone = getZone(event);
/* kill the handers first, so even if the service fails to acknowledge */
/* we've stopped listening */
document.removeEventListener(event, eventListener, false);
- window.vehicle.unsubscribe(event, zoneList,
+ window.vehicle.unsubscribe(event, zone,
function(data) {
PRINT.pass("Unsubscribe success for: " + data);
- for (var i = 0; i < data.length; i++) {
- var sub = data[i] + "_subscribe";
- var unsub = data[i] + "_unsubscribe";
- // document.getElementById(unsub).className = "testbutton unsubscribe disable";
- // document.getElementById(sub).className = "testbutton subscribe";
- }
},
function(msg) {
PRINT.fail("Unsubscribe failed for: " + msg);
@@ -214,37 +179,15 @@ function unsubscribe(event, zoneList) {
}
function getZone(eventlist) {
- var list = [];
- if (eventlist.length > 1) {
-
- // for (var i = 0; i < data.length; i++) {
- // list[i] = data[i].property;
- // //list[i] = data[i].name; ???
- // PRINT.log(data[i].property + ": " + data[i].value);
- // //PRINT.log(data[i].name+": "+data[i].value); ???
- // }
var elements = document.getElementsByClassName('proptest');
for (var i = 0; i < elements.length; i++) {
var propinfo = elements[i].getElementsByClassName('propinfo')[0];
- var name = propinfo.innerHTML;
- var idx = eventlist.indexOf(name);
- if (idx >= 0) {
+ if (event == propinfo.innerHTML) {
var zone = elements[i].getElementsByTagName('input')[1];
- list.push(zone.value);
+ return zone.value;
}
}
- } else {
- var elements = document.getElementsByClassName('proptest');
- for (var i = 0; i < elements.length; i++) {
- var propinfo = elements[i].getElementsByClassName('propinfo')[0];
- if (eventlist[0] == propinfo.innerHTML) {
- var zone = elements[i].getElementsByTagName('input')[1];
- list.push(zone.value);
- }
- }
- }
- return list.join();
}
function select(elem) {
@@ -280,10 +223,10 @@ function start(msg) {
'")></div><div id="',
'_subscribe" class="testbutton subscribe" onclick=subscribe("',
'")></div><div id="',
- '_unsubscribe" class="testbutton unsubscribe" onclick=unsubscribe(["',
- '"])></div><div class="testbutton get" onclick=getValue(["',
- '"])></div><div class="testbutton set" onclick=setValue(["',
- '"])></div><input class = "Textvalue" type="text" value="0" placeholder="Value" /><div class = "smallText"> Zone: </div><input class = "zone" type="text" value="0" placeholder="Zone"/></div></div>'
+ '_unsubscribe" class="testbutton unsubscribe" onclick=unsubscribe("',
+ '")></div><div class="testbutton get" onclick=getValue("',
+ '")></div><div class="testbutton set" onclick=setValue("',
+ '")></div><input class = "Textvalue" type="text" value="0" placeholder="Value" /><div class = "smallText"> Zone: </div><input class = "zone" type="text" value="0" placeholder="Zone"/></div></div>'
];
var events = vehicleEventType.event;
diff --git a/plugins/websocket/test/vehicle.js b/plugins/websocket/test/vehicle.js
index 6b8e6009..86a266e5 100644
--- a/plugins/websocket/test/vehicle.js
+++ b/plugins/websocket/test/vehicle.js
@@ -244,24 +244,15 @@ Vehicle.prototype.getSupportedEventTypes = function(type, writeable, successCB,
this.send(obj, successCB, errorCB);
}
-Vehicle.prototype.get = function(namelist, zone, successCB, errorCB)
+Vehicle.prototype.get = function(name, zone, successCB, errorCB)
{
- if(namelist.length <= 0)
- {
- return;
- }
-
- var properties = [];
-
- for(var i = 0; i < namelist.length; i++)
- {
- properties[i] = {"property" : namelist[i], "zone" : zone};
- }
+ property = {"property" : name, "zone" : zone};
+
var obj = {
"type" : "method",
"name": "get",
"transactionid" : this.generateTransactionId(),
- "data" : properties
+ "data" : property
};
this.send(obj, successCB, errorCB);
}
@@ -279,50 +270,39 @@ Vehicle.prototype.getHistory = function(event, startTime, endTime, successCB, er
}
-Vehicle.prototype.set = function(namelist, valuelist, zoneList, successCB, errorCB)
+Vehicle.prototype.set = function(name, value, zone, successCB, errorCB)
{
- if((namelist.length != valuelist.length)||(namelist.length <= 0))
- {
- return;
- }
-
var obj = {
"type" : "method",
"name": "set",
"transactionid" : this.generateTransactionId(),
- "data" : []
+ "data" : { "property" : name, "value" : value, "zone" : zone }
};
- var list = [];
- for(var i = 0; i < namelist.length; i++)
- {
- var val = {"property" : namelist[i], "value" : valuelist[i],"zone" : zoneList[i]};
- list[list.length] = val;
- }
- obj.data = list;
+
this.send(obj, successCB, errorCB);
}
-Vehicle.prototype.subscribe = function(namelist, zoneList, successCB, errorCB)
+Vehicle.prototype.subscribe = function(name, zone, successCB, errorCB)
{
var obj = {
"type" : "method",
"name": "subscribe",
"transactionid" : this.generateTransactionId(),
- "data" : namelist,
- "zone" : zoneList
+ "data" : {"property" : name, "zone" : zone }
};
+
this.send(obj, successCB, errorCB);
}
-Vehicle.prototype.unsubscribe = function(namelist, zoneList, successCB, errorCB)
+Vehicle.prototype.unsubscribe = function(name, zone, successCB, errorCB)
{
var obj = {
"type" : "method",
"name": "unsubscribe",
"transactionid" : this.generateTransactionId(),
- "data" : namelist,
- "zone" : zoneList
+ "data" : {"property" : name, "zone" : zone }
};
+
this.send(obj, successCB, errorCB);
}
diff --git a/plugins/websocket/websocketsink.cpp b/plugins/websocket/websocketsink.cpp
index 0c4cc128..d74eaf6b 100644
--- a/plugins/websocket/websocketsink.cpp
+++ b/plugins/websocket/websocketsink.cpp
@@ -34,14 +34,16 @@
#include <QJsonDocument>
#include <QVariantMap>
-WebSocketSink::WebSocketSink(AbstractRoutingEngine* re, libwebsocket *wsi, string uuid, VehicleProperty::Property property, std::string ambdproperty) : AbstractSink(re,map<string, string> ())
+WebSocketSink::WebSocketSink(AbstractRoutingEngine* re, libwebsocket *wsi, string uuid, VehicleProperty::Property property, std::string ambdproperty, Zone::Type zone)
+ : AbstractSink(re,map<string, string> ())
{
m_amdbproperty = ambdproperty;
m_uuid = uuid;
m_wsi = wsi;
m_property = property;
+ mZone = zone;
m_re = re;
- re->subscribeToProperty(ambdproperty,this);
+ re->subscribeToProperty(ambdproperty, this);
}
const string WebSocketSink::uuid()
{
@@ -51,6 +53,9 @@ void WebSocketSink::propertyChanged(AbstractPropertyType *value)
{
VehicleProperty::Property property = value->name;
+ if(value->zone != mZone)
+ return;
+
QVariantMap data;
QVariantMap reply;
@@ -85,7 +90,7 @@ void WebSocketSink::supportedChanged(const PropertyList &supportedProperties)
PropertyList WebSocketSink::subscriptions()
{
return PropertyList();
-}
+}
/// 6% and 4% cpu with json
/// 5% and 4% with binary
diff --git a/plugins/websocket/websocketsink.h b/plugins/websocket/websocketsink.h
index b316755b..5b5502fc 100644
--- a/plugins/websocket/websocketsink.h
+++ b/plugins/websocket/websocketsink.h
@@ -29,13 +29,14 @@ class WebSocketSink : public AbstractSink
{
public:
- WebSocketSink(AbstractRoutingEngine* re,libwebsocket *wsi,string uuid,VehicleProperty::Property property,std::string ambdproperty);
+ WebSocketSink(AbstractRoutingEngine* re, libwebsocket *wsi, string uuid, VehicleProperty::Property property, std::string ambdproperty, Zone::Type zone);
~WebSocketSink();
const string uuid() ;
void propertyChanged(AbstractPropertyType *value);
void supportedChanged(const PropertyList & supportedProperties);
PropertyList subscriptions();
libwebsocket *socket() { return m_wsi; }
+ Zone::Type zone() { return mZone; }
private:
char *webSocketBuffer;
@@ -44,6 +45,7 @@ private:
libwebsocket *m_wsi;
string m_uuid;
string m_property;
+ Zone::Type mZone;
};
#endif // WEBSOCKETSINK_H
diff --git a/plugins/websocket/websocketsinkmanager.cpp b/plugins/websocket/websocketsinkmanager.cpp
index 185620d7..1c8a7e16 100644
--- a/plugins/websocket/websocketsinkmanager.cpp
+++ b/plugins/websocket/websocketsinkmanager.cpp
@@ -143,7 +143,7 @@ void WebSocketSinkManager::setConfiguration(map<string, string> config)
info.ssl_private_key_filepath = ssl_key_path.c_str();
}
context = libwebsocket_create_context(&info);
-
+
}
void WebSocketSinkManager::addSingleShotSink(libwebsocket* socket, VehicleProperty::Property property, Zone::Type zone, string id)
@@ -251,19 +251,21 @@ void WebSocketSinkManager::addSingleShotRangedSink(libwebsocket* socket, Propert
AsyncRangePropertyReply* reply = routingEngine->getRangePropertyAsync(rangedRequest);
}
-void WebSocketSinkManager::removeSink(libwebsocket* socket,VehicleProperty::Property property, string uuid)
+void WebSocketSinkManager::removeSink(libwebsocket* socket,VehicleProperty::Property property, string uuid, Zone::Type zone)
{
if (m_sinkMap.find(property) != m_sinkMap.end())
{
list<WebSocketSink*> sinks = m_sinkMap[property];
- for(auto i = sinks.begin(); i != sinks.end(); i++)
+ for(auto i : sinks)
{
- delete *i;
+ if(i->zone() == zone)
+ {
+ m_sinkMap[property].remove(i);
+ delete i;
+ }
}
- m_sinkMap.erase(property);
-
QVariantMap reply;
reply["type"]="methodReply";
reply["name"]="unsubscribe";
@@ -325,7 +327,7 @@ void WebSocketSinkManager::setValue(libwebsocket* socket,VehicleProperty::Proper
delete type;
}
-void WebSocketSinkManager::addSink(libwebsocket* socket, VehicleProperty::Property property,string uuid)
+void WebSocketSinkManager::addSink(libwebsocket* socket, VehicleProperty::Property property, string uuid, Zone::Type zone)
{
PropertyList foo = VehicleProperty::capabilities();
if (!contains(foo,property))
@@ -353,7 +355,7 @@ void WebSocketSinkManager::addSink(libwebsocket* socket, VehicleProperty::Proper
lwsWrite(socket, replystr, replystr.length());
- WebSocketSink *sink = new WebSocketSink(m_engine,socket,uuid,property,property);
+ WebSocketSink *sink = new WebSocketSink(m_engine, socket, uuid, property, property, zone);
m_sinkMap[property].push_back(sink);
}
extern "C" AbstractSinkManager * create(AbstractRoutingEngine* routingengine, map<string, string> config)
@@ -568,14 +570,15 @@ static int websocket_callback(struct libwebsocket_context *context,struct libweb
}
else if (name == "subscribe")
{
- std::string data = call["data"].toString().toStdString();
- sinkManager->addSink(wsi, data, id);
+ QVariantMap data = call["data"].toMap();
+ int zone = data["zone"].toInt();
+ sinkManager->addSink(wsi, data["property"].toString().toStdString(), id, zone);
}
else if (name == "unsubscribe")
{
- std::string data = call["data"].toString().toStdString();
- sinkManager->removeSink(wsi,data,id);
+ QVariantMap data = call["data"].toMap();
+ sinkManager->removeSink(wsi, data["property"].toString().toStdString(), id, data["zone"].toInt());
}
else if (name == "getSupportedEventTypes")
@@ -650,7 +653,7 @@ static int websocket_callback(struct libwebsocket_context *context,struct libweb
break;
}
}
- return 0;
+ return 0;
}
bool gioPollingFunc(GIOChannel *source, GIOCondition condition, gpointer data)
@@ -672,7 +675,7 @@ bool gioPollingFunc(GIOChannel *source, GIOCondition condition, gpointer data)
//This is the polling function. If it return false, glib will stop polling this FD.
//printf("Polling...%i\n",condition);
-
+
lws_tokens token;
struct pollfd pollstruct;
int newfd = g_io_channel_unix_get_fd(source);
diff --git a/plugins/websocket/websocketsinkmanager.h b/plugins/websocket/websocketsinkmanager.h
index 8197514f..e4d98211 100644
--- a/plugins/websocket/websocketsinkmanager.h
+++ b/plugins/websocket/websocketsinkmanager.h
@@ -37,9 +37,9 @@ public:
WebSocketSinkManager(AbstractRoutingEngine* engine, map<string, string> config);
void addSingleShotSink(libwebsocket* socket, VehicleProperty::Property property, Zone::Type zone, string id);
void addSingleShotRangedSink(libwebsocket* socket, PropertyList properties,double start, double end, double seqstart,double seqend, string id);
- void addSink(libwebsocket* socket, VehicleProperty::Property property,string uuid);
+ void addSink(libwebsocket* socket, VehicleProperty::Property property, string uuid, Zone::Type zone);
void disconnectAll(libwebsocket* socket);
- void removeSink(libwebsocket* socket,VehicleProperty::Property property,string uuid);
+ void removeSink(libwebsocket* socket, VehicleProperty::Property property, string uuid, Zone::Type zone);
void addPoll(int fd);
void removePoll(int fd);
void init();
diff --git a/plugins/websocketsink/CMakeLists.txt b/plugins/websocketsink/CMakeLists.txt
deleted file mode 100644
index d4b1c315..00000000
--- a/plugins/websocketsink/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-if(websocketold_plugin)
-
-include(CheckIncludeFiles)
-include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs})
-
-pkg_check_modules(websockets REQUIRED libwebsockets)
-
-set(websocketsinkplugin_headers websocketsink.h websocketmanager.h)
-set(websocketsinkplugin_sources websocketsinkmanager.cpp websocketsink.cpp)
-add_library(websocketsinkplugin MODULE ${websocketsinkplugin_sources})
-set_target_properties(websocketsinkplugin PROPERTIES PREFIX "")
-target_link_libraries(websocketsinkplugin amb ${websockets_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib ${link_libraries})
-
-install(TARGETS websocketsinkplugin LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
-
-endif(websocketold_plugin)
diff --git a/plugins/websocketsink/protocol b/plugins/websocketsink/protocol
deleted file mode 100644
index 5250b115..00000000
--- a/plugins/websocketsink/protocol
+++ /dev/null
@@ -1,25 +0,0 @@
-Example protocol messages
-
-Property changed event:
-{"type":"valuechanged","name":"VehicleSpeed","data":"217","transactionid":"d293f670-f0b3-11e1-aff1-0800200c9a66", "timestamp":"1354521964.60253","sequence":"0"}
-
-Get property request:
-{"type":"method","name":"get","data":["VehicleSpeed"],"transactionid":"d293f670-f0b3-11e1-aff1-0800200c9a66"}
-
-Get property reply:
-{"type":"methodReply","name":"get","data":[{"property":"VehicleSpeed","value":"17"}],"transactionid":"d293f670-f0b3-11e1-aff1-0800200c9a66", "timestamp" : "1354521964.24962", "sequence": "0" }
-
-Get supported request:
-{"type":"method","name":"getSupportedEventTypes","data":[],"transactionid":"d293f670-f0b3-11e1-aff1-0800200c9a66"}
-
-Get supported reply:
-{"type":"methodReply","name":"getSupportedEventTypes","data":["running_status_speedometer","running_status_engine_speed","running_status_steering_wheel_angle","running_status_transmission_gear_status","EngineSpeed","VehicleSpeed","AccelerationX","TransmissionShiftPosition","SteeringWheelAngle","ThrottlePosition","EngineCoolantTemperature","VIN","WMI","BatteryVoltage","MachineGunTurretStatus"],"transactionid":"d293f670-f0b3-11e1-aff1-0800200c9a66"}
-
-Subscribe to data:
-{"type":"method","name":"subscribe","data":["EngineSpeed"],"transactionid":"d293f670-f0b3-11e1-aff1-0800200c9a66"}
-
-Subscribe to data reply:
-{"type":"methodReply","name":"subscribe","data":["EngineSpeed"],"transactionid":"d293f670-f0b3-11e1-aff1-0800200c9a66"}
-
-Get History request:
-{"type":"method","name":"getRange","data": {"timeBegin":"1368825008.35948","timeEnd":"1368825018.35948","sequenceBegin":"-1","sequenceEnd":"-1"},"transactionid":"b07589ba-417c-4604-80c6-01c0dcbd524d"}
diff --git a/plugins/websocketsink/test/events.js b/plugins/websocketsink/test/events.js
deleted file mode 100644
index cb0cfd52..00000000
--- a/plugins/websocketsink/test/events.js
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2012, Intel Corporation.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0. The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-
-/* ---------------------- vehicle event typedef --------------------------- */
-
-function VehicleEventType()
-{
- this.event = [
-"Randomize",
-"AirConditioning",
-"AirRecirculation",
-"AirflowDirection",
-"AvgKW",
-"BatteryStatus",
-"ChildLock",
-"Defrost",
-"ExteriorBrightness",
-"ExteriorTemperature",
-"FanSpeed",
-"FrontWheelRadius",
-"FullBatteryRange",
-"InteriorTemperature",
-"LightHazard",
-"LightHead",
-"LightParking",
-"NightMode",
-"Odometer",
-"SeatHeater",
-"TargetTemperature",
-"TransmissionShiftPosition",
-"VehicleSpeed",
-"Weather"
- ];
- this.value = [];
-
- /* set random initial values for all the props */
- for(i in this.event)
- {
- var prop = this.event[i];
- this.value[prop] = Math.floor(Math.random() * 1000000);
- }
-}
-
-VehicleEventType.prototype.getSupportedEventList = function(val)
-{
- /* for undefined just assume everything */
- if((val == undefined)||(val === ""))
- return this.event;
-
- /* grab every event with case insensitive prefix of val */
- var value = val.toLowerCase();
- var list = [];
- for(i in this.event)
- {
- var prop = this.event[i].toLowerCase();
- if(prop.indexOf(value) === 0)
- {
- list[list.length] = prop;
- }
- }
-
- /* if the target val isn't alone, remove it, it's a grouping */
- var idx = list.indexOf(value);
- if((idx >= 0)&&(list.length > 1))
- {
- list.splice(idx, 1);
- }
- return list;
-}
-
-VehicleEventType.prototype.getValueEventList = function(val)
-{
- var i, j, list = this.getSupportedEventList(val);
- for(i = 0; i < list.length; i++)
- {
- for(j = i + 1; j < list.length; j++)
- {
- if(list[j].indexOf(list[i]) === 0)
- {
- list.splice(i, 1);
- i--;
- }
- }
- }
- return list;
-}
-
-VehicleEventType.prototype.getValuesEventList = function(vals)
-{
- var i, j, list = [];
- for(i = 0; i < vals.length; i++)
- {
- var sublist = this.getValueEventList(vals[i]);
- for(j = 0; j < sublist.length; j++)
- {
- if(list.indexOf(sublist[j]) < 0)
- {
- list[list.length] = sublist[j];
- }
- }
- }
- return list;
-}
-
-VehicleEventType.prototype.isValueEvent = function(val)
-{
- var list = this.getValueEventList(val);
- return(list.length === 1);
-}
-
-VehicleEventType.prototype.getValue = function(prop)
-{
- return this.value[prop];
-}
-
-VehicleEventType.prototype.isValid = function(prop)
-{
- return (this.event.indexOf(prop) >= 0);
-}
-
-VehicleEventType.prototype.setValue = function(prop, newval)
-{
- this.value[prop] = newval;
-}
diff --git a/plugins/websocketsink/test/index.html b/plugins/websocketsink/test/index.html
deleted file mode 100644
index 9a5daef4..00000000
--- a/plugins/websocketsink/test/index.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <title>IVI API Tester</title>
- <meta charset="utf-8">
- <link rel="stylesheet" href="style.css"/>
- <script src="vehicle.js"></script>
-</head>
-<body onload="init()">
- <div id="result">
- </div>
- <div id="tester">
- </div>
- <script src="events.js"></script>
- <script src="test.js"></script>
-</body>
-</html>
diff --git a/plugins/websocketsink/test/servertest/client.html b/plugins/websocketsink/test/servertest/client.html
deleted file mode 100644
index 9ef2ee3b..00000000
--- a/plugins/websocketsink/test/servertest/client.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <title>IVI API Tester</title>
- <meta charset="utf-8">
- <link rel="stylesheet" href="../style.css"/>
- <script src="../api.js"></script>
-</head>
-<body onload='init("ws://localhost:23023/vehicle?client", "")'>
- <div id="result">
- </div>
- <div id="tester">
- </div>
- <script src="../events.js"></script>
- <script src="../test.js"></script>
-</body>
-</html>
diff --git a/plugins/websocketsink/test/servertest/server.html b/plugins/websocketsink/test/servertest/server.html
deleted file mode 100644
index 43dc72ab..00000000
--- a/plugins/websocketsink/test/servertest/server.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <title>IVI API Server Test</title>
- <meta charset="utf-8">
- <style>
-#result {
- position: absolute;
- height: 99%;
- width: 99%;
- overflow-y: auto;
- word-wrap: break-word;
-}
- </style>
- <script src="../events.js"></script>
- <script src="server.js"></script>
-</head>
-<body>
- <div id="result">
- </div>
-</body>
-</html>
diff --git a/plugins/websocketsink/test/servertest/server.js b/plugins/websocketsink/test/servertest/server.js
deleted file mode 100644
index 3fcda404..00000000
--- a/plugins/websocketsink/test/servertest/server.js
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * Copyright (c) 2012, Intel Corporation.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0. The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-
-/* --------------------------- utility code ------------------------------- */
-
-var PRINT = {
- logElement : null,
- init : function(log_id) {
- this.logElement = document.getElementById(log_id);
- },
-
- scrollToBottom : function() {
- this.logElement.scrollTop = this.logElement.scrollHeight;
- },
-
- incoming : function(msg) {
- this.logElement.innerHTML += "<div style='color: blue'> REQUEST: " + msg + "</div>";
- this.scrollToBottom();
- },
-
- outgoing : function(msg) {
- this.logElement.innerHTML += "<div style='color: purple'> RESPONSE: " + msg + "</div>";
- this.scrollToBottom();
- },
-
- pass : function(msg) {
- this.logElement.innerHTML += "<div style='color: green'> SUCCESS: " + msg + "</div>";
- this.scrollToBottom();
- },
-
- fail : function(msg) {
- this.logElement.innerHTML += "<div style='color: red'> FAIL: " + msg + "</div>";
- this.scrollToBottom();
- },
-
- log : function(msg) {
- this.logElement.innerHTML += "<div class='LogClass'> " + msg + "</div>";
- this.scrollToBottom();
- },
-}
-
-/* ----------------------------- test code --------------------------------- */
-
-function VehicleServer(socketUrl)
-{
- var self = this;
- this.vehicleEventType = new VehicleEventType();
- this.subscriptions = [];
-
- this.Signal = function(name)
- {
- var me = this;
- this.users = 0;
- this.name = name;
- this.start = function() {
- if(me.users <= 0)
- {
- var interval = Math.floor(Math.random()*5000) + 1000;
- me.timer = setInterval(function() {
- var value = parseInt(self.vehicleEventType.getValue(me.name)) + 1;
- self.vehicleEventType.setValue(me.name, value);
- var obj = {
- "type" : "valuechanged",
- "name": me.name,
- "data" : value
- };
- self.socket.send(JSON.stringify(obj));
- }, interval);
- }
- me.users = 1;
- }
- this.stop = function() {
- me.users--;
- if((me.users <= 0)&&(me.timer != undefined))
- {
- clearInterval(me.timer);
- }
- }
- }
-
- function init() {
- if ("WebSocket" in window)
- {
- var list = self.vehicleEventType.getValueEventList();
- for(var i = 0; i < list.length; i++)
- {
- self.subscriptions[i] = new self.Signal(list[i]);
- }
-
- self.socket = new WebSocket(socketUrl);
- self.socket.onopen = function()
- {
- PRINT.pass("Server READY");
- };
- self.socket.onclose = function()
- {
- PRINT.fail("Server CLOSED");
- };
- self.socket.onerror = function(e)
- {
- PRINT.fail("Server ERROR: "+e.data);
- };
- self.socket.onmessage = function (e)
- {
- self.receive(e.data);
- };
- }
- else
- {
- PRINT.fail("This browser doesn't appear to support websockets!");
- }
- }
- init();
-}
-
-VehicleServer.prototype.subscribe = function(list)
-{
- for(var i = 0; i < this.subscriptions.length; i++)
- {
- if(list.indexOf(this.subscriptions[i].name) >= 0)
- {
- this.subscriptions[i].start();
- }
- }
-}
-
-VehicleServer.prototype.unsubscribe = function(list)
-{
- for(var i = 0; i < this.subscriptions.length; i++)
- {
- if(list.indexOf(this.subscriptions[i].name) >= 0)
- {
- this.subscriptions[i].stop();
- }
- }
-}
-
-VehicleServer.prototype.receive = function(msg)
-{
- var event = JSON.parse(msg);
- /* accept only methods with transaction ids */
- if((event == undefined)||(event.transactionid == undefined)||
- (event.type != "method"))
- {
- return;
- }
-
- var obj;
- PRINT.incoming(msg);
- if(event.name === "getSupportedEventTypes")
- {
- var data;
- if(event.writeable)
- {
- data = this.vehicleEventType.getValueEventList(event.data);
- }
- else
- {
- data = this.vehicleEventType.getSupportedEventList(event.data);
- }
- obj = {
- "type" : "methodReply",
- "name": event.name,
- "transactionid" : event.transactionid,
- "data" : data
- };
- }
- else if(event.name === "get")
- {
- var names = this.vehicleEventType.getValuesEventList(event.data);
- if(names.length > 0)
- {
- obj = {
- "type" : "methodReply",
- "name": event.name,
- "transactionid" : event.transactionid,
- "data" : []
- };
- for(i in names)
- {
- var value = this.vehicleEventType.getValue(names[i]);
- obj.data.push({"name" : names[i], "value" : value});
- }
- }
- else
- {
- obj = {
- "type" : "methodReply",
- "name": event.name,
- "transactionid" : event.transactionid,
- "error" : event.data + " is not a valid event"
- };
- }
- }
- else if(event.name === "set")
- {
- var bad = [];
- var good = [];
- for(var i = 0; i < event.data.length; i++)
- {
- if((event.data[i].value != undefined) &&
- this.vehicleEventType.isValueEvent(event.data[i].property))
- {
- this.vehicleEventType.setValue(event.data[i].property, parseInt(event.data[i].value));
- good[good.length] = event.data[i].property;
- }
- else
- {
- bad[bad.length] = event.data[i].property;
- }
- }
-
- obj = {
- "type" : "methodReply",
- "name": event.name,
- "transactionid" : event.transactionid
- };
-
- if(bad.length > 0)
- {
- obj.error = "Failed to set:";
- for(var i = 0; i < bad.length; i++)
- {
- obj.error += " "+bad[i];
- }
- }
-
- if(good.length > 0)
- {
- obj.data = "Successfully set:";
- for(var i = 0; i < good.length; i++)
- {
- obj.data += " "+good[i];
- }
- }
- }
- else if(event.name === "subscribe")
- {
- var names = this.vehicleEventType.getValuesEventList(event.data);
- if(names.length > 0)
- {
- obj = {
- "type" : "methodReply",
- "name": event.name,
- "transactionid" : event.transactionid,
- "data" : names
- };
- for(i in names)
- {
- this.subscribe(names[i]);
- }
- }
- else
- {
- obj = {
- "type" : "methodReply",
- "name": event.name,
- "transactionid" : event.transactionid,
- "error" : "no valid events provided"
- };
- }
- }
- else if(event.name === "unsubscribe")
- {
- var names = this.vehicleEventType.getValuesEventList(event.data);
- if(names.length > 0)
- {
- obj = {
- "type" : "methodReply",
- "name": event.name,
- "transactionid" : event.transactionid,
- "data" : names
- };
- for(i in names)
- {
- this.unsubscribe(names[i]);
- }
- }
- else
- {
- obj = {
- "type" : "methodReply",
- "name": event.name,
- "transactionid" : event.transactionid,
- "error" : "no valid events provided"
- };
- }
- }
- else
- {
- obj = {
- "type" : "methodReply",
- "name": event.name,
- "transactionid" : event.transactionid,
- "error" : event.name + " is not a valid method"
- };
- }
- PRINT.outgoing(JSON.stringify(obj));
- this.socket.send(JSON.stringify(obj));
-}
-
-window.addEventListener('load', function () {
- "use strict";
- PRINT.init("result");
- var server = new VehicleServer("ws://localhost:23023/vehicle?server");
-});
diff --git a/plugins/websocketsink/test/style.css b/plugins/websocketsink/test/style.css
deleted file mode 100644
index 8456fd1e..00000000
--- a/plugins/websocketsink/test/style.css
+++ /dev/null
@@ -1,182 +0,0 @@
-.PassClass {
- font: bold 16px Arial;
- color: green;
-}
-
-.FailClass {
- font: bold 16px Arial;
- color: red;
-}
-
-.LogClass {
- font: 16px Arial;
- color: black;
-}
-
-#tester {
- position: absolute;
- -webkit-user-select: none;
- top: 0px;
- left: 0%;
- height: 100%;
- width: 620px;
- overflow-y: auto;
-}
-
-#result {
- position: absolute;
- top: 0px;
- left: 620px;
- height: 98%;
- width: 1380px;
- padding-top: 1%;
- background-color: #eeeeee;
- padding-left: 1%;
- word-wrap:break-word;
- overflow-y: auto;
-}
-
-.proptest {
- position: relative;
- left: 0px;
- height: 67px;
- width: 700px;
- overflow: hidden;
-}
-
-.proptest .buttons {
- position: absolute;
- top: 32px;
- left: 0px;
- height: 35px;
- width: 630px;
-}
-
-.smallText {
- text-align: left;
- color: #FFFFFF;
- font: 18px Arial;
- display: inline;
-}
-.propinfo {
- position: absolute;
- top: 0px;
- left: 0px;
- height: 67px;
- width: 600px;
- text-align: left;
- color: #FFFFFF;
- font: 18px Arial;
- line-height: 30px;
- padding-left: 5px;
- background: -webkit-gradient(linear, left top, left bottom, from(#444), to(#000));
- cursor: pointer;
-}
-
-.propinfo.select {
- background: -webkit-gradient(linear, left top, left bottom, from(#444), to(#aaa));
-}
-
-.propinfo.unselectable {
- cursor: auto;
- background: #000000;
- border-bottom: solid 1px #444;
-}
-
-input[type='text'] {
- margin-top: 5px;
- color: black;
- font: bold 18px Arial;
- height: 19px;
- width: 100px;
- background: -webkit-gradient(linear, left top, left bottom, from(#aaa), to(#fff));
- -webkit-transition: all 2s linear;
-}
-
-input[type='text'].change {
- -webkit-transition: all 0.1s linear;
- color: red;
-}
-
-.testbutton {
- position: relative;
- float: left;
- color: #d7d7d7;
- border: solid 1px #333;
- text-align: center;
- text-decoration: none;
- font: 16px/100% Arial, Helvetica, sans-serif;
- text-shadow: 0 1px 1px rgba(0,0,0,.3);
- -webkit-border-radius: 12px;
- border-radius: 12px;
- background: -webkit-gradient(linear, left top, left bottom, from(#666), to(#000));
- height: 25px;
- line-height: 24px;
- cursor: pointer;
- box-shadow: 2px 2px 14px #000;
- margin-top: 5px;
- margin-bottom: 5px;
- margin-right: 2px;
-}
-
-.testbutton.types {
- width: 50px;
- background: -webkit-gradient(linear, left top, left bottom, from(blue), to(#000));
-}
-
-.testbutton.types:after {
- content: 'types';
-}
-
-.testbutton.get {
- width: 35px;
- background: -webkit-gradient(linear, left top, left bottom, from(green), to(#000));
-}
-
-.testbutton.get:after {
- content: 'get';
-}
-
-.testbutton.set {
- width: 35px;
- background: -webkit-gradient(linear, left top, left bottom, from(green), to(#000));
-}
-
-.testbutton.set:after {
- content: 'set';
-}
-
-.testbutton.subscribe {
- width: 80px;
- background: -webkit-gradient(linear, left top, left bottom, from(purple), to(#000));
-}
-
-.testbutton.subscribe.disable {
- pointer-events: none;
- color: #999999;
- background: -webkit-gradient(linear, left top, left bottom, from(#000), to(#111));
-}
-
-.testbutton.subscribe:after {
- content: 'subscribe';
-}
-
-.testbutton.unsubscribe {
- width: 100px;
- background: -webkit-gradient(linear, left top, left bottom, from(purple), to(#000));
-}
-
-.testbutton.unsubscribe.disable {
- pointer-events: none;
- color: #999999;
- background: -webkit-gradient(linear, left top, left bottom, from(#000), to(#111));
-}
-
-.testbutton.unsubscribe:after {
- content: 'unsubscribe';
-}
-
-.testbutton:active {
- color: #666;
- background: -webkit-gradient(linear, left top, left bottom, from(#000), to(#444));
-}
diff --git a/plugins/websocketsink/test/test.js b/plugins/websocketsink/test/test.js
deleted file mode 100644
index 90106f21..00000000
--- a/plugins/websocketsink/test/test.js
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Copyright (c) 2012, Intel Corporation.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0. The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-
-/* --------------------------- utility code ------------------------------- */
-
-var PRINT = {
- logElement: null,
- init: function(log_id) {
- this.logElement = document.getElementById(log_id);
- },
-
- scrollToBottom: function() {
- this.logElement.scrollTop = this.logElement.scrollHeight;
- },
-
- clear: function() {
- this.logElement.innerHTML = "";
- },
-
- pass: function(msg) {
- this.logElement.innerHTML += "<div class='PassClass'>PASS: " + msg + "</div>";
- this.scrollToBottom();
- },
-
- fail: function(msg) {
- this.logElement.innerHTML += "<div class='FailClass'>FAIL: " + msg + "</div>";
- this.scrollToBottom();
- },
-
- log: function(msg) {
- this.logElement.innerHTML += "<div class='LogClass'> " + msg + "</div>";
- this.scrollToBottom();
- },
-}
-
-/* ----------------------------- test code --------------------------------- */
-
-var vehicleEventType = new VehicleEventType();
-var selected = [];
-
-function getTypes(event) {
- var types = window.vehicle.getSupportedEventTypes(event, false,
- function(data) {
- if (data && data.length > 1) {
- PRINT.pass(event + " is a set of " + data.length + " events:");
- for (i in data) {
- PRINT.log(data[i]);
- }
- } else if (data && data.length > 0) {
- PRINT.pass(event + " is a single event:");
- for (i in data) {
- PRINT.log(data[i]);
- }
- } else {
- PRINT.fail(event + " unexcepted empty data field");
- }
- },
- function(msg) {
- PRINT.fail(((event === "") ? "all events" : event) + ":<br>" + msg);
- }
- );
-}
-
-function updateInput(input, value) {
- input.value = value;
- input.className = "change";
- input.addEventListener('webkitTransitionEnd', function callback(e) {
- e.target.removeEventListener('webkitTransitionEnd', callback, false);
- e.target.className = "";
- }, false);
-}
-
-function getValue(eventlist) {
- var zoneList = getZone(eventlist);
- var types = window.vehicle.get(eventlist, zoneList,
- function(data) {
- if (data) {
- PRINT.pass("values received:");
- if (eventlist.length > 1 && !! data.length && data.length > 0) {
- var list = [];
- for (var i = 0; i < data.length; i++) {
- list[i] = data[i].property;
- //list[i] = data[i].name; ???
- PRINT.log(data[i].property + ": " + data[i].value + ", zone: " + data[i].zone);
- //PRINT.log(data[i].name+": "+data[i].value); ???
- }
-
- var elements = document.getElementsByClassName('proptest');
- for (var i = 0; i < elements.length; i++) {
- var propinfo = elements[i].getElementsByClassName('propinfo')[0];
- var name = propinfo.innerHTML;
- var idx = list.indexOf(name);
- if (idx >= 0) {
- var zone = elements[i].getElementsByTagName('input')[1];
- updateInput(zone, zone.value);
- var input = elements[i].getElementsByTagName('input')[0];
- updateInput(input, data[idx].value);
- }
- }
- } else {
- PRINT.log(JSON.stringify(data));
- var elements = document.getElementsByClassName('proptest');
- for (var i = 0; i < elements.length; i++) {
- var propinfo = elements[i].getElementsByClassName('propinfo')[0];
- if (data.property == propinfo.innerHTML) {
- var zone = elements[i].getElementsByTagName('input')[1];
- updateInput(zone, zone.value);
- var input = elements[i].getElementsByTagName('input')[0];
- updateInput(input, data.value);
- }
- }
- }
- } else {
- PRINT.fail("no values retrieved for " + eventlist);
- }
- },
- function(msg) {
- PRINT.fail(msg);
- }
- );
-}
-
-function setValue(eventlist) {
- var zoneList = getZone(eventlist);
- var elements = document.getElementsByClassName('proptest');
- var i, valuelist = [] ;
-
- /* initialize the value list */
- for (i = 0; i < eventlist.length; i++) {
- valuelist[i] = 0;
- }
-
- for (var i = 0; i < elements.length; i++) {
- var propinfo = elements[i].getElementsByClassName('propinfo')[0];
- var name = propinfo.innerHTML;
- var idx = eventlist.indexOf(name);
- if (idx >= 0) {
-
- var input = elements[i].getElementsByTagName('input')[0];
- valuelist[idx] = input.value;
- }
- }
-
- var types = window.vehicle.set(eventlist, valuelist, zoneList,
- function(msg) {
- PRINT.pass("Set success for: " + JSON.stringify(msg));
- },
- function(msg) {
- PRINT.fail("Set error: " + JSON.stringify(msg));
- }
- );
-}
-
-function eventListener(e) {
- PRINT.log(e.name + " update: " + JSON.stringify(e.value));
- var elements = document.getElementsByClassName('proptest');
- for (var i = 0; i < elements.length; i++) {
- var propinfo = elements[i].getElementsByClassName('propinfo')[0];
- var name = propinfo.innerHTML;
- if (name === e.name) {
- var input = elements[i].getElementsByTagName('input')[0];
- updateInput(input, e.value.value);
- var zone = elements[i].getElementsByTagName('input')[1];
- updateInput(zone, e.value.zone);
- }
- }
-}
-
-function subscribe(eventlist) {
- var zoneList = getZone(eventlist);
- window.vehicle.subscribe(eventlist, zoneList,
- function(data) {
- PRINT.pass("Subscribe success for: " + data);
- for (var i = 0; i < data.length; i++) {
- var sub = data[i] + "_subscribe";
- var unsub = data[i] + "_unsubscribe";
- // document.getElementById(sub).className = "testbutton subscribe disable"
- // document.getElementById(unsub).className = "testbutton unsubscribe";
- document.addEventListener(data[i], eventListener, false);
- }
- },
- function(msg) {
- PRINT.fail("Subscribe failed for: " + msg);
- }
- );
-}
-
-function unsubscribe(eventlist, zoneList) {
- zoneList = getZone(eventlist);
- /* kill the handers first, so even if the service fails to acknowledge */
- /* we've stopped listening */
- for (var i = 0; i < eventlist.length; i++) {
- document.removeEventListener(eventlist[i], eventListener, false);
- }
- window.vehicle.unsubscribe(eventlist, zoneList,
- function(data) {
- PRINT.pass("Unsubscribe success for: " + data);
- for (var i = 0; i < data.length; i++) {
- var sub = data[i] + "_subscribe";
- var unsub = data[i] + "_unsubscribe";
- // document.getElementById(unsub).className = "testbutton unsubscribe disable";
- // document.getElementById(sub).className = "testbutton subscribe";
- }
- },
- function(msg) {
- PRINT.fail("Unsubscribe failed for: " + msg);
- }
- );
-}
-
-function getZone(eventlist) {
- var list = [];
- if (eventlist.length > 1) {
-
- // for (var i = 0; i < data.length; i++) {
- // list[i] = data[i].property;
- // //list[i] = data[i].name; ???
- // PRINT.log(data[i].property + ": " + data[i].value);
- // //PRINT.log(data[i].name+": "+data[i].value); ???
- // }
-
- var elements = document.getElementsByClassName('proptest');
- for (var i = 0; i < elements.length; i++) {
- var propinfo = elements[i].getElementsByClassName('propinfo')[0];
- var name = propinfo.innerHTML;
- var idx = eventlist.indexOf(name);
- if (idx >= 0) {
- var zone = elements[i].getElementsByTagName('input')[1];
- list.push(zone.value);
- }
- }
- } else {
- var elements = document.getElementsByClassName('proptest');
- for (var i = 0; i < elements.length; i++) {
- var propinfo = elements[i].getElementsByClassName('propinfo')[0];
- if (eventlist[0] == propinfo.innerHTML) {
- var zone = elements[i].getElementsByTagName('input')[1];
- list.push(zone.value);
- }
- }
- }
- return list.join();
-}
-
-function select(elem) {
- var name = elem.innerHTML;
- if (!vehicleEventType.isValid(name))
- return;
-
- var idx = selected.indexOf(name);
- if (elem.className == "propinfo") {
- if (idx < 0) {
- selected[selected.length] = name;
- }
- elem.className = "propinfo select";
- } else if (elem.className == "propinfo select") {
- if (idx >= 0) {
- selected.splice(idx, 1);
- }
- elem.className = "propinfo";
- }
-}
-
-function start(msg) {
- if (window.vehicle && window.vehicle.getSupportedEventTypes) {
- PRINT.pass("vehicle interface online " + msg);
- } else {
- PRINT.fail("vehicle interface not found");
- return;
- }
-
- var tester = document.getElementById("tester");
- var part = ['<div class="proptest"><div class="propinfo" onclick=select(this)>',
- '</div><div class="buttons"><div class="testbutton types" onclick=getTypes("',
- '")></div><div id="',
- '_subscribe" class="testbutton subscribe" onclick=subscribe(["',
- '"])></div><div id="',
- '_unsubscribe" class="testbutton unsubscribe" onclick=unsubscribe(["',
- '"])></div><div class="testbutton get" onclick=getValue(["',
- '"])></div><div class="testbutton set" onclick=setValue(["',
- '"])></div><input class = "Textvalue" type="text" value="0" placeholder="Value" /><div class = "smallText"> Zone: </div><input class = "zone" type="text" value="0" placeholder="Zone"/></div></div>'
- ];
- var events = vehicleEventType.event;
-
- /* apply on all selected events */
- var html = '<div class="proptest"><div class="propinfo unselectable">apply on all selected events' +
- '</div><div class="buttons">' +
- '<div class="testbutton subscribe" onclick=subscribe(selected)></div>' +
- '<div class="testbutton unsubscribe" onclick=unsubscribe(selected)></div>' +
- '<div class="testbutton get" onclick=getValue(selected)></div>' +
- '<div class="testbutton set" onclick=setValue(selected)></div></div></div>';
-
- /* all events */
- html += '<div class="proptest"><div class="propinfo unselectable">all events';
- html += '</div><div class="buttons"><div class="testbutton types" onclick=getTypes("' ;
- html += '")></div><div class="testbutton subscribe" onclick=\"subscribe([\'' ;
- html += events.join("','") ;
- html += '\'])\"></div><div class="testbutton unsubscribe" onclick= \"unsubscribe([\'' ;
- html += events.join("','");
- html += '\'])\"></div><div class="testbutton get" onclick=\"getValue([\'' ;
- html += events.join("','");
- html += '\'])\"></div></div></div>';
-
- /* events */
- for (var i = 0; i < events.length; i++) {
- var piece = "";
- for (var j = 0; j < part.length - 1; j++) {
- piece += part[j] + events[i];
- }
- html += piece + part[j];
- }
- tester.innerHTML = html;
-}
-
-function error(msg) {
- PRINT.fail(msg);
-}
-
-function init(url, protocol) {
- PRINT.init("result");
- window.vehicle = new Vehicle(start, error, url, protocol);
-}
diff --git a/plugins/websocketsink/test/vehicle.js b/plugins/websocketsink/test/vehicle.js
deleted file mode 100644
index 6b8e6009..00000000
--- a/plugins/websocketsink/test/vehicle.js
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
- * Copyright (c) 2012, Intel Corporation.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0. The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-
-/*****************************************************************************
-* Class name: Vehicle
-* Description:
-* A javascript implementation of the IVI vehicle API that communicates
-* to the automotive message broker through a websocket
-* Optional constructor arguments:
-* sCB: success callback, called when socket is connected, argument is
-* success message string
-* eCB: error callback, called on socket close or error, argument is error
-* message string
-* url: the URL to use for the websocket, in the form "ws://host:port/script"
-* protocol: the protocol to use for the websocket, default is "http-only"
-*
-* [Public Member functions]
-* Function name: getSupportedEventTypes(type, writeable, successCB, errorCB)
-* Description:
-* Retrieves a list of vehicle events for the requested type
-* Required arguments:
-* type: target event or group to query (use empty string for all events)
-* writeable: if true, return only writeable events, otherwise get all
-* successCB: success callback, gets called with a string list of names
-* for all the events and event groups that are children of the
-* target. e.g. "vehicle_info" returns all events/groups with the
-* vehicle_info prefix. If the target is an event group, it's
-* omitted from the returned list
-* errorCB: error callback, called with error message string
-*
-* Function name: get(eventlist, successCB, errorCB)
-* Description:
-* Retrieves a list of event/value pairs for a target list of event names
-* Required arguments:
-* eventlist[]: list of events to read (use empty string for all events)
-* successCB: success callback, gets called with the event/value pair list
-* for all requested events. The list is the in the
-* form of data[n].name/data[n].value
-* errorCB: error callback, called with error message string
-*
-* Function name: getHistory(event, startTime, endTime, successCB, errorCB)
-* Description:
-* Retrieves a list of event/value pairs for a target list of event names
-* Required arguments:
-* event: event to read
-* startTime: start date/time
-* endTime: end date/time
-* successCB: success callback, gets called with the event/value pair list
-* for all requested events. The list is the in the
-* form of data[n].name/data[n].value
-* errorCB: error callback, called with error message string
-*
-*
-* Function name: set(eventlist, valuelist, successCB, errorCB)
-* Description:
-* Sets a gourp of event's values (triggers error on read-only events)
-* Required arguments:
-* eventlist: target events to set
-* valuelist: target event values
-* successCB: success callback, gets called with the eventlist
-* that was successfully set
-* errorCB: error callback, called with error message string
-*
-* Function name: subscribe(eventlist, successCB, errorCB)
-* Description:
-* Subscribe to a list of events so you can listen to value changes, they
-* can be monitored with document.addEventListener(eventname, callback, false);
-* The Event object passed to the callback has two parameters, e.name and
-* e.value. Events are sent to the handler individually.
-* Required arguments:
-* eventlist: target events to listen to
-* successCB: success callback, gets called with the eventlist
-* that was successfully subscribed
-* errorCB: error callback, called with the eventlist that failed to subscribe
-*
-* Function name: unsubscribe(eventlist, successCB, errorCB)
-* Description:
-* Unsubscribe to a list of events to let the server know you're not listening,
-* they should stop being sent from the server if no other clients are using them,
-* but will at least stop being triggered in your app.
-* Required arguments:
-* eventlist: target events to stop listening to
-* successCB: success callback, gets called with the eventlist
-* that was successfully unsubscribed
-* errorCB: error callback, called with the eventlist that failed to unsubscribe
-*
-******************************************************************************/
-/*
-(function () {
-*/
-function Vehicle(sCB, eCB, url, protocol)
-{
- /* store a copy of Vehicle this for reference in callbacks */
- var self = this;
-
- this.iSuccessCB = sCB;
- this.iErrorCB = eCB;
-
- /* variables for call management, supports up to 100 simultaneously */
- this.methodIdx = 0;
- this.methodCalls = [];
- for(var i = 0; i < 100; i++)
- {
- this.methodCalls[i] = null;
- }
-
- /* number of connection retries to attempt if the socket closes */
- this.retries = 5;
- this.connected = false;
-
- /* timeout for method calls in milliseconds */
- this.timeouttime = 5000;
-
- /* default values for WebSocket */
- this.socketUrl = "ws://localhost:23000/vehicle";
- this.socketProtocol = "http-only";
-
- /* override the websocket address if parameters are given */
- if(url !== undefined) this.socketUrl = url;
- if(protocol !== undefined) this.socketProtocol = protocol;
-
- this.VehicleMethodCall = function(id, name, successCB, errorCB)
- {
- var me = this;
- this.successCB = successCB;
- this.errorCB = errorCB;
- this.transactionid = id;
- this.name = name;
- this.done = false;
- this.start = function()
- {
- me.timeout = setTimeout(function(){
- if(me.errorCB !== undefined)
- {
- me.errorCB("\""+me.name+"\" method timed out after "+self.timeouttime+"ms");
- }
- me.finish();
- }, self.timeouttime);
- }
- this.finish = function()
- {
- if(me.timeout !== undefined)
- {
- clearTimeout(me.timeout);
- }
- me.done = true;
- }
- }
-
- function init() {
- if ("WebSocket" in window)
- {
- if(self.socketProtocol.length > 0)
- {
- self.socket = new WebSocket(self.socketUrl, self.socketProtocol);
- }
- else
- {
- self.socket = new WebSocket(self.socketUrl);
- }
- self.socket.onopen = function()
- {
- self.connected = true;
- self.iSuccessCB((self.retries < 5)?"(RECONNECTED)":"");
- self.retries = 5;
- };
- self.socket.onclose = function()
- {
- self.connected = false;
- self.iErrorCB("socket closed "+((self.retries > 0)?"retrying in 5 seconds ...":""));
- if(self.retries > 0)
- {
- setTimeout(function(){
- self.retries--;
- init();
- }, 5000);
- }
- };
- self.socket.onerror = function(e)
- {
- self.iErrorCB(e.data);
- };
- self.socket.onmessage = function (e)
- {
- self.receive(e.data);
- };
- }
- else
- {
- console.log("This browser doesn't appear to support websockets!");
- }
- }
- init();
-}
-
-Vehicle.prototype.generateTransactionId = function()
-{
- var i, val = [];
- for(i = 0; i < 8; i++)
- {
- var num = Math.floor((Math.random()+1)*65536);
- val[i] = num.toString(16).substring(1);
- }
- var uuid = val[0]+val[1]+"-"+
- val[2]+"-"+val[3]+"-"+val[4]+"-"+
- val[5]+val[6]+val[7];
- return uuid;
-}
-
-Vehicle.prototype.send = function(obj, successCB, errorCB)
-{
- if(!this.connected)
- {
- if(errorCB !== undefined)
- {
- errorCB("\""+obj.name+"\" method failed because socket is closed");
- }
- return;
- }
- var i = this.methodIdx;
- this.methodIdx = (this.methodIdx + 1)%100;
- this.methodCalls[i] = new this.VehicleMethodCall(obj.transactionid,
- obj.name, successCB, errorCB);
- this.socket.send(JSON.stringify(obj));
- this.methodCalls[i].start();
-}
-
-
-Vehicle.prototype.getSupportedEventTypes = function(type, writeable, successCB, errorCB)
-{
- var obj = {
- "type" : "method",
- "name" : "getSupportedEventTypes",
- "writeable" : writeable,
- "transactionid" : this.generateTransactionId(),
- "data" : type
- };
- this.send(obj, successCB, errorCB);
-}
-
-Vehicle.prototype.get = function(namelist, zone, successCB, errorCB)
-{
- if(namelist.length <= 0)
- {
- return;
- }
-
- var properties = [];
-
- for(var i = 0; i < namelist.length; i++)
- {
- properties[i] = {"property" : namelist[i], "zone" : zone};
- }
- var obj = {
- "type" : "method",
- "name": "get",
- "transactionid" : this.generateTransactionId(),
- "data" : properties
- };
- this.send(obj, successCB, errorCB);
-}
-
-Vehicle.prototype.getHistory = function(event, startTime, endTime, successCB, errorCB)
-{
- var obj = {
- "type" : "method",
- "name": "getHistory",
- "transactionid" : this.generateTransactionId(),
- "data" : [event, (startTime.getTime()/1000).toString(), (endTime.getTime()/1000).toString()]
- };
-
- this.send(obj, successCB, errorCB);
-
-}
-
-Vehicle.prototype.set = function(namelist, valuelist, zoneList, successCB, errorCB)
-{
- if((namelist.length != valuelist.length)||(namelist.length <= 0))
- {
- return;
- }
-
- var obj = {
- "type" : "method",
- "name": "set",
- "transactionid" : this.generateTransactionId(),
- "data" : []
- };
- var list = [];
- for(var i = 0; i < namelist.length; i++)
- {
- var val = {"property" : namelist[i], "value" : valuelist[i],"zone" : zoneList[i]};
- list[list.length] = val;
- }
- obj.data = list;
- this.send(obj, successCB, errorCB);
-}
-
-Vehicle.prototype.subscribe = function(namelist, zoneList, successCB, errorCB)
-{
- var obj = {
- "type" : "method",
- "name": "subscribe",
- "transactionid" : this.generateTransactionId(),
- "data" : namelist,
- "zone" : zoneList
- };
- this.send(obj, successCB, errorCB);
-}
-
-Vehicle.prototype.unsubscribe = function(namelist, zoneList, successCB, errorCB)
-{
- var obj = {
- "type" : "method",
- "name": "unsubscribe",
- "transactionid" : this.generateTransactionId(),
- "data" : namelist,
- "zone" : zoneList
- };
- this.send(obj, successCB, errorCB);
-}
-
-Vehicle.prototype.sendEvent = function(name, value)
-{
- var evt = document.createEvent("Event");
- evt.initEvent(name, true, true);
- evt.name = name;
- evt.value = value;
- document.dispatchEvent(evt);
- console.log(evt);
-}
-
-Vehicle.prototype.receive = function(msg)
-{
- var self = this;
- var event;
- try {
- event = JSON.parse(msg);
- }
- catch(e) {
- self.iErrorCB("GARBAGE MESSAGE: "+msg);
- return;
- }
-
- if((event === undefined)||(event.type === undefined)||
- (event.name === undefined))
- {
- self.iErrorCB("BADLY FORMED MESSAGE: "+msg);
- return;
- }
- else
- {
- if(event.type === "methodReply")
- {
- var calls = this.methodCalls;
- for(var i = 0; i < calls.length; i++)
- {
- var call = calls[i];
- if(call&&(!call.done)&&(call.transactionid === event.transactionid))
- {
- call.finish();
- if(event.error !== undefined)
- {
- call.errorCB(event.error);
- }
- else if(event.data !== undefined && call.successCB !== undefined)
- {
- call.successCB(event.data);
- }
- return;
- }
- }
- }
- else if(event.type === "valuechanged")
- {
- self.sendEvent(event.name, event.data);
- }
- }
-}
-
-/*
- // AMD / RequireJS
- if (typeof define !== 'undefined' && define.amd) {
- define([], function () {
- return {
- Vehicle: Vehicle
- };
- });
- }
- // Node.js
- else if (typeof module !== 'undefined' && module.exports) {
- module.exports = {
- Vehicle: Vehicle
- };
- }
- // included directly via <script> tag
- else {
- root.vehicle = {
- Vehicle: Vehicle
- };
- }
-})();
-*/
diff --git a/plugins/websocketsink/websocketsink.cpp b/plugins/websocketsink/websocketsink.cpp
deleted file mode 100644
index 21093f52..00000000
--- a/plugins/websocketsink/websocketsink.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- Copyright (C) 2012 Intel Corporation
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-
-#include "websocketsink.h"
-#include <glib.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sstream>
-#include "debugout.h"
-
-
-
-WebSocketSink::WebSocketSink(AbstractRoutingEngine* re,libwebsocket *wsi,string uuid,VehicleProperty::Property property,std::string ambdproperty) : AbstractSink(re,map<string, string> ())
-{
- m_amdbproperty = ambdproperty;
- m_uuid = uuid;
- m_wsi = wsi;
- m_property = property;
- m_re = re;
- re->subscribeToProperty(ambdproperty,this);
-}
-const string WebSocketSink::uuid()
-{
- return m_uuid;
-}
-void WebSocketSink::propertyChanged(AbstractPropertyType *value)
-{
- VehicleProperty::Property property = value->name;
-
- stringstream s;
-
- //TODO: Dirty hack hardcoded stuff, jsut to make it work.
- std::string tmpstr="";
- if (m_property != property)
- {
- tmpstr = m_property;
- }
- else
- {
- tmpstr = property;
- }
-
- s.precision(15);
-
- s << "{\"type\":\"valuechanged\",\"name\":\"" << tmpstr << "\",\"data\":";
- s << "{ \"value\":\"" << value->toString() << "\",\"zone\":\""<<value->zone;
- s << "\",\"timestamp\":\""<<value->timestamp<<"\",\"sequence\":\""<<value->sequence<<"\"},";
- s << "\"transactionid\":\"" << m_uuid << "\"}";
-
- string replystr = s.str();
- //printf("Reply: %s\n",replystr.c_str());
-
- DebugOut() << "Reply:" << replystr << "\n";
-
- char *new_response = new char[LWS_SEND_BUFFER_PRE_PADDING + strlen(replystr.c_str()) + LWS_SEND_BUFFER_POST_PADDING];
- new_response+=LWS_SEND_BUFFER_PRE_PADDING;
- strcpy(new_response,replystr.c_str());
- libwebsocket_write(m_wsi, (unsigned char*)new_response, strlen(new_response), LWS_WRITE_TEXT);
- delete [] (char*)(new_response-LWS_SEND_BUFFER_PRE_PADDING);
-}
-WebSocketSink::~WebSocketSink()
-{
- m_re->unsubscribeToProperty(m_amdbproperty,this);
-}
-void WebSocketSink::supportedChanged(PropertyList supportedProperties)
-{
-}
-PropertyList WebSocketSink::subscriptions()
-{
- return PropertyList();
-}
-
diff --git a/plugins/websocketsink/websocketsink.h b/plugins/websocketsink/websocketsink.h
deleted file mode 100644
index 94d4b695..00000000
--- a/plugins/websocketsink/websocketsink.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- Copyright (C) 2012 Intel Corporation
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-
-#ifndef WEBSOCKETSINK_H
-#define WEBSOCKETSINK_H
-#include <glib.h>
-#include <abstractroutingengine.h>
-#include "abstractsink.h"
-#include <libwebsockets.h>
-class WebSocketSink : public AbstractSink
-{
-
-public:
- WebSocketSink(AbstractRoutingEngine* re,libwebsocket *wsi,string uuid,VehicleProperty::Property property,std::string ambdproperty);
- ~WebSocketSink();
- const string uuid() ;
- void propertyChanged(AbstractPropertyType *value);
- void supportedChanged(PropertyList supportedProperties);
- PropertyList subscriptions();
- libwebsocket *socket() { return m_wsi; }
-private:
- char *webSocketBuffer;
- string m_amdbproperty;
- AbstractRoutingEngine *m_re;
- libwebsocket *m_wsi;
- string m_uuid;
- string m_property;
-};
-
-#endif // WEBSOCKETSINK_H
diff --git a/plugins/websocketsink/websocketsinkmanager.cpp b/plugins/websocketsink/websocketsinkmanager.cpp
deleted file mode 100644
index 94997f03..00000000
--- a/plugins/websocketsink/websocketsinkmanager.cpp
+++ /dev/null
@@ -1,769 +0,0 @@
-/*
- Copyright (C) 2012 Intel Corporation
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-
-#include "websocketsinkmanager.h"
-#include "websocketsink.h"
-#include <sstream>
-#include <json/json.h>
-#include <json/json_object.h>
-#include <json/json_tokener.h>
-#include <listplusplus.h>
-#include <memory>
-
-#define __SMALLFILE__ std::string(__FILE__).substr(std::string(__FILE__).rfind("/")+1)
-
-//Global variables, these will be moved into the class
-struct pollfd pollfds[100];
-int count_pollfds = 0;
-libwebsocket_context *context;
-WebSocketSinkManager *sinkManager;
-static int websocket_callback(struct libwebsocket_context *context,struct libwebsocket *wsi,enum libwebsocket_callback_reasons reason, void *user,void *in, size_t len);
-bool gioPollingFunc(GIOChannel *source,GIOCondition condition,gpointer data);
-
-// libwebsocket_write helper function
-static int lwsWrite(struct libwebsocket *lws, const std::string& strToWrite)
-{
- std::unique_ptr<char[]> buffer(new char[LWS_SEND_BUFFER_PRE_PADDING + strToWrite.length() + LWS_SEND_BUFFER_POST_PADDING]);
-
- char *buf = buffer.get() + LWS_SEND_BUFFER_PRE_PADDING;
- strcpy(buf, strToWrite.c_str());
-
- //NOTE: delete[] on buffer is not needed since std::unique_ptr<char[]> is used
- return libwebsocket_write(lws, (unsigned char*)buf, strToWrite.length(), LWS_WRITE_TEXT);
-}
-
-WebSocketSinkManager::WebSocketSinkManager(AbstractRoutingEngine* engine, map<string, string> config):AbstractSinkManager(engine, config)
-{
- m_engine = engine;
-
-
- //Create a listening socket on port 23000 on localhost.
-
-
-}
-void WebSocketSinkManager::init()
-{
- //Protocol list for libwebsockets.
- protocollist[0] = { "http-only", websocket_callback, 0 };
- protocollist[1] = { NULL, NULL, 0 };
-
-
- setConfiguration(configuration);
-}
-list< VehicleProperty::Property > WebSocketSinkManager::getSupportedProperties()
-{
- return m_engine->supported();
-}
-void WebSocketSinkManager::setConfiguration(map<string, string> config)
-{
-// //Config has been passed, let's start stuff up.
- configuration = config;
- struct lws_context_creation_info info;
- memset(&info, 0, sizeof info);
-
- //Default values
- int port = 23000;
- std::string interface = "lo";
- std::string ssl_cert_path;
- std::string ssl_key_path;
- int options = 0;
- bool ssl = false;
- //Try to load config
- for (map<string,string>::iterator i=configuration.begin();i!=configuration.end();i++)
- {
- //printf("Incoming setting: %s:%s\n",(*i).first.c_str(),(*i).second.c_str());
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Incoming setting:" << (*i).first << ":" << (*i).second << "\n";
- if ((*i).first == "interface")
- {
- interface = (*i).second;
- }
- if ((*i).first == "port")
- {
- port = boost::lexical_cast<int>((*i).second);
- }
- if ((*i).first == "cert")
- {
- ssl_cert_path = (*i).second;
- }
- if ((*i).first == "key")
- {
- ssl_key_path = (*i).second;
- }
- if ((*i).first == "ssl")
- {
- if ((*i).second == "true")
- {
- ssl = true;
- }
- else
- {
- ssl = false;
- }
- }
- }
- info.iface = interface.c_str();
- info.protocols = protocollist;
- info.extensions = libwebsocket_get_internal_extensions();
- info.gid = -1;
- info.uid = -1;
- info.options = options;
- info.port = port;
- if (ssl)
- {
- info.ssl_cert_filepath = ssl_cert_path.c_str();
- info.ssl_private_key_filepath = ssl_key_path.c_str();
- }
- context = libwebsocket_create_context(&info);
-
-}
-
-void WebSocketSinkManager::addSingleShotSink(libwebsocket* socket, VehicleProperty::Property property, Zone::Type zone, string id)
-{
- AsyncPropertyRequest request;
- PropertyList foo = VehicleProperty::capabilities();
- if (ListPlusPlus<VehicleProperty::Property>(&foo).contains(property))
- {
- request.property = property;
- }
- else
- {
- DebugOut(0)<<"websocketsink: Invalid property requested: "<<property;
- return;
- }
-
- request.zoneFilter = zone;
- request.completed = [socket,id,property](AsyncPropertyReply* reply)
- {
- DebugOut()<<"Got property: "<<reply->property.c_str()<<endl;
- if(!reply->value){
- DebugOut()<<"Property value is null"<<endl;
- delete reply;
- return;
- }
-
- stringstream s;
- s.precision(15);
-
- s << "{\"type\":\"methodReply\",\"name\":\"get\",\"data\":{";
- s << "\"property\":\"" << property << "\",\"zone\":\"" << reply->value->zone << "\",\"value\":\"" << reply->value->toString() << "\",\"timestamp\":\""<<reply->value->timestamp<<"\",";
- s <<"\"sequence\": \""<<reply->value->sequence<<"\"}";
- s << ",\"transactionid\":\"" << id << "\"}";
-
- string replystr = s.str();
- //printf("Reply: %s\n",replystr.c_str());
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Reply:" << replystr << endl;
-
- lwsWrite(socket, replystr);
-
- delete reply;
- };
-
- AsyncPropertyReply* reply = routingEngine->getPropertyAsync(request);
-}
-
-void WebSocketSinkManager::addSingleShotRangedSink(libwebsocket* socket, PropertyList properties, double start, double end, double seqstart,double seqend, string id)
-{
- AsyncRangePropertyRequest rangedRequest;
-
- rangedRequest.timeBegin = start;
- rangedRequest.timeEnd = end;
- rangedRequest.sequenceBegin = seqstart;
- rangedRequest.sequenceEnd = seqend;
-
- rangedRequest.completed = [socket,id](AsyncRangePropertyReply* reply)
- {
- stringstream s;
-
- stringstream data;
- data.precision(15);
- data<< "[";
- std::list<AbstractPropertyType*> values = reply->values;
- for(auto itr = values.begin(); itr != values.end(); itr++)
- {
- if(itr != values.begin())
- {
- data<<",";
- }
-
- data << "{ \"value\" : " << "\"" << (*itr)->toString() << "\", \"timestamp\" : \"" << (*itr)->timestamp << "\", \"sequence\" : \""<<(*itr)->sequence<<"\" }";
- }
-
- data<<"]";
-
- s << "{\"type\":\"methodReply\",\"name\":\"getRanged\",\"data\":"<<data.str()<<",\"transactionid\":\"" << id << "\"}";
-
- string replystr = s.str();
- //printf("Reply: %s\n",replystr.c_str());
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Reply:" << replystr << "\n";
-
- lwsWrite(socket, replystr);
-
- delete reply;
- };
-
- AsyncRangePropertyReply* reply = routingEngine->getRangePropertyAsync(rangedRequest);
-}
-
-void WebSocketSinkManager::removeSink(libwebsocket* socket,VehicleProperty::Property property, string uuid)
-{
- if (m_sinkMap.find(property) != m_sinkMap.end())
- {
- list<WebSocketSink*> sinks = m_sinkMap[property];
-
- for(auto i = sinks.begin(); i != sinks.end(); i++)
- {
- delete *i;
- }
-
- m_sinkMap.erase(property);
-
- stringstream s;
- s << "{\"type\":\"methodReply\",\"name\":\"unsubscribe\",\"data\":[\"" << property << "\"],\"transactionid\":\"" << uuid << "\"}";
-
- string replystr = s.str();
- //printf("Reply: %s\n",replystr.c_str());
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Reply:" << replystr << "\n";
-
- lwsWrite(socket, replystr);
- }
-}
-void WebSocketSinkManager::setValue(libwebsocket* socket,VehicleProperty::Property property,string value,Zone::Type zone,string uuid)
-{
- AbstractPropertyType* type = VehicleProperty::getPropertyTypeForPropertyNameValue(property,value);
-
- AsyncSetPropertyRequest request;
- request.property = property;
- request.value = type;
- request.zoneFilter = zone;
- request.completed = [&](AsyncPropertyReply* reply)
- {
- ///TODO: do something here on !reply->success
- stringstream s;
- s << "{\"type\":\"methodReply\",\"name\":\"set\",\"data\":[{\"property\":\"" << property << "\",\"zone\":" << reply->zoneFilter
- << "}],\"transactionid\":\"" << uuid << "\"";
- if(!reply->success)
- s << ",\"error\":\"method call failed\"";
- s << "}";
-
- string replystr = s.str();
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Reply:" << replystr << "\n";
-
- lwsWrite(socket, replystr);
-
- delete reply;
- };
-
- m_engine->setProperty(request);
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "AbstractRoutingEngine::setProperty called with arguments:" << property << value << "\n";
- delete type;
-
-}
-void WebSocketSinkManager::addSink(libwebsocket* socket, VehicleProperty::Property property,string uuid)
-{
- stringstream s;
-
- string tmpstr = "";
- {
- PropertyList foo = VehicleProperty::capabilities();
- if (ListPlusPlus<VehicleProperty::Property>(&foo).contains(property))
- {
- tmpstr = property;
- }
- else
- {
- //Invalid property requested.
- return;
- }
-
- }
- s << "{\"type\":\"methodReply\",\"name\":\"subscribe\",\"data\":[\"" << property << "\"],\"transactionid\":\"" << uuid << "\"}";
-
- string replystr = s.str();
- //printf("Reply: %s\n",replystr.c_str());
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Reply:" << replystr << "\n";
-
- lwsWrite(socket, replystr);
-
- WebSocketSink *sink = new WebSocketSink(m_engine,socket,uuid,property,tmpstr);
- m_sinkMap[property].push_back(sink);
-}
-extern "C" AbstractSinkManager * create(AbstractRoutingEngine* routingengine, map<string, string> config)
-{
- sinkManager = new WebSocketSinkManager(routingengine, config);
- sinkManager->init();
- return sinkManager;
-}
-void WebSocketSinkManager::disconnectAll(libwebsocket* socket)
-{
- std::list<WebSocketSink*> toDeleteList;
-
- for (auto i=m_sinkMap.begin(); i != m_sinkMap.end();i++)
- {
- std::list<WebSocketSink*> *sinks = & (*i).second;
- for (auto sinkItr = sinks->begin(); sinkItr != sinks->end(); sinkItr++)
- {
- if ((*sinkItr)->socket() == socket)
- {
- //This is the sink in question.
- WebSocketSink* sink = (*sinkItr);
- if(!ListPlusPlus<WebSocketSink*>(&toDeleteList).contains(sink))
- {
- toDeleteList.push_back(sink);
- }
-
- sinks->erase(sinkItr);
- sinkItr = sinks->begin();
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Sink removed"<<endl;
- }
- }
- }
-
- for(auto i=toDeleteList.begin();i!=toDeleteList.end();i++)
- {
- delete *i;
- }
-}
-void WebSocketSinkManager::addPoll(int fd)
-{
- GIOChannel *chan = g_io_channel_unix_new(fd);
- guint sourceid = g_io_add_watch(chan, GIOCondition(G_IO_IN | G_IO_HUP | G_IO_ERR),(GIOFunc)gioPollingFunc,chan);
- g_io_channel_set_close_on_unref(chan,true);
- g_io_channel_unref(chan); //Pass ownership of the GIOChannel to the watch.
- m_ioChannelMap[fd] = chan;
- m_ioSourceMap[fd] = sourceid;
-}
-void WebSocketSinkManager::removePoll(int fd)
-{
- g_io_channel_shutdown(m_ioChannelMap[fd],false,0);
- //printf("Shutting down IO Channel\n");
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Shutting down IO Channel\n";
- g_source_remove(m_ioSourceMap[fd]); //Since the watch owns the GIOChannel, this should unref it enough to dissapear.
-
- //for (map<int,guint>::const_iterator i=m_ioSourceMap.cbegin();i!=m_ioSourceMap.cend();i++)
- for (map<int,guint>::iterator i=m_ioSourceMap.begin();i!=m_ioSourceMap.end();i++)
- {
- if((*i).first == fd)
- {
- //printf("Erasing source\n");
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Erasing source\n";
- m_ioSourceMap.erase(i);
- i--;
- if (m_ioSourceMap.size() == 0)
- {
- break;
- }
- }
- }
- //for (map<int,GIOChannel*>::const_iterator i=m_ioChannelMap.cbegin();i!=m_ioChannelMap.cend();i++)
- for (map<int,GIOChannel*>::iterator i=m_ioChannelMap.begin();i!=m_ioChannelMap.end();i++)
- {
- if((*i).first == fd)
- {
- //printf("Erasing channel\n");
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Erasing channel\n";
- m_ioChannelMap.erase(i);
- i--;
- if (m_ioChannelMap.size() == 0)
- {
- break;
- }
- }
- }
-}
-
-static int websocket_callback(struct libwebsocket_context *context,struct libwebsocket *wsi,enum libwebsocket_callback_reasons reason, void *user,void *in, size_t len)
-{
- //printf("Switch: %i\n",reason);
- DebugOut(5) << __SMALLFILE__ << ":" << __LINE__ << "websocket_callback:" << reason << endl;
-
-
- switch (reason)
- {
- case LWS_CALLBACK_CLIENT_WRITEABLE:
- {
- //Connection has been established.
- //printf("Connection established\n");
- break;
- }
- case LWS_CALLBACK_CLOSED:
- {
- //Connection is closed, we need to remove all related sinks
- sinkManager->disconnectAll(wsi);
- /*g_io_
- GIOChannel *chan = g_io_channel_unix_new((int)(long)user);
- g_io_add_watch(chan,G_IO_IN,(GIOFunc)gioPollingFunc,0);
- g_io_add_watch(chan,G_IO_PRI,(GIOFunc)gioPollingFunc,0);
- pollfds[count_pollfds].fd = (int)(long)user;
- pollfds[count_pollfds].events = (int)len;
-// pollfds[count_pollfds++].revents = 0;*/
- break;
- }
- case LWS_CALLBACK_CLIENT_RECEIVE:
- {
- //printf("Client writable\n");
- break;
- }
- case LWS_CALLBACK_SERVER_WRITEABLE:
- {
- //printf("Server writable\n");
- break;
- }
-
- case LWS_CALLBACK_RECEIVE:
- {
- //printf("Data Received: %s\n",(char*)in);
- //The lack of a break; here is intentional.
- }
- case LWS_CALLBACK_HTTP:
- {
- //TODO: Verify that ALL requests get sent via LWS_CALLBACK_HTTP, so we can use that instead of LWS_CALLBACK_RECIEVE
- //TODO: Do we want exceptions, or just to return an invalid json reply? Probably an invalid json reply.
- DebugOut() << __SMALLFILE__ << ":" << __LINE__ << " Requested: " << (char*)in << "\n";
-
- std::string tempInput((char*)in);
-
- json_object *rootobject;
- json_tokener *tokener = json_tokener_new();
- enum json_tokener_error err;
- do
- {
- rootobject = json_tokener_parse_ex(tokener, tempInput.c_str(),len);
- } while ((err = json_tokener_get_error(tokener)) == json_tokener_continue);
- if (err != json_tokener_success)
- {
- fprintf(stderr, "Error: %s\n", json_tokener_error_desc(err));
- throw std::runtime_error("JSON Parsing error");
- // Handle errors, as appropriate for your application.
- }
- if(!rootobject)
- {
- DebugOut(0)<<"failed to parse json: "<<tempInput<<endl;
- }
-
- if (tokener->char_offset < len) // XXX shouldn't access internal fields
- {
- // Handle extra characters after parsed object as desired.
- // e.g. issue an error, parse another object from that point, etc...
-
- }
- // Success, use jobj here.
- json_object *typeobject = json_object_object_get(rootobject,"type");
- json_object *nameobject = json_object_object_get(rootobject,"name");
- json_object *transidobject = json_object_object_get(rootobject,"transactionid");
-
- string type = string(json_object_get_string(typeobject));
- string name = string(json_object_get_string(nameobject));
- string id;
- if (json_object_get_type(transidobject) == json_type_string)
- {
- id = string(json_object_get_string(transidobject));
- }
- else
- {
- stringstream strstr;
- strstr << json_object_get_int(transidobject);
- id = strstr.str();
- }
- json_object_put(typeobject);
- json_object_put(nameobject);
- json_object_put(transidobject);
- if (type == "method" && name == "getRanged")
- {
- json_object *dataobject = json_object_object_get(rootobject,"data");
- if (json_object_get_type(dataobject) == json_type_object)
- {
- json_object *timeBeginObject = json_object_object_get(dataobject,"timeBegin");
- json_object *timeEndObject = json_object_object_get(dataobject,"timeEnd");
- json_object *sequenceBeginObject = json_object_object_get(dataobject,"sequenceBegin");
- json_object *sequenceEndObject = json_object_object_get(dataobject,"sequenceEnd");
- json_object *propertyObject = json_object_object_get(dataobject,"properties");
- double timeBegin = boost::lexical_cast<double,std::string>(json_object_get_string(timeBeginObject));
- double timeEnd = boost::lexical_cast<double,std::string>(json_object_get_string(timeEndObject));
- double sequenceBegin = boost::lexical_cast<double,std::string>(json_object_get_string(sequenceBeginObject));
- double sequenceEnd = boost::lexical_cast<double,std::string>(json_object_get_string(sequenceEndObject));
-
- array_list *plist = json_object_get_array(propertyObject);
-
- PropertyList propertyList;
-
- for(int i=0; i < array_list_length(plist); i++)
- {
- json_object *prop = (json_object*)array_list_get_idx(plist,i);
-
- std::string pstr = json_object_get_string(prop);
-
- propertyList.push_back(pstr);
- }
-
- json_object_put(timeBeginObject);
- json_object_put(timeEndObject);
- json_object_put(sequenceBeginObject);
- json_object_put(sequenceEndObject);
- json_object_put(propertyObject);
-
- if ((timeBegin < 0 && timeEnd > 0) || (timeBegin > 0 && timeEnd < 0))
- {
- DebugOut(DebugOut::Warning)<<"Invalid time begin/end pair"<<endl;
- }
- else if ((sequenceBegin < 0 && sequenceEnd > 0) || (sequenceBegin > 0 && sequenceEnd < 0))
- {
- DebugOut(DebugOut::Warning)<<"Invalid sequence begin/end pair"<<endl;
- }
- else
- {
- sinkManager->addSingleShotRangedSink(wsi,propertyList,timeBegin,timeEnd,sequenceBegin,sequenceEnd,id);
- }
- }
- json_object_put(dataobject);
- }
- else
- {
-
- vector<string> data;
- list<string> key;
- list<string> value;
- list<Zone::Type> zone;
- json_object *dataobject = json_object_object_get(rootobject,"data");
- if (json_object_get_type(dataobject) == json_type_array)
- {
- array_list *arraylist = json_object_get_array(dataobject);
- for (int i=0;i<array_list_length(arraylist);i++)
- {
- json_object *arrayobject = (json_object*)array_list_get_idx(arraylist,i);
- if (json_object_get_type(arrayobject) == json_type_object)
- {
- json_object *propobject = json_object_object_get(arrayobject,"property");
- json_object *valueobject = json_object_object_get(arrayobject,"value");
- json_object *zoneobject = json_object_object_get(arrayobject,"zone");
- string keystr = string(propobject ? json_object_get_string(propobject) : "");
- string valuestr = string(valueobject ? json_object_get_string(valueobject): "");
- key.push_back(keystr);
- value.push_back(valuestr);
- Zone::Type z(Zone::None);
- if(zoneobject){
- try {
- z = static_cast<Zone::Type>(boost::lexical_cast<int,std::string>(json_object_get_string(zoneobject)));
- } catch (...) { }
- }
- zone.push_back(z);
- json_object_put(propobject);
- json_object_put(valueobject);
- json_object_put(zoneobject);
- }
- else if (json_object_get_type(arrayobject) == json_type_string)
- {
- string path = string(json_object_get_string(arrayobject));
- data.push_back(path);
- }
- }
- //array_list_free(arraylist);
- }
- else
- {
- string path = json_object_get_string(dataobject);
- if (path != "")
- {
- data.push_back(path);
- }
- }
- json_object_put(dataobject);
- if (type == "method")
- {
- if (name == "get")
- {
- if (data.size() > 0)
- {
- //GetProperty is going to be a singleshot sink.
- sinkManager->addSingleShotSink(wsi,data.front(),Zone::None,id);
- }
- else if (key.size() > 0 && key.size() == zone.size())
- {
- //GetProperty is going to be a singleshot sink.
- sinkManager->addSingleShotSink(wsi,key.front(),zone.front(),id);
- }
- else
- {
- DebugOut() << __SMALLFILE__ << ":" << __LINE__ << " \"get\" method called with no data! Transaction ID:" << id << "\n";
- }
- }
- else if (name == "set")
- {
- if (data.size() > 0)
- {
- //Should not happen
- }
- else if (value.size() > 0)
- {
- if (key.size() != value.size())
- {
- DebugOut() << __SMALLFILE__ << ":" << __LINE__ << "\"set\" method called with an invalid key value pair count\n";
- }
- else
- {
- list<string>::iterator d = value.begin();
- list<Zone::Type>::iterator z = zone.begin();
- for (list<string>::iterator i=key.begin();i!=key.end();++i)
- {
- DebugOut() << __SMALLFILE__ << ":" << __LINE__ <<
- "websocketsinkmanager setting " << (*i) << "to " << (*d) << "in zone " << (*z) << "\n";
- //(*i);
- sinkManager->setValue(wsi,(*i),(*d),(*z), id);
- //(*d);
- ++d;
- ++z;
- }
-
- }
- }
- }
- else if (name == "subscribe")
- {
- //Websocket wants to subscribe to an event, data.front();
- for (auto i=data.begin();i!=data.end();i++)
- {
- sinkManager->addSink(wsi,(*i),id);
- }
- }
- else if (name == "unsubscribe")
- {
- //Websocket wants to unsubscribe to an event, data.front();
- for (auto i=data.begin();i!=data.end();i++)
- {
- sinkManager->removeSink(wsi,(*i),id);
- }
- }
- else if (name == "getSupportedEventTypes")
- {
- //If data.front() dosen't contain a property name, return a list of properties supported.
- //if it does, then return the event types that particular property supports.
- string typessupported = "";
- if (data.size() == 0)
- {
- //Send what properties we support
- PropertyList foo = sinkManager->getSupportedProperties();
- PropertyList::const_iterator i=foo.cbegin();
- while (i != foo.cend())
- {
- if(i==foo.cbegin())
- typessupported.append("\"").append((*i)).append("\"");
- else
- typessupported.append(",\"").append((*i)).append("\"");
- i++;
- }
- }
- else
- {
- //Send what events a particular property supports
- PropertyList foo = sinkManager->getSupportedProperties();
- if (ListPlusPlus<VehicleProperty::Property>(&foo).contains(data.front()))
- {
- //sinkManager->addSingleShotSink(wsi,data.front(),id);
- typessupported = "\"get\",\"subscribe\",\"unsubscribe\",\"getSupportedEventTypes\"";
- }
- }
- stringstream s;
- string s2;
- s << "{\"type\":\"methodReply\",\"name\":\"getSupportedEventTypes\",\"data\":[" << typessupported << "],\"transactionid\":\"" << id << "\"}";
- string replystr = s.str();
- DebugOut() << __SMALLFILE__ << ":" << __LINE__ << " JSON Reply: " << replystr << "\n";
- //printf("Reply: %s\n",replystr.c_str());
- lwsWrite(wsi, replystr);
- }
- else
- {
- DebugOut(0)<<"Unknown method called."<<endl;
- }
- }
- }
-
-
-
-
- break;
- }
- case LWS_CALLBACK_ADD_POLL_FD:
- {
- //printf("Adding poll %i\n",sinkManager);
- DebugOut(5) << __SMALLFILE__ <<":"<< __LINE__ << "Adding poll" << endl;
- if (sinkManager != 0)
- {
- //sinkManager->addPoll((int)(long)user);
- sinkManager->addPoll(libwebsocket_get_socket_fd(wsi));
- }
- else
- {
- DebugOut(5) << "Error, invalid sink manager!!" << endl;
- }
- break;
- }
- case LWS_CALLBACK_DEL_POLL_FD:
- {
- sinkManager->removePoll(libwebsocket_get_socket_fd(wsi));
- break;
- }
- case LWS_CALLBACK_SET_MODE_POLL_FD:
- {
- //Set the poll mode
- break;
- }
- case LWS_CALLBACK_CLEAR_MODE_POLL_FD:
- {
- //Don't handle this yet.
- break;
- }
- default:
- {
- //printf("Unhandled callback: %i\n",reason);
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Unhandled callback:" << reason << "\n";
- break;
- }
- }
- return 0;
-}
-
-bool gioPollingFunc(GIOChannel *source, GIOCondition condition, gpointer data)
-{
- DebugOut(5) << "Polling..." << condition << endl;
-
- if(condition & G_IO_ERR)
- {
- DebugOut(0)<< __SMALLFILE__ <<":"<< __LINE__ <<" websocketsink polling error."<<endl;
- }
-
- if (condition & G_IO_HUP)
- {
- //Hang up. Returning false closes out the GIOChannel.
- //printf("Callback on G_IO_HUP\n");
- DebugOut(0)<<"socket hangup event..."<<endl;
- return false;
- }
-
- //This is the polling function. If it return false, glib will stop polling this FD.
- //printf("Polling...%i\n",condition);
-
- lws_tokens token;
- struct pollfd pollstruct;
- int newfd = g_io_channel_unix_get_fd(source);
- pollstruct.fd = newfd;
- pollstruct.events = condition;
- pollstruct.revents = condition;
- libwebsocket_service_fd(context,&pollstruct);
-
- return true;
-}
diff --git a/plugins/websocketsink/websocketsinkmanager.h b/plugins/websocketsink/websocketsinkmanager.h
deleted file mode 100644
index f7178bd1..00000000
--- a/plugins/websocketsink/websocketsinkmanager.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- Copyright (C) 2012 Intel Corporation
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef WEBSOCKETSINKMANAGER_H
-#define WEBSOCKETSINKMANAGER_H
-
-#include <abstractroutingengine.h>
-#include <abstractsink.h>
-#include "websocketsink.h"
-#include <gio/gio.h>
-#include <map>
-#include <libwebsockets.h>
-#include "debugout.h"
-#include <stdexcept>
-#include "sys/types.h"
-#include <stdlib.h>
-
-class WebSocketSinkManager: public AbstractSinkManager
-{
-public:
- WebSocketSinkManager(AbstractRoutingEngine* engine, map<string, string> config);
- void addSingleShotSink(libwebsocket* socket, VehicleProperty::Property property, Zone::Type zone, string id);
- void addSingleShotRangedSink(libwebsocket* socket, PropertyList properties,double start, double end, double seqstart,double seqend, string id);
- void addSink(libwebsocket* socket, VehicleProperty::Property property,string uuid);
- void disconnectAll(libwebsocket* socket);
- void removeSink(libwebsocket* socket,VehicleProperty::Property property,string uuid);
- void addPoll(int fd);
- void removePoll(int fd);
- void init();
- map<std::string, list<WebSocketSink*> > m_sinkMap;
- void setConfiguration(map<string, string> config);
- void setValue(libwebsocket* socket,VehicleProperty::Property property,string value, Zone::Type zone, string uuid);
- list<VehicleProperty::Property> getSupportedProperties();
-private:
- map<int,GIOChannel*> m_ioChannelMap;
- map<int,guint> m_ioSourceMap;
- AbstractRoutingEngine *m_engine;
- struct libwebsocket_protocols protocollist[2];
-};
-
-#endif // WEBSOCKETSINKMANAGER_H
diff --git a/plugins/websocketsourceplugin/CMakeLists.txt b/plugins/websocketsourceplugin/CMakeLists.txt
deleted file mode 100644
index dff8dec5..00000000
--- a/plugins/websocketsourceplugin/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-if(websocketold_plugin)
-
-include(CheckIncludeFiles)
-include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs})
-
-pkg_check_modules(websockets REQUIRED libwebsockets)
-
-set(websocketsourceplugin_headers websocketsource.h)
-set(websocketsourceplugin_sources websocketsource.cpp)
-add_library(websocketsourceplugin MODULE ${websocketsourceplugin_sources})
-set_target_properties(websocketsourceplugin PROPERTIES PREFIX "")
-target_link_libraries(websocketsourceplugin amb ${websockets_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib ${link_libraries})
-
-install(TARGETS websocketsourceplugin LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
-
-endif(websocketold_plugin)
diff --git a/plugins/websocketsourceplugin/websocketsource.cpp b/plugins/websocketsourceplugin/websocketsource.cpp
deleted file mode 100644
index 371ee0d1..00000000
--- a/plugins/websocketsourceplugin/websocketsource.cpp
+++ /dev/null
@@ -1,638 +0,0 @@
-/*
- Copyright (C) 2012 Intel Corporation
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-
-#include "websocketsource.h"
-#include <iostream>
-#include <boost/assert.hpp>
-#include <boost/lexical_cast.hpp>
-#include <glib.h>
-#include <sstream>
-#include <listplusplus.h>
-#include <timestamp.h>
-#include "uuidhelper.h"
-
-#include "debugout.h"
-#define __SMALLFILE__ std::string(__FILE__).substr(std::string(__FILE__).rfind("/")+1)
-libwebsocket_context *context = NULL;
-WebSocketSource *source;
-AbstractRoutingEngine *m_re;
-
-double oldTimestamp=0;
-double totalTime=0;
-double numUpdates=0;
-double averageLatency=0;
-
-static int callback_http_only(libwebsocket_context *context,struct libwebsocket *wsi,enum libwebsocket_callback_reasons reason,void *user, void *in, size_t len);
-static struct libwebsocket_protocols protocols[] = {
- {
- "http-only",
- callback_http_only,
- 0,
- 128,
- },
- { /* end of list */
- NULL,
- NULL,
- 0,
- 0
- }
-};
-
-//Called when a client connects, subscribes, or unsubscribes.
-void WebSocketSource::checkSubscriptions()
-{
- PropertyList notSupportedList;
- while (queuedRequests.size() > 0)
- {
- VehicleProperty::Property prop = queuedRequests.front();
- queuedRequests.pop_front();
- if (ListPlusPlus<VehicleProperty::Property>(&activeRequests).contains(prop))
- {
- return;
- }
- activeRequests.push_back(prop);
- stringstream s;
- ///TODO: fix transid here:
- s << "{\"type\":\"method\",\"name\":\"subscribe\",\"data\":[\"" << prop << "\"],\"transactionid\":\"" << "d293f670-f0b3-11e1-aff1-0800200c9a66" << "\"}";
-
- string replystr = s.str();
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Reply:" << replystr << "\n";
- //printf("Reply: %s\n",replystr.c_str());
-
- char *new_response = new char[LWS_SEND_BUFFER_PRE_PADDING + strlen(replystr.c_str()) + LWS_SEND_BUFFER_POST_PADDING];
- new_response+=LWS_SEND_BUFFER_PRE_PADDING;
- strcpy(new_response,replystr.c_str());
- if(clientsocket)
- libwebsocket_write(clientsocket, (unsigned char*)new_response, strlen(new_response), LWS_WRITE_TEXT);
- delete (char*)(new_response-LWS_SEND_BUFFER_PRE_PADDING);
- }
-}
-void WebSocketSource::setConfiguration(map<string, string> config)
-{
- //printf("WebSocketSource::setConfiguration has been called\n");
- std::string ip;
- int port;
- configuration = config;
- for (map<string,string>::iterator i=configuration.begin();i!=configuration.end();i++)
- {
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Incoming setting for WebSocketSource:" << (*i).first << ":" << (*i).second << "\n";
- //printf("Incoming setting: %s:%s\n",(*i).first.c_str(),(*i).second.c_str());
- if ((*i).first == "ip")
- {
- ip = (*i).second;
- }
- if ((*i).first == "port")
- {
- port = boost::lexical_cast<int>((*i).second);
- }
- if ((*i).first == "ssl")
- {
- if ((*i).second == "true")
- {
- m_sslEnabled = true;
- }
- else
- {
- m_sslEnabled = false;
- }
- }
- }
- //printf("Connecting to websocket server at %s port %i\n",ip.c_str(),port);
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Connecting to websocket server at" << ip << ":" << port << "\n";
- int sslval = 0;
- if (m_sslEnabled)
- {
- DebugOut(5) << "SSL ENABLED" << endl;
- sslval = 2;
- }
-
- clientsocket = libwebsocket_client_connect(context, ip.c_str(), port, sslval,"/", "localhost", "websocket",protocols[0].name, -1);
-
-
-}
-
-PropertyInfo WebSocketSource::getPropertyInfo(VehicleProperty::Property property)
-{
- return PropertyInfo::invalid();
-}
-
-bool gioPollingFunc(GIOChannel *source, GIOCondition condition, gpointer data)
-{
- //This is the polling function. If it return false, glib will stop polling this FD.
-
- oldTimestamp = amb::currentTime();
-
- struct pollfd pollstruct;
- int newfd = g_io_channel_unix_get_fd(source);
- pollstruct.fd = newfd;
- pollstruct.events = condition;
- pollstruct.revents = condition;
- libwebsocket_service_fd(context,&pollstruct);
- if (condition & G_IO_HUP)
- {
- //Hang up. Returning false closes out the GIOChannel.
- //printf("Callback on G_IO_HUP\n");
- return false;
- }
- if (condition & G_IO_IN)
- {
-
- }
- DebugOut() << "gioPollingFunc" << condition << endl;
-
- return true;
-}
-
-static int checkTimeouts(gpointer data)
-{
- WebSocketSource *src = (WebSocketSource*)data;
- for (auto i=src->uuidTimeoutMap.begin();i!= src->uuidTimeoutMap.end();i++)
- {
- if (src->uuidRangedReplyMap.find((*i).first) != src->uuidRangedReplyMap.end())
- {
- //A source exists!
- if (amb::currentTime() > (*i).second)
- {
- //We've reached timeout
- DebugOut() << "Timeout reached for request ID:" << (*i).first << "\n";
- src->uuidRangedReplyMap[(*i).first]->success = false;
- src->uuidRangedReplyMap[(*i).first]->completed(src->uuidRangedReplyMap[(*i).first]);
- src->uuidRangedReplyMap.erase((*i).first);
- src->uuidTimeoutMap.erase((*i).first);
- i--;
-
- if (src->uuidTimeoutMap.size() == 0)
- {
- return 0;
- }
-
- }
- else
- {
- //No timeout yet, keep waiting.
- }
- }
- else
- {
- //Reply has already come back, ignore and erase from list.
- src->uuidTimeoutMap.erase((*i).first);
- i--;
-
- if (src->uuidTimeoutMap.size() == 0)
- {
- return 0;
- }
- }
-
- }
- return 0;
-}
-
-static int callback_http_only(libwebsocket_context *context,struct libwebsocket *wsi,enum libwebsocket_callback_reasons reason,void *user, void *in, size_t len)
-{
- unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 4096 + LWS_SEND_BUFFER_POST_PADDING];
- int l;
- DebugOut() << __SMALLFILE__ << ":" << __LINE__ << reason << "callback_http_only" << endl;
- switch (reason)
- {
- case LWS_CALLBACK_CLOSED:
- //fprintf(stderr, "mirror: LWS_CALLBACK_CLOSED\n");
- //wsi_mirror = NULL;
- //printf("Connection closed!\n");
- break;
-
- //case LWS_CALLBACK_PROTOCOL_INIT:
- case LWS_CALLBACK_CLIENT_ESTABLISHED:
- {
- //This happens when a client initally connects. We need to request the support event types.
- source->clientConnected = true;
- source->checkSubscriptions();
- //printf("Incoming connection!\n");
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Incoming connection" << endl;
- stringstream s;
- s << "{\"type\":\"method\",\"name\":\"getSupportedEventTypes\",\"data\":[],\"transactionid\":\"" << "d293f670-f0b3-11e1-aff1-0800200c9a66" << "\"}";
-
- string replystr = s.str();
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Reply:" << replystr << "\n";
- char *new_response = new char[LWS_SEND_BUFFER_PRE_PADDING + strlen(replystr.c_str()) + LWS_SEND_BUFFER_POST_PADDING];
- new_response+=LWS_SEND_BUFFER_PRE_PADDING;
- strcpy(new_response,replystr.c_str());
- libwebsocket_write(wsi, (unsigned char*)(new_response), strlen(new_response), LWS_WRITE_TEXT);
- delete (char*)(new_response-LWS_SEND_BUFFER_PRE_PADDING);
-
- break;
- }
- case LWS_CALLBACK_CLIENT_RECEIVE:
- {
- double prejsonparsetime = (amb::currentTime() - oldTimestamp)*1000;
-
- DebugOut(2)<<"websocket source pre-json parse time: "<<prejsonparsetime<<endl;
-
- json_object *rootobject;
- json_tokener *tokener = json_tokener_new();
- enum json_tokener_error err;
- do
- {
- rootobject = json_tokener_parse_ex(tokener, (char*)in,len);
- } while ((err = json_tokener_get_error(tokener)) == json_tokener_continue);
- if (err != json_tokener_success)
- {
- fprintf(stderr, "Error: %s\n", json_tokener_error_desc(err));
- // Handle errors, as appropriate for your application.
- }
- if (tokener->char_offset < len) // XXX shouldn't access internal fields
- {
- // Handle extra characters after parsed object as desired.
- // e.g. issue an error, parse another object from that point, etc...
- }
- //Incoming JSON reqest.
-
-
- DebugOut(5)<<"source received: "<<string((char*)in)<<endl;
-
- json_object *typeobject= json_object_object_get(rootobject,"type");
- json_object *nameobject= json_object_object_get(rootobject,"name");
- json_object *transidobject= json_object_object_get(rootobject,"transactionid");
-
-
- string type = string(json_object_get_string(typeobject));
- string name = string(json_object_get_string(nameobject));
-
- string id;
-
- if (json_object_get_type(transidobject) == json_type_string)
- {
- id = json_object_get_string(transidobject);
- }
- else
- {
- stringstream strstr;
- strstr << json_object_get_int(transidobject);
- id = strstr.str();
- }
-
- list<pair<string,string> > pairdata;
- if (type == "valuechanged")
- {
- json_object *dataobject = json_object_object_get(rootobject,"data");
-
- json_object *valueobject = json_object_object_get(dataobject,"value");
- json_object *timestampobject = json_object_object_get(dataobject,"timestamp");
- json_object *sequenceobject= json_object_object_get(dataobject,"sequence");
-
- string value = string(json_object_get_string(valueobject));
- string timestamp = string(json_object_get_string(timestampobject));
- string sequence = string(json_object_get_string(sequenceobject));
- //printf("Value changed: %s, %s\n",name.c_str(),data.front().c_str());
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Value changed:" << name << value << endl;
- //Name should be a valid property
- // routingEngine->updateProperty(VehicleProperty::VehicleSpeed, velocity);
- //data.front()
- try
- {
- AbstractPropertyType* type = VehicleProperty::getPropertyTypeForPropertyNameValue(name,value);
- type->timestamp = boost::lexical_cast<double,std::string>(timestamp);
- type->sequence = boost::lexical_cast<double,std::string>(sequence);
- m_re->updateProperty(type, source->uuid());
- double currenttime = amb::currentTime();
-
- /** This is now the latency between when something is available to read on the socket, until
- * a property is about to be updated in AMB. This includes libwebsockets parsing and the
- * JSON parsing in this section.
- */
-
- DebugOut(2)<<"websocket parse latency: "<<(currenttime - oldTimestamp)*1000<<"ms"<<endl;
- DebugOut(2)<<"websocket network + parse latency: "<<(currenttime - type->timestamp)*1000<<"ms"<<endl;
- totalTime += (currenttime - oldTimestamp)*1000;
- numUpdates ++;
- averageLatency = totalTime / numUpdates;
-
- DebugOut(2)<<"Average parse latency: "<<averageLatency<<endl;
-
- delete type;
- }
- catch (exception ex)
- {
- //printf("Exception %s\n",ex.what());
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Exception:" << ex.what() << "\n";
- }
- json_object_put(valueobject);
- json_object_put(timestampobject);
- json_object_put(sequenceobject);
- json_object_put(dataobject);
- //printf("Done\n");
- /*if (name == "get")
- {
- if (data.size() > 0)
- {
- }
- }*/
- }
- else if (type == "methodReply")
- {
- json_object *dataobject = json_object_object_get(rootobject,"data");
- if (name == "getSupportedEventTypes")
- {
- //printf("Got supported events!\n");
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Got getSupportedEventTypes request"<<endl;
- PropertyList props;
- if (json_object_get_type(dataobject) == json_type_array)
- {
- array_list *dataarray = json_object_get_array(dataobject);
- for (int i=0;i<array_list_length(dataarray);i++)
- {
- json_object *arrayobj = (json_object*)array_list_get_idx(dataarray,i);
- props.push_back(string(json_object_get_string(arrayobj)));
- }
- //array_list_free(dataarray);
- }
- else
- {
- props.push_back(string(json_object_get_string(dataobject)));
- }
- source->setSupported(props);
- //m_re->updateSupported(m_supportedProperties,PropertyList());
- }
- else if (name == "getRanged")
- {
- std::list<AbstractPropertyType*> propertylist;
- array_list *dataarray = json_object_get_array(dataobject);
- for (int i=0;i<array_list_length(dataarray);i++)
- {
- json_object *arrayobj = (json_object*)array_list_get_idx(dataarray,i);
- json_object *keyobject = json_object_object_get(arrayobj,"name");
- json_object *valueobject = json_object_object_get(arrayobj,"value");
- json_object *timestampobject = json_object_object_get(arrayobj,"timestamp");
- json_object *sequenceobject = json_object_object_get(arrayobj,"sequence");
- std::string name = json_object_get_string(keyobject);
- std::string value = json_object_get_string(valueobject);
- std::string timestamp = json_object_get_string(timestampobject);
- std::string sequence = json_object_get_string(sequenceobject);
-
- ///TODO: we might only have to free the dataobject at the end instead of this:
-
- json_object_put(keyobject);
- json_object_put(valueobject);
- json_object_put(timestampobject);
- json_object_put(sequenceobject);
-
- AbstractPropertyType* type = VehicleProperty::getPropertyTypeForPropertyNameValue(name,value);
- propertylist.push_back(type);
- }
- //array_list_free(dataarray);
- if (source->uuidRangedReplyMap.find(id) != source->uuidRangedReplyMap.end())
- {
- source->uuidRangedReplyMap[id]->values = propertylist;
- source->uuidRangedReplyMap[id]->success = true;
- source->uuidRangedReplyMap[id]->completed(source->uuidRangedReplyMap[id]);
- source->uuidRangedReplyMap.erase(id);
- }
- else
- {
- DebugOut() << "getRanged methodReply has been recieved, without a request being in!. This is likely due to a request coming in after the timeout has elapsed.\n";
- }
- }
- else if (name == "get")
- {
-
- DebugOut() << __SMALLFILE__ << ":" << __LINE__ << "Got \"GET\" event:" << pairdata.size()<<endl;
- if (source->uuidReplyMap.find(id) != source->uuidReplyMap.end())
- {
- json_object *propertyobject = json_object_object_get(dataobject,"property");
- json_object *valueobject = json_object_object_get(dataobject,"value");
- json_object *timestampobject = json_object_object_get(dataobject,"timestamp");
- json_object *sequenceobject = json_object_object_get(dataobject,"sequence");
- std::string property = json_object_get_string(propertyobject);
- std::string value = json_object_get_string(valueobject);
- std::string timestamp = json_object_get_string(timestampobject);
- std::string sequence = json_object_get_string(sequenceobject);
- json_object_put(propertyobject);
- json_object_put(valueobject);
- json_object_put(timestampobject);
- json_object_put(sequenceobject);
-
- AbstractPropertyType* v = VehicleProperty::getPropertyTypeForPropertyNameValue(property,value);
- v->timestamp = boost::lexical_cast<double,std::string>(timestamp);
- v->sequence = boost::lexical_cast<double,std::string>(sequence);
- if (source->uuidReplyMap.find(id) != source->uuidReplyMap.end())
- {
- source->uuidReplyMap[id]->value = v;
- source->uuidReplyMap[id]->success = true;
- source->uuidReplyMap[id]->completed(source->uuidReplyMap[id]);
- source->uuidReplyMap.erase(id);
-
- }
- else
- {
- DebugOut() << "get methodReply has been recieved, without a request being in!. This is likely due to a request coming in after the timeout has elapsed.\n";
- }
-
- delete v;
- }
- else
- {
- DebugOut() << __SMALLFILE__ << ":" << __LINE__ << "GET Method Reply INVALID! Multiple properties detected, only single are supported!!!" << "\n";
- }
-
- //data will contain a property/value map.
- }
- json_object_put(dataobject);
- }
- json_object_put(rootobject);
-
- break;
-
- }
- case LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED:
- {
- //printf("Requested extension: %s\n",(char*)in);
- return 0;
- break;
- }
- case LWS_CALLBACK_ADD_POLL_FD:
- {
- DebugOut(5) << __SMALLFILE__ << ":" << __LINE__ << "Adding poll for websocket IO channel" << endl;
- //Add a FD to the poll list.
- GIOChannel *chan = g_io_channel_unix_new(libwebsocket_get_socket_fd(wsi));
-
- /// TODO: I changed this to be more consistent with the websocket sink end. it may not be correct. TEST
-
- g_io_add_watch(chan,GIOCondition(G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP),(GIOFunc)gioPollingFunc,0);
- g_io_channel_set_close_on_unref(chan,true);
- g_io_channel_unref(chan); //Pass ownership of the GIOChannel to the watch.
-
- break;
- }
- return 0;
- }
-}
-void WebSocketSource::setSupported(PropertyList list)
-{
- DebugOut() <<__SMALLFILE__ << ":" << __LINE__ <<"SET SUPPORTED"<<endl;
- m_supportedProperties = list;
- m_re->updateSupported(list,PropertyList(),this);
-}
-
-WebSocketSource::WebSocketSource(AbstractRoutingEngine *re, map<string, string> config) : AbstractSource(re, config)
-{
- m_sslEnabled = false;
- clientConnected = false;
- source = this;
- m_re = re;
- struct lws_context_creation_info info;
- memset(&info, 0, sizeof info);
- info.protocols = protocols;
- info.extensions = libwebsocket_get_internal_extensions();
- info.gid = -1;
- info.uid = -1;
- info.port = CONTEXT_PORT_NO_LISTEN;
- //std::string ssl_key_path = "/home/michael/.ssh/id_rsa";
- //info.ssl_ca_filepath = ssl_key_path.c_str();
-
- context = libwebsocket_create_context(&info);
- //context = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, NULL,protocols, libwebsocket_internal_extensions,NULL, NULL, -1, -1, 0);
-
- setConfiguration(config);
- re->setSupported(supported(), this);
-
- //printf("websocketsource loaded!!!\n");
- g_timeout_add(1000,checkTimeouts,this); //Do this once per second, check for functions that have timed out and reply with success = false;
-
-}
-PropertyList WebSocketSource::supported()
-{
- return m_supportedProperties;
-}
-
-int WebSocketSource::supportedOperations()
-{
- /// TODO: need to do this correctly based on what the host supports.
- return Get | Set | GetRanged;
-}
-
-const string WebSocketSource::uuid()
-{
- return "d293f670-f0b3-11e1-aff1-0800200c9a66";
-}
-
-void WebSocketSource::subscribeToPropertyChanges(VehicleProperty::Property property)
-{
- //printf("Subscribed to property: %s\n",property.c_str());
- queuedRequests.push_back(property);
- if (clientConnected)
- {
- checkSubscriptions();
- }
-}
-
-
-void WebSocketSource::unsubscribeToPropertyChanges(VehicleProperty::Property property)
-{
- removeRequests.push_back(property);
- if (clientConnected)
- {
- checkSubscriptions();
- }
-}
-
-
-void WebSocketSource::getPropertyAsync(AsyncPropertyReply *reply)
-{
- std::string uuid = amb::createUuid();
- uuidReplyMap[uuid] = reply;
- uuidTimeoutMap[uuid] = amb::currentTime() + 10.0; ///TODO: 10 second timeout, make this configurable?
- stringstream s;
-
- s << "{\"type\":\"method\",\"name\":\"get\",\"data\":[\"" << reply->property << "\"],\"transactionid\":\"" << uuid << "\"}";
- string replystr = s.str();
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Sending:" << replystr <<endl;
- //printf("Reply: %s\n",replystr.c_str());
- char *new_response = new char[LWS_SEND_BUFFER_PRE_PADDING + strlen(replystr.c_str()) + LWS_SEND_BUFFER_POST_PADDING];
- new_response+=LWS_SEND_BUFFER_PRE_PADDING;
- strcpy(new_response,replystr.c_str());
- if(clientsocket)
- libwebsocket_write(clientsocket, (unsigned char*)new_response, strlen(new_response), LWS_WRITE_TEXT);
- delete (char*)(new_response-LWS_SEND_BUFFER_PRE_PADDING);
-}
-
-void WebSocketSource::getRangePropertyAsync(AsyncRangePropertyReply *reply)
-{
- std::string uuid = amb::createUuid();
- uuidRangedReplyMap[uuid] = reply;
- uuidTimeoutMap[uuid] = amb::currentTime() + 60; ///TODO: 60 second timeout, make this configurable?
- stringstream s;
- s.precision(15);
- s << "{\"type\":\"method\",\"name\":\"getRanged\",\"data\": {";
-
- s << "\"properties\":[";
-
- for (auto itr = reply->properties.begin(); itr != reply->properties.end(); itr++)
- {
- std::string prop = *itr;
-
- if(itr != reply->properties.begin())
- {
- s<<",";
- }
-
- s<<"\""<<prop<<"\"";
- }
-
- s<<"],";
-
- s << "\"timeBegin\":\"" << reply->timeBegin << "\",";
- s << "\"timeEnd\":\"" << reply->timeEnd << "\",";
- s << "\"sequenceBegin\":\"" << reply->sequenceBegin<< "\",";
- s << "\"sequenceEnd\":\"" << reply->sequenceEnd << "\"}";
- s<< ",\"transactionid\":\"" << uuid << "\"}";
- string replystr = s.str();
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Reply:" << replystr <<endl;
- //printf("Reply: %s\n",replystr.c_str());
- char *new_response = new char[LWS_SEND_BUFFER_PRE_PADDING + strlen(replystr.c_str()) + LWS_SEND_BUFFER_POST_PADDING];
- new_response+=LWS_SEND_BUFFER_PRE_PADDING;
- strcpy(new_response,replystr.c_str());
- if(clientsocket)
- libwebsocket_write(clientsocket, (unsigned char*)new_response, strlen(new_response), LWS_WRITE_TEXT);
- delete (char*)(new_response-LWS_SEND_BUFFER_PRE_PADDING);
-}
-
-AsyncPropertyReply * WebSocketSource::setProperty( AsyncSetPropertyRequest request )
-{
- ///TODO: fill in
- AsyncPropertyReply* reply = new AsyncPropertyReply(request);
- reply->success = true;
- stringstream s;
- s << "{\"type\":\"method\",\"name\":\"set\",\"data\":[\"property\" : \"" << request.property << "\",\"value\" : \"" << request.value << "\"],\"transactionid\":\"" << "d293f670-f0b3-11e1-aff1-0800200c9a66" << "\"}";
- string replystr = s.str();
- DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Reply:" << replystr << "\n";
- //printf("Reply: %s\n",replystr.c_str());
- char *new_response = new char[LWS_SEND_BUFFER_PRE_PADDING + strlen(replystr.c_str()) + LWS_SEND_BUFFER_POST_PADDING];
- new_response+=LWS_SEND_BUFFER_PRE_PADDING;
- strcpy(new_response,replystr.c_str());
- libwebsocket_write(clientsocket, (unsigned char*)new_response, strlen(new_response), LWS_WRITE_TEXT);
- delete (char*)(new_response-LWS_SEND_BUFFER_PRE_PADDING);
- reply->completed(reply);
- return reply;
-}
-
-extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map<string, string> config)
-{
- return new WebSocketSource(routingengine, config);
-
-}
diff --git a/plugins/websocketsourceplugin/websocketsource.h b/plugins/websocketsourceplugin/websocketsource.h
deleted file mode 100644
index c44c7254..00000000
--- a/plugins/websocketsourceplugin/websocketsource.h
+++ /dev/null
@@ -1,69 +0,0 @@
-
-/*
-Copyright (C) 2012 Intel Corporation
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-
-#ifndef WEBSOCKETSOURCE_H
-#define WEBSOCKETSOURCE_H
-
-
-
-#include <abstractsource.h>
-#include <string>
-#include <libwebsockets.h>
-
-
-class WebSocketSource : public AbstractSource
-{
-
-public:
- WebSocketSource(AbstractRoutingEngine* re, std::map<std::string, std::string> config);
- const std::string uuid();
- void getPropertyAsync(AsyncPropertyReply *reply);
- void getRangePropertyAsync(AsyncRangePropertyReply *reply);
- AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
- bool m_sslEnabled;
- void subscribeToPropertyChanges(VehicleProperty::Property property);
- void unsubscribeToPropertyChanges(VehicleProperty::Property property);
- PropertyList supported();
-
- int supportedOperations();
-
- libwebsocket *clientsocket;
- PropertyList queuedRequests;
- bool clientConnected;
- void checkSubscriptions();
- PropertyList activeRequests;
- PropertyList removeRequests;
- void setSupported(PropertyList list);
- void supportedChanged(PropertyList) {}
- void setConfiguration(std::map<std::string, std::string> config);
- //map<VehicleProperty::Property,AsyncPropertyReply*> propertyReplyMap;
- //map<VehicleProperty::Property,AsyncRangePropertyReply*> rangedPropertyReplyMap;
- std::map<std::string,AsyncPropertyReply*> uuidReplyMap;
- std::map<std::string,double> uuidTimeoutMap;
- std::map<std::string,AsyncRangePropertyReply*> uuidRangedReplyMap;
-
- PropertyInfo getPropertyInfo(VehicleProperty::Property property);
-
-private:
- PropertyList m_supportedProperties;
-
-};
-
-#endif // WEBSOCKETSOURCE_H
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index e141b7b6..e54f797b 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,3 +1,12 @@
-set(amb_tests amb-get amb-set amb-get-history amb-listen gen-set)
+set(amb_tests ${CMAKE_CURRENT_BINARY_DIR}/amb-get ${CMAKE_CURRENT_BINARY_DIR}/amb-set
+ ${CMAKE_CURRENT_BINARY_DIR}/amb-get-history ${CMAKE_CURRENT_BINARY_DIR}/amb-listen
+ ${CMAKE_CURRENT_BINARY_DIR}/gen-set)
+
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/amb-get.py ${CMAKE_CURRENT_BINARY_DIR}/amb-get @ONLY)
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/amb-set.py ${CMAKE_CURRENT_BINARY_DIR}/amb-set @ONLY)
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/amb-get-history.py ${CMAKE_CURRENT_BINARY_DIR}/amb-get-history @ONLY)
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/amb-listen.py ${CMAKE_CURRENT_BINARY_DIR}/amb-listen @ONLY)
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/gen-set.py ${CMAKE_CURRENT_BINARY_DIR}/gen-set @ONLY)
+
install (PROGRAMS ${amb_tests} DESTINATION bin)
diff --git a/tests/amb-get-history b/tests/amb-get-history.py
index f934e0d8..f934e0d8 100755
--- a/tests/amb-get-history
+++ b/tests/amb-get-history.py
diff --git a/tests/amb-get b/tests/amb-get.py
index 4a70401b..4a70401b 100755
--- a/tests/amb-get
+++ b/tests/amb-get.py
diff --git a/tests/amb-listen b/tests/amb-listen.py
index 81ecfaca..81ecfaca 100755
--- a/tests/amb-listen
+++ b/tests/amb-listen.py
diff --git a/tests/amb-set b/tests/amb-set.py
index 19e25cf1..59d7b7fa 100755
--- a/tests/amb-set
+++ b/tests/amb-set.py
@@ -20,16 +20,20 @@ valueType = args.valueType
zone = int(args.zone)
realValue = 0
+
+print "valueType: " + valueType
+
if valueType == "boolean":
- realValue = value == "true"
+ realValue = value == "true"
elif valueType == "integer":
- realValue = int(value)
+ realValue = int(value)
elif valueType == "string":
- realValue = value
+ realValue = value
elif valueType == "double":
- realValue = double(value)
+ realValue = double(value)
elif valueType == "UInt16":
- realValue = dbus.UInt16(int(value))
+ print "can has UInt16!!!"
+ realValue = dbus.UInt16(value)
bus = dbus.SystemBus()
managerObject = bus.get_object("org.automotive.message.broker", "/");
diff --git a/tests/gen-set b/tests/gen-set.py
index 82f999c3..82f999c3 100755
--- a/tests/gen-set
+++ b/tests/gen-set.py
diff --git a/xwalk/CMakeLists.txt b/xwalk/CMakeLists.txt
index 01cbae07..fb96843f 100644
--- a/xwalk/CMakeLists.txt
+++ b/xwalk/CMakeLists.txt
@@ -2,15 +2,12 @@ if(xwalk_vehicle_extension)
pkg_check_modules(gio REQUIRED gio-2.0)
-set(vehicle_api_headers vehicle.h vehicle_instance.h vehicle_extension.h common/extension.h picojson.h common/utils.h common/virtual_fs.h
+set(vehicle_api_headers vehicle.h vehicle_instance.h vehicle_extension.h common/extension.h common/picojson.h common/utils.h common/virtual_fs.h
common/XW_Extension_EntryPoints.h common/XW_Extension.h common/XW_Permissions.h common/XW_Extension_Runtime.h common/XW_Extension_SyncMessage.h)
-set(vehicle_api_sources vehicle.cc vehicle_extension.cc vehicle_instance.cc common/extension.cc)
-
-
+set(vehicle_api_sources vehicle.cc vehicle_extension.cc vehicle_instance.cc common/extension.cc common/picojson.h)
include_directories(${include_dirs} ${CMAKE_CURRENT_SOURCE_DIR}/)
-
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/vehicle_api.cc
COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/generate_api.py ${CMAKE_CURRENT_SOURCE_DIR}/vehicle_api.js kSource_vehicle_api ${CMAKE_CURRENT_BINARY_DIR}/vehicle_api.cc )
diff --git a/xwalk/common/picojson.h b/xwalk/common/picojson.h
index 9f983197..93171e3f 100644
--- a/xwalk/common/picojson.h
+++ b/xwalk/common/picojson.h
@@ -1,16 +1,16 @@
/*
* Copyright 2009-2010 Cybozu Labs, Inc.
* Copyright 2011 Kazuho Oku
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY CYBOZU LABS, INC. ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
@@ -21,7 +21,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of Cybozu Labs, Inc.
@@ -43,155 +43,155 @@
#include <vector>
#ifdef _MSC_VER
- #define SNPRINTF _snprintf_s
- #pragma warning(push)
- #pragma warning(disable : 4244) // conversion from int to char
+ #define SNPRINTF _snprintf_s
+ #pragma warning(push)
+ #pragma warning(disable : 4244) // conversion from int to char
#else
- #define SNPRINTF snprintf
+ #define SNPRINTF snprintf
#endif
namespace picojson {
-
+
enum {
- null_type,
- boolean_type,
- number_type,
- string_type,
- array_type,
- object_type
+ null_type,
+ boolean_type,
+ number_type,
+ string_type,
+ array_type,
+ object_type
};
-
+
struct null {};
-
+
class value {
public:
- typedef std::vector<value> array;
- typedef std::map<std::string, value> object;
- union _storage {
- bool boolean_;
- double number_;
- std::string* string_;
- array* array_;
- object* object_;
- };
+ typedef std::vector<value> array;
+ typedef std::map<std::string, value> object;
+ union _storage {
+ bool boolean_;
+ double number_;
+ std::string* string_;
+ array* array_;
+ object* object_;
+ };
protected:
- int type_;
- _storage u_;
+ int type_;
+ _storage u_;
public:
- value();
- value(int type, bool);
- explicit value(bool b);
- explicit value(double n);
- explicit value(const std::string& s);
- explicit value(const array& a);
- explicit value(const object& o);
- explicit value(const char* s);
- value(const char* s, size_t len);
- ~value();
- value(const value& x);
- value& operator=(const value& x);
- void swap(value& x);
- template <typename T> bool is() const;
- template <typename T> const T& get() const;
- template <typename T> T& get();
- bool evaluate_as_boolean() const;
- const value& get(size_t idx) const;
- const value& get(const std::string& key) const;
- bool contains(size_t idx) const;
- bool contains(const std::string& key) const;
- std::string to_str() const;
- template <typename Iter> void serialize(Iter os) const;
- std::string serialize() const;
+ value();
+ value(int type, bool);
+ explicit value(bool b);
+ explicit value(double n);
+ explicit value(const std::string& s);
+ explicit value(const array& a);
+ explicit value(const object& o);
+ explicit value(const char* s);
+ value(const char* s, size_t len);
+ ~value();
+ value(const value& x);
+ value& operator=(const value& x);
+ void swap(value& x);
+ template <typename T> bool is() const;
+ template <typename T> const T& get() const;
+ template <typename T> T& get();
+ bool evaluate_as_boolean() const;
+ const value& get(size_t idx) const;
+ const value& get(const std::string& key) const;
+ bool contains(size_t idx) const;
+ bool contains(const std::string& key) const;
+ std::string to_str() const;
+ template <typename Iter> void serialize(Iter os) const;
+ std::string serialize() const;
private:
- template <typename T> value(const T*); // intentionally defined to block implicit conversion of pointer to bool
+ template <typename T> value(const T*); // intentionally defined to block implicit conversion of pointer to bool
};
-
+
typedef value::array array;
typedef value::object object;
-
+
inline value::value() : type_(null_type) {}
-
+
inline value::value(int type, bool) : type_(type) {
- switch (type) {
+ switch (type) {
#define INIT(p, v) case p##type: u_.p = v; break
- INIT(boolean_, false);
- INIT(number_, 0.0);
- INIT(string_, new std::string());
- INIT(array_, new array());
- INIT(object_, new object());
+ INIT(boolean_, false);
+ INIT(number_, 0.0);
+ INIT(string_, new std::string());
+ INIT(array_, new array());
+ INIT(object_, new object());
#undef INIT
- default: break;
- }
+ default: break;
+ }
}
-
+
inline value::value(bool b) : type_(boolean_type) {
- u_.boolean_ = b;
+ u_.boolean_ = b;
}
-
+
inline value::value(double n) : type_(number_type) {
- u_.number_ = n;
+ u_.number_ = n;
}
-
+
inline value::value(const std::string& s) : type_(string_type) {
- u_.string_ = new std::string(s);
+ u_.string_ = new std::string(s);
}
-
+
inline value::value(const array& a) : type_(array_type) {
- u_.array_ = new array(a);
+ u_.array_ = new array(a);
}
-
+
inline value::value(const object& o) : type_(object_type) {
- u_.object_ = new object(o);
+ u_.object_ = new object(o);
}
-
+
inline value::value(const char* s) : type_(string_type) {
- u_.string_ = new std::string(s);
+ u_.string_ = new std::string(s);
}
-
+
inline value::value(const char* s, size_t len) : type_(string_type) {
- u_.string_ = new std::string(s, len);
+ u_.string_ = new std::string(s, len);
}
-
+
inline value::~value() {
- switch (type_) {
+ switch (type_) {
#define DEINIT(p) case p##type: delete u_.p; break
- DEINIT(string_);
- DEINIT(array_);
- DEINIT(object_);
+ DEINIT(string_);
+ DEINIT(array_);
+ DEINIT(object_);
#undef DEINIT
- default: break;
- }
+ default: break;
+ }
}
-
+
inline value::value(const value& x) : type_(x.type_) {
- switch (type_) {
+ switch (type_) {
#define INIT(p, v) case p##type: u_.p = v; break
- INIT(string_, new std::string(*x.u_.string_));
- INIT(array_, new array(*x.u_.array_));
- INIT(object_, new object(*x.u_.object_));
+ INIT(string_, new std::string(*x.u_.string_));
+ INIT(array_, new array(*x.u_.array_));
+ INIT(object_, new object(*x.u_.object_));
#undef INIT
- default:
- u_ = x.u_;
- break;
- }
+ default:
+ u_ = x.u_;
+ break;
+ }
}
-
+
inline value& value::operator=(const value& x) {
- if (this != &x) {
- this->~value();
- new (this) value(x);
- }
- return *this;
+ if (this != &x) {
+ this->~value();
+ new (this) value(x);
+ }
+ return *this;
}
-
+
inline void value::swap(value& x) {
- std::swap(type_, x.type_);
- std::swap(u_, x.u_);
+ std::swap(type_, x.type_);
+ std::swap(u_, x.u_);
}
-
+
#define IS(ctype, jtype) \
template <> inline bool value::is<ctype>() const { \
- return type_ == jtype##_type; \
+ return type_ == jtype##_type; \
}
IS(null, null)
IS(bool, boolean)
@@ -201,17 +201,17 @@ namespace picojson {
IS(array, array)
IS(object, object)
#undef IS
-
+
#define GET(ctype, var) \
template <> inline const ctype& value::get<ctype>() const { \
- assert("type mismatch! call vis<type>() before get<type>()" \
+ assert("type mismatch! call vis<type>() before get<type>()" \
&& is<ctype>()); \
- return var; \
+ return var; \
} \
template <> inline ctype& value::get<ctype>() { \
- assert("type mismatch! call is<type>() before get<type>()" \
+ assert("type mismatch! call is<type>() before get<type>()" \
&& is<ctype>()); \
- return var; \
+ return var; \
}
GET(bool, u_.boolean_)
GET(double, u_.number_)
@@ -219,75 +219,84 @@ namespace picojson {
GET(array, *u_.array_)
GET(object, *u_.object_)
#undef GET
-
+
inline bool value::evaluate_as_boolean() const {
- switch (type_) {
- case null_type:
- return false;
- case boolean_type:
- return u_.boolean_;
- case number_type:
- return u_.number_ != 0;
- case string_type:
- return ! u_.string_->empty();
- default:
- return true;
- }
+ switch (type_) {
+ case null_type:
+ return false;
+ case boolean_type:
+ return u_.boolean_;
+ case number_type:
+ return u_.number_ != 0;
+ case string_type:
+ return ! u_.string_->empty();
+ default:
+ return true;
+ }
}
-
+
inline const value& value::get(size_t idx) const {
- static value s_null;
- assert(is<array>());
- return idx < u_.array_->size() ? (*u_.array_)[idx] : s_null;
+ static value s_null;
+ assert(is<array>());
+ return idx < u_.array_->size() ? (*u_.array_)[idx] : s_null;
}
inline const value& value::get(const std::string& key) const {
- static value s_null;
- assert(is<object>());
- object::const_iterator i = u_.object_->find(key);
- return i != u_.object_->end() ? i->second : s_null;
+ static value s_null;
+ assert(is<object>());
+ object::const_iterator i = u_.object_->find(key);
+ return i != u_.object_->end() ? i->second : s_null;
}
inline bool value::contains(size_t idx) const {
- assert(is<array>());
- return idx < u_.array_->size();
+ assert(is<array>());
+ return idx < u_.array_->size();
}
inline bool value::contains(const std::string& key) const {
- assert(is<object>());
- object::const_iterator i = u_.object_->find(key);
- return i != u_.object_->end();
+ assert(is<object>());
+ object::const_iterator i = u_.object_->find(key);
+ return i != u_.object_->end();
}
-
+
inline std::string value::to_str() const {
- switch (type_) {
- case null_type: return "null";
- case boolean_type: return u_.boolean_ ? "true" : "false";
- case number_type: {
- char buf[256];
- double tmp;
- SNPRINTF(buf, sizeof(buf), fabs(u_.number_) < (1ULL << 53) && modf(u_.number_, &tmp) == 0 ? "%.f" : "%.17g", u_.number_);
- return buf;
- }
- case string_type: return *u_.string_;
- case array_type: return "array";
- case object_type: return "object";
- default: assert(0);
+ switch (type_) {
+ case null_type: return "null";
+ case boolean_type: return u_.boolean_ ? "true" : "false";
+ case number_type: {
+ char buf[256];
+ double tmp;
+ SNPRINTF(buf, sizeof(buf), fabs(u_.number_) < (1ULL << 53) && modf(u_.number_, &tmp) == 0 ? "%.f" : "%.17g", u_.number_);
+ return buf;
+ }
+ case string_type: return *u_.string_;
+ case array_type: {
+ std::string output;
+ for(auto i : get<array>())
+ {
+ output+= i.to_str() + ",";
+ }
+ output = output.substr(0, output.length() - 1);
+ output = "["+output+"]";
+ return output;
+ }
+ case object_type: return "object";
+ default: assert(0);
#ifdef _MSC_VER
- __assume(0);
+ __assume(0);
#endif
- }
- return std::string();
+ }
+ return std::string();
}
-
+
template <typename Iter> void copy(const std::string& s, Iter oi) {
- std::copy(s.begin(), s.end(), oi);
+ std::copy(s.begin(), s.end(), oi);
}
-
+
template <typename Iter> void serialize_str(const std::string& s, Iter oi) {
- *oi++ = '"';
- for (std::string::const_iterator i = s.begin(); i != s.end(); ++i) {
- switch (*i) {
+ *oi++ = '"';
+ for (std::string::const_iterator i = s.begin(); i != s.end(); ++i) {
+ switch (*i) {
#define MAP(val, sym) case val: copy(sym, oi); break
MAP('"', "\\\"");
MAP('\\', "\\\\");
@@ -298,7 +307,7 @@ namespace picojson {
MAP('\r', "\\r");
MAP('\t', "\\t");
#undef MAP
- default:
+ default:
if ((unsigned char)*i < 0x20 || *i == 0x7f) {
char buf[7];
SNPRINTF(buf, sizeof(buf), "\\u%04x", *i & 0xff);
@@ -307,32 +316,32 @@ namespace picojson {
*oi++ = *i;
}
break;
- }
- }
- *oi++ = '"';
+ }
+ }
+ *oi++ = '"';
}
-
+
template <typename Iter> void value::serialize(Iter oi) const {
- switch (type_) {
- case string_type:
- serialize_str(*u_.string_, oi);
- break;
- case array_type: {
- *oi++ = '[';
- for (array::const_iterator i = u_.array_->begin();
- i != u_.array_->end();
- ++i) {
+ switch (type_) {
+ case string_type:
+ serialize_str(*u_.string_, oi);
+ break;
+ case array_type: {
+ *oi++ = '[';
+ for (array::const_iterator i = u_.array_->begin();
+ i != u_.array_->end();
+ ++i) {
if (i != u_.array_->begin()) {
*oi++ = ',';
}
i->serialize(oi);
- }
- *oi++ = ']';
- break;
- }
- case object_type: {
- *oi++ = '{';
- for (object::const_iterator i = u_.object_->begin();
+ }
+ *oi++ = ']';
+ break;
+ }
+ case object_type: {
+ *oi++ = '{';
+ for (object::const_iterator i = u_.object_->begin();
i != u_.object_->end();
++i) {
if (i != u_.object_->begin()) {
@@ -341,132 +350,132 @@ namespace picojson {
serialize_str(i->first, oi);
*oi++ = ':';
i->second.serialize(oi);
- }
- *oi++ = '}';
- break;
- }
- default:
- copy(to_str(), oi);
- break;
- }
+ }
+ *oi++ = '}';
+ break;
+ }
+ default:
+ copy(to_str(), oi);
+ break;
+ }
}
-
+
inline std::string value::serialize() const {
- std::string s;
- serialize(std::back_inserter(s));
- return s;
+ std::string s;
+ serialize(std::back_inserter(s));
+ return s;
}
-
+
template <typename Iter> class input {
protected:
- Iter cur_, end_;
- int last_ch_;
- bool ungot_;
- int line_;
+ Iter cur_, end_;
+ int last_ch_;
+ bool ungot_;
+ int line_;
public:
- input(const Iter& first, const Iter& last) : cur_(first), end_(last), last_ch_(-1), ungot_(false), line_(1) {}
- int getc() {
- if (ungot_) {
+ input(const Iter& first, const Iter& last) : cur_(first), end_(last), last_ch_(-1), ungot_(false), line_(1) {}
+ int getc() {
+ if (ungot_) {
ungot_ = false;
return last_ch_;
- }
- if (cur_ == end_) {
+ }
+ if (cur_ == end_) {
last_ch_ = -1;
return -1;
- }
- if (last_ch_ == '\n') {
+ }
+ if (last_ch_ == '\n') {
line_++;
- }
- last_ch_ = *cur_++ & 0xff;
- return last_ch_;
- }
- void ungetc() {
- if (last_ch_ != -1) {
+ }
+ last_ch_ = *cur_++ & 0xff;
+ return last_ch_;
+ }
+ void ungetc() {
+ if (last_ch_ != -1) {
assert(! ungot_);
ungot_ = true;
- }
- }
- Iter cur() const { return cur_; }
- int line() const { return line_; }
- void skip_ws() {
- while (1) {
+ }
+ }
+ Iter cur() const { return cur_; }
+ int line() const { return line_; }
+ void skip_ws() {
+ while (1) {
int ch = getc();
if (! (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r')) {
ungetc();
break;
}
- }
- }
- bool expect(int expect) {
- skip_ws();
- if (getc() != expect) {
+ }
+ }
+ bool expect(int expect) {
+ skip_ws();
+ if (getc() != expect) {
ungetc();
return false;
- }
- return true;
- }
- bool match(const std::string& pattern) {
- for (std::string::const_iterator pi(pattern.begin());
+ }
+ return true;
+ }
+ bool match(const std::string& pattern) {
+ for (std::string::const_iterator pi(pattern.begin());
pi != pattern.end();
++pi) {
if (getc() != *pi) {
ungetc();
return false;
}
- }
- return true;
- }
+ }
+ return true;
+ }
};
-
+
template<typename Iter> inline int _parse_quadhex(input<Iter> &in) {
- int uni_ch = 0, hex;
- for (int i = 0; i < 4; i++) {
- if ((hex = in.getc()) == -1) {
+ int uni_ch = 0, hex;
+ for (int i = 0; i < 4; i++) {
+ if ((hex = in.getc()) == -1) {
return -1;
- }
- if ('0' <= hex && hex <= '9') {
+ }
+ if ('0' <= hex && hex <= '9') {
hex -= '0';
- } else if ('A' <= hex && hex <= 'F') {
+ } else if ('A' <= hex && hex <= 'F') {
hex -= 'A' - 0xa;
- } else if ('a' <= hex && hex <= 'f') {
+ } else if ('a' <= hex && hex <= 'f') {
hex -= 'a' - 0xa;
- } else {
+ } else {
in.ungetc();
return -1;
- }
- uni_ch = uni_ch * 16 + hex;
- }
- return uni_ch;
+ }
+ uni_ch = uni_ch * 16 + hex;
+ }
+ return uni_ch;
}
-
+
template<typename String, typename Iter> inline bool _parse_codepoint(String& out, input<Iter>& in) {
- int uni_ch;
- if ((uni_ch = _parse_quadhex(in)) == -1) {
- return false;
- }
- if (0xd800 <= uni_ch && uni_ch <= 0xdfff) {
- if (0xdc00 <= uni_ch) {
+ int uni_ch;
+ if ((uni_ch = _parse_quadhex(in)) == -1) {
+ return false;
+ }
+ if (0xd800 <= uni_ch && uni_ch <= 0xdfff) {
+ if (0xdc00 <= uni_ch) {
// a second 16-bit of a surrogate pair appeared
return false;
- }
- // first 16-bit of surrogate pair, get the next one
- if (in.getc() != '\\' || in.getc() != 'u') {
+ }
+ // first 16-bit of surrogate pair, get the next one
+ if (in.getc() != '\\' || in.getc() != 'u') {
in.ungetc();
return false;
- }
- int second = _parse_quadhex(in);
- if (! (0xdc00 <= second && second <= 0xdfff)) {
+ }
+ int second = _parse_quadhex(in);
+ if (! (0xdc00 <= second && second <= 0xdfff)) {
return false;
- }
- uni_ch = ((uni_ch - 0xd800) << 10) | ((second - 0xdc00) & 0x3ff);
- uni_ch += 0x10000;
- }
- if (uni_ch < 0x80) {
- out.push_back(uni_ch);
- } else {
- if (uni_ch < 0x800) {
+ }
+ uni_ch = ((uni_ch - 0xd800) << 10) | ((second - 0xdc00) & 0x3ff);
+ uni_ch += 0x10000;
+ }
+ if (uni_ch < 0x80) {
+ out.push_back(uni_ch);
+ } else {
+ if (uni_ch < 0x800) {
out.push_back(0xc0 | (uni_ch >> 6));
- } else {
+ } else {
if (uni_ch < 0x10000) {
out.push_back(0xe0 | (uni_ch >> 12));
} else {
@@ -474,21 +483,21 @@ namespace picojson {
out.push_back(0x80 | ((uni_ch >> 12) & 0x3f));
}
out.push_back(0x80 | ((uni_ch >> 6) & 0x3f));
- }
- out.push_back(0x80 | (uni_ch & 0x3f));
- }
- return true;
+ }
+ out.push_back(0x80 | (uni_ch & 0x3f));
+ }
+ return true;
}
-
+
template<typename String, typename Iter> inline bool _parse_string(String& out, input<Iter>& in) {
- while (1) {
- int ch = in.getc();
- if (ch < ' ') {
+ while (1) {
+ int ch = in.getc();
+ if (ch < ' ') {
in.ungetc();
return false;
- } else if (ch == '"') {
+ } else if (ch == '"') {
return true;
- } else if (ch == '\\') {
+ } else if (ch == '\\') {
if ((ch = in.getc()) == -1) {
return false;
}
@@ -505,96 +514,96 @@ namespace picojson {
#undef MAP
case 'u':
if (! _parse_codepoint(out, in)) {
- return false;
+ return false;
}
break;
default:
return false;
}
- } else {
+ } else {
out.push_back(ch);
- }
- }
- return false;
+ }
+ }
+ return false;
}
-
+
template <typename Context, typename Iter> inline bool _parse_array(Context& ctx, input<Iter>& in) {
- if (! ctx.parse_array_start()) {
- return false;
- }
- if (in.expect(']')) {
- return true;
- }
- size_t idx = 0;
- do {
- if (! ctx.parse_array_item(in, idx)) {
+ if (! ctx.parse_array_start()) {
+ return false;
+ }
+ if (in.expect(']')) {
+ return true;
+ }
+ size_t idx = 0;
+ do {
+ if (! ctx.parse_array_item(in, idx)) {
return false;
- }
- idx++;
- } while (in.expect(','));
- return in.expect(']');
+ }
+ idx++;
+ } while (in.expect(','));
+ return in.expect(']');
}
-
+
template <typename Context, typename Iter> inline bool _parse_object(Context& ctx, input<Iter>& in) {
- if (! ctx.parse_object_start()) {
- return false;
- }
- if (in.expect('}')) {
- return true;
- }
- do {
- std::string key;
- if (! in.expect('"')
+ if (! ctx.parse_object_start()) {
+ return false;
+ }
+ if (in.expect('}')) {
+ return true;
+ }
+ do {
+ std::string key;
+ if (! in.expect('"')
|| ! _parse_string(key, in)
|| ! in.expect(':')) {
return false;
- }
- if (! ctx.parse_object_item(in, key)) {
+ }
+ if (! ctx.parse_object_item(in, key)) {
return false;
- }
- } while (in.expect(','));
- return in.expect('}');
+ }
+ } while (in.expect(','));
+ return in.expect('}');
}
-
+
template <typename Iter> inline bool _parse_number(double& out, input<Iter>& in) {
- std::string num_str;
- while (1) {
- int ch = in.getc();
- if (('0' <= ch && ch <= '9') || ch == '+' || ch == '-' || ch == '.'
+ std::string num_str;
+ while (1) {
+ int ch = in.getc();
+ if (('0' <= ch && ch <= '9') || ch == '+' || ch == '-' || ch == '.'
|| ch == 'e' || ch == 'E') {
num_str.push_back(ch);
- } else {
+ } else {
in.ungetc();
break;
- }
- }
- char* endp;
- out = strtod(num_str.c_str(), &endp);
- return endp == num_str.c_str() + num_str.size();
+ }
+ }
+ char* endp;
+ out = strtod(num_str.c_str(), &endp);
+ return endp == num_str.c_str() + num_str.size();
}
-
+
template <typename Context, typename Iter> inline bool _parse(Context& ctx, input<Iter>& in) {
- in.skip_ws();
- int ch = in.getc();
- switch (ch) {
+ in.skip_ws();
+ int ch = in.getc();
+ switch (ch) {
#define IS(ch, text, op) case ch: \
- if (in.match(text) && op) { \
+ if (in.match(text) && op) { \
return true; \
- } else { \
+ } else { \
return false; \
- }
- IS('n', "ull", ctx.set_null());
- IS('f', "alse", ctx.set_bool(false));
- IS('t', "rue", ctx.set_bool(true));
+ }
+ IS('n', "ull", ctx.set_null());
+ IS('f', "alse", ctx.set_bool(false));
+ IS('t', "rue", ctx.set_bool(true));
#undef IS
- case '"':
- return ctx.parse_string(in);
- case '[':
- return _parse_array(ctx, in);
- case '{':
- return _parse_object(ctx, in);
- default:
- if (('0' <= ch && ch <= '9') || ch == '-') {
+ case '"':
+ return ctx.parse_string(in);
+ case '[':
+ return _parse_array(ctx, in);
+ case '{':
+ return _parse_object(ctx, in);
+ default:
+ if (('0' <= ch && ch <= '9') || ch == '-') {
in.ungetc();
double f;
if (_parse_number(f, in)) {
@@ -603,180 +612,180 @@ namespace picojson {
} else {
return false;
}
- }
- break;
- }
- in.ungetc();
- return false;
+ }
+ break;
+ }
+ in.ungetc();
+ return false;
}
-
+
class deny_parse_context {
public:
- bool set_null() { return false; }
- bool set_bool(bool) { return false; }
- bool set_number(double) { return false; }
- template <typename Iter> bool parse_string(input<Iter>&) { return false; }
- bool parse_array_start() { return false; }
- template <typename Iter> bool parse_array_item(input<Iter>&, size_t) {
- return false;
- }
- bool parse_object_start() { return false; }
- template <typename Iter> bool parse_object_item(input<Iter>&, const std::string&) {
- return false;
- }
+ bool set_null() { return false; }
+ bool set_bool(bool) { return false; }
+ bool set_number(double) { return false; }
+ template <typename Iter> bool parse_string(input<Iter>&) { return false; }
+ bool parse_array_start() { return false; }
+ template <typename Iter> bool parse_array_item(input<Iter>&, size_t) {
+ return false;
+ }
+ bool parse_object_start() { return false; }
+ template <typename Iter> bool parse_object_item(input<Iter>&, const std::string&) {
+ return false;
+ }
};
-
+
class default_parse_context {
protected:
- value* out_;
+ value* out_;
public:
- default_parse_context(value* out) : out_(out) {}
- bool set_null() {
- *out_ = value();
- return true;
- }
- bool set_bool(bool b) {
- *out_ = value(b);
- return true;
- }
- bool set_number(double f) {
- *out_ = value(f);
- return true;
- }
- template<typename Iter> bool parse_string(input<Iter>& in) {
- *out_ = value(string_type, false);
- return _parse_string(out_->get<std::string>(), in);
- }
- bool parse_array_start() {
- *out_ = value(array_type, false);
- return true;
- }
- template <typename Iter> bool parse_array_item(input<Iter>& in, size_t) {
- array& a = out_->get<array>();
- a.push_back(value());
- default_parse_context ctx(&a.back());
- return _parse(ctx, in);
- }
- bool parse_object_start() {
- *out_ = value(object_type, false);
- return true;
- }
- template <typename Iter> bool parse_object_item(input<Iter>& in, const std::string& key) {
- object& o = out_->get<object>();
- default_parse_context ctx(&o[key]);
- return _parse(ctx, in);
- }
+ default_parse_context(value* out) : out_(out) {}
+ bool set_null() {
+ *out_ = value();
+ return true;
+ }
+ bool set_bool(bool b) {
+ *out_ = value(b);
+ return true;
+ }
+ bool set_number(double f) {
+ *out_ = value(f);
+ return true;
+ }
+ template<typename Iter> bool parse_string(input<Iter>& in) {
+ *out_ = value(string_type, false);
+ return _parse_string(out_->get<std::string>(), in);
+ }
+ bool parse_array_start() {
+ *out_ = value(array_type, false);
+ return true;
+ }
+ template <typename Iter> bool parse_array_item(input<Iter>& in, size_t) {
+ array& a = out_->get<array>();
+ a.push_back(value());
+ default_parse_context ctx(&a.back());
+ return _parse(ctx, in);
+ }
+ bool parse_object_start() {
+ *out_ = value(object_type, false);
+ return true;
+ }
+ template <typename Iter> bool parse_object_item(input<Iter>& in, const std::string& key) {
+ object& o = out_->get<object>();
+ default_parse_context ctx(&o[key]);
+ return _parse(ctx, in);
+ }
private:
- default_parse_context(const default_parse_context&);
- default_parse_context& operator=(const default_parse_context&);
+ default_parse_context(const default_parse_context&);
+ default_parse_context& operator=(const default_parse_context&);
};
class null_parse_context {
public:
- struct dummy_str {
- void push_back(int) {}
- };
+ struct dummy_str {
+ void push_back(int) {}
+ };
public:
- null_parse_context() {}
- bool set_null() { return true; }
- bool set_bool(bool) { return true; }
- bool set_number(double) { return true; }
- template <typename Iter> bool parse_string(input<Iter>& in) {
- dummy_str s;
- return _parse_string(s, in);
- }
- bool parse_array_start() { return true; }
- template <typename Iter> bool parse_array_item(input<Iter>& in, size_t) {
- return _parse(*this, in);
- }
- bool parse_object_start() { return true; }
- template <typename Iter> bool parse_object_item(input<Iter>& in, const std::string&) {
- return _parse(*this, in);
- }
+ null_parse_context() {}
+ bool set_null() { return true; }
+ bool set_bool(bool) { return true; }
+ bool set_number(double) { return true; }
+ template <typename Iter> bool parse_string(input<Iter>& in) {
+ dummy_str s;
+ return _parse_string(s, in);
+ }
+ bool parse_array_start() { return true; }
+ template <typename Iter> bool parse_array_item(input<Iter>& in, size_t) {
+ return _parse(*this, in);
+ }
+ bool parse_object_start() { return true; }
+ template <typename Iter> bool parse_object_item(input<Iter>& in, const std::string&) {
+ return _parse(*this, in);
+ }
private:
- null_parse_context(const null_parse_context&);
- null_parse_context& operator=(const null_parse_context&);
+ null_parse_context(const null_parse_context&);
+ null_parse_context& operator=(const null_parse_context&);
};
-
+
// obsolete, use the version below
template <typename Iter> inline std::string parse(value& out, Iter& pos, const Iter& last) {
- std::string err;
- pos = parse(out, pos, last, &err);
- return err;
+ std::string err;
+ pos = parse(out, pos, last, &err);
+ return err;
}
-
+
template <typename Context, typename Iter> inline Iter _parse(Context& ctx, const Iter& first, const Iter& last, std::string* err) {
- input<Iter> in(first, last);
- if (! _parse(ctx, in) && err != NULL) {
- char buf[64];
- SNPRINTF(buf, sizeof(buf), "syntax error at line %d near: ", in.line());
- *err = buf;
- while (1) {
+ input<Iter> in(first, last);
+ if (! _parse(ctx, in) && err != NULL) {
+ char buf[64];
+ SNPRINTF(buf, sizeof(buf), "syntax error at line %d near: ", in.line());
+ *err = buf;
+ while (1) {
int ch = in.getc();
if (ch == -1 || ch == '\n') {
break;
} else if (ch >= ' ') {
err->push_back(ch);
}
- }
- }
- return in.cur();
+ }
+ }
+ return in.cur();
}
-
+
template <typename Iter> inline Iter parse(value& out, const Iter& first, const Iter& last, std::string* err) {
- default_parse_context ctx(&out);
- return _parse(ctx, first, last, err);
+ default_parse_context ctx(&out);
+ return _parse(ctx, first, last, err);
}
-
+
inline std::string parse(value& out, std::istream& is) {
- std::string err;
- parse(out, std::istreambuf_iterator<char>(is.rdbuf()),
+ std::string err;
+ parse(out, std::istreambuf_iterator<char>(is.rdbuf()),
std::istreambuf_iterator<char>(), &err);
- return err;
+ return err;
}
-
+
template <typename T> struct last_error_t {
- static std::string s;
+ static std::string s;
};
template <typename T> std::string last_error_t<T>::s;
-
+
inline void set_last_error(const std::string& s) {
- last_error_t<bool>::s = s;
+ last_error_t<bool>::s = s;
}
-
+
inline const std::string& get_last_error() {
- return last_error_t<bool>::s;
+ return last_error_t<bool>::s;
}
inline bool operator==(const value& x, const value& y) {
- if (x.is<null>())
- return y.is<null>();
+ if (x.is<null>())
+ return y.is<null>();
#define PICOJSON_CMP(type) \
- if (x.is<type>()) \
- return y.is<type>() && x.get<type>() == y.get<type>()
- PICOJSON_CMP(bool);
- PICOJSON_CMP(double);
- PICOJSON_CMP(std::string);
- PICOJSON_CMP(array);
- PICOJSON_CMP(object);
+ if (x.is<type>()) \
+ return y.is<type>() && x.get<type>() == y.get<type>()
+ PICOJSON_CMP(bool);
+ PICOJSON_CMP(double);
+ PICOJSON_CMP(std::string);
+ PICOJSON_CMP(array);
+ PICOJSON_CMP(object);
#undef PICOJSON_CMP
- assert(0);
+ assert(0);
#ifdef _MSC_VER
- __assume(0);
+ __assume(0);
#endif
- return false;
+ return false;
}
-
+
inline bool operator!=(const value& x, const value& y) {
- return ! (x == y);
+ return ! (x == y);
}
}
namespace std {
template<> inline void swap(picojson::value& x, picojson::value& y)
- {
- x.swap(y);
- }
+ {
+ x.swap(y);
+ }
}
inline std::istream& operator>>(std::istream& is, picojson::value& x)
@@ -784,8 +793,8 @@ inline std::istream& operator>>(std::istream& is, picojson::value& x)
picojson::set_last_error(std::string());
std::string err = picojson::parse(x, is);
if (! err.empty()) {
- picojson::set_last_error(err);
- is.setstate(std::ios::failbit);
+ picojson::set_last_error(err);
+ is.setstate(std::ios::failbit);
}
return is;
}
@@ -796,17 +805,17 @@ inline std::ostream& operator<<(std::ostream& os, const picojson::value& x)
return os;
}
#ifdef _MSC_VER
- #pragma warning(pop)
+ #pragma warning(pop)
#endif
#endif
#ifdef TEST_PICOJSON
#ifdef _MSC_VER
- #pragma warning(disable : 4127) // conditional expression is constant
+ #pragma warning(disable : 4127) // conditional expression is constant
#endif
using namespace std;
-
+
static void plan(int num)
{
printf("1..%d\n", num);
@@ -818,16 +827,16 @@ static void ok(bool b, const char* name = "")
{
static int n = 1;
if (! b)
- success = false;
+ success = false;
printf("%s %d - %s\n", b ? "ok" : "ng", n++, name);
}
template <typename T> void is(const T& x, const T& y, const char* name = "")
{
if (x == y) {
- ok(true, name);
+ ok(true, name);
} else {
- ok(false, name);
+ ok(false, name);
}
}
@@ -842,8 +851,8 @@ int main(void)
// constructors
#define TEST(expr, expected) \
- is(picojson::value expr .serialize(), string(expected), "picojson::value" #expr)
-
+ is(picojson::value expr .serialize(), string(expected), "picojson::value" #expr)
+
TEST( (true), "true");
TEST( (false), "false");
TEST( (42.0), "42");
@@ -852,34 +861,34 @@ int main(void)
TEST( ("hello", 4), "\"hell\"");
{
- double a = 1;
- for (int i = 0; i < 1024; i++) {
- picojson::value vi(a);
- std::stringstream ss;
- ss << vi;
- picojson::value vo;
- ss >> vo;
- double b = vo.get<double>();
- if ((i < 53 && a != b) || fabs(a - b) / b > 1e-8) {
- printf("ng i=%d a=%.18e b=%.18e\n", i, a, b);
- }
- a *= 2;
- }
+ double a = 1;
+ for (int i = 0; i < 1024; i++) {
+ picojson::value vi(a);
+ std::stringstream ss;
+ ss << vi;
+ picojson::value vo;
+ ss >> vo;
+ double b = vo.get<double>();
+ if ((i < 53 && a != b) || fabs(a - b) / b > 1e-8) {
+ printf("ng i=%d a=%.18e b=%.18e\n", i, a, b);
+ }
+ a *= 2;
+ }
}
-
+
#undef TEST
-
+
#define TEST(in, type, cmp, serialize_test) { \
- picojson::value v; \
- const char* s = in; \
- string err = picojson::parse(v, s, s + strlen(s)); \
- ok(err.empty(), in " no error"); \
- ok(v.is<type>(), in " check type"); \
- is<type>(v.get<type>(), cmp, in " correct output"); \
- is(*s, '\0', in " read to eof"); \
- if (serialize_test) { \
- is(v.serialize(), string(in), in " serialize"); \
- } \
+ picojson::value v; \
+ const char* s = in; \
+ string err = picojson::parse(v, s, s + strlen(s)); \
+ ok(err.empty(), in " no error"); \
+ ok(v.is<type>(), in " check type"); \
+ is<type>(v.get<type>(), cmp, in " correct output"); \
+ is(*s, '\0', in " read to eof"); \
+ if (serialize_test) { \
+ is(v.serialize(), string(in), in " serialize"); \
+ } \
}
TEST("false", bool, false, true);
TEST("true", bool, true, true);
@@ -887,150 +896,150 @@ int main(void)
TEST("1.7976931348623157e+308", double, DBL_MAX, false);
TEST("\"hello\"", string, string("hello"), true);
TEST("\"\\\"\\\\\\/\\b\\f\\n\\r\\t\"", string, string("\"\\/\b\f\n\r\t"),
- true);
+ true);
TEST("\"\\u0061\\u30af\\u30ea\\u30b9\"", string,
- string("a\xe3\x82\xaf\xe3\x83\xaa\xe3\x82\xb9"), false);
+ string("a\xe3\x82\xaf\xe3\x83\xaa\xe3\x82\xb9"), false);
TEST("\"\\ud840\\udc0b\"", string, string("\xf0\xa0\x80\x8b"), false);
#undef TEST
#define TEST(type, expr) { \
- picojson::value v; \
- const char *s = expr; \
- string err = picojson::parse(v, s, s + strlen(s)); \
- ok(err.empty(), "empty " #type " no error"); \
- ok(v.is<picojson::type>(), "empty " #type " check type"); \
- ok(v.get<picojson::type>().empty(), "check " #type " array size"); \
+ picojson::value v; \
+ const char *s = expr; \
+ string err = picojson::parse(v, s, s + strlen(s)); \
+ ok(err.empty(), "empty " #type " no error"); \
+ ok(v.is<picojson::type>(), "empty " #type " check type"); \
+ ok(v.get<picojson::type>().empty(), "check " #type " array size"); \
}
TEST(array, "[]");
TEST(object, "{}");
#undef TEST
-
+
{
- picojson::value v;
- const char *s = "[1,true,\"hello\"]";
- string err = picojson::parse(v, s, s + strlen(s));
- ok(err.empty(), "array no error");
- ok(v.is<picojson::array>(), "array check type");
- is(v.get<picojson::array>().size(), size_t(3), "check array size");
- ok(v.contains(0), "check contains array[0]");
- ok(v.get(0).is<double>(), "check array[0] type");
- is(v.get(0).get<double>(), 1.0, "check array[0] value");
- ok(v.contains(1), "check contains array[1]");
- ok(v.get(1).is<bool>(), "check array[1] type");
- ok(v.get(1).get<bool>(), "check array[1] value");
- ok(v.contains(2), "check contains array[2]");
- ok(v.get(2).is<string>(), "check array[2] type");
- is(v.get(2).get<string>(), string("hello"), "check array[2] value");
- ok(!v.contains(3), "check not contains array[3]");
+ picojson::value v;
+ const char *s = "[1,true,\"hello\"]";
+ string err = picojson::parse(v, s, s + strlen(s));
+ ok(err.empty(), "array no error");
+ ok(v.is<picojson::array>(), "array check type");
+ is(v.get<picojson::array>().size(), size_t(3), "check array size");
+ ok(v.contains(0), "check contains array[0]");
+ ok(v.get(0).is<double>(), "check array[0] type");
+ is(v.get(0).get<double>(), 1.0, "check array[0] value");
+ ok(v.contains(1), "check contains array[1]");
+ ok(v.get(1).is<bool>(), "check array[1] type");
+ ok(v.get(1).get<bool>(), "check array[1] value");
+ ok(v.contains(2), "check contains array[2]");
+ ok(v.get(2).is<string>(), "check array[2] type");
+ is(v.get(2).get<string>(), string("hello"), "check array[2] value");
+ ok(!v.contains(3), "check not contains array[3]");
}
-
+
{
- picojson::value v;
- const char *s = "{ \"a\": true }";
- string err = picojson::parse(v, s, s + strlen(s));
- ok(err.empty(), "object no error");
- ok(v.is<picojson::object>(), "object check type");
- is(v.get<picojson::object>().size(), size_t(1), "check object size");
- ok(v.contains("a"), "check contains property");
- ok(v.get("a").is<bool>(), "check bool property exists");
- is(v.get("a").get<bool>(), true, "check bool property value");
- is(v.serialize(), string("{\"a\":true}"), "serialize object");
- ok(!v.contains("z"), "check not contains property");
+ picojson::value v;
+ const char *s = "{ \"a\": true }";
+ string err = picojson::parse(v, s, s + strlen(s));
+ ok(err.empty(), "object no error");
+ ok(v.is<picojson::object>(), "object check type");
+ is(v.get<picojson::object>().size(), size_t(1), "check object size");
+ ok(v.contains("a"), "check contains property");
+ ok(v.get("a").is<bool>(), "check bool property exists");
+ is(v.get("a").get<bool>(), true, "check bool property value");
+ is(v.serialize(), string("{\"a\":true}"), "serialize object");
+ ok(!v.contains("z"), "check not contains property");
}
#define TEST(json, msg) do { \
- picojson::value v; \
- const char *s = json; \
- string err = picojson::parse(v, s, s + strlen(s)); \
- is(err, string("syntax error at line " msg), msg); \
+ picojson::value v; \
+ const char *s = json; \
+ string err = picojson::parse(v, s, s + strlen(s)); \
+ is(err, string("syntax error at line " msg), msg); \
} while (0)
TEST("falsoa", "1 near: oa");
TEST("{]", "1 near: ]");
TEST("\n\bbell", "2 near: bell");
TEST("\"abc\nd\"", "1 near: ");
#undef TEST
-
+
{
- picojson::value v1, v2;
- const char *s;
- string err;
- s = "{ \"b\": true, \"a\": [1,2,\"three\"], \"d\": 2 }";
- err = picojson::parse(v1, s, s + strlen(s));
- s = "{ \"d\": 2.0, \"b\": true, \"a\": [1,2,\"three\"] }";
- err = picojson::parse(v2, s, s + strlen(s));
- ok((v1 == v2), "check == operator in deep comparison");
+ picojson::value v1, v2;
+ const char *s;
+ string err;
+ s = "{ \"b\": true, \"a\": [1,2,\"three\"], \"d\": 2 }";
+ err = picojson::parse(v1, s, s + strlen(s));
+ s = "{ \"d\": 2.0, \"b\": true, \"a\": [1,2,\"three\"] }";
+ err = picojson::parse(v2, s, s + strlen(s));
+ ok((v1 == v2), "check == operator in deep comparison");
}
{
- picojson::value v1, v2;
- const char *s;
- string err;
- s = "{ \"b\": true, \"a\": [1,2,\"three\"], \"d\": 2 }";
- err = picojson::parse(v1, s, s + strlen(s));
- s = "{ \"d\": 2.0, \"a\": [1,\"three\"], \"b\": true }";
- err = picojson::parse(v2, s, s + strlen(s));
- ok((v1 != v2), "check != operator for array in deep comparison");
+ picojson::value v1, v2;
+ const char *s;
+ string err;
+ s = "{ \"b\": true, \"a\": [1,2,\"three\"], \"d\": 2 }";
+ err = picojson::parse(v1, s, s + strlen(s));
+ s = "{ \"d\": 2.0, \"a\": [1,\"three\"], \"b\": true }";
+ err = picojson::parse(v2, s, s + strlen(s));
+ ok((v1 != v2), "check != operator for array in deep comparison");
}
{
- picojson::value v1, v2;
- const char *s;
- string err;
- s = "{ \"b\": true, \"a\": [1,2,\"three\"], \"d\": 2 }";
- err = picojson::parse(v1, s, s + strlen(s));
- s = "{ \"d\": 2.0, \"a\": [1,2,\"three\"], \"b\": false }";
- err = picojson::parse(v2, s, s + strlen(s));
- ok((v1 != v2), "check != operator for object in deep comparison");
+ picojson::value v1, v2;
+ const char *s;
+ string err;
+ s = "{ \"b\": true, \"a\": [1,2,\"three\"], \"d\": 2 }";
+ err = picojson::parse(v1, s, s + strlen(s));
+ s = "{ \"d\": 2.0, \"a\": [1,2,\"three\"], \"b\": false }";
+ err = picojson::parse(v2, s, s + strlen(s));
+ ok((v1 != v2), "check != operator for object in deep comparison");
}
{
- picojson::value v1, v2;
- const char *s;
- string err;
- s = "{ \"b\": true, \"a\": [1,2,\"three\"], \"d\": 2 }";
- err = picojson::parse(v1, s, s + strlen(s));
- picojson::object& o = v1.get<picojson::object>();
- o.erase("b");
- picojson::array& a = o["a"].get<picojson::array>();
- picojson::array::iterator i;
- i = std::remove(a.begin(), a.end(), picojson::value(std::string("three")));
- a.erase(i, a.end());
- s = "{ \"a\": [1,2], \"d\": 2 }";
- err = picojson::parse(v2, s, s + strlen(s));
- ok((v1 == v2), "check erase()");
+ picojson::value v1, v2;
+ const char *s;
+ string err;
+ s = "{ \"b\": true, \"a\": [1,2,\"three\"], \"d\": 2 }";
+ err = picojson::parse(v1, s, s + strlen(s));
+ picojson::object& o = v1.get<picojson::object>();
+ o.erase("b");
+ picojson::array& a = o["a"].get<picojson::array>();
+ picojson::array::iterator i;
+ i = std::remove(a.begin(), a.end(), picojson::value(std::string("three")));
+ a.erase(i, a.end());
+ s = "{ \"a\": [1,2], \"d\": 2 }";
+ err = picojson::parse(v2, s, s + strlen(s));
+ ok((v1 == v2), "check erase()");
}
ok(picojson::value(3.0).serialize() == "3",
- "integral number should be serialized as a integer");
-
+ "integral number should be serialized as a integer");
+
{
- const char* s = "{ \"a\": [1,2], \"d\": 2 }";
- picojson::null_parse_context ctx;
- string err;
- picojson::_parse(ctx, s, s + strlen(s), &err);
- ok(err.empty(), "null_parse_context");
+ const char* s = "{ \"a\": [1,2], \"d\": 2 }";
+ picojson::null_parse_context ctx;
+ string err;
+ picojson::_parse(ctx, s, s + strlen(s), &err);
+ ok(err.empty(), "null_parse_context");
}
-
+
{
- picojson::value v1, v2;
- v1 = picojson::value(true);
- swap(v1, v2);
- ok(v1.is<picojson::null>(), "swap (null)");
- ok(v2.get<bool>() == true, "swap (bool)");
-
- v1 = picojson::value("a");
- v2 = picojson::value(1.0);
- swap(v1, v2);
- ok(v1.get<double>() == 1.0, "swap (dobule)");
- ok(v2.get<string>() == "a", "swap (string)");
-
- v1 = picojson::value(picojson::object());
- v2 = picojson::value(picojson::array());
- swap(v1, v2);
- ok(v1.is<picojson::array>(), "swap (array)");
- ok(v2.is<picojson::object>(), "swap (object)");
+ picojson::value v1, v2;
+ v1 = picojson::value(true);
+ swap(v1, v2);
+ ok(v1.is<picojson::null>(), "swap (null)");
+ ok(v2.get<bool>() == true, "swap (bool)");
+
+ v1 = picojson::value("a");
+ v2 = picojson::value(1.0);
+ swap(v1, v2);
+ ok(v1.get<double>() == 1.0, "swap (dobule)");
+ ok(v2.get<string>() == "a", "swap (string)");
+
+ v1 = picojson::value(picojson::object());
+ v2 = picojson::value(picojson::array());
+ swap(v1, v2);
+ ok(v1.is<picojson::array>(), "swap (array)");
+ ok(v2.is<picojson::object>(), "swap (object)");
}
-
+
return success ? 0 : 1;
}
diff --git a/xwalk/vehicle.cc b/xwalk/vehicle.cc
index 5256a392..cea84802 100644
--- a/xwalk/vehicle.cc
+++ b/xwalk/vehicle.cc
@@ -72,7 +72,8 @@ picojson::value GetBasic(GVariant* value) {
picojson::value v;
if (type == "i") {
- v = picojson::value(static_cast<double>(GVS<int>::value(value)));
+ int tempVal = GVS<int>::value(value);
+ v = picojson::value(static_cast<double>(tempVal));
} else if (type == "d") {
v = picojson::value(GVS<double>::value(value));
} else if (type == "q") {
@@ -100,21 +101,19 @@ GVariant* GetBasic(picojson::value value, const std::string& type) {
GVariant* v = nullptr;
if (type == "i") {
- v = g_variant_new(type.c_str(), value.get<double>());
+ v = g_variant_new(type.c_str(), (int32_t)value.get<double>());
} else if (type == "d") {
v = g_variant_new(type.c_str(), value.get<double>());
} else if (type == "q") {
- v = g_variant_new(type.c_str(), value.get<double>());
+ v = g_variant_new(type.c_str(), (uint16_t)value.get<double>());
} else if (type == "n") {
- v = g_variant_new(type.c_str(), value.get<double>());
- } else if (type == "y") {
- v = g_variant_new(type.c_str(), value.get<double>());
+ v = g_variant_new(type.c_str(), (int16_t)value.get<double>());
} else if (type == "u") {
- v = g_variant_new(type.c_str(), value.get<double>());
+ v = g_variant_new(type.c_str(), (uint32_t)value.get<double>());
} else if (type == "x") {
- v = g_variant_new(type.c_str(), value.get<double>());
+ v = g_variant_new(type.c_str(), (int64_t)value.get<double>());
} else if (type == "t") {
- v = g_variant_new(type.c_str(), value.get<double>());
+ v = g_variant_new(type.c_str(), (uint64_t)value.get<double>());
} else if (type == "b") {
v = g_variant_new(type.c_str(), value.get<bool>());
} else if (type == "s") {
@@ -185,22 +184,22 @@ picojson::value::array AmbZoneToW3C(int amb_zone) {
picojson::value::array z;
if (amb_zone & Zone::Left) {
- z.push_back(picojson::value("Left"));
+ z.push_back(picojson::value("left"));
}
if (amb_zone & Zone::Right) {
- z.push_back(picojson::value("Right"));
+ z.push_back(picojson::value("right"));
}
if (amb_zone & Zone::Front) {
- z.push_back(picojson::value("Front"));
+ z.push_back(picojson::value("front"));
}
if (amb_zone & Zone::Middle) {
- z.push_back(picojson::value("Middle"));
+ z.push_back(picojson::value("middle"));
}
if (amb_zone & Zone::Center) {
- z.push_back(picojson::value("Center"));
+ z.push_back(picojson::value("center"));
}
if (amb_zone & Zone::Rear) {
- z.push_back(picojson::value("Rear"));
+ z.push_back(picojson::value("rear"));
}
return z;
@@ -682,6 +681,8 @@ void Vehicle::Set(const std::string &object_name, picojson::object value,
GError* set_error = nullptr;
+ DebugOut() << "Trying to set " << attribute << " to " << itr.second.to_str() << endl;
+
g_dbus_proxy_call_sync(properties_proxy.get(), "Set",
g_variant_new("(ssv)",
interface_name.c_str(),
diff --git a/xwalk/vehicle.html b/xwalk/vehicle.html
index 59d32234..19d9c218 100644
--- a/xwalk/vehicle.html
+++ b/xwalk/vehicle.html
@@ -10,6 +10,11 @@ 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));
@@ -68,53 +73,12 @@ vehicle.lightStatus.set({"fog" : false}).then(function() {
debug("set fail! " + error.message);
});
-debug("testing running status api's");
-debug("vehicle.vehicleSpeed " + vehicle.vehicleSpeed);
-debug("vehicle.engineSpeed " + vehicle.engineSpeed);
-debug("vehicle.powertrainTorque " + vehicle.powertrainTorque);
-debug("vehicle.acceleratorPedalPosition " + vehicle.acceleratorPedalPosition);
-debug("vehicle.throttlePosition " + vehicle.throttlePosition);
-debug("vehicle.transmission " + vehicle.transmission);
-debug("vehicle.cruiseControlStatus " + vehicle.cruiseControlStatus);
-debug("vehicle.lightStatus " + vehicle.lightStatus);
-debug("vehicle.horn " + vehicle.horn);
-debug("vehicle.chime " + vehicle.chime);
-debug("vehicle.fuel " + vehicle.fuel);
-debug("vehicle.engineOil " + vehicle.engineOil);
-debug("vehicle.acceleration " + vehicle.acceleration);
-debug("vehicle.engineCoolant " + vehicle.engineCoolant);
-debug("vehicle.steeringWheel " + vehicle.steeringWheel);
-debug("vehicle.wheelTick " + vehicle.wheelTick);
-debug("vehicle.ignitionTime " + vehicle.ignitionTime);
-debug("vehicle.yawRate " + vehicle.yawRate);
-debug("vehicle.brakeOperation " + vehicle.brakeOperation);
-debug("vehicle.buttonEvent " + vehicle.buttonEvent);
-debug("vehicle.nightMode " + vehicle.nightMode);
-debug("vehicle.drivingMode " + vehicle.drivingMode);
-
-debug("getting data from running status attributes");
-
-get("vehicleSpeed");
-get("engineSpeed");
-get("powertrainTorque");
-get("acceleratorPedalPosition");
-get("throttlePosition");
-get("transmission");
-get("cruiseControlStatus");
-get("lightStatus");
-get("horn");
-get("chime");
-get("fuel");
-get("engineOil");
-get("acceleration");
-get("engineCoolant");
-get("steeringWheel");
-get("wheelTick");
-get("ignitionTime");
-get("yawRate");
-get("brakeOperation");
-get("nightMode");
-get("drivingMode");
+for(var propName in vehicle) {
+ if(typeof(obj[propName]) != "undefined") {
+ debug("vehicle." + propName);
+ get(propName);
+ }
+}
</script>
<script src="js/js-test-post.js"></script>
diff --git a/xwalk/vehicle_api.js b/xwalk/vehicle_api.js
index ae1dbefe..9880558f 100644
--- a/xwalk/vehicle_api.js
+++ b/xwalk/vehicle_api.js
@@ -151,8 +151,6 @@ function isAvailable(obj, attName)
var reply = extension.internal.sendSyncMessage(JSON.stringify(msg));
-
-
if (reply === "true") {
return "available";
} else {
@@ -173,6 +171,7 @@ function createPromise(msg) {
msg.asyncCallId = next_async_call_id;
extension.postMessage(JSON.stringify(msg));
++next_async_call_id;
+
return promise;
}
@@ -334,10 +333,37 @@ _defineVehicleSignalProperty(exports, 'washerFluid');
_defineVehicleSignalProperty(exports, 'malfunctionIndicator');
_defineVehicleSignalProperty(exports, 'batteryStatus');
_defineVehicleSignalProperty(exports, 'tire');
-
-
+_defineVehicleSignalProperty(exports, 'diagnostics');
+
+/// Personalization attributes:
+_defineVehicleSignalProperty(exports, 'mirror');
+_defineVehicleSignalProperty(exports, 'seatAdjustment');
+_defineVehicleSignalProperty(exports, 'driveMode');
+_defineVehicleSignalProperty(exports, 'dashboardIllumination');
+_defineVehicleSignalProperty(exports, 'vehicleSound');
+
+/// Driving Safety attributes:
+_defineVehicleSignalProperty(exports, 'antilockBreakingSystem');
+_defineVehicleSignalProperty(exports, 'tractionControlSystem');
+_defineVehicleSignalProperty(exports, 'electronicStabilityControl');
+_defineVehicleSignalProperty(exports, 'topSpeedLimit');
+_defineVehicleSignalProperty(exports, 'airbagStatus');
_defineVehicleSignalProperty(exports, 'door');
+_defineVehicleSignalProperty(exports, 'childSafetyLock');
+_defineVehicleSignalProperty(exports, 'seat');
+
+/// Climate attributes:
_defineVehicleSignalProperty(exports, 'temperature');
+_defineVehicleSignalProperty(exports, 'rainSensor');
+_defineVehicleSignalProperty(exports, 'wiperStatus');
_defineVehicleSignalProperty(exports, 'climateControl');
_defineVehicleSignalProperty(exports, 'defrost');
+_defineVehicleSignalProperty(exports, 'sunroof');
+_defineVehicleSignalProperty(exports, 'atmosphericPressure');
+
+/// Vision and Parking Interfaces
+_defineVehicleSignalProperty(exports, 'langeDepartureStatus');
+_defineVehicleSignalProperty(exports, 'alarm');
+_defineVehicleSignalProperty(exports, 'parkingBrake');
+
diff --git a/xwalk/vehicle_instance.cc b/xwalk/vehicle_instance.cc
index ab9593c6..4e8027ca 100644
--- a/xwalk/vehicle_instance.cc
+++ b/xwalk/vehicle_instance.cc
@@ -32,8 +32,9 @@ void VehicleInstance::HandleMessage(const char* message) {
if (v.contains("zone")) {
picojson::value zone = v.get("zone");
if (zone.is<picojson::object>() && zone.contains("value")) {
- picojson::array zones = zone.get("value").get<picojson::array>();
+ picojson::value::array zones = zone.get("value").get<picojson::value::array>();
amb_zone = ZoneToAMBZone(zones);
+ DebugOut() << "Converted W3C zone " << picojson::value(zones).to_str() << " to AMB zone: " << amb_zone << endl;
} else {
int callback_id = -1;
if (v.contains("asyncCallId"))
@@ -46,7 +47,6 @@ void VehicleInstance::HandleMessage(const char* message) {
if (method == "get") {
std::string attribute = v.get("name").to_str();
int callback_id = v.get("asyncCallId").get<double>();
- Zone::Type amb_zone = 0;
std::transform(attribute.begin(), attribute.begin() + 1, attribute.begin(),
::toupper);
@@ -74,7 +74,6 @@ void VehicleInstance::HandleMessage(const char* message) {
} else if (method == "set") {
std::string attribute = v.get("name").to_str();
int callback_id = v.get("asyncCallId").get<double>();
- Zone::Type amb_zone = 0;
std::transform(attribute.begin(), attribute.begin() + 1, attribute.begin(),
::toupper);
@@ -88,7 +87,6 @@ void VehicleInstance::HandleMessage(const char* message) {
} else if (method == "supported") {
std::string attribute = v.get("name").to_str();
int callback_id = v.get("asyncCallId").get<double>();
- Zone::Type amb_zone = 0;
std::transform(attribute.begin(), attribute.begin() + 1, attribute.begin(),
::toupper);
@@ -131,17 +129,20 @@ int VehicleInstance::ZoneToAMBZone(picojson::array zones) {
for (auto zone : zones) {
std::string tempzone = zone.to_str();
- if (tempzone == "Front") {
+ std::transform(tempzone.begin(), tempzone.end(), tempzone.begin(),
+ ::tolower);
+
+ if (tempzone == "front") {
amb_zone |= Zone::Front;
- } else if (tempzone == "Middle") {
+ } else if (tempzone == "middle") {
amb_zone |= Zone::Middle;
- } else if (tempzone == "Right") {
+ } else if (tempzone == "right") {
amb_zone |= Zone::Right;
- } else if (tempzone == "Left") {
+ } else if (tempzone == "left") {
amb_zone |= Zone::Left;
- } else if (tempzone == "Rear") {
+ } else if (tempzone == "rear") {
amb_zone |= Zone::Rear;
- } else if (tempzone == "Center") {
+ } else if (tempzone == "center") {
amb_zone |= Zone::Center;
}
}