Tomáš Pecka | 991e4d5 | 2021-01-11 10:03:14 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 CESNET, https://photonics.cesnet.cz/ |
| 3 | * |
| 4 | * Written by Tomáš Pecka <tomas.pecka@fit.cvut.cz> |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #pragma once |
| 9 | |
| 10 | #include <map> |
| 11 | #include <sdbus-c++/sdbus-c++.h> |
| 12 | #include <string> |
| 13 | #include <variant> |
| 14 | #include "utils/log-fwd.h" |
| 15 | |
| 16 | namespace velia::system { |
| 17 | |
| 18 | class RAUC { |
| 19 | public: |
| 20 | using SlotProperties = std::map<std::string, std::variant<std::string, uint64_t, uint32_t>>; |
| 21 | |
Tomáš Pecka | 9cc0094 | 2021-01-14 22:45:10 +0100 | [diff] [blame] | 22 | RAUC(sdbus::IConnection& connection, std::function<void(const std::string&)> operCb, std::function<void(int32_t, const std::string&)> progressCb, std::function<void(int32_t, const std::string&)> completedCb); |
Tomáš Pecka | 991e4d5 | 2021-01-11 10:03:14 +0100 | [diff] [blame] | 23 | std::string primarySlot() const; |
| 24 | std::map<std::string, SlotProperties> slotStatus() const; |
Tomáš Pecka | 9cc0094 | 2021-01-14 22:45:10 +0100 | [diff] [blame] | 25 | void install(const std::string& source); |
Tomáš Pecka | c764b76 | 2021-01-23 21:46:21 +0100 | [diff] [blame^] | 26 | std::string operation() const; |
| 27 | std::string lastError() const; |
Tomáš Pecka | 991e4d5 | 2021-01-11 10:03:14 +0100 | [diff] [blame] | 28 | |
| 29 | private: |
| 30 | std::shared_ptr<sdbus::IProxy> m_dbusObjectProxy; |
Tomáš Pecka | 9cc0094 | 2021-01-14 22:45:10 +0100 | [diff] [blame] | 31 | std::function<void(const std::string&)> m_operCb; |
| 32 | std::function<void(int32_t, const std::string&)> m_progressCb; |
| 33 | std::function<void(int32_t, const std::string&)> m_completedCb; |
Tomáš Pecka | 991e4d5 | 2021-01-11 10:03:14 +0100 | [diff] [blame] | 34 | velia::Log m_log; |
| 35 | }; |
| 36 | |
| 37 | } |