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