void updateBox(SensorData data, int i) {
    mBoxName[i].setText(data.getName());
    mBoxVal[i].setText(valFormat.format(data.getFloatValue()));
    mBoxUnit[i].setText(data.getUnit());

    String imgname = TREE_PREFIX + data.getLevel();
    int resID = getResources().getIdentifier(imgname, TREE_TYPE, TREE_PACKAGE);
    if (resID == 0) {
      resID = R.drawable.tree_max;
    }
    mBoxImage[i].setImageResource(resID);
  }
  @Override
  void receivedSensorDataBundle(SensorDataBundleWrapper bundle) {

    Location location = bundle.getLocation();

    if (location == null) {
      mLatView.setText(R.string.common_na);
      mLonView.setText(R.string.common_na);
    } else {
      String lat_val[], lon_val[];

      lat_val = Location.convert(location.getLatitude(), Location.FORMAT_SECONDS).split(":", 0);
      lon_val = Location.convert(location.getLongitude(), Location.FORMAT_SECONDS).split(":", 0);
      mLatView.setText(
          lat_val[0]
              + "º"
              + lat_val[1]
              + "'"
              + lat_val[2].substring(0, lat_val[2].indexOf('.'))
              + "\"");
      mLonView.setText(
          lon_val[0]
              + "º"
              + lon_val[1]
              + "'"
              + lon_val[2].substring(0, lon_val[2].indexOf('.'))
              + "\"");
    }

    SensorDataParser parser =
        DeviceHandlerFactory.getInstance().getParser(bundle.getSensorName(), bundle.getSensorId());

    for (SensorData data : parser.getSensorData(bundle.getSensorData(), filter)) {
      switch (data.getDataType()) {
        case CO2:
          updateBox(data, 0);
          break;
        case NOx:
          updateBox(data, 1);
          break;
        case COx:
          updateBox(data, 2);
          break;
        case Noise:
          updateBox(data, 3);
          break;
        case Humidity:
          mHumidityView.setText(data.getStrValue());
          mHumidityUnitView.setText(data.getUnit());
          break;
        case Temperature:
          mTemperatureView.setText(data.getStrValue());
          mTemperatureUnitView.setText(data.getUnit());
          break;
      }
    }
  }