Infrastruction modification
[smartthings-infrastructure.git] / NfcTouch / NfcTouch.groovy
index 3635d51492d99e7a0894b0669f0aa662092e9271..80ce59d66650bec55d312470c3cb7da5b4d4adbc 100644 (file)
@@ -1,20 +1,22 @@
 //Create a class for Touch sensor
 package NfcTouch
+import SmartThing.SmartThing
 
-public class NfcTouch{
-       def sendEvent
-       private int isTouched
-       private String displayName = "NfcTouch0"
+public class NfcTouch extends SmartThing {
+       // id, label, and display name of the device
+       StringBuilder id = new StringBuilder()
+       StringBuilder label = new StringBuilder()
+       StringBuilder displayName = new StringBuilder()
 
-       NfcTouch(Closure sendEvent, int isTouched) {
-               this.sendEvent = sendEvent
-               this.isTouched = isTouched
-       }
+       NfcTouch(Closure sendEvent) {
+               idSmartThing = id
+               labelSmartThing = label
+               displayNameSmartThing = displayName
+               sendEventSmartThings = sendEvent
 
-       //By Model Checker
-       def setValue(LinkedHashMap eventDataMap) {
-               println("NFC is Touched!")
-               this.isTouched = 1 //Do we need this?
-               sendEvent(eventDataMap)
+               // Initialization
+               id.append("nfcSensorID0")
+               label.append("nfcSensor")
+               displayName.append("nfcSensor0")
        }
 }