1 #pragma once 2 3 #include <sdbusplus/bus.hpp> 4 5 #include <string> 6 #include <variant> 7 #include <vector> 8 9 namespace util 10 { 11 12 namespace dbus 13 { 14 15 using DBusValue = std::variant<std::string, bool, std::vector<uint8_t>, 16 std::vector<std::string>>; 17 using DBusProperty = std::string; 18 using DBusInterface = std::string; 19 using DBusService = std::string; 20 using DBusPath = std::string; 21 using DBusInterfaceList = std::vector<DBusInterface>; 22 using DBusSubTree = 23 std::map<DBusPath, std::map<DBusService, DBusInterfaceList>>; 24 25 /** 26 * Find the dbus object path and service that implements the given interface 27 * 28 * @param[in] i_interface Interface to search for 29 * @param[out] o_path Path of dbus object implementing the interface 30 * @param[out] o_service Service implementing the dbus object path 31 * @return non-zero on error 32 */ 33 int find(const std::string& i_interface, std::string& o_path, 34 std::string& o_service); 35 36 /** 37 * Find the dbus service that implements the given dbus object and interface 38 * 39 * @param[in] i_interface Interface that maps to the service 40 * @param[in] i_path Path that maps to the service 41 * @param[out] o_service Service implementing the dbus object and interface 42 * @return non-zer on error 43 */ 44 int findService(const std::string& i_interface, const std::string& i_path, 45 std::string& o_service); 46 47 /** 48 * Read a property from a dbus object interface 49 * 50 * @param[in] i_interface Interface implementing the property 51 * @param[in] i_path Path of the dbus object 52 * @param[in] i_service Service implementing the dbus object and interface 53 * @param[in] i_property Property to read 54 * @return non-zero on error 55 */ 56 int getProperty(const std::string& i_interface, const std::string& i_path, 57 const std::string& i_service, const std::string& i_property, 58 DBusValue& o_response); 59 60 /** 61 * Get the IBM compatible names defined for this system 62 * 63 * @return A vector of strings containing the system names 64 */ 65 std::vector<std::string> systemNames(); 66 67 } // namespace dbus 68 69 } // namespace util 70