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

need if_is_bitmap and if_is_enum support underneath zcl_event_fields #572

Closed
yunhanw-google opened this issue Jun 27, 2022 · 8 comments
Closed
Assignees
Labels
high priority Tag that shows this as higher priority as other issues. matter Important to Matter SDK

Comments

@yunhanw-google
Copy link
Contributor

Trying the below
switch (TLV::TagNumFromTag(reader.GetTag()))
{
{{#zcl_event_fields}}
case to_underlying(Fields::k{{asUpperCamelCase name}}):
#ifdef CHIP_USE_ENUM_CLASS_FOR_IM_ENUM
{{#if_is_enum type}}
ReturnErrorOnFailure(Check{{type}}({{asLowerCamelCase label}}));
{{/if_is_enum}}
#endif
{{#if_is_bitmap type}}
ReturnErrorOnFailure(Check{{type}}({{asLowerCamelCase label}}));
{{/if_is_bitmap}}
ReturnErrorOnFailure(DataModel::Decode(reader, {{asLowerCamelCase name}}));
break;
{{/zcl_event_fields}}
default:
break;
}

it seems if_is_enum and if_is_bitmap cannot work underneath zcl_event_fields
it seems it is working with command and attribute, thanks
needs this to unblock one IM thing, project-chip/connectedhomeip#19334

@rerasool rerasool added the matter Important to Matter SDK label Jun 27, 2022
@tecimovic tecimovic added the high priority Tag that shows this as higher priority as other issues. label Jun 27, 2022
@brdandu
Copy link
Collaborator

brdandu commented Jun 27, 2022

@yunhanw-google is there an enum or bitmap type which is not detected as one with the above template?

@tecimovic
Copy link
Collaborator

@brdandu : this doesn't seem to work within 'events'. I was planning to take a look, but I suspect that when querying for the Matter "events" we don't properly populate stuff that those if helpers need.

@brdandu
Copy link
Collaborator

brdandu commented Jun 27, 2022

@brdandu : this doesn't seem to work within 'events'. I was planning to take a look, but I suspect that when querying for the Matter "events" we don't properly populate stuff that those if helpers need.

There might be an issue in ON EVENT_FIELD.EVENT_REF = EVENT.EVENT_ID because of EVENT_FIELD.EVENT_REF instead of EF.EVENT_REF

@tecimovic
Copy link
Collaborator

@yunhanw-google :

I created a new unit test template that looks like this:

List of all events.

{{#zcl_events}}
>> Event: {{name}}
{{#zcl_event_fields}}
    > Field: {{name}} {{#if_is_enum type}}[ENUM]{{/if_is_enum}}{{#if_is_bitmap type}}[BITMAP]{{/if_is_bitmap}}
{{/zcl_event_fields}}
{{/zcl_events}}

So simple iteration across all events and then over fields.
I see that the enums are detected, and I don't think there is any bitmaps in my XML files anyway, so I get:

List of all events.

>> Event: AccessControlEntryChanged
    > Field: AdminNodeID 
    > Field: AdminPasscodeID 
    > Field: ChangeType [ENUM]
    > Field: LatestValue 
    > Field: AdminFabricIndex 
>> Event: AccessControlExtensionChanged
    > Field: AdminNodeID 
    > Field: AdminPasscodeID 
    > Field: ChangeType [ENUM]
    > Field: LatestValue 
    > Field: AdminFabricIndex 
>> Event: StateChanged
    > Field: ActionID 
    > Field: InvokeID 
    > Field: NewState [ENUM]
>> Event: ActionFailed
    > Field: ActionID 
    > Field: InvokeID 
    > Field: NewState [ENUM]
    > Field: Error [ENUM]
>> Event: StartUp
    > Field: SoftwareVersion 
>> Event: ShutDown
>> Event: Leave
>> Event: ReachableChanged
    > Field: ReachableNewValue 
>> Event: StateTransition
    > Field: PreviousState [ENUM]
    > Field: NewState [ENUM]
    > Field: Reason [ENUM]
    > Field: TargetSoftwareVersion 
.
.
.

See the "[ENUM]" thingies, which is printed because of "if_is_enum" in the template.

@tecimovic
Copy link
Collaborator

If I temporarily change one of the types in my test files to bitmap, then I also see "[BITMAP]" printed out.

So at this point I am not sure I understand what is not working here.

@yunhanw-google :
can you post a complete template here, please, including the outer "{{zcl_events}}" tag?
Your snippet starts with "zcl_event_fields", and that has to exist within an outer "zcl_events" anyway, so I would like to see the complete template.

tecimovic added a commit to tecimovic/zap that referenced this issue Jun 29, 2022
@tecimovic
Copy link
Collaborator

Draft pull request: #574
adds these unit tests if you want to check.

@yunhanw-google
Copy link
Contributor Author

let me have a try, thanks

tecimovic added a commit to tecimovic/zap that referenced this issue Jun 30, 2022
tecimovic added a commit to tecimovic/zap that referenced this issue Jun 30, 2022
@yunhanw-google
Copy link
Contributor Author

i see, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high priority Tag that shows this as higher priority as other issues. matter Important to Matter SDK
Projects
None yet
Development

No branches or pull requests

4 participants