1 #include "bios_attribute.hpp" 2 3 #include "bios_config.hpp" 4 #include "common/utils.hpp" 5 6 #include <iostream> 7 #include <variant> 8 9 using namespace pldm::utils; 10 11 namespace pldm 12 { 13 namespace responder 14 { 15 namespace bios 16 { 17 18 BIOSAttribute::BIOSAttribute(const Json& entry, 19 DBusHandler* const dbusHandler) : 20 name(entry.at("attribute_name")), 21 readOnly(false), displayName(entry.at("displayName")), 22 helpText(entry.at("helpText")), dbusHandler(dbusHandler) 23 { 24 try 25 { 26 readOnly = entry.at("readOnly"); 27 } 28 catch (const std::exception& e) 29 { 30 // No action required, readOnly is initialised to false 31 } 32 33 try 34 { 35 std::string objectPath = entry.at("dbus").at("object_path"); 36 std::string interface = entry.at("dbus").at("interface"); 37 std::string propertyName = entry.at("dbus").at("property_name"); 38 std::string propertyType = entry.at("dbus").at("property_type"); 39 40 dBusMap = {objectPath, interface, propertyName, propertyType}; 41 } 42 catch (const std::exception& e) 43 { 44 // No action required, dBusMap whill have no value 45 } 46 } 47 48 std::optional<DBusMapping> BIOSAttribute::getDBusMap() 49 { 50 return dBusMap; 51 } 52 53 } // namespace bios 54 } // namespace responder 55 } // namespace pldm 56