aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2012-05-29 23:27:46 +0400
committerAnton Tananaev <anton.tananaev@gmail.com>2012-05-29 23:27:46 +0400
commit3b61199ca03a602514457cf7ed640ff6d9a39519 (patch)
tree14099d0648a01f5dc4299894df0fe232ff4870cb /src/org/traccar/protocol
parentbf8177e17e6ce607e60fe6e43ecf7401af51a03c (diff)
downloadtraccar-server-3b61199ca03a602514457cf7ed640ff6d9a39519.tar.gz
traccar-server-3b61199ca03a602514457cf7ed640ff6d9a39519.tar.bz2
traccar-server-3b61199ca03a602514457cf7ed640ff6d9a39519.zip
fixed #3
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/T55ProtocolDecoder.java16
1 files changed, 7 insertions, 9 deletions
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;
}