blob: f6b3912dd4df2e7d5288e1e5f8a6a6d09fea4d2c [file] [log] [blame]
Sampa Misra46ece062020-03-18 07:17:44 -05001#include "config.h"
2
John Wange2efdcc2020-02-12 17:02:06 +08003#include "bios_attribute.hpp"
4
Sampa Misra46ece062020-03-18 07:17:44 -05005#include "bios_config.hpp"
John Wange2efdcc2020-02-12 17:02:06 +08006#include "utils.hpp"
7
8#include <iostream>
9#include <variant>
10
11namespace pldm
12{
13namespace responder
14{
15namespace bios
16{
17
18BIOSAttribute::BIOSAttribute(const Json& entry,
19 DBusHandler* const dbusHandler) :
20 name(entry.at("attribute_name")),
21 readOnly(!entry.contains("dbus")), dbusHandler(dbusHandler)
22{
23 if (!readOnly)
24 {
25 std::string objectPath = entry.at("dbus").at("object_path");
26 std::string interface = entry.at("dbus").at("interface");
27 std::string propertyName = entry.at("dbus").at("property_name");
28 std::string propertyType = entry.at("dbus").at("property_type");
29
30 dBusMap = {objectPath, interface, propertyName, propertyType};
31 }
32}
33
Sampa Misra46ece062020-03-18 07:17:44 -050034std::optional<DBusMapping> BIOSAttribute::getDBusMap()
35{
36 return dBusMap;
37}
38
John Wange2efdcc2020-02-12 17:02:06 +080039} // namespace bios
40} // namespace responder
41} // namespace pldm