blob: 0f62b3cb3c883984c43acd82f2472636fc315b69 [file] [log] [blame]
Tomáš Peckaaf7b7042021-04-20 20:14:13 +02001/*
2 * Copyright (C) 2021 CESNET, https://photonics.cesnet.cz/
3 *
4 * Written by Tomáš Pecka <tomas.pecka@cesnet.cz>
5 *
6 */
7#pragma once
8
Tomáš Pecka63b2d652021-04-22 19:03:14 +02009#include <atomic>
Tomáš Peckaaf7b7042021-04-20 20:14:13 +020010#include <filesystem>
11#include <sysrepo-cpp/Session.hpp>
Tomáš Pecka63b2d652021-04-22 19:03:14 +020012#include <thread>
Tomáš Peckaaf7b7042021-04-20 20:14:13 +020013#include "utils/log-fwd.h"
14
15namespace velia::system {
16
17class LED {
18public:
19 LED(const std::shared_ptr<::sysrepo::Connection>& srConn, std::filesystem::path sysfsLeds);
Tomáš Pecka63b2d652021-04-22 19:03:14 +020020 ~LED();
Tomáš Peckaaf7b7042021-04-20 20:14:13 +020021
22private:
Tomáš Pecka63b2d652021-04-22 19:03:14 +020023 void poll() const;
24
Tomáš Peckaaf7b7042021-04-20 20:14:13 +020025 velia::Log m_log;
Tomáš Pecka63b2d652021-04-22 19:03:14 +020026 std::map<std::filesystem::path, uint32_t> m_ledsMaxBrightness;
Tomáš Peckaaf7b7042021-04-20 20:14:13 +020027 std::shared_ptr<::sysrepo::Session> m_srSession;
28 std::shared_ptr<::sysrepo::Subscribe> m_srSubscribe;
Tomáš Pecka63b2d652021-04-22 19:03:14 +020029 std::thread m_thr;
30 std::atomic<bool> m_thrRunning;
Tomáš Peckaaf7b7042021-04-20 20:14:13 +020031};
32}