public class MQTTLibrary
extends org.robotframework.javalib.library.AnnotationLibrary
| Modifier and Type | Field and Description |
|---|---|
static String |
KEYWORD_PATTERN |
static String |
ROBOT_LIBRARY_DOC_FORMAT |
static String |
ROBOT_LIBRARY_SCOPE |
static String |
ROBOT_LIBRARY_VERSION |
| Constructor and Description |
|---|
MQTTLibrary() |
| Modifier and Type | Method and Description |
|---|---|
void |
connectToMQTTBroker(String broker,
String clientId)
Connect to an MQTT broker.
|
void |
disconnectFromMQTTBroker()
Disconnect from MQTT Broker
|
String |
getKeywordDocumentation(String keywordName) |
void |
publishToMQTTSynchronously(String topic,
Object message)
Publish a message to a topic
|
void |
publishToMQTTSynchronously(String topic,
Object message,
int qos,
boolean retained)
Publish a message to a topic with specified qos and retained flag
|
void |
subscribeToMQTTAndValidate(String broker,
String clientId,
String topic,
String expectedPayload,
long timeout)
Subscribe to an MQTT broker and validate that a message with specified
payload is received
|
addKeywordPattern, autowireFields, createKeywordFactory, getKeywordArguments, runKeywordpublic static final String KEYWORD_PATTERN
public static final String ROBOT_LIBRARY_SCOPE
public static final String ROBOT_LIBRARY_VERSION
public static final String ROBOT_LIBRARY_DOC_FORMAT
public void connectToMQTTBroker(String broker, String clientId) throws org.eclipse.paho.client.mqttv3.MqttException
broker - Uri of the broker to connect toclientId - Client Idorg.eclipse.paho.client.mqttv3.MqttException - if there is an issue connecting to the brokerpublic void publishToMQTTSynchronously(String topic, Object message) throws org.eclipse.paho.client.mqttv3.MqttException
topic - topic to which the message will be publishedmessage - message payload to publishorg.eclipse.paho.client.mqttv3.MqttException - if there is an issue publishing to the brokerpublic void publishToMQTTSynchronously(String topic, Object message, int qos, boolean retained) throws org.eclipse.paho.client.mqttv3.MqttException
topic - topic to which the message will be publishedmessage - message payload to publishqos - qos of the messageretained - retained flagorg.eclipse.paho.client.mqttv3.MqttException - if there is an issue publishing to the brokerpublic void disconnectFromMQTTBroker()
public void subscribeToMQTTAndValidate(String broker, String clientId, String topic, String expectedPayload, long timeout)
broker - Uri of broker to subscribe toclientId - Client Idtopic - topic to subscribe toexpectedPayload - payload to validatetimeout - timeout for the payload to be receivedCopyright © 2015. All rights reserved.