Move current implementation into separate namespace

We will be moving ietf-hardware implementation from cla-sysrepo to
velia. Veliad daemon will manage not only the "system health" (the
current implementation) but it will also (in later commits) implement
ietf-hardware (RFC8348) [1] (report HW sensors readout to Sysrepo).

This commit prepares the directory structure (i.e., it moves the current
code into a namespace velia::health.
We will be adding new namespace velia::ietf_hardware throughout the next
few commits which will implement the support for ietf-hardware YANG
model.

[1] https://tools.ietf.org/html/rfc8348#appendix-A

Change-Id: I315c2575c5d50036d27cb0a11f5571ce9d615fe5
diff --git a/src/health/outputs/LedSysfsDriver.cpp b/src/health/outputs/LedSysfsDriver.cpp
new file mode 100644
index 0000000..c3b0f0f
--- /dev/null
+++ b/src/health/outputs/LedSysfsDriver.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2020 CESNET, https://photonics.cesnet.cz/
+ *
+ * Written by Tomáš Pecka <tomas.pecka@fit.cvut.cz>
+ *
+*/
+
+#include <fstream>
+#include "LedSysfsDriver.h"
+#include "utils/log.h"
+
+namespace velia::health {
+
+LedSysfsDriver::LedSysfsDriver(const std::filesystem::path& directory)
+    : m_log(spdlog::get("main"))
+    , m_brightnessFile(directory / "brightness")
+{
+    // check that brightness file exists
+    if (!std::filesystem::exists(m_brightnessFile)) {
+        throw std::invalid_argument("Sysfs dir must contain 'brightness' file.");
+    }
+
+    m_log->trace("Initialized LED {}", std::string(directory));
+}
+
+/** @brief Set the brightness of the LED to @p brightness.
+ *  Caller is responsible for providing correct brightness value. No checks for valid value are performed.
+ */
+void LedSysfsDriver::set(uint32_t brightness)
+{
+    std::ofstream ofs(m_brightnessFile);
+    if (!(ofs << brightness)) {
+        throw std::invalid_argument("Write to '" + std::string(m_brightnessFile) + "' failed.");
+    }
+}
+
+}