1 #pragma once 2 3 #include "sdbusplus.hpp" 4 5 #include <sdbusplus/bus.hpp> 6 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; 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 /** 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 /** 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 } 79 catch (const util::DBusError& e) 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 90