[−][src]Crate tokio_socketcan_bcm
The Broadcast Manager protocol provides a command based configuration interface to filter and send (e.g. cyclic) CAN messages in kernel space. Filtering messages in kernel space may significantly reduce the load in an application.
A BCM socket is not intended for sending individual CAN frames. To send invidiual frames use the tokio-socketcan crate.
Example
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); () } }
Structs
BCMSocket | A socket for a CAN device, specifically for broadcast manager operations. |
BcmFrameStream | |
BcmMsgHead | BcmMsgHead |
BcmMsgHeadFrameLess | BcmMsgHeadFrameLess |
BcmStream | |
CANAddr | |
CANFrame | CANFrame |
FrameFlags | |
TxMsg |
Enums
CANMessageId | 11-bit or 29-bit identifier of can frame. |
ConstructionError | Error that occurs when creating CAN packets |
Constants
AF_CAN | defined in socket.h |
CAN_BCM | |
CAN_FD_FRAME | |
MAX_NFRAMES | |
PF_CAN | defined in socket.h |
RX_ANNOUNCE_RESUM | refers also to the time-out supervision of the management RX_SETUP. By setting this flag, when an RX-outs occours, a RX_CHANGED will be generated when the (cyclic) receive restarts. This will happen even if the user data have not changed. |
RX_CHANGED | sent if the first or a revised CAN message was received |
RX_CHECK_DLC | A change of the DLC leads to an RX_CHANGED. |
RX_DELETE | remove RX content filter subscription |
RX_FILTER_ID | Filter by can_id alone, no frames required (nframes=0) |
RX_NO_AUTOTIMER | If the timer ival1 in the RX_SETUP has been set equal to zero, on receipt of the CAN message the timer for the timeout monitoring is automatically started. Setting this flag prevents the automatic start timer. |
RX_READ | read properties of RX content filter subscription |
RX_RTR_FRAME | the filter passed is used as CAN message to be sent when receiving an RTR frame. |
RX_SETUP | create RX content filter subscription |
RX_STATUS | reply to RX_READ request |
RX_TIMEOUT | cyclic message is absent |
SETTIMER | Flags |
SOCK_DGRAM | datagram (connection less) socket |
STARTTIMER | start the timer with the actual value of ival1, ival2 and count. Starting the timer leads simultaneously to emit a can_frame. |
TX_ANNOUNCE | A change of data by the process is emitted immediatly. (Requirement of 'Changing Now' - BAES) |
TX_COUNTEVT | create the message TX_EXPIRED when count expires |
TX_CP_CAN_ID | Copies the can_id from the message header to each subsequent frame in frames. This is intended only as usage simplification. |
TX_DELETE | remove (cyclic) transmission task |
TX_EXPIRED | notification on performed transmissions (count=0) |
TX_READ | read properties of (cyclic) transmission task |
TX_RESET_MULTI_ID | forces a reset of the index counter from the update to be sent by multiplex message even if it would not be necessary because of the length. |
TX_SEND | send one CAN frame |
TX_SETUP | OpCodes |
TX_STATUS | reply to TX_READ request |
Traits
IntoBcmStream |