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. e3ba267837b8


From: Rob Savoye
Subject: [Powerguru-commit] [SCM] powerguru branch, master, updated. e3ba267837b824dd5134358179f8378d398c4ff2
Date: Sun, 6 Jan 2019 17:01:16 -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  e3ba267837b824dd5134358179f8378d398c4ff2 (commit)
       via  31793f2133d41c49220f7aac747b23dff376c3b0 (commit)
      from  152640d997f9a5086826cbd645811b38b8356945 (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=e3ba267837b824dd5134358179f8378d398c4ff2


commit e3ba267837b824dd5134358179f8378d398c4ff2
Author: Rob Savoye <address@hidden>
Date:   Sun Jan 6 15:00:55 2019 -0700

    Add new file, what is this project

diff --git a/README b/README
index bc5fe65..8a5f6ae 100644
--- a/README
+++ b/README
@@ -1,39 +1,46 @@
-struct servent {
-     char  *s_name;       /* official service name */
-     char **s_aliases;    /* alias list */
-     int    s_port;       /* port number */
-     char  *s_proto;      /* protocol to use */
-}
+  PowerGuru is a program that does data logging of sensor data,
+primarily focued on renewable energy and environmental monitoring. It
+was part of a larger projet that handled power management of off-grid
+systems.
 
-The members of the servent structure are:
-     s_name The official name of the service.
-     s_aliases A NULL-terminated list of alternative names for the service.
-     s_port The port number for the service given in network byte order.
-     s_proto The name of the protocol to use with this service.
+  The original implementation was designed for what's now 20 year old
+hardware. The host was an S-100 based systems with hardwired remote
+controls running over serial ports. It worked with my Xantex (was
+Trace) and Outback Power based inverter and charge controllers. At the
+time, there was no software solution for this, but over time the
+manufacturers developed their own. I even had to revese engineer the
+protocols.
 
+  Jumping forward 20 years, the availablity of inexpensive hardware
+like the Rapberry PI or Aurdino, and many inexpensive GPIO, i2C, or
+USB sensors have changed everything.
 
-struct protoent {
-     char  *p_name;       /* official protocol name */
-     char **p_aliases;    /* alias list */
-     int    p_proto;      /* protocol number */
-}
+  If you've never done it, refactoring an od project is interesting. I
+hope I writ better C++ code now. In the years since this code was left
+to bit-rot, there are new C++ standards, better libraries, and
+different protocols. For one thing, the Boost libraries are awesome,
+and allowed me to drop lots of old crufty C++ wrappers around a C
+API.
 
-       The members of the protoent structure are:
-       p_name The official name of the protocol.
-       p_aliases A NULL-terminated list of alternative names for the protocol.
-       p_proto The protocol number.
+  I needed some simple C++ code for an IOT workshop I'm teaching, so
+decided to bring it back to life. Since I no longer own the off-grid
+house, but do have solar panels on my truck, I decided to focus the
+new version on power and weather monitoring that system in my pickup
+truck.
 
-The  addrinfo  structure  used  by getaddrinfo() contains the following fields:
+  For those interested, there were several huge changes, basically
+replacing the old code that handled the C APIs for system level tasks
+like networking, logging, posix threading, using newer C++ containers
+for data, and adopting smart pointers, 
 
-struct addrinfo {
-       int              ai_flags;
-       int              ai_family;
-       int              ai_socktype;
-       int              ai_protocol;
-       socklen_t        ai_addrlen;
-       struct sockaddr *ai_addr;
-       char            *ai_canonname;
-       struct addrinfo *ai_next;
-}
+  The other big change was depreciating the older Xantrex and Outback
+protocols, because I have nothing to test it against anymore. Then I
+had to add support for 1 wire sensors, which has good library
+support. The final change was switching from Mysql to Postgresql,
+primarily because I used Posgresql for other projects/
 
-getaddrinfo() is an excellent function that will return information on a 
particular host name (such as its IP address) and load up a struct sockaddr for 
you, taking care of the gritty details (like if it's IPv4 or IPv6.) It replaces 
the old functions gethostbyname() and getservbyname().T
\ No newline at end of file
+  Since the workshop needs to also cover using Python, I added a
+Python version that does the same things. While developing Python on a
+Raspberry PI is pretty easy, most large IOT appliction are written in
+C++, and learning how to cross compile and remote debug is an
+important skill set to know.

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


commit 31793f2133d41c49220f7aac747b23dff376c3b0
Author: Rob Savoye <address@hidden>
Date:   Sun Jan 6 14:26:44 2019 -0700

    Add a test for C++11, which is when many boost libraries got added to the 
standard.

diff --git a/configure.ac b/configure.ac
index 95cbc6f..11eff9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -230,6 +230,19 @@ save_CXXFLAGS="${CXXFLAGS}"
 save_CPPFLAGS="${CPPFLAGS}"
 save_CFLAGS="${CFLAGS}"
 
+CFLAGS="--std=c++11"
+AC_MSG_CHECKING([For C++11 support])
+AC_TRY_COMPILE([#include <time.h>], [
+  int foo = CLOCKS_PER_SEC;
+  ],
+  has_c11=yes,
+  has_c11=no
+)
+AC_MSG_RESULT([${has_c11}])
+if test x"${has_c11}" = x"no"; then
+  AC_MSG_ERROR([You need a C++ compiler that support the C++11 standard])
+fi
+
 dnl Force warningto cause an error for compile tests
 CFLAGS="${save_CFLAGS} -Wall -Werror"
 

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

Summary of changes:
 README       | 71 +++++++++++++++++++++++++++++++++---------------------------
 configure.ac | 13 +++++++++++
 2 files changed, 52 insertions(+), 32 deletions(-)


hooks/post-receive
-- 
powerguru



reply via email to

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