1 //Create a class for button
3 import Timer.SimulatedTimer
6 private int deviceNumbers
10 //For one device(We cannot have obj.id)-> We should have obj[0].id
11 private String id = "buttonID0"
12 private String label = "button0"
13 private String displayName = "button0"
14 private String button = "pushed"
15 private int numberOfButtons = 4
18 Buttons(Closure sendEvent, int deviceNumbers, boolean init) {
19 this.sendEvent = sendEvent
20 this.deviceNumbers = deviceNumbers
24 this.button = "pushed"
28 buttons.add(new Button(id, label, displayName, button, numberOfButtons))
32 def setValue(LinkedHashMap eventDataMap) {
33 buttons[0].setValue(eventDataMap)
34 sendEvent(eventDataMap)
37 //Methods for closures
38 def count(Closure Input) {
44 def each(Closure Input) {
47 def sort(Closure Input) {
50 def find(Closure Input) {
53 def collect(Closure Input) {
54 buttons.collect(Input)
59 def eventsSince(Date dateObj) {
60 return buttons[0].eventsSince()