Link watches to callbacks
Callbacks must ultimately be triggered when a property
is updated by a watch. Add that support.
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: I20130a11c19ddcf2c4ae45800f2068b31950bcd6
diff --git a/src/propertywatchimpl.hpp b/src/propertywatchimpl.hpp
index 6e957ae..d0153e4 100644
--- a/src/propertywatchimpl.hpp
+++ b/src/propertywatchimpl.hpp
@@ -3,6 +3,7 @@
#include <sdbusplus/message.hpp>
#include <sdbusplus/bus/match.hpp>
#include <vector>
+#include "callback.hpp"
#include "data_types.hpp"
#include "propertywatch.hpp"
@@ -141,6 +142,12 @@
}
std::get<2>(item->second).get() = p.second.template get<T>();
+
+ // Invoke callback if present.
+ if (this->alreadyRan && this->callback)
+ {
+ (*this->callback)();
+ }
}
}