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

[Android]Add Json input support for command and write in Android chip-tool #28592

Closed
yunhanw-google opened this issue Aug 9, 2023 · 0 comments · Fixed by #28767
Closed

[Android]Add Json input support for command and write in Android chip-tool #28592

yunhanw-google opened this issue Aug 9, 2023 · 0 comments · Fixed by #28767
Assignees
Labels

Comments

@yunhanw-google
Copy link
Contributor

yunhanw-google commented Aug 9, 2023

For Command arguments, the expect json paylod input in a box would be one command payload
"""
{
"1:ARRAY": [a,b,c,d]
"5:STRING" : "t"
}
"""
we still need to provide the command path(endpointId, clusterId, commandId)
When processing with IM, We need TlvWriter().fromJsonString(value)

For Write arguments, the expect json paylod input in a box would be a list of attribute
"""
{
"1:ARRAY": [a,b,c,d]
"5:STRING" : "t"
}
"""
we need to provide the endpointId, clusterId.
When processing by IM write API, we need get tagNumber and tlvByteArray one by one, inject them into write API.
val dataWithStruct = TlvWriter().fromJsonString(jsonblob)
val tlvReader = TlvReader(dataWithStruct)
tlvReader.skipElement()

while (!tlvReader.isEndOfTlv())) {
val elementBytes = TlvWriter().startStructure(AnonymousTag).copyElement(tlvReader).getEncoded()
val anotherTlvReader = TlvReader(elementBytes)
anotherTlvReader.skipElement()
val tag: ContextSpecificTag? = innerTlvReader.peekElement().tag as? ContextSpecificTag
val tagNumber = tag?.tagNumber?.toUInt()
val value = TlvWriter().copyElement(AnonymousTag, innerTlvReader).getEncoded()

In UI, we need to add box for json input for command and write.

The goal for this work is to demonstrate how to use json/tlv to run cluster interaction with scale, for example, how to send a burst of attributes from multiple clusters using json across components instead of tlv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants