[LLT-5814] refactor events reporting from libtelio #1021
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.
Problem
Event reporting in libtelio is rather scattered around, and with introduction of PQ now we need to take a look at the state of multiple modules before we can decide on what events should be fired. For this reason some refactoring is required, and this PR attempts to perform it.
Solution
General convention of events is that they should be fired whenever any field in the reported state changes. This allows for, IMHO, rather fool-proof aproach of having some module responsible for event reporting, which gets notified whenever something changes. This module takes a look at current state of affairs by querying relevant modules, builds up necessary events, and if any field is different -> fires an event.
☑️ Definition of Done checklist