Move GPIO presence object to its own files
This commit moves and renames the PresenceSensor to PresenceGpio
from TachSensors to its own file so that it can be used for more
than just fans.
It is currently only used for GPIO presence monitoring for fans.
This commit maintains the same functionality as the original code.
Once the objects is created for a GPIO, it will be monitoring for
gpiod::line_request::EVENT_BOTH_EDGES changes. The user can call
isPresent() anytime to read the presence status.
Interface:
EventPresenceGpio(const std::string& iDeviceType,
const std::string& iDeviceName,
const std::string& gpioName, bool inverted,
boost::asio::io_context& io);
Sample usage:
presenceGpio = std::make_unique<EventPresenceGpio>(
"Fan", "Fan4b", "FAN4_PRESENCE_R_N", true, io);
if (presenceGpio->isPresent())
{
// Fan is present
}
Testing: Unable to test this update because no hardware supporting
event driven GPIO detection available.
Change-Id: I1f1a4cbab39d3e3ab38b30288f6aa199ee0cfe3c
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/src/meson.build b/src/meson.build
index 6fb66a1..12f8ee5 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -121,6 +121,7 @@
executable(
'fansensor',
'FanMain.cpp',
+ 'PresenceGpio.cpp',
'TachSensor.cpp',
'PwmSensor.cpp',
dependencies: [