From 3b61199ca03a602514457cf7ed640ff6d9a39519 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 29 May 2012 23:27:46 +0400 Subject: fixed #3 --- src/org/traccar/protocol/T55ProtocolDecoder.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/org/traccar/protocol/T55ProtocolDecoder.java') diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java index bf956ce4f..98d0079a6 100644 --- a/src/org/traccar/protocol/T55ProtocolDecoder.java +++ b/src/org/traccar/protocol/T55ProtocolDecoder.java @@ -67,8 +67,6 @@ public class T55ProtocolDecoder extends GenericProtocolDecoder { throws Exception { String sentence = (String) msg; - - //System.out.println(sentence); // Detect device ID if (sentence.contains("$PGID")) { @@ -89,11 +87,11 @@ public class T55ProtocolDecoder extends GenericProtocolDecoder { if (!parser.matches()) { return null; } - + // Create new position Position position = new Position(); position.setDeviceId(deviceId); - + Integer index = 1; // Time @@ -103,10 +101,10 @@ public class T55ProtocolDecoder extends GenericProtocolDecoder { time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); index += 1; // Skip milliseconds - + // Validity position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false); - + // Latitude Double latitude = Double.valueOf(parser.group(index++)); latitude += Double.valueOf(parser.group(index++)) / 60; @@ -134,16 +132,16 @@ public class T55ProtocolDecoder extends GenericProtocolDecoder { } else { position.setCourse(0.0); } - + // Date time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); position.setTime(time.getTime()); - + // Altitude position.setAltitude(0.0); - + return position; } -- cgit v1.2.3