powerguru-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Powerguru-commit] [SCM] powerguru branch, master, updated. cd8d3f0c599f


From: Rob Savoye
Subject: [Powerguru-commit] [SCM] powerguru branch, master, updated. cd8d3f0c599f1355d8f4828dd2c6de40377e2446
Date: Wed, 21 Nov 2018 21:37:38 -0500 (EST)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "powerguru".

The branch, master has been updated
       via  cd8d3f0c599f1355d8f4828dd2c6de40377e2446 (commit)
       via  b1ed5a630b0ec0451886b10b79222cd1d8433f6c (commit)
       via  a9920f328c521315c288fc0432516ae2a1a89252 (commit)
       via  46e8c00d57d0993c781047af91caf6fd70e3f571 (commit)
       via  a04e60e8e18501d70822d555dd70861a2f10c8b6 (commit)
       via  11eb570b9bd70fcb175bb6397850711845a4ac6d (commit)
       via  21fcf45d89967ee70ae157bdc0457a88b7d20dd8 (commit)
       via  e446109b34e052846c8e42ffa16a9d774ebe4975 (commit)
       via  7a088d5712c5b508ca896122346aa10bd09493b4 (commit)
       via  c6af2d6f7da53eb8d3bda06e953fce460588e436 (commit)
       via  4004fca4cc3708bb826b02b4c5fd8f30363c0b19 (commit)
       via  3242aefe350320e240dab2721beb6fe7b25b6669 (commit)
       via  b476eda834048c9b96c91069189eb5c8c2712016 (commit)
       via  5b038c3aa182d2c97890068dae5f9425d7f4cac4 (commit)
       via  96e4c3ea16b80ccdd6dac780858d360a7380b0a9 (commit)
       via  8c873bb899d053ed63c2ed59a6d2f9954cd0a337 (commit)
       via  bcdd346c07c95895c92d6dbfbb74b90690494e69 (commit)
       via  67d6a09f5e1b3d1d184d87874a7fb2b9ac99314d (commit)
       via  1335f6009fd21302a882cc8cab6cb506d8709f3d (commit)
       via  a6ae1878ab986517e0dde30f2ea6c342ed3da464 (commit)
       via  d1b88f2ba865a7a082701c6839e752b864b7e2b6 (commit)
       via  61f5737d5aacedbac45619f6d994313a1c8ecb11 (commit)
       via  dde745602f521fee210fa6d89d8e0e89f38fc4a3 (commit)
       via  9c38e3b35179a2d94d0e74fc525ea3eb44a3e680 (commit)
       via  3a2a4ebdb0b7c7cc2b22ddeb05f1b880c84d9346 (commit)
       via  57d7137c7e1a4e08130e9024bdd8ebd026936896 (commit)
       via  17cb35214e8129ebb97c35d8fcc324e919a45bcf (commit)
       via  0ad377ff6a51350152e3fa31a0e5c37eee45fb4c (commit)
       via  8de97c6d891d052c3cb9df8394ab21eadedc5a3c (commit)
       via  64a4acd696a3efcd73455911314889f936026ba4 (commit)
       via  2fb2c74a2c6e1dac9ee71d3448e5703411fcfaf3 (commit)
       via  8305a73668a67118a1814305dddf41fe5c245e3c (commit)
       via  12171e4728f2d4de3d94fef9456b4907ef9e9a7f (commit)
       via  e4c3578341d78b74b9040fc995b9e6750ce5aaec (commit)
      from  8637d9f769c97b6e4e2d98eae131ab3423366388 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=cd8d3f0c599f1355d8f4828dd2c6de40377e2446


commit cd8d3f0c599f1355d8f4828dd2c6de40377e2446
Author: Rob Savoye <address@hidden>
Date:   Wed Nov 21 19:37:14 2018 -0700

    Add working database support

diff --git a/devices/ownet.h b/devices/ownet.h
index ef03b0c..b922764 100644
--- a/devices/ownet.h
+++ b/devices/ownet.h
@@ -31,6 +31,7 @@
 #include <log.h>
 #include <owcapi.h>
 #include <boost/algorithm/string.hpp>
+#include "database.h"
 
 extern LogFile dbglogfile;
 
