Link with libphosphor_dbus

Link with libphosphor_dbus.

Update the manager implementation to match the new server binding
in libphosphor_dbus (bool types for notify and notify
signature change).

Change-Id: I033d224965caf737591e363b3e2fd666605bff13
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/Makefile.am b/Makefile.am
index 1673362..b684c4a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,10 +13,10 @@
 phosphor_inventory_CFLAGS = $(SDBUSPLUS_CFLAGS)
 
 libmanagercommon_la_SOURCES = \
-	xyz.openbmc_project.Inventory.Manager.cpp \
 	events.cpp \
 	manager.cpp
-libmanagercommon_la_LIBADD = $(SDBUSPLUS_LIBS)
+libmanagercommon_la_LIBADD = $(SDBUSPLUS_LIBS) $(PHOSPHOR_DBUS_INTERFACES_LIBS)
+libmanagercommon_la_CFLAGS = $(SDBUSPLUS_CFLAGS) $(PHOSPHOR_DBUS_INTERACES_CFLAGS)
 
 libmanager_la_SOURCES = \
 	extra_ifaces.cpp \
diff --git a/configure.ac b/configure.ac
index e9b30fe..526770c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,6 +23,8 @@
 PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
 PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],,
     AC_MSG_ERROR(["Requires sdbusplus package."]))
+PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],,
+    AC_MSG_ERROR(["Requires phosphor-dbus-interfaces package."]))
 
 # Checks for typedefs, structures, and compiler characteristics.
 AX_CXX_COMPILE_STDCXX_14([noext])
diff --git a/manager.cpp b/manager.cpp
index 8026bf0..bb94c21 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -144,11 +144,11 @@
     }
 }
 
