use std::path::PathBuf;
use modem_device::{Capabilities, DeviceEvent, LaneKey, Metrics, Report};
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct LaneView {
pub key: LaneKey,
pub path: PathBuf,
pub connected: bool,
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct SchedulerCounters {
pub submitted: u64,
pub sent: u64,
pub dropped: u64,
pub stale: u64,
pub peerless: u64,
pub tx_failed: u64,
pub unroutable: u64,
pub rx_oversize: u64,
pub tx_oversize: u64,
}
impl SchedulerCounters {
#[must_use]
pub fn queue_depth(&self) -> u64 {
self.submitted.saturating_sub(self.sent)
}
}
#[async_trait::async_trait]
pub trait SduPlane: Send + Sync {
fn device(&self) -> &str;
fn capabilities(&self) -> Capabilities;
fn lanes(&self) -> Vec<LaneView>;
fn scheduler(&self) -> SchedulerCounters;
fn medium_metrics(&self) -> Metrics;
fn report(&self) -> Report;
fn health(&self) -> tokio::sync::watch::Receiver<bool>;
fn oper(&self) -> modem_device::OperStatus;
fn identity(&self) -> modem_device::Identity;
fn configuration(&self) -> Option<&dyn modem_device::Configure>;
fn actions(&self) -> Option<&dyn modem_device::Actions>;
fn events(&self) -> tokio::sync::broadcast::Receiver<DeviceEvent>;
async fn shutdown(&self);
}