diff --git a/examples/onoff_light/src/main.rs b/examples/onoff_light/src/main.rs index efa4b853..7f0dc4a4 100644 --- a/examples/onoff_light/src/main.rs +++ b/examples/onoff_light/src/main.rs @@ -133,7 +133,7 @@ fn run() -> Result<(), Error> { core::mem::size_of_val(&responder.run::<4, 4>()) ); - // Run the responder with up to 4 handlers (i.e. 4 exchanges can be handled simultenously) + // Run the responder with up to 4 handlers (i.e. 4 exchanges can be handled simultaneously) // Clients trying to open more exchanges than the ones currently running will get "I'm busy, please try again later" let mut respond = pin!(responder.run::<4, 4>()); //let mut respond = responder_fut(responder); @@ -229,7 +229,7 @@ const NODE: Node<'static> = Node { root_endpoint::endpoint(0, root_endpoint::OperNwType::Ethernet), Endpoint { id: 1, - device_type: DEV_TYPE_ON_OFF_LIGHT, + device_types: &[DEV_TYPE_ON_OFF_LIGHT], clusters: &[descriptor::CLUSTER, cluster_on_off::CLUSTER], }, ], diff --git a/examples/onoff_light_bt/src/main.rs b/examples/onoff_light_bt/src/main.rs index 8099eb28..14cdf825 100644 --- a/examples/onoff_light_bt/src/main.rs +++ b/examples/onoff_light_bt/src/main.rs @@ -244,7 +244,7 @@ const NODE: Node<'static> = Node { root_endpoint::endpoint(0, root_endpoint::OperNwType::Wifi), Endpoint { id: 1, - device_type: DEV_TYPE_ON_OFF_LIGHT, + device_types: &[DEV_TYPE_ON_OFF_LIGHT], clusters: &[descriptor::CLUSTER, cluster_on_off::CLUSTER], }, ], diff --git a/rs-matter/src/data_model/objects/endpoint.rs b/rs-matter/src/data_model/objects/endpoint.rs index 05878edc..c84583ed 100644 --- a/rs-matter/src/data_model/objects/endpoint.rs +++ b/rs-matter/src/data_model/objects/endpoint.rs @@ -24,7 +24,7 @@ use super::{AttrId, Attribute, Cluster, ClusterId, CmdId, DeviceType, EndptId}; #[derive(Debug, Clone)] pub struct Endpoint<'a> { pub id: EndptId, - pub device_type: DeviceType, + pub device_types: &'a [DeviceType], pub clusters: &'a [Cluster<'a>], } diff --git a/rs-matter/src/data_model/root_endpoint.rs b/rs-matter/src/data_model/root_endpoint.rs index ce86a603..2ed71bac 100644 --- a/rs-matter/src/data_model/root_endpoint.rs +++ b/rs-matter/src/data_model/root_endpoint.rs @@ -52,7 +52,7 @@ pub enum OperNwType { pub const fn endpoint(id: EndptId, op_nw_type: OperNwType) -> Endpoint<'static> { Endpoint { id, - device_type: super::device_types::DEV_TYPE_ROOT_NODE, + device_types: &[super::device_types::DEV_TYPE_ROOT_NODE], clusters: clusters(op_nw_type), } } diff --git a/rs-matter/src/data_model/system_model/descriptor.rs b/rs-matter/src/data_model/system_model/descriptor.rs index a5501a8a..cbeca61e 100644 --- a/rs-matter/src/data_model/system_model/descriptor.rs +++ b/rs-matter/src/data_model/system_model/descriptor.rs @@ -182,8 +182,9 @@ impl<'a> DescriptorCluster<'a> { tw.start_array(tag)?; for endpoint in node.endpoints { if endpoint.id == endpoint_id { - let dev_type = endpoint.device_type; - dev_type.to_tlv(&TagType::Anonymous, &mut *tw)?; + for dev_type in endpoint.device_types { + dev_type.to_tlv(&TagType::Anonymous, &mut *tw)?; + } } } diff --git a/rs-matter/tests/common/e2e/im/handler.rs b/rs-matter/tests/common/e2e/im/handler.rs index b8487a84..59049b60 100644 --- a/rs-matter/tests/common/e2e/im/handler.rs +++ b/rs-matter/tests/common/e2e/im/handler.rs @@ -60,7 +60,7 @@ impl<'a> E2eTestHandler<'a> { access_control::CLUSTER, echo_cluster::CLUSTER, ], - device_type: DEV_TYPE_ROOT_NODE, + device_types: &[DEV_TYPE_ROOT_NODE], }, Endpoint { id: 1, @@ -69,7 +69,7 @@ impl<'a> E2eTestHandler<'a> { cluster_on_off::CLUSTER, echo_cluster::CLUSTER, ], - device_type: DEV_TYPE_ON_OFF_LIGHT, + device_types: &[DEV_TYPE_ON_OFF_LIGHT], }, ], }; diff --git a/rs-matter/tests/common/im_engine.rs b/rs-matter/tests/common/im_engine.rs index 50fd67ca..65532441 100644 --- a/rs-matter/tests/common/im_engine.rs +++ b/rs-matter/tests/common/im_engine.rs @@ -109,7 +109,7 @@ const NODE: Node<'static> = Node { access_control::CLUSTER, echo_cluster::CLUSTER, ], - device_type: DEV_TYPE_ROOT_NODE, + device_types: &[DEV_TYPE_ROOT_NODE], }, Endpoint { id: 1, @@ -118,7 +118,7 @@ const NODE: Node<'static> = Node { cluster_on_off::CLUSTER, echo_cluster::CLUSTER, ], - device_type: DEV_TYPE_ON_OFF_LIGHT, + device_types: &[DEV_TYPE_ON_OFF_LIGHT], }, ], };