use std::sync::Arc;
use hidpp::channel::HidppChannel;
use route::DeviceRoute;
pub(crate) mod pool;
pub(crate) mod registry;
pub(crate) mod route;
#[cfg(test)]
pub(crate) mod scripted;
pub(crate) mod transport;
pub use pool::ChannelPool;
pub use registry::ChannelRegistry;
#[derive(Clone)]
pub struct SharedChannel {
channel: Arc<HidppChannel>,
route: DeviceRoute,
}
impl SharedChannel {
#[must_use]
pub(crate) fn new(channel: Arc<HidppChannel>, route: DeviceRoute) -> Self {
Self { channel, route }
}
#[must_use]
pub fn matches(&self, route: &DeviceRoute) -> bool {
self.route == *route
}
pub(crate) fn channel(&self) -> &Arc<HidppChannel> {
&self.channel
}
pub(crate) fn device_index(&self) -> u8 {
self.route.device_index()
}
}