~aleteoryx/muditaos

ref: 943fef9643ba6f4dd399f90f1da11e53d82301a7 muditaos/module-services/service-db/agents/settings/FactorySettings.hpp -rw-r--r-- 927 bytes
943fef96 — Radoslaw Wicik [BH-353] Add Documentation for main targets 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <Database/Database.hpp>
#include <purefs/filesystem_paths.hpp>
#include <json/json11.hpp>
#include <fstream>
#include <module-services/service-db/service-db/SettingsMessages.hpp>
#include "Settings_queries.hpp"

namespace settings
{
    namespace factory
    {
        constexpr auto entry_key = "factory_data";
    }

    class FactorySettings
    {
      public:
        FactorySettings(std::string path) : filePath(path)
        {}

        [[nodiscard]] std::unique_ptr<QueryResult> getMfgEntries();
        void initDb(Database *database);

      private:
        json11::Json readMfgSettings(const std::string &path);
        std::string readFileContent(const std::string &filename) const noexcept;

        std::string filePath;
    };

} // namespace settings