Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/smartthings-infrastructure
[smartthings-infrastructure.git] / Location / LocationVar.groovy
1 //Create a class for location variable
2 package Location
3
4 class LocationVar {
5         private int contactBookEnabled
6         private def modes
7         private def timeZone
8         private def hubs
9         private String mode
10         private String name
11         private List contacts
12         private List phoneNumbers
13         def sendEvent
14     
15         private Phrase helloHome
16
17         LocationVar(Closure sendEvent) {
18                 this.hubs = [[id:0, localIP:"128.195.204.105"]]
19                 this.modes = [[name: "home"],[name: "away"],[name: "night"]]
20                 this.mode = "home"
21                 this.helloHome = new Phrase()
22                 this.contactBookEnabled = 1
23                 this.contacts = ['AJ']
24                 this.phoneNumbers = [9495379373]
25                 this.sendEvent = sendEvent
26                 this.timeZone = TimeZone.getTimeZone("America/New_York")
27                 this.name = "hub0"
28         }
29
30         //By Model Checker
31         def setValue(LinkedHashMap eventDataMap) {
32                 def sentMode = eventDataMap['value']
33                 println("The location is changed to $sentMode!")
34                 this.mode = sentMode
35                 sendEvent(eventDataMap)
36         }
37 }