diff options
Diffstat (limited to 'src/org/traccar/protocol/LaipacProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/LaipacProtocolDecoder.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/LaipacProtocolDecoder.java b/src/org/traccar/protocol/LaipacProtocolDecoder.java index bfaff9ec4..8634a0e32 100644 --- a/src/org/traccar/protocol/LaipacProtocolDecoder.java +++ b/src/org/traccar/protocol/LaipacProtocolDecoder.java @@ -15,9 +15,10 @@ */ package org.traccar.protocol; -import org.jboss.netty.channel.Channel; +import io.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.DeviceSession; +import org.traccar.NetworkMessage; import org.traccar.helper.Checksum; import org.traccar.helper.DateBuilder; import org.traccar.helper.Parser; @@ -93,7 +94,7 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { String sentence = (String) msg; if (sentence.startsWith("$ECHK") && channel != null) { - channel.write(sentence + "\r\n"); // heartbeat + channel.writeAndFlush(new NetworkMessage(sentence + "\r\n", remoteAddress)); // heartbeat return null; } @@ -146,15 +147,15 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { if (channel != null) { if (event.equals("3")) { - channel.write("$AVCFG,00000000,d*31\r\n"); + channel.writeAndFlush(new NetworkMessage("$AVCFG,00000000,d*31\r\n", remoteAddress)); } else if (event.equals("X") || event.equals("4")) { - channel.write("$AVCFG,00000000,x*2D\r\n"); + channel.writeAndFlush(new NetworkMessage("$AVCFG,00000000,x*2D\r\n", remoteAddress)); } else if (event.equals("Z")) { - channel.write("$AVCFG,00000000,z*2F\r\n"); + channel.writeAndFlush(new NetworkMessage("$AVCFG,00000000,z*2F\r\n", remoteAddress)); } else if (Character.isLowerCase(status.charAt(0))) { String response = "$EAVACK," + event + "," + checksum; response += Checksum.nmea(response) + "\r\n"; - channel.write(response); + channel.writeAndFlush(new NetworkMessage(response, remoteAddress)); } } |