aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-06 20:59:54 +1200
committerGitHub <noreply@github.com>2018-06-06 20:59:54 +1200
commit35bef1115f73da97b15ae3c1de03db1cd6d733c5 (patch)
tree97e5414d9eeb41fc0c4545c26b5098ac727c2de7 /src/org/traccar/protocol/Gl200TextProtocolDecoder.java
parenteb6475d5087345b7f355fcd55362b955ba5df715 (diff)
parente091e61f54cabd2442927700d9c689f81fc1ed8b (diff)
downloadtrackermap-server-35bef1115f73da97b15ae3c1de03db1cd6d733c5.tar.gz
trackermap-server-35bef1115f73da97b15ae3c1de03db1cd6d733c5.tar.bz2
trackermap-server-35bef1115f73da97b15ae3c1de03db1cd6d733c5.zip
Merge pull request #3912 from Abyss777/netty4_gl200_teltonika
Migrate gl200 and teltonika to netty 4
Diffstat (limited to 'src/org/traccar/protocol/Gl200TextProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Gl200TextProtocolDecoder.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
index 1c7fe4688..e6187a002 100644
--- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -15,11 +15,10 @@
*/
package org.traccar.protocol;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.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;
@@ -29,6 +28,9 @@ import org.traccar.model.Network;
import org.traccar.model.Position;
import org.traccar.model.WifiAccessPoint;
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.Channel;
+
import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
import java.text.DateFormat;
@@ -368,7 +370,8 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
if (type.equals("HBD")) {
if (channel != null) {
parser.skip(6);
- channel.write("+SACK:GTHBD," + protocolVersion + "," + parser.next() + "$", remoteAddress);
+ channel.writeAndFlush(new NetworkMessage(
+ "+SACK:GTHBD," + protocolVersion + "," + parser.next() + "$", remoteAddress));
}
} else {
Position position = new Position(getProtocolName());
@@ -980,7 +983,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
decodeDeviceTime(position, parser);
if (Context.getConfig().getBoolean(getProtocolName() + ".ack") && channel != null) {
- channel.write("+SACK:" + parser.next() + "$", remoteAddress);
+ channel.writeAndFlush(new NetworkMessage("+SACK:" + parser.next() + "$", remoteAddress));
}
return position;
@@ -1060,7 +1063,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
- String sentence = ((ChannelBuffer) msg).toString(StandardCharsets.US_ASCII);
+ String sentence = ((ByteBuf) msg).toString(StandardCharsets.US_ASCII);
int typeIndex = sentence.indexOf(":GT");
if (typeIndex < 0) {