When I am setting more than one attribute at a time I only want to send one
notification after all the attributes have been set. This change makes it
possible to send the notification at the end.
Change-Id: I8a4825edab97b92041a67a8cdf57f9a6fd832f3b
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/4207
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Markus Jung <markus.jung85@gmail.com>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
*/
void setAttribute(const std::string &key, RCSResourceAttributes::Value &&value);
+ /**
+ * Sends a notification to all observers.
+ *
+ * Calling this is not needed when setAttribute() was called
+ * with notify == true.
+ *
+ * @return void
+ */
+ void sendNotification();
+
/**
* This function should be implemented by the according bundle resource
* and execute the according business logic (e.g., light switch or sensor resource)
m_resourceAttributes[key] = value;
- if (notify && m_pNotiReceiver)
- m_pNotiReceiver->onNotificationReceived(m_uri);
+ sendNotification();
}
void BundleResource::setAttribute(const std::string &key, RCSResourceAttributes::Value &&value)
return m_resourceAttributes.at(key);
}
+
+ void BundleResource::sendNotification()
+ {
+ if (m_pNotiReceiver)
+ m_pNotiReceiver->onNotificationReceived(m_uri);
+ }
}
}