ruby-macrodroid 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f4e1e8fee18ccf4731c38c61f67b673888872ffa5b33349a6f2da8e9e51535f
4
- data.tar.gz: a3fe55c967182a61cf50514a38e7c3b8521e3efda4ce93d2b99c41e89540408b
3
+ metadata.gz: 79ad74c909d44b5bc3ddd5a5f65a2359cf385de96cd9e504cf30ce390ab2252f
4
+ data.tar.gz: 71ab0f9b2267ea514859f4ebc9525e4cb5c8389895ccf85df2653a495c7bc104
5
5
  SHA512:
6
- metadata.gz: 22ec4d0d3b94072c272817def3167dd5b6c8d2874572028bb0f3629dfb0b86e00cbd5779e0f3f99344182819abe556f5ab2440c18621cc50302b35aff40a16bf
7
- data.tar.gz: b61d5d2efe7d8e47d1c99438a837f85d25af466c49c34eb3979d7204c600c4ca017262ba3f311311904abb78973713a8f53db9a17b6dce3c802ca8a651cacd21
6
+ metadata.gz: 8f514b4bc19ddc8b00d8794fe7802779c332f371072db40c30f6a247316764b43306919e571256c5200451965aa9629312e30c82d96838a78d5f4658df22bf95
7
+ data.tar.gz: 6c4b78db5f22aa70860c34eb9a046909805a93924dc2fb3c7bcae45ced4d552b04e3c05645a1ac54135b220fae189641352820b90f00b78ae00506701ce3dc4d
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -2,13 +2,9 @@
2
2
 
3
3
  # file: ruby-macrodroid.rb
4
4
 
5
- require 'pp'
6
- require 'json'
7
5
  require 'uuid'
8
- require 'date'
9
6
  require 'rxfhelper'
10
- require 'app-routes'
11
-
7
+ require 'chronic_cron'
12
8
 
13
9
 
14
10
  class TriggersNlp
@@ -70,7 +66,7 @@ module Params
70
66
  h.inject({}) do |r, x|
71
67
 
72
68
  key, value = x
73
- puts 'value: ' + value.inspect
69
+ #puts 'value: ' + value.inspect
74
70
 
75
71
  val = if value.is_a?(Hash) then
76
72
  to_snake_case(value)
@@ -117,15 +113,18 @@ class Macro
117
113
  using Params
118
114
 
119
115
  attr_reader :local_variables, :triggers, :actions, :guid
120
- attr_accessor :name
116
+ attr_accessor :title
121
117
 
122
118
  def initialize(name=nil, debug: false)
123
119
 
124
- @name, @debug = name, debug
120
+ @title, @debug = name, debug
121
+
122
+ puts 'inside Macro#initialize' if @debug
123
+
125
124
  lv=[], triggers=[], actions=[]
126
125
  @local_variables, @triggers, @actions = lv, triggers, actions
127
126
 
128
- @triggers, @actions = [], []
127
+ @triggers, @actions, @constraints = [], [], []
129
128
  @h = {}
130
129
 
131
130
  end
@@ -159,7 +158,7 @@ class Macro
159
158
  m_action_list: @actions.map(&:to_h),
160
159
  m_constraint_list: [],
161
160
  m_description: '',
162
- m_name: @name,
161
+ m_name: @title,
163
162
  m_excludeLog: false,
164
163
  m_GUID: guid(),
165
164
  m_isOrCondition: false,
@@ -203,7 +202,12 @@ class Macro
203
202
 
204
203
  def import_xml(node)
205
204
 
206
- @name = node.attributes[:name]
205
+ if @debug then
206
+ puts 'inside Macro#import_xml'
207
+ puts 'node: ' + node.xml.inspect
208
+ end
209
+
210
+ @title = node.attributes[:name]
207
211
 
208
212
  if node.element('triggers') then
209
213
 
@@ -242,6 +246,8 @@ class Macro
242
246
 
243
247
  r = tp.find_trigger e.text
244
248
 
249
+ puts 'found trigger ' + r.inspect if @debug
250
+
245
251
  if r then
246
252
  r[0].new(r[1])
247
253
  end
@@ -253,6 +259,7 @@ class Macro
253
259
  @actions = node.xpath('action').map do |e|
254
260
 
255
261
  r = ap.find_action e.text
262
+ puts 'found action ' + r.inspect if @debug
256
263
 
257
264
  if r then
258
265
  r[0].new(r[1])
@@ -265,6 +272,33 @@ class Macro
265
272
  self
266
273
 
267
274
  end
275
+
276
+ def match?(triggerx, detail={time: $env[:time]} )
277
+
278
+ if @triggers.any? {|x| x.type == triggerx and x.match?(detail) } then
279
+
280
+ if @debug then
281
+ puts 'checking constraints ...'
282
+ puts '@constraints: ' + @constraints.inspect
283
+ end
284
+
285
+ if @constraints.all? {|x| x.match?($env.merge(detail)) } then
286
+
287
+ true
288
+
289
+ else
290
+
291
+ return false
292
+
293
+ end
294
+
295
+ end
296
+
297
+ end
298
+
299
+ def run()
300
+ @actions.map(&:invoke)
301
+ end
268
302
 
269
303
  private
270
304
 
@@ -298,10 +332,12 @@ class MacroDroid
298
332
 
299
333
  if s[0] == '{' then
300
334
  import_json(s)
301
- else
302
- s[0] == '<'
335
+ elsif s[0] == '<'
303
336
  import_xml(s)
304
337
  @h = build_h
338
+ else
339
+ import_xml(text_to_xml(s))
340
+ @h = build_h
305
341
  end
306
342
 
307
343
  else
@@ -319,6 +355,7 @@ class MacroDroid
319
355
 
320
356
  def build_h()
321
357
 
