public class ApplicationClient extends AbstractClient implements org.eclipse.paho.client.mqttv3.MqttCallbackExtended
CLIENT_ID_DELIMITER, config, DEFAULT_ACTION_TIMEOUT, DEFAULT_DISCONNECTED_BUFFER_SIZE, DEFAULT_MAX_CONNECT_ATTEMPTS, DEFAULT_MAX_INFLIGHT_MESSAGES, DEFAULT_MESSAGING_QOS, disconnectRequested, gson, messageCount, mqttAsyncClient, mqttCallback, mqttClient, mqttClientOptions, persistence| Constructor and Description |
|---|
ApplicationClient() |
ApplicationClient(ApplicationConfig config)
Create an application client for the IBM Watson IoT Platform.
|
| Modifier and Type | Method and Description |
|---|---|
void |
connectComplete(boolean reconnect,
String serverURI) |
void |
connectionLost(Throwable e)
Simply log error when connection is lost
|
void |
deliveryComplete(org.eclipse.paho.client.mqttv3.IMqttDeliveryToken token)
A completed deliver does not guarantee that the message is recieved by the service
because devices send messages with Quality of Service (QoS) 0.
|
void |
messageArrived(String topic,
org.eclipse.paho.client.mqttv3.MqttMessage msg) |
boolean |
publishCommand(String typeId,
String deviceId,
String commandId,
Object data) |
boolean |
publishCommand(String typeId,
String deviceId,
String commandId,
Object data,
int qos)
Publish command to the IBM Watson IoT Platform.
|
boolean |
publishEvent(String typeId,
String deviceId,
String eventId,
Object data) |
boolean |
publishEvent(String typeId,
String deviceId,
String eventId,
Object data,
int qos)
Publish event, on the behalf of a device, to the IBM Watson IoT Platform.
|
void |
registerCodec(MessageCodec codec) |
void |
registerCommandCallback(CommandCallback callback) |
void |
registerEventCallback(EventCallback callback) |
void |
setStatusCallback(StatusCallback callback) |
void |
subscribeToApplicationStatus(String appId)
Subscribe to application status of the IBM Watson IoT Platform.
|
void |
subscribeToDeviceCommands(String typeId) |
void |
subscribeToDeviceCommands(String typeId,
String deviceId) |
void |
subscribeToDeviceCommands(String typeId,
String deviceId,
String commandId) |
void |
subscribeToDeviceCommands(String typeId,
String deviceId,
String commandId,
String format) |
void |
subscribeToDeviceCommands(String typeId,
String deviceId,
String commandId,
String format,
int qos)
Subscribe to device commands, on the behalf of a device, of the IBM Watson IoT Platform.
|
void |
subscribeToDeviceEvents() |
void |
subscribeToDeviceEvents(String typeId) |
void |
subscribeToDeviceEvents(String typeId,
String deviceId) |
void |
subscribeToDeviceEvents(String typeId,
String deviceId,
String eventId) |
void |
subscribeToDeviceEvents(String typeId,
String deviceId,
String eventId,
String format) |
void |
subscribeToDeviceEvents(String typeId,
String deviceId,
String eventId,
String format,
int qos)
Subscribe to device events of the IBM Watson IoT Platform.
|
void |
subscribeToDeviceStatus(String typeId,
String deviceId)
Subscribe to device status of the IBM Watson IoT Platform.
|
void |
unSubscribeFromApplicationStatus(String appId)
Unsubscribe from application status of the IBM Watson IoT Platform.
|
void |
unsubscribeFromDeviceCommands() |
void |
unsubscribeFromDeviceCommands(String typeId) |
void |
unsubscribeFromDeviceCommands(String typeId,
String commandId) |
void |
unsubscribeFromDeviceCommands(String typeId,
String deviceId,
String commandId)
Unsubscribe from device commands of the IBM Watson IoT Platform.
|
void |
unsubscribeFromDeviceEvents() |
void |
unsubscribeFromDeviceEvents(String typeId) |
void |
unsubscribeFromDeviceEvents(String typeId,
String deviceId) |
void |
unsubscribeFromDeviceEvents(String typeId,
String deviceId,
String eventId)
Unsubscribe from device events of the IBM Watson IoT Platform.
|
close, configureMqttClient, connect, disconnect, getConfig, isConnected, toStringpublic ApplicationClient(ApplicationConfig config) throws Exception
config - Configuration object for the clientException - Failure in parsing the propertiespublic boolean publishEvent(String typeId, String deviceId, String eventId, Object data, int qos)
typeId - object of String which denotes deviceTypedeviceId - object of String which denotes deviceIdeventId - object of String which denotes eventdata - Payload dataqos - Quality of Service, in int - can have values 0,1,2public boolean publishEvent(String typeId, String deviceId, String eventId, Object data)
public boolean publishCommand(String typeId, String deviceId, String commandId, Object data, int qos)
typeId - object of String which denotes deviceTypedeviceId - object of String which denotes deviceIdcommandId - object of String which denotes commanddata - Payload dataqos - Quality of Service, in int - can have values 0,1,2public boolean publishCommand(String typeId, String deviceId, String commandId, Object data)
public void subscribeToDeviceEvents(String typeId, String deviceId, String eventId, String format, int qos)
typeId - object of String which denotes deviceTypedeviceId - object of String which denotes deviceIdeventId - object of String which denotes eventformat - object of String which denotes formatqos - Quality of Service, in int - can have values 0,1,2public void subscribeToDeviceEvents(String typeId, String deviceId, String eventId, String format)
public void subscribeToDeviceEvents(String typeId, String deviceId, String eventId)
public void subscribeToDeviceEvents(String typeId)
public void subscribeToDeviceEvents()
public void unsubscribeFromDeviceEvents(String typeId, String deviceId, String eventId)
typeId - object of String which denotes deviceTypedeviceId - object of String which denotes deviceIdeventId - object of String which denotes eventpublic void unsubscribeFromDeviceEvents(String typeId)
public void unsubscribeFromDeviceEvents()
public void subscribeToDeviceCommands(String typeId, String deviceId, String commandId, String format, int qos)
typeId - object of String which denotes deviceTypedeviceId - object of String which denotes deviceIdcommandId - object of String which denotes commandformat - object of String which denotes formatqos - Quality of Service, in int - can have values 0,1,2public void subscribeToDeviceCommands(String typeId, String deviceId, String commandId, String format)
public void subscribeToDeviceCommands(String typeId, String deviceId, String commandId)
public void subscribeToDeviceCommands(String typeId)
public void unsubscribeFromDeviceCommands(String typeId, String deviceId, String commandId)
typeId - object of String which denotes deviceTypedeviceId - object of String which denotes deviceIdcommandId - object of String which denotes commandpublic void unsubscribeFromDeviceCommands(String typeId, String commandId)
public void unsubscribeFromDeviceCommands(String typeId)
public void unsubscribeFromDeviceCommands()
public void subscribeToDeviceStatus(String typeId, String deviceId)
typeId - object of String which denotes deviceTypedeviceId - object of String which denotes deviceIdpublic void subscribeToApplicationStatus(String appId)
appId - object of String which denotes the application uniquely in the organizationpublic void unSubscribeFromApplicationStatus(String appId)
appId - object of String which denotes the application uniquely in the organizationpublic void connectionLost(Throwable e)
connectionLost in interface org.eclipse.paho.client.mqttv3.MqttCallbackpublic void connectComplete(boolean reconnect,
String serverURI)
connectComplete in interface org.eclipse.paho.client.mqttv3.MqttCallbackExtendedpublic void deliveryComplete(org.eclipse.paho.client.mqttv3.IMqttDeliveryToken token)
deliveryComplete in interface org.eclipse.paho.client.mqttv3.MqttCallbackpublic void messageArrived(String topic, org.eclipse.paho.client.mqttv3.MqttMessage msg)
messageArrived in interface org.eclipse.paho.client.mqttv3.MqttCallbackpublic void registerCodec(MessageCodec codec)
public void registerCommandCallback(CommandCallback callback)
public void registerEventCallback(EventCallback callback)
public void setStatusCallback(StatusCallback callback)
Copyright © 2019. All rights reserved.