diff options
-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")); } |