/** * Close connection from the server * */ void close() { service.traceDebug(TAG, "close()"); try { if (myClient != null) { myClient.close(); } } catch (MqttException e) { // Pass a new bundle, let handleException stores error messages. handleException(new Bundle(), e); } }
public void subscribe(String[] topicFilters, int[] qos, String invocationContext, String activityToken, IMqttMessageListener[] messageListeners) { service.traceDebug(TAG, "subscribe({" + Arrays.toString(topicFilters) + "}," + Arrays.toString(qos) + ",{" + invocationContext + "}, {" + activityToken + "}"); final Bundle resultBundle = new Bundle(); resultBundle.putString(MqttServiceConstants.CALLBACK_ACTION, MqttServiceConstants.SUBSCRIBE_ACTION); resultBundle.putString(MqttServiceConstants.CALLBACK_ACTIVITY_TOKEN, activityToken); resultBundle.putString(MqttServiceConstants.CALLBACK_INVOCATION_CONTEXT, invocationContext); if((myClient != null) && (myClient.isConnected())){ IMqttActionListener listener = new MqttConnectionListener(resultBundle); try { myClient.subscribe(topicFilters, qos,messageListeners); } catch (Exception e){ handleException(resultBundle, e); } } else { resultBundle.putString(MqttServiceConstants.CALLBACK_ERROR_MESSAGE, NOT_CONNECTED); service.traceError("subscribe", NOT_CONNECTED); service.callbackToActivity(clientHandle, Status.ERROR, resultBundle); } }
myClient.unsubscribe(topic, invocationContext, listener); } catch (Exception e) { handleException(resultBundle, e);
myClient.subscribe(topic, qos, invocationContext, listener); } catch (Exception e) { handleException(resultBundle, e);
myClient.subscribe(topic, qos, invocationContext, listener); } catch (Exception e) { handleException(resultBundle, e);
myClient.unsubscribe(topic, invocationContext, listener); } catch (Exception e) { handleException(resultBundle, e);
activityToken); } catch (Exception e) { handleException(resultBundle, e); activityToken); } catch (Exception e) { handleException(resultBundle, e);
Log.e(TAG, "Exception occurred attempting to reconnect: " + ex.getMessage()); setConnectingState(false); handleException(resultBundle, ex); service.traceError(TAG, "Cannot reconnect to remote server." + e.getMessage()); setConnectingState(false); handleException(resultBundle, e); } catch (Exception e){ setConnectingState(false); MqttException newEx = new MqttException(MqttException.REASON_CODE_UNEXPECTED_ERROR, e.getCause()); handleException(resultBundle, newEx);
myClient.disconnect(quiesceTimeout, invocationContext, listener); } catch (Exception e) { handleException(resultBundle, e);
myClient.disconnect(invocationContext, listener); } catch (Exception e) { handleException(resultBundle, e);
activityToken); } catch (Exception e) { handleException(resultBundle, e);
service.traceError(TAG, "Exception occurred attempting to connect: " + e.getMessage()); setConnectingState(false); handleException(resultBundle, e);
/** * Close connection from the server * */ void close() { service.traceDebug(TAG, "close()"); try { if (myClient != null) { myClient.close(); } } catch (MqttException e) { // Pass a new bundle, let handleException stores error messages. handleException(new Bundle(), e); } }
/** * Close connection from the server * */ void close() { service.traceDebug(TAG, "close()"); try { if (myClient != null) { myClient.close(); } } catch (MqttException e) { // Pass a new bundle, let handleException stores error messages. handleException(new Bundle(), e); } }
public void subscribe(String[] topicFilters, int[] qos, String invocationContext, String activityToken, IMqttMessageListener[] messageListeners) { service.traceDebug(TAG, "subscribe({" + Arrays.toString(topicFilters) + "}," + Arrays.toString(qos) + ",{" + invocationContext + "}, {" + activityToken + "}"); final Bundle resultBundle = new Bundle(); resultBundle.putString(MqttServiceConstants.CALLBACK_ACTION, MqttServiceConstants.SUBSCRIBE_ACTION); resultBundle.putString(MqttServiceConstants.CALLBACK_ACTIVITY_TOKEN, activityToken); resultBundle.putString(MqttServiceConstants.CALLBACK_INVOCATION_CONTEXT, invocationContext); if((myClient != null) && (myClient.isConnected())){ IMqttActionListener listener = new MqttConnectionListener(resultBundle); try { myClient.subscribe(topicFilters, qos,messageListeners); } catch (Exception e){ handleException(resultBundle, e); } } else { resultBundle.putString(MqttServiceConstants.CALLBACK_ERROR_MESSAGE, NOT_CONNECTED); service.traceError("subscribe", NOT_CONNECTED); service.callbackToActivity(clientHandle, Status.ERROR, resultBundle); } }
public void subscribe(String[] topicFilters, int[] qos, String invocationContext, String activityToken, IMqttMessageListener[] messageListeners) { service.traceDebug(TAG, "subscribe({" + Arrays.toString(topicFilters) + "}," + Arrays.toString(qos) + ",{" + invocationContext + "}, {" + activityToken + "}"); final Bundle resultBundle = new Bundle(); resultBundle.putString(MqttServiceConstants.CALLBACK_ACTION, MqttServiceConstants.SUBSCRIBE_ACTION); resultBundle.putString(MqttServiceConstants.CALLBACK_ACTIVITY_TOKEN, activityToken); resultBundle.putString(MqttServiceConstants.CALLBACK_INVOCATION_CONTEXT, invocationContext); if((myClient != null) && (myClient.isConnected())){ IMqttActionListener listener = new MqttConnectionListener(resultBundle); try { myClient.subscribe(topicFilters, qos,messageListeners); } catch (Exception e){ handleException(resultBundle, e); } } else { resultBundle.putString(MqttServiceConstants.CALLBACK_ERROR_MESSAGE, NOT_CONNECTED); service.traceError("subscribe", NOT_CONNECTED); service.callbackToActivity(clientHandle, Status.ERROR, resultBundle); } }
myClient.subscribe(topic, qos, invocationContext, listener); } catch (Exception e) { handleException(resultBundle, e);
myClient.subscribe(topic, qos, invocationContext, listener); } catch (Exception e) { handleException(resultBundle, e);
myClient.unsubscribe(topic, invocationContext, listener); } catch (Exception e) { handleException(resultBundle, e);
myClient.unsubscribe(topic, invocationContext, listener); } catch (Exception e) { handleException(resultBundle, e);