From 5c2bd5ed35e73299a525a2ae1296174d0d4a5356 Mon Sep 17 00:00:00 2001 From: Patrick Venture Date: Sat, 20 Oct 2018 19:45:48 -0700 Subject: rename header: fru-area.hpp to fru_area.hpp Rename fru-area.hpp header file per the openbmc file naming convention. Change-Id: I751c8d5650bb5e71238923c4728a9cdedccc7c7f Signed-off-by: Patrick Venture --- fru_area.hpp | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 fru_area.hpp (limited to 'fru_area.hpp') diff --git a/fru_area.hpp b/fru_area.hpp new file mode 100644 index 0000000..2595e54 --- /dev/null +++ b/fru_area.hpp @@ -0,0 +1,144 @@ +#ifndef __IPMI_FRU_AREA_H__ +#define __IPMI_FRU_AREA_H__ + +#include "frup.hpp" +#include "writefrudata.hpp" + +#include +#include +#include + +#include +#include +#include + +class IPMIFruArea; +typedef std::vector> fru_area_vec_t; + +class IPMIFruArea +{ + private: + // Unique way of identifying a FRU + uint8_t iv_fruid = 0; + + // Type of the fru matching offsets in common header + ipmi_fru_area_type iv_type = IPMI_FRU_AREA_INTERNAL_USE; + + // Name of the fru area. ( BOARD/CHASSIS/PRODUCT ) + std::string iv_name; + + // Length of a specific fru area. + size_t iv_len = 0; + + // Special bit for BMC readable eeprom only. + bool iv_bmc_fru = false; + + // If a FRU is physically present. + bool iv_present = false; + + // Whether a particular area is valid ? + bool iv_valid = false; + + // Actual area data. + uint8_t* iv_data = nullptr; + + // fru inventory dbus name + std::string iv_bus_name; + + // fru inventory dbus object path + std::string iv_obj_path; + + // fru inventory dbus interface name + std::string iv_intf_name; + + // Default constructor disabled. + IPMIFruArea(); + + public: + // constructor + IPMIFruArea(const uint8_t fruid, const ipmi_fru_area_type type, + bool bmc_fru = false); + + // Destructor + virtual ~IPMIFruArea(); + + // If a particular area has been marked valid / invalid + inline bool is_valid() const + { + return iv_valid; + } + + // Sets the present bit + inline void set_present(const bool present) + { + iv_present = present; + } + + // Sets the valid bit for a corresponding area. + inline void set_valid(const bool valid) + { + iv_valid = valid; + } + + // If a particular area accessible only by BMC + inline bool is_bmc_fru() const + { + return iv_bmc_fru; + } + + // returns fru id; + uint8_t get_fruid() const + { + return iv_fruid; + } + + // Returns the length. + size_t get_len() const + { + return iv_len; + } + + // Returns the type of the current fru area + ipmi_fru_area_type get_type() const + { + return iv_type; + } + + // Returns the name + const char* get_name() const + { + return iv_name.c_str(); + } + + // Returns SD bus name + const char* get_bus_name() const + { + return iv_bus_name.c_str(); + } + + // Retrns SD bus object path + const char* get_obj_path() const + { + return iv_obj_path.c_str(); + } + + // Returns SD bus interface name + const char* get_intf_name() const + { + return iv_intf_name.c_str(); + } + + // Returns the data portion + inline uint8_t* get_data() const + { + return iv_data; + } + + // Accepts a pointer to data and sets it in the object. + void set_data(const uint8_t*, const size_t); + + // Sets the dbus parameters + void update_dbus_paths(const char*, const char*, const char*); +}; + +#endif -- cgit v1.2.1