set (DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}" CACHE PATH "The directory the docs will be installed to")
option(use_qtcore "Use QCoreApplication mainloop " OFF)
-option(nobdy_compat "Build nobdy compatibility plugin" OFF)
find_library(libtool_LIBRARY ltdl DOC "Libtool libraries")
find_path(libtool_INCLUDE_DIR ltdl.h DOC "Libtool headers")
#endif
#include "pluginloader.h"
-#include "dbusinterfacemanager.h"
+#include "abstractsource.h"
using namespace std;
PluginLoader loader(plugin);
- if(!loader.load())
+ AbstractSource* source = loader.loadSource();
+ if(source == nullptr)
return -1;
- DBusInterfaceManager manager;
-
#ifdef USE_QT_CORE
app.exec();
}
-bool PluginLoader::load()
+AbstractSource* PluginLoader::loadSource()
{
if(lt_dlinit())
{
mErrorString = lt_dlerror();
cerr<<"error initializing libtool: "<<__FILE__<<" - "<<__FUNCTION__<<":"<<__LINE__<<" "<<mErrorString<<endl;
- return false;
+ return nullptr;
}
lt_dlerror();
{
mErrorString = lt_dlerror();
cerr<<"error opening plugin: "<<mPluginPath<<" in "<<__FILE__<<" - "<<__FUNCTION__<<":"<<__LINE__<<" "<<mErrorString<<endl;
- return false;
+ return nullptr;
}
f_create = (create_t *)lt_dlsym(handle, "create");
//mErrorString = lt_dlerror();
if(f_create)
{
- f_create();
- return true;
+ return f_create();
+
}
- return false;
+ return nullptr;
}
std::string PluginLoader::errorString()
#include <string>
#include <ltdl.h>
+#include "abstractsource.h"
-
-typedef void create_t();
+typedef AbstractSource* create_t();
class PluginLoader
{
public:
- PluginLoader(std::string pluginPath);
-
- bool load();
-
- std::string errorString();
+ PluginLoader(std::string pluginPath);
+
+ AbstractSource * loadSource();
+
+ std::string errorString();
private:
std::string mPluginPath;
-set(amb_sources steeringwheelangleproperty.cpp accelerationproperty.cpp enginecoolantproperty.cpp engineoilproperty.cpp fuelrangeproperty.cpp fuellevelproperty.cpp chime.cpp hornproperty.cpp interiorlightstatusproperty.cpp lightstatusproperty.cpp wheelbrakeproperty.cpp cruisecontrolstatus.cpp transmissiongearstatus.cpp tripmeterproperty.cpp fueleconomyproperty.cpp vehiclepowermodeproperty.cpp enginespeedproperty.cpp runningstatusinterface.cpp vehiclespeed.cpp abstractdbusinterface.cpp abstractproperty.cpp dbusinterfacemanager.cpp debugout.cpp)
-set(amb_headers_install dbusinterfacemanager.h runningstatusinterface.h abstractproperty.h vehiclespeed.h hornproperty.h interiorlightstatusproperty.h lightstatusproperty.h wheelbrakeproperty.h cruisecontrolstatus.h transmissiongearstatus.h tripmeterproperty.h fueleconomyproperty.h vehiclepowermodeproperty.h enginespeedproperty.h chime.h)
+set(amb_sources abstractsink.cpp vehicleproperty.cpp abstractsource.cpp debugout.cpp)
+set(amb_headers_install vehicleproperty.h debugout.h abstractsource.h)
include_directories( ${include_dirs} )
add_library(amb SHARED ${amb_sources})
+++ /dev/null
-
-namespace VehicleInfo
-{
- enum VehicleType
- {
- Sedan=0,
- Coupe,
- Cabriole,
- Roadster,
- SUV,
- Truck
- };
-}
\ No newline at end of file
+++ /dev/null
-/*
-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 "abstractdbusinterface.h"
-#include "debugout.h"
-#include <boost/algorithm/string.hpp>
-#include <gio/gio.h>
-
-#include "abstractproperty.h"
-
-unordered_map<string, AbstractDBusInterface*> AbstractDBusInterface::interfaceMap;
-
-AbstractDBusInterface::AbstractDBusInterface(string interfaceName, string objectPath)
-: mInterfaceName(interfaceName), mObjectPath(objectPath)
-{
- mConnection = nullptr;
-
- interfaceMap[interfaceName] = this;
- introspectionXml ="<node>" ;
- introspectionXml += "<interface name='"+ interfaceName + "' >";
-}
-
-void AbstractDBusInterface::addProperty(AbstractProperty* property)
-{
- string nameToLower = property->name();
- boost::algorithm::to_lower<string>(nameToLower);
-
- ///see which properties are supported:
- introspectionXml += "<property type='"+ property->signature() + "' name='"+ property->name()+"' access='read' />"
- "<signal name='" + property->name() + "' >"
- " <arg type='"+ property->signature() + "' name='" + nameToLower + "' direction='out' />"
- "</signal>";
-
- properties[property->name()] = property;
-}
-
-void AbstractDBusInterface::registerObject(GDBusConnection* connection)
-{
- mConnection = connection;
-
- if(introspectionXml.empty())
- {
- cerr<<"no interface to export: "<<mInterfaceName<<endl;
- throw -1;
- }
-
- introspectionXml += "</interface>";
- introspectionXml += "</node>";
-
- GError* error=NULL;
-
- GDBusNodeInfo* introspection = g_dbus_node_info_new_for_xml(introspectionXml.c_str(), &error);
-
- if(!introspection)
- {
- cerr<<"Error in "<<__FILE__<<" - "<<__FUNCTION__<<":"<<__LINE__<<endl;
- cerr<<error->message<<endl;
- cerr<<"probably bad xml:"<<endl;
- cerr<<introspectionXml<<endl;
- return;
- }
-
- GDBusInterfaceInfo* mInterfaceInfo = g_dbus_node_info_lookup_interface(introspection, mInterfaceName.c_str());
-
- const GDBusInterfaceVTable vtable = { NULL, AbstractDBusInterface::getProperty, AbstractDBusInterface::setProperty };
-
- guint regId = g_dbus_connection_register_object(connection, mObjectPath.c_str(), mInterfaceInfo, &vtable, NULL, NULL, &error);
-
- if(error) throw -1;
-
- g_assert(regId > 0);
-}
-
-void AbstractDBusInterface::updateValue(AbstractProperty *property)
-{
- if(mConnection == nullptr)
- {
- return;
- }
-
- GError *error = NULL;
- g_dbus_connection_emit_signal(mConnection, NULL, mObjectPath.c_str(), mInterfaceName.c_str(), property->name().c_str(), g_variant_new("(v)",property->toGVariant()), &error);
-
- if(error)
- {
- throw -1;
- }
-}
-
-GVariant* AbstractDBusInterface::getProperty(GDBusConnection* connection, const gchar* sender, const gchar* objectPath, const gchar* interfaceName, const gchar* propertyName, GError** error, gpointer userData)
-{
- *error = NULL;
- if(interfaceMap.count(interfaceName))
- {
- GVariant* value = interfaceMap[interfaceName]->getProperty(propertyName);
- return value;
- }
- debugOut("No interface for" + string(interfaceName));
- return nullptr;
-}
-
-gboolean AbstractDBusInterface::setProperty(GDBusConnection* connection, const gchar* sender, const gchar* objectPath, const gchar* interfaceName, const gchar* propertyName, GVariant* value, GError** error, gpointer userData)
-{
- if(interfaceMap.count(interfaceName))
- {
- interfaceMap[interfaceName]->setProperty(propertyName, value);
- return true;
- }
-
- return false;
-}
-
+++ /dev/null
-/*
-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 ABSTRACTDBUSINTERFACE_H
-#define ABSTRACTDBUSINTERFACE_H
-
-#include <string>
-#include <functional>
-#include <unordered_map>
-#include <gio/gio.h>
-#include <boost/any.hpp>
-
-class AbstractProperty;
-
-using namespace std;
-
-class AbstractDBusInterface
-{
-
-public:
- AbstractDBusInterface(string interfaceName, string objectPath);
-
-
- void registerObject(GDBusConnection* connection);
-
- void addProperty(AbstractProperty* property);
- virtual void updateValue(AbstractProperty* property);
-
-protected:
-
- static GVariant *getProperty(GDBusConnection * connection, const gchar * sender, const gchar *objectPath, const gchar *interfaceName, const gchar * propertyName, GError** error, gpointer userData);
- static gboolean setProperty(GDBusConnection * connection, const gchar * sender, const gchar *objectPath, const gchar *interfaceName, const gchar * propertyName, GVariant *value, GError** error, gpointer userData);
-
- virtual void setProperty(string propertyName, GVariant * value) = 0;
- virtual GVariant * getProperty(string propertyName) = 0;
-
- unordered_map<string, AbstractProperty*> properties;
-
-private:
- string mInterfaceName;
- string mObjectPath;
- string introspectionXml;
- GDBusConnection * mConnection;
- static unordered_map<string, AbstractDBusInterface*> interfaceMap;
-};
-
-#endif // ABSTRACTDBUSINTERFACE_H
+++ /dev/null
-/*
-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 "abstractproperty.h"
-#include "abstractdbusinterface.h"
-
-AbstractProperty::AbstractProperty(string pn, string sig, Access access, AbstractDBusInterface* interface)
- : mPropertyName(pn), mSignature(sig), mAccess(access), mInterface(interface)
-{
- interface->addProperty(this);
-}
-
-void AbstractProperty::updateValue()
-{
- mInterface->updateValue(this);
-}
+++ /dev/null
-/*
-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 ABSTRACTPROPERTY_H
-#define ABSTRACTPROPERTY_H
-
-#include <string>
-#include <functional>
-#include <boost/any.hpp>
-#include <glib.h>
-
-#include "debugout.h"
-
-class AbstractDBusInterface;
-
-using namespace std;
-
-typedef function<void (boost::any)> SetterFunc;
-
-class AbstractProperty
-{
-
-public:
-
- enum Access {
- Read,
- Write,
- ReadWrite
- };
-
- AbstractProperty(string propertyName, string signature, Access access, AbstractDBusInterface* interface);
-
- virtual void setSetterFunction(SetterFunc setterFunc)
- {
- mSetterFunc = setterFunc;
- }
-
- virtual string signature()
- {
- return mSignature;
- }
-
- virtual string name()
- {
- return mPropertyName;
- }
-
- virtual Access access()
- {
- return mAccess;
- }
-
- virtual GVariant* toGVariant() = 0;
- virtual void fromGVariant(GVariant *value) = 0;
-
- template<typename T>
- void setValue(T val)
- {
- mValue = val;
- updateValue();
- }
-
- template<typename T>
- T value()
- {
- return boost::any_cast<T>(mValue);
- }
-
-protected: ///methods:
-
- void updateValue();
-
-protected:
-
- boost::any mValue;
- string mPropertyName;
- string mSignature;
- SetterFunc mSetterFunc;
- Access mAccess;
-
- AbstractDBusInterface* mInterface;
-};
-
-#endif // ABSTRACTPROPERTY_H
/*
- <one line to give the library's name and an idea of what it does.>
Copyright (C) 2012 Intel Corporation
This library is free software; you can redistribute it and/or
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "fuellevelproperty.h"
-#include "runningstatusinterface.h"
-void FuelLevelProperty::fromGVariant(GVariant* value)
+#include "abstractsink.h"
+
+AbstractSink::AbstractSink()
{
}
-GVariant* FuelLevelProperty::toGVariant()
+void AbstractSink::setProperty(VehicleProperty::Property prop, boost::any value)
+{
+ setPropertyCb(prop, value);
+}
+
+void AbstractSink::setSupported(PropertyList properties)
{
- return g_variant_new_byte(value());
+ mSupported = properties;
}
-FuelLevelProperty::FuelLevelProperty()
- :AbstractProperty("FuelLevel", "y", AbstractProperty::Read, RunningStatusInterface::iface())
+void AbstractSink::subscribeToProperty(VehicleProperty::Property property)
{
- setValue(0);
+ subscribeToPropertyCb(property);
}
-void FuelLevelProperty::setValue(uint8_t val)
+PropertyList AbstractSink::supported()
{
- AbstractProperty::setValue<uint8_t>(val);
+ return mSupported;
}
-uint8_t FuelLevelProperty::value()
+void AbstractSink::unsubscribeToProperty(VehicleProperty::Property property)
{
- return AbstractProperty::value<uint8_t>();
+ unsubscribeToPropertyCb(property);
}
-FuelLevelProperty& FuelLevelProperty::operator =(uint8_t const &val)
+void AbstractSinkManager::sinkCreated(AbstractSink* sink)
{
- this->setValue(val);
- return *this;
+ sinkCreatedCb(sink);
}
+void AbstractSinkManager::sinkRemoved(AbstractSink* sink)
+{
+ sinkRemovedCb(sink);
+}
--- /dev/null
+/*
+ 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 ABSTRACTSINK_H
+#define ABSTRACTSINK_H
+
+#include <string>
+#include <list>
+#include <functional>
+
+#include "vehicleproperty.h"
+
+using namespace std;
+
+typedef function<void (VehicleProperty::Property, boost::any)> SetPropertySignal;
+typedef function<void (VehicleProperty::Property)> SubscriptionSignal;
+
+typedef list<AbstractSink*> SinkList;
+typedef function<void (AbstractSink*)> SinkSignal;
+
+class AbstractSink
+{
+
+public:
+ AbstractSink();
+
+ void setProperty(VehicleProperty::Property, boost::any);
+ void subscribeToProperty(VehicleProperty::Property property);
+ void unsubscribeToProperty(VehicleProperty::Property property);
+ PropertyList supported();
+
+ void setSupported(PropertyList properties);
+
+ ///Pure virtual methods:
+
+ virtual string name() = 0;
+ virtual void propertyChanged(VehicleProperty::Property property, boost::any value) = 0;
+ virtual PropertyList subscriptions() = 0;
+
+
+private:
+ SetPropertySignal setPropertyCb;
+ SubscriptionSignal subscribeToPropertyCb;
+ SubscriptionSignal unsubscribeToPropertyCb;
+ PropertyList mSupported;
+};
+
+class AbstractSinkManager
+{
+public:
+ virtual SinkList sinks() = 0;
+
+ void sinkCreated(AbstractSink*);
+ void sinkRemoved(AbstractSink*);
+
+private:
+ SinkSignal sinkCreatedCb;
+ SinkSignal sinkRemovedCb;
+};
+
+#endif // ABSTRACTSINK_H
*/
-#include "engineoilproperty.h"
-#include "runningstatusinterface.h"
-void EngineOilProperty::fromGVariant(GVariant* value)
+#include "abstractsource.h"
+
+AbstractSource::AbstractSource()
{
}
-GVariant* EngineOilProperty::toGVariant()
+void AbstractSource::propertyChanged(VehicleProperty::Property property, boost::any value)
{
- EngineOil v = *this;
- return g_variant_new(signature().c_str(), v.remaining, v.temperature, v.pressure);
+ mPropertyChangedCb(property, value);
}
-EngineOilProperty::EngineOilProperty()
- :AbstractProperty("EngineOil","(yyq)",AbstractProperty::Read,RunningStatusInterface::iface())
+void AbstractSource::setPropertyChangedCb(PropertyChangedSignal propertyChangedCb)
{
- setValue<EngineOil>(EngineOil());
+ mPropertyChangedCb = propertyChangedCb;
}
-
-
--- /dev/null
+/*
+ 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 ABSTRACTSOURCE_H
+#define ABSTRACTSOURCE_H
+
+#include <string>
+#include <list>
+#include <functional>
+#include <boost/any.hpp>
+#include "vehicleproperty.h"
+
+using namespace std;
+
+typedef function<void (VehicleProperty::Property, boost::any)> PropertyChangedSignal;
+
+class AbstractSource
+{
+
+public:
+ AbstractSource();
+
+ void propertyChanged(VehicleProperty::Property property, boost::any value);
+
+ void setPropertyChangedCb(PropertyChangedSignal propertyChangedCb);
+
+ ///pure virtual methods:
+
+ virtual string name() = 0;
+ virtual void setProperty(VehicleProperty::Property property, boost::any value) = 0;
+ virtual void subscribeToPropertyChanges(VehicleProperty::Property property) = 0;
+ virtual void unsubscribeToPropertyChanges(VehicleProperty::Property property) = 0;
+ virtual PropertyList supported() = 0;
+
+
+private:
+ PropertyChangedSignal mPropertyChangedCb;
+
+};
+
+#endif // ABSTRACTSOURCE_H
+++ /dev/null
-/*
- <one line to give the library's name and an idea of what it does.>
- 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 "accelerationproperty.h"
-#include "runningstatusinterface.h"
-void AccelerationProperty::fromGVariant(GVariant* value)
-{
-
-}
-
-GVariant* AccelerationProperty::toGVariant()
-{
- Acceleration acl = *this;
- return g_variant_new(signature().c_str(),acl.x, acl.y, acl.z);
-}
-
-AccelerationProperty::AccelerationProperty()
- : AbstractProperty("Acceleration","(ddd)",AbstractProperty::Read,RunningStatusInterface::iface())
-{
- setValue<Acceleration>(Acceleration());
-}
-
+++ /dev/null
-/*
- <one line to give the library's name and an idea of what it does.>
- 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 ACCELERATIONPROPERTY_H
-#define ACCELERATIONPROPERTY_H
-
-#include <abstractproperty.h>
-
-
-class Acceleration
-{
-public:
- Acceleration() : x(0),y(0),z(0) { }
- Acceleration(Acceleration const & other)
- {
- x = other.x;
- y = other.y;
- z = other.z;
- }
-
- Acceleration & operator = (Acceleration const & other)
- {
- x = other.x;
- y = other.y;
- z = other.z;
-
- return *this;
- }
-
- double x;
- double y;
- double z;
-};
-
-class AccelerationProperty : public AbstractProperty
-{
-
-public:
- operator Acceleration()
- {
- return value<Acceleration>();
- }
-
- AccelerationProperty & operator = (Acceleration const & v)
- {
- setValue<Acceleration>(v);
- }
-
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
- AccelerationProperty();
-};
-
-#endif // ACCELERATIONPROPERTY_H
+++ /dev/null
-/*
- <one line to give the library's name and an idea of what it does.>
- 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 "chime.h"
-#include "runningstatusinterface.h"
-
-void Chime::fromGVariant(GVariant* value)
-{
-
-}
-
-GVariant* Chime::toGVariant()
-{
- return g_variant_new_boolean(value());
-}
-
-Chime::Chime()
- :AbstractProperty("Chime","b",AbstractProperty::Read,RunningStatusInterface::iface())
-{
- setValue(false);
-}
-
-void Chime::setValue(bool val)
-{
- AbstractProperty::setValue<bool>(val);
-}
-
-bool Chime::value()
-{
- return AbstractProperty::value<bool>();
-}
-
+++ /dev/null
-/*
- 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 "cruisecontrolstatus.h"
-#include "runningstatusinterface.h"
-
-#include "debugout.h"
-
-void CruiseControlStatusProperty::setValue(CruiseControlStatus status)
-{
- AbstractProperty::setValue<CruiseControlStatus>(status);
-}
-
-CruiseControlStatus CruiseControlStatusProperty::value()
-{
- return AbstractProperty::value<CruiseControlStatus>();
-}
-
-
-void CruiseControlStatusProperty::fromGVariant(GVariant* value)
-{
-
-}
-
-GVariant* CruiseControlStatusProperty::toGVariant()
-{
- return g_variant_new(signature().c_str(), value().activated, value().speed);
-}
-
-CruiseControlStatusProperty::CruiseControlStatusProperty()
-: AbstractProperty("CruiseControlStatus", "(bq)", AbstractProperty::Read, RunningStatusInterface::iface())
-{
- setValue(CruiseControlStatus());
-}
-
+++ /dev/null
-/*
- 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 CRUISECONTROLSTATUS_H
-#define CRUISECONTROLSTATUS_H
-
-#include <abstractproperty.h>
-
-class CruiseControlStatus
-{
-public:
- CruiseControlStatus() : activated(false), speed(0) { }
-
- CruiseControlStatus(bool active, uint16_t spd)
- : activated(active), speed(spd)
- { }
-
- CruiseControlStatus(const CruiseControlStatus& other)
- {
- activated = other.activated;
- speed = other.speed;
- }
-
- CruiseControlStatus& operator = (CruiseControlStatus other)
- {
- activated = other.activated;
- speed = other.speed;
-
- return *this;
- }
-
- bool operator == (CruiseControlStatus &other)
- {
- return activated == other.activated && speed == other.speed;
- }
-
- bool activated;
- uint16_t speed;
-
-};
-
-class CruiseControlStatusProperty : public AbstractProperty
-{
-public:
-
- operator CruiseControlStatus()
- {
- return value();
- }
-
- CruiseControlStatusProperty & operator = (CruiseControlStatus const & v)
- {
- setValue(v);
- return *this;
- }
-
- void setValue(CruiseControlStatus status);
- CruiseControlStatus value();
-
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
- CruiseControlStatusProperty();
-};
-
-#endif // CRUISECONTROLSTATUS_H
+++ /dev/null
-/*
-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 "dbusinterfacemanager.h"
-#include "runningstatusinterface.h"
-
-#include <string>
-
-using namespace std;
-
-static void
-on_bus_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
-{
- RunningStatusInterface::iface()->registerObject(connection);
-}
-
-static void
-on_name_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
-{
-}
-
-static void
-on_name_lost (GDBusConnection *connection, const gchar *name, gpointer user_data)
-{
-}
-
-
-
-DBusInterfaceManager::DBusInterfaceManager()
-{
- g_type_init();
-
- ownerId = g_bus_own_name(G_BUS_TYPE_SESSION,
- DBusServiceName,
- G_BUS_NAME_OWNER_FLAGS_NONE,
- on_bus_acquired,
- on_name_acquired,
- on_name_lost,
- this,
- NULL);
-
- ///TODO: instantiate other interfaces here!
-}
-
-DBusInterfaceManager::~DBusInterfaceManager()
-{
- g_bus_unown_name(ownerId);
-}
-
-
+++ /dev/null
-/*
-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 DBUSINTERFACEMANAGER_H
-#define DBUSINTERFACEMANAGER_H
-
-class DBusInterfaceManager
-{
-
-public:
- DBusInterfaceManager();
- ~DBusInterfaceManager();
-
-
-private:
-
- unsigned int ownerId;
-
-};
-
-#endif // DBUSINTERFACEMANAGER_H
+++ /dev/null
-/*
- <one line to give the library's name and an idea of what it does.>
- 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 "enginecoolantproperty.h"
-#include "runningstatusinterface.h"
-
-void EngineCoolantProperty::fromGVariant(GVariant* value)
-{
-
-}
-
-GVariant* EngineCoolantProperty::toGVariant()
-{
- EngineCoolant val = value<EngineCoolant>();
- return g_variant_new(signature().c_str(), val.level, val.temperature);
-}
-
-EngineCoolantProperty::EngineCoolantProperty()
- :AbstractProperty("EngineCoolant", "(yy)", AbstractProperty::Read, RunningStatusInterface::iface())
-{
- setValue<EngineCoolant>(EngineCoolant());
-}
-
+++ /dev/null
-/*
- <one line to give the library's name and an idea of what it does.>
- 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 ENGINECOOLANTPROPERTY_H
-#define ENGINECOOLANTPROPERTY_H
-
-#include <abstractproperty.h>
-
-class EngineCoolant
-{
-public:
- EngineCoolant(): temperature(0), level(0) {}
- EngineCoolant(EngineCoolant const & other)
- {
- temperature = other.temperature;
- level = other.level;
- }
-
- EngineCoolant& operator = (EngineCoolant const &other)
- {
- temperature = other.temperature;
- level = other.level;
- return *this;
- }
-
- bool operator == (const EngineCoolant& other) const
- {
- return temperature == other.temperature && level == other.level;
- }
-
-
-
- uint8_t temperature;
- uint8_t level;
-};
-
-class EngineCoolantProperty : public AbstractProperty
-{
-
-public:
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
- EngineCoolantProperty();
-
- EngineCoolantProperty& operator=(EngineCoolant const & other)
- {
- setValue<EngineCoolant>(other);
- return *this;
- }
-
- operator EngineCoolant()
- {
- return value<EngineCoolant>();
- }
-
-};
-
-#endif // ENGINECOOLANTPROPERTY_H
+++ /dev/null
-/*
- 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 ENGINEOILPROPERTY_H
-#define ENGINEOILPROPERTY_H
-
-#include <abstractproperty.h>
-
-class EngineOil
-{
-public:
- EngineOil():remaining(0), temperature(0), pressure(0) { }
-
- EngineOil(EngineOil const & other)
- {
- remaining = other.remaining;
- temperature = other.temperature;
- pressure = other.pressure;
- }
-
- EngineOil & operator = (EngineOil const & other)
- {
- remaining = other.remaining;
- temperature = other.temperature;
- pressure = other.pressure;
-
- return *this;
- }
-
- bool operator == (EngineOil const & other)
- {
- return remaining == other.remaining &&
- temperature == other.temperature &&
- pressure == other.pressure;
- }
-
- uint8_t remaining;
- uint8_t temperature;
- uint16_t pressure;
-};
-
-class EngineOilProperty : public AbstractProperty
-{
-
-public:
-
- operator EngineOil()
- {
- return value<EngineOil>();
- }
-
- EngineOilProperty & operator = (EngineOil const & val)
- {
- AbstractProperty::setValue<EngineOil>(val);
- return *this;
- }
-
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
-
- EngineOilProperty();
-
-
-};
-
-#endif // ENGINEOILPROPERTY_H
+++ /dev/null
-/*
- <one line to give the library's name and an idea of what it does.>
- Copyright (C) 2012 Kevron Rees <email>
-
- 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 "enginespeedproperty.h"
-#include "runningstatusinterface.h"
-#include "debugout.h"
-
-#include <glib.h>
-
-void EngineSpeedProperty::setValue(uint16_t v)
-{
- AbstractProperty::setValue<uint16_t>(v);
-}
-
-
-void EngineSpeedProperty::fromGVariant(GVariant* value)
-{
- setValue((uint16_t)g_variant_get_uint16(value));
-}
-
-GVariant* EngineSpeedProperty::toGVariant()
-{
- return g_variant_new_uint16(AbstractProperty::value<uint16_t>());
-}
-
-EngineSpeedProperty::EngineSpeedProperty()
-: AbstractProperty("EngineSpeed", "q", AbstractProperty::Read, RunningStatusInterface::iface())
-{
- setValue(0);
-}
-
+++ /dev/null
-/*
- 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 ENGINESPEEDPROPERTY_H
-#define ENGINESPEEDPROPERTY_H
-
-#include "abstractproperty.h"
-
-
-class EngineSpeedProperty : public AbstractProperty
-{
-
-public:
-
- operator uint16_t()
- {
- return value();
- }
-
- EngineSpeedProperty & operator = (uint16_t const &v)
- {
- setValue(v);
- return *this;
- }
-
- void setValue(uint16_t v);
- uint16_t value() { return AbstractProperty::value<uint16_t>(); }
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
- EngineSpeedProperty();
-
-};
-
-#endif // ENGINESPEEDPROPERTY_H
+++ /dev/null
-/*
- 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 "fueleconomyproperty.h"
-#include "runningstatusinterface.h"
-
-void FuelEconomyProperty::fromGVariant(GVariant* value)
-{
- mValue = (uint16_t)g_variant_get_uint16(value);
-}
-
-GVariant* FuelEconomyProperty::toGVariant()
-{
- return g_variant_new_uint16(AbstractProperty::value<uint16_t>());
-}
-
-FuelEconomyProperty::FuelEconomyProperty()
-: AbstractProperty("FuelEconomy","q",AbstractProperty::Read, RunningStatusInterface::iface())
-{
- setValue(0);
-}
-
-void FuelEconomyProperty::setValue(uint16_t val)
-{
- AbstractProperty::setValue<uint16_t>(val);
-}
+++ /dev/null
-/*
- 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 FUELECONOMYPROPERTY_H
-#define FUELECONOMYPROPERTY_H
-
-#include <abstractproperty.h>
-
-
-class FuelEconomyProperty : public AbstractProperty
-{
-
-public:
-
- operator uint16_t()
- {
- return value();
- }
-
- FuelEconomyProperty & operator = (uint16_t const &v)
- {
- setValue(v);
- return *this;
- }
-
- void setValue(uint16_t val);
- uint16_t value() { return AbstractProperty::value<uint16_t>(); }
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
- FuelEconomyProperty();
-
-};
-
-#endif // FUELECONOMYPROPERTY_H
+++ /dev/null
-/*
- <one line to give the library's name and an idea of what it does.>
- 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 FUELLEVELPROPERTY_H
-#define FUELLEVELPROPERTY_H
-
-#include <abstractproperty.h>
-
-
-class FuelLevelProperty : public AbstractProperty
-{
-
-public:
- void setValue(uint8_t val);
- uint8_t value();
-
- FuelLevelProperty& operator = (uint8_t const &val);
-
- operator uint8_t()
- {
- return value();
- }
-
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
- FuelLevelProperty();
-};
-
-#endif // FUELLEVELPROPERTY_H
+++ /dev/null
-/*
- <one line to give the library's name and an idea of what it does.>
- 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 "fuelrangeproperty.h"
-#include "runningstatusinterface.h"
-void FuelRangeProperty::fromGVariant(GVariant* value)
-{
-
-}
-
-GVariant* FuelRangeProperty::toGVariant()
-{
- return g_variant_new_uint16(value<uint16_t>());
-}
-
-FuelRangeProperty::FuelRangeProperty()
- :AbstractProperty("FuelRange","q",AbstractProperty::Read, RunningStatusInterface::iface())
-{
- setValue<uint16_t>(0);
-}
-
-FuelRangeProperty& FuelRangeProperty::operator=(uint16_t const & other)
-{
- setValue<uint16_t>(other);
- return *this;
-}
-
+++ /dev/null
-/*
- <one line to give the library's name and an idea of what it does.>
- 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 "hornproperty.h"
-#include "runningstatusinterface.h"
-
-void HornProperty::setValue(bool val)
-{
- AbstractProperty::setValue<bool>(val);
-}
-
-bool HornProperty::value()
-{
- return AbstractProperty::value<bool>();
-}
-
-
-void HornProperty::fromGVariant(GVariant* value)
-{
-
-}
-
-GVariant* HornProperty::toGVariant()
-{
- return g_variant_new_boolean(value());
-}
-
-HornProperty::HornProperty()
- :AbstractProperty("Horn","b",AbstractProperty::Read,RunningStatusInterface::iface())
-{
- setValue(false);
-}
-
+++ /dev/null
-/*
- <one line to give the library's name and an idea of what it does.>
- 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 HORNPROPERTY_H
-#define HORNPROPERTY_H
-
-#include <abstractproperty.h>
-
-
-class HornProperty : public AbstractProperty
-{
-
-public:
- operator bool()
- {
- return value();
- }
-
- HornProperty & operator = (bool v)
- {
- setValue(v);
- return *this;
- }
-
- void setValue(bool);
- bool value();
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
- HornProperty();
-};
-
-#endif // HORNPROPERTY_H
+++ /dev/null
-/*
- 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 "interiorlightstatusproperty.h"
-#include "runningstatusinterface.h"
-
-void InteriorLightStatusProperty::setValue(InteriorLightStatusProperty::InteriorLightStatus val)
-{
- AbstractProperty::setValue<InteriorLightStatusProperty::InteriorLightStatus>(val);
-}
-
-InteriorLightStatusProperty::InteriorLightStatus InteriorLightStatusProperty::value()
-{
- return AbstractProperty::value<InteriorLightStatusProperty::InteriorLightStatus>();
-}
-
-
-void InteriorLightStatusProperty::fromGVariant(GVariant* value)
-{
-
-}
-
-GVariant* InteriorLightStatusProperty::toGVariant()
-{
- GVariantBuilder builder;
-
- g_variant_builder_init(&builder, G_VARIANT_TYPE(signature().c_str()));
-
- InteriorLightStatusProperty::InteriorLightStatus lights = value();
-
- for(InteriorLightStatus::const_iterator itr = lights.begin(); itr != lights.end(); itr++)
- {
- g_variant_builder_add(&builder, "{yb}", (char)(*itr).first, (*itr).second);
- }
-
- GVariant *variant = g_variant_new(signature().c_str(), &builder);
- g_variant_builder_unref(&builder);
-
- return variant;
-}
-
-InteriorLightStatusProperty::InteriorLightStatusProperty()
-: AbstractProperty("InteriorLightStatus","a{yb}", AbstractProperty::Read, RunningStatusInterface::iface())
-{
- setValue(InteriorLightStatusProperty::InteriorLightStatus());
-}
-
+++ /dev/null
-/*
- 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 INTERIORLIGHTSTATUSPROPERTY_H
-#define INTERIORLIGHTSTATUSPROPERTY_H
-
-#include <abstractproperty.h>
-#include <map>
-
-class InteriorLightStatusProperty : public AbstractProperty
-{
-
-public:
- enum InteriorLight {
- Driver = 0,
- Passenger = 1,
- Center = 2
- };
-
- typedef std::map<InteriorLight, bool> InteriorLightStatus;
-
- operator InteriorLightStatus()
- {
- return value();
- }
-
- InteriorLightStatusProperty & operator = (InteriorLightStatus const & v)
- {
- setValue(v);
- return *this;
- }
-
- void setValue(InteriorLightStatusProperty::InteriorLightStatus val);
- InteriorLightStatusProperty::InteriorLightStatus value();
-
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
- InteriorLightStatusProperty();
-};
-
-#endif // INTERIORLIGHTSTATUSPROPERTY_H
+++ /dev/null
-/*
- 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 "lightstatusproperty.h"
-#include "runningstatusinterface.h"
-#include "debugout.h"
-
-void LightStatusProperty::setValue(LightStatusProperty::LightStatus val)
-{
- AbstractProperty::setValue<LightStatusProperty::LightStatus>(val);
-}
-
-LightStatusProperty::LightStatus LightStatusProperty::value()
-{
- return AbstractProperty::value<LightStatusProperty::LightStatus>();
-}
-
-
-void LightStatusProperty::fromGVariant(GVariant* value)
-{
-
-}
-
-GVariant* LightStatusProperty::toGVariant()
-{
- GVariantBuilder builder;
-
- g_variant_builder_init(&builder, G_VARIANT_TYPE(signature().c_str()));
-
- LightStatusProperty::LightStatus lights = value();
-
- for(LightStatus::const_iterator itr = lights.begin(); itr != lights.end(); itr++)
- {
- g_variant_builder_add(&builder, "{yb}", (char)(*itr).first, (*itr).second);
- }
-
- GVariant *variant = g_variant_new(signature().c_str(), &builder);
- g_variant_builder_unref(&builder);
-
- return variant;
-}
-
-LightStatusProperty::LightStatusProperty()
-: AbstractProperty("LightStatus","a{yb}", AbstractProperty::Read, RunningStatusInterface::iface())
-{
- setValue(LightStatus());
-}
-
+++ /dev/null
-/*
- 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 LIGHTSTATUSPROPERTY_H
-#define LIGHTSTATUSPROPERTY_H
-
-#include <abstractproperty.h>
-#include <map>
-
-class LightStatusProperty : public AbstractProperty
-{
-
-public:
- enum Light {
- Head = 0,
- RightTurn = 1,
- LeftTurn = 2,
- Brake = 3,
- Fog = 4,
- Hazard = 5,
- Parking = 6,
- HighBeam = 7
- };
-
- typedef std::map<Light, bool> LightStatus;
-
- operator LightStatus()
- {
- return value();
- }
-
- LightStatusProperty& operator = (LightStatus l)
- {
- setValue(l);
- return *this;
- }
-
- void setValue(LightStatusProperty::LightStatus val);
- LightStatusProperty::LightStatus value();
-
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
- LightStatusProperty();
-};
-
-#endif // LIGHTSTATUSPROPERTY_H
+++ /dev/null
-/*
-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 "runningstatusinterface.h"
-#include <iostream>
-
-#include "debugout.h"
-#include "abstractproperty.h"
-
-using namespace std;
-
-RunningStatusInterface* RunningStatusInterface::mIface = nullptr;
-
-RunningStatusInterface* RunningStatusInterface::iface()
-{
- if(mIface == nullptr)
- mIface = new RunningStatusInterface();
-
- return mIface;
-}
-
-
-RunningStatusInterface::RunningStatusInterface()
- : AbstractDBusInterface(DBusServiceName".RunningStatus", "/runningStatus")
-{
-
-}
-
-
-GVariant* RunningStatusInterface::getProperty(std::string propertyName)
-{
- if(properties.count(propertyName))
- return properties[propertyName]->toGVariant();
- else
- throw -1;
-}
-
-void RunningStatusInterface::setProperty(std::string propertyName, GVariant* value)
-{
- if(properties.count(propertyName))
- {
- properties[propertyName]->fromGVariant(value);
- }
- else
- {
- throw -1;
- }
-}
-
-
+++ /dev/null
-/*
-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 RUNNINGSTATUSINTERFACE_H
-#define RUNNINGSTATUSINTERFACE_H
-
-#include "abstractdbusinterface.h"
-
-
-class RunningStatusInterface : public AbstractDBusInterface
-{
-public:
- static RunningStatusInterface* iface();
-
-protected:
- RunningStatusInterface();
-
- virtual GVariant* getProperty(std::string propertyName);
- virtual void setProperty(std::string propertyName, GVariant* value);
-
- static RunningStatusInterface* mIface;
-};
-
-
-
-#endif // RUNNINGSTATUSINTERFACE_H
+++ /dev/null
-/*
- <one line to give the library's name and an idea of what it does.>
- 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 "steeringwheelangleproperty.h"
-#include "runningstatusinterface.h"
-
-void SteeringWheelAngleProperty::fromGVariant(GVariant* value)
-{
-
-}
-
-GVariant* SteeringWheelAngleProperty::toGVariant()
-{
- return g_variant_new_uint16(value<uint16_t>());
-}
-
-SteeringWheelAngleProperty::SteeringWheelAngleProperty()
- :AbstractProperty("SteeringWheelAngle","q",AbstractProperty::Read, RunningStatusInterface::iface())
-{
- setValue<uint16_t>(0);
-}
-
+++ /dev/null
-/*
- <one line to give the library's name and an idea of what it does.>
- 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 STEERINGWHEELANGLEPROPERTY_H
-#define STEERINGWHEELANGLEPROPERTY_H
-
-#include <abstractproperty.h>
-
-
-class SteeringWheelAngleProperty : public AbstractProperty
-{
-
-public:
- operator uint16_t()
- {
- return value<uint16_t>();
- }
-
- SteeringWheelAngleProperty & operator = (uint16_t const & v)
- {
- setValue<uint16_t>(v);
- return *this;
- }
-
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
- SteeringWheelAngleProperty();
-};
-
-#endif // STEERINGWHEELANGLEPROPERTY_H
+++ /dev/null
-/*
- 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 "transmissiongearstatus.h"
-#include "runningstatusinterface.h"
-
-void TransmissionGearStatusProperty::setValue(TransmissionGearStatusProperty::TransmissionGearStatus status)
-{
- AbstractProperty::setValue<TransmissionGearStatusProperty::TransmissionGearStatus>(status);
-}
-
-
-TransmissionGearStatusProperty::TransmissionGearStatus TransmissionGearStatusProperty::value()
-{
- return AbstractProperty::value<TransmissionGearStatusProperty::TransmissionGearStatus>();
-}
-
-
-void TransmissionGearStatusProperty::fromGVariant(GVariant* value)
-{
- setValue((TransmissionGearStatusProperty::TransmissionGearStatus)g_variant_get_byte(value));
-}
-
-GVariant* TransmissionGearStatusProperty::toGVariant()
-{
- return g_variant_new_byte( (gchar) value() );
-}
-
-TransmissionGearStatusProperty::TransmissionGearStatusProperty()
-: AbstractProperty("TransmissionGearStatus", "y", AbstractProperty::Read, RunningStatusInterface::iface())
-{
- setValue(TransmissionGearStatus::Neutral);
-}
-
+++ /dev/null
-/*
- 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 TRANSMISSIONGEARSTATUS_H
-#define TRANSMISSIONGEARSTATUS_H
-
-#include <abstractproperty.h>
-
-
-class TransmissionGearStatusProperty : public AbstractProperty
-{
-
-public:
- enum TransmissionGearStatus
- {
- Neutral = 0,
- First = 1,
- Second = 2,
- Third = 3,
- Fourth = 4,
- Fifth = 5,
- Sixth,
- Seventh,
- Eighth,
- Nineth,
- Tenth,
- Drive = 64,
- Reverse = 128,
- Park = 255
- };
-
- operator TransmissionGearStatus()
- {
- return value();
- }
-
- TransmissionGearStatusProperty& operator = (TransmissionGearStatus const & t)
- {
- setValue(t);
- return *this;
- }
-
- void setValue(TransmissionGearStatus status);
- TransmissionGearStatus value();
-
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
- TransmissionGearStatusProperty();
-};
-
-#endif // TRANSMISSIONGEARSTATUS_H
+++ /dev/null
-/*
- 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 "tripmeterproperty.h"
-#include "runningstatusinterface.h"
-
-
-void TripMeterProperty::setValue(TripMeters trips)
-{
- AbstractProperty::setValue<TripMeters>(trips);
-}
-
-TripMeters TripMeterProperty::value()
-{
- return AbstractProperty::value<TripMeters>();
-}
-
-
-void TripMeterProperty::fromGVariant(GVariant* value)
-{
-
-}
-
-GVariant* TripMeterProperty::toGVariant()
-{
-
- TripMeters list = AbstractProperty::value<TripMeters>();
-
- GVariant* variant;
-
- GVariantBuilder params;
- g_variant_builder_init(¶ms, G_VARIANT_TYPE(signature().c_str()));
- for(TripMeters::iterator itr = list.begin(); itr != list.end(); itr++)
- {
- g_variant_builder_add_value(¶ms, g_variant_new_uint32(*itr));
- }
-
- variant = g_variant_new("au",¶ms);
- g_variant_builder_unref(¶ms);
-
- return variant;
-}
-
-TripMeterProperty::TripMeterProperty()
-: AbstractProperty("TripMeter", "au", AbstractProperty::ReadWrite, RunningStatusInterface::iface())
-{
- setValue(TripMeters());
-}
-
+++ /dev/null
-/*
- 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 TRIPMETERPROPERTY_H
-#define TRIPMETERPROPERTY_H
-
-#include <abstractproperty.h>
-#include <list>
-
-
-typedef std::list<uint32_t> TripMeters;
-
-class TripMeterProperty : public AbstractProperty
-{
-
-public:
- void setValue(TripMeters trips);
- TripMeters value();
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
- TripMeterProperty();
-
- operator TripMeters()
- {
- return value();
- }
-
- TripMeterProperty& operator = (TripMeters const &t)
- {
- setValue(t);
- return *this;
- }
-
-private:
- TripMeters mValue;
-};
-
-#endif // TRIPMETERPROPERTY_H
+++ /dev/null
-/*
- 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 "vehiclepowermodeproperty.h"
-#include "runningstatusinterface.h"
-
-#include <glib.h>
-
-void VehiclePowerModeProperty::setValue(VehiclePowerModeProperty::VehiclePowerMode mode)
-{
- AbstractProperty::setValue<VehiclePowerModeProperty::VehiclePowerMode>(mode);
-}
-
-VehiclePowerModeProperty::VehiclePowerMode VehiclePowerModeProperty::value()
-{
- return AbstractProperty::value<VehiclePowerModeProperty::VehiclePowerMode>();
-}
-
-
-void VehiclePowerModeProperty::fromGVariant(GVariant* value)
-{
- setValue((VehiclePowerMode)g_variant_get_byte(value));
-}
-
-GVariant* VehiclePowerModeProperty::toGVariant()
-{
- return g_variant_new_byte( (gchar) value() );
-}
-
-VehiclePowerModeProperty::VehiclePowerModeProperty()
-: AbstractProperty("VehiclePowerMode", "y", AbstractProperty::Read, RunningStatusInterface::iface())
-{
- setValue(VehiclePowerModeProperty::Off);
-}
-
+++ /dev/null
-/*
- 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 VEHICLEPOWERMODEPROPERTY_H
-#define VEHICLEPOWERMODEPROPERTY_H
-
-#include <abstractproperty.h>
-
-
-class VehiclePowerModeProperty : public AbstractProperty
-{
-
-public:
- enum VehiclePowerMode
- {
- Off = 0,
- Accessory1 = 1,
- Accessory2 = 2,
- Run = 3
- };
-
- operator VehiclePowerMode()
- {
- return value();
- }
-
- VehiclePowerModeProperty& operator = (VehiclePowerMode const & mode)
- {
- setValue(mode);
- return *this;
- }
-
- void setValue(VehiclePowerMode mode);
- VehiclePowerMode value();
-
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
- VehiclePowerModeProperty();
-
-private:
-
- VehiclePowerMode mMode;
-
-};
-
-#endif // VEHICLEPOWERMODEPROPERTY_H
/*
- <one line to give the library's name and an idea of what it does.>
Copyright (C) 2012 Intel Corporation
This library is free software; you can redistribute it and/or
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef FUELRANGEPROPERTY_H
-#define FUELRANGEPROPERTY_H
-#include <abstractproperty.h>
+#include "vehicleproperty.h"
-
-class FuelRangeProperty : public AbstractProperty
+VehicleProperty::VehicleProperty()
{
-public:
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
- FuelRangeProperty();
-
- FuelRangeProperty& operator=(uint16_t const & other);
+}
- operator uint16_t()
- {
- return value<uint16_t>();
- }
-};
+string VehicleProperty::name(VehicleProperty::Property prop)
+{
+ return "";
+}
-#endif // FUELRANGEPROPERTY_H
+VehicleProperty::Property VehicleProperty::value(string name)
+{
+ return VehicleProperty::NoValue;
+}
/*
- <one line to give the library's name and an idea of what it does.>
Copyright (C) 2012 Intel Corporation
This library is free software; you can redistribute it and/or
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef CHIME_H
-#define CHIME_H
-#include <abstractproperty.h>
+#ifndef VEHICLEPROPERTY_H
+#define VEHICLEPROPERTY_H
-class Chime : public AbstractProperty
+#include <string>
+#include <list>
+
+using namespace std;
+
+class VehicleProperty
{
public:
- void setValue(bool);
- bool value();
- operator bool()
- {
- return value();
- }
+ VehicleProperty();
- Chime& operator = (bool const & val)
+ enum Property
{
- this->setValue(val);
- return *this;
- }
-
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
- Chime();
+ NoValue=0,
+ VehicleSpeed,
+ EngineSpeed
+ };
+
+ static string name(Property prop);
+ static Property value(string name);
+
};
+typedef list<VehicleProperty::Property> PropertyList;
-
-#endif // CHIME_H
+#endif // VEHICLEPROPERTY_H
+++ /dev/null
-/*
-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 "vehiclespeed.h"
-#include "runningstatusinterface.h"
-#include "debugout.h"
-
-#include <glib.h>
-
-VehicleSpeedProperty::VehicleSpeedProperty(): AbstractProperty("VehicleSpeed", "q", AbstractProperty::Read, RunningStatusInterface::iface())
-{
- setValue(0);
-}
-
-void VehicleSpeedProperty::setValue(uint16_t val)
-{
- AbstractProperty::setValue<uint16_t>(val);
-}
-
-uint16_t VehicleSpeedProperty::value()
-{
- return AbstractProperty::value<uint16_t>();
-}
-
-GVariant* VehicleSpeedProperty::toGVariant()
-{
-
- return g_variant_new_uint16(value());
-}
-
-void VehicleSpeedProperty::fromGVariant(GVariant *value)
-{
- setValue((uint16_t)g_variant_get_uint16(value));
-}
+++ /dev/null
-/*
-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 VEHICLESPEED_H
-#define VEHICLESPEED_H
-
-#include "abstractproperty.h"
-
-class VehicleSpeedProperty : public AbstractProperty
-{
-
-public:
- VehicleSpeedProperty();
- void setValue(uint16_t val);
- uint16_t value();
-
- operator uint16_t()
- {
- return value();
- }
-
- VehicleSpeedProperty& operator = (uint16_t const &v)
- {
- setValue(v);
- return *this;
- }
-
- GVariant* toGVariant();
- void fromGVariant(GVariant *value);
-
-
-};
-
-#endif // VEHICLESPEED_H
+++ /dev/null
-/*
- 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 "wheelbrakeproperty.h"
-#include "runningstatusinterface.h"
-
-void WheelBrakeProperty::setValue(bool val)
-{
- AbstractProperty::setValue<bool>(val);
-}
-
-bool WheelBrakeProperty::value()
-{
- return AbstractProperty::value<bool>();
-}
-
-void WheelBrakeProperty::fromGVariant(GVariant* value)
-{
-
-}
-
-GVariant* WheelBrakeProperty::toGVariant()
-{
- return g_variant_new_boolean(value());
-}
-
-WheelBrakeProperty::WheelBrakeProperty()
-: AbstractProperty("WheelBrake","b",AbstractProperty::Read,RunningStatusInterface::iface())
-{
- setValue(false);
-}
-
+++ /dev/null
-/*
- 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 WHEELBRAKEPROPERTY_H
-#define WHEELBRAKEPROPERTY_H
-
-#include <abstractproperty.h>
-
-
-class WheelBrakeProperty : public AbstractProperty
-{
-
-public:
- operator bool()
- {
- return value();
- }
-
- WheelBrakeProperty & operator = (bool const & v)
- {
- setValue(v);
- return *this;
- }
-
- virtual void fromGVariant(GVariant* value);
- virtual GVariant* toGVariant();
-
- void setValue(bool val);
- bool value();
-
- WheelBrakeProperty();
-};
-
-#endif // WHEELBRAKEPROPERTY_H
using namespace std;
-#include "enginespeedproperty.h"
-#include "vehiclepowermodeproperty.h"
-#include "fueleconomyproperty.h"
-#include "tripmeterproperty.h"
-#include "transmissiongearstatus.h"
-#include "cruisecontrolstatus.h"
-#include "wheelbrakeproperty.h"
-#include "lightstatusproperty.h"
-#include "interiorlightstatusproperty.h"
-#include "hornproperty.h"
-#include "chime.h"
-#include "fuellevelproperty.h"
-#include "fuelrangeproperty.h"
-#include "engineoilproperty.h"
-#include "enginecoolantproperty.h"
-#include "accelerationproperty.h"
-#include "steeringwheelangleproperty.h"
-
#include "debugout.h"
-ExamplePlugin::ExamplePlugin()
+ExampleSourcePlugin::ExampleSourcePlugin()
{
- int velocity = 5;
-
- VehicleSpeedProperty* speed = new VehicleSpeedProperty();
- *speed = velocity;
-
- EngineSpeedProperty* engineSpeed = new EngineSpeedProperty();
- engineSpeed->setValue(2000);
-
- VehiclePowerModeProperty* vehiclePowerMode = new VehiclePowerModeProperty();
- *vehiclePowerMode = VehiclePowerModeProperty::Run;
-
- FuelEconomyProperty* fueleconomyproperty = new FuelEconomyProperty();
- *fueleconomyproperty = 42;
-
- TripMeters trips;
- trips.push_back(1500);
- trips.push_back(1000);
-
- TripMeterProperty* tripmeterproperty = new TripMeterProperty();
- *tripmeterproperty = trips;
-
- TransmissionGearStatusProperty* transmissiongearstatus = new TransmissionGearStatusProperty();
- transmissiongearstatus->setValue(TransmissionGearStatusProperty::First);
-
- CruiseControlStatus cruisecontrolstatus = CruiseControlStatus(true, velocity);
-
- CruiseControlStatusProperty * cruisecontrolstatusproperty = new CruiseControlStatusProperty();
- *cruisecontrolstatusproperty = cruisecontrolstatus;
-
- WheelBrakeProperty *wheelbrakeproperty = new WheelBrakeProperty();
- *wheelbrakeproperty = false;
- LightStatusProperty::LightStatus lights;
- lights[LightStatusProperty::Brake] = wheelbrakeproperty->value();
- lights[LightStatusProperty::Fog] = true;
- lights[LightStatusProperty::Head] = true;
- lights[LightStatusProperty::HighBeam] = false;
- lights[LightStatusProperty::Hazard] = false;
- lights[LightStatusProperty::LeftTurn] = false;
- lights[LightStatusProperty::RightTurn] = false;
- lights[LightStatusProperty::Parking] = false;
-
- LightStatusProperty *lightstatusproperty = new LightStatusProperty();
- *lightstatusproperty = lights;
-
- InteriorLightStatusProperty::InteriorLightStatus interiorLights;
- interiorLights[InteriorLightStatusProperty::Driver] = false;
- interiorLights[InteriorLightStatusProperty::Passenger] = true;
- interiorLights[InteriorLightStatusProperty::Center] = false;
-
- InteriorLightStatusProperty* interiorlightstatusproperty = new InteriorLightStatusProperty();
- *interiorlightstatusproperty = interiorLights;
-
- HornProperty *hornProperty = new HornProperty();
- *hornProperty = false;
-
- Chime * chime = new Chime();
- *chime = false;
-
- bool val = *chime;
-
- BOOST_ASSERT(val == false);
-
- FuelLevelProperty *fuelLevel = new FuelLevelProperty();
- *fuelLevel = (uint8_t)95;
-
- uint8_t fl = *fuelLevel;
-
- BOOST_ASSERT(fl == 95);
-
- FuelRangeProperty* fuelRange = new FuelRangeProperty();
-
- *fuelRange = 321;
-
- uint16_t fr = *fuelRange;
-
- BOOST_ASSERT(fr == 321);
-
- EngineOilProperty *oilproperty = new EngineOilProperty();
-
- EngineOil oil;
- oil.temperature = 32;
- oil.pressure = 400;
- oil.remaining = 88;
-
- *oilproperty = oil;
-
- EngineOil ol = *oilproperty;
-
- BOOST_ASSERT(ol == oil);
-
- EngineCoolant coolant;
- coolant.level= 99;
- coolant.temperature = 44;
-
- EngineCoolantProperty *coolantProp = new EngineCoolantProperty();
- *coolantProp = coolant;
+}
- EngineCoolant ec = *coolantProp;
+extern "C" AbstractSource * create()
+{
+ return new ExampleSourcePlugin();
+}
- BOOST_ASSERT(ec == coolant);
+string ExampleSourcePlugin::name()
+{
+ return "example source plugin";
+}
- AccelerationProperty* accelerationProp = new AccelerationProperty();
- Acceleration accel;
- accel.x = 1;
- accel.y = 0.25;
- accel.z = 0;
+void ExampleSourcePlugin::setProperty(VehicleProperty::Property , boost::any )
+{
- *accelerationProp = accel;
+}
- SteeringWheelAngleProperty * steeringWheelAngle = new SteeringWheelAngleProperty();
+void ExampleSourcePlugin::subscribeToPropertyChanges(VehicleProperty::Property property)
+{
+ mRequests.push_back(property);
+}
- *steeringWheelAngle = 100;
+PropertyList ExampleSourcePlugin::supported()
+{
+ PropertyList props;
+ props.push_back(VehicleProperty::EngineSpeed);
+ props.push_back(VehicleProperty::VehicleSpeed);
+
+ return props;
}
-extern "C" void create()
+void ExampleSourcePlugin::unsubscribeToPropertyChanges(VehicleProperty::Property property)
{
- new ExamplePlugin;
+ mRequests.remove(property);
}
+
#ifndef EXAMPLEPLUGIN_H
#define EXAMPLEPLUGIN_H
-#include "vehiclespeed.h"
+#include <abstractsource.h>
+#include <string>
-class ExamplePlugin
+using namespace std;
+
+class ExampleSourcePlugin: public AbstractSource
{
public:
- ExamplePlugin();
+ ExampleSourcePlugin();
+ string name();
+ void setProperty(VehicleProperty::Property, boost::any);
+ void subscribeToPropertyChanges(VehicleProperty::Property property);
+ void unsubscribeToPropertyChanges(VehicleProperty::Property property);
+ PropertyList supported();
+
+private:
+ PropertyList mRequests;
};
#endif // EXAMPLEPLUGIN_H