Scripts and main daemon

This includes the scripts for the YAML parsing and the
main execution point.

Change-Id: If42154c621353b23370b63d4e58f6c75bca8b356
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/scripts/writesensor.mako.cpp b/scripts/writesensor.mako.cpp
new file mode 100644
index 0000000..8be30bb
--- /dev/null
+++ b/scripts/writesensor.mako.cpp
@@ -0,0 +1,36 @@
+## This file is a template.  The comment below is emitted
+## into the rendered file; feel free to edit this file.
+
+// !!! WARNING: This is GENERATED Code... Please do NOT edit !!!
+
+#include <map>
+#include "conf.hpp"
+
+std::map<std::string, struct sensor> SensorConfig = {
+% for key in sensorDict.iterkeys():
+   % if key:
+   <%
+           sensor = sensorDict[key]
+           type = sensor["type"]
+           readpath = sensor["readpath"]
+           writepath = sensor.get("writepath", "")
+           min = sensor.get("min", 0)
+           max = sensor.get("max", 0)
+           # Presently only thermal inputs have their timeout
+           # checked, but we should default it as 2s, which is
+           # the previously hard-coded value.
+           # If it's a fan sensor though, let's set the default
+           # to 0.
+           if type == "fan":
+               timeout = sensor.get("timeout", 0)
+           else:
+               timeout = sensor.get("timeout", 2)
+   %>
+    {"${key}",
+        {"${type}","${readpath}","${writepath}", ${min}, ${max}, ${timeout}},
+    },
+   % endif
+% endfor
+};
+
+