-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[BUG] Java API does not expose list reads on a reasonable way #28680
Comments
DeviceTypeList See these attributes, they are list, if it is too long to fit in a packet, the interaction model code would handle reports with chunks. Chunking required when reading a large list or a large set of attributes. |
So how do I differentiate a single chuncked response from multiple responses? There needs to be an indicator in the response API to tell my code to combine or replace. |
There is. The attribute path tells you what's going on. See the mListOp member of ConcreteDataAttributePath. |
@bzbarsky-apple Can you please reopen, I don't have the ability. As far as I can see the Java API is not exposing mListOp. ReportCallback::OnAttributeData receives the ConcreteDataAttributePath. When it creates the Java AttributeState object it does not include the mListOp status telling you to append, replace, etc. |
@yunhanw-google Shouldn't this API be coalescing the chunking into a single value and not sending the pieces into the user app? BTW, thread is chunking lots of stuff. Previously I was using wifi and it never chunked anything. When I started testing with Thread devices I immediately hit this chunking issue. |
@jonsmirl Android's OnReportCallback use ClusterStateCache, and ClusterStateCache use bufferedReadCallback Therefore when using Java/Jni's onReport, https://github.com/project-chip/connectedhomeip/blob/master/src/controller/java/AndroidCallbacks.cpp#L219 |
So attributeState.getValue where the 'value' is returned as Java ChipStructs is basically unusable? I have to rework everything to use JSON or TLV directly? That is giant pain because I round trip these values. I modify the structs and then write them back to the CHIP attributes. And the CHIP API requires the ChipStructs. I need to go explore Kotlin json support. Maybe the Kotlin json library can convert these back into ChipStructs. Does this same problem occur on a direct read of the attributes? |
This is a total mess for user apps. Now I have to add code to convert every possible JSON object back into ChipStructs. That is the kind of code zap should be generating. This API should be returning coalesced ChipStructs so that they can be round-tripped back into the CHIP API. |
Sorry, we do provide 3 output in report, JSON, TLV/AttributeTLVValue
Now this flag is enabled at default. You could use JSON or Tlv as well, you may need to match JSOO or TLV to cluster attribute. |
The JSON is identical to the ChipStruct, neither are coalesced. First line is the ChipStruct, second is the JSON from each attribute report.
|
You said that earlier, but how does this work on Thread with an MTU of 127 bytes? If only these (DeviceTypeList ServerList ClientList PartsList TagList) are impacted, I don't care I am just printing them out as an easy way to test. But are ACLs going to get chunked on Thread? I can't tolerate partial ACL responses. Modifying the ACL has to be a read-modify-write operation. If this API is going to send chunks into the user apps, then doesn't it have to include the mListOp field so that I can know what to do with the chunks?
|
As I mentioned, from NodeState, you would see the attribute as a whole via json/tlv/ChipStruct, the underlying bufferReader in c++ layer has coalesced them together as a attribute if the list is oversized and sent via chunk |
I printed it out above, the json is not coalesced. Timber.d( |
you may add additional log in https://github.com/project-chip/connectedhomeip/blob/master/src/app/BufferedReadCallback.cpp#L70, you may confirm whether the actual coalescing happens or not |
I need to investigate this more. There is a bridge in the system and after debugging this appears it could be from the bridge and not directly from the chunking code. I added printing code as you suggested including mListOp and they are all 1, if it was a local chunking issue there would be some 2s. So maybe the chunks aren't making it through the bridge as expected. I will open new bug when I figure out more. |
Now that we figured out to look at the bridge code we found the problem. Those reports that look like chunks aren't really chunks. They are actually the Descriptors from three different endpoints on the device and the bridge was not tracking the EPs correctly and reported them all on EP0. @yunhanw-google thanks for the help looking at this. |
Reproduction steps
Is this correct behavior? I have a wild card subscription and the Descriptor attributes are coming back in pieces.
Do other attributes report in pieces? If so, how can you differentiate a piece from a change in the attribute?
These are the events I am getting from the subscription API.
Bug prevalence
always
GitHub hash of the SDK that was being used
5b4f800
Platform
core
Platform Version(s)
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: