Code refactoring
Moved all the constants to const.hpp and utility method to
utils.cpp/hpp.
Removed file ibm_vpd_type_check.cpp/hpp and keyword_vpd_types.hpp.
Signed-off-by: SunnySrivastava1984 <sunnsr25@in.ibm.com>
Change-Id: Ie7b54e6fd03a499fab7c3124e17292c6d525e471
diff --git a/utils.cpp b/utils.cpp
index 6002b9c..24d7b4c 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -11,7 +11,7 @@
{
namespace vpd
{
-
+using namespace openpower::vpd::constants;
namespace inventory
{
@@ -68,7 +68,35 @@
} // namespace inventory
-using namespace openpower::vpd::constants;
+vpdType vpdTypeCheck(const Binary& vpdVector)
+{
+ // Read first 3 Bytes to check the 11S bar code format
+ std::string is11SFormat = "";
+ for (uint8_t i = 0; i < FORMAT_11S_LEN; i++)
+ {
+ is11SFormat += vpdVector[MEMORY_VPD_DATA_START + i];
+ }
+
+ if (vpdVector[IPZ_DATA_START] == KW_VAL_PAIR_START_TAG)
+ {
+ // IPZ VPD FORMAT
+ return vpdType::IPZ_VPD;
+ }
+ else if (vpdVector[KW_VPD_DATA_START] == KW_VPD_START_TAG)
+ {
+ // KEYWORD VPD FORMAT
+ return vpdType::KEYWORD_VPD;
+ }
+ else if (is11SFormat.compare(MEMORY_VPD_START_TAG) == 0)
+ {
+ // Memory VPD format
+ return vpdType::MEMORY_VPD;
+ }
+
+ // INVALID VPD FORMAT
+ return vpdType::INVALID_VPD_FORMAT;
+}
+
LE2ByteData readUInt16LE(Binary::const_iterator iterator)
{
LE2ByteData lowByte = *iterator;