com.esf.net.mqtt.client.service
Interface IEsfMqttCloudClient

All Superinterfaces:
IEsfMqttClient

public interface IEsfMqttCloudClient
extends IEsfMqttClient


Field Summary
static java.lang.String SERVICE_NAME
          Reports the class name representing this interface.
 
Method Summary
 void disableConnectionLostTimeout()
          Disables the connection lost timeout option.
 void enableConnectionLostTimeout(long timeout)
          Enables the connection lost timeout option within the client.
 int publish(java.lang.String sensorId, java.lang.String topic, byte[] payload, int qos)
          Publishes a message to the MQtt broker.
 int subscribe(java.lang.String sensorId, EsfMqttSubscription subscription)
          Subscribes to a topic with the MQtt broker.
 int subscribe(java.lang.String sensorId, EsfMqttSubscription[] subscriptions)
          Subscribes to one or more topics with the MQtt broker.
 int subscribe(java.lang.String sensorId, java.lang.String topic, int qos)
          Subscribes to a topic with the MQtt broker.
 int unsubscribe(java.lang.String sensorId, EsfMqttSubscription subscription)
          Unsubscribes from a topic with the MQtt broker.
 int unsubscribe(java.lang.String sensorId, java.lang.String topic)
          Unsubscribes from a topic with the MQtt broker.
 
Methods inherited from interface com.esf.net.mqtt.client.service.IEsfMqttClient
connect, disconnect, getClientId, getPassword, getSubscriptions, getUsername, isConnected, publish, registerCallback, setBrokerAddress, setBrokerPort, setCleanStart, setClientId, setKeepAlive, setPassword, setUsername, subscribe, subscribe, subscribe, unsubscribe, unsubscribe
 

Field Detail

SERVICE_NAME

static final java.lang.String SERVICE_NAME
Reports the class name representing this interface.

Method Detail

publish

int publish(java.lang.String sensorId,
            java.lang.String topic,
            byte[] payload,
            int qos)
            throws EsfMqttException
Publishes a message to the MQtt broker.

Parameters:
sensorId - A String specifying the sensor ID.
topic - A String specifying the topic the message was published on.
payload - An array of bytes containing the payload of the message.
qos - An integer specifying the quality of service the message was published on.
Returns:
The published message's ID.
Throws:
EsfMqttException

subscribe

int subscribe(java.lang.String sensorId,
              EsfMqttSubscription[] subscriptions)
              throws EsfMqttException
Subscribes to one or more topics with the MQtt broker. The topics are specified as an array of EsfMqttSubscription objects. If the subscribe fails, an exception will be thrown that will contain information about the cause of the failure.

Parameters:
sensorId - A String specifying the sensor ID.
subscriptions - An array of EsfMqttSubscription objects.
Returns:
The subscribe message's ID.
Throws:
EsfMqttException

subscribe

int subscribe(java.lang.String sensorId,
              EsfMqttSubscription subscription)
              throws EsfMqttException
Subscribes to a topic with the MQtt broker. The topic and QoS are specified in an EsfMqttSubscription object. If the subscribe fails, an exception will be thrown that will contain information about the cause of the failure.

Parameters:
sensorId - A String specifying the sensor ID.
subscription - An EsfMqttSubscription object.
Returns:
The subscribe message's ID.
Throws:
EsfMqttException

subscribe

int subscribe(java.lang.String sensorId,
              java.lang.String topic,
              int qos)
              throws EsfMqttException
Subscribes to a topic with the MQtt broker. The topic is specified as a String object and the QoS is specified as an interger. If the subscribe fails, an exception will be thrown that will contain information about the cause of the failure.

Parameters:
sensorId - A String specifying the sensor ID.
topic - A String object containing the topic.
qos - An int containing the Quality of Service.
Returns:
The subscribe message's ID.
Throws:
EsfMqttException

unsubscribe

int unsubscribe(java.lang.String sensorId,
                EsfMqttSubscription subscription)
                throws EsfMqttException
Unsubscribes from a topic with the MQtt broker. An EsfMqttSubscription topic is specified that contains the topic in which to unsubscribe from. If the unsubscribe fails, an exception will be thrown that will contain information about the cause of the failure.

Parameters:
sensorId - A String specifying the sensor ID.
subscription - A EsfMqttSubscription object containing the topic.
Returns:
The unsubscribe message's ID.
Throws:
EsfMqttException

unsubscribe

int unsubscribe(java.lang.String sensorId,
                java.lang.String topic)
                throws EsfMqttException
Unsubscribes from a topic with the MQtt broker. A String object is specified which contains the topic in which to unsubscribe from. If the unsubscribe fails, an exception will be thrown that will contain information about the cause of the failure.

Parameters:
sensorId - A String specifying the sensor ID.
topic - A String object containing the topic.
Returns:
The unsubscribe message's ID.
Throws:
EsfMqttException

enableConnectionLostTimeout

void enableConnectionLostTimeout(long timeout)
Enables the connection lost timeout option within the client. When a connection with the broker is lost, a thread will start that will reboot the unit if the connection is not restablished within the specified timeout (in seconds).

Parameters:
timeout - The number of seconds the unit can be disconnected before rebooting.

disableConnectionLostTimeout

void disableConnectionLostTimeout()
Disables the connection lost timeout option.