use crate::dm::{Cluster, Dataver, InvokeContext};
use crate::error::{Error, ErrorCode};
use crate::with;
pub use crate::dm::clusters::decl::ethernet_network_diagnostics::*;
#[derive(Debug, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct EthDiagHandler {
dataver: Dataver,
}
impl EthDiagHandler {
pub const fn new(dataver: Dataver) -> Self {
Self { dataver }
}
pub const fn adapt(self) -> HandlerAdaptor<Self> {
HandlerAdaptor(self)
}
}
impl ClusterHandler for EthDiagHandler {
const CLUSTER: Cluster<'static> = FULL_CLUSTER.with_attrs(with!(required)).with_cmds(with!());
fn dataver(&self) -> u32 {
self.dataver.get()
}
fn dataver_changed(&self) {
self.dataver.changed();
}
fn handle_reset_counts(&self, _ctx: impl InvokeContext) -> Result<(), Error> {
Err(ErrorCode::CommandNotFound.into())
}
}