split Factory class
In the next few patches we are going to split veliad into velia and
velia-hardware. However, the current veliad uses a Factory class which
has two functions, one for velia(-health) and one for velia-hardware.
It is only logical to split this Factory class into two, one for the
health and one for the hardware part.
There is no point in the velia-hardware to depend on stuff from
velia-health and vice versa.
Change-Id: If935c21b5da98cf56713479635d6ae6266c680a7
diff --git a/src/health/Factory.cpp b/src/health/Factory.cpp
new file mode 100644
index 0000000..607a985
--- /dev/null
+++ b/src/health/Factory.cpp
@@ -0,0 +1,18 @@
+#include "Factory.h"
+#include "health/outputs/LedSysfsDriver.h"
+#include "health/outputs/SlotWrapper.h"
+#include "health/outputs/callables.h"
+
+namespace velia::health {
+boost::signals2::SlotWrapper<void, health::State> createOutput(const std::string& applianceName)
+{
+ if (applianceName == "czechlight-clearfog") {
+ return boost::signals2::SlotWrapper<void, State>(std::make_shared<LedOutputCallback>(
+ std::make_shared<LedSysfsDriver>("/sys/class/leds/status:red/"),
+ std::make_shared<LedSysfsDriver>("/sys/class/leds/status:green/"),
+ std::make_shared<LedSysfsDriver>("/sys/class/leds/status:blue/")));
+ } else {
+ throw std::runtime_error("Unknown appliance '" + applianceName + "'");
+ }
+}
+}