- this.smoke = smoke
- this.currentSmokeValue = smoke
- this.smokeLatestValue = smokeLatestValue
- this.carbonMonoxide = carbonMonoxide
- this.currentCarbonMonoxideValue = currentCarbonMonoxideValue
- this.carbonMonoxideLatestValue = carbonMonoxideLatestValue
- this.battery = battery
- this.batteryLatestValue = battery
- }
-
- def setValue(String value, String name) {
- if (name.contains("smoke")) {
- println("the smoke value of smoke detector with id:$id is triggered to $value!")
- this.smokeLatestValue = value
- this.smoke = value
- this.currentSmokeValue = value
- } else if (name.contains("carbonMonoxide")) {
- println("the carbonMonoxide value of smoke detector with id:$id is triggered to $value!")
- this.carbonMonoxideLatestValue = value
- this.carbonMonoxide = value
- this.currentCarbonMonoxideValue = value
- } else if (name.contains("battery")) {
- println("the battery value of smoke detector with id:$id is triggered to $value!")
- this.batteryLatestValue = value.toInteger()
- this.battery = value.toInteger()
- }
-
- }