diff options
-rw-r--r-- | src/org/traccar/protocol/PricolProtocolDecoder.java | 5 | ||||
-rw-r--r-- | test/org/traccar/protocol/PricolProtocolDecoderTest.java | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/PricolProtocolDecoder.java b/src/org/traccar/protocol/PricolProtocolDecoder.java index 8a84109ca..52b68cca6 100644 --- a/src/org/traccar/protocol/PricolProtocolDecoder.java +++ b/src/org/traccar/protocol/PricolProtocolDecoder.java @@ -16,6 +16,7 @@ package org.traccar.protocol; import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.DeviceSession; @@ -85,6 +86,10 @@ public class PricolProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium()); position.set(Position.KEY_RPM, buf.readUnsignedShort()); + if (channel != null) { + channel.write(ChannelBuffers.copiedBuffer("ACK", StandardCharsets.US_ASCII)); + } + return position; } diff --git a/test/org/traccar/protocol/PricolProtocolDecoderTest.java b/test/org/traccar/protocol/PricolProtocolDecoderTest.java index 6c7837f76..3826d56c4 100644 --- a/test/org/traccar/protocol/PricolProtocolDecoderTest.java +++ b/test/org/traccar/protocol/PricolProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class PricolProtocolDecoderTest extends ProtocolTest { PricolProtocolDecoder decoder = new PricolProtocolDecoder(new PricolProtocol()); + verifyNotNull(decoder, binary( + "3c544553303030324b02000000000000000000000000000000000000000000000000000000037c01f4000000000000000000000000000000000000000000003e")); + verifyPosition(decoder, binary( "3c4944303030303150FFFFFFFF1C050C121D38045D09FA4e001DE815F4452FFFFFFFFFFF03FF03FF03FF03FF03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF113e")); |