| Richard Marian Thomaiyar | 7a36277 | 2019-06-16 19:11:35 +0530 | [diff] [blame] | 1 | /* | 
 | 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. Bills | 7b8a447 | 2020-10-12 15:50:22 -0700 | [diff] [blame] | 19 | #include <boost/asio/io_service.hpp> | 
| Richard Marian Thomaiyar | 7a36277 | 2019-06-16 19:11:35 +0530 | [diff] [blame] | 20 | #include <sdbusplus/asio/object_server.hpp> | 
 | 21 |  | 
 | 22 | static constexpr const char* uBootEnvMgrServiceName = | 
 | 23 |     "xyz.openbmc_project.U_Boot.Environment.Manager"; | 
 | 24 | static constexpr const char* uBootEnvMgrIface = | 
 | 25 |     "xyz.openbmc_project.U_Boot.Environment.Manager"; | 
 | 26 | static constexpr const char* uBootEnvMgrPath = | 
 | 27 |     "/xyz/openbmc_project/u_boot/environment/mgr"; | 
 | 28 |  | 
 | 29 | class 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 | }; |