Infrastruction modification
[smartthings-infrastructure.git] / ThreeAxis / ThreeAxises.groovy
1 //Create a class for three axis
2 package ThreeAxis
3 import SmartThing.SmartThings
4
5 public class ThreeAxises extends SmartThings {
6         List threeAxises = new ArrayList()
7                 
8         ThreeAxises(Closure sendEvent, boolean init) {
9                 // Only initialize one time since we only have one device for each capability
10                 threeAxises = smartThings
11
12                 // Initialization
13                 StringBuilder id = new StringBuilder("threeAxisID0")
14                 StringBuilder label = new StringBuilder("threeAxis")
15                 StringBuilder displayName = new StringBuilder("threeAxis0")
16                 LinkedHashMap threeAxis
17
18                 if (init)
19                         threeAxis = [x:0, y:0, z:0]
20                 else
21                         threeAxis = [x:1, y:2, z:3]
22
23                 threeAxises.add(new ThreeAxis(sendEvent, id, label, displayName, threeAxis))
24         }
25
26         // Methods to return values
27         def getCurrentThreeAxis() {
28                 List tmpValues = new ArrayList()
29                 tmpValues.add(threeAxises[0].getCurrentThreeAxis())
30                 return tmpValues
31         }
32 }