Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame] | 1 | #include "settings.hpp" |
2 | |||||
3 | #include "xyz/openbmc_project/Common/error.hpp" | ||||
4 | |||||
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 5 | #include <phosphor-logging/elog-errors.hpp> |
George Liu | 947b534 | 2022-07-01 16:12:18 +0800 | [diff] [blame] | 6 | #include <phosphor-logging/lg2.hpp> |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 7 | |
8 | namespace settings | ||||
9 | { | ||||
10 | |||||
Pavithra Barithaya | dd42c7f | 2022-08-11 05:09:02 -0500 | [diff] [blame] | 11 | PHOSPHOR_LOG2_USING; |
12 | |||||
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 13 | using namespace phosphor::logging; |
14 | using namespace sdbusplus::xyz::openbmc_project::Common::Error; | ||||
15 | |||||
Pavithra Barithaya | 864e173 | 2023-04-11 04:30:23 -0500 | [diff] [blame] | 16 | Objects::Objects(sdbusplus::bus_t& bus) |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 17 | { |
George Liu | dc746c0 | 2022-09-02 11:10:55 +0800 | [diff] [blame] | 18 | Interfaces settingsIntfs = {timeSyncIntf}; |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 19 | MapperResponse result; |
George Liu | f344f84 | 2022-07-01 16:09:41 +0800 | [diff] [blame] | 20 | |
21 | try | ||||
22 | { | ||||
George Liu | dc746c0 | 2022-09-02 11:10:55 +0800 | [diff] [blame] | 23 | result = getSubTree(bus, root, settingsIntfs, 0); |
George Liu | f344f84 | 2022-07-01 16:09:41 +0800 | [diff] [blame] | 24 | } |
Patrick Williams | 3867926 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 25 | catch (const sdbusplus::exception_t& ex) |
George Liu | f344f84 | 2022-07-01 16:09:41 +0800 | [diff] [blame] | 26 | { |
Pavithra Barithaya | dd42c7f | 2022-08-11 05:09:02 -0500 | [diff] [blame] | 27 | error("Failed to invoke GetSubTree method: {ERROR}", "ERROR", ex); |
George Liu | f344f84 | 2022-07-01 16:09:41 +0800 | [diff] [blame] | 28 | } |
29 | |||||
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 30 | if (result.empty()) |
31 | { | ||||
Pavithra Barithaya | dd42c7f | 2022-08-11 05:09:02 -0500 | [diff] [blame] | 32 | error("Invalid response from mapper"); |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 33 | } |
34 | |||||
35 | for (const auto& iter : result) | ||||
36 | { | ||||
37 | const Path& path = iter.first; | ||||
Pavithra Barithaya | 864e173 | 2023-04-11 04:30:23 -0500 | [diff] [blame] | 38 | for (const auto& serviceIter : iter.second) |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 39 | { |
Pavithra Barithaya | 864e173 | 2023-04-11 04:30:23 -0500 | [diff] [blame] | 40 | for (const Interface& interface : serviceIter.second) |
Ed Tanous | 7aa715b | 2018-05-09 17:28:05 -0700 | [diff] [blame] | 41 | { |
George Liu | 3c2f449 | 2020-04-12 11:35:57 +0800 | [diff] [blame] | 42 | if (timeSyncIntf == interface) |
Ed Tanous | 7aa715b | 2018-05-09 17:28:05 -0700 | [diff] [blame] | 43 | { |
44 | timeSyncMethod = path; | ||||
45 | } | ||||
Ed Tanous | 7aa715b | 2018-05-09 17:28:05 -0700 | [diff] [blame] | 46 | } |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 47 | } |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 48 | } |
49 | } | ||||
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 50 | } // namespace settings |