diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2011-11-28 11:47:28 +0000 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2011-11-28 11:47:28 +0000 |
commit | dcdea45edb7ee84b3eafd5593965e30b5cc077ab (patch) | |
tree | a86f4acd84f7a7a3d94a774efca8b5dbbcfd7f0c | |
parent | 8b6816289e5c7a4db1cb7ddda5e49e4ace050fa1 (diff) | |
download | trackermap-server-dcdea45edb7ee84b3eafd5593965e30b5cc077ab.tar.gz trackermap-server-dcdea45edb7ee84b3eafd5593965e30b5cc077ab.tar.bz2 trackermap-server-dcdea45edb7ee84b3eafd5593965e30b5cc077ab.zip |
-rw-r--r-- | src/org/traccar/protocol/gl100/Gl100ProtocolDecoder.java | 8 | ||||
-rw-r--r-- | test/org/traccar/protocol/gl100/Gl100ProtocolDecoderTest.java | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/gl100/Gl100ProtocolDecoder.java b/src/org/traccar/protocol/gl100/Gl100ProtocolDecoder.java index e2c576d69..25ce737fc 100644 --- a/src/org/traccar/protocol/gl100/Gl100ProtocolDecoder.java +++ b/src/org/traccar/protocol/gl100/Gl100ProtocolDecoder.java @@ -84,6 +84,14 @@ public class Gl100ProtocolDecoder extends OneToOneDecoder { String sentence = (String) msg; + // Send response + if (sentence.contains("AT+GTHBD=")) { + String response = "+RESP:GTHBD,GPRS ACTIVE,"; + response += sentence.substring(9, sentence.lastIndexOf(',')); + response += '\0'; + channel.write(response); + } + // Parse message Matcher parser = pattern.matcher(sentence); if (!parser.matches()) { diff --git a/test/org/traccar/protocol/gl100/Gl100ProtocolDecoderTest.java b/test/org/traccar/protocol/gl100/Gl100ProtocolDecoderTest.java index 614eb3478..972e849e2 100644 --- a/test/org/traccar/protocol/gl100/Gl100ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/gl100/Gl100ProtocolDecoderTest.java @@ -51,6 +51,8 @@ public class Gl100ProtocolDecoderTest { assertNotNull(decoder.decode(null, null, "+RESP:GTTRI,359231030000010,2,0,0,1,4.3,92,70.0,1,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,0,0,1,-3.6,145,30.0,2,121.354442,31.221940,20090101000100,0460,0000,18d8,6141,00,11F0,0102120204")); + //assertNotNull(decoder.decode(null, null, + // "AT+GTHBD=HeartBeat,359231030000010,20090101000000,11F0,0102120204")); } |