From 92f00d0da0dafd08ccf2a623406963e61fcde276 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 8 Nov 2017 06:44:10 +1300 Subject: Fix D-WAY heartbeat response --- src/org/traccar/protocol/DwayProtocolDecoder.java | 4 ++-- test/org/traccar/protocol/DwayProtocolDecoderTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/org/traccar/protocol/DwayProtocolDecoder.java b/src/org/traccar/protocol/DwayProtocolDecoder.java index 767b35c72..121681588 100644 --- a/src/org/traccar/protocol/DwayProtocolDecoder.java +++ b/src/org/traccar/protocol/DwayProtocolDecoder.java @@ -59,9 +59,9 @@ public class DwayProtocolDecoder extends BaseProtocolDecoder { Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { String sentence = (String) msg; - if (sentence.startsWith(">H")) { + if (sentence.equals("AA55,HB")) { if (channel != null) { - channel.write(">ALIVE\r\n"); + channel.write("55AA,HB,OK\r\n"); } return null; } diff --git a/test/org/traccar/protocol/DwayProtocolDecoderTest.java b/test/org/traccar/protocol/DwayProtocolDecoderTest.java index be51f2b94..621aabf92 100644 --- a/test/org/traccar/protocol/DwayProtocolDecoderTest.java +++ b/test/org/traccar/protocol/DwayProtocolDecoderTest.java @@ -23,7 +23,7 @@ public class DwayProtocolDecoderTest extends ProtocolTest { "AA55,1,123456,1,140101,101132,22.5500,113.6770,75,70.5,320,1100,0011,1110,3950,33000,24000,12345678")); verifyNull(decoder, text( - ">H12345678")); + "AA55,HB")); } -- cgit v1.2.3