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_packetType
Fields inherited from class kr.ac.konkuk.ccslab.cm.event.mqttevent.CMMqttEvent
CONNACK, CONNECT, DISCONNECT, PINGREQ, PINGRESP, PUBACK, PUBCOMP, PUBLISH, PUBREC, PUBREL, SUBACK, SUBSCRIBE, UNSUBACK, UNSUBSCRIBE
Fields 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.byte
Returns the connect flags.int
Returns the keep-alive time.Returns the password.protected int
byte
Returns the protocol level.Returns the protocol name.Returns the user name.protected int
Returns the will message.byte
Returns the will QoS.Returns the will topic.boolean
Returns the clean session flag.boolean
Returns the password flag.boolean
Returns the user name flag.boolean
Returns the will flag.boolean
Returns the will retain flag.protected void
protected void
void
setCleanSessionFlag
(boolean bCleanSession) Sets the clean session flag.void
setClientID
(String strClientID) Sets the client ID.void
setConnFlag
(byte flag) Sets the connect flags.void
setKeepAlive
(int seconds) Sets the keep-alive time.void
setPassword
(String strPassword) Sets the password.void
setPasswordFlag
(boolean bPassword) Sets the password flag.void
setPayload
(String strClientID, String strWillTopic, String strWillMessage, String strUserName, String strPassword) Sets the payload of the MQTT CONNECT packet.void
setProtocolLevel
(byte level) Sets the protocol level.void
setProtocolName
(String strName) Sets the protocol name.void
setUserName
(String strUserName) Sets the user name.void
setUserNameFlag
(boolean bUser) Sets the user name flag.void
setVarHeader
(byte connectFlag, int nKeepAlive) Sets the variable header of MQTT CONNECT packet.void
setWillFlag
(boolean bWill) Sets the will flag.void
setWillMessage
(String strWillMessage) Sets the will message.void
setWillQoS
(byte qos) Sets the will QoS.void
setWillRetainFlag
(boolean bWillRetain) Sets the will retain flag.void
setWillTopic
(String strWillTopic) Sets the will topic.toString()
Returns the string representation of the CMMqttEventFixedHeader.protected void
protected void
Methods inherited from class kr.ac.konkuk.ccslab.cm.event.mqttevent.CMMqttEventFixedHeader
getBinaryString, getBinaryStringOfByte, getFixedHeaderByteNum, getFlag, getPacketType, getRemainingLength, marshallFixedHeader, setFixedHeader, setFlag, setPacketType, setRemainingLength, unmarshallFixedHeader
Methods inherited from class kr.ac.konkuk.ccslab.cm.event.mqttevent.CMMqttEvent
getByteNum, getPacketID, marshallBody, unmarshallBody
Methods 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:
getVarHeaderByteNum
in classCMMqttEvent
-
marshallVarHeader
protected void marshallVarHeader()- Specified by:
marshallVarHeader
in classCMMqttEvent
-
unmarshallVarHeader
- Specified by:
unmarshallVarHeader
in 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:
getPayloadByteNum
in classCMMqttEvent
-
marshallPayload
protected void marshallPayload()- Specified by:
marshallPayload
in classCMMqttEvent
-
unmarshallPayload
- Specified by:
unmarshallPayload
in classCMMqttEvent
-
toString
Description copied from class:CMMqttEventFixedHeader
Returns the string representation of the CMMqttEventFixedHeader.- Overrides:
toString
in classCMMqttEventFixedHeader
- Returns:
- string of this object.
-