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...
26 int dot = event.indexOf('.')
30 name = event.substring(0, dot)
31 value = event.substring(dot + 1)
38 functionList.add(FunctionToCall)
41 ////subscribe(obj, event, nameOfFunc)
42 def subscribe(Object obj, String event, String FunctionToCall) {
43 if (event == "tamper.tampered") {
44 event = "contact" //This really should be its own name
45 } else if ((event == "mode")||(event == "mode.away")||(event == "mode.home")||(event == "mode.night")) {
49 int dot = event.indexOf('.')
53 name = event.substring(0, dot)
54 value = event.substring(dot + 1)
61 functionList.add(FunctionToCall)
65 ////subscribe(obj, event, func, data)
66 def subscribe(Object obj, String event, Closure FunctionToCall, LinkedHashMap metaData) {
67 subscribe(obj, event, FunctionToCall)