diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-01 09:56:32 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-01 09:56:32 +1300 |
commit | f16ce106253ce3a857efbe4cd7b65f76c77d6364 (patch) | |
tree | a8c59b88518afbec9cebc74f4c59b14039ad5e5b | |
parent | 161875aaccca9799fb0e79948781547930664158 (diff) | |
download | trackermap-server-f16ce106253ce3a857efbe4cd7b65f76c77d6364.tar.gz trackermap-server-f16ce106253ce3a857efbe4cd7b65f76c77d6364.tar.bz2 trackermap-server-f16ce106253ce3a857efbe4cd7b65f76c77d6364.zip |
Fix issues in FlexTrack decoder
-rw-r--r-- | src/org/traccar/protocol/FlextrackProtocolDecoder.java | 8 | ||||
-rw-r--r-- | test/org/traccar/protocol/FlextrackProtocolDecoderTest.java | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/FlextrackProtocolDecoder.java b/src/org/traccar/protocol/FlextrackProtocolDecoder.java index 0622cbc3a..12ed78bee 100644 --- a/src/org/traccar/protocol/FlextrackProtocolDecoder.java +++ b/src/org/traccar/protocol/FlextrackProtocolDecoder.java @@ -61,7 +61,7 @@ public class FlextrackProtocolDecoder extends BaseProtocolDecoder { "(\\d+)," + // HDOP "(\\p{XDigit}+)," + // Cell "\\d+," + // GPS fix time - "(\\d+)," + // LAC + "(\\p{XDigit}+)," + // LAC "(\\d+)"); // Odometer private void sendAcknowledgement(Channel channel, String index) { @@ -97,7 +97,9 @@ public class FlextrackProtocolDecoder extends BaseProtocolDecoder { } } - } else if (sentence.contains("UNITSTAT")) { + } else if (sentence.contains("UNITSTAT") && hasDeviceId()) { + + String x = PatternUtil.checkPattern(pattern.pattern(), sentence); Matcher parser = pattern.matcher(sentence); if (!parser.matches()) { @@ -106,6 +108,8 @@ public class FlextrackProtocolDecoder extends BaseProtocolDecoder { Position position = new Position(); position.setProtocol(getProtocolName()); + position.setDeviceId(getDeviceId()); + int index = 1; sendAcknowledgement(channel, parser.group(index++)); diff --git a/test/org/traccar/protocol/FlextrackProtocolDecoderTest.java b/test/org/traccar/protocol/FlextrackProtocolDecoderTest.java index 435dacf9a..6b22f2906 100644 --- a/test/org/traccar/protocol/FlextrackProtocolDecoderTest.java +++ b/test/org/traccar/protocol/FlextrackProtocolDecoderTest.java @@ -19,6 +19,9 @@ public class FlextrackProtocolDecoderTest extends ProtocolDecoderTest { "-1,LOGON,1080424008,8945020110126633198")); verify(decoder.decode(null, null, + "-2,UNITSTAT,20060101,123442,1080424008,N0.00.0000,E0.00.0000,0,0,0,4129,-61,2,23866,0,999,A214,63,2EE2,3471676")); + + verify(decoder.decode(null, null, "-2,UNITSTAT,20050205,181923,7000004634,N55.46.0812,E009.21.1665,122,198,6,3934,-81,01A8,23802,213,55,37FD,45,0055,12878")); } |