aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Ev603ProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-11-09 19:01:19 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-11-09 19:01:19 +1300
commitcf0565caceee6856328e481dd23600ed2590c88a (patch)
tree9d2cc8cf8d3eb27b36412eb492ad702581891f1c /src/org/traccar/protocol/Ev603ProtocolDecoder.java
parentf9ecee5b732b0c82c8a95bebdb5e275ea479cccc (diff)
downloadtrackermap-server-cf0565caceee6856328e481dd23600ed2590c88a.tar.gz
trackermap-server-cf0565caceee6856328e481dd23600ed2590c88a.tar.bz2
trackermap-server-cf0565caceee6856328e481dd23600ed2590c88a.zip
Improve unit test verification
Diffstat (limited to 'src/org/traccar/protocol/Ev603ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Ev603ProtocolDecoder.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/Ev603ProtocolDecoder.java b/src/org/traccar/protocol/Ev603ProtocolDecoder.java
index 322d7dd61..5be569d77 100644
--- a/src/org/traccar/protocol/Ev603ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Ev603ProtocolDecoder.java
@@ -1,6 +1,6 @@
/*
- * Copyright 2012 Anton Tananaev (anton.tananaev@gmail.com)
- * Luis Parada (luis.parada@gmail.com)
+ * Copyright 2012 - 2013 Anton Tananaev (anton.tananaev@gmail.com)
+ * Luis Parada (luis.parada@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ public class Ev603ProtocolDecoder extends BaseProtocolDecoder{
super(serverManager);
}
- static private Pattern pattern = Pattern.compile(
+ private static final Pattern pattern = Pattern.compile(
"!A," + // Type
"(\\d{2})\\/(\\d{2})\\/(\\d{2})," + // Date dd/mm/YY
"(\\d{2}):(\\d{2}):(\\d{2})," + // Time hh:mm:ss
@@ -67,7 +67,7 @@ public class Ev603ProtocolDecoder extends BaseProtocolDecoder{
else if (sentence.startsWith("!A,")) {
// Parse message
Matcher parser = pattern.matcher(sentence);
- if (!parser.matches()) {
+ if (deviceId == null || !parser.matches()) {
return null;
}
@@ -105,10 +105,11 @@ public class Ev603ProtocolDecoder extends BaseProtocolDecoder{
// Course
position.setCourse(Double.valueOf(parser.group(index++)));
+ if (position.getCourse() > 360) {
+ position.setCourse(0.0);
+ }
- // Extended info
position.setExtendedInfo(extendedInfo.toString());
-
return position;
}