UsbCanSocket

Struct UsbCanSocket 

Source
pub struct UsbCanSocket { /* private fields */ }

Implementations§

Source§

impl UsbCanSocket

Source

pub fn open(bus: UsbBus, baud: Baudrate) -> Result<UsbCanSocket, CanError>

Opens a CAN socket with a standard baudrate.

§Arguments
  • bus - USB bus channel (USB1-USB16)
  • baud - Standard baudrate (e.g., Baud125K, Baud500K)
§Examples
let socket = UsbCanSocket::open(UsbBus::USB1, Baudrate::Baud500K)?;
Source

pub fn open_with_usb_bus(bus: UsbBus) -> UsbCanSocket

Source

pub fn open_with_timing( bus: UsbBus, timing: &CanBitTiming, ) -> Result<UsbCanSocket, CanError>

Opens a CAN socket with custom bit timing.

Use CAN_TIMING_BOUNDARIES for valid ranges.

§Examples
let timing = CanBitTiming::new(8, 1, 13, 2)?;  // 500 kbit/s
let socket = UsbCanSocket::open_with_timing(UsbBus::USB1, &timing)?;
Source

pub fn open_fd_with_timing( bus: UsbBus, timing: &CanFdBitTiming, ) -> Result<UsbCanSocket, CanError>

Opens a CAN FD socket with custom timing for nominal and data phases.

§Examples
let timing = CanFdBitTiming::new(
    10, 4, 13, 2,  // Nominal phase
    5, 2, 6, 1     // Data phase
)?;
let socket = UsbCanSocket::open_fd_with_timing(UsbBus::USB1, &timing)?;

Trait Implementations§

Source§

impl Debug for UsbCanSocket

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for UsbCanSocket

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PartialEq for UsbCanSocket

Source§

fn eq(&self, other: &UsbCanSocket) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for UsbCanSocket

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AcceptanceFilter11Bit for T
where T: HasAcceptanceFilter11Bit + Channel,

Source§

impl<T> AcceptanceFilter29Bit for T
where T: HasAcceptanceFilter29Bit + Channel,

Source§

impl<T> AllowEchoFrames for T
where T: HasAllowEchoFrames + Channel,

Source§

impl<T> AllowErrorFrames for T
where T: HasAllowErrorFrames + Channel,

Source§

impl<T> AllowRTRFrames for T
where T: HasAllowRTRFrames + Channel,

Source§

impl<T> AllowStatusFrames for T
where T: HasAllowStatusFrames + Channel,

Source§

impl<T> AnalogValue for T
where T: HasAnalogValue + Channel,

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> BitrateInfo for T
where T: HasBitrateInfo + Channel,

§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> BusOffAutoreset for T
where T: HasBusOffAutoreset + Channel,

Source§

impl<T> ChannelFeatures for T
where T: HasChannelFeatures + Channel,

Source§

impl<T> ChannelIdentifying for T
where T: HasChannelIdentifying + Channel,

Source§

impl<T> ChannelVersion for T
where T: HasChannelVersion + Channel,

Source§

impl<T> ControllerNumber for T
where T: HasControllerNumber + Channel,

Source§

impl<T> DataBusSpeed for T
where T: HasDataBusSpeed + Channel,

Source§

impl<T> DeviceId for T
where T: HasDeviceId + Channel,

Source§

impl<T> DevicePartNumber for T
where T: HasDevicePartNumber + Channel,

Source§

impl<T> DigitalConfiguration for T
where T: HasDigitalConfiguration + Channel,

Source§

impl<T> DigitalValue for T
where T: HasSetDigitalValue + Channel,

Source§

impl<T> FirmwareVersion for T
where T: HasFirmwareVersion + Channel,

Source§

impl<T> FiveVoltsPower for T
where T: HasFiveVoltsPower + Channel,

§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HardwareName for T
where T: HasHardwareName + Channel,

Source§

impl<T> InterframeDelay for T
where T: HasInterframeDelay + Channel,

§

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

§

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> ListenOnly for T
where T: HasListenOnly + Channel,

Source§

