diff options
| author | Patrick Williams <patrick@stwcx.xyz> | 2016-10-18 22:03:41 -0500 |
|---|---|---|
| committer | Patrick Williams <patrick@stwcx.xyz> | 2016-10-20 16:40:18 -0500 |
| commit | a475c03042bfcd1a1dd27eb1f8e837fc76c8a25f (patch) | |
| tree | 166fcf3b9d34ae26669881b8c9f23c8c0054ef2c /tools | |
| parent | 5354c82a648c5937b8306284dad49be1b67ae75d (diff) | |
| download | sdbusplus-a475c03042bfcd1a1dd27eb1f8e837fc76c8a25f.tar.gz sdbusplus-a475c03042bfcd1a1dd27eb1f8e837fc76c8a25f.zip | |
interface: enable property-changed signals
Change-Id: I5a46fe2d948ddc6c1b86dd6f898b814767802054
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/templates/interface.mako.server.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
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 @@ namespace ${s} % 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 @@ int ${classname}::_callback_get_${p.name}( ${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 @@ ${ s.cpp_prototype(loader, interface=interface, ptype='vtable') } 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() }; |

