/////////////////////////////////////////////////////////////////////
-////subscribe(app, func)
-def subscribe(Object Obj, Closure Input) {
- EventList.add("Touched")
- FunctionList.add(Input)
+////subscribe(obj, func)
+def subscribe(Object obj, Closure FunctionToCall) {
+ if (obj == app) {
+ objectList.add(obj)
+ eventList.add("Touched")
+ valueList.add("")
+ functionList.add(FunctionToCall)
+ } else if (obj == location) {
+ objectList.add(obj)
+ eventList.add("mode")
+ valueList.add("")
+ functionList.add(FunctionToCall)
+ }
}
-////subscribe(obj, string, func)
-def subscribe(Object Obj, String S, Closure Input) {
- ObjectList.add(Obj)
- EventList.add(S)
- FunctionList.add(Input)
+
+////subscribe(obj, event, func)
+def subscribe(Object obj, String event, Closure FunctionToCall) {
+ if (event == "tamper.tampered") {
+ event = "contact" //This really should be its own name
+ }
+
+ int dot = event.indexOf('.')
+ String name = ""
+ String value = ""
+ if (dot != -1) {
+ name = event.substring(0, dot)
+ value = event.substring(dot + 1)
+ } else {
+ name = event
+ }
+
+ objectList.add(obj)
+ eventList.add(name)
+ functionList.add(FunctionToCall)
+ valueList.add(value)
}
-////subscribe(obj, string, func, hashmap)
-def subscribe(Object Obj, String S, Closure Input, LinkedHashMap LHM) {
- ObjectList.add(Obj)
- EventList.add(S)
- FunctionList.add(Input)
+////subscribe(obj, event, nameOfFunc)
+def subscribe(Object obj, String event, String FunctionToCall) {
+ if (event == "tamper.tampered") {
+ event = "contact" //This really should be its own name
+ }
+
+ int dot = event.indexOf('.')
+ String name = ""
+ String value = ""
+ if (dot != -1) {
+ name = event.substring(0, dot)
+ value = event.substring(dot + 1)
+ } else {
+ name = event
+ }
+
+ objectList.add(obj)
+ eventList.add(name)
+ functionList.add(FunctionToCall)
+ valueList.add(value)
+}
+
+////subscribe(obj, event, func, data)
+def subscribe(Object obj, String event, Closure FunctionToCall, LinkedHashMap metaData) {
+ subscribe(obj, event, FunctionToCall)
}