Scanner, Discovery and Controller enhancements (#473)
* Make sure Cache remembers former keys
Before this change the cache forgot any former cached entries on clear which do not allow to iterate over them.
* Return ttl to when parsing IP Records
* Add ttl handling in MDnS Scanner
Also make sure that all addresses from same matterserver over all interfaces gets combined (a respinse on anotehr netInterface was clearing out other entries evenually). ANd make sure to only request more adddresses if nothing is existing after checking ttls
* Allow to discover only new records and continuously
* Prevent message processing and also querying once closed
* allow to cancel "continuous" queries
* Add deviceIdentifier to Commission device data
This one is set differently according to the discovery methods (IP/BLE) but allows to use it as a unique field.
* Add needed support to BLE Scanner too
* Enhance abstract Scanner definition
* Move "promises.any" polyfill to generic class
And allow promises and Promise generate functions as input
* Enhance ControllerDiscovery
* Enhance test to check scanner expiring records
* Adjust commissioning to be more generic and parallel (IP/BLE)
* Add continuous and polling discovery to resume logic
When the connection should be resumed we in parallel poll the device last known address evener 10mins (for devices that do not announce itself when coming back online) but also add continuous discovery run without a timeout to get notified when the device comes back online and announce itself.
* Add 60s resume Timeout for Interaction client
This has the effect that when a command is being executed but the device is not reachable and so the InteractionClient gets resumed, we only do this for 60s. Then the command fails.
* Cleanup and new imports
* Allow controller to discover commissionable devices
The callback is called for each discovered device and at the end the final result is returned
* Forward config/callbacks
Make sure that defined callbacks are also used after commissioning in the created PairedNode instance and not lost
* Use discovered device object for commissioning
Alternatively to identifierData also an "CommissionableDevice" returned by discovery method can be used for commissioning. This first tries the addresses already discovered.
* Split disconnect from removal of a node
disconnect should not remove resumption records or such, removal should do that.
* Introduce Node state
This commit is introducing a node state and a corresponding callback to inform the developer about state changes of the node. Additionally all callbacks are enhanced by the nodeId of the node the change happens. With this also generic callbacks can be provided when connecting to all nodes at once and the result can still be handled by node.
Node state also supports "structure changed" info when a bridge structure changed and was updated internally to reprocess the device objects if needed.
* Add connection state logic
* Allow Endpoint structure to update
... but only update whats changed and reuse unchanged
* Allow Endpoint logging to pass through options
* Add nodeid to attribute/event callbacks
* Add all callbacks to controller example
* Update shell License infos
* Shell: commission - allow commission by instanceId
* Shell: add possible callbacks and log to console for now what they report
* Shell: add unpair command
* Shell: discover commands
* Shell: Add connect/disconnect to a node
* Shell: Improve done/exit handling
* Shell: Renaming for consistency
* Stabilize tests a bit more
* Leftover
* Last fixes
* [execute-chiptests-long] Changelog
* [execute-chiptests-long] Changelog
* Add some state changed tests
* Address review feedback