pldmtool : obtain PLDM Instance Id

This commit makes a dbus call and obtains the
instanceId and modifies the request message and
corresponding response message is obtained.
The loopback response message logic is removed as it
is the request message itself being received and
there is no need to specifically process this.
The code is simplified to just wait on a
matching response message.

Tested:
./pldmtool base GetPLDMTypes
& ./pldmtool base GetPLDMTypes
Encode request successfully
Request Message:
08 01 80 00 04
Success in creating the socket : RC = 4
Success in connecting to socket : RC = 0
Success in sending message type as pldm to mctp : RC = 0
Write to socket successful : RC = 5
Total length: 14
Encode request successfully
Request Message:
08 01 81 00 04
Success in creating the socket : RC = 4
Success in connecting to socket : RC = 0
Success in sending message type as pldm to mctp : RC = 0
Write to socket successful : RC = 5
Total length: 14
Shutdown Socket successful :  RC = 0
Response Message:
08 01 01 00 04 00 1d 00 00 00 00 00 00 00
Shutdown Socket successful :  RC = 0
Response Message:
08 01 00 00 04 00 1d 00 00 00 00 00 00 00
Supported types: 0(base) 2(platform) 3(bios) 4(fru)
Supported types: 0(base) 2(platform) 3(bios) 4(fru)

Change-Id: I688b58bdade817645321942b4a798e14e75b6021
Signed-off-by: Pavithra Barithaya <pbaritha@in.ibm.com>
diff --git a/tool/pldm_base_cmd.cpp b/tool/pldm_base_cmd.cpp
index d55195d..b1028d0 100644
--- a/tool/pldm_base_cmd.cpp
+++ b/tool/pldm_base_cmd.cpp
@@ -62,7 +62,7 @@
     {
         std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr));
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
-        auto rc = encode_get_types_req(PLDM_LOCAL_INSTANCE_ID, request);
+        auto rc = encode_get_types_req(instanceId, request);
         return {rc, requestMsg};
     }
 
@@ -130,8 +130,8 @@
                                         PLDM_GET_VERSION_REQ_BYTES);
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
 
-        auto rc = encode_get_version_req(PLDM_LOCAL_INSTANCE_ID, 0,
-                                         PLDM_GET_FIRSTPART, pldmType, request);
+        auto rc = encode_get_version_req(instanceId, 0, PLDM_GET_FIRSTPART,
+                                         pldmType, request);
         return {rc, requestMsg};
     }
 
@@ -183,7 +183,7 @@
     {
         std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr));
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
-        auto rc = encode_get_tid_req(PLDM_LOCAL_INSTANCE_ID, request);
+        auto rc = encode_get_tid_req(instanceId, request);
         return {rc, requestMsg};
     }
 
@@ -229,8 +229,8 @@
                                         PLDM_GET_COMMANDS_REQ_BYTES);
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
         ver32_t version{0xFF, 0xFF, 0xFF, 0xFF};
-        auto rc = encode_get_commands_req(PLDM_LOCAL_INSTANCE_ID, pldmType,
-                                          version, request);
+        auto rc =
+            encode_get_commands_req(instanceId, pldmType, version, request);
         return {rc, requestMsg};
     }