Removing getXXX methods + properties. Adding getProperty feature to SmartThing(s)
[smartthings-infrastructure.git] / AccelerationSensor / AccelerationSensor.groovy
1 // Create a class for acceleration sensor
2 package AccelerationSensor
3 import SmartThing.SmartThing
4
5 public class AccelerationSensor extends SmartThing {
6         // id, label, and display name of the device
7         String id
8         String label
9         String displayName
10         // Maps from features to values
11         HashMap<String, String> deviceValuesMap = new HashMap<String, String>()
12         // Possible values for eventsSince method
13         List<String> possibleValues = new ArrayList<String>();
14
15         AccelerationSensor(Closure sendEvent, String id, String label, String displayName, String currentAcceleration) {
16                 deviceValueSmartThing = deviceValuesMap
17                 idSmartThing = id
18                 labelSmartThing = label
19                 displayNameSmartThing = displayName
20                 possibleValuesSmartThings = possibleValues
21                 sendEventSmartThings = sendEvent
22
23                 // Initialization
24                 this.id = id
25                 this.label = label
26                 this.displayName = displayName
27                 possibleValues.add("active")
28                 possibleValues.add("inactive")
29
30                 deviceValuesMap.put("acceleration", currentAcceleration)
31         }
32 }