Streamline attribute reporting config and align polling #4765
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is intended to streamline the behavior in
checkLightBindingsForAttributeReporting()
andcheckSensorBindingsForAttributeReporting()
to check if the corresponding bindings exist and require attribute reporting.For both functions, a grace time of
(val.maxInterval * 3 / 2)
is now given (the resources must have themaxInterval
already set internally), so that basically 2 reports are allowed to have gone MIA before configuring the reporting again. Otherwise, a default value will be assumed (60 * 6 secs for lights, 60 * 15 secs for sensors (previously 60 * 45)).All this also has been better aligned with the poll manager, which takes the same code as
checkLightBindingsForAttributeReporting()
. This should ensure light nodes get a proper fall back to polling, in case no reports come in after(val.maxInterval * 3 / 2)
.Some XAL related code has been removed as is seemed to be duplicate code, but required a slight amendment of the maxInterval value (now 1200 instead of 3600) to reflect the initial polling conditions.
All in all, this should prevent some unnecessary requests to set up reporting configration and prevent unnecessary polling of light nodes based on a larger maxInterval of the previous allowed 6 minutes (e.g. light nodes maxInterval is configured to 10 mins, but with the old code, it always gets polled after 6 mins. New code would allow for up to 2 missed maxInterval 10 mins reports before falling back to polling).