aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar')
-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));