@@ -44,7 +45,6 @@ struct ownet {
 } typedef ownet_t;
 
 struct temperature {
-    //ownet_t ownet;
     float temp;
     float lowtemp;
     float hightemp;
@@ -53,16 +53,31 @@ struct temperature {
 class Ownet {
 private:
     enum family_t {CONTROL = 05, THERMOMETER = 10, THERMOMETER2 = 28};
-    std::map<std::string, ownet_t> _sensors;
+    std::map<std::string, ownet_t *> _sensors;
     bool _owserver = false;
     std::map<std::string, temperature_t *> _temperatures;
     std::mutex _mutex;
-
+    int poll_sleep = 2;
+#ifdef HAVE_LIBPQ
+    Database pdb;
+#endif
 public:
+    //
+    // Thread have a polling frequency to avoid eating up all the cpu cycles
+    // by polling to quickly.
+    int getPollSleep(void) {
+        return poll_sleep;
+    }
+    void setPollSleep(int x) {
+        poll_sleep = x;
+    }
+
+    // see if we're connected to the owserver
     bool isConnected(void) {
         return _owserver;
     }
 
+    // see if any 1 wire sensors were found during scanning
     bool hasSensors(void) {
         if (_sensors.size() >0) {
             return true;
@@ -71,6 +86,7 @@ public:
         }
     }
 
+    // extract a value from an owfs file
     std::string getValue(const std::string &device, std::string file) {
 //        DEBUGLOG_REPORT_FUNCTION;
         char * buf;
@@ -85,20 +101,28 @@ public:
             //std::cout << ", Got(" << s << "): " <<  buf << std::endl;
         }
 
-        std::string bar(buf);
+        std::string value = (buf);
         free(buf);
 
-        return bar;
+        return value;
+    }
+
+    // return a handle to all the sensors
+    ownet_t *getSensor(const std::string &device) {
+        return _sensors[device];
     }
 
-    std::map<std::string, ownet_t> &getSensors(void) {
+    std::map<std::string, ownet_t *> &getSensors(void) {
         return _sensors;
     }
 
+    // get all the temperature fields for a device.
     temperature_t *getTemperature(const std::string &device) {
         DEBUGLOG_REPORT_FUNCTION;
 
         std::string family = getValue(device, "family");
+        std::string id = getValue(device, "id");
+        std::string type = getValue(device, "type");
 
         temperature_t *temp = 0;
         if (family == "10") {
@@ -107,6 +131,15 @@ public:
             temp->temp = std::stof(getValue(device, "temperature"));
             temp->lowtemp =std::stof(getValue(device, "templow"));
             temp->hightemp = std::stof(getValue(device, "temphigh"));
+            // Add data to the database
+            std::string query = family + ',';
+            query += "\'" + id;
+            query += "\', \'" + type;
+            query += "\', " + std::to_string(temp->temp);
+            query += ", " + std::to_string(temp->lowtemp);
+            query +=  ", " + std::to_string(temp->hightemp);
+            pdb.queryInsert(query);
+
             std::lock_guard<std::mutex> guard(_mutex);
             _temperatures[device] = temp;
         } else {
@@ -119,18 +152,18 @@ public:
     void dump(void) {
         DEBUGLOG_REPORT_FUNCTION;
 
-        std::map<std::string, ownet_t>::iterator sit;
+        std::map<std::string, ownet_t *>::iterator sit;
         for (sit = _sensors.begin(); sit != _sensors.end(); sit++) {
             std::cout << "Data for device: " << sit->first << std::endl;
-            std::cout << "\tfamily: " << sit->second.family << std::endl;
-            std::cout << "\ttype: " << sit->second.type << std::endl;
-            std::cout << "\tid: " << sit->second.id << std::endl;
+            std::cout << "\tfamily: " << sit->second->family << std::endl;
+            std::cout << "\ttype: " << sit->second->type << std::endl;
+            std::cout << "\tid: " << sit->second->id << std::endl;
         }
         std::map<std::string, temperature_t *>::iterator tit;
         for (tit = _temperatures.begin(); tit != _temperatures.end(); tit++) {
-            std::cout << "Current temperature: " << tit->second->temp << 
std::endl;
-            std::cout << "Low temperture: " << tit->second->lowtemp << 
std::endl;
-            std::cout << "High Temperature: " << tit->second->hightemp << 
std::endl;
+            std::cout << "\tCurrent temperature: " << tit->second->temp << 
std::endl;
+            std::cout << "\tLow temperture: " << tit->second->lowtemp << 
std::endl;
+            std::cout << "\tHigh Temperature: " << tit->second->hightemp << 
std::endl;
         }
     }
 #else
@@ -179,31 +212,45 @@ public:
             }
         }
 
+#ifdef HAVE_LIBPQ
+        if (!pdb.openDB()) {
+            dbglogfile << "ERROR: Couldn't open database!" << std::endl;
+            exit(1);
+        }
+#endif
+
         int i = 0;
         std::vector<std::string>::iterator it;
         for(it = results.begin(); it != results.end(); it++,i++ ) {
-            ownet_t data;
-            data.family = getValue(it->c_str(), "family");
-            data.type = getValue(it->c_str(), "type");
-            data.id = getValue(it->c_str(), "id");
-            if (data.type.length() == 0 || data.id.length() == 0) {
+            ownet_t *data = new ownet_t[1];
+            data->family = getValue(it->c_str(), "family");
+            data->type = getValue(it->c_str(), "type");
+            data->id = getValue(it->c_str(), "id");
+            if (data->type.length() == 0 || data->id.length() == 0) {
                 break;
             }
             std::string dev = *it + "temperature";
             if (OW_present(dev.c_str()) == 0) {
                 dbglogfile << "Temperature sensor found: " << *it << std::endl;
                 temperature_t *temp= new temperature_t[1];
-
+                memset(temp, 0, sizeof(temperature_t));
                 temp->temp = std::stof(getValue(*it, "temperature"));
                 temp->lowtemp = std::stof(getValue(*it, "templow"));
                 temp->hightemp = std::stof(getValue(*it, "temphigh"));
                 _temperatures[*it] = temp;
+
+                std::string query = data->family + ',';
+                query += "\'" + data->id;
+                query += "\', \'" + data->type;
+                query += "\', " + std::to_string(temp->temp);
+                query += ", " + std::to_string(temp->lowtemp);
+                query +=  ", " + std::to_string(temp->hightemp);
+                pdb.queryInsert(query);
             } else {
                 dbglogfile << "Temperature sensor not found!" << std::endl;
             }
             _sensors[*it] = data;
         }
-
     }
 
 //    ~Ownet(void);

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=b1ed5a630b0ec0451886b10b79222cd1d8433f6c


commit b1ed5a630b0ec0451886b10b79222cd1d8433f6c
Author: Rob Savoye <address@hidden>
Date:   Wed Nov 21 19:35:56 2018 -0700

    Add minimally working support for the database

diff --git a/lib/postgresql.cc b/lib/postgresql.cc
index 45a908f..140d04a 100644
--- a/lib/postgresql.cc
+++ b/lib/postgresql.cc
@@ -25,7 +25,6 @@
 #include <iostream>
 #include <iomanip> 
 #include <vector>
-#include <sys/time.h>
 #include <cstdio>
 
 #ifdef __STDC_HOSTED__
@@ -40,8 +39,9 @@ using namespace std;
 #include "log.h"
 
 #ifdef HAVE_LIBPQ
+# include <libpq-fe.h>
 #else
-#warning "You need to install Postgresql for data base support"
+# warning "You need to install Postgresql for data base support"
 #endif
 
 const int LINELEN = 80;
@@ -95,7 +95,7 @@ Database::dbHostSet(std::string host)
 bool
 Database::openDB (void)
 {
-    // DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
     unsigned long flag = 0;
 
@@ -103,6 +103,14 @@ Database::openDB (void)
                << " on " << _dbhost.c_str()
                << " as user " << _dbuser.c_str() << endl;
 
+    _connection = PQconnectdb("dbname = powerguru");
+     /* Check to see that the backend connection was successfully made */
+    if (PQstatus(_connection) != CONNECTION_OK)
+    {
+        dbglogfile << "ERROR: Connection to database failed" << std::endl;
+        //exit_nicely(_connection);
+    }
+
     return true;
 }
 
@@ -110,20 +118,24 @@ Database::openDB (void)
 bool
 Database::closeDB (void)
 {
+    DEBUGLOG_REPORT_FUNCTION;
+    //exit_nicely(_connection);
+    
     return true;
 }
 
 bool
-Database::queryInsert(const char *query)
+Database::queryInsert(const std::string &query)
 {
     DEBUGLOG_REPORT_FUNCTION;
 
     int retries, result;
-  
-    retries = 2;
-  
-    dbglogfile << "Query is: " << query << endl;
-  
+    std::string str = "INSERT INTO onewire VALUES(";
+    str += query + ");";
+    
+    PQexec(_connection, str.c_str());
+    dbglogfile << "Query is: " << str << endl;
+    
     dbglogfile << "Lost connection to the database server, shutting down..." 
<< endl;
     return false;
 }
@@ -145,6 +157,7 @@ Database::queryResults(const char *query)
     return (void *)0;
 }
 
+#if 0
 bool
 Database::queryInsert(vector<meter_data_t *> data)
 {
@@ -179,7 +192,9 @@ Database::queryInsert(vector<meter_data_t *> data)
   
     return true;  
 }
-  
+#endif
+
+#if 0
 bool
 Database::queryInsert(meter_data_t *data)
 {
@@ -206,67 +221,6 @@ Database::queryInsert(meter_data_t *data)
     ttm->tm_year+= 1900;          // years since 1900
     ttm->tm_mon+=1;               // months since January
 
-#if 0  
-    // FIXME: For now source is the facility
-    // Build the query string to insert the data
-    sprintf(query, "INSERT INTO meters () VALUES ( \
-        '%d',                   // Unit address (int)\
-        '%s',                   // Device Type enum)\
-        '%d-%d-%d %d:%d:%d',    // timestamp\
-        '%d',                   // Charger Amps (int)\
-        '%d',                   // AC Load Amps (int)\
-        '%f',                   // Battery Volts (float)\
-        '%f',                   // AC Volts Out (float)\
-        '%f',                   // AC1 Volts In (float)\
-        '%f',                   // AC2 Volts In (float)\
-        '%d',                   // PV Amps In (int)\
-        '%f',                   // PV Volts In (float)\
-        '%f',                   // Buy Amps (int)\
-        '%f',                   // Sell Amps (int)\
-        '%f',                   // Dail Kwh (float)\
-        '%d',                   // Frequency in Hertz (int)\
-        '%f'                    // Battery Temperature Compenation (float)\
-        )",
-            //  sprintf(query, "INSERT INTO meters () VALUES 
('%d','%s','%0.4d-%0.2d-%d 
%0.2d:%0.2d:%0.2d','%d','%d','%f','%f','%f','%f','%d','%f','%f','%f','%d','%f','%f')",
-            data->unit,
-            type,
-            
ttm->tm_year,ttm->tm_mon,ttm->tm_mday,ttm->tm_hour,ttm->tm_min,ttm->tm_sec,
-            data->charge_amps,
-            data->ac_load_amps,
-            data->battery_volts,
-            data->ac_volts_out,
-            data->ac1_volts_in,
-            data->ac2_volts_in,
-            data->pv_amps_in,
-            data->pv_volts_in,
-            data->buy_amps,
-            data->sell_amps,
-            data->daily_kwh,
-            data->hertz,
-            data->tempcomp_volts
-        );
-#else
-    query << "INSERT INTO meters () VALUES (";
-    query << data->unit << ",";
-    query << "\'" << type << "\',";
-    query << "\'" << ttm->tm_year << "-" << ttm->tm_mon << "-" << ttm->tm_mday 
<< " ";
-    query << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec << "\',";
-    query << data->charge_amps << ",";
-    query << data->ac_load_amps << ",";
-    query << data->battery_volts << ",";
-    query << data->ac_volts_out << ",";
-    query << data->ac1_volts_in << ",";
-    query << data->ac2_volts_in << ",";
-    query << data->pv_amps_in << ",";
-    query << data->pv_volts_in << ",";
-    query << data->buy_amps << ",";
-    query << data->sell_amps << ",";
-    query << data->daily_kwh << ",";
-    query << data->hertz << ",";
-    query << data->tempcomp_volts << ")";
-    query << ends;
-#endif
-
 #ifdef __STDC_HOSTED__
     string str = query.str().c_str();
 #else
@@ -278,24 +232,7 @@ Database::queryInsert(meter_data_t *data)
   
     return true;
 }
-
-char *
-Database::gettime()
-{
-    struct timeval tp;
-    struct tm *tm, result;
-    static char tmpbuf[30];
- 
-    gettimeofday(&tp, 0);
-    tm = localtime_r(&(tp.tv_sec), &result);
-    asctime(tm);
-    memset(tmpbuf, 0, 20);
-     
-    strftime(tmpbuf, 20, "%Y-%m-%d %H:%M:%S", tm);
- 
-//    DBG_MSG(DBG_INFO, "TIMESTAMP is %s\n", tmpbuf);
-    return tmpbuf;
-}
+#endif
 
 // local Variables:
 // mode: C++

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=a9920f328c521315c288fc0432516ae2a1a89252


commit a9920f328c521315c288fc0432516ae2a1a89252
Author: Rob Savoye <address@hidden>
Date:   Wed Nov 21 19:35:22 2018 -0700

    Move gettimeofday function to here

diff --git a/lib/database.h b/lib/database.h
index 3f88c59..fc6d971 100644
--- a/lib/database.h
+++ b/lib/database.h
@@ -29,18 +29,16 @@
 #include <list>
 #include <iomanip> 
 #include <vector>
+#include <sys/time.h>
 
-//#include "database.h"
-
-#ifdef HAVE_MYSQL
-#include <mysql/errmsg.h>
-#include <mysql/mysql.h>
-//#else
-//#warning "You need to install MySQL for data base support"
+#ifdef HAVE_MARIADB
+# include <mysql/errmsg.h>
+# include <mysql/mysql.h>
 #endif
 
-// This shuts up warnings about these constants not being used.
-#pragma GCC system_header
+#ifdef HAVE_LIBPQ
+# include <libpq-fe.h>
+#endif
 
 static const char *DBTABLE = "powerguru";
 static const char *DBNAME  = "powerguru";
@@ -52,6 +50,7 @@ enum dbtype {NODB, DBDATABASE, DBPGSQL, DBODBC, DBGDBM, 
DBSTL};
 
 typedef enum { NO_DEVICE, MX_OUTBACK, FX_OUTBACK, SW_XANTREX } device_t;
 
+#ifdef HAVE_LIBXML
 typedef struct
 {
     int   unit;                   // The unit number for the device
@@ -76,6 +75,7 @@ typedef struct
     // compensated. Xantrex Only.
   
 }  meter_data_t ;
+#endif
 
 class Database
 {
@@ -83,15 +83,29 @@ public:
     Database();
     ~Database();
   
+    std::string &gettime(std::string &time) {
+        struct timeval tp;
+        struct tm *tm, result;
+        char tmpbuf[30];  
+        gettimeofday(&tp, 0);
+        tm = localtime_r(&(tp.tv_sec), &result);
+        asctime(tm);
+        memset(tmpbuf, 0, 20);
+        strftime(tmpbuf, 20, "%Y-%m-%d %H:%M:%S", tm);
+//    DBG_MSG(DBG_INFO, "TIMESTAMP is %s\n", tmpbuf);
+        time = tmpbuf;
+        return time;
+    }
+
     bool openDB ();
     bool closeDB ();
     bool queryInsert(std::vector<meter_data_t *> data);
+    //bool queryInsert(temperature_t &data);
     bool queryInsert(meter_data_t *data);
-    bool queryInsert(const char *query);
+    bool queryInsert(const std::string &query);
     void *queryResults(const char *query);
     //bool deleteDB(etamsg_t *data);
     //bool insertDB(etamsg_t *data);
-    char *gettime();
 
     // Accessors
     void dbUserSet(std::string user);
@@ -111,8 +125,8 @@ private:
     MYSQL           *_connection;
     MYSQL           _mysql;
 #endif
-#ifdef LIBPQ
-    bool           *_connection;
+#ifdef HAVE_LIBPQ
+    PGconn           *_connection;
 #endif
 };
 

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=46e8c00d57d0993c781047af91caf6fd70e3f571


commit 46e8c00d57d0993c781047af91caf6fd70e3f571
Author: Rob Savoye <address@hidden>
Date:   Wed Nov 21 19:33:41 2018 -0700

    Add include path to devices directory.

diff --git a/lib/Makefile.am b/lib/Makefile.am
index 1beab0b..5f13d7d 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -31,49 +31,44 @@ address@hidden@
 # These headers get installed
 # include_HEADERS = log.h err.h proc.h serial.h xantrex.h outback.h
 
-libpguru_la_CPPFLAGS = -I$(top_srcdir)
+libpguru_la_CPPFLAGS = -I$(top_srcdir)/devices
 libpguru_la_LIBDADD =
 
+libpguru_la_SOURCES = \
+       proc.cc proc.h \
+       err.cc err.h \
+       log.cc log.h \
+       rc.cc rc.h \
+       serial.cc serial.h \
+       console.cc console.h \
+       menuitem.cc menuitem.h \
+       database.h \
+       tcputil.cc tcputil.h \
+       tcpip.cc tcpip.h
+
 if BUILD_LIBXML
-XML_FILES = xml.cc xml.h msgs.cc msgs.h
+libpguru_la_SOURCES += xml.cc xml.h msgs.cc msgs.h
 libpguru_la_CPPFLAGS += $(LIBXML_CPPFLAGS)
 libpguru_la_LIBDADD += $(LIBXML_LIBS)
 endif
 
 if BUILD_SNMP
-SNMP_FILES = snmp.cc snmp.h
+libpguru_la_SOURCES += snmp.cc snmp.h
 libpguru_la_CPPFLAGS += -I$(top_srcdir)/snmp
 libpguru_la_LIBDADD += $(SNMP_LIBS) ../snmp/libpgsnmp.la
 endif
 
 if BUILD_MARIADB
-MARIADB_FILES = mariadb.cc
+libpguru_la_SOURCES += mariadb.cc
 libpguru_la_LIBDADD += $(MARIADB_LIBS)
 endif
 
 if BUILD_POSTGRESQL
-LIBPQ_FILES = postgresql.cc
-libpguru_la_CPPFLAGS += ${LIBPQ_CPPFLAGS}
-libpguru_la_LIBDADD +=  $(LIBPQ_LIBS)
+libpguru_la_SOURCES += postgresql.cc
+libpguru_la_CPPFLAGS += $(PQ_CPPFLAGS)
+libpguru_la_LIBDADD +=  $(PQ_LIBS)
 endif
 
-libpguru_la_SOURCES = \
-       proc.cc proc.h \
-       err.cc err.h \
-       log.cc log.h \
-       rc.cc rc.h \
-       serial.cc serial.h \
-       console.cc console.h \
-       menuitem.cc menuitem.h \
-       database.h \
-       $(SNMP_FILES) \
-       $(LIBPQ_FILES) \
-       $(MARIADB_FILES) \
-       $(XML_FILES) \
-       tcputil.cc tcputil.h \
-       tcpip.cc tcpip.h
-#      sem.cc sem.h
-
 include_HEADERS = \
        proc.h \
        serial.h \

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=a04e60e8e18501d70822d555dd70861a2f10c8b6


commit a04e60e8e18501d70822d555dd70861a2f10c8b6
Author: Rob Savoye <address@hidden>
Date:   Wed Nov 21 19:32:51 2018 -0700

    For ownet thread, build query and add data to database.

diff --git a/daemon/threads.cc b/daemon/threads.cc
index 1c7071e..d03231c 100644
--- a/daemon/threads.cc
+++ b/daemon/threads.cc
@@ -43,33 +43,76 @@ extern char *optarg;
 #include "log.h"
 #include "err.h"
 #include "ownet.h"
+#include "console.h"
+#include "database.h"
 
 extern LogFile dbglogfile;
 
 using namespace std::chrono_literals;
 
+#if 0
+void
+console_handler(Console &con)
+{
+    DEBUGLOG_REPORT_FUNCTION;
+    while ((ch = con.Getc()) != 'q') {
+        if (ch > 0) {                // If we have something, process it
+            con.Putc (ch);          // echo inputted character to screen
+            switch (ch) {
+              case 'Q':
+              case 'q':
+                  con.Puts("Qutting PowerGuru due to user input!\n");
+                  msg.writeNet("quit");
+                  con.Reset();
+                  exit(0);
+                  break;
+              case '?':
+                  con.Puts("PowerGuru client\n");
+                  con.Puts("\t? - help\r\n");
+                  con.Puts("\tq - Quit\r\n");
+                  con.Puts("\tQ - Quit\r\n");
+                  sleep(2);
+              default:
+                  break;
+            };
+        }
+
+}
+#endif
+
+//#if defined(HAVE_LIBPQ) && defined(HAVE_MARIADB)
+void
+msg_handler(Database &db)
+{
+    DEBUGLOG_REPORT_FUNCTION;
+}
+//#endif
+
 #ifdef BUILD_OWNET
 void
 ownet_handler(pdev::Ownet &ownet)
 {
     DEBUGLOG_REPORT_FUNCTION;
     dbglogfile << "PowerGuru - 1 Wire Mode" << std::endl;
-    //dev::Ownet ownet;
-    //ownet.dump();
     bool poll = true;
-    
-    std::map<std::string, pdev::ownet_t> sensors = ownet.getSensors();
-    std::map<std::string, pdev::ownet_t>::iterator it;
-    while (poll) {
+
+    // Open the network connection to the database.
+    std::string query = "INSERT INTO onewire VALUES(";
+    query += "";
+    query += ");";
+
+    std::map<std::string, pdev::ownet_t *> sensors = ownet.getSensors();
+    std::map<std::string, pdev::ownet_t *>::iterator it;
+    while (ownet.getPollSleep() != 0) {
         for (it = sensors.begin(); it != sensors.end(); it++) {
-            if (it->second.family == "10") {
+            if (it->second->family == "10") {
                 ownet.getTemperature(it->first.c_str());
             }
         }
         ownet.dump();
         
         // Don't eat up all the cpu cycles!
-        std::this_thread::sleep_for(std::chrono::seconds(2));
+        
std::this_thread::sleep_for(std::chrono::seconds(ownet.getPollSleep()));
     }
 }
 #endif
@@ -80,7 +123,9 @@ outback_handler(pdev::Ownet &ownet)
 {
     DEBUGLOG_REPORT_FUNCTION;
 
-    dbglogfile << "FIXME: unimplementd"<< std::endl;
+    dbglogfile << "FIXME: outback_handler() unimplementd"<< std::endl;
+    // Don't eat up all the cpu cycles!
+    std::this_thread::sleep_for(std::chrono::seconds(ownet.getPollSleep()));
 }
 #endif
 
@@ -90,7 +135,9 @@ xantrex_handler(pdev::Ownet &ownet)
 {
     DEBUGLOG_REPORT_FUNCTION;
 
-    dbglogfile << "FIXME: unimplemented"<< std::endl;
+    dbglogfile << "FIXME: xantrext_handler() unimplemented"<< std::endl;
+    // Don't eat up all the cpu cycles!
+    std::this_thread::sleep_for(std::chrono::seconds(ownet.getPollSleep()));
 }
 #endif
 

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=11eb570b9bd70fcb175bb6397850711845a4ac6d


commit 11eb570b9bd70fcb175bb6397850711845a4ac6d
Author: Rob Savoye <address@hidden>
Date:   Wed Nov 21 19:29:56 2018 -0700

    Add libpq flags

diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 7a5ffcc..77be297 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -36,6 +36,11 @@ if BUILD_OWNET
 pgd_LDADD += $(OWNET_LIBS)
 endif
 
+if BUILD_POSTGRESQL
+pgd_CPPFLAGS += $(PQ_CPPFLAGS)
+pgd_LDADD += $(PQ_LIBS)
+endif
+
 bin_PROGRAMS = pgd
 
 pgd_SOURCES = main.cc threads.cc

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=21fcf45d89967ee70ae157bdc0457a88b7d20dd8


commit 21fcf45d89967ee70ae157bdc0457a88b7d20dd8
Author: Rob Savoye <address@hidden>
Date:   Wed Nov 21 19:27:54 2018 -0700

    Add libpq flags

diff --git a/devices/Makefile.am b/devices/Makefile.am
index a110e9a..0cd287b 100644
--- a/devices/Makefile.am
+++ b/devices/Makefile.am
@@ -54,6 +54,11 @@ libpdev_la_SOURCES += ownet.cc ownet.h
 libpdev_la_LIBDADD += $(OWNET_LIBS)
 endif
 
+if BUILD_POSTGRESQL
+libpdev_la_CPPFLAGS += $(PQ_CPPFLAGS)
+libpdev_la_LIBDADD +=  $(PQ_LIBS)
+endif
+
 include_HEADERS = \
        xantrex-trace.h \
        outbackpower.h \

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=e446109b34e052846c8e42ffa16a9d774ebe4975


commit e446109b34e052846c8e42ffa16a9d774ebe4975
Author: Rob Savoye <address@hidden>
Date:   Wed Nov 21 19:27:22 2018 -0700

    default db= to none. Tweak PQ flags.

diff --git a/configure.ac b/configure.ac
index d082b61..c5114f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,6 +131,11 @@ AC_PATH_PROG(DOXYGEN, doxygen)
 AM_CONDITIONAL(ENABLE_DOXYGEN, [ test x"$DOXYGEN" != x ])
 
 sysroot="${sysroot:-`${CXX} -print-sysroot`}"
+dnl We don't need a sysroot for native builds
+if test x"${sysroot}" = x"/"; then
+   sysroot=""
+fi
+
 AC_ARG_WITH(sysroot,
   AC_HELP_STRING([--with-sysroot], [system root directory for cross 
compiling]),
   sysroot=${withval};
@@ -222,9 +227,14 @@ AM_CONDITIONAL(BUILD_LIBXML, [ test x${has_libxml} = xtrue 
])
 dnl GNU_PKG_FIND(libxml2, [libxml/xmlstring.h], [libxml2], xmlNewReference)
 
 dnl libpq. FIXME: add libpqcxx
-db=mariadb
+db=none
 LDFLAGS="${save_LDFLAGS} -lpq"
-CPPFLAGS="-I${sysroot}/usr/include/postgresql/9.6/server/libpq"
+if test ${sysroot}/usr/include/postgresql/9.6/server/libpq; then
+   CPPFLAGS="-I${sysroot}/usr/include/postgresql/9.6/server/libpq"
+fi
+if test ${sysroot}/usr/include/postgresql; then
+   CPPFLAGS="-I${sysroot}/usr/include/postgresql"
+fi
 AC_MSG_CHECKING([For postgresql development files])
 AC_TRY_COMPILE([#include <libpq-fe.h>], [
   PQpass(0);
@@ -235,11 +245,11 @@ AC_TRY_COMPILE([#include <libpq-fe.h>], [
 AC_MSG_RESULT([${has_libpq}])
 if test x"${has_libpq}" = x"true"; then
   AC_DEFINE([HAVE_LIBPQ], [1], [Has postgresql development files])
-  LIBPQ_LIBS="-lpq"
-  LIBPQ_CPPFLAGS="-I${sysroot}/usr/include/postgresql/9.6/server/libpq"
+  PQ_LIBS="-lpq"
+  PQ_CPPFLAGS="${CPPFLAGS}"
   db=postgresql
-  AC_SUBST(LIBPQ_CPPFLAGS)
-  AC_SUBST(LIBPQ_LIBS)
+  AC_SUBST(PQ_CPPFLAGS)
+  AC_SUBST(PQ_LIBS)
 fi
 AM_CONDITIONAL(BUILD_POSTGRESQL, [ test x${has_libpq} = xtrue ])
 

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=7a088d5712c5b508ca896122346aa10bd09493b4


commit 7a088d5712c5b508ca896122346aa10bd09493b4
Author: Rob Savoye <address@hidden>
Date:   Wed Nov 21 12:47:00 2018 -0700

    Add defines for optional devices

diff --git a/daemon/threads.cc b/daemon/threads.cc
index 934b0a1..1c7071e 100644
--- a/daemon/threads.cc
+++ b/daemon/threads.cc
@@ -48,6 +48,7 @@ extern LogFile dbglogfile;
 
 using namespace std::chrono_literals;
 
+#ifdef BUILD_OWNET
 void
 ownet_handler(pdev::Ownet &ownet)
 {
@@ -71,7 +72,9 @@ ownet_handler(pdev::Ownet &ownet)
         std::this_thread::sleep_for(std::chrono::seconds(2));
     }
 }
+#endif
 
+#ifdef BUILD_OUTBACK
 void
 outback_handler(pdev::Ownet &ownet)
 {
@@ -79,7 +82,9 @@ outback_handler(pdev::Ownet &ownet)
 
     dbglogfile << "FIXME: unimplementd"<< std::endl;
 }
+#endif
 
+#ifdef BUILD_XANTREX
 void
 xantrex_handler(pdev::Ownet &ownet)
 {
@@ -87,6 +92,7 @@ xantrex_handler(pdev::Ownet &ownet)
 
     dbglogfile << "FIXME: unimplemented"<< std::endl;
 }
+#endif
 
 // local Variables:
 // mode: C++

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=c6af2d6f7da53eb8d3bda06e953fce460588e436


commit c6af2d6f7da53eb8d3bda06e953fce460588e436
Author: Rob Savoye <address@hidden>
Date:   Wed Nov 21 12:46:41 2018 -0700

    Add defines for optional devices

diff --git a/configure.ac b/configure.ac
index 033eebb..d082b61 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,8 +95,17 @@ AC_SUBST(BUILD_OUTBACK)
 AC_SUBST(BUILD_XANTREX)
 
 AM_CONDITIONAL(BUILD_OWNET, [ test x${BUILD_OWNET} = xyes ])
+if test x${BUILD_OWNET} = xyes; then
+   AC_DEFINE([BUILD_OWNET], [1], [Buikd support for owfs])
+fi
 AM_CONDITIONAL(BUILD_OUTBACK, [ test x${BUILD_OUTBACK} = xyes ])
+if test x${BUILD_OUTBACK} = xyes; then
+   AC_DEFINE([BUILD_OUTBACK], [1], [Build support for the Outback protocol])
+fi
 AM_CONDITIONAL(BUILD_XANTREX, [ test x${BUILD_XANTREX} = xyes ])
+if test x${BUILD_XANTREX} = xyes; then
+   AC_DEFINE([BUILD_XANTREX], [1], [Build support for the Xantrex protocol])
+fi
 
 db="none"
 AC_ARG_WITH(db, [  --with-db          database to use, mariadb or the default 
of postgresql],

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=4004fca4cc3708bb826b02b4c5fd8f30363c0b19


commit 4004fca4cc3708bb826b02b4c5fd8f30363c0b19
Author: Rob Savoye <address@hidden>
Date:   Wed Nov 21 12:37:56 2018 -0700

    Add libs for ownet

diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 5104c64..7a5ffcc 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -21,7 +21,7 @@
 AUTOMAKE_OPTIONS = # dejagnu
 
 pgd_CPPFLAGS = -Wall -I$(top_srcdir)/lib -I$(top_srcdir)/devices
-pgd_LDADD = ../devices/libpdev.la ../lib/libpguru.la 
+pgd_LDADD = ../devices/libpdev.la ../lib/libpguru.la -lpthread
 
 if BUILD_LIBXML
 pgd_CPPFLAGS += $(LIBXML_CPPFLAGS)
@@ -32,9 +32,13 @@ if BUILD_SNMP
 pgd_LDADD += ../snmp/libpgsnmp.la $(SNMP_LIBS)
 endif
 
+if BUILD_OWNET
+pgd_LDADD += $(OWNET_LIBS)
+endif
+
 bin_PROGRAMS = pgd
 
-pgd_SOURCES = main.cc
+pgd_SOURCES = main.cc threads.cc
 pgd_LDFLAGS = -export-dynamic -ldl
 
 # MUDFLAP_OPT = -fmudflap

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=3242aefe350320e240dab2721beb6fe7b25b6669


commit 3242aefe350320e240dab2721beb6fe7b25b6669
Author: Rob Savoye <address@hidden>
Date:   Wed Nov 21 12:36:45 2018 -0700

    Add thread support

diff --git a/daemon/main.cc b/daemon/main.cc
index f973d7d..35e90d0 100644
--- a/daemon/main.cc
+++ b/daemon/main.cc
@@ -28,6 +28,9 @@
 #include <sstream>
 #include <signal.h>
 #include <errno.h>
+#include <thread>
+#include <mutex>
+#include <condition_variable>
 
 #ifdef HAVE_GETOPT_H
 #include <getopt.h>
@@ -39,8 +42,15 @@ extern char *optarg;
 // local header files
 #include "log.h"
 #include "err.h"
+//#ifdef BUILD_XANTREX
 #include "xantrex-trace.h"
+//#endif
+#ifdef BUILD_OUTBACK
 #include "outbackpower.h"
+#endif
+//#ifdef BUILD_OWNET
+#include "ownet.h"
+//#endif
 #include "console.h"
 #include "menuitem.h"
 #include "database.h"
@@ -52,7 +62,6 @@ extern char *optarg;
 
 using namespace std;
 using namespace rcinit;
-using namespace pdev;
 
 static void usage (const char *);
 extern LogFile dbglogfile;
@@ -63,6 +72,10 @@ alarm_handler2 (int sig);
 
 int curses = 0;
 
+extern void ownet_handler(pdev::Ownet &);
+extern void outback_handler(pdev::Ownet &);
+extern void xantrex_handler(pdev::Ownet &);
+
 int
 main(int argc, char *argv[])
 {
@@ -72,21 +85,23 @@ main(int argc, char *argv[])
     const char *filespec;
     MenuItem ti;
     string hostname;
+    bool poll;
     bool console;
+    bool use_db;
+    bool snmp;
+    bool daemon;
+    bool client;
+    bool echo;
+#if 0
     bool setitem;
     bool getitem;
-    bool echo;
     bool monitor;
-    bool poll;
     bool outbackmode;
     bool xantrexmode;
-    bool use_db;
-    bool snmp;
     bool background;
-    bool daemon;
-    bool client;
+#endif
     retcode_t   ret;
-
+    std::condition_variable alldone;
 #if defined(HAVE_MARIADB) && defined(HAVE_POSTGRESQL)
     Database pdb;
 #endif
@@ -112,20 +127,21 @@ main(int argc, char *argv[])
     // Set the option flags to default values. We do it this way to
     // shut up GCC complaining they're not used.
     console = false;
+    poll = false;
+    daemon = true;
+    client = false;
+    echo = false;
+    use_db = true;
+    snmp = false;
+#if 0
     setitem = false;
     getitem = false;
-    echo = false;
     monitor = false;
-    poll = false;
     outbackmode = false;
     xantrexmode = false;
-    use_db = true;
-    snmp = false;
     background = false;
-    daemon = true;
-    client = false;
     hostname = "localhost";
-    
+#endif
     // Load the database config variable so they can be overridden by
     // the command line arguments.
     RCinitFile config;
@@ -155,7 +171,7 @@ main(int argc, char *argv[])
         switch (c) {
           case 'p':
               poll = true;
-              xantrexmode = true;     // FIXME: force xantrex mode for now
+              //xantrexmode = true;     // FIXME: force xantrex mode for now
               break;
 
 #if 0
@@ -185,15 +201,15 @@ main(int argc, char *argv[])
 
           case 'x':
               //console = true;
-              xantrexmode = true;
+              //xantrexmode = true;
               break;
 
           case 'o':
-              outbackmode = true;
+              //outbackmode = true;
               break;
 
           case 'r':
-              background = true;
+              //background = true;
               break;
 
 #ifdef USE_SNMP
@@ -266,96 +282,47 @@ main(int argc, char *argv[])
     }
 #endif
 
-    // Talk to an Outback Power Systems device
-    if (outbackmode) {
-        Console con;
-        // Open a console for user input
-        con.Open();
-    
-        con.Puts("PowerGuru - Outback Mode\r\n");
-        //outback outdev("/dev/pts/7");
-        outback outdev(filespec);
-        if (poll) {
-            // outdev.poll();
-#if defined(HAVE_MARIADB) && defined(HAVE_POSTGRESQL)
-        } else {
-            if (outdev.main(con, pdb) == ERROR) {
-                dbglogfile << "ERROR: Main Loop exited with an error!" << endl;
-            }
+    Console con;
+    // Open a console for user input
+    con.Open();
+
+    dbglogfile << "PowerGuru - 1 Wire Mode" << std::endl;
+    pdev::Ownet ownet;
+//#ifdef BUILD_OWNET
+    std::thread first (ownet_handler, std::ref(ownet));     // spawn new 
thread that calls foo()
+//#endif
+#ifdef BUILD_OUTBACK
+    std::thread second (outback_handler, std::ref(ownet));  // spawn new 
thread that calls bar(0)
 #endif
-        }
-        con.Reset();
-        con.Close();
-        exit(0);
-    }
-
-    if (xantrexmode) {
-        XantrexUI ui;
-        Console con;
-        // Open a console for user input
-        con.Open();
-        if (poll) {
-            // Open the serial port
-            try {
-                ui.Open(filespec);
-            }
-            catch (ErrCond catch_err) {
-                cerr << catch_err << endl;
-                exit(1);
-            }
-            //
-            for (i=0; i<1000; i++) {        
-                //display = ui.MenuHeadingPlus();
-#if 0
-                ch = con.Getc();
-                switch (ch) {
-                    // Toggle the DTR state, which is as close as we get to
-                    // flow control.
-                  case 'Q':
-                  case 'q':
-                      return SUCCESS;
-                      break;
-                  case '?':
-                      con.Puts("PowerGuru - Outback Mode\r\n");
-                      con.Puts("\t? - help\r\n");
-                      con.Puts("\tq - Quit\r\n");
-                      con.Puts("\tQ - Quit\r\n");
-                      sleep(2);
-                  default:
-                      break;
-                };
+#ifdef BUILD_XANTREX
+    std::thread third (xantrex_handler, std::ref(ownet));  // spawn new thread 
that calls bar(0)
 #endif
-
-                vector<meter_data_t *> data = ui.PollMeters(1);
-//           ui.MenuHeadingPlus();
-//           ui.MenuHeadingMinus();          
-#if defined(HAVE_MARIADB) && defined(HAVE_POSTGRESQL)
-                pdb.queryInsert(data);
+    
 #if 0
-                for (i=0; i<data->size(); i++) {
-                    //cout << "Inverter/Charger amps: " << 
data[i]->inverter_amps << endl;
-                    cout << "Input amps AC: " << data[i]->input_amps << endl;
-                    cout << "Load  amps AC: " << data[i]->load_amps << endl;
-                    cout << "Battery actual volts DC: " << 
data[i]->actual_volts << endl;
-                    cout << "Battery TempComp volts DC: " << 
data[i]->tempcomp_volts << endl;
-                    cout << "Inverter volts AC: " << data[i]->inverter_volts 
<< endl;
-                    cout << "Grid (AC1) volts AC: " << data[i]->ac1 << endl;
-                    cout << "Generator (AC2) volts AC: " << data[i]->ac2 << 
endl;
-                    cout << "Read Frequency Hertz: " << data[i]->hertz << endl;
-                    //pdb.queryInsert(data[i]);
-                    //delete data[i];
-                }
-#endif
-#endif
-                //sleep(1);
-                cout << endl;
+    //if (poll) {
+    int ch;
+    while ((ch = con.Getc()) != 'q') {
+        if (ch > 0) {                // If we have something, process it
+            con.Putc (ch);          // echo inputted character to screen
+            switch (ch) {
+              case '?':
+                  con.Puts("Powerguru daemon\r\n");
+                  con.Puts("\t? - help\r\n");
+                  con.Puts("\r\n");
+                  break;
+              case 'q':
+                  exit(0);
+              case 'r':
+                  std::cout << "XXXXXX: " << 
ownet.getValue("/10.67C6697351FF", "/temperature") << std::endl;
+                  break;
+              case 'd':
+                  ownet.dump();
+                  break;
             }
         }
-        con.Reset();
-        con.Close();
-        exit(0);
     }
 
+#endif
 #if defined(HAVE_MARIADB) && defined(HAVE_POSTGRESQL)
     if (use_db) {
         if (!pdb.closeDB()) {
@@ -364,7 +331,6 @@ main(int argc, char *argv[])
         }
     }
 #endif
-    
     // Network daemon/client mode. Normally we're a network daemon that
     // responses to requests by a remote client. Many house networks
     // are behind a firewall, so the daemon can also connect to a
@@ -432,6 +398,19 @@ main(int argc, char *argv[])
             messages.clear();
         }
     }
+    con.Reset();
+    con.Close();
+
+    // synchronize threads:
+    first.join();                // pauses until first finishes
+#ifdef BUILD_OUTBACK
+    second.join();               // pauses until second finishes
+#endif
+#ifdef BUILD_XANTREX
+    third.join();               // pauses until third finishes
+#end
+
+    exit(0);
 }
 
 

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=b476eda834048c9b96c91069189eb5c8c2712016


commit b476eda834048c9b96c91069189eb5c8c2712016
Author: Rob Savoye <address@hidden>
Date:   Wed Nov 21 12:33:40 2018 -0700

    refactor handing of temperture data

diff --git a/devices/ownet.h b/devices/ownet.h
index 014a1af..ef03b0c 100644
--- a/devices/ownet.h
+++ b/devices/ownet.h
@@ -24,6 +24,7 @@
 # include "config.h"
 #endif
 
+#include <mutex>
 #include <string>
 #include <vector>
 #include <map>
@@ -42,12 +43,22 @@ struct ownet {
     std::string device;
 } typedef ownet_t;
 
+struct temperature {
+    //ownet_t ownet;
+    float temp;
+    float lowtemp;
+    float hightemp;
+} typedef temperature_t;
+
 class Ownet {
-public:
+private:
     enum family_t {CONTROL = 05, THERMOMETER = 10, THERMOMETER2 = 28};
-    std::map<std::string, ownet_t > _sensors;
+    std::map<std::string, ownet_t> _sensors;
     bool _owserver = false;
+    std::map<std::string, temperature_t *> _temperatures;
+    std::mutex _mutex;
 
+public:
     bool isConnected(void) {
         return _owserver;
     }
@@ -60,31 +71,66 @@ public:
         }
     }
 
-    std::string getValue(const char *device, std::string file) {
-        // DEBUGLOG_REPORT_FUNCTION;
+    std::string getValue(const std::string &device, std::string file) {
+//        DEBUGLOG_REPORT_FUNCTION;
         char * buf;
         size_t s  = 0;
 
         std::string data = device + file;
-        //dbglogfile << "Looking for: " << data;
+        //std::cout << "Looking for: " << data;
         int ret = OW_get(data.c_str(), &buf, &s);
-        //dbglogfile << ", Got: " <<  buf << std::endl;
         if (ret <= 0) {
             return std::string();
+            //} else {
+            //std::cout << ", Got(" << s << "): " <<  buf << std::endl;
         }
 
-        return std::string(buf);
+        std::string bar(buf);
+        free(buf);
+
+        return bar;
+    }
+
+    std::map<std::string, ownet_t> &getSensors(void) {
+        return _sensors;
+    }
+
+    temperature_t *getTemperature(const std::string &device) {
+        DEBUGLOG_REPORT_FUNCTION;
+
+        std::string family = getValue(device, "family");
+
+        temperature_t *temp = 0;
+        if (family == "10") {
+            dbglogfile << device << " is a thermometer" << std::endl;
+            temp = new temperature_t[1];
+            temp->temp = std::stof(getValue(device, "temperature"));
+            temp->lowtemp =std::stof(getValue(device, "templow"));
+            temp->hightemp = std::stof(getValue(device, "temphigh"));
+            std::lock_guard<std::mutex> guard(_mutex);
+            _temperatures[device] = temp;
+        } else {
+            dbglogfile << device << " is not a thermometer" << std::endl;
+        }
+        return temp;
     }
+
 #if 1
     void dump(void) {
         DEBUGLOG_REPORT_FUNCTION;
 
-        std::map<std::string, ownet_t>::iterator it;
-        for (it = _sensors.begin(); it != _sensors.end(); it++) {
-            std::cout << "Data for device: " << it->first << std::endl;
-            std::cout << "\tfamily: " << it->second.family << std::endl;
-            std::cout << "\ttype: " << it->second.type << std::endl;
-            std::cout << "\tid: " << it->second.id << std::endl;
+        std::map<std::string, ownet_t>::iterator sit;
+        for (sit = _sensors.begin(); sit != _sensors.end(); sit++) {
+            std::cout << "Data for device: " << sit->first << std::endl;
+            std::cout << "\tfamily: " << sit->second.family << std::endl;
+            std::cout << "\ttype: " << sit->second.type << std::endl;
+            std::cout << "\tid: " << sit->second.id << std::endl;
+        }
+        std::map<std::string, temperature_t *>::iterator tit;
+        for (tit = _temperatures.begin(); tit != _temperatures.end(); tit++) {
+            std::cout << "Current temperature: " << tit->second->temp << 
std::endl;
+            std::cout << "Low temperture: " << tit->second->lowtemp << 
std::endl;
+            std::cout << "High Temperature: " << tit->second->hightemp << 
std::endl;
         }
     }
 #else
@@ -92,6 +138,7 @@ public:
 #endif
     Ownet(void) {
         DEBUGLOG_REPORT_FUNCTION;
+
         dbglogfile << "Trying to connect to the owserver" << std::endl;
         char *buf = 0;
         size_t s  = 0;
@@ -145,6 +192,12 @@ public:
             std::string dev = *it + "temperature";
             if (OW_present(dev.c_str()) == 0) {
                 dbglogfile << "Temperature sensor found: " << *it << std::endl;
+                temperature_t *temp= new temperature_t[1];
+
+                temp->temp = std::stof(getValue(*it, "temperature"));
+                temp->lowtemp = std::stof(getValue(*it, "templow"));
+                temp->hightemp = std::stof(getValue(*it, "temphigh"));
+                _temperatures[*it] = temp;
             } else {
                 dbglogfile << "Temperature sensor not found!" << std::endl;
             }

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=5b038c3aa182d2c97890068dae5f9425d7f4cac4


commit 5b038c3aa182d2c97890068dae5f9425d7f4cac4
Author: Rob Savoye <address@hidden>
Date:   Wed Nov 21 12:30:55 2018 -0700

    Add thread functions

diff --git a/daemon/threads.cc b/daemon/threads.cc
new file mode 100644
index 0000000..934b0a1
--- /dev/null
+++ b/daemon/threads.cc
@@ -0,0 +1,94 @@
+// 
+// Copyright (C) 2018 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifdef HAVE_CONFIG_H
+// This is generated by autoconf.
+# include "config.h"
+#endif
+
+#include <cstring>
+#include <vector>
+#include <stdlib.h>
+#include <unistd.h>
+#include <termios.h>
+#include <sstream>
+#include <signal.h>
+#include <errno.h>
+#include <thread>
+#include <condition_variable>
+#include <mutex>
+#include <chrono>
+
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#else
+extern int optind;
+extern char *optarg;
+#endif
+
+#include "log.h"
+#include "err.h"
+#include "ownet.h"
+
+extern LogFile dbglogfile;
+
+using namespace std::chrono_literals;
+
+void
+ownet_handler(pdev::Ownet &ownet)
+{
+    DEBUGLOG_REPORT_FUNCTION;
+    dbglogfile << "PowerGuru - 1 Wire Mode" << std::endl;
+    //dev::Ownet ownet;
+    //ownet.dump();
+    bool poll = true;
+    
+    std::map<std::string, pdev::ownet_t> sensors = ownet.getSensors();
+    std::map<std::string, pdev::ownet_t>::iterator it;
+    while (poll) {
+        for (it = sensors.begin(); it != sensors.end(); it++) {
+            if (it->second.family == "10") {
+                ownet.getTemperature(it->first.c_str());
+            }
+        }
+        ownet.dump();
+        
+        // Don't eat up all the cpu cycles!
+        std::this_thread::sleep_for(std::chrono::seconds(2));
+    }
+}
+
+void
+outback_handler(pdev::Ownet &ownet)
+{
+    DEBUGLOG_REPORT_FUNCTION;
+
+    dbglogfile << "FIXME: unimplementd"<< std::endl;
+}
+
+void
+xantrex_handler(pdev::Ownet &ownet)
+{
+    DEBUGLOG_REPORT_FUNCTION;
+
+    dbglogfile << "FIXME: unimplemented"<< std::endl;
+}
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=96e4c3ea16b80ccdd6dac780858d360a7380b0a9


commit 96e4c3ea16b80ccdd6dac780858d360a7380b0a9
Author: Rob Savoye <address@hidden>
Date:   Tue Nov 20 15:43:53 2018 -0700

    Add table for 1 wire data

diff --git a/powerguru.sql b/powerguru.sql
index 389c18d..3549a76 100644
--- a/powerguru.sql
+++ b/powerguru.sql
@@ -1,5 +1,6 @@
 -- 
---   Copyright (C) 2005 Free Software Foundation, Inc.
+--   Copyright (C) 2005, 2006-2018
+--   Free Software Foundation, Inc.
 --
 --   This program is free software; you can redistribute it and/or modify
 --   it under the terms of the GNU General Public License as published by
@@ -33,26 +34,34 @@
 --
 -- Table structure for table `meters`
 --
+DROP TABLE IF EXISTS meters;
+CREATE TABLE meters (
+  unit integer NOT NULL default '0',
+  --device_type enum('NONE','MX','FX','SW') NOT NULL default 'NONE',
+  charge_amps integer NOT NULL default '0',
+  ac_load_amps integer NOT NULL default '0',
+  battery_volts float NOT NULL default '0',
+  ac_volts_out float NOT NULL default '0',
+  ac1_volts_in float NOT NULL default '0',
+  ac2_volts_in float NOT NULL default '0',
+  pv_amps_in integer NOT NULL default '0',
+  pv_volts_in float NOT NULL default '0',
+  buy_amps integer NOT NULL default '0',
+  sell_amps integer NOT NULL default '0',
+  daily_kwh float NOT NULL default '0',
+  hertz integer NOT NULL default '0',
+  battery_tempcomp float NOT NULL default '0'
+);
 
-DROP TABLE IF EXISTS `meters`;
-CREATE TABLE `meters` (
-  `unit` int(11) NOT NULL default '0',
-  `device_type` enum('NONE','MX','FX','SW') NOT NULL default 'NONE',
-  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update 
CURRENT_TIMESTAMP,
-  `charge_amps` int(11) NOT NULL default '0',
-  `ac_load_amps` int(11) NOT NULL default '0',
-  `battery_volts` float NOT NULL default '0',
-  `ac_volts_out` float NOT NULL default '0',
-  `ac1_volts_in` float NOT NULL default '0',
-  `ac2_volts_in` float NOT NULL default '0',
-  `pv_amps_in` int(11) NOT NULL default '0',
-  `pv_volts_in` float NOT NULL default '0',
-  `buy_amps` int(11) NOT NULL default '0',
-  `sell_amps` int(11) NOT NULL default '0',
-  `daily_kwh` float NOT NULL default '0',
-  `hertz` int(11) NOT NULL default '0',
-  `battery_tempcomp` float NOT NULL default '0'
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Stores data from data logging 
output';
+DROP TABLE IF EXISTS onewire;
+CREATE TABLE onewire (
+  family integer NOT NULL default '0',
+  id integer NOT NULL default '0',
+  type char(12) NOT NULL default '0',
+  temphigh float NOT NULL default '0',
+  templow float NOT NULL default '0',
+  temperature float NOT NULL default '0'
+);
 
 /*!40101 SET address@hidden */;
 /*!40014 SET address@hidden */;

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=8c873bb899d053ed63c2ed59a6d2f9954cd0a337


commit 8c873bb899d053ed63c2ed59a6d2f9954cd0a337
Author: Rob Savoye <address@hidden>
Date:   Tue Nov 20 14:49:15 2018 -0700

    Add in initial 1 wire device support.

diff --git a/client/cmd.cc b/client/cmd.cc
index 857f9c5..4b4a7e4 100644
--- a/client/cmd.cc
+++ b/client/cmd.cc
@@ -42,12 +42,20 @@
 #include "tcpip.h"
 #include "console.h"
 #include "msgs.h"
+#include "log.h"
+#include "ownet.h"
 
 using namespace std;
+//using namespace pdev;
+
 extern LogFile dbglogfile;
 static void usage (const char *);
 
 const int INBUFSIZE = 1024;
+namespace pdev {
+class Ownet;
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -60,7 +68,7 @@ main(int argc, char *argv[])
     string      passwd;
     char        *ptr;
     retcode_t   ret;
-    client = true;
+    client = false;
     daemon = false;
     hostname = "localhost";
 
@@ -137,73 +145,93 @@ main(int argc, char *argv[])
     con.Open();
 
     char *buffer;
-      
     buffer = (char *)new char[INBUFSIZE];
     memset(buffer, 0, INBUFSIZE);
+    Msgs msg;
 
-#if 0
-    cerr << "\rWelcome " << tcpip.remoteName()
-         << " at IP address: " << tcpip.remoteIP() << endl;
-    cerr << msg.status((meter_data_t *)0) << endl;
-#endif    
+    pdev::Ownet ownet;
+    if (ownet.isConnected()) {
+        if (ownet.hasSensors()) {
+            dbglogfile << "and has sensors attached" << std::endl;
+            ownet.dump();
+        } else {
+            dbglogfile << "and has no sensors attached" << std::endl;
+        }
+    }
 
-    Msgs msg;
-    msg.toggleDebug(true);
+    if (client == true || daemon == true) {
+#if 0
+        cerr << "\rWelcome " << tcpip.remoteName()
+             << " at IP address: " << tcpip.remoteIP() << endl;
+        cerr << msg.status((meter_data_t *)0) << endl;
+#endif
+        msg.toggleDebug(true);
+        std::cout << "Client or daemon not specified. exiting..." << std::endl;
+        exit(0);
+    }
+    //con.Puts("FIXME1\n");
 
     // Make a client connection
     if (client == true) {
-        msg.init(hostname);
+        ret = msg.init(hostname);
+        if (ret == ERROR) {
+            dbglogfile << "BARF" << std::endl;
+        }
         msg.checkConsole();
     }
 
     // Start as a daemon
     if (daemon == true) {
-        msg.init(true);
+        ret = msg.init(true);
+        if (ret == ERROR) {
+            dbglogfile << "BARF" << std::endl;
+        }
     }
     //msg.methodsDump();          // FIXME: debugging crap
     
     //msg.print_msg(msg.status((meter_data_t *)0));
 
-    if (client) {
-        msg.writeNet(msg.metersRequestCreate(Msgs::BATTERY_VOLTS));
-    }
+//    if (client) {
+//        msg.writeNet(msg.metersRequestCreate(Msgs::BATTERY_VOLTS));
+//    }
 
     // msg.cacheDump();
     
     while ((ch = con.Getc()) != 'q') {
-        if (ch > 0){                // If we have something, process it
+        if (ch > 0) {                // If we have something, process it
             //con.Putc (ch);          // echo inputted character to screen
         
             switch (ch) {
                 // Toggle the DTR state, which is as close as we get to
                 // flow control.
-              case 's':
-                  if (client) {
-#if 0
-                      //sleep(1);
-                      
msg.writeNet(msg.metersRequestCreate(Msgs::AC1_VOLTS_IN));
-                      //sleep(1);
-                      msg.writeNet(msg.metersRequestCreate(Msgs::CHARGE_AMPS));
-                      //sleep(1);
-                      
msg.writeNet(msg.metersRequestCreate(Msgs::AC_LOAD_AMPS));
-                      //sleep(1);
-                      msg.writeNet(msg.metersRequestCreate(Msgs::PV_AMPS_IN));
-                      //sleep(1);
-                      msg.writeNet(msg.metersRequestCreate(Msgs::SELL_AMPS));
-                      //            msg.writeNet(msg.requestCreate(""));
-#else            
-                      msg.writeNet(msg.requestCreate(Msgs::REVISION));
-                      msg.writeNet(msg.requestCreate(Msgs::SYSVERSION));
-                      msg.writeNet(msg.requestCreate(Msgs::OPMODE));
-                      msg.writeNet(msg.requestCreate(Msgs::WARNINGMODE));
-                      msg.writeNet(msg.requestCreate(Msgs::ERRORMODE));
-#endif
-                  }
-                  break;
+//               case 's':
+//                   if (client) {
+// #if 0
+//                       //sleep(1);
+//                       
msg.writeNet(msg.metersRequestCreate(Msgs::AC1_VOLTS_IN));
+//                       //sleep(1);
+//                       
msg.writeNet(msg.metersRequestCreate(Msgs::CHARGE_AMPS));
+//                       //sleep(1);
+//                       
msg.writeNet(msg.metersRequestCreate(Msgs::AC_LOAD_AMPS));
+//                       //sleep(1);
+//                       
msg.writeNet(msg.metersRequestCreate(Msgs::PV_AMPS_IN));
+//                       //sleep(1);
+//                       
msg.writeNet(msg.metersRequestCreate(Msgs::SELL_AMPS));
+//                       //            msg.writeNet(msg.requestCreate(""));
+// #else            
+//                       msg.writeNet(msg.requestCreate(Msgs::REVISION));
+//                       msg.writeNet(msg.requestCreate(Msgs::SYSVERSION));
+//                       msg.writeNet(msg.requestCreate(Msgs::OPMODE));
+//                       msg.writeNet(msg.requestCreate(Msgs::WARNINGMODE));
+//                       msg.writeNet(msg.requestCreate(Msgs::ERRORMODE));
+// #endif
+//                   }
+//                   break;
               case 'Q':
               case 'q':
                   con.Puts("Qutting PowerGuru due to user input!\n");
                   msg.writeNet("quit");
+                  con.Reset();
                   exit(0);
                   break;
               case '?':
@@ -221,38 +249,39 @@ main(int argc, char *argv[])
         unsigned int i;
         memset(buffer, 0, INBUFSIZE);
 #if 1
-        vector<const xmlChar *> messages;
-        //const xmlChar *messages[200];
-        ret = msg.anydata(messages);
-
-        if (ret == ERROR) {
-            dbglogfile << "ERROR: Got error from socket " << endl;
-            // Start as a daemon
-            if (daemon == true) {
-                msg.closeNet();
-                // wait for the next connection
-                if (msg.newNetConnection(true)) {
-                    dbglogfile << "New connection started for remote client." 
<< endl;
-                }
-            } else {
-                if (errno != EAGAIN) {
-                    dbglogfile << "ERROR: " << errno << ":\t"<< 
strerror(errno) << endl;
+        if (client == true || daemon == true) {
+            vector<const xmlChar *> messages;
+            //const xmlChar *messages[200];
+            ret = msg.anydata(messages);
+            
+            if (ret == ERROR) {
+                dbglogfile << "ERROR: Got error from socket " << endl;
+                // Start as a daemon
+                if (daemon == true) {
                     msg.closeNet();
-                    exit (-1);
+                    // wait for the next connection
+                    if (msg.newNetConnection(true)) {
+                        dbglogfile << "New connection started for remote 
client." << endl;
+                    }
+                } else {
+                    if (errno != EAGAIN) {
+                        dbglogfile << "ERROR: " << errno << ":\t"<< 
strerror(errno) << endl;
+                        msg.closeNet();
+                        exit (-1);
+                    }
                 }
             }
-        }
-        for (i=0; i < messages.size(); i++) {
-            cerr << "Got message " << messages[i] << endl;
-            string str = (const char *)messages[i];
-            delete messages[i];
-            if (xml.parseXML(str) == ERROR) {
-                continue;
+            for (i=0; i < messages.size(); i++) {
+                cerr << "Got message " << messages[i] << endl;
+                string str = (const char *)messages[i];
+                delete messages[i];
+                if (xml.parseXML(str) == ERROR) {
+                    continue;
+                }
             }
+            messages.clear();
+            msg.cacheDump();
         }
-        messages.clear();
-        msg.cacheDump();
-
 #else
         ptr = buffer;
         int bytes = msg.readNet(buffer, INBUFSIZE, 0);      

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=bcdd346c07c95895c92d6dbfbb74b90690494e69


commit bcdd346c07c95895c92d6dbfbb74b90690494e69
Author: Rob Savoye <address@hidden>
Date:   Tue Nov 20 14:47:57 2018 -0700

    Add accessors for Ownet. Try to cnnect to the owserver multiple times.

diff --git a/devices/ownet.cc b/devices/ownet.cc
index fd6f142..08e1667 100644
--- a/devices/ownet.cc
+++ b/devices/ownet.cc
@@ -30,9 +30,24 @@ extern LogFile dbglogfile;
 
 namespace pdev {
 
-Ownet::~Ownet(void) {
-    OW_finish();
-};
+#if 0
+//Ownet::~Ownet(void) {
+//    OW_finish();
+//};
+
+void
+Ownet::dump(void) {
+    DEBUGLOG_REPORT_FUNCTION;
+    std::map<std::string, ownet_t>::iterator it;
+
+    for (it = _sensors.begin(); it != _sensors.end(); it++) {
+        dbglogfile << "Data for device: " << it->first << std::endl;
+        dbglogfile << "\tfamily: " << it->second.family << std::endl;
+        dbglogfile << "\ttype: " << it->second.type << std::endl;
+        dbglogfile << "\tid: " << it->second.id << std::endl;
+    }
+}
+#endif
 
 } // end of namespace
 
diff --git a/devices/ownet.h b/devices/ownet.h
index a656cf6..014a1af 100644
--- a/devices/ownet.h
+++ b/devices/ownet.h
@@ -45,10 +45,20 @@ struct ownet {
 class Ownet {
 public:
     enum family_t {CONTROL = 05, THERMOMETER = 10, THERMOMETER2 = 28};
-    //typedef std::pair<std::string, ownet_t > sensors_t;
     std::map<std::string, ownet_t > _sensors;
-    //typedef std::map<std::string, ownet_t > sensors_t;
-    //std::map<std::string, ownet_t > _sensors;
+    bool _owserver = false;
+
+    bool isConnected(void) {
+        return _owserver;
+    }
+
+    bool hasSensors(void) {
+        if (_sensors.size() >0) {
+            return true;
+        } else {
+            return false;
+        }
+    }
 
     std::string getValue(const char *device, std::string file) {
         // DEBUGLOG_REPORT_FUNCTION;
@@ -65,18 +75,21 @@ public:
 
         return std::string(buf);
     }
-
+#if 1
     void dump(void) {
         DEBUGLOG_REPORT_FUNCTION;
+
         std::map<std::string, ownet_t>::iterator it;
         for (it = _sensors.begin(); it != _sensors.end(); it++) {
-            dbglogfile << "Data for device: " << it->first << std::endl;
-            dbglogfile << "\tfamily: " << it->second.family << std::endl;
-            dbglogfile << "\ttype: " << it->second.type << std::endl;
-            dbglogfile << "\tid: " << it->second.id << std::endl;
+            std::cout << "Data for device: " << it->first << std::endl;
+            std::cout << "\tfamily: " << it->second.family << std::endl;
+            std::cout << "\ttype: " << it->second.type << std::endl;
+            std::cout << "\tid: " << it->second.id << std::endl;
         }
     }
-
+#else
+    void dump(void);
+#endif
     Ownet(void) {
         DEBUGLOG_REPORT_FUNCTION;
         dbglogfile << "Trying to connect to the owserver" << std::endl;
@@ -84,8 +97,17 @@ public:
         size_t s  = 0;
 
         //OW_init("/dev/ttyS0");
-        OW_init("localhost:4304");
-
+        int count = 5;
+        while (count-- > 0) {
+            if (OW_init("localhost:4304") < 0) {
+                dbglogfile << "WARNING: Couldn't connect to owserver!" << 
std::endl;
+                //return;
+            } else {
+                dbglogfile << "Connected to owserver." << std::endl;
+                _owserver = true;
+                break;
+            }
+        }
         // 0=mixed  output,  1=syslog, 2=console.
         OW_set_error_print("1");
         // (0=default, 1=err_connect, 2=err_call, 3=err_data, 4=err_detail,
@@ -101,11 +123,13 @@ public:
         //}
 
         std::vector<std::string> results;
-        boost::split(results, buf, boost::is_any_of(","));
-        free(buf);
-        s = 0;
-        if( results.size() <= 0) {
-            return;
+        if (buf != 0) {
+            boost::split(results, buf, boost::is_any_of(","));
+            free(buf);
+            s = 0;
+            if( results.size() <= 0) {
+                return;
+            }
         }
 
         int i = 0;
@@ -126,17 +150,17 @@ public:
             }
             _sensors[*it] = data;
         }
+
     }
 
-    ~Ownet(void);
+//    ~Ownet(void);
 
-//    ~Ownet(void) {
-//        OW_finish();
-//    };
+    ~Ownet(void) {
+        OW_finish();
+    };
 
 };
 
-
 // end of namespace pdev
 }
 

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=67d6a09f5e1b3d1d184d87874a7fb2b9ac99314d


commit 67d6a09f5e1b3d1d184d87874a7fb2b9ac99314d
Author: Rob Savoye <address@hidden>
Date:   Tue Nov 20 14:45:07 2018 -0700

    Make building devices optional

diff --git a/configure.ac b/configure.ac
index e88e433..033eebb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,24 +75,28 @@ else
 fi
 
 devices=""
-build_ownet="yes"
-build_outback="no"
-build_xantrex="no"
+BUILD_OWNET="yes"
+BUILD_OUTBACK="no"
+BUILD_XANTREX="no"
 AC_ARG_WITH(devices, [  --with-device          the device(s) to build (ownet, 
outback, xantrex)],
 [devices="`echo ${withval} | tr ',' ' '`"
 for i in ${devices}; do
     echo "FIXME: $i"
      case ${i} in
-        ownet)  build_ownet="yes" ;;
-        outback) build_outback="yes" ;;
-        xantrex) build_xantrex="yes" ;;
+        ownet)  BUILD_OWNET="yes" ;;
+        outback) BUILD_OUTBACK="yes" ;;
+        xantrex) BUILD_XANTREX="yes" ;;
         *) AC_MSG_ERROR([bad value ${i} for with-device option]) ;;
      esac
 done
 ])
-AM_CONDITIONAL(BUILD_OWNET, [ test x${build_ownet} = xyes ])
-AM_CONDITIONAL(BUILD_OUTBACK, [ test x${build_outback} = xyes ])
-AM_CONDITIONAL(BUILD_XANTREX, [ test x${build_xantrex} = xyes ])
+AC_SUBST(BUILD_OWNET)
+AC_SUBST(BUILD_OUTBACK)
+AC_SUBST(BUILD_XANTREX)
+
+AM_CONDITIONAL(BUILD_OWNET, [ test x${BUILD_OWNET} = xyes ])
+AM_CONDITIONAL(BUILD_OUTBACK, [ test x${BUILD_OUTBACK} = xyes ])
+AM_CONDITIONAL(BUILD_XANTREX, [ test x${BUILD_XANTREX} = xyes ])
 
 db="none"
 AC_ARG_WITH(db, [  --with-db          database to use, mariadb or the default 
of postgresql],

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=1335f6009fd21302a882cc8cab6cb506d8709f3d


commit 1335f6009fd21302a882cc8cab6cb506d8709f3d
Author: Rob Savoye <address@hidden>
Date:   Tue Nov 20 12:17:21 2018 -0700

    Use pdev namespace

diff --git a/daemon/main.cc b/daemon/main.cc
index 71a9a40..f973d7d 100644
--- a/daemon/main.cc
+++ b/daemon/main.cc
@@ -52,7 +52,7 @@ extern char *optarg;
 
 using namespace std;
 using namespace rcinit;
-using namespace outbackpower;
+using namespace pdev;
 
 static void usage (const char *);
 extern LogFile dbglogfile;

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=a6ae1878ab986517e0dde30f2ea6c342ed3da464


commit a6ae1878ab986517e0dde30f2ea6c342ed3da464
Author: Rob Savoye <address@hidden>
Date:   Tue Nov 20 12:16:43 2018 -0700

    Add devices to dump target

diff --git a/Makefile.am b/Makefile.am
index 630ec43..4f5e9d2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -103,9 +103,6 @@ dump:
 if BUILD_SNMP
        @echo " Building with net-snmp"
 endif
-if BUILD_OWNET
-       @echo " Building with 1-Wire support"
-endif
 if BUILD_LIBXML
        @echo " Building with libxml2"
 endif
@@ -115,3 +112,13 @@ endif
 if BUILD_POSTGRESQL
        @echo " Building with Postgresql"
 endif
+if BUILD_OUTBACK
+       @echo " Building with Outback protocol"
+endif
+
+if BUILD_XANTREX
+       @echo " Building with Xantrex protocol"
+endif
+if BUILD_OWNET
+       @echo " Building with 1-Wire support"
+endif

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=d1b88f2ba865a7a082701c6839e752b864b7e2b6


commit d1b88f2ba865a7a082701c6839e752b864b7e2b6
Author: Rob Savoye <address@hidden>
Date:   Tue Nov 20 12:15:06 2018 -0700

    Add ownet support

diff --git a/client/Makefile.am b/client/Makefile.am
index f3e72dd..c8507b9 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -21,7 +21,7 @@ AUTOMAKE_OPTIONS =
 
 bin_PROGRAMS = pguru 
 
-pguru_CPPFLAGS = -I$(top_srcdir)/lib
+pguru_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/devices
 
 pguru_SOURCES = cmd.cc
 pguru_LDADD = ../lib/libpguru.la -ldl
@@ -35,5 +35,9 @@ if BUILD_SNMP
 pguru_LDADD += ../snmp/libpgsnmp.la $(SNMP_LIBS)
 endif
 
+if BUILD_OWNET
+pguru_LDADD += $(OWNET_LIBS)
+endif
+
 # pguru_DEPENDENCIES = ../lib/libpguru.la
 

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=61f5737d5aacedbac45619f6d994313a1c8ecb11


commit 61f5737d5aacedbac45619f6d994313a1c8ecb11
Author: Rob Savoye <address@hidden>
Date:   Tue Nov 20 12:14:33 2018 -0700

    Initial rough hack

diff --git a/devices/ownet.cc b/devices/ownet.cc
index 999da69..fd6f142 100644
--- a/devices/ownet.cc
+++ b/devices/ownet.cc
@@ -22,17 +22,19 @@
 
 #include "err.h"
 #include "log.h"
-#include <ownetapi.h>
-using namespace std;
-using namespace pdev;
+#include "ownet.h"
+#include <string>
+#include <boost/algorithm/string.hpp>
 
-char * buf;
-size_t s ;
-OWNET_init("localhost:4304");
-OWNET_dirlist("/",&buf,&s) ;
-printf("Directory %s",buf);
-free(buf);
-OWNET_finish() ;
+extern LogFile dbglogfile;
+
+namespace pdev {
+
+Ownet::~Ownet(void) {
+    OW_finish();
+};
+
+} // end of namespace
 
 // local Variables:
 // mode: C++
diff --git a/devices/ownet.h b/devices/ownet.h
index 05ea324..a656cf6 100644
--- a/devices/ownet.h
+++ b/devices/ownet.h
@@ -24,7 +24,118 @@
 # include "config.h"
 #endif
 
-#include <ownetapi.h> 
+#include <string>
+#include <vector>
+#include <map>
+#include <log.h>
+#include <owcapi.h>
+#include <boost/algorithm/string.hpp>
+
+extern LogFile dbglogfile;
+
+namespace pdev {
+
+struct ownet {
+    std::string family;
+    std::string id;
+    std::string type;
+    std::string device;
+} typedef ownet_t;
+
+class Ownet {
+public:
+    enum family_t {CONTROL = 05, THERMOMETER = 10, THERMOMETER2 = 28};
+    //typedef std::pair<std::string, ownet_t > sensors_t;
+    std::map<std::string, ownet_t > _sensors;
+    //typedef std::map<std::string, ownet_t > sensors_t;
+    //std::map<std::string, ownet_t > _sensors;
+
+    std::string getValue(const char *device, std::string file) {
+        // DEBUGLOG_REPORT_FUNCTION;
+        char * buf;
+        size_t s  = 0;
+
+        std::string data = device + file;
+        //dbglogfile << "Looking for: " << data;
+        int ret = OW_get(data.c_str(), &buf, &s);
+        //dbglogfile << ", Got: " <<  buf << std::endl;
+        if (ret <= 0) {
+            return std::string();
+        }
+
+        return std::string(buf);
+    }
+
+    void dump(void) {
+        DEBUGLOG_REPORT_FUNCTION;
+        std::map<std::string, ownet_t>::iterator it;
+        for (it = _sensors.begin(); it != _sensors.end(); it++) {
+            dbglogfile << "Data for device: " << it->first << std::endl;
+            dbglogfile << "\tfamily: " << it->second.family << std::endl;
+            dbglogfile << "\ttype: " << it->second.type << std::endl;
+            dbglogfile << "\tid: " << it->second.id << std::endl;
+        }
+    }
+
+    Ownet(void) {
+        DEBUGLOG_REPORT_FUNCTION;
+        dbglogfile << "Trying to connect to the owserver" << std::endl;
+        char *buf = 0;
+        size_t s  = 0;
+
+        //OW_init("/dev/ttyS0");
+        OW_init("localhost:4304");
+
+        // 0=mixed  output,  1=syslog, 2=console.
+        OW_set_error_print("1");
+        // (0=default, 1=err_connect, 2=err_call, 3=err_data, 4=err_detail,
+        // 5=err_debug, 6=err_beyond)
+        OW_set_error_level("4");
+        OW_get("/", &buf, &s);
+        // buf looks like:
+        // 
10.67C6697351FF/,05.4AEC29CDBAAB/,bus.0/,uncached/,settings/,system/,statistics/,structure/,simultaneous/,alarm/
+        //
+        //if (s <= 0) {
+        //    dbglogfile << "S: " << (int)s << std::endl;
+            // return;
+        //}
+
+        std::vector<std::string> results;
+        boost::split(results, buf, boost::is_any_of(","));
+        free(buf);
+        s = 0;
+        if( results.size() <= 0) {
+            return;
+        }
+
+        int i = 0;
+        std::vector<std::string>::iterator it;
+        for(it = results.begin(); it != results.end(); it++,i++ ) {
+            ownet_t data;
+            data.family = getValue(it->c_str(), "family");
+            data.type = getValue(it->c_str(), "type");
+            data.id = getValue(it->c_str(), "id");
+            if (data.type.length() == 0 || data.id.length() == 0) {
+                break;
+            }
+            std::string dev = *it + "temperature";
+            if (OW_present(dev.c_str()) == 0) {
+                dbglogfile << "Temperature sensor found: " << *it << std::endl;
+            } else {
+                dbglogfile << "Temperature sensor not found!" << std::endl;
+            }
+            _sensors[*it] = data;
+        }
+    }
+
+    ~Ownet(void);
+
+//    ~Ownet(void) {
+//        OW_finish();
+//    };
+
+};
+
 
 // end of namespace pdev
 }

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=dde745602f521fee210fa6d89d8e0e89f38fc4a3


commit dde745602f521fee210fa6d89d8e0e89f38fc4a3
Author: Rob Savoye <address@hidden>
Date:   Tue Nov 20 12:10:46 2018 -0700

    Update copyright dte

diff --git a/devices/xanbus.h b/devices/xanbus.h
index 2c87a2b..21afdcb 100644
--- a/devices/xanbus.h
+++ b/devices/xanbus.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2011 Free Software Foundation, Inc.
+// Copyright (C) 2011-2018
+// Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
diff --git a/devices/xantrex-trace.h b/devices/xantrex-trace.h
index a422ecd..471bc9b 100644
--- a/devices/xantrex-trace.h
+++ b/devices/xantrex-trace.h
@@ -1,5 +1,5 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+// Copyright (C) 2005, 2006-2018.
 //      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=9c38e3b35179a2d94d0e74fc525ea3eb44a3e680


commit 9c38e3b35179a2d94d0e74fc525ea3eb44a3e680
Author: Rob Savoye <address@hidden>
Date:   Tue Nov 20 12:10:23 2018 -0700

    Use pdev namespace

diff --git a/devices/outbackpower.cc b/devices/outbackpower.cc
index d72477a..862a603 100644
--- a/devices/outbackpower.cc
+++ b/devices/outbackpower.cc
@@ -31,7 +31,7 @@
 #include "database.h"
 
 using namespace std;
-using namespace outbackpower;
+using namespace pdev;
 
 const int PACKET_SIZE = 49;
 
diff --git a/devices/outbackpower.h b/devices/outbackpower.h
index acaa663..b16550b 100644
--- a/devices/outbackpower.h
+++ b/devices/outbackpower.h
@@ -1,5 +1,5 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+// Copyright (C) 2005, 2006-2018.
 //      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
@@ -34,7 +34,7 @@
 // series. Each packet is 49 bytes, and is transmitted as ASCII
 // numerals for portability, with an ASCII comma character
 // seperating each field.
-namespace outbackpower
+namespace pdev
 {
 
 // Outback FX Inverter protocol
@@ -352,7 +352,7 @@ private:
     int _checksum;
 };
 
-// end of namespace outback
+// end of namespace pdev
 }
 
 // __OUTBACK_POWER_H__

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=3a2a4ebdb0b7c7cc2b22ddeb05f1b880c84d9346


commit 3a2a4ebdb0b7c7cc2b22ddeb05f1b880c84d9346
Author: Rob Savoye <address@hidden>
Date:   Tue Nov 20 12:09:38 2018 -0700

    Make it possile to specify a set o devices to build.

diff --git a/devices/Makefile.am b/devices/Makefile.am
index 5af437f..a110e9a 100644
--- a/devices/Makefile.am
+++ b/devices/Makefile.am
@@ -16,7 +16,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-AUTOMAKE_OPTIONS = 
+AUTOMAKE_OPTIONS = subdir-objects
 
 #DL_LIB = @DL_LIB@
 #LIBLTDL = @LIBLTDL@
@@ -33,21 +33,32 @@ address@hidden@
 
 libpdev_la_CPPFLAGS = -I$(top_srcdir)/lib -I..
 
+libpdev_la_LIBDADD =
+
+libpdev_la_SOURCES =
+if BUILD_XANTREX
+libpdev_la_SOURCES += xantrex-trace.cc xantrex-trace.h xanbus.cc xanbus.h
+endif
+if BUILD_OUTBACK
+libpdev_la_SOURCES += outbackpower.cc outbackpower.h
+endif
+
 if BUILD_SNMP
 SNMP_FILES = snmp.cc snmp.h
 libpdev_la_CPPFLAGS += -I$(top_srcdir)/snmp
-libpdev_la_LIBDADD =  $(SNMP_LIBS) ../snmp/libpgsnmp.la
+libpdev_la_LIBDADD +=  $(SNMP_LIBS) ../snmp/libpgsnmp.la
 endif
 
-libpdev_la_SOURCES = \
-       xantrex-trace.cc xantrex-trace.h \
-       xanbus.cc xanbus.h \
-       outbackpower.cc outbackpower.h
+if BUILD_OWNET
+libpdev_la_SOURCES += ownet.cc ownet.h
+libpdev_la_LIBDADD += $(OWNET_LIBS)
+endif
 
 include_HEADERS = \
        xantrex-trace.h \
        outbackpower.h \
-       xanbus.h
+       xanbus.h \
+       ownet.h
 
 #libpdev_la_LDFLAGS = -module -avoid-version -no-undefined
 

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=57d7137c7e1a4e08130e9024bdd8ebd026936896


commit 57d7137c7e1a4e08130e9024bdd8ebd026936896
Author: Rob Savoye <address@hidden>
Date:   Tue Nov 20 12:09:20 2018 -0700

    Make it possile to specify a set o devices to build.

diff --git a/configure.ac b/configure.ac
index 616b684..e88e433 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,6 +74,26 @@ else
    AC_DOCBOOK_STYLES
 fi
 
+devices=""
+build_ownet="yes"
+build_outback="no"
+build_xantrex="no"
+AC_ARG_WITH(devices, [  --with-device          the device(s) to build (ownet, 
outback, xantrex)],
+[devices="`echo ${withval} | tr ',' ' '`"
+for i in ${devices}; do
+    echo "FIXME: $i"
+     case ${i} in
+        ownet)  build_ownet="yes" ;;
+        outback) build_outback="yes" ;;
+        xantrex) build_xantrex="yes" ;;
+        *) AC_MSG_ERROR([bad value ${i} for with-device option]) ;;
+     esac
+done
+])
+AM_CONDITIONAL(BUILD_OWNET, [ test x${build_ownet} = xyes ])
+AM_CONDITIONAL(BUILD_OUTBACK, [ test x${build_outback} = xyes ])
+AM_CONDITIONAL(BUILD_XANTREX, [ test x${build_xantrex} = xyes ])
+
 db="none"
 AC_ARG_WITH(db, [  --with-db          database to use, mariadb or the default 
of postgresql],
 [case "${withval}" in
@@ -246,7 +266,7 @@ AC_TRY_COMPILE([#include <ownetapi.h>], [
 AC_MSG_RESULT([${has_ownet}])
 if test x"${has_ownet}" = x"true"; then
   AC_DEFINE([HAVE_OWNET], [1], [Has ownet development files])
-  OWNET_LIBS="-lownet"
+  OWNET_LIBS="-lownet -lowcapi"
   AC_SUBST(OWNET_LIBS)
 fi
 AM_CONDITIONAL(BUILD_OWNET, [ test x${has_ownet} = xtrue ])
@@ -254,6 +274,11 @@ AM_CONDITIONAL(BUILD_OWNET, [ test x${has_ownet} = xtrue ])
 dnl mariadb development files
 dnl FIXME
 
+dnl FIXME: Force this definition as there is a type conflict between the 
net-snmp
+dnl defintion and tje sys/types,h one.
+AC_DEFINE([HAVE_SSIZE_T], [1], [Has ssize_t defined])
+AC_DEFINE([HAVE_STRTOULL], [1], [Has strtoull defined])
+
 LDFLAGS="${save_LDFLAGS}"
 CXXFLAGS="${save_CXXFLAGS}"
 CPPFLAGS="${save_CPPFLAGS}"
@@ -356,10 +381,21 @@ else
   echo "        Found net-snmp. will configure SNMP support"
 fi
 
-if test x"${has_ownet}" != x"true"; then
-  echo "        To use a 1-Wire device. install the ownet development package 
for your system"
-else
-  echo "        Found ownet. will configure ownet support"
+if test x"${build_outback}" = x"yes"; then
+   echo "        Including Outback protocol"
+fi
+
+if test x"${build_xantrex}" = x"yes"; then
+   echo "        Including Xantrex protocol"
+fi
+
+if test x"${build_ownet}" = x"yes"; then
+   echo "        Including 1-wire protocol"
+   if test x"${has_ownet}" != x"true"; then
+      echo "        To use a 1-Wire device. install the ownet development 
package for your system"
+   else
+      echo "        Found ownet. will configure ownet support"
+   fi
 fi
 
 if test x"${db}" = x"none"; then

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=17cb35214e8129ebb97c35d8fcc324e919a45bcf


commit 17cb35214e8129ebb97c35d8fcc324e919a45bcf
Author: Rob Savoye <address@hidden>
Date:   Mon Nov 19 14:21:33 2018 -0700

    Add support for doxygen and ownet

diff --git a/configure.ac b/configure.ac
index df8022e..616b684 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl
-dnl  Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+dnl  Copyright (C) 2005, 2006-2018
 dnl    Free Software Foundation, Inc.
 dnl
 dnl  This program is free software; you can redistribute it and/or modify
@@ -94,6 +94,8 @@ AC_HEADER_STDC
 dnl AC_PROG_AR
 AC_CHECK_TOOL(AR, ar)
 AC_PATH_PROG(DEJAGNU, runtest)
+AC_PATH_PROG(DOXYGEN, doxygen)
+AM_CONDITIONAL(ENABLE_DOXYGEN, [ test x"$DOXYGEN" != x ])
 
 sysroot="${sysroot:-`${CXX} -print-sysroot`}"
 AC_ARG_WITH(sysroot,
@@ -232,6 +234,23 @@ if test x"${has_snmp}" = x"true"; then
 fi
 AM_CONDITIONAL(BUILD_SNMP, [ test x${has_snmp} = xtrue ])
 
+dnl dnl OWFS
+LDFLAGS="${save_LDFLAGS} -l"
+AC_MSG_CHECKING([For libownet development files])
+AC_TRY_COMPILE([#include <ownetapi.h>], [
+  OWNET_HANDLE foo;
+  ],
+  has_ownet=true,
+  has_ownet=false
+)
+AC_MSG_RESULT([${has_ownet}])
+if test x"${has_ownet}" = x"true"; then
+  AC_DEFINE([HAVE_OWNET], [1], [Has ownet development files])
+  OWNET_LIBS="-lownet"
+  AC_SUBST(OWNET_LIBS)
+fi
+AM_CONDITIONAL(BUILD_OWNET, [ test x${has_ownet} = xtrue ])
+
 dnl mariadb development files
 dnl FIXME
 
@@ -299,6 +318,7 @@ snmp/Makefile
 client/Makefile
 po/Makefile.in
 doc/Makefile
+doc/Doxyfile
 doc/C/Makefile
 testsuite/Makefile
 testsuite/libtests/Makefile
@@ -336,6 +356,12 @@ else
   echo "        Found net-snmp. will configure SNMP support"
 fi
 
+if test x"${has_ownet}" != x"true"; then
+  echo "        To use a 1-Wire device. install the ownet development package 
for your system"
+else
+  echo "        Found ownet. will configure ownet support"
+fi
+
 if test x"${db}" = x"none"; then
   echo "        To use a database. install the mariadb or postgresql 
development package for your system"
 else

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=0ad377ff6a51350152e3fa31a0e5c37eee45fb4c


commit 0ad377ff6a51350152e3fa31a0e5c37eee45fb4c
Author: Rob Savoye <address@hidden>
Date:   Mon Nov 19 14:21:01 2018 -0700

    Not using submodules

diff --git a/Arduino-Temperature-Control-Library 
b/Arduino-Temperature-Control-Library
deleted file mode 160000
index 1050b66..0000000
--- a/Arduino-Temperature-Control-Library
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 1050b661ef80ac398eb4be5b91447c7d2a77a5e8
diff --git a/OneWire b/OneWire
deleted file mode 160000
index 5785917..0000000
--- a/OneWire
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 578591782da41dd20fe6947ad3f8fb6056172b43

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=8de97c6d891d052c3cb9df8394ab21eadedc5a3c


commit 8de97c6d891d052c3cb9df8394ab21eadedc5a3c
Author: Rob Savoye <address@hidden>
Date:   Mon Nov 19 13:58:38 2018 -0700

    Add doxygen support

diff --git a/Makefile.am b/Makefile.am
index 73fdfdf..630ec43 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -95,11 +95,17 @@ mudflap:
        @echo "Rebuilding with GCC Mudflap support"
        $(MAKE) CXXFLAGS="$(CXXFLAGS) -fmudflap" LDFLAGS="$(LDFLAGS) -lmudflap"
 
+apidoc:
+       $(MAKE) -C doc $@
+
 dump:
        @echo "Dumping configure options"
 if BUILD_SNMP
        @echo " Building with net-snmp"
 endif
+if BUILD_OWNET
+       @echo " Building with 1-Wire support"
+endif
 if BUILD_LIBXML
        @echo " Building with libxml2"
 endif

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=64a4acd696a3efcd73455911314889f936026ba4


commit 64a4acd696a3efcd73455911314889f936026ba4
Author: Rob Savoye <address@hidden>
Date:   Mon Nov 19 13:58:29 2018 -0700

    Add doxygen support

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 41caf3e..b9f38ac 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -11,3 +11,16 @@
 
 SUBDIRS = C
 
+XTRA_DIST = Doxyfile.in
+
+if ENABLE_DOXYGEN
+
+.PHONY: apidoc
+
+apidoc: 
+       $(DOXYGEN) $<
+
+clean-generic:
+       rm -Rf apidoc
+
+endif

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=2fb2c74a2c6e1dac9ee71d3448e5703411fcfaf3


commit 2fb2c74a2c6e1dac9ee71d3448e5703411fcfaf3
Author: Rob Savoye <address@hidden>
Date:   Mon Nov 19 13:58:17 2018 -0700

    Add doxygen supportdoc/Doxyfile.in

diff --git a/Arduino-Temperature-Control-Library 
b/Arduino-Temperature-Control-Library
new file mode 160000
index 0000000..1050b66
--- /dev/null
+++ b/Arduino-Temperature-Control-Library
@@ -0,0 +1 @@
+Subproject commit 1050b661ef80ac398eb4be5b91447c7d2a77a5e8
diff --git a/OneWire b/OneWire
new file mode 160000
index 0000000..5785917
--- /dev/null
+++ b/OneWire
@@ -0,0 +1 @@
+Subproject commit 578591782da41dd20fe6947ad3f8fb6056172b43
diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in
new file mode 100644
index 0000000..8b0d0b0
--- /dev/null
+++ b/doc/Doxyfile.in
@@ -0,0 +1,938 @@
+# Doxyfile 1.2.15
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           =  PowerGuru
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = @VERSION@
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = apidoc
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French, 
+# German, Greek, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, 
+# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish.
+
+OUTPUT_LANGUAGE        = English
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = YES
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these class will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = YES
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed 
description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
inherited 
+# members of a class in the documentation of that class as if those members 
were 
+# ordinary class members. Constructors, destructors and assignment operators 
of 
+# the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. It is allowed to use relative paths in the argument list.
+
+STRIP_FROM_PATH        = 
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower case letters. If set to YES upper case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# users are adviced to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments  will behave just like the Qt-style comments (thus requiring an 
+# explict @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# reimplements.
+
+INHERIT_DOCS           = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consist of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
sources 
+# only. Doxygen will then generate output that is more tailored for C. 
+# For instance some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
sources 
+# only. Doxygen will then generate output that is more tailored for Java. 
+# For instance namespaces will be presented as packages, qualified scopes 
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text.
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that 
contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  =  @top_srcdir@
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh 
*.hxx *.hpp 
+# *.h++ *.idl *.odl
+
+FILE_PATTERNS          =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT 
tag.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
directories 
+# that are symbolic links (a Unix filesystem feature) are excluded from the 
input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories.
+
+EXCLUDE_PATTERNS       = */examples/* */mozilla-sdk/* */cygnal/* 
*/libbase/tree.hh  */win32/* */backend/render_handler_agg_compat.h *.git *.bzr 
*/testsuite/*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.
+
+INPUT_FILTER           = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse.
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these 
sources.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default) 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the Html help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+, 
+# or Internet explorer 4.0+). Note that for large projects the tree generation 
+# can take a very long time. In such cases it is better to disable this 
feature. 
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimised for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assigments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_XML           = NO
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be 
expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line and do not end with a semicolon. Such function macros are 
typically 
+# used for boiler-plate code, and will confuse the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tagfiles.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with 
base or 
+# super classes. Setting the tag to NO turns the diagrams off. Note that this 
+# option is superceded by the HAVE_DOT option below. This is only a fallback. 
It is 
+# recommended to install and use dot, since it yield more powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph 
visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found on the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_WIDTH    = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT   = 1024
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermedate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO
+
+# The CGI_NAME tag should be the name of the CGI script that 
+# starts the search engine (doxysearch) with the correct parameters. 
+# A script with this name will be generated by doxygen.
+
+#CGI_NAME               = search.cgi
+
+# The CGI_URL tag should be the absolute URL to the directory where the 
+# cgi binaries are located. See the documentation of your http daemon for 
+# details.
+
+#CGI_URL                = 
+
+# The DOC_URL tag should be the absolute URL to the directory where the 
+# documentation is located. If left blank the absolute path to the 
+# documentation, with file:// prepended to it, will be used.
+
+#DOC_URL                = 
+
+# The DOC_ABSPATH tag should be the absolute path to the directory where the 
+# documentation is located. If left blank the directory on the local machine 
+# will be used.
+
+#DOC_ABSPATH            = 
+
+# The BIN_ABSPATH tag must point to the directory where the doxysearch binary 
+# is installed.
+
+#BIN_ABSPATH            = /usr/local/bin/
+
+# The EXT_DOC_PATHS tag can be used to specify one or more paths to 
+# documentation generated for other projects. This allows doxysearch to search 
+# the documentation for these projects as well.
+
+#EXT_DOC_PATHS          = 

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=8305a73668a67118a1814305dddf41fe5c245e3c


commit 8305a73668a67118a1814305dddf41fe5c245e3c
Author: Rob Savoye <address@hidden>
Date:   Mon Nov 19 13:37:54 2018 -0700

    Initial 1-Wire support using owfs

diff --git a/devices/ownet.cc b/devices/ownet.cc
new file mode 100644
index 0000000..999da69
--- /dev/null
+++ b/devices/ownet.cc
@@ -0,0 +1,40 @@
+// 
+// Copyright (C) 2005, 2006 - 2018
+//      Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "err.h"
+#include "log.h"
+#include <ownetapi.h>
+using namespace std;
+using namespace pdev;
+
+char * buf;
+size_t s ;
+OWNET_init("localhost:4304");
+OWNET_dirlist("/",&buf,&s) ;
+printf("Directory %s",buf);
+free(buf);
+OWNET_finish() ;
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/devices/ownet.h b/devices/ownet.h
new file mode 100644
index 0000000..05ea324
--- /dev/null
+++ b/devices/ownet.h
@@ -0,0 +1,38 @@
+// 
+// Copyright (C) 2005, 2006-2018.
+//      Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifndef __OWNET_H__
+#define __OWNET_H__
+
+// This is generated by autoconf
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <ownetapi.h> 
+
+// end of namespace pdev
+}
+
+// __OWNET_H__
+#endif
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=12171e4728f2d4de3d94fef9456b4907ef9e9a7f


commit 12171e4728f2d4de3d94fef9456b4907ef9e9a7f
Author: Rob Savoye <address@hidden>
Date:   Mon Nov 19 11:44:04 2018 -0700

    Remove as too Arudino specific

diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 105ca92..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,6 +0,0 @@
-[submodule "Arduino-Temperature-Control-Library"]
-       path = Arduino-Temperature-Control-Library
-       url = https://github.com/milesburton/Arduino-Temperature-Control-Library
-[submodule "OneWire"]
-       path = OneWire
-       url = https://github.com/PaulStoffregen/OneWire.git

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=e4c3578341d78b74b9040fc995b9e6750ce5aaec


commit e4c3578341d78b74b9040fc995b9e6750ce5aaec
Author: Rob Savoye <address@hidden>
Date:   Mon Nov 19 10:44:43 2018 -0700

    Add modules for OneWire sensors

diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..105ca92
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "Arduino-Temperature-Control-Library"]
+       path = Arduino-Temperature-Control-Library
+       url = https://github.com/milesburton/Arduino-Temperature-Control-Library
+[submodule "OneWire"]
+       path = OneWire
+       url = https://github.com/PaulStoffregen/OneWire.git

-----------------------------------------------------------------------

Summary of changes:
 Makefile.am                         |  13 +
 client/Makefile.am                  |   6 +-
 client/cmd.cc                       | 159 +++---
 configure.ac                        |  99 +++-
 daemon/Makefile.am                  |  13 +-
 daemon/main.cc                      | 185 ++++---
 daemon/threads.cc                   | 147 ++++++
 devices/Makefile.am                 |  30 +-
 devices/outbackpower.cc             |   2 +-
 devices/outbackpower.h              |   6 +-
 lib/sharedlib.h => devices/ownet.cc |  61 +--
 devices/ownet.h                     | 273 +++++++++++
 devices/xanbus.h                    |   3 +-
 devices/xantrex-trace.h             |   2 +-
 doc/Doxyfile.in                     | 938 ++++++++++++++++++++++++++++++++++++
 doc/Makefile.am                     |  13 +
 lib/Makefile.am                     |  43 +-
 lib/database.h                      |  40 +-
 lib/postgresql.cc                   | 115 +----
 powerguru.sql                       |  49 +-
 20 files changed, 1831 insertions(+), 366 deletions(-)
 create mode 100644 daemon/threads.cc
 copy lib/sharedlib.h => devices/ownet.cc (54%)
 create mode 100644 devices/ownet.h
 create mode 100644 doc/Doxyfile.in


hooks/post-receive
-- 
powerguru



reply via email to

[Prev in Thread] Current Thread [Next in Thread]