Infrastruction modification
[smartthings-infrastructure.git] / AeonKeyFob / AeonKeyFobs.groovy
index f001f0d8fe0ce3b126eb4528c3594ccd96650e41..bbb45b3e0151bed4e5bd5aa6ecd68bc2d986c609 100644 (file)
@@ -1,60 +1,18 @@
 //Create a class for aeon key fob
 package AeonKeyFob
-import Timer.SimulatedTimer
+import SmartThing.SmartThings
 
-public class AeonKeyFobs {
-       private int deviceNumbers
-       private List aeonKeyFobs
-       def sendEvent
-
-       //For one device(We cannot have obj.id)-> We should have obj[0].id
-       private String id = "aeonKeyFobID0"
-       private String label = "aeonKeyFob0"
-       private String displayName = "aeonKeyFob0"
-       
+public class AeonKeyFobs extends SmartThings {
+       List aeonKeyFobs = new ArrayList()
                
-       AeonKeyFobs(Closure sendEvent, int deviceNumbers) {
-               this.sendEvent = sendEvent              
-               this.deviceNumbers = deviceNumbers
-               this.aeonKeyFobs = []
-
-               aeonKeyFobs.add(new AeonKeyFob(id, label, displayName))
-       }
-
-       //By Model Checker
-       def setValue(LinkedHashMap eventDataMap) {
-               aeonKeyFobs[0].setValue(eventDataMap)
-               sendEvent(eventDataMap)
-       }
-
-       //Methods for closures
-       def count(Closure Input) {
-               aeonKeyFobs.count(Input)
-       }
-       def size() {
-               aeonKeyFobs.size()
-       }
-       def each(Closure Input) {
-               aeonKeyFobs.each(Input)
-       }
-       def sort(Closure Input) {
-               aeonKeyFobs.sort(Input)
-       }
-       def find(Closure Input) {
-               aeonKeyFobs.find(Input)
-       }
-       def collect(Closure Input) {
-               aeonKeyFobs.collect(Input)
-       }
-
-
-       //methods
-       def eventsSince(Date dateObj) {
-               return aeonKeyFobs[0].eventsSince()
-       }
-
+       AeonKeyFobs(Closure sendEvent) {
+               aeonKeyFobs = smartThings
+               
+               // Initialization
+               StringBuilder id = new StringBuilder("aeonKeyFobID0")
+               StringBuilder label = new StringBuilder("button")
+               StringBuilder displayName = new StringBuilder("aeonKeyFob0")
 
-       def getAt(int ix) {
-               aeonKeyFobs[ix]
+               aeonKeyFobs.add(new AeonKeyFob(sendEvent, id, label, displayName))
        }
 }