aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/AquilaProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/At2000FrameDecoder.java2
-rw-r--r--src/org/traccar/protocol/At2000ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/AutoFonProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Avl301ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/BoxProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/CastelProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/CellocatorProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/DmtProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/DwayProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/EgtsProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/FlexCommProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/FlextrackProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/GalileoProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/GatorProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gl100ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/GlobalSatProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/GoSafeProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gps056ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/GpsGateProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/GpsmtaProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/GranitProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Gt02ProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/HuaShengProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/HuabaoProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/IntellitracFrameDecoder.java2
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/KhdProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Mta6ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/MxtProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/OigoProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/PricolProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/ProgressProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Pt502ProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/Pt60ProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/RuptelaProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/SabertekProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Tr20ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/UproProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/WatchProtocolDecoder.java9
43 files changed, 69 insertions, 53 deletions
diff --git a/src/org/traccar/protocol/AquilaProtocolDecoder.java b/src/org/traccar/protocol/AquilaProtocolDecoder.java
index ca6d2e48f..97d4ca79f 100644
--- a/src/org/traccar/protocol/AquilaProtocolDecoder.java
+++ b/src/org/traccar/protocol/AquilaProtocolDecoder.java
@@ -303,7 +303,8 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder {
if (channel != null) {
String password = Context.getIdentityManager().lookupAttributeString(
position.getDeviceId(), getProtocolName() + ".language", "aquila123", true);
- channel.write(new NetworkMessage("#set$" + id + "@" + password + "#EMR_MODE:0*", remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(
+ "#set$" + id + "@" + password + "#EMR_MODE:0*", remoteAddress));
}
}
diff --git a/src/org/traccar/protocol/At2000FrameDecoder.java b/src/org/traccar/protocol/At2000FrameDecoder.java
index 9d5524ec1..c02e38b65 100644
--- a/src/org/traccar/protocol/At2000FrameDecoder.java
+++ b/src/org/traccar/protocol/At2000FrameDecoder.java
@@ -39,7 +39,7 @@ public class At2000FrameDecoder extends BaseFrameDecoder {
response.writeMedium(1);
response.writeByte(0x00); // success
response.writerIndex(2 * BLOCK_LENGTH);
- channel.write(new NetworkMessage(response, channel.remoteAddress()));
+ channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
}
diff --git a/src/org/traccar/protocol/At2000ProtocolDecoder.java b/src/org/traccar/protocol/At2000ProtocolDecoder.java
index bd75e12b9..cba7c92c6 100644
--- a/src/org/traccar/protocol/At2000ProtocolDecoder.java
+++ b/src/org/traccar/protocol/At2000ProtocolDecoder.java
@@ -56,7 +56,7 @@ public class At2000ProtocolDecoder extends BaseProtocolDecoder {
response.writeByte(MSG_TRACK_REQUEST);
response.writeMedium(0);
response.writerIndex(BLOCK_LENGTH);
- channel.write(new NetworkMessage(response, channel.remoteAddress()));
+ channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
}
diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
index cb1ddaca9..c0c57720e 100644
--- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java
+++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
@@ -138,7 +138,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
ByteBuf response = Unpooled.buffer();
response.writeBytes("resp_crc=".getBytes(StandardCharsets.US_ASCII));
response.writeByte(buf.getByte(buf.writerIndex() - 1));
- channel.write(new NetworkMessage(response, remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
}
return null;
diff --git a/src/org/traccar/protocol/Avl301ProtocolDecoder.java b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
index a473f9a5b..a3697117b 100644
--- a/src/org/traccar/protocol/Avl301ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
@@ -57,7 +57,7 @@ public class Avl301ProtocolDecoder extends BaseProtocolDecoder {
response.writeByte(type);
response.writeByte('#');
response.writeByte('\r'); response.writeByte('\n');
- channel.write(new NetworkMessage(response, channel.remoteAddress()));
+ channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
}
diff --git a/src/org/traccar/protocol/BoxProtocolDecoder.java b/src/org/traccar/protocol/BoxProtocolDecoder.java
index ef18f1555..231fd9b36 100644
--- a/src/org/traccar/protocol/BoxProtocolDecoder.java
+++ b/src/org/traccar/protocol/BoxProtocolDecoder.java
@@ -63,7 +63,7 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder {
} else if (sentence.startsWith("E,")) {
if (channel != null) {
- channel.write(new NetworkMessage("A," + sentence.substring(2) + "\r", remoteAddress));
+ channel.writeAndFlush(new NetworkMessage("A," + sentence.substring(2) + "\r", remoteAddress));
}
} else if (sentence.startsWith("L,")) {
diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java
index 296309989..3c3ad6117 100644
--- a/src/org/traccar/protocol/CastelProtocolDecoder.java
+++ b/src/org/traccar/protocol/CastelProtocolDecoder.java
@@ -209,7 +209,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder {
response.writeShortLE(
Checksum.crc16(Checksum.CRC16_X25, response.nioBuffer(0, response.writerIndex())));
response.writeByte(0x0D); response.writeByte(0x0A);
- channel.write(new NetworkMessage(response, remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
}
}
@@ -231,7 +231,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder {
response.writeShortLE(
Checksum.crc16(Checksum.CRC16_X25, response.nioBuffer(0, response.writerIndex())));
response.writeByte(0x0D); response.writeByte(0x0A);
- channel.write(new NetworkMessage(response, remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
}
}
diff --git a/src/org/traccar/protocol/CellocatorProtocolDecoder.java b/src/org/traccar/protocol/CellocatorProtocolDecoder.java
index 426b6bf3b..18e20699a 100644
--- a/src/org/traccar/protocol/CellocatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/CellocatorProtocolDecoder.java
@@ -64,7 +64,7 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder {
reply.writeByte(checksum);
if (channel != null) {
- channel.write(new NetworkMessage(reply, remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(reply, remoteAddress));
}
}
diff --git a/src/org/traccar/protocol/DmtProtocolDecoder.java b/src/org/traccar/protocol/DmtProtocolDecoder.java
index fe9ab0e5f..9b414531a 100644
--- a/src/org/traccar/protocol/DmtProtocolDecoder.java
+++ b/src/org/traccar/protocol/DmtProtocolDecoder.java
@@ -59,7 +59,7 @@ public class DmtProtocolDecoder extends BaseProtocolDecoder {
if (content != null) {
response.writeBytes(content);
}
- channel.write(new NetworkMessage(response, channel.remoteAddress()));
+ channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
}
diff --git a/src/org/traccar/protocol/DwayProtocolDecoder.java b/src/org/traccar/protocol/DwayProtocolDecoder.java
index c3941b0a1..f2e1ad710 100644
--- a/src/org/traccar/protocol/DwayProtocolDecoder.java
+++ b/src/org/traccar/protocol/DwayProtocolDecoder.java
@@ -62,7 +62,7 @@ public class DwayProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
if (sentence.equals("AA55,HB")) {
if (channel != null) {
- channel.write(new NetworkMessage("55AA,HB,OK\r\n", remoteAddress));
+ channel.writeAndFlush(new NetworkMessage("55AA,HB,OK\r\n", remoteAddress));
}
return null;
}
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index 64b61904d..1ed21893d 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -63,7 +63,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
private void sendResponse(Channel channel, SocketAddress remoteAddress, String uniqueId, int type, int index) {
if (channel != null) {
- channel.write(new NetworkMessage(EelinkProtocolEncoder.encodeContent(
+ channel.writeAndFlush(new NetworkMessage(EelinkProtocolEncoder.encodeContent(
channel instanceof DatagramChannel, uniqueId, type, index, null), remoteAddress));
}
}
diff --git a/src/org/traccar/protocol/EgtsProtocolDecoder.java b/src/org/traccar/protocol/EgtsProtocolDecoder.java
index 1a3efa4cf..bb78f89a2 100644
--- a/src/org/traccar/protocol/EgtsProtocolDecoder.java
+++ b/src/org/traccar/protocol/EgtsProtocolDecoder.java
@@ -106,7 +106,7 @@ public class EgtsProtocolDecoder extends BaseProtocolDecoder {
response.writeBytes(record);
response.writeShortLE(recordChecksum);
- channel.write(new NetworkMessage(response, channel.remoteAddress()));
+ channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
}
diff --git a/src/org/traccar/protocol/FlexCommProtocolDecoder.java b/src/org/traccar/protocol/FlexCommProtocolDecoder.java
index 73c192698..3a1e23d20 100644
--- a/src/org/traccar/protocol/FlexCommProtocolDecoder.java
+++ b/src/org/traccar/protocol/FlexCommProtocolDecoder.java
@@ -118,7 +118,7 @@ public class FlexCommProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_POWER, parser.nextInt() * 0.1);
if (channel != null) {
- channel.write(new NetworkMessage("{01}", remoteAddress));
+ channel.writeAndFlush(new NetworkMessage("{01}", remoteAddress));
}
return position;
diff --git a/src/org/traccar/protocol/FlextrackProtocolDecoder.java b/src/org/traccar/protocol/FlextrackProtocolDecoder.java
index f2a5579d2..a6970ba86 100644
--- a/src/org/traccar/protocol/FlextrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/FlextrackProtocolDecoder.java
@@ -68,7 +68,7 @@ public class FlextrackProtocolDecoder extends BaseProtocolDecoder {
private void sendAcknowledgement(Channel channel, SocketAddress remoteAddress, String index) {
if (channel != null) {
- channel.write(new NetworkMessage(index + ",ACK\r", remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(index + ",ACK\r", remoteAddress));
}
}
diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java
index 9beb93e4c..dae92fa8a 100644
--- a/src/org/traccar/protocol/GalileoProtocolDecoder.java
+++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java
@@ -97,7 +97,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
reply.writeByte(0x02);
reply.writeShortLE((short) checksum);
if (channel != null) {
- channel.write(new NetworkMessage(reply, channel.remoteAddress()));
+ channel.writeAndFlush(new NetworkMessage(reply, channel.remoteAddress()));
}
}
diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java
index 5841f6fad..f77723691 100644
--- a/src/org/traccar/protocol/GatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/GatorProtocolDecoder.java
@@ -68,7 +68,7 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder {
response.writeByte(0); // slave order
response.writeByte(1); // calibration
response.writeByte(0x0D);
- channel.write(new NetworkMessage(response, remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
}
}
diff --git a/src/org/traccar/protocol/Gl100ProtocolDecoder.java b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
index 13ed7120e..a1654d062 100644
--- a/src/org/traccar/protocol/Gl100ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
@@ -65,7 +65,7 @@ public class Gl100ProtocolDecoder extends BaseProtocolDecoder {
String response = "+RESP:GTHBD,GPRS ACTIVE,";
response += sentence.substring(9, sentence.lastIndexOf(','));
response += '\0';
- channel.write(new NetworkMessage(response, remoteAddress)); // heartbeat response
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress)); // heartbeat response
}
Parser parser = new Parser(PATTERN, sentence);
diff --git a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
index dd1ede9a4..4b67c1eff 100644
--- a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
+++ b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
@@ -52,7 +52,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
private Position decodeOriginal(Channel channel, SocketAddress remoteAddress, String sentence) {
if (channel != null) {
- channel.write(new NetworkMessage("ACK\r", remoteAddress));
+ channel.writeAndFlush(new NetworkMessage("ACK\r", remoteAddress));
}
String format;
diff --git a/src/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
index 38224f16d..f3900a61b 100644
--- a/src/org/traccar/protocol/GoSafeProtocolDecoder.java
+++ b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
@@ -206,7 +206,7 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
if (channel != null) {
- channel.write(new NetworkMessage("1234", remoteAddress));
+ channel.writeAndFlush(new NetworkMessage("1234", remoteAddress));
}
String sentence = (String) msg;
diff --git a/src/org/traccar/protocol/Gps056ProtocolDecoder.java b/src/org/traccar/protocol/Gps056ProtocolDecoder.java
index d8d63cce2..c2a8372b0 100644
--- a/src/org/traccar/protocol/Gps056ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps056ProtocolDecoder.java
@@ -43,7 +43,7 @@ public class Gps056ProtocolDecoder extends BaseProtocolDecoder {
response.writeBytes(content);
}
response.writeByte('#');
- channel.write(new NetworkMessage(response, channel.remoteAddress()));
+ channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
}
diff --git a/src/org/traccar/protocol/GpsGateProtocolDecoder.java b/src/org/traccar/protocol/GpsGateProtocolDecoder.java
index b4357ff64..6eff3eb76 100644
--- a/src/org/traccar/protocol/GpsGateProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsGateProtocolDecoder.java
@@ -68,7 +68,7 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder {
private void send(Channel channel, SocketAddress remoteAddress, String message) {
if (channel != null) {
- channel.write(new NetworkMessage(message + Checksum.nmea(message) + "\r\n", remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(message + Checksum.nmea(message) + "\r\n", remoteAddress));
}
}
diff --git a/src/org/traccar/protocol/GpsmtaProtocolDecoder.java b/src/org/traccar/protocol/GpsmtaProtocolDecoder.java
index a4e732ed9..1d80178cb 100644
--- a/src/org/traccar/protocol/GpsmtaProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsmtaProtocolDecoder.java
@@ -82,7 +82,7 @@ public class GpsmtaProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_CHARGE, parser.nextInt(0) == 1);
if (channel != null) {
- channel.write(new NetworkMessage(time, remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(time, remoteAddress));
}
return position;
diff --git a/src/org/traccar/protocol/GranitProtocolDecoder.java b/src/org/traccar/protocol/GranitProtocolDecoder.java
index d9e7b62d8..c3eff7d34 100644
--- a/src/org/traccar/protocol/GranitProtocolDecoder.java
+++ b/src/org/traccar/protocol/GranitProtocolDecoder.java
@@ -64,7 +64,7 @@ public class GranitProtocolDecoder extends BaseProtocolDecoder {
response.writeInt((int) time);
response.writeShortLE(deviceId);
appendChecksum(response, 16);
- channel.write(new NetworkMessage(response, channel.remoteAddress()));
+ channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
private static void sendResponseArchive(Channel channel, int deviceId, int packNum) {
@@ -74,7 +74,7 @@ public class GranitProtocolDecoder extends BaseProtocolDecoder {
response.writeShortLE(packNum);
response.writeShortLE(deviceId);
appendChecksum(response, 14);
- channel.write(new NetworkMessage(response, channel.remoteAddress()));
+ channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
private void decodeStructure(ByteBuf buf, Position position) {
diff --git a/src/org/traccar/protocol/Gt02ProtocolDecoder.java b/src/org/traccar/protocol/Gt02ProtocolDecoder.java
index d222acaab..83be9d996 100644
--- a/src/org/traccar/protocol/Gt02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt02ProtocolDecoder.java
@@ -21,6 +21,7 @@ import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
@@ -74,7 +75,7 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder {
if (channel != null) {
byte[] response = {0x54, 0x68, 0x1A, 0x0D, 0x0A};
- channel.write(Unpooled.wrappedBuffer(response));
+ channel.writeAndFlush(new NetworkMessage(Unpooled.wrappedBuffer(response), remoteAddress));
}
} else if (type == MSG_DATA) {
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index f54e3bf6d..490c366ea 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -183,7 +183,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
response.writeShort(Checksum.crc16(Checksum.CRC16_X25,
response.nioBuffer(2, response.writerIndex() - 2)));
response.writeByte('\r'); response.writeByte('\n'); // ending
- channel.write(new NetworkMessage(response, channel.remoteAddress()));
+ channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
}
diff --git a/src/org/traccar/protocol/HuaShengProtocolDecoder.java b/src/org/traccar/protocol/HuaShengProtocolDecoder.java
index 05d0751a2..6349a6792 100644
--- a/src/org/traccar/protocol/HuaShengProtocolDecoder.java
+++ b/src/org/traccar/protocol/HuaShengProtocolDecoder.java
@@ -55,7 +55,7 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder {
response.writeBytes(content);
}
response.writeByte(0xC0);
- channel.write(new NetworkMessage(response, channel.remoteAddress()));
+ channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
}
diff --git a/src/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/org/traccar/protocol/HuabaoProtocolDecoder.java
index 95d077abd..7735092fc 100644
--- a/src/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -68,7 +68,7 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
response.writeShort(index);
response.writeShort(type);
response.writeByte(RESULT_SUCCESS);
- channel.write(new NetworkMessage(formatMessage(MSG_GENERAL_RESPONSE, id, response), remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(formatMessage(MSG_GENERAL_RESPONSE, id, response), remoteAddress));
}
}
@@ -122,7 +122,7 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
response.writeShort(index);
response.writeByte(RESULT_SUCCESS);
response.writeBytes("authentication".getBytes(StandardCharsets.US_ASCII));
- channel.write(new NetworkMessage(
+ channel.writeAndFlush(new NetworkMessage(
formatMessage(MSG_TERMINAL_REGISTER_RESPONSE, id, response), remoteAddress));
}
diff --git a/src/org/traccar/protocol/IntellitracFrameDecoder.java b/src/org/traccar/protocol/IntellitracFrameDecoder.java
index 3b175252d..2cf91bf59 100644
--- a/src/org/traccar/protocol/IntellitracFrameDecoder.java
+++ b/src/org/traccar/protocol/IntellitracFrameDecoder.java
@@ -42,7 +42,7 @@ public class IntellitracFrameDecoder extends LineBasedFrameDecoder {
if (buf.getUnsignedShort(buf.readerIndex()) == 0xFAF8) {
ByteBuf syncMessage = buf.readBytes(8);
if (ctx != null && ctx.channel() != null) {
- ctx.channel().write(new NetworkMessage(syncMessage, ctx.channel().remoteAddress()));
+ ctx.channel().writeAndFlush(new NetworkMessage(syncMessage, ctx.channel().remoteAddress()));
}
}
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index f65a95352..58ec8c613 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -333,9 +333,9 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
if (channel != null) {
if (type.equals("U01") || type.equals("U02") || type.equals("U03")) {
- channel.write(new NetworkMessage("(S39)", remoteAddress));
+ channel.writeAndFlush(new NetworkMessage("(S39)", remoteAddress));
} else if (type.equals("U06")) {
- channel.write(new NetworkMessage("(S20)", remoteAddress));
+ channel.writeAndFlush(new NetworkMessage("(S20)", remoteAddress));
}
}
diff --git a/src/org/traccar/protocol/KhdProtocolDecoder.java b/src/org/traccar/protocol/KhdProtocolDecoder.java
index 3b5c1962d..6aa4add9e 100644
--- a/src/org/traccar/protocol/KhdProtocolDecoder.java
+++ b/src/org/traccar/protocol/KhdProtocolDecoder.java
@@ -139,7 +139,7 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
response.writeByte(0); // reserved
response.writeByte(Checksum.xor(response.nioBuffer()));
response.writeByte(0x0D); // ending
- channel.write(new NetworkMessage(response, remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
}
diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
index 56a5669ae..94b624612 100644
--- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
@@ -25,6 +25,7 @@ import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.handler.codec.http.HttpVersion;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
import org.traccar.Protocol;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
@@ -50,7 +51,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
private void sendContinue(Channel channel) {
FullHttpResponse response = new DefaultFullHttpResponse(
HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE);
- channel.write(response);
+ channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
private void sendResponse(Channel channel, short packetId, short packetCount) {
@@ -62,7 +63,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
FullHttpResponse response = new DefaultFullHttpResponse(
HttpVersion.HTTP_1_1, HttpResponseStatus.OK, Unpooled.wrappedBuffer(begin, end));
- channel.write(response);
+ channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
private static class FloatReader {
diff --git a/src/org/traccar/protocol/MxtProtocolDecoder.java b/src/org/traccar/protocol/MxtProtocolDecoder.java
index be45b60c8..34cb268d9 100644
--- a/src/org/traccar/protocol/MxtProtocolDecoder.java
+++ b/src/org/traccar/protocol/MxtProtocolDecoder.java
@@ -60,7 +60,7 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder {
encoded.writeByte(b);
}
encoded.writeByte(0x04); // ending
- channel.write(new NetworkMessage(encoded, channel.remoteAddress()));
+ channel.writeAndFlush(new NetworkMessage(encoded, channel.remoteAddress()));
}
}
diff --git a/src/org/traccar/protocol/OigoProtocolDecoder.java b/src/org/traccar/protocol/OigoProtocolDecoder.java
index e00079210..9067bac21 100644
--- a/src/org/traccar/protocol/OigoProtocolDecoder.java
+++ b/src/org/traccar/protocol/OigoProtocolDecoder.java
@@ -217,7 +217,7 @@ public class OigoProtocolDecoder extends BaseProtocolDecoder {
response.writeByte(MSG_ACKNOWLEDGEMENT);
response.writeByte(index);
response.writeByte(0x00);
- channel.write(new NetworkMessage(response, remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
}
return position;
diff --git a/src/org/traccar/protocol/PricolProtocolDecoder.java b/src/org/traccar/protocol/PricolProtocolDecoder.java
index 901639501..e0ab300be 100644
--- a/src/org/traccar/protocol/PricolProtocolDecoder.java
+++ b/src/org/traccar/protocol/PricolProtocolDecoder.java
@@ -87,7 +87,8 @@ public class PricolProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_RPM, buf.readUnsignedShort());
if (channel != null) {
- channel.write(new NetworkMessage(Unpooled.copiedBuffer("ACK", StandardCharsets.US_ASCII), remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(
+ Unpooled.copiedBuffer("ACK", StandardCharsets.US_ASCII), remoteAddress));
}
return position;
diff --git a/src/org/traccar/protocol/ProgressProtocolDecoder.java b/src/org/traccar/protocol/ProgressProtocolDecoder.java
index d7e67df30..c57d6e5ce 100644
--- a/src/org/traccar/protocol/ProgressProtocolDecoder.java
+++ b/src/org/traccar/protocol/ProgressProtocolDecoder.java
@@ -152,7 +152,7 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
if (type == MSG_ALARM) {
position.set(Position.KEY_ALARM, true);
byte[] response = {(byte) 0xC9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- channel.write(Unpooled.wrappedBuffer(response));
+ channel.writeAndFlush(new NetworkMessage(Unpooled.wrappedBuffer(response), remoteAddress));
}
buf.readUnsignedIntLE(); // crc
diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
index 4f75666ae..05d498cb4 100644
--- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
@@ -22,6 +22,7 @@ import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
@@ -144,7 +145,7 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
if (channel != null) {
int offset = photo.writerIndex();
int size = Math.min(photo.writableBytes(), MAX_CHUNK_SIZE);
- channel.write("#PHD" + offset + "," + size + "\r\n");
+ channel.writeAndFlush(new NetworkMessage("#PHD" + offset + "," + size + "\r\n", channel.remoteAddress()));
}
}
diff --git a/src/org/traccar/protocol/Pt60ProtocolDecoder.java b/src/org/traccar/protocol/Pt60ProtocolDecoder.java
index 24dc72332..63dd3c90b 100644
--- a/src/org/traccar/protocol/Pt60ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt60ProtocolDecoder.java
@@ -53,7 +53,8 @@ public class Pt60ProtocolDecoder extends BaseProtocolDecoder {
private void sendResponse(Channel channel, SocketAddress remoteAddress) {
if (channel != null) {
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
- channel.write(new NetworkMessage("@G#@,V01,38," + dateFormat.format(new Date()) + ",@R#@", remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(
+ "@G#@,V01,38," + dateFormat.format(new Date()) + ",@R#@", remoteAddress));
}
}
diff --git a/src/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/org/traccar/protocol/RuptelaProtocolDecoder.java
index df3c89f8f..2df0b6e25 100644
--- a/src/org/traccar/protocol/RuptelaProtocolDecoder.java
+++ b/src/org/traccar/protocol/RuptelaProtocolDecoder.java
@@ -20,6 +20,7 @@ import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
import org.traccar.helper.DataConverter;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Position;
@@ -196,7 +197,8 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
}
if (channel != null) {
- channel.write(Unpooled.wrappedBuffer(DataConverter.parseHex("0002640113bc")));
+ channel.writeAndFlush(new NetworkMessage(
+ Unpooled.wrappedBuffer(DataConverter.parseHex("0002640113bc")), remoteAddress));
}
return positions;
@@ -229,7 +231,8 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
}
if (channel != null) {
- channel.write(Unpooled.wrappedBuffer(DataConverter.parseHex("00026d01c4a4")));
+ channel.writeAndFlush(new NetworkMessage(
+ Unpooled.wrappedBuffer(DataConverter.parseHex("00026d01c4a4")), remoteAddress));
}
return positions;
diff --git a/src/org/traccar/protocol/SabertekProtocolDecoder.java b/src/org/traccar/protocol/SabertekProtocolDecoder.java
index d92753df3..8b7f2fb44 100644
--- a/src/org/traccar/protocol/SabertekProtocolDecoder.java
+++ b/src/org/traccar/protocol/SabertekProtocolDecoder.java
@@ -19,6 +19,7 @@ import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
import org.traccar.helper.BitUtil;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
@@ -71,7 +72,8 @@ public class SabertekProtocolDecoder extends BaseProtocolDecoder {
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());
if (channel != null) {
- channel.write(Unpooled.wrappedBuffer(new byte[]{(byte) (deviceSession != null ? 0x06 : 0x15)}));
+ channel.writeAndFlush(new NetworkMessage(
+ Unpooled.wrappedBuffer(new byte[]{(byte) (deviceSession != null ? 0x06 : 0x15)}), remoteAddress));
}
if (deviceSession == null) {
return null;
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index 6253bc127..fd208d526 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -19,6 +19,7 @@ import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
@@ -349,10 +350,10 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
String id = sentence.substring(1, 13);
String type = sentence.substring(13, 17);
if (type.equals("BP00")) {
- channel.write("(" + id + "AP01HSO)");
+ channel.writeAndFlush(new NetworkMessage("(" + id + "AP01HSO)", remoteAddress));
return null;
} else if (type.equals("BP05")) {
- channel.write("(" + id + "AP05)");
+ channel.writeAndFlush(new NetworkMessage("(" + id + "AP05)", remoteAddress));
}
}
diff --git a/src/org/traccar/protocol/Tr20ProtocolDecoder.java b/src/org/traccar/protocol/Tr20ProtocolDecoder.java
index 1e3f8e8b2..0c4c12f60 100644
--- a/src/org/traccar/protocol/Tr20ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tr20ProtocolDecoder.java
@@ -18,6 +18,7 @@ package org.traccar.protocol;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
@@ -60,7 +61,8 @@ public class Tr20ProtocolDecoder extends BaseProtocolDecoder {
Parser parser = new Parser(PATTERN_PING, (String) msg);
if (parser.matches()) {
if (channel != null) {
- channel.write("&&" + parser.next() + "\r\n"); // keep-alive response
+ channel.writeAndFlush(new NetworkMessage(
+ "&&" + parser.next() + "\r\n", remoteAddress)); // keep-alive response
}
return null;
}
diff --git a/src/org/traccar/protocol/UproProtocolDecoder.java b/src/org/traccar/protocol/UproProtocolDecoder.java
index 9bbf6eb93..4e09d544a 100644
--- a/src/org/traccar/protocol/UproProtocolDecoder.java
+++ b/src/org/traccar/protocol/UproProtocolDecoder.java
@@ -20,6 +20,7 @@ import io.netty.buffer.ByteBufUtil;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
@@ -123,7 +124,7 @@ public class UproProtocolDecoder extends BaseProtocolDecoder {
String subtype = parser.next();
if (reply && channel != null) {
- channel.write("*MG20Y" + type + subtype + "#");
+ channel.writeAndFlush(new NetworkMessage("*MG20Y" + type + subtype + "#", remoteAddress));
}
while (buf.isReadable()) {
diff --git a/src/org/traccar/protocol/WatchProtocolDecoder.java b/src/org/traccar/protocol/WatchProtocolDecoder.java
index a5bdb6d62..04da066c5 100644
--- a/src/org/traccar/protocol/WatchProtocolDecoder.java
+++ b/src/org/traccar/protocol/WatchProtocolDecoder.java
@@ -20,6 +20,7 @@ import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
import org.traccar.helper.BitUtil;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
@@ -63,11 +64,11 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder {
private void sendResponse(Channel channel, String id, String index, String content) {
if (channel != null) {
if (index != null) {
- channel.write(String.format(
- "[%s*%s*%s*%04x*%s]", manufacturer, id, index, content.length(), content));
+ channel.writeAndFlush(new NetworkMessage(String.format("[%s*%s*%s*%04x*%s]",
+ manufacturer, id, index, content.length(), content), channel.remoteAddress()));
} else {
- channel.write(String.format(
- "[%s*%s*%04x*%s]", manufacturer, id, content.length(), content));
+ channel.writeAndFlush(new NetworkMessage(String.format("[%s*%s*%04x*%s]",
+ manufacturer, id, content.length(), content), channel.remoteAddress()));
}
}
}