pub fn create_frame_send_msg(
    cs: &CANSocket,
    channel: &str,
    cob_id: u32,
    data: &[u8],
    rtr: bool,
    err: bool,
) -> Result<CANFrame, Box<dyn Error>> {
    let frame = CANFrame::new(cob_id, data, rtr, err).unwrap();
    cs.write_frame(&frame)?;
    let mut formatted_data = "".to_owned();
    for item in data {
        formatted_data = format!("{}{:02X?} ", formatted_data, item);
    }
    println!(
        "{0:<30} {1:<8} {2:<10} {3:<25}",
        Utc::now().naive_local().format("[%a %b %e %H:%M:%S %Y]:"),
        channel,
        format!("0x{:03X?}", cob_id),
        formatted_data
    );

    Ok(frame)
}
/// Output provided message data as a can message to a given socket
/// Returns CANFrame that was sent
Output provided message data as a can message to a given socket
Returns CANFrame that was sent
Output provided message data as a can message to a given socket Returns CANFrame that was sent
pub fn create_frame_send_msg(
    cs: &CANSocket,
    channel: &str,
    cob_id: u32,
    data: &[u8],
    rtr: bool,
    err: bool,
) -> Result<CANFrame, Box<dyn Error>> {
    let frame = CANFrame::new(cob_id, data, rtr, err).unwrap();
    cs.write_frame(&frame)?;
    let mut formatted_data = "".to_owned();
    for item in data {
        formatted_data = format!("{}{:02X?} ", formatted_data, item);
    }
    println!(
        "{0:<30} {1:<8} {2:<10} {3:<25}",
        Utc::now().naive_local().format("[%a %b %e %H:%M:%S %Y]:"),
        channel,
        format!("0x{:03X?}", cob_id),
        formatted_data
    );
    Ok(frame)
}
pub fn create_frame_send_msg ( cs : & CANSocket , channel : & str , cob_id : u32 , data : & [ u8 ] , rtr : bool , err : bool , ) -> Result < CANFrame , Box < dyn Error > > { let frame = CANFrame :: new ( cob_id , data , rtr , err ) . unwrap ( ) ; cs . write_frame ( & frame ) ? ; let mut formatted_data = " " . to_owned ( ) ; for item in data { formatted_data = format ! ( " " formatted_data item ) ; } println ! ( " " Utc now ( ) naive_local ( ) format ( " " ) channel format ( " " cob_id ) formatted_data ) ; Ok ( frame ) }
Output provided message data as a can message to a given socket
Returns CANFrame that was sent
Output provided message data as a can message to a given socket Returns CANFrame that was sent
cs
&CANSocket
channel
&str
cob_id
u32
data
&[u8]
rtr
bool
err
bool
cs
&CANSocket
channel
&str
cob_id
u32
data
&[u8]
rtr
bool
err
bool