|
1 <!-- defines a rules to snooze and stop an active alarm on a doubletap or turndown event --> |
|
2 <script xmlns="http://www.nokia.com/ns/cep/script/1.0/" xmlns:cep="http://www.nokia.com/ns/cep/1.0/"> |
|
3 |
|
4 <!-- active sensor channels when alarm expires --> |
|
5 <if> |
|
6 <equals> |
|
7 <contextRef source='Sensor' type='Setting.Active'/> |
|
8 <string>Off</string> |
|
9 </equals> |
|
10 <actions> |
|
11 </actions> |
|
12 </if> |
|
13 <!-- Check if we have an active alarm and we receive an event --> |
|
14 <elseIf> |
|
15 <and> |
|
16 <!-- Must have an active alarm and receive new double tap event or orientation event from sensor --> |
|
17 <!-- ...alarm is active... --> |
|
18 <notEqual> |
|
19 <contextRef source='AlarmUI' type='State'/> |
|
20 <string>Inactive</string> |
|
21 </notEqual> |
|
22 <or> |
|
23 <and> |
|
24 <!-- Check that double tap interaction is set --> |
|
25 <equals> |
|
26 <contextRef source='Sensor' type='Setting.TappingInteraction.SilenceAlarm'/> |
|
27 <string>On</string> |
|
28 </equals> |
|
29 <!-- ...and we receive a new doubletap event from sensors --> |
|
30 <contextUpdated> |
|
31 <contextRef source='Sensor' type='Event.DoubleTap'/> |
|
32 </contextUpdated> |
|
33 </and> |
|
34 <and> |
|
35 <!-- Check that turning interaction is set --> |
|
36 <equals> |
|
37 <contextRef source='Sensor' type='Setting.TurningInteraction.SilenceAlarm'/> |
|
38 <string>On</string> |
|
39 </equals> |
|
40 <!-- ...and previous orientation is not 'Undefined' ... --> |
|
41 <notEqual> |
|
42 <contextRef source='Sensor' type='Event.Orientation.Previous'/> |
|
43 <string>Undefined</string> |
|
44 </notEqual> |
|
45 <!-- ...and we receive a new orientation event from sensors... --> |
|
46 <contextChanged> |
|
47 <contextRef source='Sensor' type='Event.Orientation'/> |
|
48 </contextChanged> |
|
49 <equals> |
|
50 <contextRef source='Sensor' type='Event.Orientation'/> |
|
51 <string>DisplayDownwards</string> |
|
52 </equals> |
|
53 </and> |
|
54 </or> |
|
55 </and> |
|
56 <actions> |
|
57 <!-- snooze the alarm --> |
|
58 <AlarmUI.Snooze dummy='dummy'/> |
|
59 |
|
60 <!-- request vibra feedback --> |
|
61 <Vibra Mode='Start' Delay='0' Repeats='2' RepeatInterval='200' Duration='50' Intensity='50'/> |
|
62 </actions> |
|
63 </elseIf> |
|
64 <!-- Check if we just have an active alarm --> |
|
65 <!-- active sensor channels when alarm expires --> |
|
66 <elseIf> |
|
67 <and> |
|
68 <!-- ...alarm is active... --> |
|
69 <contextUpdated> |
|
70 <contextRef source='AlarmUI' type='State'/> |
|
71 </contextUpdated> |
|
72 <notEqual> |
|
73 <contextRef source='AlarmUI' type='State'/> |
|
74 <string>Inactive</string> |
|
75 </notEqual> |
|
76 </and> |
|
77 <actions> |
|
78 <!-- Activate double tap events from sensor --> |
|
79 <publishContext> |
|
80 <contextRef source='Sensor' type='Event' value='DoubleTap.Activate'/> |
|
81 </publishContext> |
|
82 <!-- Activate orientation events from sensor --> |
|
83 <publishContext> |
|
84 <contextRef source='Sensor' type='Event' value='Orientation.Activate'/> |
|
85 </publishContext> |
|
86 </actions> |
|
87 </elseIf> |
|
88 <!-- deactivate sensor channels when alarm is dismissed --> |
|
89 <elseIf> |
|
90 <and> |
|
91 <!-- ...an alarm that was just deactivated --> |
|
92 <contextUpdated> |
|
93 <contextRef source='AlarmUI' type='State'/> |
|
94 </contextUpdated> |
|
95 <equals> |
|
96 <contextRef source='AlarmUI' type='State'/> |
|
97 <string>Inactive</string> |
|
98 </equals> |
|
99 </and> |
|
100 <actions> |
|
101 <!-- deactivate doubletap channel --> |
|
102 <publishContext> |
|
103 <contextRef source='Sensor' type='Event' value='DoubleTap.Deactivate'/> |
|
104 </publishContext> |
|
105 |
|
106 <!-- deactivate orientation channel --> |
|
107 <publishContext> |
|
108 <contextRef source='Sensor' type='Event' value='Orientation.Deactivate'/> |
|
109 </publishContext> |
|
110 </actions> |
|
111 </elseIf> |
|
112 <!-- stop an active alarm on a 'Stop' command --> |
|
113 <elseIf> |
|
114 <and> |
|
115 <!-- alarm is active... --> |
|
116 <notEqual> |
|
117 <contextRef source='AlarmUI' type='State'/> |
|
118 <string>Inactive</string> |
|
119 </notEqual> |
|
120 <!-- ...and we got a new stop command --> |
|
121 <contextUpdated> |
|
122 <contextRef source='AlarmUI' type='Command'/> |
|
123 </contextUpdated> |
|
124 <equals> |
|
125 <contextRef source='AlarmUI' type='Command'/> |
|
126 <string>Stop</string> |
|
127 </equals> |
|
128 </and> |
|
129 <actions> |
|
130 <!-- stop the alarm --> |
|
131 <AlarmUI.Stop dummy='dummy'/> |
|
132 |
|
133 <!-- request vibra feedback --> |
|
134 <Vibra Mode='Start' Delay='0' Repeats='2' RepeatInterval='200' Duration='50' Intensity='50'/> |
|
135 </actions> |
|
136 </elseIf> |
|
137 <!-- snooze an active alarm on a 'Snooze' command --> |
|
138 <elseIf> |
|
139 <and> |
|
140 <!-- alarm is active... --> |
|
141 <notEqual> |
|
142 <contextRef source='AlarmUI' type='State'/> |
|
143 <string>Inactive</string> |
|
144 </notEqual> |
|
145 <!-- ...and we got a new stop command --> |
|
146 <contextUpdated> |
|
147 <contextRef source='AlarmUI' type='Command'/> |
|
148 </contextUpdated> |
|
149 <equals> |
|
150 <contextRef source='AlarmUI' type='Command'/> |
|
151 <string>Snooze</string> |
|
152 </equals> |
|
153 </and> |
|
154 <actions> |
|
155 <!-- snooze the alarm --> |
|
156 <AlarmUI.Snooze dummy='dummy'/> |
|
157 |
|
158 <!-- request vibra feedback --> |
|
159 <Vibra Mode='Start' Delay='0' Repeats='2' RepeatInterval='200' Duration='50' Intensity='50'/> |
|
160 </actions> |
|
161 </elseIf> |
|
162 </script> |