IM: Use Types for Ids
This commit is contained in:
		
							parent
							
								
									89c02e1c7e
								
							
						
					
					
						commit
						cef9919714
					
				
					 11 changed files with 89 additions and 63 deletions
				
			
		|  | @ -21,7 +21,7 @@ use std::{ | |||
| }; | ||||
| 
 | ||||
| use crate::{ | ||||
|     data_model::objects::{Access, Privilege}, | ||||
|     data_model::objects::{Access, ClusterId, EndptId, Privilege}, | ||||
|     error::Error, | ||||
|     fabric, | ||||
|     interaction_model::messages::GenericPath, | ||||
|  | @ -240,13 +240,17 @@ impl<'a> AccessReq<'a> { | |||
| 
 | ||||
| #[derive(FromTLV, ToTLV, Copy, Clone, Debug, PartialEq)] | ||||
| pub struct Target { | ||||
|     cluster: Option<u32>, | ||||
|     endpoint: Option<u16>, | ||||
|     cluster: Option<ClusterId>, | ||||
|     endpoint: Option<EndptId>, | ||||
|     device_type: Option<u32>, | ||||
| } | ||||
| 
 | ||||
| impl Target { | ||||
|     pub fn new(endpoint: Option<u16>, cluster: Option<u32>, device_type: Option<u32>) -> Self { | ||||
|     pub fn new( | ||||
|         endpoint: Option<EndptId>, | ||||
|         cluster: Option<ClusterId>, | ||||
|         device_type: Option<u32>, | ||||
|     ) -> Self { | ||||
|         Self { | ||||
|             cluster, | ||||
|             endpoint, | ||||
|  |  | |||
|  | @ -234,7 +234,7 @@ enum ResumeReq { | |||
| } | ||||
| 
 | ||||
| impl objects::ChangeConsumer for DataModel { | ||||
|     fn endpoint_added(&self, id: u16, endpoint: &mut Endpoint) -> Result<(), Error> { | ||||
|     fn endpoint_added(&self, id: EndptId, endpoint: &mut Endpoint) -> Result<(), Error> { | ||||
|         endpoint.add_cluster(DescriptorCluster::new(id, self.clone())?)?; | ||||
|         Ok(()) | ||||
|     } | ||||
|  |  | |||
|  | @ -134,9 +134,9 @@ impl ResumeReadReq { | |||
| impl DataModel { | ||||
|     pub fn read_attribute_raw( | ||||
|         &self, | ||||
|         endpoint: u16, | ||||
|         cluster: u32, | ||||
|         attr: u16, | ||||
|         endpoint: EndptId, | ||||
|         cluster: ClusterId, | ||||
|         attr: AttrId, | ||||
|     ) -> Result<AttrValue, IMStatusCode> { | ||||
|         let node = self.node.read().unwrap(); | ||||
|         let cluster = node.get_cluster(endpoint, cluster)?; | ||||
|  |  | |||
|  | @ -46,7 +46,7 @@ pub fn device_type_add_root_node( | |||
|     fabric_mgr: Arc<FabricMgr>, | ||||
|     acl_mgr: Arc<AclMgr>, | ||||
|     pase_mgr: PaseMgr, | ||||
| ) -> Result<u32, Error> { | ||||
| ) -> Result<EndptId, Error> { | ||||
|     // Add the root endpoint
 | ||||
|     let endpoint = node.add_endpoint(DEV_TYPE_ROOT_NODE)?; | ||||
|     if endpoint != 0 { | ||||
|  | @ -78,7 +78,7 @@ pub const DEV_TYPE_ON_SMART_SPEAKER: DeviceType = DeviceType { | |||
|     drev: 2, | ||||
| }; | ||||
| 
 | ||||
| pub fn device_type_add_on_off_light(node: &mut WriteNode) -> Result<u32, Error> { | ||||
| pub fn device_type_add_on_off_light(node: &mut WriteNode) -> Result<EndptId, Error> { | ||||
|     let endpoint = node.add_endpoint(DEV_TYPE_ON_OFF_LIGHT)?; | ||||
|     node.add_cluster(endpoint, OnOffCluster::new()?)?; | ||||
|     Ok(endpoint) | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  *    limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| use super::{GlobalElements, Privilege}; | ||||
| use super::{AttrId, GlobalElements, Privilege}; | ||||
| use crate::{ | ||||
|     error::*, | ||||
|     // TODO: This layer shouldn't really depend on the TLV layer, should create an abstraction layer
 | ||||
|  | @ -153,7 +153,7 @@ impl AttrValue { | |||
| 
 | ||||
| #[derive(Debug, Clone)] | ||||
| pub struct Attribute { | ||||
|     pub(super) id: u16, | ||||
|     pub(super) id: AttrId, | ||||
|     pub(super) value: AttrValue, | ||||
|     pub(super) quality: Quality, | ||||
|     pub(super) access: Access, | ||||
|  | @ -171,7 +171,7 @@ impl Default for Attribute { | |||
| } | ||||
| 
 | ||||
| impl Attribute { | ||||
|     pub fn new(id: u16, value: AttrValue, access: Access, quality: Quality) -> Self { | ||||
|     pub fn new(id: AttrId, value: AttrValue, access: Access, quality: Quality) -> Self { | ||||
|         Attribute { | ||||
|             id, | ||||
|             value, | ||||
|  | @ -189,8 +189,8 @@ impl Attribute { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     pub fn is_system_attr(attr_id: u16) -> bool { | ||||
|         attr_id >= (GlobalElements::ServerGenCmd as u16) | ||||
|     pub fn is_system_attr(attr_id: AttrId) -> bool { | ||||
|         attr_id >= (GlobalElements::ServerGenCmd as AttrId) | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -28,7 +28,7 @@ use num_derive::FromPrimitive; | |||
| use rand::Rng; | ||||
| use std::fmt::{self, Debug}; | ||||
| 
 | ||||
| use super::Encoder; | ||||
| use super::{AttrId, ClusterId, Encoder}; | ||||
| 
 | ||||
| pub const ATTRS_PER_CLUSTER: usize = 10; | ||||
| pub const CMDS_PER_CLUSTER: usize = 8; | ||||
|  | @ -56,7 +56,7 @@ pub struct AttrDetails { | |||
|     /// List Index, if any
 | ||||
|     pub list_index: Option<Nullable<u16>>, | ||||
|     /// The actual attribute ID
 | ||||
|     pub attr_id: u16, | ||||
|     pub attr_id: AttrId, | ||||
| } | ||||
| 
 | ||||
| impl AttrDetails { | ||||
|  | @ -102,13 +102,13 @@ pub trait ClusterType { | |||
| } | ||||
| 
 | ||||
| pub struct Cluster { | ||||
|     pub(super) id: u32, | ||||
|     pub(super) id: ClusterId, | ||||
|     attributes: Vec<Attribute>, | ||||
|     data_ver: u32, | ||||
| } | ||||
| 
 | ||||
| impl Cluster { | ||||
|     pub fn new(id: u32) -> Result<Cluster, Error> { | ||||
|     pub fn new(id: ClusterId) -> Result<Cluster, Error> { | ||||
|         let mut c = Cluster { | ||||
|             id, | ||||
|             attributes: Vec::with_capacity(ATTRS_PER_CLUSTER), | ||||
|  | @ -118,7 +118,7 @@ impl Cluster { | |||
|         Ok(c) | ||||
|     } | ||||
| 
 | ||||
|     pub fn id(&self) -> u32 { | ||||
|     pub fn id(&self) -> ClusterId { | ||||
|         self.id | ||||
|     } | ||||
| 
 | ||||
|  | @ -167,18 +167,18 @@ impl Cluster { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     fn get_attribute_index(&self, attr_id: u16) -> Option<usize> { | ||||
|     fn get_attribute_index(&self, attr_id: AttrId) -> Option<usize> { | ||||
|         self.attributes.iter().position(|c| c.id == attr_id) | ||||
|     } | ||||
| 
 | ||||
|     fn get_attribute(&self, attr_id: u16) -> Result<&Attribute, Error> { | ||||
|     fn get_attribute(&self, attr_id: AttrId) -> Result<&Attribute, Error> { | ||||
|         let index = self | ||||
|             .get_attribute_index(attr_id) | ||||
|             .ok_or(Error::AttributeNotFound)?; | ||||
|         Ok(&self.attributes[index]) | ||||
|     } | ||||
| 
 | ||||
|     fn get_attribute_mut(&mut self, attr_id: u16) -> Result<&mut Attribute, Error> { | ||||
|     fn get_attribute_mut(&mut self, attr_id: AttrId) -> Result<&mut Attribute, Error> { | ||||
|         let index = self | ||||
|             .get_attribute_index(attr_id) | ||||
|             .ok_or(Error::AttributeNotFound)?; | ||||
|  | @ -188,7 +188,7 @@ impl Cluster { | |||
|     // Returns a slice of attribute, with either a single attribute or all (wildcard)
 | ||||
|     pub fn get_wildcard_attribute( | ||||
|         &self, | ||||
|         attribute: Option<u16>, | ||||
|         attribute: Option<AttrId>, | ||||
|     ) -> Result<(&[Attribute], bool), IMStatusCode> { | ||||
|         if let Some(a) = attribute { | ||||
|             if let Some(i) = self.get_attribute_index(a) { | ||||
|  | @ -266,7 +266,7 @@ impl Cluster { | |||
|         encoder.encode_status(IMStatusCode::UnsupportedAttribute, 0) | ||||
|     } | ||||
| 
 | ||||
|     pub fn read_attribute_raw(&self, attr_id: u16) -> Result<&AttrValue, IMStatusCode> { | ||||
|     pub fn read_attribute_raw(&self, attr_id: AttrId) -> Result<&AttrValue, IMStatusCode> { | ||||
|         let a = self | ||||
|             .get_attribute(attr_id) | ||||
|             .map_err(|_| IMStatusCode::UnsupportedAttribute)?; | ||||
|  | @ -300,7 +300,7 @@ impl Cluster { | |||
| 
 | ||||
|     pub fn write_attribute_from_tlv( | ||||
|         &mut self, | ||||
|         attr_id: u16, | ||||
|         attr_id: AttrId, | ||||
|         data: &TLVElement, | ||||
|     ) -> Result<(), IMStatusCode> { | ||||
|         let a = self.get_attribute_mut(attr_id)?; | ||||
|  | @ -319,7 +319,7 @@ impl Cluster { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     pub fn write_attribute_raw(&mut self, attr_id: u16, value: AttrValue) -> Result<(), Error> { | ||||
|     pub fn write_attribute_raw(&mut self, attr_id: AttrId, value: AttrValue) -> Result<(), Error> { | ||||
|         let a = self.get_attribute_mut(attr_id)?; | ||||
|         a.set_value(value).map(|_| { | ||||
|             self.cluster_changed(); | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ use crate::{data_model::objects::ClusterType, error::*, interaction_model::core: | |||
| 
 | ||||
| use std::fmt; | ||||
| 
 | ||||
| use super::DeviceType; | ||||
| use super::{ClusterId, DeviceType}; | ||||
| 
 | ||||
| pub const CLUSTERS_PER_ENDPT: usize = 9; | ||||
| 
 | ||||
|  | @ -51,18 +51,21 @@ impl Endpoint { | |||
|         &self.dev_type | ||||
|     } | ||||
| 
 | ||||
|     fn get_cluster_index(&self, cluster_id: u32) -> Option<usize> { | ||||
|     fn get_cluster_index(&self, cluster_id: ClusterId) -> Option<usize> { | ||||
|         self.clusters.iter().position(|c| c.base().id == cluster_id) | ||||
|     } | ||||
| 
 | ||||
|     pub fn get_cluster(&self, cluster_id: u32) -> Result<&dyn ClusterType, Error> { | ||||
|     pub fn get_cluster(&self, cluster_id: ClusterId) -> Result<&dyn ClusterType, Error> { | ||||
|         let index = self | ||||
|             .get_cluster_index(cluster_id) | ||||
|             .ok_or(Error::ClusterNotFound)?; | ||||
|         Ok(self.clusters[index].as_ref()) | ||||
|     } | ||||
| 
 | ||||
|     pub fn get_cluster_mut(&mut self, cluster_id: u32) -> Result<&mut dyn ClusterType, Error> { | ||||
|     pub fn get_cluster_mut( | ||||
|         &mut self, | ||||
|         cluster_id: ClusterId, | ||||
|     ) -> Result<&mut dyn ClusterType, Error> { | ||||
|         let index = self | ||||
|             .get_cluster_index(cluster_id) | ||||
|             .ok_or(Error::ClusterNotFound)?; | ||||
|  | @ -72,7 +75,7 @@ impl Endpoint { | |||
|     // Returns a slice of clusters, with either a single cluster or all (wildcard)
 | ||||
|     pub fn get_wildcard_clusters( | ||||
|         &self, | ||||
|         cluster: Option<u32>, | ||||
|         cluster: Option<ClusterId>, | ||||
|     ) -> Result<(&BoxedClusters, bool), IMStatusCode> { | ||||
|         if let Some(c) = cluster { | ||||
|             if let Some(i) = self.get_cluster_index(c) { | ||||
|  | @ -88,7 +91,7 @@ impl Endpoint { | |||
|     // Returns a slice of clusters, with either a single cluster or all (wildcard)
 | ||||
|     pub fn get_wildcard_clusters_mut( | ||||
|         &mut self, | ||||
|         cluster: Option<u32>, | ||||
|         cluster: Option<ClusterId>, | ||||
|     ) -> Result<(&mut BoxedClusters, bool), IMStatusCode> { | ||||
|         if let Some(c) = cluster { | ||||
|             if let Some(i) = self.get_cluster_index(c) { | ||||
|  |  | |||
|  | @ -15,6 +15,11 @@ | |||
|  *    limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| pub type EndptId = u16; | ||||
| pub type ClusterId = u32; | ||||
| pub type AttrId = u16; | ||||
| pub type CmdId = u32; | ||||
| 
 | ||||
| mod attribute; | ||||
| pub use attribute::*; | ||||
| 
 | ||||
|  |  | |||
|  | @ -23,10 +23,10 @@ use crate::{ | |||
| }; | ||||
| use std::fmt; | ||||
| 
 | ||||
| use super::DeviceType; | ||||
| use super::{ClusterId, DeviceType, EndptId}; | ||||
| 
 | ||||
| pub trait ChangeConsumer { | ||||
|     fn endpoint_added(&self, id: u16, endpoint: &mut Endpoint) -> Result<(), Error>; | ||||
|     fn endpoint_added(&self, id: EndptId, endpoint: &mut Endpoint) -> Result<(), Error>; | ||||
| } | ||||
| 
 | ||||
| pub const ENDPTS_PER_ACC: usize = 3; | ||||
|  | @ -61,7 +61,7 @@ impl Node { | |||
|         self.changes_cb = Some(consumer); | ||||
|     } | ||||
| 
 | ||||
|     pub fn add_endpoint(&mut self, dev_type: DeviceType) -> Result<u32, Error> { | ||||
|     pub fn add_endpoint(&mut self, dev_type: DeviceType) -> Result<EndptId, Error> { | ||||
|         let index = self | ||||
|             .endpoints | ||||
|             .iter() | ||||
|  | @ -69,13 +69,13 @@ impl Node { | |||
|             .ok_or(Error::NoSpace)?; | ||||
|         let mut endpoint = Endpoint::new(dev_type)?; | ||||
|         if let Some(cb) = &self.changes_cb { | ||||
|             cb.endpoint_added(index as u16, &mut endpoint)?; | ||||
|             cb.endpoint_added(index as EndptId, &mut endpoint)?; | ||||
|         } | ||||
|         self.endpoints[index] = Some(endpoint); | ||||
|         Ok(index as u32) | ||||
|         Ok(index as EndptId) | ||||
|     } | ||||
| 
 | ||||
|     pub fn get_endpoint(&self, endpoint_id: u16) -> Result<&Endpoint, Error> { | ||||
|     pub fn get_endpoint(&self, endpoint_id: EndptId) -> Result<&Endpoint, Error> { | ||||
|         if (endpoint_id as usize) < ENDPTS_PER_ACC { | ||||
|             let endpoint = self.endpoints[endpoint_id as usize] | ||||
|                 .as_ref() | ||||
|  | @ -86,7 +86,7 @@ impl Node { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     pub fn get_endpoint_mut(&mut self, endpoint_id: u16) -> Result<&mut Endpoint, Error> { | ||||
|     pub fn get_endpoint_mut(&mut self, endpoint_id: EndptId) -> Result<&mut Endpoint, Error> { | ||||
|         if (endpoint_id as usize) < ENDPTS_PER_ACC { | ||||
|             let endpoint = self.endpoints[endpoint_id as usize] | ||||
|                 .as_mut() | ||||
|  | @ -97,17 +97,21 @@ impl Node { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     pub fn get_cluster_mut(&mut self, e: u16, c: u32) -> Result<&mut dyn ClusterType, Error> { | ||||
|     pub fn get_cluster_mut( | ||||
|         &mut self, | ||||
|         e: EndptId, | ||||
|         c: ClusterId, | ||||
|     ) -> Result<&mut dyn ClusterType, Error> { | ||||
|         self.get_endpoint_mut(e)?.get_cluster_mut(c) | ||||
|     } | ||||
| 
 | ||||
|     pub fn get_cluster(&self, e: u16, c: u32) -> Result<&dyn ClusterType, Error> { | ||||
|     pub fn get_cluster(&self, e: EndptId, c: ClusterId) -> Result<&dyn ClusterType, Error> { | ||||
|         self.get_endpoint(e)?.get_cluster(c) | ||||
|     } | ||||
| 
 | ||||
|     pub fn add_cluster( | ||||
|         &mut self, | ||||
|         endpoint_id: u32, | ||||
|         endpoint_id: EndptId, | ||||
|         cluster: Box<dyn ClusterType>, | ||||
|     ) -> Result<(), Error> { | ||||
|         let endpoint_id = endpoint_id as usize; | ||||
|  | @ -124,7 +128,7 @@ impl Node { | |||
|     // Returns a slice of endpoints, with either a single endpoint or all (wildcard)
 | ||||
|     pub fn get_wildcard_endpoints( | ||||
|         &self, | ||||
|         endpoint: Option<u16>, | ||||
|         endpoint: Option<EndptId>, | ||||
|     ) -> Result<(&BoxedEndpoints, usize, bool), IMStatusCode> { | ||||
|         if let Some(e) = endpoint { | ||||
|             let e = e as usize; | ||||
|  | @ -140,7 +144,7 @@ impl Node { | |||
| 
 | ||||
|     pub fn get_wildcard_endpoints_mut( | ||||
|         &mut self, | ||||
|         endpoint: Option<u16>, | ||||
|         endpoint: Option<EndptId>, | ||||
|     ) -> Result<(&mut BoxedEndpoints, usize, bool), IMStatusCode> { | ||||
|         if let Some(e) = endpoint { | ||||
|             let e = e as usize; | ||||
|  | @ -171,7 +175,7 @@ impl Node { | |||
|         let (endpoints, mut endpoint_id, wildcard) = self.get_wildcard_endpoints(path.endpoint)?; | ||||
|         for e in endpoints.iter() { | ||||
|             if let Some(e) = e { | ||||
|                 current_path.endpoint = Some(endpoint_id as u16); | ||||
|                 current_path.endpoint = Some(endpoint_id as EndptId); | ||||
|                 f(¤t_path, e.as_ref()) | ||||
|                     .or_else(|e| if !wildcard { Err(e) } else { Ok(()) })?; | ||||
|             } | ||||
|  | @ -202,7 +206,7 @@ impl Node { | |||
|             self.get_wildcard_endpoints_mut(path.endpoint)?; | ||||
|         for e in endpoints.iter_mut() { | ||||
|             if let Some(e) = e { | ||||
|                 current_path.endpoint = Some(endpoint_id as u16); | ||||
|                 current_path.endpoint = Some(endpoint_id as EndptId); | ||||
|                 f(¤t_path, e.as_mut()) | ||||
|                     .or_else(|e| if !wildcard { Err(e) } else { Ok(()) })?; | ||||
|             } | ||||
|  |  | |||
|  | @ -37,12 +37,12 @@ pub enum Attributes { | |||
| 
 | ||||
| pub struct DescriptorCluster { | ||||
|     base: Cluster, | ||||
|     endpoint_id: u16, | ||||
|     endpoint_id: EndptId, | ||||
|     data_model: DataModel, | ||||
| } | ||||
| 
 | ||||
| impl DescriptorCluster { | ||||
|     pub fn new(endpoint_id: u16, data_model: DataModel) -> Result<Box<Self>, Error> { | ||||
|     pub fn new(endpoint_id: EndptId, data_model: DataModel) -> Result<Box<Self>, Error> { | ||||
|         let mut c = Box::new(DescriptorCluster { | ||||
|             endpoint_id, | ||||
|             data_model, | ||||
|  |  | |||
|  | @ -16,6 +16,7 @@ | |||
|  */ | ||||
| 
 | ||||
| use crate::{ | ||||
|     data_model::objects::{ClusterId, EndptId}, | ||||
|     error::Error, | ||||
|     tlv::{FromTLV, TLVElement, TLVWriter, TagType, ToTLV}, | ||||
| }; | ||||
|  | @ -25,13 +26,13 @@ use crate::{ | |||
| #[derive(Default, Clone, Copy, Debug, PartialEq, FromTLV, ToTLV)] | ||||
| #[tlvargs(datatype = "list")] | ||||
| pub struct GenericPath { | ||||
|     pub endpoint: Option<u16>, | ||||
|     pub cluster: Option<u32>, | ||||
|     pub endpoint: Option<EndptId>, | ||||
|     pub cluster: Option<ClusterId>, | ||||
|     pub leaf: Option<u32>, | ||||
| } | ||||
| 
 | ||||
| impl GenericPath { | ||||
|     pub fn new(endpoint: Option<u16>, cluster: Option<u32>, leaf: Option<u32>) -> Self { | ||||
|     pub fn new(endpoint: Option<EndptId>, cluster: Option<ClusterId>, leaf: Option<u32>) -> Self { | ||||
|         Self { | ||||
|             endpoint, | ||||
|             cluster, | ||||
|  | @ -40,7 +41,7 @@ impl GenericPath { | |||
|     } | ||||
| 
 | ||||
|     /// Returns Ok, if the path is non wildcard, otherwise returns an error
 | ||||
|     pub fn not_wildcard(&self) -> Result<(u16, u32, u32), Error> { | ||||
|     pub fn not_wildcard(&self) -> Result<(EndptId, ClusterId, u32), Error> { | ||||
|         match *self { | ||||
|             GenericPath { | ||||
|                 endpoint: Some(e), | ||||
|  | @ -257,7 +258,7 @@ pub mod ib { | |||
|     use std::fmt::Debug; | ||||
| 
 | ||||
|     use crate::{ | ||||
|         data_model::objects::{AttrDetails, EncodeValue}, | ||||
|         data_model::objects::{AttrDetails, AttrId, ClusterId, EncodeValue, EndptId}, | ||||
|         error::Error, | ||||
|         interaction_model::core::IMStatusCode, | ||||
|         tlv::{FromTLV, Nullable, TLVElement, TLVWriter, TagType, ToTLV}, | ||||
|  | @ -275,7 +276,12 @@ pub mod ib { | |||
|     } | ||||
| 
 | ||||
|     impl<'a> InvResp<'a> { | ||||
|         pub fn cmd_new(endpoint: u16, cluster: u32, cmd: u16, data: EncodeValue<'a>) -> Self { | ||||
|         pub fn cmd_new( | ||||
|             endpoint: EndptId, | ||||
|             cluster: ClusterId, | ||||
|             cmd: u16, | ||||
|             data: EncodeValue<'a>, | ||||
|         ) -> Self { | ||||
|             Self::Cmd(CmdData::new( | ||||
|                 CmdPath::new(Some(endpoint), Some(cluster), Some(cmd)), | ||||
|                 data, | ||||
|  | @ -448,9 +454,9 @@ pub mod ib { | |||
|     pub struct AttrPath { | ||||
|         pub tag_compression: Option<bool>, | ||||
|         pub node: Option<u64>, | ||||
|         pub endpoint: Option<u16>, | ||||
|         pub cluster: Option<u32>, | ||||
|         pub attr: Option<u16>, | ||||
|         pub endpoint: Option<EndptId>, | ||||
|         pub cluster: Option<ClusterId>, | ||||
|         pub attr: Option<AttrId>, | ||||
|         pub list_index: Option<Nullable<u16>>, | ||||
|     } | ||||
| 
 | ||||
|  | @ -490,7 +496,11 @@ pub mod ib { | |||
|     } | ||||
| 
 | ||||
|     impl CmdPath { | ||||
|         pub fn new(endpoint: Option<u16>, cluster: Option<u32>, command: Option<u16>) -> Self { | ||||
|         pub fn new( | ||||
|             endpoint: Option<EndptId>, | ||||
|             cluster: Option<ClusterId>, | ||||
|             command: Option<u16>, | ||||
|         ) -> Self { | ||||
|             Self { | ||||
|                 path: GenericPath { | ||||
|                     endpoint, | ||||
|  | @ -525,8 +535,8 @@ pub mod ib { | |||
|     #[derive(FromTLV, ToTLV, Copy, Clone)] | ||||
|     pub struct ClusterPath { | ||||
|         pub node: Option<u64>, | ||||
|         pub endpoint: u16, | ||||
|         pub cluster: u32, | ||||
|         pub endpoint: EndptId, | ||||
|         pub cluster: ClusterId, | ||||
|     } | ||||
| 
 | ||||
|     #[derive(FromTLV, ToTLV, Copy, Clone)] | ||||
|  | @ -539,8 +549,8 @@ pub mod ib { | |||
|     #[tlvargs(datatype = "list")] | ||||
|     pub struct EventPath { | ||||
|         pub node: Option<u64>, | ||||
|         pub endpoint: Option<u16>, | ||||
|         pub cluster: Option<u32>, | ||||
|         pub endpoint: Option<EndptId>, | ||||
|         pub cluster: Option<ClusterId>, | ||||
|         pub event: Option<u32>, | ||||
|         pub is_urgent: Option<bool>, | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue