blob: 4cd0370048315c6466b04ae03ea226feacb40a7e [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
Jason M. Bills7b8a4472020-10-12 15:50:22 -070019#include <boost/asio/io_service.hpp>
Richard Marian Thomaiyar7a362772019-06-16 19:11:35 +053020#include <sdbusplus/asio/object_server.hpp>
21
22static constexpr const char* uBootEnvMgrServiceName =
23 "xyz.openbmc_project.U_Boot.Environment.Manager";
24static constexpr const char* uBootEnvMgrIface =
25 "xyz.openbmc_project.U_Boot.Environment.Manager";
26static constexpr const char* uBootEnvMgrPath =
27 "/xyz/openbmc_project/u_boot/environment/mgr";
28
29class UBootEnvMgr
30{
31 boost::asio::io_service& io;
32 sdbusplus::asio::object_server& server;
33 std::shared_ptr<sdbusplus::asio::connection> conn;
34 std::shared_ptr<sdbusplus::asio::dbus_interface> iface;
35
36 std::unordered_map<std::string, std::string> readAllVariable();
37 void writeVariable(const std::string& key, const std::string& value);
38
39 public:
40 UBootEnvMgr(boost::asio::io_service& io,
41 sdbusplus::asio::object_server& srv,
42 std::shared_ptr<sdbusplus::asio::connection>& conn);
43};