//Create a class for Touch sensor
package appTouch
+import SmartThing.SmartThing
-public class Touched{
- def sendEvent
- private String id
- private int isTouched
- private String label
- private String name
+public class Touched extends SmartThing {
+ // id, label, and display name of the device
+ StringBuilder id = new StringBuilder()
+ StringBuilder label = new StringBuilder()
+ StringBuilder displayName = new StringBuilder()
+ Touched(Closure sendEvent) {
+ idSmartThing = id
+ labelSmartThing = label
+ displayNameSmartThing = displayName
+ sendEventSmartThings = sendEvent
- Touched(Closure sendEvent, int isTouched) {
- this.sendEvent = sendEvent
- this.isTouched = isTouched
- this.label = "app0"
- this.id = "appID0"
- this.name = "app0"
- }
-
- //By Model Checker
- def setValue(LinkedHashMap eventDataMap) {
- println("The application is Touched!")
- this.isTouched = 1 //Do we need this?
- sendEvent(eventDataMap)
+ // Initialization
+ id.append("appTouchID0")
+ label.append("appTouch")
+ displayName.append("appTouch0")
}
}