Removing getXXX methods + properties. Adding getProperty feature to SmartThing(s)
[smartthings-infrastructure.git] / appTouch / Touched.groovy
index 89d575e670ad99eb5125de3f85a66c24eb77bfc7..0cc6851e5cb2a57e082b6fff4808191d8bfd9c23 100644 (file)
@@ -1,26 +1,21 @@
 //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
+       String id
+       String label
+       String displayName
 
-
-       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)
+       Touched(Closure sendEvent) {
+               id = "appTouchID0"
+               label = "appTouch"
+               displayName = "appTouchSensor"
+               
+               idSmartThing = id
+               labelSmartThing = label
+               displayNameSmartThing = displayName
+               sendEventSmartThings = sendEvent
        }
 }