Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'apps/MQTTSN-UDP-Client/src/org/eclipse/paho/mqttsn/udpclient/messages/mqttsn/MqttsMessage.java')
-rw-r--r--apps/MQTTSN-UDP-Client/src/org/eclipse/paho/mqttsn/udpclient/messages/mqttsn/MqttsMessage.java91
1 files changed, 91 insertions, 0 deletions
diff --git a/apps/MQTTSN-UDP-Client/src/org/eclipse/paho/mqttsn/udpclient/messages/mqttsn/MqttsMessage.java b/apps/MQTTSN-UDP-Client/src/org/eclipse/paho/mqttsn/udpclient/messages/mqttsn/MqttsMessage.java
new file mode 100644
index 0000000..bd1c3f9
--- /dev/null
+++ b/apps/MQTTSN-UDP-Client/src/org/eclipse/paho/mqttsn/udpclient/messages/mqttsn/MqttsMessage.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2013 IBM Corp.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v1.0 which accompany this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Ian Craggs - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+
+package org.eclipse.paho.mqttsn.udpclient.messages.mqttsn;
+
+/**
+ * This object represents a Mqtts message. It is subclassed
+ * to create the appropriate Mqtts Message.
+ *
+ *
+ */
+public abstract class MqttsMessage {
+
+ //Mqtts message types
+ public static final int ADVERTISE = 0x00;
+ public static final int SEARCHGW = 0x01;
+ public static final int GWINFO = 0x02;
+ public static final int CONNECT = 0x04;
+ public static final int CONNACK = 0x05;
+ public static final int WILLTOPICREQ = 0x06;
+ public static final int WILLTOPIC = 0x07;
+ public static final int WILLMSGREQ = 0x08;
+ public static final int WILLMSG = 0x09;
+ public static final int REGISTER = 0x0A;
+ public static final int REGACK = 0x0B;
+ public static final int PUBLISH = 0x0C;
+ public static final int PUBACK = 0x0D;
+ public static final int PUBCOMP = 0x0E;
+ public static final int PUBREC = 0x0F;
+ public static final int PUBREL = 0x10;
+ public static final int SUBSCRIBE = 0x12;
+ public static final int SUBACK = 0x13;
+ public static final int UNSUBSCRIBE = 0x14;
+ public static final int UNSUBACK = 0x15;
+ public static final int PINGREQ = 0x16;
+ public static final int PINGRESP = 0x17;
+ public static final int DISCONNECT = 0x18;
+ public static final int WILLTOPICUPD = 0x1A;
+ public static final int WILLTOPICRESP = 0x1B;
+ public static final int WILLMSGUPD = 0x1C;
+ public static final int WILLMSGRESP = 0x1D;
+
+ //Mqtts message type
+ protected int msgType;
+
+ //Types of topic Ids
+ public final static int NORMAL_TOPIC_ID = 0;
+ public final static int PREDIFINED_TOPIC_ID = 1;
+
+ //Types of topic names
+ public final static int TOPIC_NAME = 0;
+ public final static int SHORT_TOPIC_NAME = 2;
+
+ //Return Code values
+ public final static int RETURN_CODE_ACCEPTED = 0;
+ public final static int RETURN_CODE_REJECTED_CONGESTION = 1;
+ public final static int RETURN_CODE_INVALID_TOPIC_ID = 2;
+
+ /**
+ * MqttsMessage default constructor.
+ */
+ public MqttsMessage() {}
+
+ /**
+ * This method is implemented in subclasses.
+ */
+ public abstract byte[] toBytes ();
+
+
+ public int getMsgType() {
+ return msgType;
+ }
+
+ public void setMsgType(int msgType) {
+ this.msgType = msgType;
+ }
+} \ No newline at end of file

Back to the top