impl<T> MessageFilter for T
where T: HasMessageFilter + Channel,

Source§

impl<T> NominalBusSpeed for T
where T: HasNominalBusSpeed + Channel,

Source§

impl<T> ReceiveStatus for T
where T: HasReceiveStatus + Channel,

Source§

impl<T> RecvCan for T
where T: HasRecvCan + Socket,

Source§

impl<T> RecvCanFd for T
where T: HasRecvCanFd + Socket,

Source§

impl<T> SendCan for T
where T: HasSendCan + Socket,

Source§

fn send(&self, frame: CanFrame) -> Result<(), CanError>

Source§

impl<T> SendCanFd for T
where T: HasSendCanFd + Socket,

Source§

impl<T> SetAcceptanceFilter11Bit for T
where T: HasSetAcceptanceFilter11Bit + Channel,

Source§

impl<T> SetAcceptanceFilter29Bit for T
where T: HasSetAcceptanceFilter29Bit + Channel,

Source§

impl<T> SetAllowEchoFrames for T
where T: HasSetAllowEchoFrames + Channel,

Source§

impl<T> SetAllowErrorFrames for T
where T: HasSetAllowErrorFrames + Channel,

Source§

impl<T> SetAllowRTRFrames for T
where T: HasSetAllowRTRFrames + Channel,

Source§

impl<T> SetAllowStatusFrames for T
where T: HasSetAllowStatusFrames + Channel,

Source§

impl<T> SetBusOffAutoreset for T
where T: HasSetBusOffAutoreset + Channel,

Source§

impl<T> SetControllerNumber for T
where T: HasSetControllerNumber + Channel,

Source§

impl<T> SetDeviceId for T
where T: HasSetDeviceId + Channel,

Source§

impl<T> SetDigitalClear for T
where T: HasSetDigitalClear + Channel,

Source§

impl<T> SetDigitalConfiguration for T
where T: HasSetDigitalConfiguration + Channel,

Source§

impl<T> SetDigitalSet for T
where T: HasSetDigitalSet + Channel,

Source§

fn digital_set(&self, mask: u32) -> Result<(), CanError>

Source§

impl<T> SetDigitalValue for T
where T: HasSetDigitalValue + Channel,

Source§

fn set_digital_value(&self, pin: u8, value: IOValue) -> Result<(), CanError>

Source§

fn set_digital_value_word(&self, value_word: u32) -> Result<(), CanError>

Source§

impl<T> SetFiveVoltsPower for T
where T: HasSetFiveVoltsPower + Channel,

Source§

impl<T> SetInterframeDelay for T
where T: HasSetInterframeDelay + Channel,

Source§

impl<T> SetListenOnly for T
where T: HasSetListenOnly + Channel,

Source§

impl<T> SetMessageFilter for T
where T: HasSetMessageFilter + Channel,

Source§

impl<T> SetReceiveStatus for T
where T: HasSetReceiveStatus + Channel,

Source§

fn set_receiving(&self, status: bool) -> Result<(), CanError>

Source§

impl<T> SetTraceConfigure for T
where T: HasSetTraceConfigure + Channel,

Source§

impl<T> SetTraceLocation for T
where T: HasSetTraceLocation + Channel,

Source§

fn set_trace_location<P>(&self, path: P) -> Result<(), CanError>
where P: AsRef<Path>,

Source§

impl<T> SetTraceSize for T
where T: HasSetTraceSize + Channel,

Source§

fn set_trace_size(&self, size_mb: u8) -> Result<(), CanError>

Source§

impl<T> SetTraceStatus for T
where T: HasSetTraceStatus + Channel,

Source§

fn set_tracing(&self, enable: bool) -> Result<(), CanError>

Source§

impl<T> TraceConfigure for T
where T: HasTraceConfigure + Channel,

Source§

impl<T> TraceLocation for T
where T: HasTraceLocation + Channel,

Source§

impl<T> TraceSize for T
where T: HasTraceSize + Channel,

Source§

impl<T> TraceStatus for T
where T: HasTraceStatus + Channel,

§

impl<T, U> TryFrom<U> for T
where 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>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.