1 #include "settings.hpp"
2 
3 #include "xyz/openbmc_project/Common/error.hpp"
4 
5 #include <phosphor-logging/elog-errors.hpp>
6 #include <phosphor-logging/lg2.hpp>
7 
8 namespace settings
9 {
10 
11 PHOSPHOR_LOG2_USING;
12 
13 using namespace phosphor::logging;
14 using namespace sdbusplus::xyz::openbmc_project::Common::Error;
15 
16 Objects::Objects(sdbusplus::bus_t& bus)
17 {
18     Interfaces settingsIntfs = {timeSyncIntf};
19     MapperResponse result;
20 
21     try
22     {
23         result = getSubTree(bus, root, settingsIntfs, 0);
24     }
25     catch (const sdbusplus::exception_t& ex)
26     {
27         error("Failed to invoke GetSubTree method: {ERROR}", "ERROR", ex);
28     }
29 
30     if (result.empty())
31     {
32         error("Invalid response from mapper");
33     }
34 
35     for (const auto& iter : result)
36     {
37         const Path& path = iter.first;
38         for (const auto& serviceIter : iter.second)
39         {
40             for (const Interface& interface : serviceIter.second)
41             {
42                 if (timeSyncIntf == interface)
43                 {
44                     timeSyncMethod = path;
45                 }
46             }
47         }
48     }
49 }
50 } // namespace settings
51