Bugfix: only report devtype for the queried endpoint
This commit is contained in:
parent
09a523fc50
commit
2a57ecbd87
1 changed files with 11 additions and 3 deletions
|
@ -71,7 +71,12 @@ impl DescriptorCluster {
|
||||||
} else {
|
} else {
|
||||||
match attr.attr_id.try_into()? {
|
match attr.attr_id.try_into()? {
|
||||||
Attributes::DeviceTypeList => {
|
Attributes::DeviceTypeList => {
|
||||||
self.encode_devtype_list(attr.node, AttrDataWriter::TAG, &mut writer)?;
|
self.encode_devtype_list(
|
||||||
|
attr.node,
|
||||||
|
attr.endpoint_id,
|
||||||
|
AttrDataWriter::TAG,
|
||||||
|
&mut writer,
|
||||||
|
)?;
|
||||||
writer.complete()
|
writer.complete()
|
||||||
}
|
}
|
||||||
Attributes::ServerList => {
|
Attributes::ServerList => {
|
||||||
|
@ -111,13 +116,16 @@ impl DescriptorCluster {
|
||||||
fn encode_devtype_list(
|
fn encode_devtype_list(
|
||||||
&self,
|
&self,
|
||||||
node: &Node,
|
node: &Node,
|
||||||
|
endpoint_id: u16,
|
||||||
tag: TagType,
|
tag: TagType,
|
||||||
tw: &mut TLVWriter,
|
tw: &mut TLVWriter,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
tw.start_array(tag)?;
|
tw.start_array(tag)?;
|
||||||
for endpoint in node.endpoints {
|
for endpoint in node.endpoints {
|
||||||
let dev_type = endpoint.device_type;
|
if endpoint.id == endpoint_id {
|
||||||
dev_type.to_tlv(tw, TagType::Anonymous)?;
|
let dev_type = endpoint.device_type;
|
||||||
|
dev_type.to_tlv(tw, TagType::Anonymous)?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tw.end_container()
|
tw.end_container()
|
||||||
|
|
Loading…
Add table
Reference in a new issue