aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-07-06 15:23:21 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2013-07-06 15:23:21 +1200
commit969ba1f91e5d3da4831a0628580785ba0cb7cafb (patch)
treedc7a06f0fc95c3c97284550883a9d590c03b9826 /src/org/traccar/protocol/MeiligaoProtocolDecoder.java
parentc63b9f7b7564e8cb7a0f55371652bc274395a697 (diff)
downloadtrackermap-server-969ba1f91e5d3da4831a0628580785ba0cb7cafb.tar.gz
trackermap-server-969ba1f91e5d3da4831a0628580785ba0cb7cafb.tar.bz2
trackermap-server-969ba1f91e5d3da4831a0628580785ba0cb7cafb.zip
Fix Meiligao decoder (fix #324)
Diffstat (limited to 'src/org/traccar/protocol/MeiligaoProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 42d7ca350..9202498e4 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -39,11 +39,11 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
}
static private Pattern pattern = Pattern.compile(
- "(\\d{2})(\\d{2})(\\d{2})\\.(\\d+)," + // Time (HHMMSS.SSS)
+ "(\\d{2})(\\d{2})(\\d{2})\\.?(\\d+)?," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
- "(\\d{2})(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
+ "(\\d+)(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
"([NS])," +
- "(\\d{3})(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM)
+ "(\\d+)(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM)
"([EW])," +
"(\\d+.\\d+)," + // Speed
"(\\d+\\.?\\d*)?," + // Course
@@ -158,7 +158,10 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
time.set(Calendar.HOUR, Integer.valueOf(parser.group(index++)));
time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++)));
time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++)));
- time.set(Calendar.MILLISECOND, Integer.valueOf(parser.group(index++)));
+ String mseconds = parser.group(index++);
+ if (mseconds != null) {
+ time.set(Calendar.MILLISECOND, Integer.valueOf(mseconds));
+ }
// Validity
position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false);