inventory : adhere to change in PIM Notify()

Change-Id: I83efc8ad799aaa879525d84b97779d5b98f168c4
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/writefrudata.cpp b/writefrudata.cpp
index c5f2539..9a19e7d 100644
--- a/writefrudata.cpp
+++ b/writefrudata.cpp
@@ -481,34 +481,30 @@
         std::cerr << e.what() << "\n";
         return -1;
     }
-    auto notify = [&]()
-    {
-        return bus.new_method_call(
-                service.c_str(),
-                path.c_str(),
-                intf.c_str(),
-                "Notify");
-    };
 
     auto iter = frus.find(fruid);
     if (iter == frus.end())
     {
-        std::cerr << "ERROR Unable to get the fru info for FRU=" << fruid << "\n";
+        std::cerr << "ERROR Unable to get the fru info for FRU="
+                  << static_cast<int>(fruid) << "\n";
         return -1;
     }
 
     auto& instanceList = iter->second;
     if (instanceList.size() <= 0)
     {
-        std::cout << "Object List empty for this FRU=" << fruid << "\n";
+        std::cout << "Object List empty for this FRU="
+                  << static_cast<int>(fruid) << "\n";
     }
+
+    ObjectMap objects;
     for (auto& instance : instanceList)
     {
-        InterfaceList interfaces;
+        InterfaceMap interfaces;
 
         for (auto& interfaceList : instance.second)
         {
-            PropertiesList prop;//store all the properties
+            PropertyMap props;//store all the properties
             for (auto& properties : interfaceList.second)
             {
                 std::string section, property, value;
@@ -528,22 +524,27 @@
                 {
                     value = getFRUValue(section, property, fruData);
                 }
-                prop.emplace(std::move(properties.first), std::move(value));
+                props.emplace(std::move(properties.first), std::move(value));
             }
-            interfaces.emplace(std::move(interfaceList.first), std::move(prop));
+            interfaces.emplace(std::move(interfaceList.first), std::move(props));
         }
-        //Call the inventory manager
-        sdbusplus::message::object_path relPath = instance.first;
 
-        auto m = notify();
-        m.append(relPath);
-        m.append(interfaces);
-        auto inventoryMgrResponseMsg = bus.call(m);
-        if (inventoryMgrResponseMsg.is_method_error())
-        {
-            std::cerr << "Error in notify call\n";
-            return -1;
-        }
+        //Call the inventory manager
+        sdbusplus::message::object_path path = instance.first;
+        objects.emplace(path,interfaces);
+    }
+
+    auto pimMsg = bus.new_method_call(
+                          service.c_str(),
+                          path.c_str(),
+                          intf.c_str(),
+                          "Notify");
+    pimMsg.append(std::move(objects));
+    auto inventoryMgrResponseMsg = bus.call(pimMsg);
+    if (inventoryMgrResponseMsg.is_method_error())
+    {
+        std::cerr << "Error in notify call\n";
+        return -1;
     }
     return rc;
 }