diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-01-03 16:38:22 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-01-03 16:38:22 -0800 |
commit | eea01d00aad283bf505262b3c462dc7b88011fae (patch) | |
tree | d9d66e52b6dbda88e9beb97a82d96ca2e0a098bf | |
parent | e4e06e879652d8c61606843e3f7959ae5a1ec2a2 (diff) | |
download | traccar-server-eea01d00aad283bf505262b3c462dc7b88011fae.tar.gz traccar-server-eea01d00aad283bf505262b3c462dc7b88011fae.tar.bz2 traccar-server-eea01d00aad283bf505262b3c462dc7b88011fae.zip |
Support alternative Atlanta L100 format
-rw-r--r-- | src/org/traccar/protocol/L100ProtocolDecoder.java | 3 | ||||
-rw-r--r-- | test/org/traccar/protocol/L100ProtocolDecoderTest.java | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/L100ProtocolDecoder.java b/src/org/traccar/protocol/L100ProtocolDecoder.java index c4a4c0d58..4d6b8f34b 100644 --- a/src/org/traccar/protocol/L100ProtocolDecoder.java +++ b/src/org/traccar/protocol/L100ProtocolDecoder.java @@ -40,6 +40,7 @@ public class L100ProtocolDecoder extends BaseProtocolDecoder { private static final Pattern PATTERN = new PatternBuilder() .text("ATL") + .expression(",[^,]+,").optional() .number("(d{15}),") // imei .text("$GPRMC,") .number("(dd)(dd)(dd)") // time (hhmmss.sss) @@ -142,7 +143,7 @@ public class L100ProtocolDecoder extends BaseProtocolDecoder { } else { return decodeObdLocation(channel, remoteAddress, sentence); } - } else if (sentence.startsWith("ATL,") || sentence.substring(0, 1).matches("[NPT]")) { + } else if (!sentence.contains("$GPRMC")) { return decodeNew(channel, remoteAddress, sentence); } else { return decodeNormal(channel, remoteAddress, sentence); diff --git a/test/org/traccar/protocol/L100ProtocolDecoderTest.java b/test/org/traccar/protocol/L100ProtocolDecoderTest.java index e61e133a4..04f586f7a 100644 --- a/test/org/traccar/protocol/L100ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/L100ProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class L100ProtocolDecoderTest extends ProtocolTest { L100ProtocolDecoder decoder = new L100ProtocolDecoder(null); verifyPosition(decoder, text( + "ATL,NP,868004029750174,$GPRMC,062943,A,2533.6719,N,09154.3203,E,0,179,311218,,,*39,#01111011000000,0,0,0,934.82,27.13,4.0,25,405,755,15af,974b,0,0,0,ATL")); + + verifyPosition(decoder, text( "ATL,L,868345038171963,N,201218,093016,A,025.067144,N,055.144833,E,000.0,GPS,3939,424,03,00405,008834")); verifyPosition(decoder, text( |