blob: 245bf63c6006bb6b78d4b1cdcbee3bcac4be26f6 [file] [log] [blame]
Patrick Williamse36cf852017-07-03 14:50:21 -05001#include <sdbusplus/bus.hpp>
2#include <iostream>
3#include <cstdint>
4
5/** An example dbus client application.
6 * Calls org.freedesktop.login1's ListUsers interface to find all active
7 * users in the system and displays their username.
8 */
9
10int main()
11{
12 using namespace sdbusplus;
13
14 auto b = bus::new_system();
15 auto m = b.new_method_call("org.freedesktop.login1",
16 "/org/freedesktop/login1",
17 "org.freedesktop.login1.Manager",
18 "ListUsers");
19 auto reply = b.call(m);
20
21 std::vector<std::tuple<uint32_t, std::string, message::object_path>> users;
22 reply.read(users);
23
24 for(auto& user : users)
25 {
26 std::cout << std::get<std::string>(user) << "\n";
27 }
28
29 return 0;
30}