summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2017-02-17 15:39:36 -0600
committerMatthew Barth <msbarth@us.ibm.com>2017-03-09 15:13:33 -0600
commit293477d4650314935a3741c547efcb36d5efb340 (patch)
treea21cf9ae720be38a7d16f1a4cd33d9487dd130d9
parentae0e96c3f98e57e5988b1621ec4c67d4b27cda4f (diff)
downloadphosphor-fan-presence-293477d4650314935a3741c547efcb36d5efb340.tar.gz
phosphor-fan-presence-293477d4650314935a3741c547efcb36d5efb340.zip
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>
-rw-r--r--.gitignore3
-rw-r--r--Makefile.am11
-rw-r--r--configure.ac6
-rw-r--r--fan_enclosure.cpp14
-rw-r--r--fan_enclosure.hpp27
-rw-r--r--sensor_base.hpp30
-rw-r--r--tach_detect.cpp15
-rw-r--r--tach_sensor.cpp18
-rw-r--r--tach_sensor.hpp31
9 files changed, 152 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index d58b9e4..8023943 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,7 @@ Makefile
Makefile.in
aclocal.m4
ar-lib
-arm-openbmc-linux-gnueabi-libtool
+*-libtool
autom4te.cache*
compile
config.*
@@ -17,3 +17,4 @@ stamp-h1
*.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_CXX_COMPILE_STDCXX_14([noext])
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
OpenPOWER on IntegriCloud