public class ClientComms extends Object
Modifier and Type | Field and Description |
---|---|
static String |
BUILD_LEVEL |
static 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() |
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.
|
public ClientComms(IMqttAsyncClient client, MqttClientPersistence persistence, MqttPingSender pingSender) 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
protected void deliveryComplete(MqttPublish msg) throws MqttPersistenceException
MqttPersistenceException
public void disconnect(MqttDisconnect disconnect, long quiesceTimeout, MqttToken token) throws MqttException
MqttException
public void disconnectForcibly(long quiesceTimeout, long disconnectTimeout) throws MqttException
MqttException
public IMqttAsyncClient getClient()
@Nullable public ClientState getClientState()
public MqttConnectOptions getConOptions()
public Properties getDebug()
public long getKeepAlive()
public int getNetworkModuleIndex()
@Nullable public NetworkModule[] getNetworkModules()
public MqttDeliveryToken[] getPendingDeliveryTokens()
public boolean isClosed()
public boolean isConnected()
public boolean isConnecting()
public boolean isDisconnected()
public boolean isDisconnecting()
public void sendNoWait(MqttWireMessage message, MqttToken token) throws MqttException
MqttException
public void setCallback(MqttCallback mqttCallback)
public void setNetworkModuleIndex(int index)
public void setNetworkModules(NetworkModule[] networkModules)
public void shutdownConnection(@Nullable MqttToken token, @Nullable MqttException reason)