//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")
}
}