summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRichard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>2018-06-18 13:53:56 +0530
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-07-09 18:21:23 +0000
commit261fe75318d8f3a98b165e1f5741e4a06b0fe814 (patch)
tree0204d2600f2b1567c6daca97a53148d928776893 /tools
parent13367e49f05ac12988329d051502cdc99390d558 (diff)
downloadsdbusplus-261fe75318d8f3a98b165e1f5741e4a06b0fe814.tar.gz
sdbusplus-261fe75318d8f3a98b165e1f5741e4a06b0fe814.zip
Support to skip property changed signal
PropertyChanged signals are sent out, even before InterfacesAdded signals (if deferSignal is set to true in Object) are sent. This patch provides an option, to skip sending out PropertiesChanged signal for proper initialization sequence. Change-Id: I1678d80cc382fce420dda9f0dd9413d43c1c711d Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/sdbusplus/templates/interface.mako.server.cpp.in10
-rw-r--r--tools/sdbusplus/templates/interface.mako.server.hpp10
-rw-r--r--tools/sdbusplus/templates/property.mako.prototype.hpp.in13
3 files changed, 25 insertions, 8 deletions
diff --git a/tools/sdbusplus/templates/interface.mako.server.cpp.in b/tools/sdbusplus/templates/interface.mako.server.cpp.in
index 5fa46a9..aee5424 100644
--- a/tools/sdbusplus/templates/interface.mako.server.cpp.in
+++ b/tools/sdbusplus/templates/interface.mako.server.cpp.in
@@ -33,12 +33,13 @@ ${classname}::${classname}(bus::bus& bus, const char* path)
% if interface.properties:
${classname}::${classname}(bus::bus& bus, const char* path,
- const std::map<std::string, PropertiesVariant>& vals)
+ const std::map<std::string, PropertiesVariant>& vals,
+ bool skipSignal)
: ${classname}(bus, path)
{
for (const auto& v : vals)
{
- setPropertyByName(v.first, v.second);
+ setPropertyByName(v.first, v.second, skipSignal);
}
}
@@ -57,14 +58,15 @@ ${ p.cpp_prototype(loader, interface=interface, ptype='callback-cpp') }
% if interface.properties:
void ${classname}::setPropertyByName(const std::string& _name,
- const PropertiesVariant& val)
+ const PropertiesVariant& val,
+ bool skipSignal)
{
% for p in interface.properties:
if (_name == "${p.name}")
{
auto& v = message::variant_ns::get<${p.cppTypeParam(interface.name)}>(\
val);
- ${p.camelCase}(v);
+ ${p.camelCase}(v, skipSignal);
return;
}
% endfor
diff --git a/tools/sdbusplus/templates/interface.mako.server.hpp b/tools/sdbusplus/templates/interface.mako.server.hpp
index ec02c57..b263c7a 100644
--- a/tools/sdbusplus/templates/interface.mako.server.hpp
+++ b/tools/sdbusplus/templates/interface.mako.server.hpp
@@ -66,7 +66,8 @@ class ${classname}
* @param[in] vals - Map of property name to value for initialization.
*/
${classname}(bus::bus& bus, const char* path,
- const std::map<std::string, PropertiesVariant>& vals);
+ const std::map<std::string, PropertiesVariant>& vals,
+ bool skipSignal = false);
% endif
% for m in interface.methods:
@@ -80,6 +81,10 @@ ${ s.cpp_prototype(loader, interface=interface, ptype='header') }
% for p in interface.properties:
/** Get value of ${p.name} */
virtual ${p.cppTypeParam(interface.name)} ${p.camelCase}() const;
+ /** Set value of ${p.name} with option to skip sending signal */
+ virtual ${p.cppTypeParam(interface.name)} \
+${p.camelCase}(${p.cppTypeParam(interface.name)} value,
+ bool skipSignal);
/** Set value of ${p.name} */
virtual ${p.cppTypeParam(interface.name)} \
${p.camelCase}(${p.cppTypeParam(interface.name)} value);
@@ -91,7 +96,8 @@ ${p.camelCase}(${p.cppTypeParam(interface.name)} value);
* @param[in] val - A variant containing the value to set.
*/
void setPropertyByName(const std::string& _name,
- const PropertiesVariant& val);
+ const PropertiesVariant& val,
+ bool skipSignal = false);
/** @brief Gets a property by name.
* @param[in] _name - A string representation of the property name.
diff --git a/tools/sdbusplus/templates/property.mako.prototype.hpp.in b/tools/sdbusplus/templates/property.mako.prototype.hpp.in
index 163f6e9..0322554 100644
--- a/tools/sdbusplus/templates/property.mako.prototype.hpp.in
+++ b/tools/sdbusplus/templates/property.mako.prototype.hpp.in
@@ -68,18 +68,27 @@ int ${classname}::_callback_get_${property.name}(
return true;
}
-auto ${classname}::${property.camelCase}(${property.cppTypeParam(interface.name)} value) ->
+auto ${classname}::${property.camelCase}(${property.cppTypeParam(interface.name)} value,
+ bool skipSignal) ->
${property.cppTypeParam(interface.name)}
{
if (_${property.camelCase} != value)
{
_${property.camelCase} = value;
- _${interface_instance()}.property_changed("${property.name}");
+ if (!skipSignal)
+ {
+ _${interface_instance()}.property_changed("${property.name}");
+ }
}
return _${property.camelCase};
}
+auto ${classname}::${property.camelCase}(${property.cppTypeParam(interface.name)} val) ->
+ ${property.cppTypeParam(interface.name)}
+{
+ return ${property.camelCase}(val, false);
+}
int ${classname}::_callback_set_${property.name}(
sd_bus* bus, const char* path, const char* interface,
const char* property, sd_bus_message* value, void* context,
OpenPOWER on IntegriCloud