[−][src]Struct tokio_socketcan_bcm::BCMSocket
A socket for a CAN device, specifically for broadcast manager operations.
Fields
fd: c_int
Implementations
impl BCMSocket
[src]
pub fn open_nb(ifname: &str) -> Result<BCMSocket>
[src]
Open a named CAN device non blocking.
Usually the more common case, opens a socket can device by name, such as "vcan0" or "socan0".
pub fn open_if_nb(if_index: c_uint) -> Result<BCMSocket>
[src]
Open CAN device by interface number non blocking.
Opens a CAN device by kernel interface number.
pub fn filter_id(
&self,
can_id: CANMessageId,
ival1: Duration,
ival2: Duration
) -> Result<()>
[src]
&self,
can_id: CANMessageId,
ival1: Duration,
ival2: Duration
) -> Result<()>
Create a content filter subscription, filtering can frames by can_id.
pub fn filter_id_incoming_frames(
self,
can_id: CANMessageId,
ival1: Duration,
ival2: Duration
) -> Result<BcmFrameStream>
[src]
self,
can_id: CANMessageId,
ival1: Duration,
ival2: Duration
) -> Result<BcmFrameStream>
Combination of BCMSocket::filter_id
and BCMSocket::incoming_frames
.
use std::time; use tokio_socketcan_bcm::*; use futures_util::stream::StreamExt; #[tokio::main] async fn main() { let socket = BCMSocket::open_nb("vcan0").unwrap(); let ival = time::Duration::from_millis(0); // create a stream of messages that filters by the can frame id 0x123 let mut can_frame_stream = socket .filter_id_incoming_frames(0x123.into(), ival, ival) .unwrap(); while let Some(frame) = can_frame_stream.next().await { println!("Frame {:?}", frame); () } }
pub fn incoming_msg(self) -> Result<BcmStream>
[src]
Stream of incoming BcmMsgHeads that apply to the filter criteria.
use std::time; use tokio_socketcan_bcm::*; use futures_util::stream::StreamExt; #[tokio::main] async fn main() { let socket = BCMSocket::open_nb("vcan0").unwrap(); let ival = time::Duration::from_millis(0); // create a stream of messages that filters by the can frame id 0x123 let mut can_frame_stream = socket .incoming_msg() .unwrap(); while let Some(frame) = can_frame_stream.next().await { println!("Frame {:?}", frame); () } }
pub fn incoming_frames(self) -> Result<BcmFrameStream>
[src]
Stream of incoming frames that apply to the filter criteria.
use std::time; use tokio_socketcan_bcm::*; use futures_util::stream::StreamExt; #[tokio::main] async fn main() { let socket = BCMSocket::open_nb("vcan0").unwrap(); let ival = time::Duration::from_millis(0); // create a stream of messages that filters by the can frame id 0x123 let mut can_frame_stream = socket .incoming_frames() .unwrap(); while let Some(frame) = can_frame_stream.next().await { println!("Frame {:?}", frame); () } }
pub fn filter_delete(&self, can_id: CANMessageId) -> Result<()>
[src]
Remove a content filter subscription.
pub fn read_msg(&self) -> Result<BcmMsgHead>
[src]
Read a single bcm message.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for BCMSocket
impl Send for BCMSocket
impl Sync for BCMSocket
impl Unpin for BCMSocket
impl UnwindSafe for BCMSocket
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>,
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>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,