-
public abstract class MqttWireMessageAn on-the-wire representation of an MQTT message.
-
-
Field Summary
Fields Modifier and Type Field Description public final static byteMESSAGE_TYPE_CONNECTpublic final static byteMESSAGE_TYPE_CONNACKpublic final static byteMESSAGE_TYPE_PUBLISHpublic final static byteMESSAGE_TYPE_PUBACKpublic final static byteMESSAGE_TYPE_PUBRECpublic final static byteMESSAGE_TYPE_PUBRELpublic final static byteMESSAGE_TYPE_PUBCOMPpublic final static byteMESSAGE_TYPE_SUBSCRIBEpublic final static byteMESSAGE_TYPE_SUBACKpublic final static byteMESSAGE_TYPE_UNSUBSCRIBEpublic final static byteMESSAGE_TYPE_UNSUBACKpublic final static byteMESSAGE_TYPE_PINGREQpublic final static byteMESSAGE_TYPE_PINGRESPpublic final static byteMESSAGE_TYPE_DISCONNECTprivate bytetypeprotected booleanduplicateprivate MqttTokentoken
-
Constructor Summary
Constructors Constructor Description MqttWireMessage(byte type)
-
Method Summary
Modifier and Type Method Description bytegetType()Returns the type of the message. voidsetDuplicate(boolean duplicate)MqttTokengetToken()Get the token associated with the message. voidsetToken(MqttToken token)Set the token associated with the message. Array<byte>getPayload()Sub-classes should override this method to supply the payload bytes. intgetMessageId()Returns the MQTT message ID. voidsetMessageId(int msgId)Sets the MQTT message ID. StringgetKey()Returns a key associated with the message. Array<byte>getHeader()booleanisMessageIdRequired()Returns whether or not this message needs to include a message ID. static MqttWireMessagecreateWireMessage(MqttPersistable data, String mqttVersion)static MqttWireMessagecreateWireMessage(Array<byte> bytes, String mqttVersion)booleanisRetryable()StringtoString()StringpacketName()-
-
Method Detail
-
getType
byte getType()
Returns the type of the message.
-
setDuplicate
void setDuplicate(boolean duplicate)
-
setToken
void setToken(MqttToken token)
Set the token associated with the message.
- Parameters:
token- the token associated with the message.
-
getPayload
Array<byte> getPayload()
Sub-classes should override this method to supply the payload bytes.
-
getMessageId
int getMessageId()
Returns the MQTT message ID.
-
setMessageId
void setMessageId(int msgId)
Sets the MQTT message ID.
-
getKey
String getKey()
Returns a key associated with the message. For most message types this will be unique. For connect, disconnect and ping only one message of this type is allowed so a fixed key will be returned
-
isMessageIdRequired
boolean isMessageIdRequired()
Returns whether or not this message needs to include a message ID.
-
createWireMessage
static MqttWireMessage createWireMessage(MqttPersistable data, String mqttVersion)
-
createWireMessage
static MqttWireMessage createWireMessage(Array<byte> bytes, String mqttVersion)
-
isRetryable
boolean isRetryable()
-
packetName
String packetName()
-
-
-
-