pub struct Descriptor<'a> {
pub node: Node<'a>,
pub endpoint: EndpointId,
pub parts: &'a [EndpointId],
pub tags: &'a [SemanticTag<'a>],
pub unique_id: Option<&'a str>,
}Expand description
The Descriptor cluster on one endpoint.
Borrows the Node rather than copying anything out of it: ServerList and ClientList
are views of the endpoint’s own cluster set, and the whole point is that they cannot
disagree with it.
One instance per endpoint, because §9.5 is scoped to an endpoint — Descriptor::endpoint
is the endpoint it answers for, and a read of any other endpoint’s Descriptor is a
different instance.
Fields§
§node: Node<'a>The node this endpoint belongs to — the source of ServerList.
endpoint: EndpointIdThe endpoint this instance is on.
parts: &'a [EndpointId]PartsList (§9.5.6.4) — the endpoints this one is composed of.
TagList (§9.5.6.5), when the instance declares TAGLIST.
unique_id: Option<&'a str>EndpointUniqueID (§9.5.6.6), when the instance serves it.
Implementations§
Source§impl<'a> Descriptor<'a>
impl<'a> Descriptor<'a>
Sourcepub const fn new(node: Node<'a>, endpoint: EndpointId) -> Self
pub const fn new(node: Node<'a>, endpoint: EndpointId) -> Self
A Descriptor for an endpoint, with nothing composed under it.
DeviceTypeList is not a parameter: §9.5.6.1’s list is the endpoint’s own, and it is
read from the node. Passing it separately would let a Descriptor publish device types
that the endpoint it names does not have — and §6.6.6.2’s access control matches ACL
targets against the endpoint’s, so the two disagreeing is a privilege decision made on
one list and reported from another.
Sourcepub fn device_types(&self) -> &'a [DeviceType]
pub fn device_types(&self) -> &'a [DeviceType]
The device types of the endpoint this instance answers for (§9.5.6.1).
Sourcepub fn clients(&self) -> &'a [ClusterId]
pub fn clients(&self) -> &'a [ClusterId]
The clusters the endpoint speaks as a client (§9.5.6.3).
Read from the node for the same reason DeviceTypeList is: a Descriptor that carried
its own copy could publish a ClientList the endpoint it names does not have, and
§9.2’s device-type check reads the endpoint’s.
Sourcepub const fn with_parts(self, parts: &'a [EndpointId]) -> Self
pub const fn with_parts(self, parts: &'a [EndpointId]) -> Self
The same instance with a PartsList.
The same instance with a TagList — requires the TAGLIST feature.
Sourcepub const fn with_unique_id(self, unique_id: &'a str) -> Self
pub const fn with_unique_id(self, unique_id: &'a str) -> Self
The same instance with an EndpointUniqueID.
Sourcepub fn descriptor(&self) -> ClusterDescriptor<'static>
pub fn descriptor(&self) -> ClusterDescriptor<'static>
The cluster descriptor matching what this instance serves.
TagList and EndpointUniqueID are in the list exactly when this instance has them,
because §7.13.3’s AttributeList is what a commissioner builds its model from — an
entry for an attribute that answers UNSUPPORTED_ATTRIBUTE is a certification
failure, and so is a served attribute missing from the list.
Trait Implementations§
Source§impl<'a> Clone for Descriptor<'a>
impl<'a> Clone for Descriptor<'a>
Source§impl Cluster for Descriptor<'_>
impl Cluster for Descriptor<'_>
Source§impl ClusterHandler for Descriptor<'_>
impl ClusterHandler for Descriptor<'_>
Source§fn read(
&self,
resolved: &Resolved<'_>,
_ctx: &InteractionContext<'_>,
w: &mut TlvWriter<'_>,
tag: Tag,
) -> Result<(), Status>
fn read( &self, resolved: &Resolved<'_>, _ctx: &InteractionContext<'_>, w: &mut TlvWriter<'_>, tag: Tag, ) -> Result<(), Status>
Source§fn data_version(&self, _resolved: &Resolved<'_>) -> Option<u32>
fn data_version(&self, _resolved: &Resolved<'_>) -> Option<u32>
Source§fn write(
&self,
_resolved: &Resolved<'_>,
_data: &[u8],
_op: WriteOp,
_ctx: &InteractionContext<'_>,
) -> Result<(), Status>
fn write( &self, _resolved: &Resolved<'_>, _data: &[u8], _op: WriteOp, _ctx: &InteractionContext<'_>, ) -> Result<(), Status>
data — the encoded TLV element, tag included — into the attribute. Read more