Matthew Barth | 336f18a | 2017-09-26 09:15:56 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Matthew Barth | 336f18a | 2017-09-26 09:15:56 -0500 | [diff] [blame] | 3 | #include "sdbusplus.hpp" |
| 4 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 5 | #include <sdbusplus/bus.hpp> |
| 6 | |
Matthew Barth | 336f18a | 2017-09-26 09:15:56 -0500 | [diff] [blame] | 7 | namespace phosphor |
| 8 | { |
| 9 | namespace fan |
| 10 | { |
| 11 | namespace control |
| 12 | { |
| 13 | namespace match |
| 14 | { |
| 15 | |
| 16 | using namespace phosphor::fan; |
| 17 | using namespace sdbusplus::bus::match; |
Matthew Barth | 336f18a | 2017-09-26 09:15:56 -0500 | [diff] [blame] | 18 | |
| 19 | /** |
| 20 | * @brief A match function that constructs a PropertiesChanged match string |
| 21 | * @details Constructs a PropertiesChanged match string with a given object |
| 22 | * path and interface |
| 23 | * |
| 24 | * @param[in] obj - Object's path name |
| 25 | * @param[in] iface - Interface name |
| 26 | * |
| 27 | * @return - A PropertiesChanged match string |
| 28 | */ |
| 29 | inline auto propertiesChanged(const std::string& obj, const std::string& iface) |
| 30 | { |
| 31 | return rules::propertiesChanged(obj, iface); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * @brief A match function that constructs an InterfacesAdded match string |
| 36 | * @details Constructs an InterfacesAdded match string with a given object |
| 37 | * path |
| 38 | * |
| 39 | * @param[in] obj - Object's path name |
| 40 | * |
| 41 | * @return - An InterfacesAdded match string |
| 42 | */ |
| 43 | inline auto interfacesAdded(const std::string& obj) |
| 44 | { |
| 45 | return rules::interfacesAdded(obj); |
| 46 | } |
| 47 | |
| 48 | /** |
Matthew Barth | 1499a5c | 2018-03-20 15:52:33 -0500 | [diff] [blame] | 49 | * @brief A match function that constructs an InterfacesRemoved match string |
| 50 | * @details Constructs an InterfacesRemoved match string with a given object |
| 51 | * path |
| 52 | * |
| 53 | * @param[in] obj - Object's path name |
| 54 | * |
| 55 | * @return - An InterfacesRemoved match string |
| 56 | */ |
| 57 | inline auto interfacesRemoved(const std::string& obj) |
| 58 | { |
| 59 | return rules::interfacesRemoved(obj); |
| 60 | } |
| 61 | |
| 62 | /** |
Matthew Barth | 336f18a | 2017-09-26 09:15:56 -0500 | [diff] [blame] | 63 | * @brief A match function that constructs a NameOwnerChanged match string |
| 64 | * @details Constructs a NameOwnerChanged match string with a given object |
| 65 | * path and interface |
| 66 | * |
| 67 | * @param[in] obj - Object's path name |
| 68 | * @param[in] iface - Interface name |
| 69 | * |
| 70 | * @return - A NameOwnerChanged match string |
| 71 | */ |
| 72 | inline auto nameOwnerChanged(const std::string& obj, const std::string& iface) |
| 73 | { |
| 74 | std::string noc; |
| 75 | try |
| 76 | { |
| 77 | noc = rules::nameOwnerChanged(util::SDBusPlus::getService(obj, iface)); |
| 78 | } |
Matt Spinler | ba7b5fe | 2018-04-25 15:26:10 -0500 | [diff] [blame] | 79 | catch (const util::DBusError& e) |
Matthew Barth | 336f18a | 2017-09-26 09:15:56 -0500 | [diff] [blame] | 80 | { |
| 81 | // Unable to construct NameOwnerChanged match string |
| 82 | } |
| 83 | return noc; |
| 84 | } |
| 85 | |
| 86 | } // namespace match |
| 87 | } // namespace control |
| 88 | } // namespace fan |
| 89 | } // namespace phosphor |