1 /////////////////////////////////////////////////////////////////////
2 ////subscribe(obj, func)
3 def subscribe(Object obj, Closure FunctionToCall) {
6 eventList.add("Touched")
8 functionList.add(FunctionToCall)
9 } else if (obj == location) {
11 eventList.add("Location")
13 functionList.add(FunctionToCall)
17 ////subscribe(obj, event, func)
18 def subscribe(Object obj, String event, Closure FunctionToCall) {
19 if (event == "tamper.tampered") {
20 event = "contact" //This really should be its own name
21 } else if ((event == "mode")||(event == "mode.away")||(event == "mode.home")||(event == "mode.night")) {
22 //This really should be fixed also...
24 } else if (event == "unlocked") {
28 int dot = event.indexOf('.')
32 name = event.substring(0, dot)
33 value = event.substring(dot + 1)
40 functionList.add(FunctionToCall)
43 ////subscribe(obj, event, nameOfFunc)
44 def subscribe(Object obj, String event, String FunctionToCall) {
45 if (event == "tamper.tampered") {
46 event = "contact" //This really should be its own name
47 } else if ((event == "mode")||(event == "mode.away")||(event == "mode.home")||(event == "mode.night")) {
49 } else if (event == "unlocked") {
53 int dot = event.indexOf('.')
57 name = event.substring(0, dot)
58 value = event.substring(dot + 1)
65 functionList.add(FunctionToCall)
69 ////subscribe(obj, event, func, data)
70 def subscribe(Object obj, String event, Closure FunctionToCall, LinkedHashMap metaData) {
71 subscribe(obj, event, FunctionToCall)