| // Copyright 2024 Google LLC |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| #pragma once |
| |
| #include "google3/host_commands.h" |
| |
| #include "host_command.hpp" |
| |
| #include <sdbusplus/bus.hpp> |
| #include <xyz/openbmc_project/Software/Version/server.hpp> |
| |
| namespace google |
| { |
| namespace hoth |
| { |
| |
| template <typename... T> |
| using ServerObject = typename sdbusplus::server::object::object<T...>; |
| using VersionInterface = |
| sdbusplus::xyz::openbmc_project::Software::server::Version; |
| using VersionObject = ServerObject<VersionInterface>; |
| |
| using internal::HostCommand; |
| |
| /** @class RoVersion |
| * @brief Software Version interface implementation for Ro Version. |
| * @details A concrete implementation for xyz.openbmc_project.Software.Version |
| * DBus API. |
| */ |
| class RoVersion : public VersionObject |
| { |
| public: |
| RoVersion(sdbusplus::bus::bus& bus, const char* objPath, |
| HostCommand* hostCmd) : |
| VersionObject(bus, objPath), |
| hostCmd(hostCmd) |
| {} |
| |
| std::string version() const override; |
| |
| private: |
| /** @brief Connection to Hoth for sending and receiving host commands */ |
| HostCommand* hostCmd; |
| }; |
| |
| /** @class RwVersion |
| * @brief Software Version interface implementation for Rw Version. |
| * @details A concrete implementation for xyz.openbmc_project.Software.Version |
| * DBus API. |
| */ |
| class RwVersion : public VersionObject |
| { |
| public: |
| RwVersion(sdbusplus::bus::bus& bus, const char* objPath, |
| HostCommand* hostCmd) : |
| VersionObject(bus, objPath), |
| hostCmd(hostCmd) |
| {} |
| |
| std::string version() const override; |
| |
| private: |
| /** @brief Connection to Hoth for sending and receiving host commands */ |
| HostCommand* hostCmd; |
| }; |
| |
| } // namespace hoth |
| |
| } // namespace google |