Skip to content

Commit

Permalink
remove blocking command support
Browse files Browse the repository at this point in the history
  • Loading branch information
lulf committed May 6, 2024
1 parent acb9cac commit 02c6ab2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
16 changes: 1 addition & 15 deletions src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use core::future::Future;

use crate::controller::{blocking, CmdError, ControllerCmdAsync, ControllerCmdSync, ErrorType};
use crate::controller::{CmdError, ControllerCmdAsync, ControllerCmdSync, ErrorType};
use crate::param::param;
use crate::{FixedSizeValue, FromHciBytes, HostToControllerPacket, PacketKind, WriteHci};

Expand Down Expand Up @@ -103,13 +103,6 @@ pub trait AsyncCmd: Cmd {
) -> impl Future<Output = Result<(), CmdError<<C as ErrorType>::Error>>> {
controller.exec(self)
}

fn exec_blocking<C: blocking::ControllerCmdAsync<Self>>(
&self,
controller: &C,
) -> Result<(), blocking::TryError<CmdError<<C as ErrorType>::Error>>> {
controller.exec(self)
}
}

pub trait CmdReturnBuf: Copy + AsRef<[u8]> + AsMut<[u8]> {
Expand Down Expand Up @@ -153,13 +146,6 @@ pub trait SyncCmd: Cmd {
) -> impl Future<Output = Result<Self::Return, CmdError<<C as ErrorType>::Error>>> {
controller.exec(self)
}

fn exec_blocking<C: blocking::ControllerCmdSync<Self>>(
&self,
controller: &C,
) -> Result<Self::Return, blocking::TryError<CmdError<<C as ErrorType>::Error>>> {
controller.exec(self)
}
}

#[macro_export]
Expand Down
14 changes: 1 addition & 13 deletions src/controller/blocking.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use crate::{
cmd,
controller::{CmdError, ErrorType},
data, ControllerToHostPacket,
};
use crate::{controller::ErrorType, data, ControllerToHostPacket};

pub trait Controller: ErrorType {
fn write_acl_data(&self, packet: &data::AclPacket) -> Result<(), Self::Error>;
Expand All @@ -23,11 +19,3 @@ pub enum TryError<E> {
Error(E),
Busy,
}

pub trait ControllerCmdSync<C: cmd::SyncCmd + ?Sized>: Controller {
fn exec(&self, cmd: &C) -> Result<C::Return, TryError<CmdError<Self::Error>>>;
}

pub trait ControllerCmdAsync<C: cmd::AsyncCmd + ?Sized>: Controller {
fn exec(&self, cmd: &C) -> Result<(), TryError<CmdError<Self::Error>>>;
}

0 comments on commit 02c6ab2

Please sign in to comment.