blob: 220cda143ca96f635e5f1ab94a949416042cf7de [file] [log] [blame]
Patrick Williamsbf0283a2023-08-19 07:18:04 -05001#include <net/poettering/Calculator/aserver.hpp>
2#include <sdbusplus/async.hpp>
3
4class Calculator :
5 public sdbusplus::aserver::net::poettering::Calculator<Calculator>
6{
7 public:
8 explicit Calculator(sdbusplus::async::context& ctx) :
9 sdbusplus::aserver::net::poettering::Calculator<Calculator>(
10 ctx, "/net/poettering/calculator"),
11 manager(ctx, "/")
12 {
13 ctx.spawn(startup());
14 }
15
16 private:
17 auto startup() -> sdbusplus::async::task<>
18 {
19 ctx.get_bus().request_name("net.poettering.Calculator");
20
21 while (1)
22 {
23 using namespace std::literals;
24 co_await sdbusplus::async::sleep_for(ctx, 10s);
25
26 cleared(42);
27 }
28 co_return;
29 }
30
31 sdbusplus::server::manager_t manager;
32};
33
34int main()
35{
36 sdbusplus::async::context ctx;
37 [[maybe_unused]] Calculator c(ctx);
38
39 ctx.run();
40
41 return 0;
42}