1ab4cc6a5SGunnar Mills #include "settings.hpp" 2ab4cc6a5SGunnar Mills 3ab4cc6a5SGunnar Mills #include "xyz/openbmc_project/Common/error.hpp" 4ab4cc6a5SGunnar Mills 520ed79e0SDeepak Kodihalli #include <phosphor-logging/elog-errors.hpp> 6947b5346SGeorge Liu #include <phosphor-logging/lg2.hpp> 720ed79e0SDeepak Kodihalli 820ed79e0SDeepak Kodihalli namespace settings 920ed79e0SDeepak Kodihalli { 1020ed79e0SDeepak Kodihalli 11dd42c7faSPavithra Barithaya PHOSPHOR_LOG2_USING; 12dd42c7faSPavithra Barithaya 13*b2670248SPavithra Barithaya using namespace phosphor::time::utils; 1420ed79e0SDeepak Kodihalli using namespace phosphor::logging; 1520ed79e0SDeepak Kodihalli using namespace sdbusplus::xyz::openbmc_project::Common::Error; 1620ed79e0SDeepak Kodihalli Objects(sdbusplus::bus_t & bus)17864e173eSPavithra BarithayaObjects::Objects(sdbusplus::bus_t& bus) 1820ed79e0SDeepak Kodihalli { 19dc746c0bSGeorge Liu Interfaces settingsIntfs = {timeSyncIntf}; 2020ed79e0SDeepak Kodihalli MapperResponse result; 21f344f84eSGeorge Liu 22f344f84eSGeorge Liu try 23f344f84eSGeorge Liu { 24dc746c0bSGeorge Liu result = getSubTree(bus, root, settingsIntfs, 0); 25f344f84eSGeorge Liu } 2638679266SPatrick Williams catch (const sdbusplus::exception_t& ex) 27f344f84eSGeorge Liu { 28dd42c7faSPavithra Barithaya error("Failed to invoke GetSubTree method: {ERROR}", "ERROR", ex); 29f344f84eSGeorge Liu } 30f344f84eSGeorge Liu 3120ed79e0SDeepak Kodihalli if (result.empty()) 3220ed79e0SDeepak Kodihalli { 33dd42c7faSPavithra Barithaya error("Invalid response from mapper"); 3420ed79e0SDeepak Kodihalli } 3520ed79e0SDeepak Kodihalli 3620ed79e0SDeepak Kodihalli for (const auto& iter : result) 3720ed79e0SDeepak Kodihalli { 3820ed79e0SDeepak Kodihalli const Path& path = iter.first; 39864e173eSPavithra Barithaya for (const auto& serviceIter : iter.second) 407aa715b2SEd Tanous { 41864e173eSPavithra Barithaya for (const Interface& interface : serviceIter.second) 427aa715b2SEd Tanous { 433c2f4496SGeorge Liu if (timeSyncIntf == interface) 4420ed79e0SDeepak Kodihalli { 4520ed79e0SDeepak Kodihalli timeSyncMethod = path; 4620ed79e0SDeepak Kodihalli } 4720ed79e0SDeepak Kodihalli } 4820ed79e0SDeepak Kodihalli } 497aa715b2SEd Tanous } 507aa715b2SEd Tanous } 5120ed79e0SDeepak Kodihalli } // namespace settings 52