358
+ puts 'inside Macro#build_h' if @debug
322
359
  {
323
360
  cell_tower_groups: [],
324
361
  cell_towers_ignore: [],
@@ -379,12 +416,38 @@ class MacroDroid
379
416
 
380
417
  @macros = doc.root.xpath('macro').map do |node|
381
418
 
382
- macro = Macro.new @name
419
+ macro = Macro.new @title, debug: @debug
383
420
  macro.import_xml(node)
384
421
  macro
385
422
 
386
423
  end
387
424
  end
425
+
426
+ def text_to_xml(s)
427
+
428
+ a = s.split(/.*(?=^m:)/); a.shift
429
+ a.map!(&:chomp)
430
+
431
+ macros = a.map do |x|
432
+
433
+ lines = x.lines
434
+ puts 'lines: ' + lines.inspect if @debug
435
+
436
+ name = lines.shift[/^m: +(.*)/,1]
437
+ h = {t: [], a: [], c: []}
438
+
439
+ lines.each {|line| h[line[0].to_sym] << line[/^\w: +(.*)/,1] }
440
+ triggers = h[:t].map {|text| [:trigger, {}, text]}
441
+ actions = h[:a].map {|text| [:action, {}, text]}
442
+
443
+ [:macro, {name: name},'', *triggers, *actions]
444
+
445
+ end
446
+
447
+ doc = Rexle.new([:macros, {}, '', *macros])
448
+ doc.root.xml pretty: true
449
+
450
+ end
388
451
 
389
452
  def to_h()
390
453
 
@@ -397,12 +460,22 @@ class MacroDroid
397
460
  end
398
461
 
399
462
  class MacroObject
463
+ using ColouredText
464
+
465
+ attr_reader :type
466
+ attr_accessor :options
400
467
 
401
468
  def initialize(h={})
402
469
 
403
470
  @h = {constraint_list: [], is_or_condition: false,
404
471
  is_disabled: false}.merge(h)
405
472
  @list = []
473
+
474
+ # fetch the class name and convert from camelCase to snake_eyes
475
+ @type = self.class.to_s.sub(/Trigger|Action$/,'')\
476
+ .gsub(/\B[A-Z][a-z]/){|x| '_' + x.downcase}\
477
+ .gsub(/[a-z][A-Z]/){|x| x[0] + '_' + x[1].downcase}\
478
+ .downcase.to_sym
406
479
  end
407
480
 
408
481
  def to_h()
@@ -425,6 +498,13 @@ class MacroObject
425
498
 
426
499
  protected
427
500
 
501
+ def filter(options, h)
502
+
503
+ (h.keys - options.keys).each {|key| h.delete key }
504
+ return h
505
+
506
+ end
507
+
428
508
  def uuid()
429
509
  UUID.new.generate
430
510
  end
@@ -437,11 +517,18 @@ class Trigger < MacroObject
437
517
  super({fakeIcon: 0}.merge(h))
438
518
  @list << 'fakeIcon'
439
519
  end
520
+
521
+ def match?(detail={})
440
522
 
441
- end
523
+ detail.all? {|key,value| @h[key] == value}
524
+
525
+ end
442
526
 
527
+ end
443
528
 
444
529
 
530
+ # Category: Applications
531
+ #
445
532
  class WebHookTrigger < Trigger
446
533
 
447
534
  def initialize(h={})
@@ -456,6 +543,22 @@ class WebHookTrigger < Trigger
456
543
 
457
544
  end
458
545
 
546
+ # Category: Applications
547
+ #
548
+ # Also known as Wifi State Change
549
+ #
550
+ # wifi_state options:
551
+ # 0 - Wifi Enabled
552
+ # 1 - Wifi Disabled
553
+ # 2 - Connected to network
554
+ # ssid_list options:
555
+ # ["Any Network"]
556
+ # ["some Wifi SSID"] - 1 or more SSID can be supplied
557
+ # 3 - Disconnected from network
558
+ # ssid_list options:
559
+ # ["Any Network"]
560
+ # ["some Wifi SSID"] - 1 or more SSID can be supplied
561
+
459
562
  class WifiConnectionTrigger < Trigger
460
563
 
461
564
  def initialize(h={})
@@ -471,6 +574,8 @@ class WifiConnectionTrigger < Trigger
471
574
 
472
575
  end
473
576
 
577
+ # Category: Applications
578
+ #
474
579
  class ApplicationInstalledRemovedTrigger < Trigger
475
580
 
476
581
  def initialize(h={})
@@ -489,6 +594,8 @@ class ApplicationInstalledRemovedTrigger < Trigger
489
594
 
490
595
  end
491
596
 
597
+ # Category: Applications
598
+ #
492
599
  class ApplicationLaunchedTrigger < Trigger
493
600
 
494
601
  def initialize(h={})
@@ -505,6 +612,8 @@ class ApplicationLaunchedTrigger < Trigger
505
612
 
506
613
  end
507
614
 
615
+ # Category: Battery/Power
616
+ #
508
617
  class BatteryLevelTrigger < Trigger
509
618
 
510
619
  def initialize(h={})
@@ -521,6 +630,8 @@ class BatteryLevelTrigger < Trigger
521
630
 
522
631
  end
523
632
 
633
+ # Category: Battery/Power
634
+ #
524
635
  class BatteryTemperatureTrigger < Trigger
525
636
 
526
637
  def initialize(h={})
@@ -537,6 +648,8 @@ class BatteryTemperatureTrigger < Trigger
537
648
 
538
649
  end
539
650
 
651
+ # Category: Battery/Power
652
+ #
540
653
  class PowerButtonToggleTrigger < Trigger
541
654
 
542
655
  def initialize(h={})
@@ -551,6 +664,9 @@ class PowerButtonToggleTrigger < Trigger
551
664
 
552
665
  end
553
666
 
667
+
668
+ # Category: Battery/Power
669
+ #
554
670
  class ExternalPowerTrigger < Trigger
555
671
 
556
672
  def initialize(h={})
@@ -568,6 +684,8 @@ class ExternalPowerTrigger < Trigger
568
684
 
569
685
  end
570
686
 
687
+ # Category: Call/SMS
688
+ #
571
689
  class CallActiveTrigger < Trigger
572
690
 
573
691
  def initialize(h={})
@@ -584,6 +702,8 @@ class CallActiveTrigger < Trigger
584
702
 
585
703
  end
586
704
 
705
+ # Category: Call/SMS
706
+ #
587
707
  class IncomingCallTrigger < Trigger
588
708
 
589
709
  def initialize(h={})
@@ -602,6 +722,8 @@ class IncomingCallTrigger < Trigger
602
722
 
603
723
  end
604
724
 
725
+ # Category: Call/SMS
726
+ #
605
727
  class OutgoingCallTrigger < Trigger
606
728
 
607
729
  def initialize(h={})
@@ -620,6 +742,8 @@ class OutgoingCallTrigger < Trigger
620
742
 
621
743
  end
622
744
 
745
+ # Category: Call/SMS
746
+ #
623
747
  class CallEndedTrigger < Trigger
624
748
 
625
749
  def initialize(h={})
@@ -638,6 +762,8 @@ class CallEndedTrigger < Trigger
638
762
 
639
763
  end
640
764
 
765
+ # Category: Call/SMS
766
+ #
641
767
  class CallMissedTrigger < Trigger
642
768
 
643
769
  def initialize(h={})
@@ -652,6 +778,8 @@ class CallMissedTrigger < Trigger
652
778
 
653
779
  end
654
780
 
781
+ # Category: Call/SMS
782
+ #
655
783
  class IncomingSMSTrigger < Trigger
656
784
 
657
785
  def initialize(h={})
@@ -674,6 +802,8 @@ class IncomingSMSTrigger < Trigger
674
802
 
675
803
  end
676
804
 
805
+ # Category: Connectivity
806
+ #
677
807
  class WebHookTrigger < Trigger
678
808
 
679
809
  def initialize(h={})
@@ -688,6 +818,8 @@ class WebHookTrigger < Trigger
688
818
 
689
819
  end
690
820
 
821
+ # Category: Connectivity
822
+ #
691
823
  class WifiConnectionTrigger < Trigger
692
824
 
693
825
  def initialize(h={})
@@ -703,6 +835,8 @@ class WifiConnectionTrigger < Trigger
703
835
 
704
836
  end
705
837
 
838
+ # Category: Connectivity
839
+ #
706
840
  class BluetoothTrigger < Trigger
707
841
 
708
842
  def initialize(h={})
@@ -719,6 +853,8 @@ class BluetoothTrigger < Trigger
719
853
 
720
854
  end
721
855
 
856
+ # Category: Connectivity
857
+ #
722
858
  class HeadphonesTrigger < Trigger
723
859
 
724
860
  def initialize(h={})
@@ -734,6 +870,8 @@ class HeadphonesTrigger < Trigger
734
870
 
735
871
  end
736
872
 
873
+ # Category: Connectivity
874
+ #
737
875
  class SignalOnOffTrigger < Trigger
738
876
 
739
877
  def initialize(h={})
@@ -748,6 +886,8 @@ class SignalOnOffTrigger < Trigger
748
886
 
749
887
  end
750
888
 
889
+ # Category: Connectivity
890
+ #
751
891
  class UsbDeviceConnectionTrigger < Trigger
752
892
 
753
893
  def initialize(h={})
@@ -762,22 +902,45 @@ class UsbDeviceConnectionTrigger < Trigger
762
902
 
763
903
  end
764
904
 
905
+ # Category: Connectivity
906
+ #
907
+ # Also known as Wifi SSID Transition
908
+ #
909
+ # options:
910
+ # in_range: true | false
911
+ # wifi_cell_info: {display_name: "some Wifi SSID",
912
+ # ssid: "some Wifi SSID"} - 1 or more allowed
913
+ #
765
914
  class WifiSSIDTrigger < Trigger
766
915
 
767
916
  def initialize(h={})
768
917
 
769
918
  options = {
770
- wifi_cell_info_list: [{:displayName=>"", :ssid=>""}],
919
+ wifi_cell_info_list: [{:display_name=>"", :ssid=>""}],
771
920
  ssid_list: [],
772
- _in_range: true
921
+ in_range: true
773
922
  }
774
923
 
775
924
  super(options.merge h)
776
925
 
777
926
  end
927
+
928
+ def to_h()
929
+
930
+ h = super()
931
+ val = h[:m_inRange]
932
+
933
+ h[:m_InRange] = val
934
+ h.delete :m_inRange
935
+
936
+ return h
937
+
938
+ end
778
939
 
779
940
  end
780
941
 
942
+ # Category: Date/Time
943
+ #
781
944
  class CalendarTrigger < Trigger
782
945
 
783
946
  def initialize(h={})
@@ -802,15 +965,21 @@ class CalendarTrigger < Trigger
802
965
 
803
966
  end
804
967
 
968
+ # Category: Date/Time
969
+ #
805
970
  class TimerTrigger < Trigger
971
+ using ColouredText
972
+
806
973
 
807
974
  def initialize(h={})
975
+
976
+ puts 'TimerTrigger h: ' + h.inspect if $debug
808
977
 
809
978
  if h[:days] then
810
979
 
811
980
  days = [false] * 7
812
-
813
- h[:days].split(/, +/).each do |x|
981
+
982
+ h[:days].split(/, */).each do |x|
814
983
 
815
984
  r = Date::DAYNAMES.grep /#{x}/i
816
985
  i = Date::DAYNAMES.index(r.first)
@@ -819,7 +988,6 @@ class TimerTrigger < Trigger
819
988
  end
820
989
 
821
990
  h[:days_of_week] = days
822
- h.delete :days
823
991
 
824
992
  end
825
993
 
@@ -827,24 +995,46 @@ class TimerTrigger < Trigger
827
995
 
828
996
  t = Time.parse(h[:time])
829
997
  h[:hour], h[:minute] = t.hour, t.min
830
- h.delete :time
831
998
 
832
999
  end
1000
+
1001
+ #puts ('h: ' + h.inspect).debug
833
1002
 
834
1003
  options = {
835
1004
  alarm_id: uuid(),
836
- days_of_week: [false, true, false, false, false, false, false],
1005
+ days_of_week: [false, false, false, false, false, false, false],
837
1006
  minute: 10,
838
1007
  hour: 7,
839
1008
  use_alarm: false
840
1009
  }
1010
+
1011
+ super(options.merge filter(options,h))
841
1012
 
842
- super(options.merge h)
1013
+ end
1014
+
1015
+ def match?(detail={time: $env[:time]})
1016
+
1017
+ a = @h[:days_of_week]
1018
+ a.unshift a.pop
1019
+
1020
+ dow = a.map.with_index {|x, i| x ? i : nil }.compact.join(',')
1021
+
1022
+ s = "%s %s * * %s" % [@h[:minute], @h[:hour], dow]
1023
+
1024
+ if $debug then
1025
+ puts 's: ' + s.inspect
1026
+ puts 'detail: ' + detail.inspect
1027
+ puts '@h: ' + @h.inspect
1028
+ end
1029
+
1030
+ ChronicCron.new(s, detail[:time]).to_time == detail[:time]
843
1031
 
844
1032
  end
845
1033
 
846
1034
  end
847
1035
 
1036
+ # Category: Date/Time
1037
+ #
848
1038
  class StopwatchTrigger < Trigger
849
1039
 
850
1040
  def initialize(h={})
@@ -860,6 +1050,13 @@ class StopwatchTrigger < Trigger
860
1050
 
861
1051
  end
862
1052
 
1053
+ # Category: Date/Time
1054
+ #
1055
+ # Also known as Day of Week/Month
1056
+ #
1057
+ # month_of_year equal to 0 means it occurs every month
1058
+ # day_of_week starts with a Monday (value is 0)
1059
+ #
863
1060
  class DayTrigger < Trigger
864
1061
 
865
1062
  def initialize(h={})
@@ -881,6 +1078,10 @@ class DayTrigger < Trigger
881
1078
 
882
1079
  end
883
1080
 
1081
+ # Category: Date/Time
1082
+ #
1083
+ # Regular Interval
1084
+ #
884
1085
  class RegularIntervalTrigger < Trigger
885
1086
 
886
1087
  def initialize(h={})
@@ -900,6 +1101,17 @@ class RegularIntervalTrigger < Trigger
900
1101
 
901
1102
  end
902
1103
 
1104
+ # Category: Device Events
1105
+ #
1106
+ # Airplane Mode Changed
1107
+ #
1108
+ # options:
1109
+ # Airplane Mode Enabled
1110
+ # Airplane Mode Disabled
1111
+ #
1112
+ # shorthand example:
1113
+ # airplanemode: enabled
1114
+ #
903
1115
  class AirplaneModeTrigger < Trigger
904
1116
 
905
1117
  def initialize(h={})
@@ -914,6 +1126,8 @@ class AirplaneModeTrigger < Trigger
914
1126
 
915
1127
  end
916
1128
 
1129
+ # Category: Device Events
1130
+ #
917
1131
  class AutoSyncChangeTrigger < Trigger
918
1132
 
919
1133
  def initialize(h={})
@@ -928,6 +1142,8 @@ class AutoSyncChangeTrigger < Trigger
928
1142
 
929
1143
  end
930
1144
 
1145
+ # Category: Device Events
1146
+ #
931
1147
  class DayDreamTrigger < Trigger
932
1148
 
933
1149
  def initialize(h={})
@@ -942,6 +1158,8 @@ class DayDreamTrigger < Trigger
942
1158
 
943
1159
  end
944
1160
 
1161
+ # Category: Device Events
1162
+ #
945
1163
  class DockTrigger < Trigger
946
1164
 
947
1165
  def initialize(h={})
@@ -956,6 +1174,8 @@ class DockTrigger < Trigger
956
1174
 
957
1175
  end
958
1176
 
1177
+ # Category: Device Events
1178
+ #
959
1179
  class GPSEnabledTrigger < Trigger
960
1180
 
961
1181
  def initialize(h={})
@@ -970,6 +1190,8 @@ class GPSEnabledTrigger < Trigger
970
1190
 
971
1191
  end
972
1192
 
1193
+ # Category: Device Events
1194
+ #
973
1195
  class MusicPlayingTrigger < Trigger
974
1196
 
975
1197
  def initialize(h={})
@@ -984,19 +1206,9 @@ class MusicPlayingTrigger < Trigger
984
1206
 
985
1207
  end
986
1208
 
987
- class DeviceUnlockedTrigger < Trigger
988
-
989
- def initialize(h={})
990
-
991
- options = {
992
- }
993
-
994
- super(options.merge h)
995
-
996
- end
997
-
998
- end
999
1209
 
1210
+ # Category: Device Events
1211
+ #
1000
1212
  class DeviceUnlockedTrigger < Trigger
1001
1213
 
1002
1214
  def initialize(h={})
@@ -1010,6 +1222,8 @@ class DeviceUnlockedTrigger < Trigger
1010
1222
 
1011
1223
  end
1012
1224
 
1225
+ # Category: Device Events
1226
+ #
1013
1227
  class AutoRotateChangeTrigger < Trigger
1014
1228
 
1015
1229
  def initialize(h={})
@@ -1024,6 +1238,8 @@ class AutoRotateChangeTrigger < Trigger
1024
1238
 
1025
1239
  end
1026
1240
 
1241
+ # Category: Device Events
1242
+ #
1027
1243
  class ClipboardChangeTrigger < Trigger
1028
1244
 
1029
1245
  def initialize(h={})
@@ -1039,6 +1255,8 @@ class ClipboardChangeTrigger < Trigger
1039
1255
 
1040
1256
  end
1041
1257
 
1258
+ # Category: Device Events
1259
+ #
1042
1260
  class BootTrigger < Trigger
1043
1261
 
1044
1262
  def initialize(h={})
@@ -1052,19 +1270,8 @@ class BootTrigger < Trigger
1052
1270
 
1053
1271
  end
1054
1272
 
1055
- class BootTrigger < Trigger
1056
-
1057
- def initialize(h={})
1058
-
1059
- options = {
1060
- }
1061
-
1062
- super(options.merge h)
1063
-
1064
- end
1065
-
1066
- end
1067
-
1273
+ # Category: Device Events
1274
+ #
1068
1275
  class IntentReceivedTrigger < Trigger
1069
1276
 
1070
1277
  def initialize(h={})
@@ -1083,6 +1290,8 @@ class IntentReceivedTrigger < Trigger
1083
1290
 
1084
1291
  end
1085
1292
 
1293
+ # Category: Device Events
1294
+ #
1086
1295
  class NotificationTrigger < Trigger
1087
1296
 
1088
1297
  def initialize(h={})
@@ -1107,6 +1316,8 @@ class NotificationTrigger < Trigger
1107
1316
 
1108
1317
  end
1109
1318
 
1319
+ # Category: Device Events
1320
+ #
1110
1321
  class ScreenOnOffTrigger < Trigger
1111
1322
 
1112
1323
  def initialize(h={})
@@ -1121,6 +1332,8 @@ class ScreenOnOffTrigger < Trigger
1121
1332
 
1122
1333
  end
1123
1334
 
1335
+ # Category: Device Events
1336
+ #
1124
1337
  class SilentModeTrigger < Trigger
1125
1338
 
1126
1339
  def initialize(h={})
@@ -1135,6 +1348,8 @@ class SilentModeTrigger < Trigger
1135
1348
 
1136
1349
  end
1137
1350
 
1351
+ # Category: Location
1352
+ #
1138
1353
  class WeatherTrigger < Trigger
1139
1354
 
1140
1355
  def initialize(h={})
@@ -1158,6 +1373,8 @@ class WeatherTrigger < Trigger
1158
1373
 
1159
1374
  end
1160
1375
 
1376
+ # Category: Location
1377
+ #
1161
1378
  class GeofenceTrigger < Trigger
1162
1379
 
1163
1380
  def initialize(h={})
@@ -1176,6 +1393,8 @@ class GeofenceTrigger < Trigger
1176
1393
 
1177
1394
  end
1178
1395
 
1396
+ # Category: Location
1397
+ #
1179
1398
  class SunriseSunsetTrigger < Trigger
1180
1399
 
1181
1400
  def initialize(h={})
@@ -1191,7 +1410,8 @@ class SunriseSunsetTrigger < Trigger
1191
1410
 
1192
1411
  end
1193
1412
 
1194
-
1413
+ # Category: Sensors
1414
+ #
1195
1415
  class ActivityRecognitionTrigger < Trigger
1196
1416
 
1197
1417
  def initialize(h={})
@@ -1207,7 +1427,8 @@ class ActivityRecognitionTrigger < Trigger
1207
1427
 
1208
1428
  end
1209
1429
 
1210
-
1430
+ # Category: Sensors
1431
+ #
1211
1432
  class ProximityTrigger < Trigger
1212
1433
 
1213
1434
  def initialize(h={})
@@ -1223,6 +1444,8 @@ class ProximityTrigger < Trigger
1223
1444
 
1224
1445
  end
1225
1446
 
1447
+ # Category: Sensors
1448
+ #
1226
1449
  class ShakeDeviceTrigger < Trigger
1227
1450
 
1228
1451
  def initialize(h={})
@@ -1236,6 +1459,8 @@ class ShakeDeviceTrigger < Trigger
1236
1459
 
1237
1460
  end
1238
1461
 
1462
+ # Category: Sensors
1463
+ #
1239
1464
  class FlipDeviceTrigger < Trigger
1240
1465
 
1241
1466
  def initialize(h={})
@@ -1252,6 +1477,8 @@ class FlipDeviceTrigger < Trigger
1252
1477
 
1253
1478
  end
1254
1479
 
1480
+ # Category: Sensors
1481
+ #
1255
1482
  class OrientationTrigger < Trigger
1256
1483
 
1257
1484
  def initialize(h={})
@@ -1267,6 +1494,8 @@ class OrientationTrigger < Trigger
1267
1494
 
1268
1495
  end
1269
1496
 
1497
+ # Category: User Input
1498
+ #
1270
1499
  class FloatingButtonTrigger < Trigger
1271
1500
 
1272
1501
  def initialize(h={})
@@ -1290,6 +1519,8 @@ class FloatingButtonTrigger < Trigger
1290
1519
 
1291
1520
  end
1292
1521
 
1522
+ # Category: User Input
1523
+ #
1293
1524
  class ShortcutTrigger < Trigger
1294
1525
 
1295
1526
  def initialize(h={})
@@ -1303,6 +1534,8 @@ class ShortcutTrigger < Trigger
1303
1534
 
1304
1535
  end
1305
1536
 
1537
+ # Category: User Input
1538
+ #
1306
1539
  class VolumeButtonTrigger < Trigger
1307
1540
 
1308
1541
  def initialize(h={})
@@ -1320,6 +1553,8 @@ class VolumeButtonTrigger < Trigger
1320
1553
 
1321
1554
  end
1322
1555
 
1556
+ # Category: User Input
1557
+ #
1323
1558
  class MediaButtonPressedTrigger < Trigger
1324
1559
 
1325
1560
  def initialize(h={})
@@ -1335,6 +1570,8 @@ class MediaButtonPressedTrigger < Trigger
1335
1570
 
1336
1571
  end
1337
1572
 
1573
+ # Category: User Input
1574
+ #
1338
1575
  class SwipeTrigger < Trigger
1339
1576
 
1340
1577
  def initialize(h={})
@@ -1357,14 +1594,30 @@ class Action < MacroObject
1357
1594
  def initialize(h={})
1358
1595
  super(h)
1359
1596
  end
1597
+
1598
+ def invoke(s='')
1599
+ "%s/%s: %s" % [@group, @type, s]
1600
+ end
1360
1601
 
1361
1602
  end
1362
1603
 
1363
1604
 
1605
+ class LocationAction < Action
1606
+
1607
+ def initialize(h={})
1608
+ super(h)
1609
+ @group = 'location'
1610
+ end
1611
+
1612
+ end
1364
1613
 
1365
- class ShareLocationAction < Action
1614
+ # Category: Location
1615
+ #
1616
+ class ShareLocationAction < LocationAction
1366
1617
 
1367
1618
  def initialize(h={})
1619
+
1620
+ super()
1368
1621
 
1369
1622
  options = {
1370
1623
  email: '',
@@ -1382,39 +1635,19 @@ class ShareLocationAction < Action
1382
1635
 
1383
1636
  end
1384
1637
 
1385
- class UDPCommandAction < Action
1386
-
1387
- def initialize(h={})
1388
-
1389
- options = {
1390
- destination: '',
1391
- message: '',
1392
- port: 1024
1393
- }
1394
-
1395
- super(options.merge h)
1396
-
1397
- end
1398
-
1399
- end
1400
-
1401
- class UDPCommandAction < Action
1402
1638
 
1639
+ class ApplicationAction < Action
1640
+
1403
1641
  def initialize(h={})
1404
-
1405
- options = {
1406
- destination: '',
1407
- message: '',
1408
- port: 1024
1409
- }
1410
-
1411
- super(options.merge h)
1412
-
1642
+ super(h)
1643
+ @group = 'application'
1413
1644
  end
1414
-
1645
+
1415
1646
  end
1416
1647
 
1417
- class LaunchActivityAction < Action
1648
+ # Category: Applications
1649
+ #
1650
+ class LaunchActivityAction < ApplicationAction
1418
1651
 
1419
1652
  def initialize(h={})
1420
1653
 
@@ -1431,7 +1664,9 @@ class LaunchActivityAction < Action
1431
1664
 
1432
1665
  end
1433
1666
 
1434
- class KillBackgroundAppAction < Action
1667
+ # Category: Applications
1668
+ #
1669
+ class KillBackgroundAppAction < ApplicationAction
1435
1670
 
1436
1671
  def initialize(h={})
1437
1672
 
@@ -1446,7 +1681,9 @@ class KillBackgroundAppAction < Action
1446
1681
 
1447
1682
  end
1448
1683
 
1449
- class OpenWebPageAction < Action
1684
+ # Category: Applications
1685
+ #
1686
+ class OpenWebPageAction < ApplicationAction
1450
1687
 
1451
1688
  def initialize(h={})
1452
1689
 
@@ -1464,7 +1701,19 @@ class OpenWebPageAction < Action
1464
1701
 
1465
1702
  end
1466
1703
 
1467
- class UploadPhotoAction < Action
1704
+
1705
+ class CameraAction < Action
1706
+
1707
+ def initialize(h={})
1708
+ super(h)
1709
+ @group = 'camera'
1710
+ end
1711
+
1712
+ end
1713
+
1714
+ # Category: Camera/Photo
1715
+ #
1716
+ class UploadPhotoAction < CameraAction
1468
1717
 
1469
1718
  def initialize(h={})
1470
1719
 
@@ -1479,7 +1728,9 @@ class UploadPhotoAction < Action
1479
1728
 
1480
1729
  end
1481
1730
 
1482
- class TakePictureAction < Action
1731
+ # Category: Camera/Photo
1732
+ #
1733
+ class TakePictureAction < CameraAction
1483
1734
 
1484
1735
  def initialize(h={})
1485
1736
 
@@ -1497,7 +1748,19 @@ class TakePictureAction < Action
1497
1748
 
1498
1749
  end
1499
1750
 
1500
- class SetWifiAction < Action
1751
+
1752
+ class ConnectivityAction < Action
1753
+
1754
+ def initialize(h={})
1755
+ super(h)
1756
+ @group = 'connectivity'
1757
+ end
1758
+
1759
+ end
1760
+
1761
+ # Category: Connectivity
1762
+ #
1763
+ class SetWifiAction < ConnectivityAction
1501
1764
 
1502
1765
  def initialize(h={})
1503
1766
 
@@ -1513,7 +1776,9 @@ class SetWifiAction < Action
1513
1776
 
1514
1777
  end
1515
1778
 
1516
- class SetBluetoothAction < Action
1779
+ # Category: Connectivity
1780
+ #
1781
+ class SetBluetoothAction < ConnectivityAction
1517
1782
 
1518
1783
  def initialize(h={})
1519
1784
 
@@ -1528,7 +1793,9 @@ class SetBluetoothAction < Action
1528
1793
 
1529
1794
  end
1530
1795
 
1531
- class SetBluetoothAction < Action
1796
+ # Category: Connectivity
1797
+ #
1798
+ class SetBluetoothAction < ConnectivityAction
1532
1799
 
1533
1800
  def initialize(h={})
1534
1801
 
@@ -1543,7 +1810,9 @@ class SetBluetoothAction < Action
1543
1810
 
1544
1811
  end
1545
1812
 
1546
- class SendIntentAction < Action
1813
+ # Category: Connectivity
1814
+ #
1815
+ class SendIntentAction < ConnectivityAction
1547
1816
 
1548
1817
  def initialize(h={})
1549
1818
 
@@ -1569,7 +1838,19 @@ class SendIntentAction < Action
1569
1838
 
1570
1839
  end
1571
1840
 
1572
- class SetAlarmClockAction < Action
1841
+
1842
+ class DateTimeAction < Action
1843
+
1844
+ def initialize(h={})
1845
+ super(h)
1846
+ @group = 'datetime'
1847
+ end
1848
+
1849
+ end
1850
+
1851
+ # Category: Date/Time
1852
+ #
1853
+ class SetAlarmClockAction < DateTimeAction
1573
1854
 
1574
1855
  def initialize(h={})
1575
1856
 
@@ -1592,7 +1873,9 @@ class SetAlarmClockAction < Action
1592
1873
 
1593
1874
  end
1594
1875
 
1595
- class StopWatchAction < Action
1876
+ # Category: Date/Time
1877
+ #
1878
+ class StopWatchAction < DateTimeAction
1596
1879
 
1597
1880
  def initialize(h={})
1598
1881
 
@@ -1607,7 +1890,9 @@ class StopWatchAction < Action
1607
1890
 
1608
1891
  end
1609
1892
 
1610
- class SayTimeAction < Action
1893
+ # Category: Date/Time
1894
+ #
1895
+ class SayTimeAction < DateTimeAction
1611
1896
 
1612
1897
  def initialize(h={})
1613
1898
 
@@ -1621,7 +1906,19 @@ class SayTimeAction < Action
1621
1906
 
1622
1907
  end
1623
1908
 
1624
- class AndroidShortcutsAction < Action
1909
+
1910
+ class DeviceAction < Action
1911
+
1912
+ def initialize(h={})
1913
+ super(h)
1914
+ @group = 'device'
1915
+ end
1916
+
1917
+ end
1918
+
1919
+ # Category: Device Actions
1920
+ #
1921
+ class AndroidShortcutsAction < DeviceAction
1625
1922
 
1626
1923
  def initialize(h={})
1627
1924
 
@@ -1635,7 +1932,9 @@ class AndroidShortcutsAction < Action
1635
1932
 
1636
1933
  end
1637
1934
 
1638
- class ClipboardAction < Action
1935
+ # Category: Device Actions
1936
+ #
1937
+ class ClipboardAction < DeviceAction
1639
1938
 
1640
1939
  def initialize(h={})
1641
1940
 
@@ -1649,7 +1948,9 @@ class ClipboardAction < Action
1649
1948
 
1650
1949
  end
1651
1950
 
1652
- class PressBackAction < Action
1951
+ # Category: Device Actions
1952
+ #
1953
+ class PressBackAction < DeviceAction
1653
1954
 
1654
1955
  def initialize(h={})
1655
1956
 
@@ -1662,7 +1963,9 @@ class PressBackAction < Action
1662
1963
 
1663
1964
  end
1664
1965
 
1665
- class SpeakTextAction < Action
1966
+ # Category: Device Actions
1967
+ #
1968
+ class SpeakTextAction < DeviceAction
1666
1969
 
1667
1970
  def initialize(h={})
1668
1971
 
@@ -1683,7 +1986,9 @@ class SpeakTextAction < Action
1683
1986
 
1684
1987
  end
1685
1988
 
1686
- class UIInteractionAction < Action
1989
+ # Category: Device Actions
1990
+ #
1991
+ class UIInteractionAction < DeviceAction
1687
1992
 
1688
1993
  def initialize(h={})
1689
1994
 
@@ -1698,7 +2003,9 @@ class UIInteractionAction < Action
1698
2003
 
1699
2004
  end
1700
2005
 
1701
- class VoiceSearchAction < Action
2006
+ # Category: Device Actions
2007
+ #
2008
+ class VoiceSearchAction < DeviceAction
1702
2009
 
1703
2010
  def initialize(h={})
1704
2011
 
@@ -1711,7 +2018,19 @@ class VoiceSearchAction < Action
1711
2018
 
1712
2019
  end
1713
2020
 
1714
- class ExpandCollapseStatusBarAction < Action
2021
+
2022
+ class DeviceSettingsAction < Action
2023
+
2024
+ def initialize(h={})
2025
+ super(h)
2026
+ @group = 'devicesettings'
2027
+ end
2028
+
2029
+ end
2030
+
2031
+ # Category: Device Settings
2032
+ #
2033
+ class ExpandCollapseStatusBarAction < DeviceSettingsAction
1715
2034
 
1716
2035
  def initialize(h={})
1717
2036
 
@@ -1725,7 +2044,9 @@ class ExpandCollapseStatusBarAction < Action
1725
2044
 
1726
2045
  end
1727
2046
 
1728
- class LaunchHomeScreenAction < Action
2047
+ # Category: Device Settings
2048
+ #
2049
+ class LaunchHomeScreenAction < DeviceSettingsAction
1729
2050
 
1730
2051
  def initialize(h={})
1731
2052
 
@@ -1738,7 +2059,9 @@ class LaunchHomeScreenAction < Action
1738
2059
 
1739
2060
  end
1740
2061
 
1741
- class CameraFlashLightAction < Action
2062
+ # Category: Device Settings
2063
+ #
2064
+ class CameraFlashLightAction < DeviceSettingsAction
1742
2065
 
1743
2066
  def initialize(h={})
1744
2067
 
@@ -1753,7 +2076,9 @@ class CameraFlashLightAction < Action
1753
2076
 
1754
2077
  end
1755
2078
 
1756
- class VibrateAction < Action
2079
+ # Category: Device Settings
2080
+ #
2081
+ class VibrateAction < DeviceSettingsAction
1757
2082
 
1758
2083
  def initialize(h={})
1759
2084
 
@@ -1767,7 +2092,9 @@ class VibrateAction < Action
1767
2092
 
1768
2093
  end
1769
2094
 
1770
- class SetAutoRotateAction < Action
2095
+ # Category: Device Settings
2096
+ #
2097
+ class SetAutoRotateAction < DeviceSettingsAction
1771
2098
 
1772
2099
  def initialize(h={})
1773
2100
 
@@ -1781,7 +2108,9 @@ class SetAutoRotateAction < Action
1781
2108
 
1782
2109
  end
1783
2110
 
1784
- class DayDreamAction < Action
2111
+ # Category: Device Settings
2112
+ #
2113
+ class DayDreamAction < DeviceSettingsAction
1785
2114
 
1786
2115
  def initialize(h={})
1787
2116
 
@@ -1794,7 +2123,9 @@ class DayDreamAction < Action
1794
2123
 
1795
2124
  end
1796
2125
 
1797
- class SetKeyboardAction < Action
2126
+ # Category: Device Settings
2127
+ #
2128
+ class SetKeyboardAction < DeviceSettingsAction
1798
2129
 
1799
2130
  def initialize(h={})
1800
2131
 
@@ -1807,7 +2138,9 @@ class SetKeyboardAction < Action
1807
2138
 
1808
2139
  end
1809
2140
 
1810
- class SetKeyguardAction < Action
2141
+ # Category: Device Settings
2142
+ #
2143
+ class SetKeyguardAction < DeviceSettingsAction
1811
2144
 
1812
2145
  def initialize(h={})
1813
2146
 
@@ -1821,7 +2154,9 @@ class SetKeyguardAction < Action
1821
2154
 
1822
2155
  end
1823
2156
 
1824
- class CarModeAction < Action
2157
+ # Category: Device Settings
2158
+ #
2159
+ class CarModeAction < DeviceSettingsAction
1825
2160
 
1826
2161
  def initialize(h={})
1827
2162
 
@@ -1835,7 +2170,9 @@ class CarModeAction < Action
1835
2170
 
1836
2171
  end
1837
2172
 
1838
- class ChangeKeyboardAction < Action
2173
+ # Category: Device Settings
2174
+ #
2175
+ class ChangeKeyboardAction < DeviceSettingsAction
1839
2176
 
1840
2177
  def initialize(h={})
1841
2178
 
@@ -1850,7 +2187,9 @@ class ChangeKeyboardAction < Action
1850
2187
 
1851
2188
  end
1852
2189
 
1853
- class SetWallpaperAction < Action
2190
+ # Category: Device Settings
2191
+ #
2192
+ class SetWallpaperAction < DeviceSettingsAction
1854
2193
 
1855
2194
  def initialize(h={})
1856
2195
 
@@ -1869,7 +2208,18 @@ class SetWallpaperAction < Action
1869
2208
 
1870
2209
  end
1871
2210
 
1872
- class OpenFileAction < Action
2211
+ class FileAction < Action
2212
+
2213
+ def initialize(h={})
2214
+ super(h)
2215
+ @group = 'file'
2216
+ end
2217
+
2218
+ end
2219
+
2220
+ # Category: Files
2221
+ #
2222
+ class OpenFileAction < FileAction
1873
2223
 
1874
2224
  def initialize(h={})
1875
2225
 
@@ -1886,7 +2236,19 @@ class OpenFileAction < Action
1886
2236
 
1887
2237
  end
1888
2238
 
1889
- class ForceLocationUpdateAction < Action
2239
+
2240
+ class LocationAction < Action
2241
+
2242
+ def initialize(h={})
2243
+ super(h)
2244
+ @group = 'location'
2245
+ end
2246
+
2247
+ end
2248
+
2249
+ # Category: Location
2250
+ #
2251
+ class ForceLocationUpdateAction < LocationAction
1890
2252
 
1891
2253
  def initialize(h={})
1892
2254
 
@@ -1899,7 +2261,9 @@ class ForceLocationUpdateAction < Action
1899
2261
 
1900
2262
  end
1901
2263
 
1902
- class ShareLocationAction < Action
2264
+ # Category: Location
2265
+ #
2266
+ class ShareLocationAction < LocationAction
1903
2267
 
1904
2268
  def initialize(h={})
1905
2269
 
@@ -1917,7 +2281,9 @@ class ShareLocationAction < Action
1917
2281
 
1918
2282
  end
1919
2283
 
1920
- class SetLocationUpdateRateAction < Action
2284
+ # Category: Location
2285
+ #
2286
+ class SetLocationUpdateRateAction < LocationAction
1921
2287
 
1922
2288
  def initialize(h={})
1923
2289
 
@@ -1932,7 +2298,18 @@ class SetLocationUpdateRateAction < Action
1932
2298
 
1933
2299
  end
1934
2300
 
1935
- class AddCalendarEntryAction < Action
2301
+ class LoggingAction < Action
2302
+
2303
+ def initialize(h={})
2304
+ super(h)
2305
+ @group = 'logging'
2306
+ end
2307
+
2308
+ end
2309
+
2310
+ # Category: Logging
2311
+ #
2312
+ class AddCalendarEntryAction < LoggingAction
1936
2313
 
1937
2314
  def initialize(h={})
1938
2315
 
@@ -1959,7 +2336,9 @@ class AddCalendarEntryAction < Action
1959
2336
 
1960
2337
  end
1961
2338
 
1962
- class LogAction < Action
2339
+ # Category: Logging
2340
+ #
2341
+ class LogAction < LoggingAction
1963
2342
 
1964
2343
  def initialize(h={})
1965
2344
 
@@ -1974,7 +2353,9 @@ class LogAction < Action
1974
2353
 
1975
2354
  end
1976
2355
 
1977
- class ClearLogAction < Action
2356
+ # Category: Logging
2357
+ #
2358
+ class ClearLogAction < LoggingAction
1978
2359
 
1979
2360
  def initialize(h={})
1980
2361
 
@@ -1988,24 +2369,18 @@ class ClearLogAction < Action
1988
2369
 
1989
2370
  end
1990
2371
 
1991
- class RecordMicrophoneAction < Action
1992
-
2372
+ class MediaAction < Action
2373
+
1993
2374
  def initialize(h={})
1994
-
1995
- options = {
1996
- path: '',
1997
- record_time_string: 'Until Cancelled',
1998
- recording_format: 0,
1999
- seconds_to_record_for: -1
2000
- }
2001
-
2002
- super(options.merge h)
2003
-
2375
+ super(h)
2376
+ @group = 'media'
2004
2377
  end
2005
-
2378
+
2006
2379
  end
2007
2380
 
2008
- class RecordMicrophoneAction < Action
2381
+ # Category: Media
2382
+ #
2383
+ class RecordMicrophoneAction < MediaAction
2009
2384
 
2010
2385
  def initialize(h={})
2011
2386
 
@@ -2022,7 +2397,9 @@ class RecordMicrophoneAction < Action
2022
2397
 
2023
2398
  end
2024
2399
 
2025
- class PlaySoundAction < Action
2400
+ # Category: Media
2401
+ #
2402
+ class PlaySoundAction < MediaAction
2026
2403
 
2027
2404
  def initialize(h={})
2028
2405
 
@@ -2038,7 +2415,18 @@ class PlaySoundAction < Action
2038
2415
  end
2039
2416
 
2040
2417
 
2041
- class SendEmailAction < Action
2418
+ class MessagingAction < Action
2419
+
2420
+ def initialize(h={})
2421
+ super(h)
2422
+ @group = 'messaging'
2423
+ end
2424
+
2425
+ end
2426
+
2427
+ # Category: Messaging
2428
+ #
2429
+ class SendEmailAction < MessagingAction
2042
2430
 
2043
2431
  def initialize(h={})
2044
2432
 
@@ -2058,7 +2446,9 @@ class SendEmailAction < Action
2058
2446
 
2059
2447
  end
2060
2448
 
2061
- class SendSMSAction < Action
2449
+ # Category: Messaging
2450
+ #
2451
+ class SendSMSAction < MessagingAction
2062
2452
 
2063
2453
  def initialize(h={})
2064
2454
 
@@ -2077,7 +2467,9 @@ class SendSMSAction < Action
2077
2467
 
2078
2468
  end
2079
2469
 
2080
- class UDPCommandAction < Action
2470
+ # Category: Messaging
2471
+ #
2472
+ class UDPCommandAction < MessagingAction
2081
2473
 
2082
2474
  def initialize(h={})
2083
2475
 
@@ -2093,7 +2485,19 @@ class UDPCommandAction < Action
2093
2485
 
2094
2486
  end
2095
2487
 
2096
- class ClearNotificationsAction < Action
2488
+
2489
+ class NotificationsAction < Action
2490
+
2491
+ def initialize(h={})
2492
+ super(h)
2493
+ @group = 'notifications'
2494
+ end
2495
+
2496
+ end
2497
+
2498
+ # Category: Notifications
2499
+ #
2500
+ class ClearNotificationsAction < NotificationsAction
2097
2501
 
2098
2502
  def initialize(h={})
2099
2503
 
@@ -2115,7 +2519,9 @@ class ClearNotificationsAction < Action
2115
2519
 
2116
2520
  end
2117
2521
 
2118
- class MessageDialogAction < Action
2522
+ # Category: Notifications
2523
+ #
2524
+ class MessageDialogAction < NotificationsAction
2119
2525
 
2120
2526
  def initialize(h={})
2121
2527
 
@@ -2140,7 +2546,9 @@ class MessageDialogAction < Action
2140
2546
 
2141
2547
  end
2142
2548
 
2143
- class AllowLEDNotificationLightAction < Action
2549
+ # Category: Notifications
2550
+ #
2551
+ class AllowLEDNotificationLightAction < NotificationsAction
2144
2552
 
2145
2553
  def initialize(h={})
2146
2554
 
@@ -2154,7 +2562,9 @@ class AllowLEDNotificationLightAction < Action
2154
2562
 
2155
2563
  end
2156
2564
 
2157
- class SetNotificationSoundAction < Action
2565
+ # Category: Notifications
2566
+ #
2567
+ class SetNotificationSoundAction < NotificationsAction
2158
2568
 
2159
2569
  def initialize(h={})
2160
2570
 
@@ -2168,7 +2578,9 @@ class SetNotificationSoundAction < Action
2168
2578
 
2169
2579
  end
2170
2580
 
2171
- class SetNotificationSoundAction < Action
2581
+ # Category: Notifications
2582
+ #
2583
+ class SetNotificationSoundAction < NotificationsAction
2172
2584
 
2173
2585
  def initialize(h={})
2174
2586
 
@@ -2182,7 +2594,9 @@ class SetNotificationSoundAction < Action
2182
2594
 
2183
2595
  end
2184
2596
 
2185
- class SetNotificationSoundAction < Action
2597
+ # Category: Notifications
2598
+ #
2599
+ class SetNotificationSoundAction < NotificationsAction
2186
2600
 
2187
2601
  def initialize(h={})
2188
2602
 
@@ -2196,7 +2610,9 @@ class SetNotificationSoundAction < Action
2196
2610
 
2197
2611
  end
2198
2612
 
2199
- class NotificationAction < Action
2613
+ # Category: Notifications
2614
+ #
2615
+ class NotificationAction < NotificationsAction
2200
2616
 
2201
2617
  def initialize(h={})
2202
2618
 
@@ -2220,7 +2636,9 @@ class NotificationAction < Action
2220
2636
 
2221
2637
  end
2222
2638
 
2223
- class ToastAction < Action
2639
+ # Category: Notifications
2640
+ #
2641
+ class ToastAction < NotificationsAction
2224
2642
 
2225
2643
  def initialize(h={})
2226
2644
 
@@ -2243,10 +2661,26 @@ class ToastAction < Action
2243
2661
  super(options.merge h)
2244
2662
 
2245
2663
  end
2664
+
2665
+ def invoke()
2666
+ super(@h[:message_text])
2667
+ end
2246
2668
 
2247
2669
  end
2248
2670
 
2249
- class AnswerCallAction < Action
2671
+
2672
+ class PhoneAction < Action
2673
+
2674
+ def initialize(h={})
2675
+ super(h)
2676
+ @group = 'phone'
2677
+ end
2678
+
2679
+ end
2680
+
2681
+ # Category: Phone
2682
+ #
2683
+ class AnswerCallAction < PhoneAction
2250
2684
 
2251
2685
  def initialize(h={})
2252
2686
 
@@ -2260,7 +2694,9 @@ class AnswerCallAction < Action
2260
2694
 
2261
2695
  end
2262
2696
 
2263
- class ClearCallLogAction < Action
2697
+ # Category: Phone
2698
+ #
2699
+ class ClearCallLogAction < PhoneAction
2264
2700
 
2265
2701
  def initialize(h={})
2266
2702
 
@@ -2276,7 +2712,9 @@ class ClearCallLogAction < Action
2276
2712
 
2277
2713
  end
2278
2714
 
2279
- class OpenCallLogAction < Action
2715
+ # Category: Phone
2716
+ #
2717
+ class OpenCallLogAction < PhoneAction
2280
2718
 
2281
2719
  def initialize(h={})
2282
2720
 
@@ -2289,7 +2727,9 @@ class OpenCallLogAction < Action
2289
2727
 
2290
2728
  end
2291
2729
 
2292
- class RejectCallAction < Action
2730
+ # Category: Phone
2731
+ #
2732
+ class RejectCallAction < PhoneAction
2293
2733
 
2294
2734
  def initialize(h={})
2295
2735
 
@@ -2302,7 +2742,9 @@ class RejectCallAction < Action
2302
2742
 
2303
2743
  end
2304
2744
 
2305
- class MakeCallAction < Action
2745
+ # Category: Phone
2746
+ #
2747
+ class MakeCallAction < PhoneAction
2306
2748
 
2307
2749
  def initialize(h={})
2308
2750
 
@@ -2317,7 +2759,10 @@ class MakeCallAction < Action
2317
2759
 
2318
2760
  end
2319
2761
 
2320
- class SetRingtoneAction < Action
2762
+
2763
+ # Category: Phone
2764
+ #
2765
+ class SetRingtoneAction < PhoneAction
2321
2766
 
2322
2767
  def initialize(h={})
2323
2768
 
@@ -2331,7 +2776,18 @@ class SetRingtoneAction < Action
2331
2776
 
2332
2777
  end
2333
2778
 
2334
- class SetBrightnessAction < Action
2779
+ class ScreenAction < Action
2780
+
2781
+ def initialize(h={})
2782
+ super(h)
2783
+ @group = 'screen'
2784
+ end
2785
+
2786
+ end
2787
+
2788
+ # Category: Screen
2789
+ #
2790
+ class SetBrightnessAction < ScreenAction
2335
2791
 
2336
2792
  def initialize(h={})
2337
2793
 
@@ -2347,7 +2803,9 @@ class SetBrightnessAction < Action
2347
2803
 
2348
2804
  end
2349
2805
 
2350
- class ForceScreenRotationAction < Action
2806
+ # Category: Screen
2807
+ #
2808
+ class ForceScreenRotationAction < ScreenAction
2351
2809
 
2352
2810
  def initialize(h={})
2353
2811
 
@@ -2361,7 +2819,9 @@ class ForceScreenRotationAction < Action
2361
2819
 
2362
2820
  end
2363
2821
 
2364
- class ScreenOnAction < Action
2822
+ # Category: Screen
2823
+ #
2824
+ class ScreenOnAction < ScreenAction
2365
2825
 
2366
2826
  def initialize(h={})
2367
2827
 
@@ -2378,7 +2838,9 @@ class ScreenOnAction < Action
2378
2838
 
2379
2839
  end
2380
2840
 
2381
- class DimScreenAction < Action
2841
+ # Category: Screen
2842
+ #
2843
+ class DimScreenAction < ScreenAction
2382
2844
 
2383
2845
  def initialize(h={})
2384
2846
 
@@ -2393,7 +2855,9 @@ class DimScreenAction < Action
2393
2855
 
2394
2856
  end
2395
2857
 
2396
- class KeepAwakeAction < Action
2858
+ # Category: Screen
2859
+ #
2860
+ class KeepAwakeAction < ScreenAction
2397
2861
 
2398
2862
  def initialize(h={})
2399
2863
 
@@ -2410,7 +2874,9 @@ class KeepAwakeAction < Action
2410
2874
 
2411
2875
  end
2412
2876
 
2413
- class SetScreenTimeoutAction < Action
2877
+ # Category: Screen
2878
+ #
2879
+ class SetScreenTimeoutAction < ScreenAction
2414
2880
 
2415
2881
  def initialize(h={})
2416
2882
 
@@ -2427,8 +2893,18 @@ class SetScreenTimeoutAction < Action
2427
2893
  end
2428
2894
 
2429
2895
 
2896
+ class VolumeAction < Action
2897
+
2898
+ def initialize(h={})
2899
+ super(h)
2900
+ @group = 'volume'
2901
+ end
2902
+
2903
+ end
2430
2904
 
2431
- class SilentModeVibrateOffAction < Action
2905
+ # Category: Volume
2906
+ #
2907
+ class SilentModeVibrateOffAction < VolumeAction
2432
2908
 
2433
2909
  def initialize(h={})
2434
2910
 
@@ -2442,7 +2918,9 @@ class SilentModeVibrateOffAction < Action
2442
2918
 
2443
2919
  end
2444
2920
 
2445
- class SetVibrateAction < Action
2921
+ # Category: Volume
2922
+ #
2923
+ class SetVibrateAction < VolumeAction
2446
2924
 
2447
2925
  def initialize(h={})
2448
2926
 
@@ -2457,7 +2935,9 @@ class SetVibrateAction < Action
2457
2935
 
2458
2936
  end
2459
2937
 
2460
- class VolumeIncrementDecrementAction < Action
2938
+ # Category: Volume
2939
+ #
2940
+ class VolumeIncrementDecrementAction < VolumeAction
2461
2941
 
2462
2942
  def initialize(h={})
2463
2943
 
@@ -2471,7 +2951,9 @@ class VolumeIncrementDecrementAction < Action
2471
2951
 
2472
2952
  end
2473
2953
 
2474
- class SpeakerPhoneAction < Action
2954
+ # Category: Volume
2955
+ #
2956
+ class SpeakerPhoneAction < VolumeAction
2475
2957
 
2476
2958
  def initialize(h={})
2477
2959
 
@@ -2486,8 +2968,9 @@ class SpeakerPhoneAction < Action
2486
2968
 
2487
2969
  end
2488
2970
 
2489
-
2490
- class SetVolumeAction < Action
2971
+ # Category: Volume
2972
+ #
2973
+ class SetVolumeAction < VolumeAction
2491
2974
 
2492
2975
  def initialize(h={})
2493
2976