George Liu | 682ee18 | 2020-12-25 15:24:33 +0800 | [diff] [blame] | 1 | #include "custom_dbus.hpp" |
| 2 | |
| 3 | namespace pldm |
| 4 | { |
| 5 | namespace dbus |
| 6 | { |
| 7 | void CustomDBus::setLocationCode(const std::string& path, std::string value) |
| 8 | { |
| 9 | if (!location.contains(path)) |
| 10 | { |
| 11 | location.emplace(path, |
| 12 | std::make_unique<LocationIntf>( |
| 13 | pldm::utils::DBusHandler::getBus(), path.c_str())); |
| 14 | } |
| 15 | |
| 16 | location.at(path)->locationCode(value); |
| 17 | } |
| 18 | |
| 19 | std::optional<std::string> |
| 20 | CustomDBus::getLocationCode(const std::string& path) const |
| 21 | { |
| 22 | if (location.contains(path)) |
| 23 | { |
| 24 | return location.at(path)->locationCode(); |
| 25 | } |
| 26 | |
| 27 | return std::nullopt; |
| 28 | } |
| 29 | |
| 30 | } // namespace dbus |
| 31 | } // namespace pldm |