ruby-macrodroid 0.2.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/ruby-macrodroid.rb +1746 -179
- metadata +29 -9
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc528ce6042bfe75807bb76fcc73cc255b45b6fe0bf138d4a643a5facd7fdaf1
|
4
|
+
data.tar.gz: 294fed6fbe1ff71b05ea4384f9070e5795ceb1c41979bba419f89a4273164124
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76925a5b3cba1509ec62635c04d5d796ded37f2e8cee958748a59c88938876129853adc91df55281e594b6c9043ba5f8fdaba2307a9ff4727d70cf611f4a2d8f
|
7
|
+
data.tar.gz: 55f01e2512265e988d14cc63f576d18a5cc6fdee2a3d109ed47b0ef54bf3d4947ca4064696e405619bb5c2b5e545866fa771d040a13964e205bd343c7b111325
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/ruby-macrodroid.rb
CHANGED
@@ -2,12 +2,82 @@
|
|
2
2
|
|
3
3
|
# file: ruby-macrodroid.rb
|
4
4
|
|
5
|
-
require 'pp'
|
6
|
-
require 'json'
|
7
5
|
require 'uuid'
|
8
6
|
require 'rxfhelper'
|
7
|
+
require 'chronic_cron'
|
9
8
|
|
10
9
|
|
10
|
+
class TriggersNlp
|
11
|
+
include AppRoutes
|
12
|
+
|
13
|
+
def initialize()
|
14
|
+
|
15
|
+
super()
|
16
|
+
params = {}
|
17
|
+
triggers(params)
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def triggers(params)
|
22
|
+
|
23
|
+
get /^at (\d+:\d+(?:[ap]m)?) on (.*)/i do |time, days|
|
24
|
+
[TimerTrigger, {time: time, days: days}]
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
alias find_trigger run_route
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
class ActionsNlp
|
35
|
+
include AppRoutes
|
36
|
+
|
37
|
+
def initialize()
|
38
|
+
|
39
|
+
super()
|
40
|
+
params = {}
|
41
|
+
actions(params)
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
def actions(params)
|
46
|
+
|
47
|
+
get /^message popup: (.*)/i do |msg|
|
48
|
+
[ToastAction, {msg: msg}]
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
alias find_action run_route
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
class ConstraintsNlp
|
59
|
+
include AppRoutes
|
60
|
+
|
61
|
+
def initialize()
|
62
|
+
|
63
|
+
super()
|
64
|
+
params = {}
|
65
|
+
constraints(params)
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
def constraints(params)
|
70
|
+
|
71
|
+
get /^airplane mode (.*)/i do |state|
|
72
|
+
[AirplaneModeConstraint, {enabled: (state =~ /^enabled|on$/) == 0}]
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
alias find_constraint run_route
|
78
|
+
|
79
|
+
end
|
80
|
+
|
11
81
|
module Params
|
12
82
|
|
13
83
|
refine Hash do
|
@@ -19,7 +89,7 @@ module Params
|
|
19
89
|
h.inject({}) do |r, x|
|
20
90
|
|
21
91
|
key, value = x
|
22
|
-
puts 'value: ' + value.inspect
|
92
|
+
#puts 'value: ' + value.inspect
|
23
93
|
|
24
94
|
val = if value.is_a?(Hash) then
|
25
95
|
to_snake_case(value)
|
@@ -65,15 +135,16 @@ class Macro
|
|
65
135
|
using ColouredText
|
66
136
|
using Params
|
67
137
|
|
68
|
-
attr_reader :local_variables, :triggers, :actions, :guid
|
138
|
+
attr_reader :local_variables, :triggers, :actions, :constraints, :guid
|
139
|
+
attr_accessor :title
|
69
140
|
|
70
|
-
def initialize(debug: false)
|
141
|
+
def initialize(name=nil, debug: false)
|
71
142
|
|
72
|
-
@debug = debug
|
73
|
-
|
74
|
-
|
143
|
+
@title, @debug = name, debug
|
144
|
+
|
145
|
+
puts 'inside Macro#initialize' if @debug
|
75
146
|
|
76
|
-
@triggers, @actions = [], []
|
147
|
+
@local_variables, @triggers, @actions, @constraints = [], [], [], []
|
77
148
|
@h = {}
|
78
149
|
|
79
150
|
end
|
@@ -105,7 +176,15 @@ class Macro
|
|
105
176
|
local_variables: @local_variables,
|
106
177
|
m_trigger_list: @triggers.map(&:to_h),
|
107
178
|
m_action_list: @actions.map(&:to_h),
|
108
|
-
m_constraint_list:
|
179
|
+
m_constraint_list: @constraints.map(&:to_h),
|
180
|
+
m_description: '',
|
181
|
+
m_name: @title,
|
182
|
+
m_excludeLog: false,
|
183
|
+
m_GUID: guid(),
|
184
|
+
m_isOrCondition: false,
|
185
|
+
m_enabled: false,
|
186
|
+
m_descriptionOpen: false,
|
187
|
+
m_headingColor: 0
|
109
188
|
}
|
110
189
|
|
111
190
|
puts 'h: ' + h.inspect if @debug
|
@@ -129,19 +208,146 @@ class Macro
|
|
129
208
|
object(action.to_snake_case)
|
130
209
|
end
|
131
210
|
|
132
|
-
# fetch the constraints
|
211
|
+
# fetch the constraints
|
212
|
+
@constraints = h[:constraint_list].map do |constraint|
|
213
|
+
object(constraint.to_snake_case)
|
214
|
+
end
|
133
215
|
|
134
216
|
@h = h
|
135
217
|
|
136
|
-
%i(local_variables m_trigger_list m_action_list)
|
137
|
-
@h[x] = []
|
138
|
-
end
|
218
|
+
%i(local_variables m_trigger_list m_action_list m_constraint_list)\
|
219
|
+
.each {|x| @h[x] = [] }
|
139
220
|
|
140
221
|
@h
|
141
222
|
|
142
223
|
end
|
224
|
+
|
225
|
+
def import_xml(node)
|
226
|
+
|
227
|
+
if @debug then
|
228
|
+
puts 'inside Macro#import_xml'
|
229
|
+
puts 'node: ' + node.xml.inspect
|
230
|
+
end
|
231
|
+
|
232
|
+
@title = node.attributes[:name]
|
233
|
+
|
234
|
+
if node.element('triggers') then
|
235
|
+
|
236
|
+
# level 2
|
237
|
+
|
238
|
+
# get all the triggers
|
239
|
+
@triggers = node.xpath('triggers/*').map do |e|
|
240
|
+
|
241
|
+
puts 'e.name: ' + e.name.inspect if @debug
|
242
|
+
{timer: TimerTrigger}[e.name.to_sym].new(e.attributes.to_h)
|
243
|
+
|
244
|
+
end
|
245
|
+
|
246
|
+
# get all the actions
|
247
|
+
@actions = node.xpath('actions/*').map do |e|
|
248
|
+
|
249
|
+
if e.name == 'notification' then
|
250
|
+
|
251
|
+
case e.attributes[:type].to_sym
|
252
|
+
when :popup
|
253
|
+
e.attributes.delete :type
|
254
|
+
ToastAction.new e.attributes.to_h
|
255
|
+
end
|
256
|
+
|
257
|
+
end
|
258
|
+
|
259
|
+
end
|
260
|
+
|
261
|
+
# get all the constraints
|
262
|
+
@constraints = node.xpath('constraints/*').map do |e|
|
263
|
+
|
264
|
+
puts 'e.name: ' + e.name.inspect if @debug
|
265
|
+
{airplanemode: AirplaneModeConstraint}[e.name.to_sym].new(e.attributes.to_h)
|
266
|
+
|
267
|
+
end
|
268
|
+
|
269
|
+
else
|
270
|
+
|
271
|
+
# Level 1
|
272
|
+
|
273
|
+
tp = TriggersNlp.new
|
274
|
+
|
275
|
+
@triggers = node.xpath('trigger').map do |e|
|
276
|
+
|
277
|
+
r = tp.find_trigger e.text
|
278
|
+
|
279
|
+
puts 'found trigger ' + r.inspect if @debug
|
280
|
+
|
281
|
+
if r then
|
282
|
+
r[0].new(r[1])
|
283
|
+
end
|
284
|
+
|
285
|
+
end
|
286
|
+
|
287
|
+
ap = ActionsNlp.new
|
288
|
+
|
289
|
+
@actions = node.xpath('action').map do |e|
|
290
|
+
|
291
|
+
r = ap.find_action e.text
|
292
|
+
puts 'found action ' + r.inspect if @debug
|
293
|
+
|
294
|
+
if r then
|
295
|
+
r[0].new(r[1])
|
296
|
+
end
|
297
|
+
|
298
|
+
end
|
299
|
+
|
300
|
+
cp = ConstraintsNlp.new
|
301
|
+
|
302
|
+
@constraints = node.xpath('constraint').map do |e|
|
303
|
+
|
304
|
+
r = cp.find_constraint e.text
|
305
|
+
puts 'found constraint ' + r.inspect if @debug
|
306
|
+
|
307
|
+
if r then
|
308
|
+
r[0].new(r[1])
|
309
|
+
end
|
310
|
+
|
311
|
+
end
|
312
|
+
|
313
|
+
end
|
314
|
+
|
315
|
+
self
|
316
|
+
|
317
|
+
end
|
318
|
+
|
319
|
+
def match?(triggerx, detail={time: $env[:time]} )
|
320
|
+
|
321
|
+
if @triggers.any? {|x| x.type == triggerx and x.match?(detail) } then
|
322
|
+
|
323
|
+
if @debug then
|
324
|
+
puts 'checking constraints ...'
|
325
|
+
puts '@constraints: ' + @constraints.inspect
|
326
|
+
end
|
327
|
+
|
328
|
+
if @constraints.all? {|x| x.match?($env.merge(detail)) } then
|
329
|
+
|
330
|
+
true
|
331
|
+
|
332
|
+
else
|
333
|
+
|
334
|
+
return false
|
335
|
+
|
336
|
+
end
|
337
|
+
|
338
|
+
end
|
339
|
+
|
340
|
+
end
|
341
|
+
|
342
|
+
def run()
|
343
|
+
@actions.map(&:invoke)
|
344
|
+
end
|
143
345
|
|
144
346
|
private
|
347
|
+
|
348
|
+
def guid()
|
349
|
+
'-' + rand(1..9).to_s + 18.times.map { rand 9 }.join
|
350
|
+
end
|
145
351
|
|
146
352
|
def object(h={})
|
147
353
|
|
@@ -166,33 +372,20 @@ class MacroDroid
|
|
166
372
|
if obj then
|
167
373
|
|
168
374
|
s, _ = RXFHelper.read(obj)
|
169
|
-
|
375
|
+
|
376
|
+
if s[0] == '{' then
|
377
|
+
import_json(s)
|
378
|
+
elsif s[0] == '<'
|
379
|
+
import_xml(s)
|
380
|
+
@h = build_h
|
381
|
+
else
|
382
|
+
import_xml(text_to_xml(s))
|
383
|
+
@h = build_h
|
384
|
+
end
|
170
385
|
|
171
386
|
else
|
172
387
|
|
173
|
-
@h =
|
174
|
-
cell_tower_groups: [],
|
175
|
-
cell_towers_ignore: [],
|
176
|
-
drawer_configuration: {
|
177
|
-
drawer_items: [],
|
178
|
-
background_color: -1,
|
179
|
-
header_color: 12692882,
|
180
|
-
left_side: false,
|
181
|
-
swipe_area_color: -7829368,
|
182
|
-
swipe_area_height: 20,
|
183
|
-
swipe_area_offset: 40,
|
184
|
-
swipe_area_opacity: 80,
|
185
|
-
swipe_area_width: 14,
|
186
|
-
visible_swipe_area_width: 0
|
187
|
-
},
|
188
|
-
variables: [],
|
189
|
-
user_icons: [],
|
190
|
-
geofence_data: {
|
191
|
-
geofence_map: {}
|
192
|
-
},
|
193
|
-
macro_list: []
|
194
|
-
|
195
|
-
}
|
388
|
+
@h = build_h()
|
196
389
|
|
197
390
|
@macros = []
|
198
391
|
|
@@ -203,6 +396,34 @@ class MacroDroid
|
|
203
396
|
@macros << macro
|
204
397
|
end
|
205
398
|
|
399
|
+
def build_h()
|
400
|
+
|
401
|
+
puts 'inside Macro#build_h' if @debug
|
402
|
+
{
|
403
|
+
cell_tower_groups: [],
|
404
|
+
cell_towers_ignore: [],
|
405
|
+
drawer_configuration: {
|
406
|
+
drawer_items: [],
|
407
|
+
background_color: -1,
|
408
|
+
header_color: 12692882,
|
409
|
+
left_side: false,
|
410
|
+
swipe_area_color: -7829368,
|
411
|
+
swipe_area_height: 20,
|
412
|
+
swipe_area_offset: 40,
|
413
|
+
swipe_area_opacity: 80,
|
414
|
+
swipe_area_width: 14,
|
415
|
+
visible_swipe_area_width: 0
|
416
|
+
},
|
417
|
+
variables: [],
|
418
|
+
user_icons: [],
|
419
|
+
geofence_data: {
|
420
|
+
geofence_map: {}
|
421
|
+
},
|
422
|
+
macro_list: []
|
423
|
+
|
424
|
+
}
|
425
|
+
end
|
426
|
+
|
206
427
|
def export_json()
|
207
428
|
|
208
429
|
to_h.to_json
|
@@ -226,6 +447,50 @@ class MacroDroid
|
|
226
447
|
end
|
227
448
|
|
228
449
|
@h[:macro_list] = []
|
450
|
+
|
451
|
+
end
|
452
|
+
|
453
|
+
def import_xml(raws)
|
454
|
+
|
455
|
+
s = RXFHelper.read(raws).first
|
456
|
+
puts 's: ' + s.inspect if @debug
|
457
|
+
doc = Rexle.new(s)
|
458
|
+
puts 'after doc' if @debug
|
459
|
+
|
460
|
+
@macros = doc.root.xpath('macro').map do |node|
|
461
|
+
|
462
|
+
macro = Macro.new @title, debug: @debug
|
463
|
+
macro.import_xml(node)
|
464
|
+
macro
|
465
|
+
|
466
|
+
end
|
467
|
+
end
|
468
|
+
|
469
|
+
def text_to_xml(s)
|
470
|
+
|
471
|
+
a = s.split(/.*(?=^m:)/); a.shift
|
472
|
+
a.map!(&:chomp)
|
473
|
+
|
474
|
+
macros = a.map do |x|
|
475
|
+
|
476
|
+
lines = x.lines
|
477
|
+
puts 'lines: ' + lines.inspect if @debug
|
478
|
+
|
479
|
+
name = lines.shift[/^m: +(.*)/,1]
|
480
|
+
h = {t: [], a: [], c: []}
|
481
|
+
|
482
|
+
lines.each {|line| h[line[0].to_sym] << line[/^\w: +(.*)/,1] }
|
483
|
+
triggers = h[:t].map {|text| [:trigger, {}, text]}
|
484
|
+
actions = h[:a].map {|text| [:action, {}, text]}
|
485
|
+
constraints = h[:c].map {|text| [:constraint, {}, text]}
|
486
|
+
|
487
|
+
[:macro, {name: name},'', *triggers, *actions, *constraints]
|
488
|
+
|
489
|
+
end
|
490
|
+
|
491
|
+
doc = Rexle.new([:macros, {}, '', *macros])
|
492
|
+
doc.root.xml pretty: true
|
493
|
+
|
229
494
|
end
|
230
495
|
|
231
496
|
def to_h()
|
@@ -239,12 +504,22 @@ class MacroDroid
|
|
239
504
|
end
|
240
505
|
|
241
506
|
class MacroObject
|
507
|
+
using ColouredText
|
508
|
+
|
509
|
+
attr_reader :type
|
510
|
+
attr_accessor :options
|
242
511
|
|
243
512
|
def initialize(h={})
|
244
513
|
|
245
514
|
@h = {constraint_list: [], is_or_condition: false,
|
246
515
|
is_disabled: false}.merge(h)
|
247
516
|
@list = []
|
517
|
+
|
518
|
+
# fetch the class name and convert from camelCase to snake_eyes
|
519
|
+
@type = self.class.to_s.sub(/Trigger|Action$/,'')\
|
520
|
+
.gsub(/\B[A-Z][a-z]/){|x| '_' + x.downcase}\
|
521
|
+
.gsub(/[a-z][A-Z]/){|x| x[0] + '_' + x[1].downcase}\
|
522
|
+
.downcase.to_sym
|
248
523
|
end
|
249
524
|
|
250
525
|
def to_h()
|
@@ -267,6 +542,13 @@ class MacroObject
|
|
267
542
|
|
268
543
|
protected
|
269
544
|
|
545
|
+
def filter(options, h)
|
546
|
+
|
547
|
+
(h.keys - options.keys).each {|key| h.delete key }
|
548
|
+
return h
|
549
|
+
|
550
|
+
end
|
551
|
+
|
270
552
|
def uuid()
|
271
553
|
UUID.new.generate
|
272
554
|
end
|
@@ -279,11 +561,18 @@ class Trigger < MacroObject
|
|
279
561
|
super({fakeIcon: 0}.merge(h))
|
280
562
|
@list << 'fakeIcon'
|
281
563
|
end
|
564
|
+
|
565
|
+
def match?(detail={})
|
282
566
|
|
283
|
-
|
567
|
+
detail.all? {|key,value| @h[key] == value}
|
568
|
+
|
569
|
+
end
|
284
570
|
|
571
|
+
end
|
285
572
|
|
286
573
|
|
574
|
+
# Category: Applications
|
575
|
+
#
|
287
576
|
class WebHookTrigger < Trigger
|
288
577
|
|
289
578
|
def initialize(h={})
|
@@ -298,6 +587,22 @@ class WebHookTrigger < Trigger
|
|
298
587
|
|
299
588
|
end
|
300
589
|
|
590
|
+
# Category: Applications
|
591
|
+
#
|
592
|
+
# Also known as Wifi State Change
|
593
|
+
#
|
594
|
+
# wifi_state options:
|
595
|
+
# 0 - Wifi Enabled
|
596
|
+
# 1 - Wifi Disabled
|
597
|
+
# 2 - Connected to network
|
598
|
+
# ssid_list options:
|
599
|
+
# ["Any Network"]
|
600
|
+
# ["some Wifi SSID"] - 1 or more SSID can be supplied
|
601
|
+
# 3 - Disconnected from network
|
602
|
+
# ssid_list options:
|
603
|
+
# ["Any Network"]
|
604
|
+
# ["some Wifi SSID"] - 1 or more SSID can be supplied
|
605
|
+
|
301
606
|
class WifiConnectionTrigger < Trigger
|
302
607
|
|
303
608
|
def initialize(h={})
|
@@ -313,6 +618,8 @@ class WifiConnectionTrigger < Trigger
|
|
313
618
|
|
314
619
|
end
|
315
620
|
|
621
|
+
# Category: Applications
|
622
|
+
#
|
316
623
|
class ApplicationInstalledRemovedTrigger < Trigger
|
317
624
|
|
318
625
|
def initialize(h={})
|
@@ -331,6 +638,8 @@ class ApplicationInstalledRemovedTrigger < Trigger
|
|
331
638
|
|
332
639
|
end
|
333
640
|
|
641
|
+
# Category: Applications
|
642
|
+
#
|
334
643
|
class ApplicationLaunchedTrigger < Trigger
|
335
644
|
|
336
645
|
def initialize(h={})
|
@@ -347,6 +656,8 @@ class ApplicationLaunchedTrigger < Trigger
|
|
347
656
|
|
348
657
|
end
|
349
658
|
|
659
|
+
# Category: Battery/Power
|
660
|
+
#
|
350
661
|
class BatteryLevelTrigger < Trigger
|
351
662
|
|
352
663
|
def initialize(h={})
|
@@ -363,6 +674,8 @@ class BatteryLevelTrigger < Trigger
|
|
363
674
|
|
364
675
|
end
|
365
676
|
|
677
|
+
# Category: Battery/Power
|
678
|
+
#
|
366
679
|
class BatteryTemperatureTrigger < Trigger
|
367
680
|
|
368
681
|
def initialize(h={})
|
@@ -379,6 +692,8 @@ class BatteryTemperatureTrigger < Trigger
|
|
379
692
|
|
380
693
|
end
|
381
694
|
|
695
|
+
# Category: Battery/Power
|
696
|
+
#
|
382
697
|
class PowerButtonToggleTrigger < Trigger
|
383
698
|
|
384
699
|
def initialize(h={})
|
@@ -393,6 +708,9 @@ class PowerButtonToggleTrigger < Trigger
|
|
393
708
|
|
394
709
|
end
|
395
710
|
|
711
|
+
|
712
|
+
# Category: Battery/Power
|
713
|
+
#
|
396
714
|
class ExternalPowerTrigger < Trigger
|
397
715
|
|
398
716
|
def initialize(h={})
|
@@ -410,6 +728,8 @@ class ExternalPowerTrigger < Trigger
|
|
410
728
|
|
411
729
|
end
|
412
730
|
|
731
|
+
# Category: Call/SMS
|
732
|
+
#
|
413
733
|
class CallActiveTrigger < Trigger
|
414
734
|
|
415
735
|
def initialize(h={})
|
@@ -426,6 +746,8 @@ class CallActiveTrigger < Trigger
|
|
426
746
|
|
427
747
|
end
|
428
748
|
|
749
|
+
# Category: Call/SMS
|
750
|
+
#
|
429
751
|
class IncomingCallTrigger < Trigger
|
430
752
|
|
431
753
|
def initialize(h={})
|
@@ -444,6 +766,8 @@ class IncomingCallTrigger < Trigger
|
|
444
766
|
|
445
767
|
end
|
446
768
|
|
769
|
+
# Category: Call/SMS
|
770
|
+
#
|
447
771
|
class OutgoingCallTrigger < Trigger
|
448
772
|
|
449
773
|
def initialize(h={})
|
@@ -462,6 +786,8 @@ class OutgoingCallTrigger < Trigger
|
|
462
786
|
|
463
787
|
end
|
464
788
|
|
789
|
+
# Category: Call/SMS
|
790
|
+
#
|
465
791
|
class CallEndedTrigger < Trigger
|
466
792
|
|
467
793
|
def initialize(h={})
|
@@ -480,6 +806,8 @@ class CallEndedTrigger < Trigger
|
|
480
806
|
|
481
807
|
end
|
482
808
|
|
809
|
+
# Category: Call/SMS
|
810
|
+
#
|
483
811
|
class CallMissedTrigger < Trigger
|
484
812
|
|
485
813
|
def initialize(h={})
|
@@ -494,6 +822,8 @@ class CallMissedTrigger < Trigger
|
|
494
822
|
|
495
823
|
end
|
496
824
|
|
825
|
+
# Category: Call/SMS
|
826
|
+
#
|
497
827
|
class IncomingSMSTrigger < Trigger
|
498
828
|
|
499
829
|
def initialize(h={})
|
@@ -516,6 +846,8 @@ class IncomingSMSTrigger < Trigger
|
|
516
846
|
|
517
847
|
end
|
518
848
|
|
849
|
+
# Category: Connectivity
|
850
|
+
#
|
519
851
|
class WebHookTrigger < Trigger
|
520
852
|
|
521
853
|
def initialize(h={})
|
@@ -530,6 +862,8 @@ class WebHookTrigger < Trigger
|
|
530
862
|
|
531
863
|
end
|
532
864
|
|
865
|
+
# Category: Connectivity
|
866
|
+
#
|
533
867
|
class WifiConnectionTrigger < Trigger
|
534
868
|
|
535
869
|
def initialize(h={})
|
@@ -545,6 +879,8 @@ class WifiConnectionTrigger < Trigger
|
|
545
879
|
|
546
880
|
end
|
547
881
|
|
882
|
+
# Category: Connectivity
|
883
|
+
#
|
548
884
|
class BluetoothTrigger < Trigger
|
549
885
|
|
550
886
|
def initialize(h={})
|
@@ -561,6 +897,8 @@ class BluetoothTrigger < Trigger
|
|
561
897
|
|
562
898
|
end
|
563
899
|
|
900
|
+
# Category: Connectivity
|
901
|
+
#
|
564
902
|
class HeadphonesTrigger < Trigger
|
565
903
|
|
566
904
|
def initialize(h={})
|
@@ -576,6 +914,8 @@ class HeadphonesTrigger < Trigger
|
|
576
914
|
|
577
915
|
end
|
578
916
|
|
917
|
+
# Category: Connectivity
|
918
|
+
#
|
579
919
|
class SignalOnOffTrigger < Trigger
|
580
920
|
|
581
921
|
def initialize(h={})
|
@@ -590,6 +930,8 @@ class SignalOnOffTrigger < Trigger
|
|
590
930
|
|
591
931
|
end
|
592
932
|
|
933
|
+
# Category: Connectivity
|
934
|
+
#
|
593
935
|
class UsbDeviceConnectionTrigger < Trigger
|
594
936
|
|
595
937
|
def initialize(h={})
|
@@ -604,22 +946,45 @@ class UsbDeviceConnectionTrigger < Trigger
|
|
604
946
|
|
605
947
|
end
|
606
948
|
|
949
|
+
# Category: Connectivity
|
950
|
+
#
|
951
|
+
# Also known as Wifi SSID Transition
|
952
|
+
#
|
953
|
+
# options:
|
954
|
+
# in_range: true | false
|
955
|
+
# wifi_cell_info: {display_name: "some Wifi SSID",
|
956
|
+
# ssid: "some Wifi SSID"} - 1 or more allowed
|
957
|
+
#
|
607
958
|
class WifiSSIDTrigger < Trigger
|
608
959
|
|
609
960
|
def initialize(h={})
|
610
961
|
|
611
962
|
options = {
|
612
|
-
wifi_cell_info_list: [{:
|
963
|
+
wifi_cell_info_list: [{:display_name=>"", :ssid=>""}],
|
613
964
|
ssid_list: [],
|
614
|
-
|
965
|
+
in_range: true
|
615
966
|
}
|
616
967
|
|
617
968
|
super(options.merge h)
|
618
969
|
|
619
970
|
end
|
971
|
+
|
972
|
+
def to_h()
|
973
|
+
|
974
|
+
h = super()
|
975
|
+
val = h[:m_inRange]
|
976
|
+
|
977
|
+
h[:m_InRange] = val
|
978
|
+
h.delete :m_inRange
|
979
|
+
|
980
|
+
return h
|
981
|
+
|
982
|
+
end
|
620
983
|
|
621
984
|
end
|
622
985
|
|
986
|
+
# Category: Date/Time
|
987
|
+
#
|
623
988
|
class CalendarTrigger < Trigger
|
624
989
|
|
625
990
|
def initialize(h={})
|
@@ -644,24 +1009,76 @@ class CalendarTrigger < Trigger
|
|
644
1009
|
|
645
1010
|
end
|
646
1011
|
|
1012
|
+
# Category: Date/Time
|
1013
|
+
#
|
647
1014
|
class TimerTrigger < Trigger
|
1015
|
+
using ColouredText
|
1016
|
+
|
648
1017
|
|
649
1018
|
def initialize(h={})
|
650
1019
|
|
1020
|
+
puts 'TimerTrigger h: ' + h.inspect if $debug
|
1021
|
+
|
1022
|
+
if h[:days] then
|
1023
|
+
|
1024
|
+
days = [false] * 7
|
1025
|
+
|
1026
|
+
h[:days].split(/, */).each do |x|
|
1027
|
+
|
1028
|
+
r = Date::DAYNAMES.grep /#{x}/i
|
1029
|
+
i = Date::DAYNAMES.index(r.first)
|
1030
|
+
days[i-1] = true
|
1031
|
+
|
1032
|
+
end
|
1033
|
+
|
1034
|
+
h[:days_of_week] = days
|
1035
|
+
|
1036
|
+
end
|
1037
|
+
|
1038
|
+
if h[:time] then
|
1039
|
+
|
1040
|
+
t = Time.parse(h[:time])
|
1041
|
+
h[:hour], h[:minute] = t.hour, t.min
|
1042
|
+
|
1043
|
+
end
|
1044
|
+
|
1045
|
+
#puts ('h: ' + h.inspect).debug
|
1046
|
+
|
651
1047
|
options = {
|
652
1048
|
alarm_id: uuid(),
|
653
|
-
days_of_week: [false,
|
1049
|
+
days_of_week: [false, false, false, false, false, false, false],
|
654
1050
|
minute: 10,
|
655
1051
|
hour: 7,
|
656
1052
|
use_alarm: false
|
657
1053
|
}
|
1054
|
+
|
1055
|
+
super(options.merge filter(options,h))
|
658
1056
|
|
659
|
-
|
1057
|
+
end
|
1058
|
+
|
1059
|
+
def match?(detail={time: $env[:time]})
|
1060
|
+
|
1061
|
+
a = @h[:days_of_week]
|
1062
|
+
a.unshift a.pop
|
1063
|
+
|
1064
|
+
dow = a.map.with_index {|x, i| x ? i : nil }.compact.join(',')
|
1065
|
+
|
1066
|
+
s = "%s %s * * %s" % [@h[:minute], @h[:hour], dow]
|
1067
|
+
|
1068
|
+
if $debug then
|
1069
|
+
puts 's: ' + s.inspect
|
1070
|
+
puts 'detail: ' + detail.inspect
|
1071
|
+
puts '@h: ' + @h.inspect
|
1072
|
+
end
|
1073
|
+
|
1074
|
+
ChronicCron.new(s, detail[:time]).to_time == detail[:time]
|
660
1075
|
|
661
1076
|
end
|
662
1077
|
|
663
1078
|
end
|
664
1079
|
|
1080
|
+
# Category: Date/Time
|
1081
|
+
#
|
665
1082
|
class StopwatchTrigger < Trigger
|
666
1083
|
|
667
1084
|
def initialize(h={})
|
@@ -677,6 +1094,13 @@ class StopwatchTrigger < Trigger
|
|
677
1094
|
|
678
1095
|
end
|
679
1096
|
|
1097
|
+
# Category: Date/Time
|
1098
|
+
#
|
1099
|
+
# Also known as Day of Week/Month
|
1100
|
+
#
|
1101
|
+
# month_of_year equal to 0 means it occurs every month
|
1102
|
+
# day_of_week starts with a Monday (value is 0)
|
1103
|
+
#
|
680
1104
|
class DayTrigger < Trigger
|
681
1105
|
|
682
1106
|
def initialize(h={})
|
@@ -698,6 +1122,10 @@ class DayTrigger < Trigger
|
|
698
1122
|
|
699
1123
|
end
|
700
1124
|
|
1125
|
+
# Category: Date/Time
|
1126
|
+
#
|
1127
|
+
# Regular Interval
|
1128
|
+
#
|
701
1129
|
class RegularIntervalTrigger < Trigger
|
702
1130
|
|
703
1131
|
def initialize(h={})
|
@@ -717,6 +1145,17 @@ class RegularIntervalTrigger < Trigger
|
|
717
1145
|
|
718
1146
|
end
|
719
1147
|
|
1148
|
+
# Category: Device Events
|
1149
|
+
#
|
1150
|
+
# Airplane Mode Changed
|
1151
|
+
#
|
1152
|
+
# options:
|
1153
|
+
# Airplane Mode Enabled
|
1154
|
+
# Airplane Mode Disabled
|
1155
|
+
#
|
1156
|
+
# shorthand example:
|
1157
|
+
# airplanemode: enabled
|
1158
|
+
#
|
720
1159
|
class AirplaneModeTrigger < Trigger
|
721
1160
|
|
722
1161
|
def initialize(h={})
|
@@ -731,6 +1170,8 @@ class AirplaneModeTrigger < Trigger
|
|
731
1170
|
|
732
1171
|
end
|
733
1172
|
|
1173
|
+
# Category: Device Events
|
1174
|
+
#
|
734
1175
|
class AutoSyncChangeTrigger < Trigger
|
735
1176
|
|
736
1177
|
def initialize(h={})
|
@@ -745,6 +1186,8 @@ class AutoSyncChangeTrigger < Trigger
|
|
745
1186
|
|
746
1187
|
end
|
747
1188
|
|
1189
|
+
# Category: Device Events
|
1190
|
+
#
|
748
1191
|
class DayDreamTrigger < Trigger
|
749
1192
|
|
750
1193
|
def initialize(h={})
|
@@ -759,6 +1202,8 @@ class DayDreamTrigger < Trigger
|
|
759
1202
|
|
760
1203
|
end
|
761
1204
|
|
1205
|
+
# Category: Device Events
|
1206
|
+
#
|
762
1207
|
class DockTrigger < Trigger
|
763
1208
|
|
764
1209
|
def initialize(h={})
|
@@ -773,6 +1218,8 @@ class DockTrigger < Trigger
|
|
773
1218
|
|
774
1219
|
end
|
775
1220
|
|
1221
|
+
# Category: Device Events
|
1222
|
+
#
|
776
1223
|
class GPSEnabledTrigger < Trigger
|
777
1224
|
|
778
1225
|
def initialize(h={})
|
@@ -787,6 +1234,8 @@ class GPSEnabledTrigger < Trigger
|
|
787
1234
|
|
788
1235
|
end
|
789
1236
|
|
1237
|
+
# Category: Device Events
|
1238
|
+
#
|
790
1239
|
class MusicPlayingTrigger < Trigger
|
791
1240
|
|
792
1241
|
def initialize(h={})
|
@@ -801,19 +1250,9 @@ class MusicPlayingTrigger < Trigger
|
|
801
1250
|
|
802
1251
|
end
|
803
1252
|
|
804
|
-
class DeviceUnlockedTrigger < Trigger
|
805
|
-
|
806
|
-
def initialize(h={})
|
807
|
-
|
808
|
-
options = {
|
809
|
-
}
|
810
|
-
|
811
|
-
super(options.merge h)
|
812
|
-
|
813
|
-
end
|
814
|
-
|
815
|
-
end
|
816
1253
|
|
1254
|
+
# Category: Device Events
|
1255
|
+
#
|
817
1256
|
class DeviceUnlockedTrigger < Trigger
|
818
1257
|
|
819
1258
|
def initialize(h={})
|
@@ -827,6 +1266,8 @@ class DeviceUnlockedTrigger < Trigger
|
|
827
1266
|
|
828
1267
|
end
|
829
1268
|
|
1269
|
+
# Category: Device Events
|
1270
|
+
#
|
830
1271
|
class AutoRotateChangeTrigger < Trigger
|
831
1272
|
|
832
1273
|
def initialize(h={})
|
@@ -841,6 +1282,8 @@ class AutoRotateChangeTrigger < Trigger
|
|
841
1282
|
|
842
1283
|
end
|
843
1284
|
|
1285
|
+
# Category: Device Events
|
1286
|
+
#
|
844
1287
|
class ClipboardChangeTrigger < Trigger
|
845
1288
|
|
846
1289
|
def initialize(h={})
|
@@ -856,6 +1299,8 @@ class ClipboardChangeTrigger < Trigger
|
|
856
1299
|
|
857
1300
|
end
|
858
1301
|
|
1302
|
+
# Category: Device Events
|
1303
|
+
#
|
859
1304
|
class BootTrigger < Trigger
|
860
1305
|
|
861
1306
|
def initialize(h={})
|
@@ -869,19 +1314,8 @@ class BootTrigger < Trigger
|
|
869
1314
|
|
870
1315
|
end
|
871
1316
|
|
872
|
-
|
873
|
-
|
874
|
-
def initialize(h={})
|
875
|
-
|
876
|
-
options = {
|
877
|
-
}
|
878
|
-
|
879
|
-
super(options.merge h)
|
880
|
-
|
881
|
-
end
|
882
|
-
|
883
|
-
end
|
884
|
-
|
1317
|
+
# Category: Device Events
|
1318
|
+
#
|
885
1319
|
class IntentReceivedTrigger < Trigger
|
886
1320
|
|
887
1321
|
def initialize(h={})
|
@@ -900,6 +1334,8 @@ class IntentReceivedTrigger < Trigger
|
|
900
1334
|
|
901
1335
|
end
|
902
1336
|
|
1337
|
+
# Category: Device Events
|
1338
|
+
#
|
903
1339
|
class NotificationTrigger < Trigger
|
904
1340
|
|
905
1341
|
def initialize(h={})
|
@@ -924,6 +1360,8 @@ class NotificationTrigger < Trigger
|
|
924
1360
|
|
925
1361
|
end
|
926
1362
|
|
1363
|
+
# Category: Device Events
|
1364
|
+
#
|
927
1365
|
class ScreenOnOffTrigger < Trigger
|
928
1366
|
|
929
1367
|
def initialize(h={})
|
@@ -938,6 +1376,8 @@ class ScreenOnOffTrigger < Trigger
|
|
938
1376
|
|
939
1377
|
end
|
940
1378
|
|
1379
|
+
# Category: Device Events
|
1380
|
+
#
|
941
1381
|
class SilentModeTrigger < Trigger
|
942
1382
|
|
943
1383
|
def initialize(h={})
|
@@ -952,6 +1392,8 @@ class SilentModeTrigger < Trigger
|
|
952
1392
|
|
953
1393
|
end
|
954
1394
|
|
1395
|
+
# Category: Location
|
1396
|
+
#
|
955
1397
|
class WeatherTrigger < Trigger
|
956
1398
|
|
957
1399
|
def initialize(h={})
|
@@ -975,6 +1417,8 @@ class WeatherTrigger < Trigger
|
|
975
1417
|
|
976
1418
|
end
|
977
1419
|
|
1420
|
+
# Category: Location
|
1421
|
+
#
|
978
1422
|
class GeofenceTrigger < Trigger
|
979
1423
|
|
980
1424
|
def initialize(h={})
|
@@ -993,6 +1437,8 @@ class GeofenceTrigger < Trigger
|
|
993
1437
|
|
994
1438
|
end
|
995
1439
|
|
1440
|
+
# Category: Location
|
1441
|
+
#
|
996
1442
|
class SunriseSunsetTrigger < Trigger
|
997
1443
|
|
998
1444
|
def initialize(h={})
|
@@ -1008,7 +1454,8 @@ class SunriseSunsetTrigger < Trigger
|
|
1008
1454
|
|
1009
1455
|
end
|
1010
1456
|
|
1011
|
-
|
1457
|
+
# Category: Sensors
|
1458
|
+
#
|
1012
1459
|
class ActivityRecognitionTrigger < Trigger
|
1013
1460
|
|
1014
1461
|
def initialize(h={})
|
@@ -1024,7 +1471,8 @@ class ActivityRecognitionTrigger < Trigger
|
|
1024
1471
|
|
1025
1472
|
end
|
1026
1473
|
|
1027
|
-
|
1474
|
+
# Category: Sensors
|
1475
|
+
#
|
1028
1476
|
class ProximityTrigger < Trigger
|
1029
1477
|
|
1030
1478
|
def initialize(h={})
|
@@ -1040,6 +1488,8 @@ class ProximityTrigger < Trigger
|
|
1040
1488
|
|
1041
1489
|
end
|
1042
1490
|
|
1491
|
+
# Category: Sensors
|
1492
|
+
#
|
1043
1493
|
class ShakeDeviceTrigger < Trigger
|
1044
1494
|
|
1045
1495
|
def initialize(h={})
|
@@ -1053,6 +1503,8 @@ class ShakeDeviceTrigger < Trigger
|
|
1053
1503
|
|
1054
1504
|
end
|
1055
1505
|
|
1506
|
+
# Category: Sensors
|
1507
|
+
#
|
1056
1508
|
class FlipDeviceTrigger < Trigger
|
1057
1509
|
|
1058
1510
|
def initialize(h={})
|
@@ -1069,6 +1521,8 @@ class FlipDeviceTrigger < Trigger
|
|
1069
1521
|
|
1070
1522
|
end
|
1071
1523
|
|
1524
|
+
# Category: Sensors
|
1525
|
+
#
|
1072
1526
|
class OrientationTrigger < Trigger
|
1073
1527
|
|
1074
1528
|
def initialize(h={})
|
@@ -1084,6 +1538,8 @@ class OrientationTrigger < Trigger
|
|
1084
1538
|
|
1085
1539
|
end
|
1086
1540
|
|
1541
|
+
# Category: User Input
|
1542
|
+
#
|
1087
1543
|
class FloatingButtonTrigger < Trigger
|
1088
1544
|
|
1089
1545
|
def initialize(h={})
|
@@ -1107,6 +1563,8 @@ class FloatingButtonTrigger < Trigger
|
|
1107
1563
|
|
1108
1564
|
end
|
1109
1565
|
|
1566
|
+
# Category: User Input
|
1567
|
+
#
|
1110
1568
|
class ShortcutTrigger < Trigger
|
1111
1569
|
|
1112
1570
|
def initialize(h={})
|
@@ -1120,6 +1578,8 @@ class ShortcutTrigger < Trigger
|
|
1120
1578
|
|
1121
1579
|
end
|
1122
1580
|
|
1581
|
+
# Category: User Input
|
1582
|
+
#
|
1123
1583
|
class VolumeButtonTrigger < Trigger
|
1124
1584
|
|
1125
1585
|
def initialize(h={})
|
@@ -1137,6 +1597,8 @@ class VolumeButtonTrigger < Trigger
|
|
1137
1597
|
|
1138
1598
|
end
|
1139
1599
|
|
1600
|
+
# Category: User Input
|
1601
|
+
#
|
1140
1602
|
class MediaButtonPressedTrigger < Trigger
|
1141
1603
|
|
1142
1604
|
def initialize(h={})
|
@@ -1152,6 +1614,8 @@ class MediaButtonPressedTrigger < Trigger
|
|
1152
1614
|
|
1153
1615
|
end
|
1154
1616
|
|
1617
|
+
# Category: User Input
|
1618
|
+
#
|
1155
1619
|
class SwipeTrigger < Trigger
|
1156
1620
|
|
1157
1621
|
def initialize(h={})
|
@@ -1174,14 +1638,30 @@ class Action < MacroObject
|
|
1174
1638
|
def initialize(h={})
|
1175
1639
|
super(h)
|
1176
1640
|
end
|
1641
|
+
|
1642
|
+
def invoke(s='')
|
1643
|
+
"%s/%s: %s" % [@group, @type, s]
|
1644
|
+
end
|
1177
1645
|
|
1178
1646
|
end
|
1179
1647
|
|
1180
1648
|
|
1649
|
+
class LocationAction < Action
|
1650
|
+
|
1651
|
+
def initialize(h={})
|
1652
|
+
super(h)
|
1653
|
+
@group = 'location'
|
1654
|
+
end
|
1655
|
+
|
1656
|
+
end
|
1181
1657
|
|
1182
|
-
|
1658
|
+
# Category: Location
|
1659
|
+
#
|
1660
|
+
class ShareLocationAction < LocationAction
|
1183
1661
|
|
1184
1662
|
def initialize(h={})
|
1663
|
+
|
1664
|
+
super()
|
1185
1665
|
|
1186
1666
|
options = {
|
1187
1667
|
email: '',
|
@@ -1199,39 +1679,19 @@ class ShareLocationAction < Action
|
|
1199
1679
|
|
1200
1680
|
end
|
1201
1681
|
|
1202
|
-
class UDPCommandAction < Action
|
1203
|
-
|
1204
|
-
def initialize(h={})
|
1205
|
-
|
1206
|
-
options = {
|
1207
|
-
destination: '',
|
1208
|
-
message: '',
|
1209
|
-
port: 1024
|
1210
|
-
}
|
1211
|
-
|
1212
|
-
super(options.merge h)
|
1213
|
-
|
1214
|
-
end
|
1215
|
-
|
1216
|
-
end
|
1217
|
-
|
1218
|
-
class UDPCommandAction < Action
|
1219
1682
|
|
1683
|
+
class ApplicationAction < Action
|
1684
|
+
|
1220
1685
|
def initialize(h={})
|
1221
|
-
|
1222
|
-
|
1223
|
-
destination: '',
|
1224
|
-
message: '',
|
1225
|
-
port: 1024
|
1226
|
-
}
|
1227
|
-
|
1228
|
-
super(options.merge h)
|
1229
|
-
|
1686
|
+
super(h)
|
1687
|
+
@group = 'application'
|
1230
1688
|
end
|
1231
|
-
|
1689
|
+
|
1232
1690
|
end
|
1233
1691
|
|
1234
|
-
|
1692
|
+
# Category: Applications
|
1693
|
+
#
|
1694
|
+
class LaunchActivityAction < ApplicationAction
|
1235
1695
|
|
1236
1696
|
def initialize(h={})
|
1237
1697
|
|
@@ -1248,7 +1708,9 @@ class LaunchActivityAction < Action
|
|
1248
1708
|
|
1249
1709
|
end
|
1250
1710
|
|
1251
|
-
|
1711
|
+
# Category: Applications
|
1712
|
+
#
|
1713
|
+
class KillBackgroundAppAction < ApplicationAction
|
1252
1714
|
|
1253
1715
|
def initialize(h={})
|
1254
1716
|
|
@@ -1263,7 +1725,9 @@ class KillBackgroundAppAction < Action
|
|
1263
1725
|
|
1264
1726
|
end
|
1265
1727
|
|
1266
|
-
|
1728
|
+
# Category: Applications
|
1729
|
+
#
|
1730
|
+
class OpenWebPageAction < ApplicationAction
|
1267
1731
|
|
1268
1732
|
def initialize(h={})
|
1269
1733
|
|
@@ -1281,7 +1745,19 @@ class OpenWebPageAction < Action
|
|
1281
1745
|
|
1282
1746
|
end
|
1283
1747
|
|
1284
|
-
|
1748
|
+
|
1749
|
+
class CameraAction < Action
|
1750
|
+
|
1751
|
+
def initialize(h={})
|
1752
|
+
super(h)
|
1753
|
+
@group = 'camera'
|
1754
|
+
end
|
1755
|
+
|
1756
|
+
end
|
1757
|
+
|
1758
|
+
# Category: Camera/Photo
|
1759
|
+
#
|
1760
|
+
class UploadPhotoAction < CameraAction
|
1285
1761
|
|
1286
1762
|
def initialize(h={})
|
1287
1763
|
|
@@ -1296,7 +1772,9 @@ class UploadPhotoAction < Action
|
|
1296
1772
|
|
1297
1773
|
end
|
1298
1774
|
|
1299
|
-
|
1775
|
+
# Category: Camera/Photo
|
1776
|
+
#
|
1777
|
+
class TakePictureAction < CameraAction
|
1300
1778
|
|
1301
1779
|
def initialize(h={})
|
1302
1780
|
|
@@ -1314,7 +1792,19 @@ class TakePictureAction < Action
|
|
1314
1792
|
|
1315
1793
|
end
|
1316
1794
|
|
1317
|
-
|
1795
|
+
|
1796
|
+
class ConnectivityAction < Action
|
1797
|
+
|
1798
|
+
def initialize(h={})
|
1799
|
+
super(h)
|
1800
|
+
@group = 'connectivity'
|
1801
|
+
end
|
1802
|
+
|
1803
|
+
end
|
1804
|
+
|
1805
|
+
# Category: Connectivity
|
1806
|
+
#
|
1807
|
+
class SetWifiAction < ConnectivityAction
|
1318
1808
|
|
1319
1809
|
def initialize(h={})
|
1320
1810
|
|
@@ -1330,7 +1820,9 @@ class SetWifiAction < Action
|
|
1330
1820
|
|
1331
1821
|
end
|
1332
1822
|
|
1333
|
-
|
1823
|
+
# Category: Connectivity
|
1824
|
+
#
|
1825
|
+
class SetBluetoothAction < ConnectivityAction
|
1334
1826
|
|
1335
1827
|
def initialize(h={})
|
1336
1828
|
|
@@ -1345,7 +1837,9 @@ class SetBluetoothAction < Action
|
|
1345
1837
|
|
1346
1838
|
end
|
1347
1839
|
|
1348
|
-
|
1840
|
+
# Category: Connectivity
|
1841
|
+
#
|
1842
|
+
class SetBluetoothAction < ConnectivityAction
|
1349
1843
|
|
1350
1844
|
def initialize(h={})
|
1351
1845
|
|
@@ -1360,7 +1854,9 @@ class SetBluetoothAction < Action
|
|
1360
1854
|
|
1361
1855
|
end
|
1362
1856
|
|
1363
|
-
|
1857
|
+
# Category: Connectivity
|
1858
|
+
#
|
1859
|
+
class SendIntentAction < ConnectivityAction
|
1364
1860
|
|
1365
1861
|
def initialize(h={})
|
1366
1862
|
|
@@ -1386,7 +1882,19 @@ class SendIntentAction < Action
|
|
1386
1882
|
|
1387
1883
|
end
|
1388
1884
|
|
1389
|
-
|
1885
|
+
|
1886
|
+
class DateTimeAction < Action
|
1887
|
+
|
1888
|
+
def initialize(h={})
|
1889
|
+
super(h)
|
1890
|
+
@group = 'datetime'
|
1891
|
+
end
|
1892
|
+
|
1893
|
+
end
|
1894
|
+
|
1895
|
+
# Category: Date/Time
|
1896
|
+
#
|
1897
|
+
class SetAlarmClockAction < DateTimeAction
|
1390
1898
|
|
1391
1899
|
def initialize(h={})
|
1392
1900
|
|
@@ -1409,7 +1917,9 @@ class SetAlarmClockAction < Action
|
|
1409
1917
|
|
1410
1918
|
end
|
1411
1919
|
|
1412
|
-
|
1920
|
+
# Category: Date/Time
|
1921
|
+
#
|
1922
|
+
class StopWatchAction < DateTimeAction
|
1413
1923
|
|
1414
1924
|
def initialize(h={})
|
1415
1925
|
|
@@ -1424,7 +1934,9 @@ class StopWatchAction < Action
|
|
1424
1934
|
|
1425
1935
|
end
|
1426
1936
|
|
1427
|
-
|
1937
|
+
# Category: Date/Time
|
1938
|
+
#
|
1939
|
+
class SayTimeAction < DateTimeAction
|
1428
1940
|
|
1429
1941
|
def initialize(h={})
|
1430
1942
|
|
@@ -1438,7 +1950,19 @@ class SayTimeAction < Action
|
|
1438
1950
|
|
1439
1951
|
end
|
1440
1952
|
|
1441
|
-
|
1953
|
+
|
1954
|
+
class DeviceAction < Action
|
1955
|
+
|
1956
|
+
def initialize(h={})
|
1957
|
+
super(h)
|
1958
|
+
@group = 'device'
|
1959
|
+
end
|
1960
|
+
|
1961
|
+
end
|
1962
|
+
|
1963
|
+
# Category: Device Actions
|
1964
|
+
#
|
1965
|
+
class AndroidShortcutsAction < DeviceAction
|
1442
1966
|
|
1443
1967
|
def initialize(h={})
|
1444
1968
|
|
@@ -1452,7 +1976,9 @@ class AndroidShortcutsAction < Action
|
|
1452
1976
|
|
1453
1977
|
end
|
1454
1978
|
|
1455
|
-
|
1979
|
+
# Category: Device Actions
|
1980
|
+
#
|
1981
|
+
class ClipboardAction < DeviceAction
|
1456
1982
|
|
1457
1983
|
def initialize(h={})
|
1458
1984
|
|
@@ -1466,7 +1992,9 @@ class ClipboardAction < Action
|
|
1466
1992
|
|
1467
1993
|
end
|
1468
1994
|
|
1469
|
-
|
1995
|
+
# Category: Device Actions
|
1996
|
+
#
|
1997
|
+
class PressBackAction < DeviceAction
|
1470
1998
|
|
1471
1999
|
def initialize(h={})
|
1472
2000
|
|
@@ -1479,7 +2007,9 @@ class PressBackAction < Action
|
|
1479
2007
|
|
1480
2008
|
end
|
1481
2009
|
|
1482
|
-
|
2010
|
+
# Category: Device Actions
|
2011
|
+
#
|
2012
|
+
class SpeakTextAction < DeviceAction
|
1483
2013
|
|
1484
2014
|
def initialize(h={})
|
1485
2015
|
|
@@ -1500,7 +2030,9 @@ class SpeakTextAction < Action
|
|
1500
2030
|
|
1501
2031
|
end
|
1502
2032
|
|
1503
|
-
|
2033
|
+
# Category: Device Actions
|
2034
|
+
#
|
2035
|
+
class UIInteractionAction < DeviceAction
|
1504
2036
|
|
1505
2037
|
def initialize(h={})
|
1506
2038
|
|
@@ -1515,7 +2047,9 @@ class UIInteractionAction < Action
|
|
1515
2047
|
|
1516
2048
|
end
|
1517
2049
|
|
1518
|
-
|
2050
|
+
# Category: Device Actions
|
2051
|
+
#
|
2052
|
+
class VoiceSearchAction < DeviceAction
|
1519
2053
|
|
1520
2054
|
def initialize(h={})
|
1521
2055
|
|
@@ -1528,7 +2062,19 @@ class VoiceSearchAction < Action
|
|
1528
2062
|
|
1529
2063
|
end
|
1530
2064
|
|
1531
|
-
|
2065
|
+
|
2066
|
+
class DeviceSettingsAction < Action
|
2067
|
+
|
2068
|
+
def initialize(h={})
|
2069
|
+
super(h)
|
2070
|
+
@group = 'devicesettings'
|
2071
|
+
end
|
2072
|
+
|
2073
|
+
end
|
2074
|
+
|
2075
|
+
# Category: Device Settings
|
2076
|
+
#
|
2077
|
+
class ExpandCollapseStatusBarAction < DeviceSettingsAction
|
1532
2078
|
|
1533
2079
|
def initialize(h={})
|
1534
2080
|
|
@@ -1542,7 +2088,9 @@ class ExpandCollapseStatusBarAction < Action
|
|
1542
2088
|
|
1543
2089
|
end
|
1544
2090
|
|
1545
|
-
|
2091
|
+
# Category: Device Settings
|
2092
|
+
#
|
2093
|
+
class LaunchHomeScreenAction < DeviceSettingsAction
|
1546
2094
|
|
1547
2095
|
def initialize(h={})
|
1548
2096
|
|
@@ -1555,7 +2103,9 @@ class LaunchHomeScreenAction < Action
|
|
1555
2103
|
|
1556
2104
|
end
|
1557
2105
|
|
1558
|
-
|
2106
|
+
# Category: Device Settings
|
2107
|
+
#
|
2108
|
+
class CameraFlashLightAction < DeviceSettingsAction
|
1559
2109
|
|
1560
2110
|
def initialize(h={})
|
1561
2111
|
|
@@ -1570,7 +2120,9 @@ class CameraFlashLightAction < Action
|
|
1570
2120
|
|
1571
2121
|
end
|
1572
2122
|
|
1573
|
-
|
2123
|
+
# Category: Device Settings
|
2124
|
+
#
|
2125
|
+
class VibrateAction < DeviceSettingsAction
|
1574
2126
|
|
1575
2127
|
def initialize(h={})
|
1576
2128
|
|
@@ -1584,7 +2136,9 @@ class VibrateAction < Action
|
|
1584
2136
|
|
1585
2137
|
end
|
1586
2138
|
|
1587
|
-
|
2139
|
+
# Category: Device Settings
|
2140
|
+
#
|
2141
|
+
class SetAutoRotateAction < DeviceSettingsAction
|
1588
2142
|
|
1589
2143
|
def initialize(h={})
|
1590
2144
|
|
@@ -1598,7 +2152,9 @@ class SetAutoRotateAction < Action
|
|
1598
2152
|
|
1599
2153
|
end
|
1600
2154
|
|
1601
|
-
|
2155
|
+
# Category: Device Settings
|
2156
|
+
#
|
2157
|
+
class DayDreamAction < DeviceSettingsAction
|
1602
2158
|
|
1603
2159
|
def initialize(h={})
|
1604
2160
|
|
@@ -1611,7 +2167,9 @@ class DayDreamAction < Action
|
|
1611
2167
|
|
1612
2168
|
end
|
1613
2169
|
|
1614
|
-
|
2170
|
+
# Category: Device Settings
|
2171
|
+
#
|
2172
|
+
class SetKeyboardAction < DeviceSettingsAction
|
1615
2173
|
|
1616
2174
|
def initialize(h={})
|
1617
2175
|
|
@@ -1624,7 +2182,9 @@ class SetKeyboardAction < Action
|
|
1624
2182
|
|
1625
2183
|
end
|
1626
2184
|
|
1627
|
-
|
2185
|
+
# Category: Device Settings
|
2186
|
+
#
|
2187
|
+
class SetKeyguardAction < DeviceSettingsAction
|
1628
2188
|
|
1629
2189
|
def initialize(h={})
|
1630
2190
|
|
@@ -1638,7 +2198,9 @@ class SetKeyguardAction < Action
|
|
1638
2198
|
|
1639
2199
|
end
|
1640
2200
|
|
1641
|
-
|
2201
|
+
# Category: Device Settings
|
2202
|
+
#
|
2203
|
+
class CarModeAction < DeviceSettingsAction
|
1642
2204
|
|
1643
2205
|
def initialize(h={})
|
1644
2206
|
|
@@ -1652,7 +2214,9 @@ class CarModeAction < Action
|
|
1652
2214
|
|
1653
2215
|
end
|
1654
2216
|
|
1655
|
-
|
2217
|
+
# Category: Device Settings
|
2218
|
+
#
|
2219
|
+
class ChangeKeyboardAction < DeviceSettingsAction
|
1656
2220
|
|
1657
2221
|
def initialize(h={})
|
1658
2222
|
|
@@ -1667,7 +2231,9 @@ class ChangeKeyboardAction < Action
|
|
1667
2231
|
|
1668
2232
|
end
|
1669
2233
|
|
1670
|
-
|
2234
|
+
# Category: Device Settings
|
2235
|
+
#
|
2236
|
+
class SetWallpaperAction < DeviceSettingsAction
|
1671
2237
|
|
1672
2238
|
def initialize(h={})
|
1673
2239
|
|
@@ -1686,7 +2252,18 @@ class SetWallpaperAction < Action
|
|
1686
2252
|
|
1687
2253
|
end
|
1688
2254
|
|
1689
|
-
class
|
2255
|
+
class FileAction < Action
|
2256
|
+
|
2257
|
+
def initialize(h={})
|
2258
|
+
super(h)
|
2259
|
+
@group = 'file'
|
2260
|
+
end
|
2261
|
+
|
2262
|
+
end
|
2263
|
+
|
2264
|
+
# Category: Files
|
2265
|
+
#
|
2266
|
+
class OpenFileAction < FileAction
|
1690
2267
|
|
1691
2268
|
def initialize(h={})
|
1692
2269
|
|
@@ -1703,7 +2280,19 @@ class OpenFileAction < Action
|
|
1703
2280
|
|
1704
2281
|
end
|
1705
2282
|
|
1706
|
-
|
2283
|
+
|
2284
|
+
class LocationAction < Action
|
2285
|
+
|
2286
|
+
def initialize(h={})
|
2287
|
+
super(h)
|
2288
|
+
@group = 'location'
|
2289
|
+
end
|
2290
|
+
|
2291
|
+
end
|
2292
|
+
|
2293
|
+
# Category: Location
|
2294
|
+
#
|
2295
|
+
class ForceLocationUpdateAction < LocationAction
|
1707
2296
|
|
1708
2297
|
def initialize(h={})
|
1709
2298
|
|
@@ -1716,7 +2305,9 @@ class ForceLocationUpdateAction < Action
|
|
1716
2305
|
|
1717
2306
|
end
|
1718
2307
|
|
1719
|
-
|
2308
|
+
# Category: Location
|
2309
|
+
#
|
2310
|
+
class ShareLocationAction < LocationAction
|
1720
2311
|
|
1721
2312
|
def initialize(h={})
|
1722
2313
|
|
@@ -1734,7 +2325,9 @@ class ShareLocationAction < Action
|
|
1734
2325
|
|
1735
2326
|
end
|
1736
2327
|
|
1737
|
-
|
2328
|
+
# Category: Location
|
2329
|
+
#
|
2330
|
+
class SetLocationUpdateRateAction < LocationAction
|
1738
2331
|
|
1739
2332
|
def initialize(h={})
|
1740
2333
|
|
@@ -1749,7 +2342,18 @@ class SetLocationUpdateRateAction < Action
|
|
1749
2342
|
|
1750
2343
|
end
|
1751
2344
|
|
1752
|
-
class
|
2345
|
+
class LoggingAction < Action
|
2346
|
+
|
2347
|
+
def initialize(h={})
|
2348
|
+
super(h)
|
2349
|
+
@group = 'logging'
|
2350
|
+
end
|
2351
|
+
|
2352
|
+
end
|
2353
|
+
|
2354
|
+
# Category: Logging
|
2355
|
+
#
|
2356
|
+
class AddCalendarEntryAction < LoggingAction
|
1753
2357
|
|
1754
2358
|
def initialize(h={})
|
1755
2359
|
|
@@ -1776,7 +2380,9 @@ class AddCalendarEntryAction < Action
|
|
1776
2380
|
|
1777
2381
|
end
|
1778
2382
|
|
1779
|
-
|
2383
|
+
# Category: Logging
|
2384
|
+
#
|
2385
|
+
class LogAction < LoggingAction
|
1780
2386
|
|
1781
2387
|
def initialize(h={})
|
1782
2388
|
|
@@ -1791,7 +2397,9 @@ class LogAction < Action
|
|
1791
2397
|
|
1792
2398
|
end
|
1793
2399
|
|
1794
|
-
|
2400
|
+
# Category: Logging
|
2401
|
+
#
|
2402
|
+
class ClearLogAction < LoggingAction
|
1795
2403
|
|
1796
2404
|
def initialize(h={})
|
1797
2405
|
|
@@ -1805,24 +2413,18 @@ class ClearLogAction < Action
|
|
1805
2413
|
|
1806
2414
|
end
|
1807
2415
|
|
1808
|
-
class
|
1809
|
-
|
2416
|
+
class MediaAction < Action
|
2417
|
+
|
1810
2418
|
def initialize(h={})
|
1811
|
-
|
1812
|
-
|
1813
|
-
path: '',
|
1814
|
-
record_time_string: 'Until Cancelled',
|
1815
|
-
recording_format: 0,
|
1816
|
-
seconds_to_record_for: -1
|
1817
|
-
}
|
1818
|
-
|
1819
|
-
super(options.merge h)
|
1820
|
-
|
2419
|
+
super(h)
|
2420
|
+
@group = 'media'
|
1821
2421
|
end
|
1822
|
-
|
2422
|
+
|
1823
2423
|
end
|
1824
2424
|
|
1825
|
-
|
2425
|
+
# Category: Media
|
2426
|
+
#
|
2427
|
+
class RecordMicrophoneAction < MediaAction
|
1826
2428
|
|
1827
2429
|
def initialize(h={})
|
1828
2430
|
|
@@ -1839,7 +2441,9 @@ class RecordMicrophoneAction < Action
|
|
1839
2441
|
|
1840
2442
|
end
|
1841
2443
|
|
1842
|
-
|
2444
|
+
# Category: Media
|
2445
|
+
#
|
2446
|
+
class PlaySoundAction < MediaAction
|
1843
2447
|
|
1844
2448
|
def initialize(h={})
|
1845
2449
|
|
@@ -1855,7 +2459,18 @@ class PlaySoundAction < Action
|
|
1855
2459
|
end
|
1856
2460
|
|
1857
2461
|
|
1858
|
-
class
|
2462
|
+
class MessagingAction < Action
|
2463
|
+
|
2464
|
+
def initialize(h={})
|
2465
|
+
super(h)
|
2466
|
+
@group = 'messaging'
|
2467
|
+
end
|
2468
|
+
|
2469
|
+
end
|
2470
|
+
|
2471
|
+
# Category: Messaging
|
2472
|
+
#
|
2473
|
+
class SendEmailAction < MessagingAction
|
1859
2474
|
|
1860
2475
|
def initialize(h={})
|
1861
2476
|
|
@@ -1875,7 +2490,9 @@ class SendEmailAction < Action
|
|
1875
2490
|
|
1876
2491
|
end
|
1877
2492
|
|
1878
|
-
|
2493
|
+
# Category: Messaging
|
2494
|
+
#
|
2495
|
+
class SendSMSAction < MessagingAction
|
1879
2496
|
|
1880
2497
|
def initialize(h={})
|
1881
2498
|
|
@@ -1894,7 +2511,9 @@ class SendSMSAction < Action
|
|
1894
2511
|
|
1895
2512
|
end
|
1896
2513
|
|
1897
|
-
|
2514
|
+
# Category: Messaging
|
2515
|
+
#
|
2516
|
+
class UDPCommandAction < MessagingAction
|
1898
2517
|
|
1899
2518
|
def initialize(h={})
|
1900
2519
|
|
@@ -1910,7 +2529,19 @@ class UDPCommandAction < Action
|
|
1910
2529
|
|
1911
2530
|
end
|
1912
2531
|
|
1913
|
-
|
2532
|
+
|
2533
|
+
class NotificationsAction < Action
|
2534
|
+
|
2535
|
+
def initialize(h={})
|
2536
|
+
super(h)
|
2537
|
+
@group = 'notifications'
|
2538
|
+
end
|
2539
|
+
|
2540
|
+
end
|
2541
|
+
|
2542
|
+
# Category: Notifications
|
2543
|
+
#
|
2544
|
+
class ClearNotificationsAction < NotificationsAction
|
1914
2545
|
|
1915
2546
|
def initialize(h={})
|
1916
2547
|
|
@@ -1932,7 +2563,9 @@ class ClearNotificationsAction < Action
|
|
1932
2563
|
|
1933
2564
|
end
|
1934
2565
|
|
1935
|
-
|
2566
|
+
# Category: Notifications
|
2567
|
+
#
|
2568
|
+
class MessageDialogAction < NotificationsAction
|
1936
2569
|
|
1937
2570
|
def initialize(h={})
|
1938
2571
|
|
@@ -1957,7 +2590,9 @@ class MessageDialogAction < Action
|
|
1957
2590
|
|
1958
2591
|
end
|
1959
2592
|
|
1960
|
-
|
2593
|
+
# Category: Notifications
|
2594
|
+
#
|
2595
|
+
class AllowLEDNotificationLightAction < NotificationsAction
|
1961
2596
|
|
1962
2597
|
def initialize(h={})
|
1963
2598
|
|
@@ -1971,7 +2606,9 @@ class AllowLEDNotificationLightAction < Action
|
|
1971
2606
|
|
1972
2607
|
end
|
1973
2608
|
|
1974
|
-
|
2609
|
+
# Category: Notifications
|
2610
|
+
#
|
2611
|
+
class SetNotificationSoundAction < NotificationsAction
|
1975
2612
|
|
1976
2613
|
def initialize(h={})
|
1977
2614
|
|
@@ -1985,7 +2622,9 @@ class SetNotificationSoundAction < Action
|
|
1985
2622
|
|
1986
2623
|
end
|
1987
2624
|
|
1988
|
-
|
2625
|
+
# Category: Notifications
|
2626
|
+
#
|
2627
|
+
class SetNotificationSoundAction < NotificationsAction
|
1989
2628
|
|
1990
2629
|
def initialize(h={})
|
1991
2630
|
|
@@ -1999,7 +2638,9 @@ class SetNotificationSoundAction < Action
|
|
1999
2638
|
|
2000
2639
|
end
|
2001
2640
|
|
2002
|
-
|
2641
|
+
# Category: Notifications
|
2642
|
+
#
|
2643
|
+
class SetNotificationSoundAction < NotificationsAction
|
2003
2644
|
|
2004
2645
|
def initialize(h={})
|
2005
2646
|
|
@@ -2013,7 +2654,9 @@ class SetNotificationSoundAction < Action
|
|
2013
2654
|
|
2014
2655
|
end
|
2015
2656
|
|
2016
|
-
|
2657
|
+
# Category: Notifications
|
2658
|
+
#
|
2659
|
+
class NotificationAction < NotificationsAction
|
2017
2660
|
|
2018
2661
|
def initialize(h={})
|
2019
2662
|
|
@@ -2037,10 +2680,17 @@ class NotificationAction < Action
|
|
2037
2680
|
|
2038
2681
|
end
|
2039
2682
|
|
2040
|
-
|
2683
|
+
# Category: Notifications
|
2684
|
+
#
|
2685
|
+
class ToastAction < NotificationsAction
|
2041
2686
|
|
2042
2687
|
def initialize(h={})
|
2043
2688
|
|
2689
|
+
if h[:msg] then
|
2690
|
+
h[:message_text] = h[:msg]
|
2691
|
+
h.delete :msg
|
2692
|
+
end
|
2693
|
+
|
2044
2694
|
options = {
|
2045
2695
|
message_text: '',
|
2046
2696
|
image_resource_name: 'launcher_no_border',
|
@@ -2055,10 +2705,26 @@ class ToastAction < Action
|
|
2055
2705
|
super(options.merge h)
|
2056
2706
|
|
2057
2707
|
end
|
2708
|
+
|
2709
|
+
def invoke()
|
2710
|
+
super(@h[:message_text])
|
2711
|
+
end
|
2712
|
+
|
2713
|
+
end
|
2714
|
+
|
2058
2715
|
|
2716
|
+
class PhoneAction < Action
|
2717
|
+
|
2718
|
+
def initialize(h={})
|
2719
|
+
super(h)
|
2720
|
+
@group = 'phone'
|
2721
|
+
end
|
2722
|
+
|
2059
2723
|
end
|
2060
2724
|
|
2061
|
-
|
2725
|
+
# Category: Phone
|
2726
|
+
#
|
2727
|
+
class AnswerCallAction < PhoneAction
|
2062
2728
|
|
2063
2729
|
def initialize(h={})
|
2064
2730
|
|
@@ -2072,7 +2738,9 @@ class AnswerCallAction < Action
|
|
2072
2738
|
|
2073
2739
|
end
|
2074
2740
|
|
2075
|
-
|
2741
|
+
# Category: Phone
|
2742
|
+
#
|
2743
|
+
class ClearCallLogAction < PhoneAction
|
2076
2744
|
|
2077
2745
|
def initialize(h={})
|
2078
2746
|
|
@@ -2088,7 +2756,9 @@ class ClearCallLogAction < Action
|
|
2088
2756
|
|
2089
2757
|
end
|
2090
2758
|
|
2091
|
-
|
2759
|
+
# Category: Phone
|
2760
|
+
#
|
2761
|
+
class OpenCallLogAction < PhoneAction
|
2092
2762
|
|
2093
2763
|
def initialize(h={})
|
2094
2764
|
|
@@ -2101,7 +2771,9 @@ class OpenCallLogAction < Action
|
|
2101
2771
|
|
2102
2772
|
end
|
2103
2773
|
|
2104
|
-
|
2774
|
+
# Category: Phone
|
2775
|
+
#
|
2776
|
+
class RejectCallAction < PhoneAction
|
2105
2777
|
|
2106
2778
|
def initialize(h={})
|
2107
2779
|
|
@@ -2114,7 +2786,9 @@ class RejectCallAction < Action
|
|
2114
2786
|
|
2115
2787
|
end
|
2116
2788
|
|
2117
|
-
|
2789
|
+
# Category: Phone
|
2790
|
+
#
|
2791
|
+
class MakeCallAction < PhoneAction
|
2118
2792
|
|
2119
2793
|
def initialize(h={})
|
2120
2794
|
|
@@ -2129,7 +2803,10 @@ class MakeCallAction < Action
|
|
2129
2803
|
|
2130
2804
|
end
|
2131
2805
|
|
2132
|
-
|
2806
|
+
|
2807
|
+
# Category: Phone
|
2808
|
+
#
|
2809
|
+
class SetRingtoneAction < PhoneAction
|
2133
2810
|
|
2134
2811
|
def initialize(h={})
|
2135
2812
|
|
@@ -2143,7 +2820,18 @@ class SetRingtoneAction < Action
|
|
2143
2820
|
|
2144
2821
|
end
|
2145
2822
|
|
2146
|
-
class
|
2823
|
+
class ScreenAction < Action
|
2824
|
+
|
2825
|
+
def initialize(h={})
|
2826
|
+
super(h)
|
2827
|
+
@group = 'screen'
|
2828
|
+
end
|
2829
|
+
|
2830
|
+
end
|
2831
|
+
|
2832
|
+
# Category: Screen
|
2833
|
+
#
|
2834
|
+
class SetBrightnessAction < ScreenAction
|
2147
2835
|
|
2148
2836
|
def initialize(h={})
|
2149
2837
|
|
@@ -2159,7 +2847,9 @@ class SetBrightnessAction < Action
|
|
2159
2847
|
|
2160
2848
|
end
|
2161
2849
|
|
2162
|
-
|
2850
|
+
# Category: Screen
|
2851
|
+
#
|
2852
|
+
class ForceScreenRotationAction < ScreenAction
|
2163
2853
|
|
2164
2854
|
def initialize(h={})
|
2165
2855
|
|
@@ -2173,7 +2863,9 @@ class ForceScreenRotationAction < Action
|
|
2173
2863
|
|
2174
2864
|
end
|
2175
2865
|
|
2176
|
-
|
2866
|
+
# Category: Screen
|
2867
|
+
#
|
2868
|
+
class ScreenOnAction < ScreenAction
|
2177
2869
|
|
2178
2870
|
def initialize(h={})
|
2179
2871
|
|
@@ -2190,7 +2882,9 @@ class ScreenOnAction < Action
|
|
2190
2882
|
|
2191
2883
|
end
|
2192
2884
|
|
2193
|
-
|
2885
|
+
# Category: Screen
|
2886
|
+
#
|
2887
|
+
class DimScreenAction < ScreenAction
|
2194
2888
|
|
2195
2889
|
def initialize(h={})
|
2196
2890
|
|
@@ -2205,7 +2899,9 @@ class DimScreenAction < Action
|
|
2205
2899
|
|
2206
2900
|
end
|
2207
2901
|
|
2208
|
-
|
2902
|
+
# Category: Screen
|
2903
|
+
#
|
2904
|
+
class KeepAwakeAction < ScreenAction
|
2209
2905
|
|
2210
2906
|
def initialize(h={})
|
2211
2907
|
|
@@ -2222,7 +2918,9 @@ class KeepAwakeAction < Action
|
|
2222
2918
|
|
2223
2919
|
end
|
2224
2920
|
|
2225
|
-
|
2921
|
+
# Category: Screen
|
2922
|
+
#
|
2923
|
+
class SetScreenTimeoutAction < ScreenAction
|
2226
2924
|
|
2227
2925
|
def initialize(h={})
|
2228
2926
|
|
@@ -2239,8 +2937,18 @@ class SetScreenTimeoutAction < Action
|
|
2239
2937
|
end
|
2240
2938
|
|
2241
2939
|
|
2940
|
+
class VolumeAction < Action
|
2941
|
+
|
2942
|
+
def initialize(h={})
|
2943
|
+
super(h)
|
2944
|
+
@group = 'volume'
|
2945
|
+
end
|
2946
|
+
|
2947
|
+
end
|
2242
2948
|
|
2243
|
-
|
2949
|
+
# Category: Volume
|
2950
|
+
#
|
2951
|
+
class SilentModeVibrateOffAction < VolumeAction
|
2244
2952
|
|
2245
2953
|
def initialize(h={})
|
2246
2954
|
|
@@ -2254,7 +2962,9 @@ class SilentModeVibrateOffAction < Action
|
|
2254
2962
|
|
2255
2963
|
end
|
2256
2964
|
|
2257
|
-
|
2965
|
+
# Category: Volume
|
2966
|
+
#
|
2967
|
+
class SetVibrateAction < VolumeAction
|
2258
2968
|
|
2259
2969
|
def initialize(h={})
|
2260
2970
|
|
@@ -2269,7 +2979,9 @@ class SetVibrateAction < Action
|
|
2269
2979
|
|
2270
2980
|
end
|
2271
2981
|
|
2272
|
-
|
2982
|
+
# Category: Volume
|
2983
|
+
#
|
2984
|
+
class VolumeIncrementDecrementAction < VolumeAction
|
2273
2985
|
|
2274
2986
|
def initialize(h={})
|
2275
2987
|
|
@@ -2283,7 +2995,9 @@ class VolumeIncrementDecrementAction < Action
|
|
2283
2995
|
|
2284
2996
|
end
|
2285
2997
|
|
2286
|
-
|
2998
|
+
# Category: Volume
|
2999
|
+
#
|
3000
|
+
class SpeakerPhoneAction < VolumeAction
|
2287
3001
|
|
2288
3002
|
def initialize(h={})
|
2289
3003
|
|
@@ -2298,9 +3012,9 @@ class SpeakerPhoneAction < Action
|
|
2298
3012
|
|
2299
3013
|
end
|
2300
3014
|
|
2301
|
-
|
2302
|
-
|
2303
|
-
class SetVolumeAction <
|
3015
|
+
# Category: Volume
|
3016
|
+
#
|
3017
|
+
class SetVolumeAction < VolumeAction
|
2304
3018
|
|
2305
3019
|
def initialize(h={})
|
2306
3020
|
|
@@ -2325,3 +3039,856 @@ class Constraint < MacroObject
|
|
2325
3039
|
end
|
2326
3040
|
|
2327
3041
|
end
|
3042
|
+
|
3043
|
+
class TimeOfDayConstraint < Constraint
|
3044
|
+
|
3045
|
+
def initialize(h={})
|
3046
|
+
|
3047
|
+
options = {
|
3048
|
+
end_hour: 8,
|
3049
|
+
end_minute: 0,
|
3050
|
+
start_hour: 22,
|
3051
|
+
start_minute: 0
|
3052
|
+
}
|
3053
|
+
|
3054
|
+
super(options.merge h)
|
3055
|
+
|
3056
|
+
end
|
3057
|
+
|
3058
|
+
end
|
3059
|
+
|
3060
|
+
# Category: Battery/Power
|
3061
|
+
#
|
3062
|
+
class BatteryLevelConstraint < Constraint
|
3063
|
+
|
3064
|
+
def initialize(h={})
|
3065
|
+
|
3066
|
+
options = {
|
3067
|
+
battery_level: 23,
|
3068
|
+
equals: false,
|
3069
|
+
greater_than: false
|
3070
|
+
}
|
3071
|
+
|
3072
|
+
super(options.merge h)
|
3073
|
+
|
3074
|
+
end
|
3075
|
+
|
3076
|
+
end
|
3077
|
+
|
3078
|
+
# Category: Battery/Power
|
3079
|
+
#
|
3080
|
+
class BatterySaverStateConstraint < Constraint
|
3081
|
+
|
3082
|
+
def initialize(h={})
|
3083
|
+
|
3084
|
+
options = {
|
3085
|
+
option: 0
|
3086
|
+
}
|
3087
|
+
|
3088
|
+
super(options.merge h)
|
3089
|
+
|
3090
|
+
end
|
3091
|
+
|
3092
|
+
end
|
3093
|
+
|
3094
|
+
# Category: Battery/Power
|
3095
|
+
#
|
3096
|
+
class BatteryTemperatureConstraint < Constraint
|
3097
|
+
|
3098
|
+
def initialize(h={})
|
3099
|
+
|
3100
|
+
options = {
|
3101
|
+
equals: false,
|
3102
|
+
greater_than: false,
|
3103
|
+
temperature: 30
|
3104
|
+
}
|
3105
|
+
|
3106
|
+
super(options.merge h)
|
3107
|
+
|
3108
|
+
end
|
3109
|
+
|
3110
|
+
end
|
3111
|
+
|
3112
|
+
# Category: Battery/Power
|
3113
|
+
#
|
3114
|
+
class ExternalPowerConstraint < Constraint
|
3115
|
+
|
3116
|
+
def initialize(h={})
|
3117
|
+
|
3118
|
+
options = {
|
3119
|
+
external_power: true,
|
3120
|
+
power_connected_options: [false, true, false]
|
3121
|
+
}
|
3122
|
+
|
3123
|
+
super(options.merge h)
|
3124
|
+
|
3125
|
+
end
|
3126
|
+
|
3127
|
+
end
|
3128
|
+
|
3129
|
+
# Category: Connectivity
|
3130
|
+
#
|
3131
|
+
class BluetoothConstraint < Constraint
|
3132
|
+
|
3133
|
+
def initialize(h={})
|
3134
|
+
|
3135
|
+
options = {
|
3136
|
+
any_device: false,
|
3137
|
+
bt_state: 0,
|
3138
|
+
device_name: 'Any Device'
|
3139
|
+
}
|
3140
|
+
|
3141
|
+
super(options.merge h)
|
3142
|
+
|
3143
|
+
end
|
3144
|
+
|
3145
|
+
end
|
3146
|
+
|
3147
|
+
# Category: Connectivity
|
3148
|
+
#
|
3149
|
+
class GPSEnabledConstraint < Constraint
|
3150
|
+
|
3151
|
+
def initialize(h={})
|
3152
|
+
|
3153
|
+
options = {
|
3154
|
+
enabled: true
|
3155
|
+
}
|
3156
|
+
|
3157
|
+
super(options.merge h)
|
3158
|
+
|
3159
|
+
end
|
3160
|
+
|
3161
|
+
end
|
3162
|
+
|
3163
|
+
# Category: Connectivity
|
3164
|
+
#
|
3165
|
+
class LocationModeConstraint < Constraint
|
3166
|
+
|
3167
|
+
def initialize(h={})
|
3168
|
+
|
3169
|
+
options = {
|
3170
|
+
options: [false, false, false, true]
|
3171
|
+
}
|
3172
|
+
|
3173
|
+
super(options.merge h)
|
3174
|
+
|
3175
|
+
end
|
3176
|
+
|
3177
|
+
end
|
3178
|
+
|
3179
|
+
# Category: Connectivity
|
3180
|
+
#
|
3181
|
+
class SignalOnOffConstraint < Constraint
|
3182
|
+
|
3183
|
+
def initialize(h={})
|
3184
|
+
|
3185
|
+
options = {
|
3186
|
+
option: 0
|
3187
|
+
}
|
3188
|
+
|
3189
|
+
super(options.merge h)
|
3190
|
+
|
3191
|
+
end
|
3192
|
+
|
3193
|
+
end
|
3194
|
+
|
3195
|
+
# Category: Connectivity
|
3196
|
+
#
|
3197
|
+
class WifiConstraint < Constraint
|
3198
|
+
|
3199
|
+
def initialize(h={})
|
3200
|
+
|
3201
|
+
options = {
|
3202
|
+
ssid_list: [],
|
3203
|
+
wifi_state: 0
|
3204
|
+
}
|
3205
|
+
|
3206
|
+
super(options.merge h)
|
3207
|
+
|
3208
|
+
end
|
3209
|
+
|
3210
|
+
end
|
3211
|
+
|
3212
|
+
# Category: Connectivity
|
3213
|
+
#
|
3214
|
+
class CellTowerConstraint < Constraint
|
3215
|
+
|
3216
|
+
def initialize(h={})
|
3217
|
+
|
3218
|
+
options = {
|
3219
|
+
cell_group_name: 'test group',
|
3220
|
+
cell_ids: ["524,14,41070731"],
|
3221
|
+
in_range: true
|
3222
|
+
}
|
3223
|
+
|
3224
|
+
super(options.merge h)
|
3225
|
+
|
3226
|
+
end
|
3227
|
+
|
3228
|
+
end
|
3229
|
+
|
3230
|
+
# Category: Connectivity
|
3231
|
+
#
|
3232
|
+
class IsRoamingConstraint < Constraint
|
3233
|
+
|
3234
|
+
def initialize(h={})
|
3235
|
+
|
3236
|
+
options = {
|
3237
|
+
is_roaming: true
|
3238
|
+
}
|
3239
|
+
|
3240
|
+
super(options.merge h)
|
3241
|
+
|
3242
|
+
end
|
3243
|
+
|
3244
|
+
end
|
3245
|
+
|
3246
|
+
# Category: Connectivity
|
3247
|
+
#
|
3248
|
+
class DataOnOffConstraint < Constraint
|
3249
|
+
|
3250
|
+
def initialize(h={})
|
3251
|
+
|
3252
|
+
options = {
|
3253
|
+
data_on: true
|
3254
|
+
}
|
3255
|
+
|
3256
|
+
super(options.merge h)
|
3257
|
+
|
3258
|
+
end
|
3259
|
+
|
3260
|
+
end
|
3261
|
+
|
3262
|
+
# Category: Connectivity
|
3263
|
+
#
|
3264
|
+
class WifiHotSpotConstraint < Constraint
|
3265
|
+
|
3266
|
+
def initialize(h={})
|
3267
|
+
|
3268
|
+
options = {
|
3269
|
+
check_connections: false,
|
3270
|
+
comparison_value: 0,
|
3271
|
+
connected_count: 0,
|
3272
|
+
enabled: true
|
3273
|
+
}
|
3274
|
+
|
3275
|
+
super(options.merge h)
|
3276
|
+
|
3277
|
+
end
|
3278
|
+
|
3279
|
+
end
|
3280
|
+
|
3281
|
+
# Category: Date/Time
|
3282
|
+
#
|
3283
|
+
class CalendarConstraint < Constraint
|
3284
|
+
|
3285
|
+
def initialize(h={})
|
3286
|
+
|
3287
|
+
options = {
|
3288
|
+
enable_regex: false,
|
3289
|
+
availability: 0,
|
3290
|
+
calendar_id: '1',
|
3291
|
+
calendar_name: 'PC Sync',
|
3292
|
+
detail_text: '',
|
3293
|
+
entry_set: true,
|
3294
|
+
ignore_all_day: false,
|
3295
|
+
title_text: ''
|
3296
|
+
}
|
3297
|
+
|
3298
|
+
super(options.merge h)
|
3299
|
+
|
3300
|
+
end
|
3301
|
+
|
3302
|
+
end
|
3303
|
+
|
3304
|
+
# Category: Date/Time
|
3305
|
+
#
|
3306
|
+
class DayOfWeekConstraint < Constraint
|
3307
|
+
|
3308
|
+
def initialize(h={})
|
3309
|
+
|
3310
|
+
options = {
|
3311
|
+
days_of_week: [false, false, true, false, false, false, false]
|
3312
|
+
}
|
3313
|
+
|
3314
|
+
super(options.merge h)
|
3315
|
+
|
3316
|
+
end
|
3317
|
+
|
3318
|
+
end
|
3319
|
+
|
3320
|
+
# Category: Date/Time
|
3321
|
+
#
|
3322
|
+
class TimeOfDayConstraint < Constraint
|
3323
|
+
|
3324
|
+
def initialize(h={})
|
3325
|
+
|
3326
|
+
options = {
|
3327
|
+
end_hour: 1,
|
3328
|
+
end_minute: 1,
|
3329
|
+
start_hour: 21,
|
3330
|
+
start_minute: 58
|
3331
|
+
}
|
3332
|
+
|
3333
|
+
super(options.merge h)
|
3334
|
+
|
3335
|
+
end
|
3336
|
+
|
3337
|
+
end
|
3338
|
+
|
3339
|
+
# Category: Date/Time
|
3340
|
+
#
|
3341
|
+
class DayOfMonthConstraint < Constraint
|
3342
|
+
|
3343
|
+
def initialize(h={})
|
3344
|
+
|
3345
|
+
options = {
|
3346
|
+
day_names: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"],
|
3347
|
+
days_of_month: [false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false]
|
3348
|
+
}
|
3349
|
+
|
3350
|
+
super(options.merge h)
|
3351
|
+
|
3352
|
+
end
|
3353
|
+
|
3354
|
+
end
|
3355
|
+
|
3356
|
+
# Category: Date/Time
|
3357
|
+
#
|
3358
|
+
class MonthOfYearConstraint < Constraint
|
3359
|
+
|
3360
|
+
def initialize(h={})
|
3361
|
+
|
3362
|
+
options = {
|
3363
|
+
months: [false, false, false, false, false, false, false, true, false, false, false, false]
|
3364
|
+
}
|
3365
|
+
|
3366
|
+
super(options.merge h)
|
3367
|
+
|
3368
|
+
end
|
3369
|
+
|
3370
|
+
end
|
3371
|
+
|
3372
|
+
# Category: Date/Time
|
3373
|
+
#
|
3374
|
+
class SunsetSunriseConstraint < Constraint
|
3375
|
+
|
3376
|
+
def initialize(h={})
|
3377
|
+
|
3378
|
+
options = {
|
3379
|
+
option: 0
|
3380
|
+
}
|
3381
|
+
|
3382
|
+
super(options.merge h)
|
3383
|
+
|
3384
|
+
end
|
3385
|
+
|
3386
|
+
end
|
3387
|
+
|
3388
|
+
# Category: Device State
|
3389
|
+
#
|
3390
|
+
class AirplaneModeConstraint < Constraint
|
3391
|
+
|
3392
|
+
def initialize(h={})
|
3393
|
+
|
3394
|
+
options = {
|
3395
|
+
enabled: true
|
3396
|
+
}
|
3397
|
+
|
3398
|
+
super(options.merge h)
|
3399
|
+
|
3400
|
+
end
|
3401
|
+
|
3402
|
+
end
|
3403
|
+
|
3404
|
+
# Category: Device State
|
3405
|
+
#
|
3406
|
+
class AutoRotateConstraint < Constraint
|
3407
|
+
|
3408
|
+
def initialize(h={})
|
3409
|
+
|
3410
|
+
options = {
|
3411
|
+
enabled: true
|
3412
|
+
}
|
3413
|
+
|
3414
|
+
super(options.merge h)
|
3415
|
+
|
3416
|
+
end
|
3417
|
+
|
3418
|
+
end
|
3419
|
+
|
3420
|
+
# Category: Device State
|
3421
|
+
#
|
3422
|
+
class DeviceLockedConstraint < Constraint
|
3423
|
+
|
3424
|
+
def initialize(h={})
|
3425
|
+
|
3426
|
+
options = {
|
3427
|
+
locked: true
|
3428
|
+
}
|
3429
|
+
|
3430
|
+
super(options.merge h)
|
3431
|
+
|
3432
|
+
end
|
3433
|
+
|
3434
|
+
end
|
3435
|
+
|
3436
|
+
# Category: Device State
|
3437
|
+
#
|
3438
|
+
class RoamingOnOffConstraint < Constraint
|
3439
|
+
|
3440
|
+
def initialize(h={})
|
3441
|
+
|
3442
|
+
options = {
|
3443
|
+
roaming_on: true
|
3444
|
+
}
|
3445
|
+
|
3446
|
+
super(options.merge h)
|
3447
|
+
|
3448
|
+
end
|
3449
|
+
|
3450
|
+
end
|
3451
|
+
|
3452
|
+
# Category: Device State
|
3453
|
+
#
|
3454
|
+
class TimeSinceBootConstraint < Constraint
|
3455
|
+
|
3456
|
+
def initialize(h={})
|
3457
|
+
|
3458
|
+
options = {
|
3459
|
+
less_than: true,
|
3460
|
+
time_period_seconds: 10921
|
3461
|
+
}
|
3462
|
+
|
3463
|
+
super(options.merge h)
|
3464
|
+
|
3465
|
+
end
|
3466
|
+
|
3467
|
+
end
|
3468
|
+
|
3469
|
+
# Category: Device State
|
3470
|
+
#
|
3471
|
+
class AutoSyncConstraint < Constraint
|
3472
|
+
|
3473
|
+
def initialize(h={})
|
3474
|
+
|
3475
|
+
options = {
|
3476
|
+
enabled: false
|
3477
|
+
}
|
3478
|
+
|
3479
|
+
super(options.merge h)
|
3480
|
+
|
3481
|
+
end
|
3482
|
+
|
3483
|
+
end
|
3484
|
+
|
3485
|
+
# Category: Device State
|
3486
|
+
#
|
3487
|
+
class NFCStateConstraint < Constraint
|
3488
|
+
|
3489
|
+
def initialize(h={})
|
3490
|
+
|
3491
|
+
options = {
|
3492
|
+
enabled: true
|
3493
|
+
}
|
3494
|
+
|
3495
|
+
super(options.merge h)
|
3496
|
+
|
3497
|
+
end
|
3498
|
+
|
3499
|
+
end
|
3500
|
+
|
3501
|
+
# Category: Device State
|
3502
|
+
#
|
3503
|
+
class IsRootedConstraint < Constraint
|
3504
|
+
|
3505
|
+
def initialize(h={})
|
3506
|
+
|
3507
|
+
options = {
|
3508
|
+
rooted: true
|
3509
|
+
}
|
3510
|
+
|
3511
|
+
super(options.merge h)
|
3512
|
+
|
3513
|
+
end
|
3514
|
+
|
3515
|
+
end
|
3516
|
+
|
3517
|
+
# Category: Device State
|
3518
|
+
#
|
3519
|
+
class VpnConstraint < Constraint
|
3520
|
+
|
3521
|
+
def initialize(h={})
|
3522
|
+
|
3523
|
+
options = {
|
3524
|
+
option: 0
|
3525
|
+
}
|
3526
|
+
|
3527
|
+
super(options.merge h)
|
3528
|
+
|
3529
|
+
end
|
3530
|
+
|
3531
|
+
end
|
3532
|
+
|
3533
|
+
# Category: MacroDroid Specific
|
3534
|
+
#
|
3535
|
+
class MacroEnabledConstraint < Constraint
|
3536
|
+
|
3537
|
+
def initialize(h={})
|
3538
|
+
|
3539
|
+
options = {
|
3540
|
+
enabled: true,
|
3541
|
+
macro_ids: [-8016812002629322290],
|
3542
|
+
macro_names: ["Intruder photo "]
|
3543
|
+
}
|
3544
|
+
|
3545
|
+
super(options.merge h)
|
3546
|
+
|
3547
|
+
end
|
3548
|
+
|
3549
|
+
end
|
3550
|
+
|
3551
|
+
# Category: MacroDroid Specific
|
3552
|
+
#
|
3553
|
+
class ModeConstraint < Constraint
|
3554
|
+
|
3555
|
+
def initialize(h={})
|
3556
|
+
|
3557
|
+
options = {
|
3558
|
+
mode: 'Away',
|
3559
|
+
mode_selected: true
|
3560
|
+
}
|
3561
|
+
|
3562
|
+
super(options.merge h)
|
3563
|
+
|
3564
|
+
end
|
3565
|
+
|
3566
|
+
end
|
3567
|
+
|
3568
|
+
# Category: MacroDroid Specific
|
3569
|
+
#
|
3570
|
+
class TriggerThatInvokedConstraint < Constraint
|
3571
|
+
|
3572
|
+
def initialize(h={})
|
3573
|
+
|
3574
|
+
options = {
|
3575
|
+
not: false,
|
3576
|
+
si_guid_that_invoked: -4951291100076165433,
|
3577
|
+
trigger_name: 'Shake Device'
|
3578
|
+
}
|
3579
|
+
|
3580
|
+
super(options.merge h)
|
3581
|
+
|
3582
|
+
end
|
3583
|
+
|
3584
|
+
end
|
3585
|
+
|
3586
|
+
# Category: MacroDroid Specific
|
3587
|
+
#
|
3588
|
+
class LastRunTimeConstraint < Constraint
|
3589
|
+
|
3590
|
+
def initialize(h={})
|
3591
|
+
|
3592
|
+
options = {
|
3593
|
+
check_this_macro: false,
|
3594
|
+
invoked: true,
|
3595
|
+
macro_ids: [-6922688338672048267],
|
3596
|
+
macro_names: ["Opendoor"],
|
3597
|
+
time_period_seconds: 7260
|
3598
|
+
}
|
3599
|
+
|
3600
|
+
super(options.merge h)
|
3601
|
+
|
3602
|
+
end
|
3603
|
+
|
3604
|
+
end
|
3605
|
+
|
3606
|
+
# Category: Media
|
3607
|
+
#
|
3608
|
+
class HeadphonesConnectionConstraint < Constraint
|
3609
|
+
|
3610
|
+
def initialize(h={})
|
3611
|
+
|
3612
|
+
options = {
|
3613
|
+
connected: true
|
3614
|
+
}
|
3615
|
+
|
3616
|
+
super(options.merge h)
|
3617
|
+
|
3618
|
+
end
|
3619
|
+
|
3620
|
+
end
|
3621
|
+
|
3622
|
+
# Category: Media
|
3623
|
+
#
|
3624
|
+
class MusicActiveConstraint < Constraint
|
3625
|
+
|
3626
|
+
def initialize(h={})
|
3627
|
+
|
3628
|
+
options = {
|
3629
|
+
music_active: true
|
3630
|
+
}
|
3631
|
+
|
3632
|
+
super(options.merge h)
|
3633
|
+
|
3634
|
+
end
|
3635
|
+
|
3636
|
+
end
|
3637
|
+
|
3638
|
+
# Category: Notification
|
3639
|
+
#
|
3640
|
+
class NotificationPresentConstraint < Constraint
|
3641
|
+
|
3642
|
+
def initialize(h={})
|
3643
|
+
|
3644
|
+
options = {
|
3645
|
+
enable_regex: false,
|
3646
|
+
application_name_list: ["All applications"],
|
3647
|
+
exact_match: false,
|
3648
|
+
excludes: false,
|
3649
|
+
excludes_apps: -1,
|
3650
|
+
option: 0,
|
3651
|
+
package_name_list: ["allApplications"],
|
3652
|
+
text_content: ''
|
3653
|
+
}
|
3654
|
+
|
3655
|
+
super(options.merge h)
|
3656
|
+
|
3657
|
+
end
|
3658
|
+
|
3659
|
+
end
|
3660
|
+
|
3661
|
+
# Category: Notification
|
3662
|
+
#
|
3663
|
+
class PriorityModeConstraint < Constraint
|
3664
|
+
|
3665
|
+
def initialize(h={})
|
3666
|
+
|
3667
|
+
options = {
|
3668
|
+
in_mode: true,
|
3669
|
+
selected_index: 0
|
3670
|
+
}
|
3671
|
+
|
3672
|
+
super(options.merge h)
|
3673
|
+
|
3674
|
+
end
|
3675
|
+
|
3676
|
+
end
|
3677
|
+
|
3678
|
+
# Category: Notification
|
3679
|
+
#
|
3680
|
+
class NotificationVolumeConstraint < Constraint
|
3681
|
+
|
3682
|
+
def initialize(h={})
|
3683
|
+
|
3684
|
+
options = {
|
3685
|
+
option: 1
|
3686
|
+
}
|
3687
|
+
|
3688
|
+
super(options.merge h)
|
3689
|
+
|
3690
|
+
end
|
3691
|
+
|
3692
|
+
end
|
3693
|
+
|
3694
|
+
# Category: Phone
|
3695
|
+
#
|
3696
|
+
class InCallConstraint < Constraint
|
3697
|
+
|
3698
|
+
def initialize(h={})
|
3699
|
+
|
3700
|
+
options = {
|
3701
|
+
in_call: true
|
3702
|
+
}
|
3703
|
+
|
3704
|
+
super(options.merge h)
|
3705
|
+
|
3706
|
+
end
|
3707
|
+
|
3708
|
+
end
|
3709
|
+
|
3710
|
+
# Category: Phone
|
3711
|
+
#
|
3712
|
+
class PhoneRingingConstraint < Constraint
|
3713
|
+
|
3714
|
+
def initialize(h={})
|
3715
|
+
|
3716
|
+
options = {
|
3717
|
+
ringing: true
|
3718
|
+
}
|
3719
|
+
|
3720
|
+
super(options.merge h)
|
3721
|
+
|
3722
|
+
end
|
3723
|
+
|
3724
|
+
end
|
3725
|
+
|
3726
|
+
# Category: Screen and Speaker
|
3727
|
+
#
|
3728
|
+
class BrightnessConstraint < Constraint
|
3729
|
+
|
3730
|
+
def initialize(h={})
|
3731
|
+
|
3732
|
+
options = {
|
3733
|
+
brightness: 35,
|
3734
|
+
equals: false,
|
3735
|
+
force_pie_mode: false,
|
3736
|
+
greater_than: false,
|
3737
|
+
is_auto_brightness: false
|
3738
|
+
}
|
3739
|
+
|
3740
|
+
super(options.merge h)
|
3741
|
+
|
3742
|
+
end
|
3743
|
+
|
3744
|
+
end
|
3745
|
+
|
3746
|
+
# Category: Screen and Speaker
|
3747
|
+
#
|
3748
|
+
class VolumeConstraint < Constraint
|
3749
|
+
|
3750
|
+
def initialize(h={})
|
3751
|
+
|
3752
|
+
options = {
|
3753
|
+
option: 0
|
3754
|
+
}
|
3755
|
+
|
3756
|
+
super(options.merge h)
|
3757
|
+
|
3758
|
+
end
|
3759
|
+
|
3760
|
+
end
|
3761
|
+
|
3762
|
+
# Category: Screen and Speaker
|
3763
|
+
#
|
3764
|
+
class SpeakerPhoneConstraint < Constraint
|
3765
|
+
|
3766
|
+
def initialize(h={})
|
3767
|
+
|
3768
|
+
options = {
|
3769
|
+
enabled: true
|
3770
|
+
}
|
3771
|
+
|
3772
|
+
super(options.merge h)
|
3773
|
+
|
3774
|
+
end
|
3775
|
+
|
3776
|
+
end
|
3777
|
+
|
3778
|
+
# Category: Screen and Speaker
|
3779
|
+
#
|
3780
|
+
class DarkThemeConstraint < Constraint
|
3781
|
+
|
3782
|
+
def initialize(h={})
|
3783
|
+
|
3784
|
+
options = {
|
3785
|
+
option: 0
|
3786
|
+
}
|
3787
|
+
|
3788
|
+
super(options.merge h)
|
3789
|
+
|
3790
|
+
end
|
3791
|
+
|
3792
|
+
end
|
3793
|
+
|
3794
|
+
# Category: Screen and Speaker
|
3795
|
+
#
|
3796
|
+
class ScreenOnOffConstraint < Constraint
|
3797
|
+
|
3798
|
+
def initialize(h={})
|
3799
|
+
|
3800
|
+
options = {
|
3801
|
+
a: true,
|
3802
|
+
screen_on: true
|
3803
|
+
}
|
3804
|
+
|
3805
|
+
super(options.merge h)
|
3806
|
+
|
3807
|
+
end
|
3808
|
+
|
3809
|
+
end
|
3810
|
+
|
3811
|
+
# Category: Screen and Speaker
|
3812
|
+
#
|
3813
|
+
class VolumeLevelConstraint < Constraint
|
3814
|
+
|
3815
|
+
def initialize(h={})
|
3816
|
+
|
3817
|
+
options = {
|
3818
|
+
comparison: 0,
|
3819
|
+
stream_index_array: [false, true, false, false, false, false, false],
|
3820
|
+
volume: 42
|
3821
|
+
}
|
3822
|
+
|
3823
|
+
super(options.merge h)
|
3824
|
+
|
3825
|
+
end
|
3826
|
+
|
3827
|
+
end
|
3828
|
+
|
3829
|
+
# Category: Sensors
|
3830
|
+
#
|
3831
|
+
class FaceUpDownConstraint < Constraint
|
3832
|
+
|
3833
|
+
def initialize(h={})
|
3834
|
+
|
3835
|
+
options = {
|
3836
|
+
option: -1,
|
3837
|
+
selected_options: [true, false, true, false, false, false]
|
3838
|
+
}
|
3839
|
+
|
3840
|
+
super(options.merge h)
|
3841
|
+
|
3842
|
+
end
|
3843
|
+
|
3844
|
+
end
|
3845
|
+
|
3846
|
+
# Category: Sensors
|
3847
|
+
#
|
3848
|
+
class LightLevelConstraint < Constraint
|
3849
|
+
|
3850
|
+
def initialize(h={})
|
3851
|
+
|
3852
|
+
options = {
|
3853
|
+
light_level: -1,
|
3854
|
+
light_level_float: 5000.0,
|
3855
|
+
option: 1
|
3856
|
+
}
|
3857
|
+
|
3858
|
+
super(options.merge h)
|
3859
|
+
|
3860
|
+
end
|
3861
|
+
|
3862
|
+
end
|
3863
|
+
|
3864
|
+
# Category: Sensors
|
3865
|
+
#
|
3866
|
+
class DeviceOrientationConstraint < Constraint
|
3867
|
+
|
3868
|
+
def initialize(h={})
|
3869
|
+
|
3870
|
+
options = {
|
3871
|
+
portrait: true
|
3872
|
+
}
|
3873
|
+
|
3874
|
+
super(options.merge h)
|
3875
|
+
|
3876
|
+
end
|
3877
|
+
|
3878
|
+
end
|
3879
|
+
|
3880
|
+
# Category: Sensors
|
3881
|
+
#
|
3882
|
+
class ProximitySensorConstraint < Constraint
|
3883
|
+
|
3884
|
+
def initialize(h={})
|
3885
|
+
|
3886
|
+
options = {
|
3887
|
+
near: true
|
3888
|
+
}
|
3889
|
+
|
3890
|
+
super(options.merge h)
|
3891
|
+
|
3892
|
+
end
|
3893
|
+
|
3894
|
+
end
|