private void initWDwithSensorDefaults(WeatherData data) { data.setTemp(TEMPDEFAULTVALUE); data.setPressure(PRESDEFAULTVALUE); data.setHumidity(HUMDEFAULTVALUE); data.setLight(LIGHTDEFAULTVALUE); data.setSensorWindSpeed(WSPEEDDEFAULTVALUE); }
/** * Initializes data with all the values which the connected sensor array provides. WindDegree, * WeatherDescription and WeatherName are only provided by OpenWeatherMap and therefore missing. * * @param data WeatherData object to be initialized. */ private void initWDwithSensorData(WeatherData data) { try { data.setTemp(curSensData.getDouble("temperature")); System.out.println("set temp"); } catch (Exception e) { data.setTemp(TEMPDEFAULTVALUE); } try { data.setPressure(curSensData.getDouble("pressure")); System.out.println("set pres"); } catch (Exception e) { data.setPressure(PRESDEFAULTVALUE); } try { data.setHumidity(curSensData.getDouble("humidity")); System.out.println("set hum"); } catch (Exception e) { data.setHumidity(HUMDEFAULTVALUE); } try { data.setSensorWindSpeed(curSensWind); } catch (Exception e1) { data.setSensorWindSpeed(WSPEEDDEFAULTVALUE); } // data.setSensorWindSpeed(WSPEEDDEFAULTVALUE); System.out.println("set ws"); try { data.setLight(curSensData.getDouble("luminosity")); System.out.println("set light"); } catch (Exception e) { data.setLight(LIGHTDEFAULTVALUE); } }
/** * Sets all fields to default values, indicating that no sensor/OWM-data is present. * * @param data WeatherData object to be initialized. */ private void initWDwithDefaultData(WeatherData data) { data.setOwmTemp(TEMPDEFAULTVALUE); data.setOwmPressure(PRESDEFAULTVALUE); data.setOwmHumidity(HUMDEFAULTVALUE); data.setTemp(TEMPDEFAULTVALUE); data.setPressure(PRESDEFAULTVALUE); data.setHumidity(HUMDEFAULTVALUE); data.setSensorWindSpeed(WSPEEDDEFAULTVALUE); data.setOwmWindSpeed(WSPEEDDEFAULTVALUE); data.setOwmWindDegree(WDEGREEDEFAULTVALUE); data.setLight(LIGHTDEFAULTVALUE); data.setOwmDesc("N/A"); data.setOwmName("N/A"); }