/** * Get the status of a specific client * * @param clientHandle * identifies the MqttConnection to use * @return true if the specified client is connected to an MQTT server */ public boolean isConnected(String clientHandle) { MqttConnection client = getConnection(clientHandle); return client.isConnected(); }
/** * Get tokens for all outstanding deliveries for a client * * @param clientHandle * identifies the MqttConnection * @return an array (possibly empty) of tokens */ public IMqttDeliveryToken[] getPendingDeliveryTokens(String clientHandle) { MqttConnection client = getConnection(clientHandle); return client.getPendingDeliveryTokens(); }
/** * Close connection from a particular client * * @param clientHandle * identifies the MqttConnection to use */ public void close(String clientHandle) { MqttConnection client = getConnection(clientHandle); client.close(); }
/** * Sets the DisconnectedBufferOptions for this client * @param clientHandle identifier for the client * @param bufferOpts the DisconnectedBufferOptions for this client */ public void setBufferOpts(String clientHandle, DisconnectedBufferOptions bufferOpts) { MqttConnection client = getConnection(clientHandle); client.setBufferOpts(bufferOpts); }
public MqttMessage getBufferedMessage(String clientHandle, int bufferIndex){ MqttConnection client = getConnection(clientHandle); return client.getBufferedMessage(bufferIndex); }
public int getBufferedMessageCount(String clientHandle){ MqttConnection client = getConnection(clientHandle); return client.getBufferedMessageCount(); }
public void deleteBufferedMessage(String clientHandle, int bufferIndex){ MqttConnection client = getConnection(clientHandle); client.deleteBufferedMessage(bufferIndex); }
/** * Unsubscribe from one or more topics * * @param clientHandle * identifies the MqttConnection * @param topic * a list of possibly wildcarded topic names * @param invocationContext * arbitrary data to be passed back to the application * @param activityToken * arbitrary identifier to be passed back to the Activity */ public void unsubscribe(String clientHandle, final String[] topic, String invocationContext, String activityToken) { MqttConnection client = getConnection(clientHandle); client.unsubscribe(topic, invocationContext, activityToken); }
/** * Unsubscribe from a topic * * @param clientHandle * identifies the MqttConnection * @param topic * a possibly wildcarded topic name * @param invocationContext * arbitrary data to be passed back to the application * @param activityToken * arbitrary identifier to be passed back to the Activity */ public void unsubscribe(String clientHandle, final String topic, String invocationContext, String activityToken) { MqttConnection client = getConnection(clientHandle); client.unsubscribe(topic, invocationContext, activityToken); }
/** * Subscribe using topic filters * * @param clientHandle * identifies the MqttConnection to use * @param topicFilters * a list of possibly wildcarded topicfilters * @param qos * requested quality of service for each topic * @param invocationContext * arbitrary data to be passed back to the application * @param activityToken * arbitrary identifier to be passed back to the Activity * @param messageListeners a callback to handle incoming messages */ public void subscribe(String clientHandle, String[] topicFilters, int[] qos, String invocationContext, String activityToken, IMqttMessageListener[] messageListeners){ MqttConnection client = getConnection(clientHandle); client.subscribe(topicFilters, qos, invocationContext, activityToken, messageListeners); }
/** * Subscribe to one or more topics * * @param clientHandle * identifies the MqttConnection to use * @param topic * a list of possibly wildcarded topic names * @param qos * requested quality of service for each topic * @param invocationContext * arbitrary data to be passed back to the application * @param activityToken * arbitrary identifier to be passed back to the Activity */ public void subscribe(String clientHandle, String[] topic, int[] qos, String invocationContext, String activityToken) { MqttConnection client = getConnection(clientHandle); client.subscribe(topic, qos, invocationContext, activityToken); }
/** * Subscribe to a topic * * @param clientHandle * identifies the MqttConnection to use * @param topic * a possibly wildcarded topic name * @param qos * requested quality of service for the topic * @param invocationContext * arbitrary data to be passed back to the application * @param activityToken * arbitrary identifier to be passed back to the Activity */ public void subscribe(String clientHandle, String topic, int qos, String invocationContext, String activityToken) { MqttConnection client = getConnection(clientHandle); client.subscribe(topic, qos, invocationContext, activityToken); }
/** * Connect to the MQTT server specified by a particular client * * @param clientHandle * identifies the MqttConnection to use * @param connectOptions * the MQTT connection options to be used * @param invocationContext * arbitrary data to be passed back to the application * @param activityToken * arbitrary identifier to be passed back to the Activity * @throws MqttSecurityException thrown if there is a security exception * @throws MqttException thrown for all other MqttExceptions */ public void connect(String clientHandle, MqttConnectOptions connectOptions, String invocationContext, String activityToken) throws MqttSecurityException, MqttException { MqttConnection client = getConnection(clientHandle); client.connect(connectOptions, null, activityToken); }
/** * Publish a message to a topic * * @param clientHandle * identifies the MqttConnection to use * @param topic * the topic to which to publish * @param message * the message to publish * @param invocationContext * arbitrary data to be passed back to the application * @param activityToken * arbitrary identifier to be passed back to the Activity * @throws MqttPersistenceException when a problem occurs storing the message * @throws MqttException if there was an error publishing the message * @return token for tracking the operation */ public IMqttDeliveryToken publish(String clientHandle, String topic, MqttMessage message, String invocationContext, String activityToken) throws MqttPersistenceException, MqttException { MqttConnection client = getConnection(clientHandle); return client.publish(topic, message, invocationContext, activityToken); }
/** * Publish a message to a topic * * @param clientHandle * identifies the MqttConnection to use * @param topic * the topic to which to publish * @param payload * the content of the message to publish * @param qos * the quality of service requested * @param retained * whether the MQTT server should retain this message * @param invocationContext * arbitrary data to be passed back to the application * @param activityToken * arbitrary identifier to be passed back to the Activity * @throws MqttPersistenceException when a problem occurs storing the message * @throws MqttException if there was an error publishing the message * @return token for tracking the operation */ public IMqttDeliveryToken publish(String clientHandle, String topic, byte[] payload, int qos, boolean retained, String invocationContext, String activityToken) throws MqttPersistenceException, MqttException { MqttConnection client = getConnection(clientHandle); return client.publish(topic, payload, qos, retained, invocationContext, activityToken); }
/** * Disconnect from the server * * @param clientHandle * identifies the MqttConnection to use * @param invocationContext * arbitrary data to be passed back to the application * @param activityToken * arbitrary identifier to be passed back to the Activity */ public void disconnect(String clientHandle, String invocationContext, String activityToken) { MqttConnection client = getConnection(clientHandle); client.disconnect(invocationContext, activityToken); connections.remove(clientHandle); // the activity has finished using us, so we can stop the service // the activities are bound with BIND_AUTO_CREATE, so the service will // remain around until the last activity disconnects stopSelf(); }
/** * Disconnect from the server * * @param clientHandle * identifies the MqttConnection to use * @param quiesceTimeout * in milliseconds * @param invocationContext * arbitrary data to be passed back to the application * @param activityToken * arbitrary identifier to be passed back to the Activity */ public void disconnect(String clientHandle, long quiesceTimeout, String invocationContext, String activityToken) { MqttConnection client = getConnection(clientHandle); client.disconnect(quiesceTimeout, invocationContext, activityToken); connections.remove(clientHandle); // the activity has finished using us, so we can stop the service // the activities are bound with BIND_AUTO_CREATE, so the service will // remain around until the last activity disconnects stopSelf(); }
/** * Get tokens for all outstanding deliveries for a client * * @param clientHandle * identifies the MqttConnection * @return an array (possibly empty) of tokens */ public IMqttDeliveryToken[] getPendingDeliveryTokens(String clientHandle) { MqttConnection client = getConnection(clientHandle); return client.getPendingDeliveryTokens(); }
public int getBufferedMessageCount(String clientHandle){ MqttConnection client = getConnection(clientHandle); return client.getBufferedMessageCount(); }
/** * Sets the DisconnectedBufferOptions for this client * @param clientHandle identifier for the client * @param bufferOpts the DisconnectedBufferOptions for this client */ public void setBufferOpts(String clientHandle, DisconnectedBufferOptions bufferOpts) { MqttConnection client = getConnection(clientHandle); client.setBufferOpts(bufferOpts); }