added more properties
authorKevron Rees <tripzero.kev@gmail.com>
Sun, 9 Sep 2012 17:17:03 +0000 (10:17 -0700)
committerKevron Rees <tripzero.kev@gmail.com>
Sun, 9 Sep 2012 17:17:03 +0000 (10:17 -0700)
TODO
docs/runningstatus.txt
lib/abstractpropertytype.h
lib/vehicleproperty.cpp
lib/vehicleproperty.h

diff --git a/TODO b/TODO
index d9c0ccc..39d3b77 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,5 @@
-- Enable per-plugin configuration
 - Enable websocketsink plugin to listen on a configurable interface
 - Enable websocketsource plugin to connect to a configurable host
 - websocketsink unsubscribe on disconnect
+- Add properties for initial obd-ii support for: BatteryVoltage, InteriorTemperature, EngineOilTemperature,
+  VIN, and WMI
index 85f6878..b2064b0 100644 (file)
@@ -95,7 +95,7 @@ Properties    byte VehiclePowerMode [readonly]
                        
                struct{ byte, byte, byte } EngineOil [readonly]
                
-                       Remaining Oil Percentage (byte)
+                       Remaining Oil life remaining; percentage (byte)
                        Engine Oil Temperature (byte) in degrees C
                        Engine Oil Pressure in kPa (uint16)
                        
index f56cb6b..f88c8c9 100644 (file)
@@ -89,4 +89,32 @@ public:
        }
 };
 
+class StringPropertyType: public AbstractPropertyType
+{
+public:
+       StringPropertyType(std::string val)
+               :AbstractPropertyType()
+       {
+               setValue(val);
+       }
+
+       StringPropertyType(StringPropertyType const & other)
+       {
+               setValue(other.value<std::string>());
+       }
+
+       StringPropertyType & operator = (StringPropertyType const & other)
+       {
+               //setValue(other.value<std::string>());
+               return *this;
+       }
+
+
+       std::string toString()
+       {
+               return value<std::string>();
+       }
+
+};
+
 #endif
index b92b7e3..51f344c 100644 (file)
@@ -40,6 +40,12 @@ const VehicleProperty::Property VehicleProperty::AccelerationY = "AccelerationY"
 const VehicleProperty::Property VehicleProperty::AccelerationZ = "AccelerationZ";
 const VehicleProperty::Property VehicleProperty::MassAirFlow = "MassAirFlow";
 const VehicleProperty::Property VehicleProperty::ButtonEvent = "ButtonEvent";
+const VehicleProperty::Property VehicleProperty::AirIntakeTemperature = "AirIntakeTemperature";
+const VehicleProperty::Property VehicleProperty::BatteryVoltage = "BatteryVoltage";
+const VehicleProperty::Property VehicleProperty::InteriorTemperature = "InteriorTemperature";
+const VehicleProperty::Property VehicleProperty::EngineOilTemperature = "EngineOilTemperature";
+const VehicleProperty::Property VehicleProperty::VIN = "VIN";
+const VehicleProperty::Property VehicleProperty::WMI = "WMI";
 
 VehicleProperty::VehicleProperty()
 {
@@ -66,6 +72,12 @@ std::list<VehicleProperty::Property> VehicleProperty::capabilities()
        mProperties.push_back(AccelerationZ);
        mProperties.push_back(MassAirFlow);
        mProperties.push_back(ButtonEvent);
+       mProperties.push_back(AirIntakeTemperature);
+       mProperties.push_back(BatteryVoltage);
+       mProperties.push_back(InteriorTemperature);
+       mProperties.push_back(EngineOilTemperature);
+       mProperties.push_back(VIN);
+       mProperties.push_back(WMI);
 
        return mProperties;
 }
@@ -88,7 +100,13 @@ AbstractPropertyType* VehicleProperty::getPropertyTypeForPropertyNameValue(Vehic
        else if(name == AccelerationY) return new AccelerationType(value);
        else if(name == AccelerationZ) return new AccelerationType(value);
        else if(name == MassAirFlow) return new MassAirFlowType(value);
-       else if(name == ButtonEvent) return new ButtonEventType(value);
+       else if(name == AirIntakeTemperature) return new AirIntakeTemperatureType(value);
+       else if(name == BatteryVoltage) return new BatteryVoltageType(value);
+       else if(name == InteriorTemperature) return new InteriorTemperatureType(value);
+       else if(name == EngineOilTemperature) return new EngineOilTemperatureType(value);
+       else if(name == VIN) return new VINType(value);
+       else if(name == WMI) return new WMIType(value);
+
 
        return nullptr;
 }
index be68b13..e9828ff 100644 (file)
@@ -139,6 +139,30 @@ public:
        static const Property ButtonEvent;
        typedef BasicPropertyType<int> ButtonEventType;
 
+       /**< Air intake temperature in degrees celcius */
+       static const Property AirIntakeTemperature;
+       typedef BasicPropertyType<int> AirIntakeTemperatureType;
+
+       /**< Battery voltage in volts */
+       static const Property BatteryVoltage;
+       typedef BasicPropertyType<double> BatteryVoltageType;
+
+       /**< Interior Air Temperature in degrees celcius */
+       static const Property InteriorTemperature;
+       typedef BasicPropertyType<int> InteriorTemperatureType;
+
+       /**< Engine Oil Temperature in degrees celcius */
+       static const Property EngineOilTemperature;
+       typedef BasicPropertyType<int> EngineOilTemperatureType;
+
+       /**< Vehicle Identification Number (ISO 3779) 17 chars**/
+       static const Property VIN;
+       typedef StringPropertyType VINType;
+
+       /**< World Manufacturer Identifier (SAE) 3 characters. */
+       static const Property WMI;
+       typedef StringPropertyType WMIType;
+
        static std::list<VehicleProperty::Property> capabilities();
 
        static AbstractPropertyType* getPropertyTypeForPropertyNameValue(Property name, std::string value);