sdbus++: async: server: generate signal emit fns
Populate enough of the generator to define the basic class structure
and generate bindings for emitting signals.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: If62c323f460fc8c73a3aca495e5b89cd84bab32a
diff --git a/example/calculator-aserver.cpp b/example/calculator-aserver.cpp
new file mode 100644
index 0000000..220cda1
--- /dev/null
+++ b/example/calculator-aserver.cpp
@@ -0,0 +1,42 @@
+#include <net/poettering/Calculator/aserver.hpp>
+#include <sdbusplus/async.hpp>
+
+class Calculator :
+ public sdbusplus::aserver::net::poettering::Calculator<Calculator>
+{
+ public:
+ explicit Calculator(sdbusplus::async::context& ctx) :
+ sdbusplus::aserver::net::poettering::Calculator<Calculator>(
+ ctx, "/net/poettering/calculator"),
+ manager(ctx, "/")
+ {
+ ctx.spawn(startup());
+ }
+
+ private:
+ auto startup() -> sdbusplus::async::task<>
+ {
+ ctx.get_bus().request_name("net.poettering.Calculator");
+
+ while (1)
+ {
+ using namespace std::literals;
+ co_await sdbusplus::async::sleep_for(ctx, 10s);
+
+ cleared(42);
+ }
+ co_return;
+ }
+
+ sdbusplus::server::manager_t manager;
+};
+
+int main()
+{
+ sdbusplus::async::context ctx;
+ [[maybe_unused]] Calculator c(ctx);
+
+ ctx.run();
+
+ return 0;
+}