public class ClientComms
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BUILD_LEVEL |
static java.lang.String |
VERSION |
Constructor and Description |
---|
ClientComms(IMqttAsyncClient client,
MqttClientPersistence persistence,
MqttPingSender pingSender)
Creates a new ClientComms object, using the specified module to handle
the network calls.
|
Modifier and Type | Method and Description |
---|---|
MqttToken |
checkForActivity() |
MqttToken |
checkForActivity(IMqttActionListener pingCallback) |
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) |
void |
deleteBufferedMessage(int bufferIndex) |
void |
disconnect(MqttDisconnect disconnect,
long quiesceTimeout,
MqttToken token) |
void |
disconnectForcibly(long quiesceTimeout,
long disconnectTimeout)
Disconnect the connection and reset all the states.
|
MqttMessage |
getBufferedMessage(int bufferIndex) |
int |
getBufferedMessageCount() |
IMqttAsyncClient |
getClient() |
ClientState |
getClientState() |
MqttConnectOptions |
getConOptions() |
java.util.Properties |
getDebug() |
long |
getKeepAlive() |
int |
getNetworkModuleIndex() |
NetworkModule[] |
getNetworkModules() |
MqttDeliveryToken[] |
getPendingDeliveryTokens() |
boolean |
isClosed() |
boolean |
isConnected() |
boolean |
isConnecting() |
boolean |
isDisconnected() |
boolean |
isDisconnecting() |
boolean |
isResting() |
void |
messageArrivedComplete(int messageId,
int qos) |
void |
notifyReconnect()
When the client automatically reconnects, we want to send all messages from the
buffer first before allowing the user to send any messages
|
void |
removeMessageListener(java.lang.String topicFilter) |
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 |
setDisconnectedMessageBuffer(DisconnectedMessageBuffer disconnectedMessageBuffer) |
void |
setManualAcks(boolean manualAcks) |
void |
setMessageListener(java.lang.String topicFilter,
IMqttMessageListener messageListener) |
void |
setNetworkModuleIndex(int index) |
void |
setNetworkModules(NetworkModule[] networkModules) |
void |
setReconnectCallback(MqttCallbackExtended callback) |
void |
setRestingState(boolean resting)
When Automatic reconnect is enabled, we want ClientComs to enter the
'resting' state if disconnected.
|
void |
shutdownConnection(MqttToken token,
MqttException reason)
Shuts down the connection to the server.
|
public static java.lang.String VERSION
public static java.lang.String BUILD_LEVEL
public ClientComms(IMqttAsyncClient client, MqttClientPersistence persistence, MqttPingSender pingSender) throws MqttException
MqttException
public void sendNoWait(MqttWireMessage message, MqttToken token) throws MqttException
MqttException
public void close() throws MqttException
MqttException
- if not disconnectedpublic void connect(MqttConnectOptions options, MqttToken token) throws MqttException
MqttException
public void connectComplete(MqttConnack cack, MqttException mex) throws MqttException
MqttException
public void shutdownConnection(MqttToken token, MqttException reason)
public void disconnect(MqttDisconnect disconnect, long quiesceTimeout, MqttToken token) throws MqttException
MqttException
public void disconnectForcibly(long quiesceTimeout, long disconnectTimeout) throws MqttException
MqttException
public boolean isConnected()
public boolean isConnecting()
public boolean isDisconnected()
public boolean isDisconnecting()
public boolean isClosed()
public boolean isResting()
public void setCallback(MqttCallback mqttCallback)
public void setReconnectCallback(MqttCallbackExtended callback)
public void setManualAcks(boolean manualAcks)
public void messageArrivedComplete(int messageId, int qos) throws MqttException
MqttException
public void setMessageListener(java.lang.String topicFilter, IMqttMessageListener messageListener)
public void removeMessageListener(java.lang.String topicFilter)
public void setNetworkModuleIndex(int index)
public int getNetworkModuleIndex()
public NetworkModule[] getNetworkModules()
public void setNetworkModules(NetworkModule[] networkModules)
public MqttDeliveryToken[] getPendingDeliveryTokens()
public IMqttAsyncClient getClient()
public long getKeepAlive()
public ClientState getClientState()
public MqttConnectOptions getConOptions()
public java.util.Properties getDebug()
public MqttToken checkForActivity()
public MqttToken checkForActivity(IMqttActionListener pingCallback)
public void setRestingState(boolean resting)
resting
- public void setDisconnectedMessageBuffer(DisconnectedMessageBuffer disconnectedMessageBuffer)
public int getBufferedMessageCount()
public MqttMessage getBufferedMessage(int bufferIndex)
public void deleteBufferedMessage(int bufferIndex)
public void notifyReconnect()
MqttException