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() |
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) |
void |
disconnectForcibly(long quiesceTimeout,
long disconnectTimeout)
Disconnect the connection and reset all the states.
|
IMqttAsyncClient |
getClient() |
ClientState |
getClientState() |
MqttConnectOptions |
getConOptions() |
java.util.Properties |
getDebug() |
long |
getKeepAlive() |
int |
getNetworkModuleIndex() |
NetworkModule[] |
getNetworkModules() |
MqttDeliveryToken[] |
getPendingDeliveryTokens() |
protected MqttTopic |
getTopic(java.lang.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.
|
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(@Nullable MqttToken token, @Nullable 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 void setCallback(MqttCallback mqttCallback)
protected MqttTopic getTopic(java.lang.String topic)
public void setNetworkModuleIndex(int index)
public int getNetworkModuleIndex()
@Nullable public NetworkModule[] getNetworkModules()
public void setNetworkModules(NetworkModule[] networkModules)
public MqttDeliveryToken[] getPendingDeliveryTokens()
protected void deliveryComplete(MqttPublish msg) throws MqttPersistenceException
MqttPersistenceException
public IMqttAsyncClient getClient()
public long getKeepAlive()
@Nullable public ClientState getClientState()
public MqttConnectOptions getConOptions()
public java.util.Properties getDebug()
@Nullable public MqttToken checkForActivity()