candid_server 0.3.1

A server for reading and relaying messages on a CAN bus
Documentation
use socketcan::{CanFrame, CanSocket, EmbeddedFrame, ExtendedId, Socket};
use std::thread;
use std::time::Duration;

fn main() {
    // Open a write socket
    let write_socket = CanSocket::open("vcan0").unwrap();
    write_socket.set_write_timeout(Duration::new(5, 0)).unwrap();

    for i in 1..10 {
        let id = ExtendedId::new(i + 0x123).unwrap();

        let data: u64 = rand::random();
        let data = data.to_ne_bytes();

        write_socket
            .write_frame(&CanFrame::new(id, &data).unwrap())
            .unwrap();

        thread::sleep(Duration::from_millis(100));
    }
}