Class CMMqttEventCONNECT


public class CMMqttEventCONNECT extends CMMqttEventFixedHeader
This class represents a CM event that belongs to the variable header and payload of MQTT CONNECT packet.
See Also:
  • Constructor Details

    • CMMqttEventCONNECT

      public CMMqttEventCONNECT()
      Creates an instance of the CMMqttEventCONNECT class.
    • CMMqttEventCONNECT

      public CMMqttEventCONNECT(ByteBuffer msg)
  • Method Details

    • setVarHeader

      public void setVarHeader(byte connectFlag, int nKeepAlive)
      Sets the variable header of MQTT CONNECT packet.
      Parameters:
      connectFlag - - the connect flags
      nKeepAlive - - the keep-alive time
    • setProtocolName

      public void setProtocolName(String strName)
      Sets the protocol name.
      Parameters:
      strName - - the protocol name
    • getProtocolName

      public String 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 class CMMqttEvent
    • marshallVarHeader

      protected void marshallVarHeader()
      Specified by:
      marshallVarHeader in class CMMqttEvent
    • unmarshallVarHeader

      protected void unmarshallVarHeader(ByteBuffer buf)
      Specified by:
      unmarshallVarHeader in class CMMqttEvent
    • 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 ID
      strWillTopic - - the will topic
      strWillMessage - - the will message
      strUserName - - the user name
      strPassword - - the password
    • setClientID

      public void setClientID(String strClientID)
      Sets the client ID.
      Parameters:
      strClientID - - the client ID
    • getClientID

      public String getClientID()
      Returns the client ID.
      Returns:
      the client ID.
    • setWillTopic

      public void setWillTopic(String strWillTopic)
      Sets the will topic.
      Parameters:
      strWillTopic - - the will topic
    • getWillTopic

      public String getWillTopic()
      Returns the will topic.
      Returns:
      the will topic.
    • setWillMessage

      public void setWillMessage(String strWillMessage)
      Sets the will message.
      Parameters:
      strWillMessage - - the will message
    • getWillMessage

      public String getWillMessage()
      Returns the will message.
      Returns:
      the will message.
    • setUserName

      public void setUserName(String strUserName)
      Sets the user name.
      Parameters:
      strUserName - - the user name
    • getUserName

      public String getUserName()
      Returns the user name.
      Returns:
      the user name.
    • setPassword

      public void setPassword(String strPassword)
      Sets the password.
      Parameters:
      strPassword - - the password
    • getPassword

      public String getPassword()
      Returns the password.
      Returns:
      the password.
    • getPayloadByteNum

      protected int getPayloadByteNum()
      Specified by:
      getPayloadByteNum in class CMMqttEvent
    • marshallPayload

      protected void marshallPayload()
      Specified by:
      marshallPayload in class CMMqttEvent
    • unmarshallPayload

      protected void unmarshallPayload(ByteBuffer buf)
      Specified by:
      unmarshallPayload in class CMMqttEvent
    • toString

      public String toString()
      Description copied from class: CMMqttEventFixedHeader
      Returns the string representation of the CMMqttEventFixedHeader.
      Overrides:
      toString in class CMMqttEventFixedHeader
      Returns:
      string of this object.