From 7441792f600c5bf1c75db83eb25f87328cd1b682 Mon Sep 17 00:00:00 2001 From: Mitchell Matsumori-Kelly <65527685+mtmk-ee@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:49:09 -1000 Subject: [PATCH] WIP: control module --- src/control.rs | 40 ++++++++++++++++++++++++++++++++++++++++ src/lib.rs | 1 + 2 files changed, 41 insertions(+) create mode 100644 src/control.rs diff --git a/src/control.rs b/src/control.rs new file mode 100644 index 0000000..336a835 --- /dev/null +++ b/src/control.rs @@ -0,0 +1,40 @@ +use crate::{ffi, Result}; + +type PhantomLifetime<'a> = &'a (); + +pub enum ControlRequest { + GetStatus, + ClearFeature, + SetFeature, + SetAddress, + GetDescriptor, + SetDescriptor, + GetConfiguration, + SetConfiguration, +} + +struct ControlTransfer<'a> { + handle: ffi::HANDLE, + _lifetime: PhantomLifetime<'a>, +} + +impl ControlTransfer<'_> { + pub fn status(&self) -> Result {} + + pub fn clear_feature(&self) -> Result<()> {} +} + +pub struct DeviceStatus { + self_powered: bool, + remote_wakeup: bool, +} + +impl DeviceStatus { + pub fn self_powered(&self) -> bool { + self.self_powered + } + + pub fn remote_wakeup(&self) -> bool { + self.remote_wakeup + } +} diff --git a/src/lib.rs b/src/lib.rs index 469d7c2..e97942d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -53,6 +53,7 @@ #[cfg(feature = "config")] pub mod configuration; +mod control; pub mod descriptor; mod device; mod error;