blob: 779bab1172a7d2f46b8b9da5ef9f1cedde8c89c0 [file] [log] [blame]
#ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_UTILS_FRAM_UTILS_H_
#define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_UTILS_FRAM_UTILS_H_
#include <memory>
#include "absl/status/statusor.h"
#include "tlbmc/hal/fru_scanner.h"
#include "fru.pb.h"
namespace milotic_tlbmc {
// Constructs a RawFru proto from the information extracted from the FRAM data
// contained within the provided I2cFruInfo object.
// This function uses an internal helper (ParseFramData) to parse the raw byte
// data from the I2cFruInfo object. It then populates the fields in the RawFru
// proto, including I2C bus and address information, and specific FRU fields
// like serial number, product name, and board manufacturer.
//
// Args:
// i2c_fru: A unique pointer to an I2cFruInfo struct containing the raw
// FRAM data and the I2C bus/address where it was read from.
//
// Returns:
// A RawFru proto populated with the information from the FRAM, or an error
// status if the data cannot be parsed or essential information is missing.
absl::StatusOr<RawFru> CreateRawFruFromFramData(
const std::unique_ptr<I2cFruInfo>& i2c_fru);
} // namespace milotic_tlbmc
#endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_UTILS_FRAM_UTILS_H_