blob: d7a485783c2f5d934f1e331c2f431bbbc435f62d [file] [log] [blame]
Christopher Meis59ef1e72025-04-16 08:53:25 +02001#pragma once
2
3#include <boost/asio/io_context.hpp>
4#include <boost/container/flat_map.hpp>
5#include <nlohmann/json.hpp>
6#include <sdbusplus/asio/connection.hpp>
7
Christopher Meis59ef1e72025-04-16 08:53:25 +02008using DBusValueVariant =
9 std::variant<std::string, int64_t, uint64_t, double, int32_t, uint32_t,
10 int16_t, uint16_t, uint8_t, bool, std::vector<uint8_t>>;
11using DBusInterface = boost::container::flat_map<std::string, DBusValueVariant>;
12using DBusObject = boost::container::flat_map<std::string, DBusInterface>;
13
14constexpr const char* configurationOutDir = "/var/configuration/";
15constexpr const char* versionHashFile = "/var/configuration/version";
16constexpr const char* versionFile = "/etc/os-release";
17
18namespace em_utils
19{
20
21namespace properties
22{
23constexpr const char* interface = "org.freedesktop.DBus.Properties";
24constexpr const char* get = "Get";
25} // namespace properties
26
Christopher Meis59ef1e72025-04-16 08:53:25 +020027bool fwVersionIsSame();
28
Chau Ly79629442025-08-20 10:27:20 +000029void handleLeftOverTemplateVars(nlohmann::json::iterator& keyPair);
30
Christopher Meis59ef1e72025-04-16 08:53:25 +020031std::optional<std::string> templateCharReplace(
32 nlohmann::json::iterator& keyPair, const DBusObject& object, size_t index,
33 const std::optional<std::string>& replaceStr = std::nullopt);
34
35std::optional<std::string> templateCharReplace(
36 nlohmann::json::iterator& keyPair, const DBusInterface& interface,
37 size_t index, const std::optional<std::string>& replaceStr = std::nullopt);
38
Christopher Meis811160e2025-08-08 08:48:37 +020039std::string buildInventorySystemPath(std::string& boardName,
40 const std::string& boardType);
41
Christopher Meis59ef1e72025-04-16 08:53:25 +020042} // namespace em_utils