Add fan presence application framework

Add class framework for detecting fans by tach

Change-Id: I45295fd6bcd81c62cef36320dfbc4f0da6092557
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/.gitignore b/.gitignore
index d58b9e4..8023943 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,7 @@
 Makefile.in

 aclocal.m4

 ar-lib

-arm-openbmc-linux-gnueabi-libtool

+*-libtool

 autom4te.cache*

 compile

 config.*

@@ -17,3 +17,4 @@
 *.la

 *.lo

 *.o

+phosphor-fan-presence-tach

diff --git a/Makefile.am b/Makefile.am
index 74a2686..05a883d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1 +1,12 @@
 AM_DEFAULT_SOURCE_EXT = .cpp
+
+sbin_PROGRAMS = \
+	phosphor-fan-presence-tach
+
+phosphor_fan_presence_tach_SOURCES = \
+	fan_enclosure.cpp \
+	tach_sensor.cpp \
+	tach_detect.cpp
+
+phosphor_fan_presence_tach_LDFLAGS = $(SDBUSPLUS_LIBS)
+phosphor_fan_presence_tach_CXXFLAGS = $(SDBUSPLUS_CFLAGS)
diff --git a/configure.ac b/configure.ac
index ee10e62..26b5cc4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,8 +18,10 @@
 AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
 
 # Checks for libraries.
-PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], ,
-[AC_MSG_ERROR([The systemd development package is required])])
+PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], ,
+[AC_MSG_ERROR([The openbmc/sdbusplus package is required])])
+
+# Checks for header files.
 
 # Checks for library functions.
 LT_INIT # Required for systemd linking
diff --git a/fan_enclosure.cpp b/fan_enclosure.cpp
new file mode 100644
index 0000000..5bd14e5
--- /dev/null
+++ b/fan_enclosure.cpp
@@ -0,0 +1,14 @@
+#include "fan_enclosure.hpp"
+
+
+namespace phosphor
+{
+namespace fan
+{
+namespace presence
+{
+
+
+} // namespace presence
+} // namespace fan
+} // namespace phosphor
diff --git a/fan_enclosure.hpp b/fan_enclosure.hpp
new file mode 100644
index 0000000..a94ffe7
--- /dev/null
+++ b/fan_enclosure.hpp
@@ -0,0 +1,27 @@
+#pragma once
+
+
+namespace phosphor
+{
+namespace fan
+{
+namespace presence
+{
+
+class FanEnclosure
+{
+    public:
+        FanEnclosure() = delete;
+        FanEnclosure(const FanEnclosure&) = delete;
+        FanEnclosure(FanEnclosure&&) = default;
+        FanEnclosure& operator=(const FanEnclosure&) = delete;
+        FanEnclosure& operator=(FanEnclosure&&) = default;
+        ~FanEnclosure() = default;
+
+    private:
+
+};
+
+} // namespace presence
+} // namespace fan
+} // namespace phosphor
diff --git a/sensor_base.hpp b/sensor_base.hpp
new file mode 100644
index 0000000..92f53a7
--- /dev/null
+++ b/sensor_base.hpp
@@ -0,0 +1,30 @@
+#pragma once
+
+
+namespace phosphor
+{
+namespace fan
+{
+namespace presence
+{
+
+class FanEnclosure;
+class Sensor
+{
+    public:
+        Sensor() = delete;
+        Sensor(const Sensor&) = delete;
+        Sensor(Sensor&&) = delete;
+        Sensor& operator=(const Sensor&) = delete;
+        Sensor& operator=(Sensor&&) = delete;
+        virtual ~Sensor() = default;
+
+        virtual bool isPresent() = 0;
+
+    protected:
+
+};
+
+} // namespace presence
+} // namespace fan
+} // namespace phosphor
diff --git a/tach_detect.cpp b/tach_detect.cpp
new file mode 100644
index 0000000..9b2ccd1
--- /dev/null
+++ b/tach_detect.cpp
@@ -0,0 +1,15 @@
+#include <vector>
+#include <sdbusplus/bus.hpp>
+
+int main(void)
+{
+    auto bus = sdbusplus::bus::new_default();
+
+    while (true)
+    {
+        // Respond to dbus signals
+        bus.process_discard();
+        bus.wait();
+    }
+    return 0;
+}
diff --git a/tach_sensor.cpp b/tach_sensor.cpp
new file mode 100644
index 0000000..1325365
--- /dev/null
+++ b/tach_sensor.cpp
@@ -0,0 +1,18 @@
+#include "tach_sensor.hpp"
+
+
+namespace phosphor
+{
+namespace fan
+{
+namespace presence
+{
+
+bool TachSensor::isPresent()
+{
+    return false;
+}
+
+} // namespace presence
+} // namespace fan
+} // namespace phosphor
diff --git a/tach_sensor.hpp b/tach_sensor.hpp
new file mode 100644
index 0000000..0ef2b0a
--- /dev/null
+++ b/tach_sensor.hpp
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "sensor_base.hpp"
+
+
+namespace phosphor
+{
+namespace fan
+{
+namespace presence
+{
+
+class TachSensor : public Sensor
+{
+    public:
+        TachSensor() = delete;
+        TachSensor(const TachSensor&) = delete;
+        TachSensor(TachSensor&&) = delete;
+        TachSensor& operator=(const TachSensor&) = delete;
+        TachSensor& operator=(TachSensor&&) = delete;
+        ~TachSensor() = default;
+
+        bool isPresent();
+
+    private:
+
+};
+
+} // namespace presence
+} // namespace fan
+} // namespace phosphor