pub trait SyncCmd: Cmd {
type Return: for<'a> FromHciBytes<'a> + Copy;
type Handle: FixedSizeValue;
type ReturnBuf: CmdReturnBuf;
// Required methods
fn param_handle(&self) -> Self::Handle;
fn return_handle(_data: &[u8]) -> Result<Self::Handle, FromHciBytesError>;
// Provided method
fn exec<C: ControllerCmdSync<Self>>(
&self,
controller: &C,
) -> impl Future<Output = Result<Self::Return, Error<<C as ErrorType>::Error>>> { ... }
}
Expand description
A trait for objects representing HCI Commands that generate CommandComplete
events
Required Associated Types§
Sourcetype Return: for<'a> FromHciBytes<'a> + Copy
type Return: for<'a> FromHciBytes<'a> + Copy
The type of the parameters for the CommandComplete
event
Sourcetype Handle: FixedSizeValue
type Handle: FixedSizeValue
Handle returned by this command.
Sourcetype ReturnBuf: CmdReturnBuf
type ReturnBuf: CmdReturnBuf
Return buffer used by this command.
Required Methods§
Sourcefn param_handle(&self) -> Self::Handle
fn param_handle(&self) -> Self::Handle
Handle parameter for this command.
Sourcefn return_handle(_data: &[u8]) -> Result<Self::Handle, FromHciBytesError>
fn return_handle(_data: &[u8]) -> Result<Self::Handle, FromHciBytesError>
Extracts the Self::Handle
from the return parameters for commands that return a handle.
If the command takes a handle or BdAddr and returns it as the first parameter of the associated
CommandComplete
event, this method will extract that handle from the return
parameters. This is needed to identify which command the CommandComplete
event was for in the event that the
status of the command was an error.
See Bluetooth Core Specification Vol 4, Part E, §4.5
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.