pub trait Client<'a, T: UsbHidType> {
// Required methods
fn packet_received(
&'a self,
result: Result<(), ErrorCode>,
buffer: &'static mut T,
endpoint: usize,
);
fn packet_transmitted(
&'a self,
result: Result<(), ErrorCode>,
buffer: &'static mut T,
endpoint: usize,
);
}Expand description
Implement this trait and use set_client() in order to receive callbacks.
Required Methods§
Sourcefn packet_received(
&'a self,
result: Result<(), ErrorCode>,
buffer: &'static mut T,
endpoint: usize,
)
fn packet_received( &'a self, result: Result<(), ErrorCode>, buffer: &'static mut T, endpoint: usize, )
Called when a packet is received.
This will return the buffer passed into receive_buffer() as well as
the endpoint where the data was received. If the buffer length is smaller
then the data length the buffer will only contain part of the packet and
result will contain indicate an SIZE error. Result will indicate
CANCEL if a receive was cancelled by receive_cancel() but the
callback still occurred. See receive_cancel() for more details.
Sourcefn packet_transmitted(
&'a self,
result: Result<(), ErrorCode>,
buffer: &'static mut T,
endpoint: usize,
)
fn packet_transmitted( &'a self, result: Result<(), ErrorCode>, buffer: &'static mut T, endpoint: usize, )
Called when a packet has been finished transmitting.
This will return the buffer passed into send_buffer() as well as
the endpoint where the data was sent. If not all of the data could
be sent the result will contain the SIZE error. Result will
indicate CANCEL if a send was cancelled by send_cancel()
but the callback still occurred. See send_cancel() for more
details.