aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <atananaev@lyft.com>2020-12-29 10:43:50 -0800
committerAnton Tananaev <atananaev@lyft.com>2020-12-29 10:45:10 -0800
commit2a61abfed15c12893290ee1d217103744f2697a6 (patch)
tree69c1022b418ead92ca070ed5eca555da52a2d0e7 /src/main/java/org/traccar/protocol
parent980d87ad01e5d962406e1f2d75c8584c5a00cf81 (diff)
downloadtraccar-server-2a61abfed15c12893290ee1d217103744f2697a6.tar.gz
traccar-server-2a61abfed15c12893290ee1d217103744f2697a6.tar.bz2
traccar-server-2a61abfed15c12893290ee1d217103744f2697a6.zip
Fix IOTM responses
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/IotmProtocolDecoder.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java b/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java
index e172f6ab2..0c8954ae9 100644
--- a/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java
@@ -117,7 +117,11 @@ public class IotmProtocolDecoder extends BaseProtocolDecoder {
} else if (msg instanceof MqttSubscribeMessage) {
- MqttMessage response = MqttMessageBuilders.subAck().packetId((short) 1).build();
+ MqttPublishMessage message = (MqttPublishMessage) msg;
+
+ MqttMessage response = MqttMessageBuilders.subAck()
+ .packetId((short) message.variableHeader().packetId())
+ .build();
if (channel != null) {
channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
@@ -184,7 +188,9 @@ public class IotmProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // checksum
- MqttMessage response = MqttMessageBuilders.pubAck().packetId((short) 1).build();
+ MqttMessage response = MqttMessageBuilders.pubAck()
+ .packetId((short) message.variableHeader().packetId())
+ .build();
if (channel != null) {
channel.writeAndFlush(new NetworkMessage(response, remoteAddress));