Skip to main content

CommunicationManager

Struct CommunicationManager 

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

Communication manager that handles different connection types

Implementations§

Source§

impl CommunicationManager

Source

pub fn new(connection_type: DeviceConnectionType) -> Self

Source

pub fn set_retries_and_timeout( &mut self, send_retries: u32, read_retries: u32, timeout: Duration, )

Source

pub fn get_next_request_id(&mut self) -> u8

Get the next request ID for manual packet construction

Source

pub fn prepare_request_with_data( &mut self, request_type: u8, param1: u8, param2: u8, param3: u8, param4: u8, data: Option<&[u8]>, ) -> [u8; 68]

Prepare a request with optional data payload

Source

pub fn validate_response( &self, response: &[u8], expected_request_id: u8, ) -> Result<()>

Validate response packet

Source

pub fn send_usb_request<T: UsbHidInterface + ?Sized>( &mut self, interface: &mut T, request_type: u8, param1: u8, param2: u8, param3: u8, param4: u8, ) -> Result<[u8; 68]>

Send request via USB HID interface

Source

pub fn send_network_request<T: NetworkInterface + ?Sized>( &mut self, interface: &mut T, request_type: u8, param1: u8, param2: u8, param3: u8, param4: u8, ) -> Result<[u8; 68]>

Send request via network interface

Source

pub fn send_request_no_response<T: UsbHidInterface + ?Sized>( &mut self, interface: &mut T, request_type: u8, param1: u8, param2: u8, param3: u8, param4: u8, ) -> Result<()>

Send request without expecting a response

Source

pub fn send_multipart_request<T: UsbHidInterface + ?Sized>( &mut self, interface: &mut T, request_type: u8, data: &[u8], ) -> Result<[u8; 68]>

Send multi-part request for large data transfers

Source

pub fn send_usb_request_raw<T: UsbHidInterface + ?Sized>( &mut self, interface: &mut T, request: &[u8; 68], ) -> Result<[u8; 68]>

Send raw request via USB HID interface (for requests with data payloads)

Source

pub fn send_network_request_raw<T: NetworkInterface + ?Sized>( &mut self, interface: &mut T, request: &[u8; 68], ) -> Result<[u8; 68]>

Send raw request via network interface (for requests with data payloads)

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.