-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Topographically Structured Attribute Data #12575
Merged
andy31415
merged 4 commits into
project-chip:master
from
mrjerryjohns:python/topo-read-final
Dec 9, 2021
Merged
Topographically Structured Attribute Data #12575
andy31415
merged 4 commits into
project-chip:master
from
mrjerryjohns:python/topo-read-final
Dec 9, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pullapprove
bot
requested review from
anush-apple,
balducci-apple,
bzbarsky-apple,
carol-apple,
cecille,
chrisdecenzo,
chulspro,
Damian-Nordic,
electrocucaracha,
erjiaqing,
franck-apple,
hawk248,
holbrookt,
jelderton,
jepenven-silabs,
jmartinez-silabs,
kpschoedel,
LuDuda,
lzgrablic02,
mlepage-google,
msandstedt,
pan-apple,
robszewczyk,
sagar-apple,
saurabhst,
selissia,
tcarmelveilleux,
tecimovic and
vijs
December 4, 2021 05:03
pullapprove
bot
requested review from
vivien-apple,
wbschiller,
woody-apple,
yufengwangca and
yunhanw-google
December 4, 2021 05:03
mrjerryjohns
force-pushed
the
python/topo-read-final
branch
2 times, most recently
from
December 4, 2021 05:36
210d1fb
to
923f32d
Compare
PR #12575: Size comparison from ba69e73 to 923f32d Full report (39 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
yunhanw-google
approved these changes
Dec 4, 2021
woody-apple
approved these changes
Dec 6, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fast tracking, given this is updating a development tool.
The existing format for how attribute reports were returned to callers of DeviceController.ReadAttribute() made it quite challenging for them to consume it in an easy enough manner. Instead of providing them with an effectively raw stream of attribute data, this commit organizes and structures that data into a series of nested dictionaries that mirror the topography and composition of the data in a given Matter device: Endpoints that contain Clusters that in turn contain Attributes. The Python data structure equivalent represents these as nested dictionaries: Dict[EndpointId, Dict[ClusterType, Dict[AttributeType, AttributeValue]]] Tests: - Updated the existing ReadAttribute and Subscription tests to utilize this new format. - Added new ones. - Validated using the REPL
mrjerryjohns
force-pushed
the
python/topo-read-final
branch
from
December 7, 2021 22:16
923f32d
to
4e4ca74
Compare
PR #12575: Size comparison from 059f18f to 4e4ca74 Full report (39 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
…k on to the REPL's main event loop for backgrounded work
…k on to the REPL's main event loop for backgrounded work
mrjerryjohns
force-pushed
the
python/topo-read-final
branch
from
December 9, 2021 19:38
0ac13eb
to
5d4a33a
Compare
PR #12575: Size comparison from 7b66b77 to 5d4a33a Full report (32 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The existing format for how attribute reports were returned to callers of
DeviceController.ReadAttribute()
made it quite challenging for them to consume it in an easy enough manner. Data was stored in an attribute cache, organized as a flatlist of elements containing an
AttributePath
+ Data.This had two notable dis-advantages:
chip.clusters.Attribute.AttributePath
first, understand its constructor, then correctly initialize it and use that as a key to the returned data stream.This PR organizes and structures that data into a series of nested dictionaries that mirror the topography and composition of the data in a given Matter device: Endpoints that contain Clusters that in
turn contain Attributes.
The Python data structure equivalent represents these as nested dictionaries:
It uses the cluster object types themselves as strongly typed keys into the composed data! It also embeds any exceptions/IM errors as the value for an attribute instead of the data itself.
It also creates a cluster-objectified version of the entire cluster as a whole, permitting a more natural 'object-model' representation of the state of a cluster.
Accessing the returned data is as easy as pie:
Example: Reading out
OnOff
cluster on all endpointsOld:
New (attribute-view):
New (cluster-view):
In-band IM status:
Tests: