[−][src]Struct cantact::Interface
Interface for interacting with CANtact devices
Implementations
impl Interface[src]
pub fn new() -> Result<Interface, Error>[src]
Creates a new interface. This always selects the first device found by libusb. If no device is found, Error::DeviceNotFound is returned.
pub fn start(
&mut self,
rx_callback: impl FnMut(Frame) + Sync + Send + 'static
) -> Result<(), Error>[src]
&mut self,
rx_callback: impl FnMut(Frame) + Sync + Send + 'static
) -> Result<(), Error>
Start CAN communication on all configured channels.
After starting the device, Interface.send can be used to send frames.
For every received frame, the rx_callback closure will be called.
pub fn stop(&mut self) -> Result<(), Error>[src]
Stop CAN communication on all channels.
pub fn set_bitrate(&mut self, channel: usize, bitrate: u32) -> Result<(), Error>[src]
Set bitrate for specified channel to requested bitrate value in bits per second.
pub fn set_monitor(
&mut self,
channel: usize,
enabled: bool
) -> Result<(), Error>[src]
&mut self,
channel: usize,
enabled: bool
) -> Result<(), Error>
Enable or disable a channel's listen only mode. When this mode is enabled, the device will not transmit any frames, errors, or acknowledgements.
pub fn set_enabled(
&mut self,
channel: usize,
enabled: bool
) -> Result<(), Error>[src]
&mut self,
channel: usize,
enabled: bool
) -> Result<(), Error>
Enable or disable a channel's listen only mode. When this mode is enabled, the device will not transmit any frames, errors, or acknowledgements.
pub fn set_loopback(
&mut self,
channel: usize,
enabled: bool
) -> Result<(), Error>[src]
&mut self,
channel: usize,
enabled: bool
) -> Result<(), Error>
Enable or disable a channel's loopback mode. When this mode is enabled, frames sent by the device will be received by the device as if they had been sent by another node on the bus.
This mode is primarily intended for device testing!
pub fn send(&mut self, f: Frame) -> Result<(), Error>[src]
Send a CAN frame using the device
pub fn channels(&self) -> usize[src]
Returns the number of channels this Interface has
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Interface
impl !Send for Interface
impl !Sync for Interface
impl Unpin for Interface
impl UnwindSafe for Interface
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,