Moving Java drivers; Creating iotruntime socket connections for C++; First version...
[iot2.git] / benchmarks / drivers / Java / WeatherPhoneGateway / WeatherInfo.java
1 package iotcode.WeatherPhoneGateway;
2
3 /** WeatherInfo that implements WeatherInfoInterface
4  *
5  * @author      Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
6  * @version     1.0                
7  * @since       2016-04-26
8  */
9 public class WeatherInfo implements WeatherInfoInterface {
10
11         /**
12          * WeatherInfo class properties
13          */
14         private Double dInchesPerWeek;
15         private Integer iWeatherZipCode;
16         private Integer iDaysToWaterOn;
17         private Double dInchesPerMinute;
18         private boolean bNewDataAvailable;
19
20         /**
21          * Constructor
22          */
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;
29         }
30
31         /**
32          * Get irrigation info from the phone app using IoTRemoteCall
33          *
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)
38          * @
39          */
40         public String getIrrigationInfo(Double dInchesPerWeek, Integer iWeatherZipCode,
41                 Integer iDaysToWaterOn, Double dInchesPerMinute) {
42
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);
50                 
51                 return "info sent";
52         }
53
54         /**
55          * Simply return this.dInchesPerWeek
56          */
57         public Double getInchesPerWeek() {
58
59                 return this.dInchesPerWeek;
60         }
61
62         /**
63          * Simply return this.iWeatherZipCode
64          */
65         public Integer getWeatherZipCode() {
66
67                 return this.iWeatherZipCode;
68         }
69
70         /**
71          * Simply return this.iDaysToWaterOn
72          */
73         public Integer getDaysToWaterOn() {
74
75                 return this.iDaysToWaterOn;
76         }
77
78         /**
79          * Simply return this.dInchesPerMinute
80          */
81         public Double getInchesPerMinute() {
82
83                 return this.dInchesPerMinute;
84         }
85
86         /**
87          * Simply return this.bNewDataAvailable
88          */
89         public boolean isNewDataAvailable() {
90
91                 return this.bNewDataAvailable;
92         }
93
94         /**
95          * Set this.bNewDataAvailable
96          */
97         public void setNewDataAvailable(boolean bValue) {
98
99                 this.bNewDataAvailable = bValue;
100         }
101 }