embassy-usb

Crates

git

Versions

default

Flavors

AudioSourceControlHandler

Struct AudioSourceControlHandler 

Source
pub struct AudioSourceControlHandler { /* private fields */ }
Expand description

Implementation of the logic for Audio Control requests (e.g., volume, mute)

Implementations§

Source§

impl AudioSourceControlHandler

Source

pub fn new( sample_rates: &'static [u32], ep_audio_addr: EndpointAddress, ep_feedback_addr: EndpointAddress, iface_ctrl_num: InterfaceNumber, iface_stream_num: InterfaceNumber, ) -> Self

Create a new AudioSourceControlHandler

Source

pub fn get_audio_ep_addr(&self) -> u8

Gets the audio endpoint address

Source

pub fn get_feedback_ep_addr(&self) -> u8

Gets the feedback endpoint address

Source

pub fn get_audio_ep_index(&self) -> usize

Gets the index part of the audio endpoint address

Source

pub fn get_feedback_ep_index(&self) -> usize

Gets the index part of the feedback endpoint address

Source

pub fn get_ctrl_iface_num(&self) -> u8

Gets the bInterfaceNumber of the control interface

Source

pub fn get_stream_iface_num(&self) -> u8

Gets the bInterfaceNumber of the streaming interface

Trait Implementations§

Source§

impl<'d> Handler for AudioSourceControlHandler

Source§

fn addressed(&mut self, addr: u8)

Called when the host has set the address of the device to addr.

Source§

fn configured(&mut self, configured: bool)

Called when the host has enabled or disabled the configuration of the device.

Source§

fn remote_wakeup_enabled(&mut self, enabled: bool)

Called when remote wakeup feature is enabled or disabled.

Source§

fn set_alternate_setting( &mut self, iface: InterfaceNumber, alternate_setting: u8, )

Called when a “set alternate setting” control request is done on the interface.

Source§

fn reset(&mut self)

Called after a USB reset after the bus reset sequence is complete.

Source§

fn suspended(&mut self, suspended: bool)

Called when the bus has entered or exited the suspend state.

Source§

fn control_out(&mut self, req: Request, buf: &[u8]) -> Option<OutResponse>

Called when a control request is received with direction HostToDevice.

Source§

fn control_in<'a>( &'a mut self, req: Request, buf: &'a mut [u8], ) -> Option<InResponse<'a>>

Called when a control request is received with direction DeviceToHost.

Source§

fn enabled(&mut self, _enabled: bool)

Called when the USB device has been enabled or disabled.
Source§

fn get_string(&mut self, index: StringIndex, lang_id: u16) -> Option<&str>

Called when a GET_DESCRIPTOR STRING control request is received.
Source§

fn get_descriptor_requested( &mut self, _descriptor_type: u8, _index: u8, _wlength: u16, )

Called when a GET_DESCRIPTOR control request is received, before the descriptor is sent. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.