interface: enable property-changed signals
Change-Id: I5a46fe2d948ddc6c1b86dd6f898b814767802054
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/tools/templates/interface.mako.server.cpp b/tools/templates/interface.mako.server.cpp
index cb4ca29..2a5c497 100644
--- a/tools/templates/interface.mako.server.cpp
+++ b/tools/templates/interface.mako.server.cpp
@@ -3,6 +3,9 @@
<%
namespaces = interface.name.split('.')
classname = namespaces.pop()
+
+ def interface_instance():
+ return "_".join(interface.name.split('.') + ['interface'])
%>
namespace sdbusplus
{
@@ -14,7 +17,7 @@
% endfor
${classname}::${classname}(bus::bus& bus, const char* path)
- : _${"_".join(interface.name.split('.'))}_interface(
+ : _${interface_instance()}(
bus, path, _interface, _vtable, this)
{
}
@@ -48,7 +51,11 @@
${p.typeName} ${classname}::${p.camelCase}(${p.typeName} value)
{
- _${p.camelCase} = value;
+ if (_${p.camelCase} != value)
+ {
+ _${p.camelCase} = value;
+ _${interface_instance()}.property_changed("${p.name}");
+ }
return _${p.camelCase};
}
@@ -93,7 +100,8 @@
details::${classname}::_property_${p.name}
.data(),
_callback_get_${p.name},
- _callback_set_${p.name}),
+ _callback_set_${p.name},
+ vtable::property_::emits_change),
% endfor
vtable::end()
};