Skip to content
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

[nrf noup] Add zcl_generate to west command #547

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ArekBalysNordic
Copy link
Contributor

@ArekBalysNordic ArekBalysNordic commented Jan 31, 2025

Added zap_append command to the west.

use west zap-append -h to see all options.

Now you can add new clusters to the matter ZCL datamodel.
Use a west zap-append and provide the new cluster definitionsas XML files to add them to the zcl.json file.
You can generate the new zcl.json file by providing -o, --output argument, or overwrite the existing one.

The zcl_generate is integrated with west zap-gui commands.
If you want to use it call the west zap-gui command with the additional argument --clusters.
You can provide multiple clusters at once.
If you provide an additional -j / --zcl-json argument alongside the --clusters argument to the west zap-gui command, the new zcl.json will be created and contain the new clusters.

manifest-pr-skip

@ArekBalysNordic ArekBalysNordic requested a review from a team January 31, 2025 15:08
Comment on lines 24 to 26
DEFAULT_DATA_MODEL_PATH = f'{DEFAULT_MATTER_PATH}/src/app/zap-templates/zcl'
DEFAULT_ZCL_PATH = f'{DEFAULT_DATA_MODEL_PATH}/zcl.json'
DEFAULT_APP_TEMPLATES_PATH = f'{DEFAULT_MATTER_PATH}/src/app/zap-templates/app-templates.json'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could these be Path as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

commands:
- name: zcl-generate
class: ZCLGenerate
help: Generate ZCL code from XML cluster definition file
Copy link
Contributor

@kkasperczyk-no kkasperczyk-no Feb 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that naming is a bit unfortunate here and there. According to name and help it seems that it generates source code, while it's not true, as it generates only json file that describes data model. Source code is generated by zap-generate, which is also unfortunate name, because it sounds like it could generate zap file, not the code.

I don't know if we should change zap-generate name, as customers could already have learned how to use it, but I would try to name the new command in a different way (and change help as well). Maybe zap-generate-json?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe zcl-append-cluster

Copy link
Contributor

@kkasperczyk-no kkasperczyk-no Feb 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the other commands start with zap, so why do we want to use zcl now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because, actually it is more about ZCL than zap.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to zap-append :)


zap_installer = ZapInstaller(args.matter_path)
zap_installer.update_zap_if_needed()
zap_cache_path = zap_installer.get_install_path() / ".zap"
zap_cache_path = zap_installer.get_cache_path()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add here temporary cache directory instead of using the global one inside the installation dir.

Added zap_append command to the west.

use `west zap-append -h` to see all options.

Now you can add new clusters to the matter ZCL datamodel.
Use a `west zap-append` and provide the new cluster
definitionsas XML files to add them to the zcl.json file.
You can generate the new zcl.json file by providing
`-o, --output` argument, or overwrite the existing one.

The zcl_generate is integrated with `west zap-gui` commands.
If you want to use it call the `west zap-gui` command with
the additional argument `--clusters`.
You can provide multiple clusters at once.
If you provide an additional `-j` / `--zcl-json` argument
alongside the `--clusters` argument to the `west zap-gui`
command, the new zcl.json will be created and contain
the new clusters.

Signed-off-by: Arkadiusz Balys <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants