diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2018-04-03 18:33:24 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2018-04-03 18:33:24 +0100 |
commit | ef9fc91c613fc038a5f160e595176fdf7b51efe0 (patch) | |
tree | 72b152e22eb4fa752785b74300657dc6a0232dca /src/isotp.rs | |
parent | f99a3974a624a8a98abf11cd5548c7462616e641 (diff) | |
download | canopied-ef9fc91c613fc038a5f160e595176fdf7b51efe0.tar.bz2 |
Switch to env_logger/log and clean things up a bit
Diffstat (limited to 'src/isotp.rs')
-rw-r--r-- | src/isotp.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/isotp.rs b/src/isotp.rs index f9a6274..4d4794a 100644 --- a/src/isotp.rs +++ b/src/isotp.rs @@ -77,7 +77,7 @@ impl ISOTP { let data = frame.data(); match data[0] >> 4 { 0 => { - println!("SingleFrame"); + trace!("SingleFrame"); // Received a SingleFrame frame, return a Vec of the // requisite number of bytes... let len = (data[0] & 0xf) as usize; @@ -88,11 +88,11 @@ impl ISOTP { return Some((frame.id() as u16, Vec::from(sliced))); } 1 => { - println!("FirstFrame"); + trace!("FirstFrame"); // Received a FirstFrame frame, we need to cancel any // ongoing receive for this ID if self.incoming.contains_key(&id) { - println!("Removed partial"); + trace!("Removed partial"); self.incoming.remove(&id); } // Now we need to construct an incoming packet @@ -105,7 +105,7 @@ impl ISOTP { return None; } 2 => { - println!("ConsecutiveFrame"); + trace!("ConsecutiveFrame"); // Received a ConsecutiveFrame frame, we need to find the // incoming which we want, and manipulate it with the incoming // frame and hopefully we either succeed in completing packet @@ -115,9 +115,9 @@ impl ISOTP { let mut do_flow = false; let mut do_delete = false; if let Some(packet) = self.incoming.get_mut(&id) { - println!("Found packet"); + trace!("Found packet"); if let Ok(flow) = packet.process_more(frame) { - println!("Processed a frame, no error"); + trace!("Processed a frame, no error"); if packet.remaining_bytes == 0 { // We have received the packet fully ret = Some((id, packet.content.clone())); @@ -130,11 +130,11 @@ impl ISOTP { return None; } } else { - println!("Error processing frame"); + trace!("Error processing frame"); do_delete = true; } } else { - println!("Didn't find a packet"); + trace!("Didn't find a packet"); } if do_flow { let mut packet = self.incoming.remove(&id).unwrap(); @@ -147,7 +147,7 @@ impl ISOTP { return ret; } 3 => { - println!("Oh gods, a flow control frame!"); + trace!("Oh gods, a flow control frame!"); } _ => {} } @@ -158,7 +158,7 @@ impl ISOTP { // We queue a flow control packet here let frame = CANFrame::new( (packet.id as u32) - 8, - &[0x30, packet.block_size, 0x00], + &[0x30, packet.block_size, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], false, false, ).unwrap(); |