Class CMMqttEventCONNECT
java.lang.Object
kr.ac.konkuk.ccslab.cm.entity.CMObject
kr.ac.konkuk.ccslab.cm.event.CMEvent
kr.ac.konkuk.ccslab.cm.event.mqttevent.CMMqttEvent
kr.ac.konkuk.ccslab.cm.event.mqttevent.CMMqttEventFixedHeader
kr.ac.konkuk.ccslab.cm.event.mqttevent.CMMqttEventCONNECT
This class represents a CM event that belongs to the variable header and payload of
MQTT CONNECT packet.
-
Field Summary
Fields inherited from class kr.ac.konkuk.ccslab.cm.event.mqttevent.CMMqttEventFixedHeader
m_flag, m_nRemainingLength, m_packetTypeFields inherited from class kr.ac.konkuk.ccslab.cm.event.mqttevent.CMMqttEvent
CONNACK, CONNECT, DISCONNECT, PINGREQ, PINGRESP, PUBACK, PUBCOMP, PUBLISH, PUBREC, PUBREL, SUBACK, SUBSCRIBE, UNSUBACK, UNSUBSCRIBEFields inherited from class kr.ac.konkuk.ccslab.cm.event.CMEvent
m_bytes, m_nByteNum, m_nID, m_strDistributionGroup, m_strDistributionSession, m_strHandlerGroup, m_strHandlerSession, m_strReceiver, m_strSender -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of the CMMqttEventCONNECT class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the client ID.byteReturns the connect flags.intReturns the keep-alive time.Returns the password.protected intbyteReturns the protocol level.Returns the protocol name.Returns the user name.protected intReturns the will message.byteReturns the will QoS.Returns the will topic.booleanReturns the clean session flag.booleanReturns the password flag.booleanReturns the user name flag.booleanReturns the will flag.booleanReturns the will retain flag.protected voidprotected voidvoidsetCleanSessionFlag(boolean bCleanSession) Sets the clean session flag.voidsetClientID(String strClientID) Sets the client ID.voidsetConnFlag(byte flag) Sets the connect flags.voidsetKeepAlive(int seconds) Sets the keep-alive time.voidsetPassword(String strPassword) Sets the password.voidsetPasswordFlag(boolean bPassword) Sets the password flag.voidsetPayload(String strClientID, String strWillTopic, String strWillMessage, String strUserName, String strPassword) Sets the payload of the MQTT CONNECT packet.voidsetProtocolLevel(byte level) Sets the protocol level.voidsetProtocolName(String strName) Sets the protocol name.voidsetUserName(String strUserName) Sets the user name.voidsetUserNameFlag(boolean bUser) Sets the user name flag.voidsetVarHeader(byte connectFlag, int nKeepAlive) Sets the variable header of MQTT CONNECT packet.voidsetWillFlag(boolean bWill) Sets the will flag.voidsetWillMessage(String strWillMessage) Sets the will message.voidsetWillQoS(byte qos) Sets the will QoS.voidsetWillRetainFlag(boolean bWillRetain) Sets the will retain flag.voidsetWillTopic(String strWillTopic) Sets the will topic.toString()Returns the string representation of the CMMqttEventFixedHeader.protected voidprotected voidMethods inherited from class kr.ac.konkuk.ccslab.cm.event.mqttevent.CMMqttEventFixedHeader
getBinaryString, getBinaryStringOfByte, getFixedHeaderByteNum, getFlag, getPacketType, getRemainingLength, marshallFixedHeader, setFixedHeader, setFlag, setPacketType, setRemainingLength, unmarshallFixedHeaderMethods inherited from class kr.ac.konkuk.ccslab.cm.event.mqttevent.CMMqttEvent
getByteNum, getPacketID, marshallBody, unmarshallBodyMethods inherited from class kr.ac.konkuk.ccslab.cm.event.CMEvent
allocate, equals, getDistributionGroup, getDistributionSession, getHandlerGroup, getHandlerSession, getID, getInt2BytesFromByteBuffer, getReceiver, getSender, getStringFromByteBuffer, marshall, marshallHeader, putInt2BytesToByteBuffer, putStringToByteBuffer, setByteNum, setDistributionGroup, setDistributionSession, setHandlerGroup, setHandlerSession, setID, setReceiver, setSender, unmarshall, unmarshallHeader
-
Constructor Details
-
CMMqttEventCONNECT
public CMMqttEventCONNECT()Creates an instance of the CMMqttEventCONNECT class. -
CMMqttEventCONNECT
-
-
Method Details
-
setVarHeader
public void setVarHeader(byte connectFlag, int nKeepAlive) Sets the variable header of MQTT CONNECT packet.- Parameters:
connectFlag- - the connect flagsnKeepAlive- - the keep-alive time
-
setProtocolName
Sets the protocol name.- Parameters:
strName- - the protocol name
-
getProtocolName
Returns the protocol name.- Returns:
- the protocol name.
-
setProtocolLevel
public void setProtocolLevel(byte level) Sets the protocol level.- Parameters:
level- - the protocol level.
-
getProtocolLevel
public byte getProtocolLevel()Returns the protocol level.- Returns:
- the protocol level.
-
setConnFlag
public void setConnFlag(byte flag) Sets the connect flags.- Parameters:
flag- - the connect flags
-
getConnFlag
public byte getConnFlag()Returns the connect flags.- Returns:
- the connect flags.
-
setUserNameFlag
public void setUserNameFlag(boolean bUser) Sets the user name flag.- Parameters:
bUser- - the user name flag
-
isUserNameFlag
public boolean isUserNameFlag()Returns the user name flag.- Returns:
- true if the user name flag is set; false otherwise.
-
setPasswordFlag
public void setPasswordFlag(boolean bPassword) Sets the password flag.- Parameters:
bPassword- the password flag
-
isPasswordFlag
public boolean isPasswordFlag()Returns the password flag.- Returns:
- true if the password flag is set; false otherwise.
-
setWillRetainFlag
public void setWillRetainFlag(boolean bWillRetain) Sets the will retain flag.- Parameters:
bWillRetain- - the will retain flag
-
isWillRetainFlag
public boolean isWillRetainFlag()Returns the will retain flag.- Returns:
- true if the will retain flag is set; false otherwise.
-
setWillQoS
public void setWillQoS(byte qos) Sets the will QoS.- Parameters:
qos- - the will QoS
-
getWillQoS
public byte getWillQoS()Returns the will QoS.- Returns:
- the will QoS.
-
setWillFlag
public void setWillFlag(boolean bWill) Sets the will flag.- Parameters:
bWill- - the will flag
-
isWillFlag
public boolean isWillFlag()Returns the will flag.- Returns:
- the will flag.
-
setCleanSessionFlag
public void setCleanSessionFlag(boolean bCleanSession) Sets the clean session flag.- Parameters:
bCleanSession- - the clean session flag
-
isCleanSessionFlag
public boolean isCleanSessionFlag()Returns the clean session flag.- Returns:
- the clean session flag.
-
setKeepAlive
public void setKeepAlive(int seconds) Sets the keep-alive time.- Parameters:
seconds- - the keep-alive time
-
getKeepAlive
public int getKeepAlive()Returns the keep-alive time.- Returns:
- the keep-alive time.
-
getVarHeaderByteNum
protected int getVarHeaderByteNum()- Specified by:
getVarHeaderByteNumin classCMMqttEvent
-
marshallVarHeader
protected void marshallVarHeader()- Specified by:
marshallVarHeaderin classCMMqttEvent
-
unmarshallVarHeader
- Specified by:
unmarshallVarHeaderin classCMMqttEvent
-
setPayload
public void setPayload(String strClientID, String strWillTopic, String strWillMessage, String strUserName, String strPassword) Sets the payload of the MQTT CONNECT packet.- Parameters:
strClientID- - the client IDstrWillTopic- - the will topicstrWillMessage- - the will messagestrUserName- - the user namestrPassword- - the password
-
setClientID
Sets the client ID.- Parameters:
strClientID- - the client ID
-
getClientID
Returns the client ID.- Returns:
- the client ID.
-
setWillTopic
Sets the will topic.- Parameters:
strWillTopic- - the will topic
-
getWillTopic
Returns the will topic.- Returns:
- the will topic.
-
setWillMessage
Sets the will message.- Parameters:
strWillMessage- - the will message
-
getWillMessage
Returns the will message.- Returns:
- the will message.
-
setUserName
Sets the user name.- Parameters:
strUserName- - the user name
-
getUserName
Returns the user name.- Returns:
- the user name.
-
setPassword
Sets the password.- Parameters:
strPassword- - the password
-
getPassword
Returns the password.- Returns:
- the password.
-
getPayloadByteNum
protected int getPayloadByteNum()- Specified by:
getPayloadByteNumin classCMMqttEvent
-
marshallPayload
protected void marshallPayload()- Specified by:
marshallPayloadin classCMMqttEvent
-
unmarshallPayload
- Specified by:
unmarshallPayloadin classCMMqttEvent
-
toString
Description copied from class:CMMqttEventFixedHeaderReturns the string representation of the CMMqttEventFixedHeader.- Overrides:
toStringin classCMMqttEventFixedHeader- Returns:
- string of this object.
-