added a couple new properties to obd2source
authorKevron Rees <tripzero.kev@gmail.com>
Mon, 17 Dec 2012 21:52:58 +0000 (13:52 -0800)
committerKevron Rees <tripzero.kev@gmail.com>
Mon, 17 Dec 2012 21:55:56 +0000 (13:55 -0800)
TODO
plugins/obd2plugin/obd2source.h
plugins/obd2plugin/obdpid.h

diff --git a/TODO b/TODO
index 87603f9..ee95bcd 100644 (file)
--- a/TODO
+++ b/TODO
@@ -3,3 +3,5 @@
 - websocket source may want to implement a timeout on Get/Set/GetRanged calls and reply with success=false
 - enable ssl on websocket by default with option to turn it off
 - investigate and enable use of provisioning in ssl websockets
+- improve tryParse in OBD2source
+
index ee1bf57..908a9a5 100644 (file)
@@ -78,6 +78,8 @@ public:
                supportedPidsList.push_back(new FuelConsumptionPid());
                supportedPidsList.push_back(new EngineCoolantPid());
                supportedPidsList.push_back(new AirIntakeTemperaturePid());
+               supportedPidsList.push_back(new EngineLoadPid());
+               supportedPidsList.push_back(new ThrottlePositionPid());
        }
 
        ~Obd2Amb()
index 74b3483..d6db4b1 100644 (file)
@@ -279,4 +279,54 @@ public:
        }
 };
 
+class EngineLoadPid: public CopyMe<EngineCoolantPid>
+{
+public:
+       EngineLoadPid()
+               :CopyMe(VehicleProperty::EngineLoad,"01041/r",0x04)
+       {
+
+       }
+
+       bool tryParse(ByteArray replyVector)
+       {
+               ByteArray tmp = compress(cleanup(replyVector));
+
+               if (tmp[1] != id)
+               {
+                       return false;
+               }
+
+               int load = tmp[2]*100.0/255.0;
+
+               value = boost::lexical_cast<std::string>(load);
+               return true;
+       }
+};
+
+class ThrottlePositionPid: public CopyMe<ThrottlePositionPid>
+{
+public:
+       ThrottlePositionPid()
+               :CopyMe(VehicleProperty::ThrottlePosition,"01111/r",0x11)
+       {
+
+       }
+
+       bool tryParse(ByteArray replyVector)
+       {
+               ByteArray tmp = compress(cleanup(replyVector));
+
+               if (tmp[1] != id)
+               {
+                       return false;
+               }
+
+               int load = tmp[2]*100.0/255.0;
+
+               value = boost::lexical_cast<std::string>(load);
+               return true;
+       }
+};
+
 #endif