blob: d033b4de833f546d798a6153ce63222c69ede02b [file] [log] [blame]
Richard Marian Thomaiyar7a362772019-06-16 19:11:35 +05301/*
2// Copyright (c) 2019 Intel Corporation
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15*/
16
17#pragma once
18
19#include <sdbusplus/asio/object_server.hpp>
20
21static constexpr const char* uBootEnvMgrServiceName =
22 "xyz.openbmc_project.U_Boot.Environment.Manager";
23static constexpr const char* uBootEnvMgrIface =
24 "xyz.openbmc_project.U_Boot.Environment.Manager";
25static constexpr const char* uBootEnvMgrPath =
26 "/xyz/openbmc_project/u_boot/environment/mgr";
27
28class UBootEnvMgr
29{
30 boost::asio::io_service& io;
31 sdbusplus::asio::object_server& server;
32 std::shared_ptr<sdbusplus::asio::connection> conn;
33 std::shared_ptr<sdbusplus::asio::dbus_interface> iface;
34
35 std::unordered_map<std::string, std::string> readAllVariable();
36 void writeVariable(const std::string& key, const std::string& value);
37
38 public:
39 UBootEnvMgr(boost::asio::io_service& io,
40 sdbusplus::asio::object_server& srv,
41 std::shared_ptr<sdbusplus::asio::connection>& conn);
42};