From c19f015f2d0850b232eda648846e6b8074c3953c Mon Sep 17 00:00:00 2001 From: Kevron Rees Date: Thu, 28 Jun 2012 11:49:59 -0700 Subject: [PATCH] added engine oil property stub --- docs/runningstatus.txt | 2 +- lib/CMakeLists.txt | 2 +- lib/chime.cpp | 2 +- lib/chime.h | 2 +- lib/engineoilproperty.cpp | 33 ++++++++++++++++++++++++++++++++ lib/engineoilproperty.h | 47 ++++++++++++++++++++++++++++++++++++++++++++++ tests/testRunningStatus.py | 4 ++-- 7 files changed, 86 insertions(+), 6 deletions(-) create mode 100644 lib/engineoilproperty.cpp create mode 100644 lib/engineoilproperty.h diff --git a/docs/runningstatus.txt b/docs/runningstatus.txt index 50359fa..5fc0b9a 100644 --- a/docs/runningstatus.txt +++ b/docs/runningstatus.txt @@ -97,7 +97,7 @@ Properties byte VehiclePowerMode [readonly] Remaining Oil Percentage (byte) Engine Oil Temperature (byte) in degrees C - Engine Oil Pressure (byte) + Engine Oil Pressure in kPa (uint16) struct{ byte, byte } EngineCoolant [readonly] diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 874606d..a352105 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,5 +1,5 @@ -set(amb_sources 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_sources 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 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) include_directories( ${include_dirs} ) add_library(amb SHARED ${amb_sources}) diff --git a/lib/chime.cpp b/lib/chime.cpp index 46976c2..ce933f5 100644 --- a/lib/chime.cpp +++ b/lib/chime.cpp @@ -27,7 +27,7 @@ void Chime::fromGVariant(GVariant* value) GVariant* Chime::toGVariant() { - + return g_variant_new_boolean(value()); } Chime::Chime() diff --git a/lib/chime.h b/lib/chime.h index ef8689b..8e24d7b 100644 --- a/lib/chime.h +++ b/lib/chime.h @@ -34,7 +34,7 @@ public: return value(); } - Chime& operator = (bool val) + Chime& operator = (bool const & val) { this->setValue(val); return *this; diff --git a/lib/engineoilproperty.cpp b/lib/engineoilproperty.cpp new file mode 100644 index 0000000..c70504d --- /dev/null +++ b/lib/engineoilproperty.cpp @@ -0,0 +1,33 @@ +/* + 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 "engineoilproperty.h" + +void EngineOilProperty::fromGVariant(GVariant* value) +{ + +} + +GVariant* EngineOilProperty::toGVariant() +{ + +} + + + diff --git a/lib/engineoilproperty.h b/lib/engineoilproperty.h new file mode 100644 index 0000000..1ab1bcf --- /dev/null +++ b/lib/engineoilproperty.h @@ -0,0 +1,47 @@ +/* + 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 + +class EngineOil +{ +public: + EngineOil():remaining(0), temperature(0), pressure(0) { } + + uint8_t remaining; + uint8_t temperature; + uint16_t pressure; +}; + +class EngineOilProperty : public AbstractProperty +{ + +public: + + + virtual void fromGVariant(GVariant* value); + virtual GVariant* toGVariant(); + + +}; + +#endif // ENGINEOILPROPERTY_H diff --git a/tests/testRunningStatus.py b/tests/testRunningStatus.py index 4991d0e..53564a1 100755 --- a/tests/testRunningStatus.py +++ b/tests/testRunningStatus.py @@ -35,7 +35,7 @@ print "LightStatus: ", lightStatus print "InteriorLightStatus", interiorLightStatus print "HornSatus", hornStatus print "Chime", chimeStatus -print "FuelLevel: ", fuelLevelStatus +print "FuelLevel: %i" % fuelLevelStatus print "FuelRange", fuelRange assert type(speed) == dbus.UInt16 @@ -90,6 +90,6 @@ assert type(fuelLevelStatus) == dbus.Byte assert fuelLevelStatus == 95 assert type(fuelRange) == dbus.UInt16 -assert fuelRange = 321 +assert fuelRange == 321 print "Passed" -- 2.7.4