diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-02-27 09:54:18 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-02-27 09:54:18 -0800 |
commit | cde8be159a846a76908b961dc7a9f5b925b5289d (patch) | |
tree | 2c04c817d3460564c3b69e4bdceee6c6226981f1 /src/main/java/org | |
parent | 8d1bb744f845cb605417229e000d49d9cd58b54b (diff) | |
download | trackermap-server-cde8be159a846a76908b961dc7a9f5b925b5289d.tar.gz trackermap-server-cde8be159a846a76908b961dc7a9f5b925b5289d.tar.bz2 trackermap-server-cde8be159a846a76908b961dc7a9f5b925b5289d.zip |
Implement response
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/traccar/protocol/DolphinProtocolDecoder.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/DolphinProtocolDecoder.java b/src/main/java/org/traccar/protocol/DolphinProtocolDecoder.java index 56d9314b2..8e57b18b5 100644 --- a/src/main/java/org/traccar/protocol/DolphinProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/DolphinProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Anton Tananaev (anton@traccar.org) + * Copyright 2020 - 2021 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. @@ -17,9 +17,11 @@ package org.traccar.protocol; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufUtil; +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.Protocol; import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; @@ -61,6 +63,14 @@ public class DolphinProtocolDecoder extends BaseProtocolDecoder { DolphinMessages.DataPackRequest message = DolphinMessages.DataPackRequest.parseFrom( ByteBufUtil.getBytes(buf, buf.readerIndex(), length, false)); + if (channel != null) { + DolphinMessages.DataPackResponse response = DolphinMessages.DataPackResponse.newBuilder() + .setResponse(DolphinMessages.DataPackResponseCode.DataPack_OK) + .build(); + channel.writeAndFlush(new NetworkMessage( + Unpooled.wrappedBuffer(response.toByteArray()), remoteAddress)); + } + List<Position> positions = new LinkedList<>(); for (int i = 0; i < message.getPointsCount(); i++) { |