aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-10-05 07:11:19 -0700
committerAnton Tananaev <anton@traccar.org>2022-10-05 07:11:19 -0700
commit205ed7965ae97ee6cf14deb8ec4dc94cdae75dfe (patch)
tree05cfd1c84f31799344a14f0a47aabcdf2b371156
parentbcd0d17008c2c3e3ccede34a618feac53b199d02 (diff)
downloadtrackermap-server-205ed7965ae97ee6cf14deb8ec4dc94cdae75dfe.tar.gz
trackermap-server-205ed7965ae97ee6cf14deb8ec4dc94cdae75dfe.tar.bz2
trackermap-server-205ed7965ae97ee6cf14deb8ec4dc94cdae75dfe.zip
Support RFTRACK commands
-rw-r--r--src/main/java/org/traccar/protocol/RfTrackProtocolDecoder.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/RfTrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/RfTrackProtocolDecoder.java
index 540c3ce0b..b3ebbbf9a 100644
--- a/src/main/java/org/traccar/protocol/RfTrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/RfTrackProtocolDecoder.java
@@ -23,6 +23,7 @@ import io.netty.handler.codec.http.QueryStringDecoder;
import org.traccar.BaseHttpProtocolDecoder;
import org.traccar.Protocol;
import org.traccar.model.CellTower;
+import org.traccar.model.Command;
import org.traccar.model.Network;
import org.traccar.model.Position;
import org.traccar.session.DeviceSession;
@@ -108,7 +109,11 @@ public class RfTrackProtocolDecoder extends BaseHttpProtocolDecoder {
position.setNetwork(network);
}
- sendResponse(channel, HttpResponseStatus.OK, Unpooled.copiedBuffer("{}", StandardCharsets.UTF_8));
+ String response = "{}";
+ for (Command command : getCommandsManager().readQueuedCommands(position.getDeviceId(), 1)) {
+ response = command.getString(Command.KEY_DATA);
+ }
+ sendResponse(channel, HttpResponseStatus.OK, Unpooled.copiedBuffer(response, StandardCharsets.UTF_8));
return position;
}