8000 Types derived from octstr are not represented correctly in the chip-types.xml in the Matter SDK · Issue #1473 · project-chip/zap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Types derived from octstr are not represented correctly in the chip-types.xml in the Matter SDK #1473

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

Open
bzbarsky-apple opened this issue Oct 28, 2024 · 2 comments
Assignees
Milestone

Comments

@bzbarsky-apple
Copy link
Contributor

The following types are derived from octstr in the Matter spec:

  • ipadr
  • ipv4adr
  • ipv6adr
  • ipv6pre
  • hwadr

but in our current ZAP XML these seem to be defined as integer types of some sort.... They should be defined as deriving from octstr. @brdandu

@brdandu
Copy link
Collaborator
brdandu commented Mar 19, 2025

Change the following xml in chip-types.xml

<type id="0xF2" description="IP Address" name="ipadr" composite="true"/> <type id="0xF3" description="IPv4 Address" name="ipv4adr" size="4" composite="true"/> <type id="0xF4" description="IPv6 Address" name="ipv6adr" size="16" composite="true"/> <type id="0xF5" description="IPv6 Prefix" name="ipv6pre" composite="true"/> <type id="0xF6" description="Hardware Address" name="hwadr" composite="true"/>

to

<type id="0xFA" description="IP Address" name="ipadr" composite="true" baseType="octet_string"/> <type id="0xFB" description="IPv4 Address" name="ipv4adr" composite="true" baseType="octet_string"/> <type id="0xFC" description="IPv6 Address" name="ipv6adr" composite="true" baseType="octet_string"/> <type id="0xFD" description="IPv6 Prefix" name="ipv6pre" composite="true" baseType="octet_string"/> <type id="0xFE" description="Hardware Address" name="hwadr" composite="true" baseType="octet_string"/>

That baseType should allow you to add strings in the ZAP UI and generate accordingly.

@bzbarsky-apple
Copy link
Contributor Author

The above does not work on its own. When I do:

    <type id="0xF6" description="Hardware Address"         name="hwadr"                       composite="true" baseType="octet_string" />

and then try to codegen, the type ZAP spits out on the C++ side looks like this:

/* TYPE WARNING: hwadr defaults to */ uint8_t *

which is very much not the right type. if I explicitly add all these types to the atomicType function in override.js I can get the right C++ types happening, but isString still tests false for that type, so all sorts of codegen does not work correctly because the wrong branches are taken. And Darwin codegen fails outright with TypeError: Cannot read properties of undefined, for reasons I have not figured out yet.

That is, there does not seem to be a way to actually cleanly declare a type as "derives from octet string".

@brdandu brdandu modified the milestones: ZAPP-1561, ZAPP-1621 Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

2 participants
0