pub struct CommunicationManager { /* private fields */ }Expand description
Communication manager that handles different connection types
Implementations§
Source§impl CommunicationManager
impl CommunicationManager
pub fn new(connection_type: DeviceConnectionType) -> Self
pub fn set_retries_and_timeout( &mut self, send_retries: u32, read_retries: u32, timeout: Duration, )
Sourcepub fn get_next_request_id(&mut self) -> u8
pub fn get_next_request_id(&mut self) -> u8
Get the next request ID for manual packet construction
Sourcepub fn prepare_request_with_data(
&mut self,
request_type: u8,
param1: u8,
param2: u8,
param3: u8,
param4: u8,
data: Option<&[u8]>,
) -> [u8; 68]
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
Sourcepub fn validate_response(
&self,
response: &[u8],
expected_request_id: u8,
) -> Result<()>
pub fn validate_response( &self, response: &[u8], expected_request_id: u8, ) -> Result<()>
Validate response packet
Sourcepub 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]>
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
Sourcepub 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]>
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
Sourcepub 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<()>
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
Sourcepub fn send_multipart_request<T: UsbHidInterface + ?Sized>(
&mut self,
interface: &mut T,
request_type: u8,
data: &[u8],
) -> Result<[u8; 68]>
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
Sourcepub fn send_usb_request_raw<T: UsbHidInterface + ?Sized>(
&mut self,
interface: &mut T,
request: &[u8; 68],
) -> Result<[u8; 68]>
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)
Sourcepub fn send_network_request_raw<T: NetworkInterface + ?Sized>(
&mut self,
interface: &mut T,
request: &[u8; 68],
) -> Result<[u8; 68]>
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§
impl Freeze for CommunicationManager
impl RefUnwindSafe for CommunicationManager
impl Send for CommunicationManager
impl Sync for CommunicationManager
impl Unpin for CommunicationManager
impl UnsafeUnpin for CommunicationManager
impl UnwindSafe for CommunicationManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more