sdbus++: async: server: make properties protected
When the implementation wants to override the property set/get
methods, they likely want to access the underlying storage. Move
them to be protected rather than private so they can be modified.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib7e752e1fa6e0f358f6e663aa51c2cf0c93118b7
diff --git a/example/calculator-aserver.cpp b/example/calculator-aserver.cpp
index 290e0aa..149da86 100644
--- a/example/calculator-aserver.cpp
+++ b/example/calculator-aserver.cpp
@@ -15,17 +15,23 @@
auto get_property(last_result_t) const
{
- return 42;
+ return _last_result;
}
- bool set_property(last_result_t, auto)
+ bool set_property(last_result_t, int64_t v)
{
+ if (v % 2 == 0)
+ {
+ std::swap(_last_result, v);
+ return v != _last_result;
+ }
return false;
}
private:
auto startup() -> sdbusplus::async::task<>
{
+ last_result(123);
ctx.get_bus().request_name("net.poettering.Calculator");
status(State::Error);