-void Manager::notify(sdbusplus::message::object_path path, Object object)
+void Manager::notify(std::map<sdbusplus::message::object_path, Object> objs)
 {
     try
     {
-        createObjects({std::make_pair(path, object)});
+        createObjects(objs);
     }
     catch (const std::exception& e)
     {
diff --git a/manager.hpp b/manager.hpp
index e6c08bf..8b59c1b 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -5,7 +5,7 @@
 #include <string>
 #include <vector>
 #include <sdbusplus/server.hpp>
-#include "xyz/openbmc_project/Inventory/Manager/server.hpp"
+#include <xyz/openbmc_project/Inventory/Manager/server.hpp>
 #include "events.hpp"
 #include "actions.hpp"
 #include "types.hpp"
@@ -92,7 +92,8 @@
         void shutdown() noexcept;
 
         /** @brief sd_bus Notify method implementation callback. */
-        void notify(sdbusplus::message::object_path, Object) override;
+        void notify(
+            std::map<sdbusplus::message::object_path, Object> objs) override;
 
         /** @brief Event processing entry point. */
         void handleEvent(sdbusplus::message::message&,
diff --git a/test/test.cpp b/test/test.cpp
index 6ffad51..0a941f7 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -26,6 +26,9 @@
 using namespace std::literals::chrono_literals;
 using namespace std::literals::string_literals;
 
+using Object = phosphor::inventory::manager::Object;
+using ObjectMap = std::map<sdbusplus::message::object_path, Object>;
+
 constexpr auto MGR_SERVICE = "phosphor.inventory.test.mgr";
 constexpr auto MGR_INTERFACE = IFACE;
 constexpr auto MGR_ROOT = "/testing/inventory";
@@ -94,7 +97,6 @@
     sdbusplus::server::manager::manager objmgr;
 };
 
-using Object = phosphor::inventory::manager::Object;
 
 /** @class SignalQueue
  *  @brief Store DBus signals in a queue.
@@ -201,11 +203,11 @@
     {
         {
             "xyz.openbmc_project.Example.Iface1",
-            {{"ExampleProperty1", "test1"}}
+            {{"ExampleProperty1", "test1"s}}
         },
         {
             "xyz.openbmc_project.Example.Iface2",
-            {{"ExampleProperty2", "test2"}}
+            {{"ExampleProperty2", "test2"s}}
         },
     };
 
@@ -236,8 +238,7 @@
             "path='" + root + "',member='InterfacesAdded'");
 
         auto m = notify();
-        m.append(relPath);
-        m.append(obj);
+        m.append(ObjectMap({{relPath, obj}}));
         b.call(m);
 
         auto sig{queue.pop()};
@@ -257,8 +258,7 @@
         // Create an object to be deleted.
         {
             auto m = notify();
-            m.append(relDeleteMeThree);
-            m.append(obj);
+            m.append(ObjectMap({{relDeleteMeThree, obj}}));
             b.call(m);
         }
 
@@ -330,20 +330,17 @@
         // Create some objects to be deleted by an action.
         {
             auto m = notify();
-            m.append(relDeleteMeOne);
-            m.append(obj);
+            m.append(ObjectMap({{relDeleteMeOne, obj}}));
             b.call(m);
         }
         {
             auto m = notify();
-            m.append(relDeleteMeTwo);
-            m.append(obj);
+            m.append(ObjectMap({{relDeleteMeTwo, obj}}));
             b.call(m);
         }
         {
             auto m = notify();
-            m.append(relDeleteMeThree);
-            m.append(obj);
+            m.append(ObjectMap({{relDeleteMeThree, obj}}));
             b.call(m);
         }
 
@@ -448,8 +445,7 @@
         // Create an object to be updated by the set property action.
         {
             auto m = notify();
-            m.append(relChangeMe);
-            m.append(obj);
+            m.append(ObjectMap({{relChangeMe, obj}}));
             b.call(m);
         }
 
diff --git a/types.hpp b/types.hpp
index 3643bb1..ce43d11 100644
--- a/types.hpp
+++ b/types.hpp
@@ -12,7 +12,8 @@
 {
 
 /** @brief Inventory manager supported property types. */
-using InterfaceVariantType = sdbusplus::message::variant<int64_t, std::string>;
+using InterfaceVariantType =
+    sdbusplus::message::variant<bool, int64_t, std::string>;
 
 template <typename T>
 using InterfaceType = std::map<std::string, T>;
diff --git a/xyz.openbmc_project.Inventory.Manager.cpp b/xyz.openbmc_project.Inventory.Manager.cpp
deleted file mode 100644
index 787b65f..0000000
--- a/xyz.openbmc_project.Inventory.Manager.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-#include <algorithm>
-#include <sdbusplus/server.hpp>
-#include <sdbusplus/exception.hpp>
-#include <xyz/openbmc_project/Inventory/Manager/server.hpp>
-
-
-namespace sdbusplus
-{
-namespace xyz
-{
-namespace openbmc_project
-{
-namespace Inventory
-{
-namespace server
-{
-
-Manager::Manager(bus::bus& bus, const char* path)
-        : _xyz_openbmc_project_Inventory_Manager_interface(
-                bus, path, _interface, _vtable, this)
-{
-}
-
-
-int Manager::_callback_Notify(
-        sd_bus_message* msg, void* context, sd_bus_error* error)
-{
-    using sdbusplus::server::binding::details::convertForMessage;
-
-    try
-    {
-        auto m = message::message(msg);
-
-        sdbusplus::message::object_path path{};
-    std::map<std::string, std::map<std::string, sdbusplus::message::variant<int64_t, std::string>>> object{};
-
-        m.read(path, object);
-
-        auto o = static_cast<Manager*>(context);
-        o->notify(path, object);
-
-        auto reply = m.new_method_return();
-        // No data to append on reply.
-
-        reply.method_return();
-    }
-    catch(sdbusplus::internal_exception_t& e)
-    {
-        sd_bus_error_set_const(error, e.name(), e.description());
-        return -EINVAL;
-    }
-
-    return true;
-}
-
-namespace details
-{
-namespace Manager
-{
-static const auto _param_Notify =
-        utility::tuple_to_array(message::types::type_id<
-                sdbusplus::message::object_path, std::map<std::string, std::map<std::string, sdbusplus::message::variant<int64_t, std::string>>>>());
-static const auto _return_Notify =
-        utility::tuple_to_array(std::make_tuple('\0'));
-}
-}
-
-
-
-
-const vtable::vtable_t Manager::_vtable[] = {
-    vtable::start(),
-
-    vtable::method("Notify",
-                   details::Manager::_param_Notify
-                        .data(),
-                   details::Manager::_return_Notify
-                        .data(),
-                   _callback_Notify),
-    vtable::end()
-};
-
-} // namespace server
-} // namespace Inventory
-} // namespace openbmc_project
-} // namespace xyz
-} // namespace sdbusplus
-
diff --git a/xyz/openbmc_project/Inventory/Manager/server.hpp b/xyz/openbmc_project/Inventory/Manager/server.hpp
deleted file mode 100644
index 302bee5..0000000
--- a/xyz/openbmc_project/Inventory/Manager/server.hpp
+++ /dev/null
@@ -1,79 +0,0 @@
-#pragma once
-#include <tuple>
-#include <systemd/sd-bus.h>
-#include <sdbusplus/server.hpp>
-
-namespace sdbusplus
-{
-namespace xyz
-{
-namespace openbmc_project
-{
-namespace Inventory
-{
-namespace server
-{
-
-class Manager
-{
-    public:
-        /* Define all of the basic class operations:
-         *     Not allowed:
-         *         - Default constructor to avoid nullptrs.
-         *         - Copy operations due to internal unique_ptr.
-         *         - Move operations due to 'this' being registered as the
-         *           'context' with sdbus.
-         *     Allowed:
-         *         - Destructor.
-         */
-        Manager() = delete;
-        Manager(const Manager&) = delete;
-        Manager& operator=(const Manager&) = delete;
-        Manager(Manager&&) = delete;
-        Manager& operator=(Manager&&) = delete;
-        virtual ~Manager() = default;
-
-        /** @brief Constructor to put object onto bus at a dbus path.
-         *  @param[in] bus - Bus to attach to.
-         *  @param[in] path - Path to attach at.
-         */
-        Manager(bus::bus& bus, const char* path);
-
-
-
-        /** @brief Implementation for Notify
-         *  Signal the implementing service that an item is ready to have its state managed.
-         *
-         *  @param[in] path - The path of the item to be managed, relative to the inventory namespace root.
-         *  @param[in] object - The fully enumerated item to be managed.
-         */
-        virtual void notify(
-            sdbusplus::message::object_path path,
-            std::map<std::string, std::map<std::string, sdbusplus::message::variant<int64_t, std::string>>> object) = 0;
-
-
-
-
-    private:
-
-        /** @brief sd-bus callback for Notify
-         */
-        static int _callback_Notify(
-            sd_bus_message*, void*, sd_bus_error*);
-
-
-        static constexpr auto _interface = "xyz.openbmc_project.Inventory.Manager";
-        static const vtable::vtable_t _vtable[];
-        sdbusplus::server::interface::interface
-                _xyz_openbmc_project_Inventory_Manager_interface;
-
-
-};
-
-
-} // namespace server
-} // namespace Inventory
-} // namespace openbmc_project
-} // namespace xyz
-} // namespace sdbusplus
-