1 package iotcode.WeatherPhoneGateway;
3 /** WeatherInfo that implements WeatherInfoInterface
5 * @author Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
9 public class WeatherInfo implements WeatherInfoInterface {
12 * WeatherInfo class properties
14 private Double dInchesPerWeek;
15 private Integer iWeatherZipCode;
16 private Integer iDaysToWaterOn;
17 private Double dInchesPerMinute;
18 private boolean bNewDataAvailable;
23 public WeatherInfo() {
24 this.dInchesPerWeek = 0.0;
25 this.iWeatherZipCode = 0;
26 this.iDaysToWaterOn = 0;
27 this.dInchesPerMinute = 0.0;
28 this.bNewDataAvailable = false;
32 * Get irrigation info from the phone app using IoTRemoteCall
34 * @param dInchesPerWeek Rainfall information (inches per week)
35 * @param iWeatherZipCode Area zip code for weather info
36 * @param iDaysToWaterOn Number of days to water the lawn
37 * @param dInchesPerMinute Rainfall information (inches per minute)
40 public String getIrrigationInfo(Double dInchesPerWeek, Integer iWeatherZipCode,
41 Integer iDaysToWaterOn, Double dInchesPerMinute) {
43 this.dInchesPerWeek = dInchesPerWeek;
44 this.iWeatherZipCode = iWeatherZipCode;
45 this.iDaysToWaterOn = iDaysToWaterOn;
46 this.dInchesPerMinute = dInchesPerMinute;
47 this.bNewDataAvailable = true;
48 System.out.println("DEBUG: We are getting data from phone!");
49 System.out.println("DEBUG: New data available?" + bNewDataAvailable);
55 * Simply return this.dInchesPerWeek
57 public Double getInchesPerWeek() {
59 return this.dInchesPerWeek;
63 * Simply return this.iWeatherZipCode
65 public Integer getWeatherZipCode() {
67 return this.iWeatherZipCode;
71 * Simply return this.iDaysToWaterOn
73 public Integer getDaysToWaterOn() {
75 return this.iDaysToWaterOn;
79 * Simply return this.dInchesPerMinute
81 public Double getInchesPerMinute() {
83 return this.dInchesPerMinute;
87 * Simply return this.bNewDataAvailable
89 public boolean isNewDataAvailable() {
91 return this.bNewDataAvailable;
95 * Set this.bNewDataAvailable
97 public void setNewDataAvailable(boolean bValue) {
99 this.bNewDataAvailable = bValue;