Change primary postcode interface to byte array

Change primary code to std::vector<uint8_t> to meet the changes in
phosphor-dbus-interface.

[1] https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/74633

Change-Id: Ib5822973a1dbc6aa8c52f4e81b56091dc33b5f08
Signed-off-by: Cosmo Chou <cosmo.chou@quantatw.com>
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
diff --git a/ipmisnoop/ipmisnoop.cpp b/ipmisnoop/ipmisnoop.cpp
index 56d06d9..474fc34 100644
--- a/ipmisnoop/ipmisnoop.cpp
+++ b/ipmisnoop/ipmisnoop.cpp
@@ -113,12 +113,12 @@
 
                 if (posVal > minPositionVal && posVal < maxPositionVal)
                 {
-                    std::tuple<uint64_t, secondary_post_code_t> postcodes =
-                        reporters[posVal - 1]->value();
-                    uint64_t postcode = std::get<uint64_t>(postcodes);
+                    std::tuple<primary_post_code_t, secondary_post_code_t>
+                        postcodes = reporters[posVal - 1]->value();
+                    auto postcode = std::get<0>(postcodes);
 
                     // write postcode into seven segment display
-                    if (postCodeDisplay(postcode) < 0)
+                    if (postCodeDisplay(postcode[0]) < 0)
                     {
                         fprintf(stderr, "Error in display the postcode\n");
                     }
diff --git a/ipmisnoop/ipmisnoop.hpp b/ipmisnoop/ipmisnoop.hpp
index d8319ac..3f52275 100644
--- a/ipmisnoop/ipmisnoop.hpp
+++ b/ipmisnoop/ipmisnoop.hpp
@@ -19,7 +19,6 @@
 const std::string ipmiSnoopObject = "/xyz/openbmc_project/state/boot/raw";
 
 const int hostParseIdx = 3;
-const int maxPostcode = 255;
 const int maxPosition = 4;
 
 extern bool sevenSegmentLedEnabled;
@@ -54,7 +53,7 @@
             sdbusplus::bus::match::rules::propertiesChanged(objPath, rawIface),
 
             [this, &bus](sdbusplus::message_t& msg) {
-                using primarycode_t = uint64_t;
+                using primarycode_t = std::vector<uint8_t>;
                 using secondarycode_t = std::vector<uint8_t>;
                 using postcode_t = std::tuple<primarycode_t, secondarycode_t>;
 
@@ -95,18 +94,15 @@
                     std::cerr << "Value property is not found " << std::endl;
                     return;
                 }
-                uint64_t postcode =
+                auto postcode =
                     std::get<0>(std::get<postcode_t>(valPropMap->second));
 
-                if (postcode <= maxPostcode)
+                if (postcode.size() == 1)
                 {
                     if (position == hostNum)
                     {
-                        uint8_t postcode_8bit =
-                            static_cast<uint8_t>(postcode & 0x0000FF);
-
                         // write postcode into seven segment display
-                        if (postCodeDisplay(postcode_8bit) < 0)
+                        if (postCodeDisplay(postcode[0]) < 0)
                         {
                             fprintf(stderr, "Error in display the postcode\n");
                         }