John Wang | e2efdcc | 2020-02-12 17:02:06 +0800 | [diff] [blame] | 1 | #include "bios_attribute.hpp" |
| 2 | |
Sampa Misra | 46ece06 | 2020-03-18 07:17:44 -0500 | [diff] [blame] | 3 | #include "bios_config.hpp" |
Deepak Kodihalli | d130e1a | 2020-06-17 05:55:32 -0500 | [diff] [blame] | 4 | #include "common/utils.hpp" |
John Wang | e2efdcc | 2020-02-12 17:02:06 +0800 | [diff] [blame] | 5 | |
John Wang | e2efdcc | 2020-02-12 17:02:06 +0800 | [diff] [blame] | 6 | #include <variant> |
| 7 | |
Brad Bishop | 5079ac4 | 2021-08-19 18:35:06 -0400 | [diff] [blame] | 8 | using namespace pldm::utils; |
| 9 | |
John Wang | e2efdcc | 2020-02-12 17:02:06 +0800 | [diff] [blame] | 10 | namespace pldm |
| 11 | { |
| 12 | namespace responder |
| 13 | { |
| 14 | namespace bios |
| 15 | { |
| 16 | |
| 17 | BIOSAttribute::BIOSAttribute(const Json& entry, |
| 18 | DBusHandler* const dbusHandler) : |
| 19 | name(entry.at("attribute_name")), |
Archana Kakani | d660809 | 2024-05-23 01:14:56 -0500 | [diff] [blame^] | 20 | readOnly(false), displayName(entry.at("display_name")), |
| 21 | helpText(entry.at("help_text")), dbusHandler(dbusHandler) |
John Wang | e2efdcc | 2020-02-12 17:02:06 +0800 | [diff] [blame] | 22 | { |
George Liu | daa6923 | 2020-09-02 17:22:09 +0800 | [diff] [blame] | 23 | try |
| 24 | { |
Archana Kakani | d660809 | 2024-05-23 01:14:56 -0500 | [diff] [blame^] | 25 | readOnly = entry.at("read_only"); |
George Liu | daa6923 | 2020-09-02 17:22:09 +0800 | [diff] [blame] | 26 | } |
Kamalkumar Patel | 58cbcaf | 2023-10-06 03:48:25 -0500 | [diff] [blame] | 27 | catch (const std::exception&) |
George Liu | daa6923 | 2020-09-02 17:22:09 +0800 | [diff] [blame] | 28 | { |
| 29 | // No action required, readOnly is initialised to false |
| 30 | } |
| 31 | |
George Liu | 5bb9edb | 2021-08-05 20:10:32 +0800 | [diff] [blame] | 32 | try |
John Wang | e2efdcc | 2020-02-12 17:02:06 +0800 | [diff] [blame] | 33 | { |
George Liu | 5bb9edb | 2021-08-05 20:10:32 +0800 | [diff] [blame] | 34 | std::string objectPath = entry.at("dbus").at("object_path"); |
| 35 | std::string interface = entry.at("dbus").at("interface"); |
| 36 | std::string propertyName = entry.at("dbus").at("property_name"); |
| 37 | std::string propertyType = entry.at("dbus").at("property_type"); |
John Wang | e2efdcc | 2020-02-12 17:02:06 +0800 | [diff] [blame] | 38 | |
George Liu | 5bb9edb | 2021-08-05 20:10:32 +0800 | [diff] [blame] | 39 | dBusMap = {objectPath, interface, propertyName, propertyType}; |
| 40 | } |
Kamalkumar Patel | 58cbcaf | 2023-10-06 03:48:25 -0500 | [diff] [blame] | 41 | catch (const std::exception&) |
George Liu | 5bb9edb | 2021-08-05 20:10:32 +0800 | [diff] [blame] | 42 | { |
| 43 | // No action required, dBusMap whill have no value |
John Wang | e2efdcc | 2020-02-12 17:02:06 +0800 | [diff] [blame] | 44 | } |
| 45 | } |
| 46 | |
Sampa Misra | 46ece06 | 2020-03-18 07:17:44 -0500 | [diff] [blame] | 47 | std::optional<DBusMapping> BIOSAttribute::getDBusMap() |
| 48 | { |
| 49 | return dBusMap; |
| 50 | } |
| 51 | |
John Wang | e2efdcc | 2020-02-12 17:02:06 +0800 | [diff] [blame] | 52 | } // namespace bios |
| 53 | } // namespace responder |
| 54 | } // namespace pldm |