summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2018-04-09 17:13:49 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2018-04-09 17:13:49 +0100
commit7f2fba6a961c0cda02677a88222f11fe8cebe16a (patch)
treee1fad428da342ba0614abb4fd2574a4bc0e725df
parent70bd2a13487da5e713f49c2a3712fd36c1d89ba4 (diff)
downloadcanopied-7f2fba6a961c0cda02677a88222f11fe8cebe16a.tar.bz2
Remove traces
-rw-r--r--src/definitions.rs83
1 files changed, 36 insertions, 47 deletions
diff --git a/src/definitions.rs b/src/definitions.rs
index aa78809..3b07eda 100644
--- a/src/definitions.rs
+++ b/src/definitions.rs
@@ -71,10 +71,8 @@ impl RawECUEntry {
for entry in &ecu.response.values {
if let Some(ref vals) = entry.check {
let has = &payload[entry.offset..(entry.offset + vals.len())];
- trace!("Check: Does {:?} == {:?}", vals, has);
for i in 0..vals.len() {
if has[i] != vals[i] {
- trace!("Oops, not the same");
continue 'ecu;
}
}
@@ -113,51 +111,42 @@ impl RawECUEntry {
for entry in &self.response.values {
if let Some(ref kind) = entry.kind {
let value: Value = match kind.as_ref() {
- "unsigned" => {
- trace!("Unsigned");
- match entry.length {
- 1 => payload[entry.offset].into(),
- 2 => (((payload[entry.offset] as u16) << 8)
- + (payload[entry.offset + 1] as u16))
- .into(),
- 3 => (((payload[entry.offset] as u32) << 16)
- + ((payload[entry.offset + 1] as u32) << 8)
- + (payload[entry.offset + 2] as u32))
- .into(),
- 4 => (((payload[entry.offset] as u32) << 24)
- + ((payload[entry.offset + 1] as u32) << 16)
- + ((payload[entry.offset + 2] as u32) << 8)
- + (payload[entry.offset + 3] as u32))
- .into(),
- _ => panic!("Unhandled length: {}", entry.length),
- }
- }
- "signed" => {
- trace!("Signed");
- match entry.length {
- 1 => (payload[entry.offset] as i8).into(),
- 2 => ((((payload[entry.offset] as u16) << 8)
- + (payload[entry.offset + 1] as u16))
- as i16)
- .into(),
- 3 => ((((payload[entry.offset] as u32) << 16)
- + ((payload[entry.offset + 1] as u32) << 8)
- + (payload[entry.offset + 2] as u32))
- as i32)
- .into(),
- 4 => ((((payload[entry.offset] as u32) << 24)
- + ((payload[entry.offset + 1] as u32) << 16)
- + ((payload[entry.offset + 2] as u32) << 8)
- + (payload[entry.offset + 3] as u32))
- as i32)
- .into(),
- _ => panic!("Unhandled length: {}", entry.length),
- }
- }
- "bit" => {
- trace!("Bit");
- ((payload[entry.offset] & (1 << entry.base.unwrap())) != 0).into()
- }
+ "unsigned" => match entry.length {
+ 1 => payload[entry.offset].into(),
+ 2 => (((payload[entry.offset] as u16) << 8)
+ + (payload[entry.offset + 1] as u16))
+ .into(),
+ 3 => (((payload[entry.offset] as u32) << 16)
+ + ((payload[entry.offset + 1] as u32) << 8)
+ + (payload[entry.offset + 2] as u32))
+ .into(),
+ 4 => (((payload[entry.offset] as u32) << 24)
+ + ((payload[entry.offset + 1] as u32) << 16)
+ + ((payload[entry.offset + 2] as u32) << 8)
+ + (payload[entry.offset + 3] as u32))
+ .into(),
+ _ => panic!("Unhandled length: {}", entry.length),
+ },
+ "signed" => match entry.length {
+ 1 => (payload[entry.offset] as i8).into(),
+ 2 => ((((payload[entry.offset] as u16) << 8)
+ + (payload[entry.offset + 1] as u16))
+ as i16)
+ .into(),
+ 3 => ((((payload[entry.offset] as u32) << 16)
+ + ((payload[entry.offset + 1] as u32) << 8)
+ + (payload[entry.offset + 2] as u32))
+ as i32)
+ .into(),
+ 4 => ((((payload[entry.offset] as u32) << 24)
+ + ((payload[entry.offset + 1] as u32) << 16)
+ + ((payload[entry.offset + 2] as u32) << 8)
+ + (payload[entry.offset + 3] as u32))
+ as i32)
+ .into(),
+ _ => panic!("Unhandled length: {}", entry.length),
+ },
+ "bit" => ((payload[entry.offset] & (1 << entry.base.unwrap())) != 0).into(),
_ => {
panic!("Unhandled");
}