From 2a61abfed15c12893290ee1d217103744f2697a6 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 29 Dec 2020 10:43:50 -0800 Subject: Fix IOTM responses --- src/main/java/org/traccar/protocol/IotmProtocolDecoder.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/main/java/org/traccar/protocol') 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)); -- cgit v1.2.3