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