Typo in the beacon sensor event.
[smartthings-infrastructure.git] / MobilePresence / MobilePresences.groovy
1 //Create a class for mobile presence
2 package MobilePresence
3 import Timer.SimulatedTimer
4
5 public class MobilePresences {
6         private int deviceNumbers
7         private List mobilePresences
8         private String deviceNetworkId
9         def sendEvent
10
11         //For one device(We cannot have obj.id)-> We should have obj[0].id
12         private String id = "mobilePresenceID0"
13         private String label = "mobilePresence0"
14         private String displayName = "mobilePresence0"
15         
16                 
17         MobilePresences(Closure sendEvent, int deviceNumbers) {
18                 this.sendEvent = sendEvent              
19                 this.deviceNumbers = deviceNumbers
20                 this.mobilePresences = []
21                 this.deviceNetworkId = "mobile0"
22
23                 mobilePresences.add(new MobilePresence(id, label, displayName, deviceNetworkId))
24         }
25
26         //Methods for closures
27         def count(Closure Input) {
28                 mobilePresences.count(Input)
29         }
30         def size() {
31                 mobilePresences.size()
32         }
33         def each(Closure Input) {
34                 mobilePresences.each(Input)
35         }
36         def find(Closure Input) {
37                 mobilePresences.find(Input)
38         }
39         def sort(Closure Input) {
40                 mobilePresences.sort(Input)
41         }
42         def collect(Closure Input) {
43                 mobilePresences.collect(Input)
44         }
45
46
47         def getAt(int ix) {
48                 mobilePresences[ix]
49         }
50 }