database plugin queries support in constructor (untested)
authorKevron Rees <kevron_m_rees@linux.intel.com>
Wed, 3 Apr 2013 16:43:37 +0000 (09:43 -0700)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Wed, 3 Apr 2013 16:43:37 +0000 (09:43 -0700)
TODO
plugins/database/databasesink.cpp

diff --git a/TODO b/TODO
index 8058882..8cffde2 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,6 +1,12 @@
+For 0.9.0:
+
+- Test database plugin. specifically get ranged support with example sink
+- websocket source may want to implement a timeout on Get/Set/GetRanged calls and reply with success=false (TEST)
+
+Other:
+
 - per-source property filtering in routing engine
 - improve obd2source speed via Physical Addressing (see https://www.scantool.net/forum/index.php?topic=6661.msg25024#msg25024)
-- websocket source may want to implement a timeout on Get/Set/GetRanged calls and reply with success=false (TEST)
 - investigate and enable use of provisioning in ssl websockets
 - add API to get number of sources per a given property
 - DBus support for objects with multiple sources (ie battery(n)Voltage where 'n' is a battery source)
index 965b4fa..f3aa075 100644 (file)
@@ -110,23 +110,6 @@ DatabaseSink::DatabaseSink(AbstractRoutingEngine *engine, map<std::string, std::
        tablename = "data";
        tablecreate = "CREATE TABLE IF NOT EXISTS data (key TEXT, value BLOB, source TEXT, time REAL, sequence REAL)";
 
-       //startDb();
-
-       if(config.find("startOnLoad")!= config.end())
-       {
-               startDb();
-       }
-
-       if(config.find("playbackMultiplier")!= config.end())
-       {
-               playbackMultiplier = boost::lexical_cast<uint>(config["playbackMultiplier"]);
-       }
-
-       if(config.find("playbackOnLoad")!= config.end())
-       {
-               startPlayback();
-       }
-
        if(config.find("databaseFile") != config.end())
        {
                databaseName = config["databaseFile"];
@@ -146,7 +129,36 @@ DatabaseSink::DatabaseSink(AbstractRoutingEngine *engine, map<std::string, std::
        mSupported.push_back(DatabaseLoggingProperty);
        mSupported.push_back(DatabasePlaybackProperty);
 
-       routingEngine->setSupported(mSupported,this);
+
+       initDb();
+
+       /// get supported:
+
+       vector<vector<string> > supportedStr = shared->db->select("SELECT DISTINCT key FROM "+tablename);
+
+       for(int i=0; i < supportedStr.size(); i++)
+       {
+               if(!ListPlusPlus<VehicleProperty::Property>(&mSupported).contains(supportedStr[i][0]))
+                       mSupported.push_back(supportedStr[i][0]);
+       }
+
+       routingEngine->setSupported(supported(), this);
+
+       if(config.find("startOnLoad")!= config.end())
+       {
+               startDb();
+       }
+
+       if(config.find("playbackMultiplier")!= config.end())
+       {
+               playbackMultiplier = boost::lexical_cast<uint>(config["playbackMultiplier"]);
+       }
+
+       if(config.find("playbackOnLoad")!= config.end())
+       {
+               startPlayback();
+       }
+
 
 }
 
@@ -261,18 +273,6 @@ void DatabaseSink::startPlayback()
 
        initDb();
 
-       /// get supported:
-
-       vector<vector<string> > supportedStr = shared->db->select("SELECT DISTINCT key FROM "+tablename);
-
-       for(int i=0; i < supportedStr.size(); i++)
-       {
-               if(!ListPlusPlus<VehicleProperty::Property>(&mSupported).contains(supportedStr[i][0]))
-                       mSupported.push_back(supportedStr[i][0]);
-       }
-
-       routingEngine->setSupported(supported(), this);
-
        /// populate playback queue:
 
        vector<vector<string> > results = shared->db->select("SELECT * FROM "+tablename);
@@ -422,12 +422,6 @@ void DatabaseSink::getRangePropertyAsync(AsyncRangePropertyReply *reply)
        reply->success = true;
        reply->completed(reply);
 
-       /// reply is owned by the requester of this call.  we own the data:
-       for(auto itr = cleanup.begin(); itr != cleanup.end(); itr++)
-       {
-               delete *itr;
-       }
-
        delete db;
 }