Expand description
Thread Network Diagnostics, cluster 0x0035 (Core §11.14).
The largest of the three network diagnostics clusters — sixty-five attributes — and the same
shape as the other two: every number belongs to a radio and a Thread stack this crate does
not own, so the cluster is a ThreadDriver the integrator implements. It needs no radio to
compile or to test; the openthread crate is one source for the numbers, and nothing here
depends on it.
§Three kinds of attribute, and three shapes in the trait
-
The network’s state —
Channel,RoutingRole,NetworkName, the timestamps — is mandatory and nullable. A driver returnsOption, whereNoneis the specification’snull: the Thread interface is not configured or operational. There is no third answer, because a Thread device reports these or is not a Thread device. -
The tables —
NeighborTable,RouteTable,ActiveNetworkFaultsList— are mandatory lists, and empty is a perfectly good answer. A driver returns a slice, which is also the only list shape ano_stdcrate can hand over without allocating. -
The counters are conditional on §11.14.4’s features and optional within them. They arrive as
MacCountersandMleCounters, one struct each, because that is how a Thread stack hands them over and because forty-two separate trait methods would be forty-two chances to wire one to the wrong attribute. A field leftNoneis a counter the device does not keep, and it belongs out of theOptionallist too.OverrunCountis the exception: §11.14.6 makes it mandatory withinERRCNTand does not make it nullable, so it is a plainu64a device claimingERRCNThas promised to count.
use matter_kit::clusters::thread_network_diagnostics::{
RoutingRoleEnum, ThreadDriver, ThreadNetworkDiagnostics,
};
struct Stack;
impl ThreadDriver for Stack {
fn channel(&self) -> Option<u16> { Some(15) }
fn routing_role(&self) -> Option<RoutingRoleEnum> { Some(RoutingRoleEnum::Router) }
fn network_name(&self) -> Option<&str> { Some("matter-kit") }
fn pan_id(&self) -> Option<u16> { Some(0x1234) }
fn extended_pan_id(&self) -> Option<u64> { Some(0xDEAD_BEEF_0000_0001) }
}
// No feature bits: this driver reports the network and counts nothing.
let cluster = ThreadNetworkDiagnostics::<_, 4>::new(&Stack, 0);Re-exports§
pub use spec_thread::ConnectionStatusEnum;pub use spec_thread::ID;pub use spec_thread::NeighborTableStruct;pub use spec_thread::NetworkFaultEnum;pub use spec_thread::OperationalDatasetComponents;pub use spec_thread::PICS;pub use spec_thread::REVISION;pub use spec_thread::RouteTableStruct;pub use spec_thread::RoutingRoleEnum;pub use spec_thread::SecurityPolicy;pub use spec_thread::feature;pub use spec_thread::event::CONNECTION_STATUS;pub use spec_thread::event::NETWORK_FAULT_CHANGE;
Structs§
- MacCounters
- The
MACCNTcounters of §11.14.6, as a Thread stack hands them over. - MleCounters
- The
MLECNTcounters of §11.14.6 — how often this node changed role, re-attached, or followed a better partition. - Thread
Network Diagnostics - The Thread Network Diagnostics cluster (§11.14).
- Unknown
- The driver for a device with no Thread metrics to report.
Enums§
- Event
- One of §11.14.8’s events, as the Thread stack noticed it.
Constants§
- ALL_
OPTIONAL provisional - Every attribute, command and event §11.14 leaves to the product, including §2.13’s two provisional attributes.
- COUNTERS
- Every counter §11.14.4’s
MLECNTandMACCNTfeatures bring, each of which §11.14.6 leaves optional within its feature.
Traits§
- Thread
Driver - What a device’s Thread stack can report (§11.14.6).
Functions§
- conforming
- Builds a descriptor for a feature map and the optional elements a product implements.