15c2bd5edSPatrick Venture #ifndef __IPMI_FRU_AREA_H__ 25c2bd5edSPatrick Venture #define __IPMI_FRU_AREA_H__ 35c2bd5edSPatrick Venture 45c2bd5edSPatrick Venture #include "frup.hpp" 55c2bd5edSPatrick Venture #include "writefrudata.hpp" 65c2bd5edSPatrick Venture 7b4c333f9SPatrick Venture #include <cstdint> 85c2bd5edSPatrick Venture #include <memory> 95c2bd5edSPatrick Venture #include <string> 105c2bd5edSPatrick Venture #include <vector> 115c2bd5edSPatrick Venture 12b4c333f9SPatrick Venture using std::uint8_t; 13b4c333f9SPatrick Venture 145c2bd5edSPatrick Venture class IPMIFruArea 155c2bd5edSPatrick Venture { 165c2bd5edSPatrick Venture public: 17ac988990SPatrick Venture IPMIFruArea() = delete; 18*1d00178aSPatrick Venture ~IPMIFruArea() = default; 19ac988990SPatrick Venture 205c2bd5edSPatrick Venture // constructor 219f65a08fSPatrick Venture IPMIFruArea(const uint8_t fruID, const ipmi_fru_area_type type, 229f65a08fSPatrick Venture bool bmcOnlyFru = false); 235c2bd5edSPatrick Venture 245c2bd5edSPatrick Venture // Sets the present bit 25f22b36a0SPatrick Venture inline void setPresent(const bool present) 265c2bd5edSPatrick Venture { 27b9d33736SPatrick Venture isPresent = present; 285c2bd5edSPatrick Venture } 295c2bd5edSPatrick Venture 305c2bd5edSPatrick Venture // returns fru id; 31f22b36a0SPatrick Venture uint8_t getFruID() const 325c2bd5edSPatrick Venture { 339f65a08fSPatrick Venture return fruID; 345c2bd5edSPatrick Venture } 355c2bd5edSPatrick Venture 365c2bd5edSPatrick Venture // Returns the length. 37f22b36a0SPatrick Venture size_t getLength() const 385c2bd5edSPatrick Venture { 39f0f1ab9fSPatrick Venture return data.size(); 405c2bd5edSPatrick Venture } 415c2bd5edSPatrick Venture 425c2bd5edSPatrick Venture // Returns the type of the current fru area 43f22b36a0SPatrick Venture ipmi_fru_area_type getType() const 445c2bd5edSPatrick Venture { 45b9d33736SPatrick Venture return type; 465c2bd5edSPatrick Venture } 475c2bd5edSPatrick Venture 485c2bd5edSPatrick Venture // Returns the name 49f22b36a0SPatrick Venture const char* getName() const 505c2bd5edSPatrick Venture { 51b9d33736SPatrick Venture return name.c_str(); 525c2bd5edSPatrick Venture } 535c2bd5edSPatrick Venture 545c2bd5edSPatrick Venture // Returns SD bus name 55f22b36a0SPatrick Venture const char* getBusName() const 565c2bd5edSPatrick Venture { 579f65a08fSPatrick Venture return busName.c_str(); 585c2bd5edSPatrick Venture } 595c2bd5edSPatrick Venture 605c2bd5edSPatrick Venture // Retrns SD bus object path 61f22b36a0SPatrick Venture const char* getObjectPath() const 625c2bd5edSPatrick Venture { 639f65a08fSPatrick Venture return objectPath.c_str(); 645c2bd5edSPatrick Venture } 655c2bd5edSPatrick Venture 665c2bd5edSPatrick Venture // Returns SD bus interface name 67f22b36a0SPatrick Venture const char* getInterfaceName() const 685c2bd5edSPatrick Venture { 699f65a08fSPatrick Venture return interfaceName.c_str(); 705c2bd5edSPatrick Venture } 715c2bd5edSPatrick Venture 725c2bd5edSPatrick Venture // Returns the data portion 73f0f1ab9fSPatrick Venture inline const uint8_t* getData() const 745c2bd5edSPatrick Venture { 75f0f1ab9fSPatrick Venture return data.data(); 765c2bd5edSPatrick Venture } 775c2bd5edSPatrick Venture 785c2bd5edSPatrick Venture // Accepts a pointer to data and sets it in the object. 79f22b36a0SPatrick Venture void setData(const uint8_t*, const size_t); 805c2bd5edSPatrick Venture 815c2bd5edSPatrick Venture // Sets the dbus parameters 82f22b36a0SPatrick Venture void updateDbusPaths(const char*, const char*, const char*); 83524ba9c1SPatrick Venture 84524ba9c1SPatrick Venture private: 85524ba9c1SPatrick Venture // Unique way of identifying a FRU 869f65a08fSPatrick Venture uint8_t fruID = 0; 87524ba9c1SPatrick Venture 88524ba9c1SPatrick Venture // Type of the fru matching offsets in common header 89524ba9c1SPatrick Venture ipmi_fru_area_type type = IPMI_FRU_AREA_INTERNAL_USE; 90524ba9c1SPatrick Venture 91524ba9c1SPatrick Venture // Name of the fru area. ( BOARD/CHASSIS/PRODUCT ) 92524ba9c1SPatrick Venture std::string name; 93524ba9c1SPatrick Venture 94524ba9c1SPatrick Venture // Special bit for BMC readable eeprom only. 959f65a08fSPatrick Venture bool bmcOnlyFru = false; 96524ba9c1SPatrick Venture 97524ba9c1SPatrick Venture // If a FRU is physically present. 98524ba9c1SPatrick Venture bool isPresent = false; 99524ba9c1SPatrick Venture 100524ba9c1SPatrick Venture // Whether a particular area is valid ? 101524ba9c1SPatrick Venture bool isValid = false; 102524ba9c1SPatrick Venture 103524ba9c1SPatrick Venture // Actual area data. 104f0f1ab9fSPatrick Venture std::vector<uint8_t> data; 105524ba9c1SPatrick Venture 106524ba9c1SPatrick Venture // fru inventory dbus name 1079f65a08fSPatrick Venture std::string busName; 108524ba9c1SPatrick Venture 109524ba9c1SPatrick Venture // fru inventory dbus object path 1109f65a08fSPatrick Venture std::string objectPath; 111524ba9c1SPatrick Venture 112524ba9c1SPatrick Venture // fru inventory dbus interface name 1139f65a08fSPatrick Venture std::string interfaceName; 1145c2bd5edSPatrick Venture }; 1155c2bd5edSPatrick Venture 1165c2bd5edSPatrick Venture #endif 117