org.eclipse.paho.client.mqttv3.internal
Class ClientComms

java.lang.Object
  extended by org.eclipse.paho.client.mqttv3.internal.ClientComms

public class ClientComms
extends Object

Handles client communications with the server. Sends and receives MQTT V3 messages.


Field Summary
static String BUILD_LEVEL
           
static String VERSION
           
 
Constructor Summary
ClientComms(IMqttAsyncClient client, MqttClientPersistence persistence)
          Creates a new ClientComms object, using the specified module to handle the network calls.
 
Method Summary
 void close()
          Close and tidy up.
 void connect(MqttConnectOptions options, MqttToken token)
          Sends a connect message and waits for an ACK or NACK.
 void connectComplete(MqttConnack cack, MqttException mex)
           
protected  void deliveryComplete(MqttPublish msg)
           
 void disconnect(MqttDisconnect disconnect, long quiesceTimeout, MqttToken token)
           
 IMqttAsyncClient getClient()
           
 ClientState getClientState()
           
 MqttConnectOptions getConOptions()
           
 Properties getDebug()
           
 long getKeepAlive()
           
 int getNetworkModuleIndex()
           
 NetworkModule[] getNetworkModules()
           
 MqttDeliveryToken[] getPendingDeliveryTokens()
           
protected  MqttTopic getTopic(String topic)
           
 boolean isClosed()
           
 boolean isConnected()
           
 boolean isConnecting()
           
 boolean isDisconnected()
           
 boolean isDisconnecting()
           
 void sendNoWait(MqttWireMessage message, MqttToken token)
          Sends a message to the broker if in connected state, but only waits for the message to be stored, before returning.
 void setCallback(MqttCallback mqttCallback)
           
 void setNetworkModuleIndex(int index)
           
 void setNetworkModules(NetworkModule[] networkModules)
           
 void shutdownConnection(MqttToken token, MqttException reason)
          Shuts down the connection to the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static String VERSION

BUILD_LEVEL

public static String BUILD_LEVEL
Constructor Detail

ClientComms

public ClientComms(IMqttAsyncClient client,
                   MqttClientPersistence persistence)
            throws MqttException
Creates a new ClientComms object, using the specified module to handle the network calls.

Throws:
MqttException
Method Detail

sendNoWait

public void sendNoWait(MqttWireMessage message,
                       MqttToken token)
                throws MqttException
Sends a message to the broker if in connected state, but only waits for the message to be stored, before returning.

Throws:
MqttException

close

public void close()
           throws MqttException
Close and tidy up. Call each main class and let it tidy up e.g. releasing the token store which normally survives a disconnect.

Throws:
MqttException - if not disconnected

connect

public void connect(MqttConnectOptions options,
                    MqttToken token)
             throws MqttException
Sends a connect message and waits for an ACK or NACK. Connecting is a special case which will also start up the network connection, receive thread, and keep alive thread.

Throws:
MqttException

connectComplete

public void connectComplete(MqttConnack cack,
                            MqttException mex)
                     throws MqttException
Throws:
MqttException

shutdownConnection

public void shutdownConnection(MqttToken token,
                               MqttException reason)
Shuts down the connection to the server. This may have been invoked as a result of a user calling disconnect or an abnormal disconnection. The method may be invoked multiple times in parallel as each thread when it receives an error uses this method to ensure that shutdown completes successfully.


disconnect

public void disconnect(MqttDisconnect disconnect,
                       long quiesceTimeout,
                       MqttToken token)
                throws MqttException
Throws:
MqttException

isConnected

public boolean isConnected()

isConnecting

public boolean isConnecting()

isDisconnected

public boolean isDisconnected()

isDisconnecting

public boolean isDisconnecting()

isClosed

public boolean isClosed()

setCallback

public void setCallback(MqttCallback mqttCallback)

getTopic

protected MqttTopic getTopic(String topic)

setNetworkModuleIndex

public void setNetworkModuleIndex(int index)

getNetworkModuleIndex

public int getNetworkModuleIndex()

getNetworkModules

public NetworkModule[] getNetworkModules()

setNetworkModules

public void setNetworkModules(NetworkModule[] networkModules)

getPendingDeliveryTokens

public MqttDeliveryToken[] getPendingDeliveryTokens()

deliveryComplete

protected void deliveryComplete(MqttPublish msg)
                         throws MqttPersistenceException
Throws:
MqttPersistenceException

getClient

public IMqttAsyncClient getClient()

getKeepAlive

public long getKeepAlive()

getClientState

public ClientState getClientState()

getConOptions

public MqttConnectOptions getConOptions()

getDebug

public Properties getDebug()


Copyright © 2013. All Rights Reserved.