diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-06-23 20:43:17 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-06-23 20:43:17 +1200 |
commit | 5cd79fef21612cc58ea6f0d0eed612c76d021d8a (patch) | |
tree | baca1e5f48b2286155801899bf6bdc2945c39268 | |
parent | 2f3c5cac45601f54fa0dd46a23cbd593b5779cc1 (diff) | |
download | traccar-server-5cd79fef21612cc58ea6f0d0eed612c76d021d8a.tar.gz traccar-server-5cd79fef21612cc58ea6f0d0eed612c76d021d8a.tar.bz2 traccar-server-5cd79fef21612cc58ea6f0d0eed612c76d021d8a.zip |
Improve GL200 decoder
-rw-r--r-- | src/org/traccar/protocol/Gl200ProtocolDecoder.java | 28 | ||||
-rw-r--r-- | test/org/traccar/protocol/Gl200ProtocolDecoderTest.java | 3 |
2 files changed, 9 insertions, 22 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index 639c9439a..ce845a6ec 100644 --- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2012 - 2013 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,43 +26,27 @@ import org.traccar.ServerManager; import org.traccar.helper.Log; import org.traccar.model.Position; -/** - * GL200 tracker protocol decoder - */ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { - /** - * Initialize - */ public Gl200ProtocolDecoder(ServerManager serverManager) { super(serverManager); } - /** - * Regular expressions pattern - */ static private Pattern pattern = Pattern.compile( "\\+RESP:GT...," + "[0-9a-fA-F]{6}," + // Protocol version - "(\\d{15})," + // IMEI - "[^,]*," + // Device name - "(?:(?:\\d," + // Report ID / Geo mode - "\\d*," + // Report type / Geo radius - "\\d*)|" + // Number / Geo check interval - "(?:[^,]*))," + // Call number + "(\\d{15}),.*," + // IMEI "(\\d*)," + // GPS accuracy "(\\d+.\\d)," + // Speed "(\\d+)," + // Course - "(-?\\d+.\\d)," + // Altitude - "(-?\\d+.\\d+)," + // Longitude - "(-?\\d+.\\d+)," + // Latitude + "(-?\\d+\\.\\d)," + // Altitude + "(-?\\d+\\.\\d+)," + // Longitude + "(-?\\d+\\.\\d+)," + // Latitude "(\\d{4})(\\d{2})(\\d{2})" + // Date (YYYYMMDD) "(\\d{2})(\\d{2})(\\d{2})," + // Time (HHMMSS) ".*"); - /** - * Decode message - */ + @Override protected Object decode( ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java index 460d0dfec..836ec298b 100644 --- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java @@ -12,6 +12,9 @@ public class Gl200ProtocolDecoderTest { decoder.setDataManager(new TestDataManager()); assertNotNull(decoder.decode(null, null, + "+RESP:GTFRI,04040C,359231038939904,,,10,1,2,0.0,117,346.0,8.924243,50.798077,20130618122040,0262,0002,0299,109C,00,0.0,,,,,,,,,20130618122045,00F6")); + + assertNotNull(decoder.decode(null, null, "+RESP:GTFRI,020102,000035988863964,,0,0,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,,20090214093254,11F0")); assertNotNull(decoder.decode(null, null, |