Skip to content

Commit

Permalink
Updated chip_endpoint_generated_event_list method
Browse files Browse the repository at this point in the history
  • Loading branch information
emargolis committed Jan 20, 2023
1 parent e9a70a0 commit fa20fab
Showing 1 changed file with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,34 +189,30 @@ function chip_endpoint_generated_commands_list(options) {
}

function chip_endpoint_generated_event_count(options) {
let count = 0;
let count = 0
this.clusterList.forEach((c) => {
count += c.events.length
});
return count;
})
return count
}

function chip_endpoint_generated_event_list(options) {
let ret = [];
let index = 0;
let comment = null
let index = 0
let ret = '{ \\\n'
this.clusterList.forEach((c) => {
let events = [];

c.events.forEach((ev) => {
events.push(`${ev.eventId} /* ${ev.name} */`);
});

if (events.length > 0) {
ret.push({ text: ` /* ${c.comment} */\\` });
ret.push({
text: ` /* EventList (index=${index}) */ \\\n ${events.join(
', \\\n '
)}, \\`,
});
index += events.length;
}
});
return templateUtil.collectBlocks(ret, options, this);
if (c.comment != comment) {
ret += ` /* ${c.comment} */ \\\n`
ret += ` /* EventList (index=${index}) */ \\\n`
comment = c.comment
}
ret += ` ${ev.eventId}, /* ${ev.name} */ \\\n`
index++
})
})
ret += '}\n'
return ret
}

/**
Expand Down

0 comments on commit fa20fab

Please sign in to comment.