public class Thing
extends java.lang.Object
Constructor and Description |
---|
Thing(ConnectOptions connectOptions)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(java.lang.String topic,
TopicListener listener)
Adds a listener on a specified topic.
|
void |
connect()
Connect the Thing to AWS IoT.
|
void |
disconnect()
Disconnect the Thing from AWS IoT.
|
boolean |
isConnected()
Check if the thing is connected.
|
void |
publish(java.lang.String topic,
byte[] data)
Publishes a message on a desired topic.
|
public Thing(ConnectOptions connectOptions)
connectOptions
- the options to be configured to be able to connect to the AWS IoT
platform.public void connect() throws IotCoreException
IotCoreException
- when connectedpublic void disconnect() throws IotCoreException
IotCoreException
- when not connectedpublic boolean isConnected()
public void publish(java.lang.String topic, byte[] data) throws IotCoreException
topic
- the topic to publish todata
- the messageIotCoreException
- if an error occurspublic void addListener(java.lang.String topic, TopicListener listener) throws IotCoreException
topic
- the topic to listen tolistener
- the listenerIotCoreException
- if an error occurs