IM: Use Types for Ids

This commit is contained in:
Kedar Sovani 2023-03-06 23:26:30 +05:30
parent 89c02e1c7e
commit cef9919714
11 changed files with 89 additions and 63 deletions

View file

@ -21,7 +21,7 @@ use std::{
}; };
use crate::{ use crate::{
data_model::objects::{Access, Privilege}, data_model::objects::{Access, ClusterId, EndptId, Privilege},
error::Error, error::Error,
fabric, fabric,
interaction_model::messages::GenericPath, interaction_model::messages::GenericPath,
@ -240,13 +240,17 @@ impl<'a> AccessReq<'a> {
#[derive(FromTLV, ToTLV, Copy, Clone, Debug, PartialEq)] #[derive(FromTLV, ToTLV, Copy, Clone, Debug, PartialEq)]
pub struct Target { pub struct Target {
cluster: Option<u32>, cluster: Option<ClusterId>,
endpoint: Option<u16>, endpoint: Option<EndptId>,
device_type: Option<u32>, device_type: Option<u32>,
} }
impl Target { 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 { Self {
cluster, cluster,
endpoint, endpoint,

View file

@ -234,7 +234,7 @@ enum ResumeReq {
} }
impl objects::ChangeConsumer for DataModel { 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())?)?; endpoint.add_cluster(DescriptorCluster::new(id, self.clone())?)?;
Ok(()) Ok(())
} }

View file

@ -134,9 +134,9 @@ impl ResumeReadReq {
impl DataModel { impl DataModel {
pub fn read_attribute_raw( pub fn read_attribute_raw(
&self, &self,
endpoint: u16, endpoint: EndptId,
cluster: u32, cluster: ClusterId,
attr: u16, attr: AttrId,
) -> Result<AttrValue, IMStatusCode> { ) -> Result<AttrValue, IMStatusCode> {
let node = self.node.read().unwrap(); let node = self.node.read().unwrap();
let cluster = node.get_cluster(endpoint, cluster)?; let cluster = node.get_cluster(endpoint, cluster)?;

View file

@ -46,7 +46,7 @@ pub fn device_type_add_root_node(
fabric_mgr: Arc<FabricMgr>, fabric_mgr: Arc<FabricMgr>,
acl_mgr: Arc<AclMgr>, acl_mgr: Arc<AclMgr>,
pase_mgr: PaseMgr, pase_mgr: PaseMgr,
) -> Result<u32, Error> { ) -> Result<EndptId, Error> {
// Add the root endpoint // Add the root endpoint
let endpoint = node.add_endpoint(DEV_TYPE_ROOT_NODE)?; let endpoint = node.add_endpoint(DEV_TYPE_ROOT_NODE)?;
if endpoint != 0 { if endpoint != 0 {
@ -78,7 +78,7 @@ pub const DEV_TYPE_ON_SMART_SPEAKER: DeviceType = DeviceType {
drev: 2, 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)?; let endpoint = node.add_endpoint(DEV_TYPE_ON_OFF_LIGHT)?;
node.add_cluster(endpoint, OnOffCluster::new()?)?; node.add_cluster(endpoint, OnOffCluster::new()?)?;
Ok(endpoint) Ok(endpoint)

View file

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
use super::{GlobalElements, Privilege}; use super::{AttrId, GlobalElements, Privilege};
use crate::{ use crate::{
error::*, error::*,
// TODO: This layer shouldn't really depend on the TLV layer, should create an abstraction layer // 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)] #[derive(Debug, Clone)]
pub struct Attribute { pub struct Attribute {
pub(super) id: u16, pub(super) id: AttrId,
pub(super) value: AttrValue, pub(super) value: AttrValue,
pub(super) quality: Quality, pub(super) quality: Quality,
pub(super) access: Access, pub(super) access: Access,
@ -171,7 +171,7 @@ impl Default for Attribute {
} }
impl 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 { Attribute {
id, id,
value, value,
@ -189,8 +189,8 @@ impl Attribute {
} }
} }
pub fn is_system_attr(attr_id: u16) -> bool { pub fn is_system_attr(attr_id: AttrId) -> bool {
attr_id >= (GlobalElements::ServerGenCmd as u16) attr_id >= (GlobalElements::ServerGenCmd as AttrId)
} }
} }

View file

@ -28,7 +28,7 @@ use num_derive::FromPrimitive;
use rand::Rng; use rand::Rng;
use std::fmt::{self, Debug}; use std::fmt::{self, Debug};
use super::Encoder; use super::{AttrId, ClusterId, Encoder};
pub const ATTRS_PER_CLUSTER: usize = 10; pub const ATTRS_PER_CLUSTER: usize = 10;
pub const CMDS_PER_CLUSTER: usize = 8; pub const CMDS_PER_CLUSTER: usize = 8;
@ -56,7 +56,7 @@ pub struct AttrDetails {
/// List Index, if any /// List Index, if any
pub list_index: Option<Nullable<u16>>, pub list_index: Option<Nullable<u16>>,
/// The actual attribute ID /// The actual attribute ID
pub attr_id: u16, pub attr_id: AttrId,
} }
impl AttrDetails { impl AttrDetails {
@ -102,13 +102,13 @@ pub trait ClusterType {
} }
pub struct Cluster { pub struct Cluster {
pub(super) id: u32, pub(super) id: ClusterId,
attributes: Vec<Attribute>, attributes: Vec<Attribute>,
data_ver: u32, data_ver: u32,
} }
impl Cluster { impl Cluster {
pub fn new(id: u32) -> Result<Cluster, Error> { pub fn new(id: ClusterId) -> Result<Cluster, Error> {
let mut c = Cluster { let mut c = Cluster {
id, id,
attributes: Vec::with_capacity(ATTRS_PER_CLUSTER), attributes: Vec::with_capacity(ATTRS_PER_CLUSTER),
@ -118,7 +118,7 @@ impl Cluster {
Ok(c) Ok(c)
} }
pub fn id(&self) -> u32 { pub fn id(&self) -> ClusterId {
self.id 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) 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 let index = self
.get_attribute_index(attr_id) .get_attribute_index(attr_id)
.ok_or(Error::AttributeNotFound)?; .ok_or(Error::AttributeNotFound)?;
Ok(&self.attributes[index]) 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 let index = self
.get_attribute_index(attr_id) .get_attribute_index(attr_id)
.ok_or(Error::AttributeNotFound)?; .ok_or(Error::AttributeNotFound)?;
@ -188,7 +188,7 @@ impl Cluster {
// Returns a slice of attribute, with either a single attribute or all (wildcard) // Returns a slice of attribute, with either a single attribute or all (wildcard)
pub fn get_wildcard_attribute( pub fn get_wildcard_attribute(
&self, &self,
attribute: Option<u16>, attribute: Option<AttrId>,
) -> Result<(&[Attribute], bool), IMStatusCode> { ) -> Result<(&[Attribute], bool), IMStatusCode> {
if let Some(a) = attribute { if let Some(a) = attribute {
if let Some(i) = self.get_attribute_index(a) { if let Some(i) = self.get_attribute_index(a) {
@ -266,7 +266,7 @@ impl Cluster {
encoder.encode_status(IMStatusCode::UnsupportedAttribute, 0) 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 let a = self
.get_attribute(attr_id) .get_attribute(attr_id)
.map_err(|_| IMStatusCode::UnsupportedAttribute)?; .map_err(|_| IMStatusCode::UnsupportedAttribute)?;
@ -300,7 +300,7 @@ impl Cluster {
pub fn write_attribute_from_tlv( pub fn write_attribute_from_tlv(
&mut self, &mut self,
attr_id: u16, attr_id: AttrId,
data: &TLVElement, data: &TLVElement,
) -> Result<(), IMStatusCode> { ) -> Result<(), IMStatusCode> {
let a = self.get_attribute_mut(attr_id)?; 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)?; let a = self.get_attribute_mut(attr_id)?;
a.set_value(value).map(|_| { a.set_value(value).map(|_| {
self.cluster_changed(); self.cluster_changed();

View file

@ -19,7 +19,7 @@ use crate::{data_model::objects::ClusterType, error::*, interaction_model::core:
use std::fmt; use std::fmt;
use super::DeviceType; use super::{ClusterId, DeviceType};
pub const CLUSTERS_PER_ENDPT: usize = 9; pub const CLUSTERS_PER_ENDPT: usize = 9;
@ -51,18 +51,21 @@ impl Endpoint {
&self.dev_type &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) 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 let index = self
.get_cluster_index(cluster_id) .get_cluster_index(cluster_id)
.ok_or(Error::ClusterNotFound)?; .ok_or(Error::ClusterNotFound)?;
Ok(self.clusters[index].as_ref()) 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 let index = self
.get_cluster_index(cluster_id) .get_cluster_index(cluster_id)
.ok_or(Error::ClusterNotFound)?; .ok_or(Error::ClusterNotFound)?;
@ -72,7 +75,7 @@ impl Endpoint {
// Returns a slice of clusters, with either a single cluster or all (wildcard) // Returns a slice of clusters, with either a single cluster or all (wildcard)
pub fn get_wildcard_clusters( pub fn get_wildcard_clusters(
&self, &self,
cluster: Option<u32>, cluster: Option<ClusterId>,
) -> Result<(&BoxedClusters, bool), IMStatusCode> { ) -> Result<(&BoxedClusters, bool), IMStatusCode> {
if let Some(c) = cluster { if let Some(c) = cluster {
if let Some(i) = self.get_cluster_index(c) { 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) // Returns a slice of clusters, with either a single cluster or all (wildcard)
pub fn get_wildcard_clusters_mut( pub fn get_wildcard_clusters_mut(
&mut self, &mut self,
cluster: Option<u32>, cluster: Option<ClusterId>,
) -> Result<(&mut BoxedClusters, bool), IMStatusCode> { ) -> Result<(&mut BoxedClusters, bool), IMStatusCode> {
if let Some(c) = cluster { if let Some(c) = cluster {
if let Some(i) = self.get_cluster_index(c) { if let Some(i) = self.get_cluster_index(c) {

View file

@ -15,6 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
pub type EndptId = u16;
pub type ClusterId = u32;
pub type AttrId = u16;
pub type CmdId = u32;
mod attribute; mod attribute;
pub use attribute::*; pub use attribute::*;

View file

@ -23,10 +23,10 @@ use crate::{
}; };
use std::fmt; use std::fmt;
use super::DeviceType; use super::{ClusterId, DeviceType, EndptId};
pub trait ChangeConsumer { 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; pub const ENDPTS_PER_ACC: usize = 3;
@ -61,7 +61,7 @@ impl Node {
self.changes_cb = Some(consumer); 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 let index = self
.endpoints .endpoints
.iter() .iter()
@ -69,13 +69,13 @@ impl Node {
.ok_or(Error::NoSpace)?; .ok_or(Error::NoSpace)?;
let mut endpoint = Endpoint::new(dev_type)?; let mut endpoint = Endpoint::new(dev_type)?;
if let Some(cb) = &self.changes_cb { 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); 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 { if (endpoint_id as usize) < ENDPTS_PER_ACC {
let endpoint = self.endpoints[endpoint_id as usize] let endpoint = self.endpoints[endpoint_id as usize]
.as_ref() .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 { if (endpoint_id as usize) < ENDPTS_PER_ACC {
let endpoint = self.endpoints[endpoint_id as usize] let endpoint = self.endpoints[endpoint_id as usize]
.as_mut() .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) 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) self.get_endpoint(e)?.get_cluster(c)
} }
pub fn add_cluster( pub fn add_cluster(
&mut self, &mut self,
endpoint_id: u32, endpoint_id: EndptId,
cluster: Box<dyn ClusterType>, cluster: Box<dyn ClusterType>,
) -> Result<(), Error> { ) -> Result<(), Error> {
let endpoint_id = endpoint_id as usize; 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) // Returns a slice of endpoints, with either a single endpoint or all (wildcard)
pub fn get_wildcard_endpoints( pub fn get_wildcard_endpoints(
&self, &self,
endpoint: Option<u16>, endpoint: Option<EndptId>,
) -> Result<(&BoxedEndpoints, usize, bool), IMStatusCode> { ) -> Result<(&BoxedEndpoints, usize, bool), IMStatusCode> {
if let Some(e) = endpoint { if let Some(e) = endpoint {
let e = e as usize; let e = e as usize;
@ -140,7 +144,7 @@ impl Node {
pub fn get_wildcard_endpoints_mut( pub fn get_wildcard_endpoints_mut(
&mut self, &mut self,
endpoint: Option<u16>, endpoint: Option<EndptId>,
) -> Result<(&mut BoxedEndpoints, usize, bool), IMStatusCode> { ) -> Result<(&mut BoxedEndpoints, usize, bool), IMStatusCode> {
if let Some(e) = endpoint { if let Some(e) = endpoint {
let e = e as usize; let e = e as usize;
@ -171,7 +175,7 @@ impl Node {
let (endpoints, mut endpoint_id, wildcard) = self.get_wildcard_endpoints(path.endpoint)?; let (endpoints, mut endpoint_id, wildcard) = self.get_wildcard_endpoints(path.endpoint)?;
for e in endpoints.iter() { for e in endpoints.iter() {
if let Some(e) = e { if let Some(e) = e {
current_path.endpoint = Some(endpoint_id as u16); current_path.endpoint = Some(endpoint_id as EndptId);
f(&current_path, e.as_ref()) f(&current_path, e.as_ref())
.or_else(|e| if !wildcard { Err(e) } else { Ok(()) })?; .or_else(|e| if !wildcard { Err(e) } else { Ok(()) })?;
} }
@ -202,7 +206,7 @@ impl Node {
self.get_wildcard_endpoints_mut(path.endpoint)?; self.get_wildcard_endpoints_mut(path.endpoint)?;
for e in endpoints.iter_mut() { for e in endpoints.iter_mut() {
if let Some(e) = e { if let Some(e) = e {
current_path.endpoint = Some(endpoint_id as u16); current_path.endpoint = Some(endpoint_id as EndptId);
f(&current_path, e.as_mut()) f(&current_path, e.as_mut())
.or_else(|e| if !wildcard { Err(e) } else { Ok(()) })?; .or_else(|e| if !wildcard { Err(e) } else { Ok(()) })?;
} }

View file

@ -37,12 +37,12 @@ pub enum Attributes {
pub struct DescriptorCluster { pub struct DescriptorCluster {
base: Cluster, base: Cluster,
endpoint_id: u16, endpoint_id: EndptId,
data_model: DataModel, data_model: DataModel,
} }
impl DescriptorCluster { 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 { let mut c = Box::new(DescriptorCluster {
endpoint_id, endpoint_id,
data_model, data_model,

View file

@ -16,6 +16,7 @@
*/ */
use crate::{ use crate::{
data_model::objects::{ClusterId, EndptId},
error::Error, error::Error,
tlv::{FromTLV, TLVElement, TLVWriter, TagType, ToTLV}, tlv::{FromTLV, TLVElement, TLVWriter, TagType, ToTLV},
}; };
@ -25,13 +26,13 @@ use crate::{
#[derive(Default, Clone, Copy, Debug, PartialEq, FromTLV, ToTLV)] #[derive(Default, Clone, Copy, Debug, PartialEq, FromTLV, ToTLV)]
#[tlvargs(datatype = "list")] #[tlvargs(datatype = "list")]
pub struct GenericPath { pub struct GenericPath {
pub endpoint: Option<u16>, pub endpoint: Option<EndptId>,
pub cluster: Option<u32>, pub cluster: Option<ClusterId>,
pub leaf: Option<u32>, pub leaf: Option<u32>,
} }
impl GenericPath { 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 { Self {
endpoint, endpoint,
cluster, cluster,
@ -40,7 +41,7 @@ impl GenericPath {
} }
/// Returns Ok, if the path is non wildcard, otherwise returns an error /// 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 { match *self {
GenericPath { GenericPath {
endpoint: Some(e), endpoint: Some(e),
@ -257,7 +258,7 @@ pub mod ib {
use std::fmt::Debug; use std::fmt::Debug;
use crate::{ use crate::{
data_model::objects::{AttrDetails, EncodeValue}, data_model::objects::{AttrDetails, AttrId, ClusterId, EncodeValue, EndptId},
error::Error, error::Error,
interaction_model::core::IMStatusCode, interaction_model::core::IMStatusCode,
tlv::{FromTLV, Nullable, TLVElement, TLVWriter, TagType, ToTLV}, tlv::{FromTLV, Nullable, TLVElement, TLVWriter, TagType, ToTLV},
@ -275,7 +276,12 @@ pub mod ib {
} }
impl<'a> InvResp<'a> { 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( Self::Cmd(CmdData::new(
CmdPath::new(Some(endpoint), Some(cluster), Some(cmd)), CmdPath::new(Some(endpoint), Some(cluster), Some(cmd)),
data, data,
@ -448,9 +454,9 @@ pub mod ib {
pub struct AttrPath { pub struct AttrPath {
pub tag_compression: Option<bool>, pub tag_compression: Option<bool>,
pub node: Option<u64>, pub node: Option<u64>,
pub endpoint: Option<u16>, pub endpoint: Option<EndptId>,
pub cluster: Option<u32>, pub cluster: Option<ClusterId>,
pub attr: Option<u16>, pub attr: Option<AttrId>,
pub list_index: Option<Nullable<u16>>, pub list_index: Option<Nullable<u16>>,
} }
@ -490,7 +496,11 @@ pub mod ib {
} }
impl CmdPath { 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 { Self {
path: GenericPath { path: GenericPath {
endpoint, endpoint,
@ -525,8 +535,8 @@ pub mod ib {
#[derive(FromTLV, ToTLV, Copy, Clone)] #[derive(FromTLV, ToTLV, Copy, Clone)]
pub struct ClusterPath { pub struct ClusterPath {
pub node: Option<u64>, pub node: Option<u64>,
pub endpoint: u16, pub endpoint: EndptId,
pub cluster: u32, pub cluster: ClusterId,
} }
#[derive(FromTLV, ToTLV, Copy, Clone)] #[derive(FromTLV, ToTLV, Copy, Clone)]
@ -539,8 +549,8 @@ pub mod ib {
#[tlvargs(datatype = "list")] #[tlvargs(datatype = "list")]
pub struct EventPath { pub struct EventPath {
pub node: Option<u64>, pub node: Option<u64>,
pub endpoint: Option<u16>, pub endpoint: Option<EndptId>,
pub cluster: Option<u32>, pub cluster: Option<ClusterId>,
pub event: Option<u32>, pub event: Option<u32>,
pub is_urgent: Option<bool>, pub is_urgent: Option<bool>,
} }