Skip to content

Commit 6655ca2

Browse files
author
Ian Craggs
committed
MQTT V5 common packet updates
1 parent ed6d093 commit 6655ca2

5 files changed

Lines changed: 17 additions & 7 deletions

File tree

org.eclipse.paho.mqttv5.common/src/main/java/org/eclipse/paho/mqttv5/common/packet/MqttAck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2016 IBM Corp.
2+
* Copyright (c) 2016, 2019 IBM Corp.
33
*
44
* All rights reserved. This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License v1.0
@@ -19,7 +19,7 @@
1919
/**
2020
* Abstract super-class of all acknowledgement messages.
2121
*/
22-
public abstract class MqttAck extends MqttWireMessage {
22+
public abstract class MqttAck extends MqttPersistableWireMessage {
2323
public MqttAck(byte type) {
2424
super(type);
2525
}

org.eclipse.paho.mqttv5.common/src/main/java/org/eclipse/paho/mqttv5/common/packet/MqttDataTypes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class MqttDataTypes {
1515

1616
private static final int TWO_BYTE_INT_MAX = 65535;
1717
private static final long FOUR_BYTE_INT_MAX = 4294967295L;
18-
private static final int VARIABLE_BYTE_INT_MAX = 268435455;
18+
public static final int VARIABLE_BYTE_INT_MAX = 268435455;
1919

2020
public MqttDataTypes() throws IllegalAccessException {
2121
throw new IllegalAccessException("Utility Class");

org.eclipse.paho.mqttv5.common/src/main/java/org/eclipse/paho/mqttv5/common/packet/MqttSubscribe.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2016 IBM Corp.
2+
* Copyright (c) 2016, 2019 IBM Corp.
33
*
44
* All rights reserved. This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License v1.0
@@ -28,7 +28,7 @@
2828
import org.eclipse.paho.mqttv5.common.MqttSubscription;
2929
import org.eclipse.paho.mqttv5.common.packet.util.CountingInputStream;
3030

31-
public class MqttSubscribe extends MqttWireMessage {
31+
public class MqttSubscribe extends MqttPersistableWireMessage {
3232

3333
private static final Byte[] validProperties = { MqttProperties.SUBSCRIPTION_IDENTIFIER,
3434
MqttProperties.SUBSCRIPTION_IDENTIFIER_SINGLE,

org.eclipse.paho.mqttv5.common/src/main/java/org/eclipse/paho/mqttv5/common/packet/MqttUnsubscribe.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2016 IBM Corp.
2+
* Copyright (c) 2016, 2019 IBM Corp.
33
*
44
* All rights reserved. This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License v1.0
@@ -27,7 +27,7 @@
2727
import org.eclipse.paho.mqttv5.common.MqttException;
2828
import org.eclipse.paho.mqttv5.common.packet.util.CountingInputStream;
2929

30-
public class MqttUnsubscribe extends MqttWireMessage{
30+
public class MqttUnsubscribe extends MqttPersistableWireMessage{
3131

3232
private static final Byte[] validProperties = { MqttProperties.USER_DEFINED_PAIR_IDENTIFIER };
3333

org.eclipse.paho.mqttv5.common/src/main/java/org/eclipse/paho/mqttv5/common/packet/MqttWireMessage.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,5 +403,15 @@ public int[] getReasonCodes() {
403403
return null;
404404
}
405405
}
406+
407+
public byte[] serialize() throws MqttException {
408+
byte[] a = getHeader();
409+
byte[] b = getPayload();
410+
411+
byte[] c = new byte[a.length + b.length];
412+
System.arraycopy(a, 0, c, 0, a.length);
413+
System.arraycopy(b, 0, c, a.length, b.length);
414+
return c;
415+
}
406416

407417
}

0 commit comments

Comments
 (0)