Tomáš Pecka | af7b704 | 2021-04-20 20:14:13 +0200 | [diff] [blame] | 1 | /* |
| 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áš Pecka | 63b2d65 | 2021-04-22 19:03:14 +0200 | [diff] [blame] | 9 | #include <atomic> |
Tomáš Pecka | af7b704 | 2021-04-20 20:14:13 +0200 | [diff] [blame] | 10 | #include <filesystem> |
| 11 | #include <sysrepo-cpp/Session.hpp> |
Tomáš Pecka | 63b2d65 | 2021-04-22 19:03:14 +0200 | [diff] [blame] | 12 | #include <thread> |
Tomáš Pecka | af7b704 | 2021-04-20 20:14:13 +0200 | [diff] [blame] | 13 | #include "utils/log-fwd.h" |
| 14 | |
| 15 | namespace velia::system { |
| 16 | |
| 17 | class LED { |
| 18 | public: |
| 19 | LED(const std::shared_ptr<::sysrepo::Connection>& srConn, std::filesystem::path sysfsLeds); |
Tomáš Pecka | 63b2d65 | 2021-04-22 19:03:14 +0200 | [diff] [blame] | 20 | ~LED(); |
Tomáš Pecka | af7b704 | 2021-04-20 20:14:13 +0200 | [diff] [blame] | 21 | |
| 22 | private: |
Tomáš Pecka | 63b2d65 | 2021-04-22 19:03:14 +0200 | [diff] [blame] | 23 | void poll() const; |
| 24 | |
Tomáš Pecka | af7b704 | 2021-04-20 20:14:13 +0200 | [diff] [blame] | 25 | velia::Log m_log; |
Tomáš Pecka | 63b2d65 | 2021-04-22 19:03:14 +0200 | [diff] [blame] | 26 | std::map<std::filesystem::path, uint32_t> m_ledsMaxBrightness; |
Tomáš Pecka | af7b704 | 2021-04-20 20:14:13 +0200 | [diff] [blame] | 27 | std::shared_ptr<::sysrepo::Session> m_srSession; |
| 28 | std::shared_ptr<::sysrepo::Subscribe> m_srSubscribe; |
Tomáš Pecka | 63b2d65 | 2021-04-22 19:03:14 +0200 | [diff] [blame] | 29 | std::thread m_thr; |
| 30 | std::atomic<bool> m_thrRunning; |
Tomáš Pecka | af7b704 | 2021-04-20 20:14:13 +0200 | [diff] [blame] | 31 | }; |
| 32 | } |