~aleteoryx/muditaos

ref: 0eb652a5152de6bdf77c897a787d037d6e6b43d4 muditaos/module-services/service-db/agents/settings/FactorySettings.hpp -rw-r--r-- 852 bytes
0eb652a5 — Kuba Kleczkowski [MOS-792] Added VoLTE setting in db 3 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
// 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 <json11.hpp>
#include <fstream>
#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