/** @see org.eclipse.paho.client.mqttv3.MqttCallback#connectionLost(java.lang.Throwable) */
  @Override
  public void connectionLost(Throwable cause) {

    if (cause != null) {
      Notify.toast(context, "Connection Lost", Toast.LENGTH_LONG);
    }
  }
Exemplo n.º 2
0
  /**
   * A publish action has been successfully completed, update connection object associated with the
   * client this action belongs to, then notify the user of success
   */
  private void publish() {

    Connection c = Connection.getInstance();
    String actionTaken = context.getString(R.string.toast_pub_success, (Object[]) additionalArgs);

    Notify.toast(context, actionTaken, Toast.LENGTH_SHORT);
  }
Exemplo n.º 3
0
  /**
   * A connection action has been successfully completed, update the connection object associated
   * with the client this action belongs to and then notify the user of success.
   */
  private void connect() {

    Connection c = Connection.getInstance();
    c.changeConnectionStatus(Connection.ConnectionStatus.CONNECTED);

    Notify.toast(context, "Connected", Toast.LENGTH_LONG);
  }
 /**
  * @see org.eclipse.paho.client.mqttv3.MqttCallback#messageArrived(java.lang.String,
  *     org.eclipse.paho.client.mqttv3.MqttMessage)
  */
 @Override
 public void messageArrived(String topic, MqttMessage message) throws Exception {
   String msg_payload = new String(message.getPayload());
   String toast_msg = "Message Arrived -> " + topic + " : " + msg_payload;
   Notify.toast(context, toast_msg, Toast.LENGTH_LONG);
 }
Exemplo n.º 5
0
  /**
   * A subscribe action was unsuccessful, notify user and update client history
   *
   * @param exception This argument is not used
   */
  private void subscribe(Throwable exception) {
    Connection c = Connection.getInstance();
    String action = context.getString(R.string.toast_sub_failed, (Object[]) additionalArgs);

    Notify.toast(context, action, Toast.LENGTH_SHORT);
  }
Exemplo n.º 6
0
 /**
  * A disconnection action has been successfully completed, update the connection object associated
  * with the client this action belongs to and then notify the user of success.
  */
 private void disconnect() {
   Connection c = Connection.getInstance();
   c.changeConnectionStatus(Connection.ConnectionStatus.DISCONNECTED);
   String actionTaken = context.getString(R.string.toast_disconnected);
   Notify.toast(context, actionTaken, Toast.LENGTH_LONG);
 }