blob: 8a782989fc59f113b577762b060bef1405a70704 [file] [log] [blame]
Tomáš Pecka991e4d52021-01-11 10:03:14 +01001/*
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
16namespace velia::system {
17
18class RAUC {
19public:
20 using SlotProperties = std::map<std::string, std::variant<std::string, uint64_t, uint32_t>>;
21
Tomáš Pecka9cc00942021-01-14 22:45:10 +010022 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áš Pecka991e4d52021-01-11 10:03:14 +010023 std::string primarySlot() const;
24 std::map<std::string, SlotProperties> slotStatus() const;
Tomáš Pecka9cc00942021-01-14 22:45:10 +010025 void install(const std::string& source);
Tomáš Pecka991e4d52021-01-11 10:03:14 +010026
27private:
28 std::shared_ptr<sdbus::IProxy> m_dbusObjectProxy;
Tomáš Pecka9cc00942021-01-14 22:45:10 +010029 std::function<void(const std::string&)> m_operCb;
30 std::function<void(int32_t, const std::string&)> m_progressCb;
31 std::function<void(int32_t, const std::string&)> m_completedCb;
Tomáš Pecka991e4d52021-01-11 10:03:14 +010032 velia::Log m_log;
33};
34
35}