diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-06-09 00:11:14 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-09 00:11:14 +1200 |
commit | 46274ffddf31d0f09a7c370b2e374f53f6ecc2b6 (patch) | |
tree | 8d0869a71665898524fc67bfb5940a21a73c07e5 /src/org/traccar/protocol/TrackboxProtocolDecoder.java | |
parent | fb543fb413652f4cb0408a6caafbdd7f4a4ca369 (diff) | |
parent | c176b7b4bf4eef6f71767f92ada2591ef27c1cfa (diff) | |
download | trackermap-server-46274ffddf31d0f09a7c370b2e374f53f6ecc2b6.tar.gz trackermap-server-46274ffddf31d0f09a7c370b2e374f53f6ecc2b6.tar.bz2 trackermap-server-46274ffddf31d0f09a7c370b2e374f53f6ecc2b6.zip |
Merge pull request #3921 from Abyss777/netty4_tz-tl
Migrate part of T protocols
Diffstat (limited to 'src/org/traccar/protocol/TrackboxProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/TrackboxProtocolDecoder.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/TrackboxProtocolDecoder.java b/src/org/traccar/protocol/TrackboxProtocolDecoder.java index 2c113fb76..fff60ae70 100644 --- a/src/org/traccar/protocol/TrackboxProtocolDecoder.java +++ b/src/org/traccar/protocol/TrackboxProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 - 2015 Anton Tananaev (anton@traccar.org) + * Copyright 2014 - 2018 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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.DateBuilder; import org.traccar.helper.Parser; import org.traccar.helper.PatternBuilder; @@ -46,9 +47,9 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder { .number("(d+)") // satellites .compile(); - private void sendResponse(Channel channel) { + private void sendResponse(Channel channel, SocketAddress remoteAddress) { if (channel != null) { - channel.write("=OK=\r\n"); + channel.writeAndFlush(new NetworkMessage("=OK=\r\n", remoteAddress)); } } @@ -61,7 +62,7 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder { if (sentence.startsWith("a=connect")) { String id = sentence.substring(sentence.indexOf("i=") + 2); if (getDeviceSession(channel, remoteAddress, id) != null) { - sendResponse(channel); + sendResponse(channel, remoteAddress); } return null; } @@ -75,7 +76,7 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder { if (!parser.matches()) { return null; } - sendResponse(channel); + sendResponse(channel, remoteAddress); Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); |