ruby-macrodroid 0.7.7 → 0.7.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2bb7feb730c6e27fa5a975bfdbf07828880549917f2f827444024baab88520d
4
- data.tar.gz: 1c6e78b40874c2ddc5760d052974998071c581ba5cc3c52dcef58c2d1cd288ce
3
+ metadata.gz: fb08c0b934e551a836b13053c11620701b999344e32c584ead58ed4ba09bc22e
4
+ data.tar.gz: 80b878ffc9dfa68ebe83e0d530a131b29610d7e0d3fa60cee0674ee5f2969c68
5
5
  SHA512:
6
- metadata.gz: f5f66318dc99e82aa73fb6ce5ba11604f290f57d5757cfcdc46664165095b950cebf30da91b4dd9623200f5b615306f40f7815eefb78fe3f7eb65f5567dfd940
7
- data.tar.gz: '03767919cd1943368facf1c7b66c8ebc6cffeceef99123e9d24957adc6cbedc336fa55468c05b73df691cb8c204d629dfdc085933aaee86370dbecf5f67e6b00'
6
+ metadata.gz: 534112f1b6685dc04c16ff80313bdef13a69c71bad370c4b1ac0fa9688a1605e3869d80e5e5edaab86db18b204726acbda1038070ad2b5de962ebc2d09d63dc7
7
+ data.tar.gz: cebc3aac1fc702c9e6bf21700fe983cb2e243b18458219a36f07131904b35ce983cdcaab8b5c244f5dfe171d1bdd14cd1643a71ffbf79a9701fb94776d94713c
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -200,6 +200,11 @@ class TriggersNlp
200
200
 
201
201
  alias find_trigger run_route
202
202
 
203
+ def to_s(colour: false)
204
+ 'TriggersNlp ' + @h.inspect
205
+ end
206
+
207
+ alias to_summary to_s
203
208
  end
204
209
 
205
210
  class ActionsNlp
@@ -319,6 +324,11 @@ class ActionsNlp
319
324
 
320
325
  alias find_action run_route
321
326
 
327
+ def to_s(colour: false)
328
+ 'ActionsNlp ' + @h.inspect
329
+ end
330
+
331
+ alias to_summary to_s
322
332
  end
323
333
 
324
334
  class ConstraintsNlp
@@ -473,7 +483,8 @@ class Macro
473
483
 
474
484
  # fetch the triggers
475
485
  @triggers = h[:trigger_list].map do |trigger|
476
-
486
+ puts 'trigger: ' + trigger.inspect
487
+ #exit
477
488
  object(trigger.to_snake_case)
478
489
 
479
490
  end
@@ -669,7 +680,11 @@ EOF
669
680
  indent = 0
670
681
  actions = @actions.map do |x|
671
682
 
672
- s = x.to_s
683
+ s = x.to_s(colour: colour)
684
+ if s.lines.length > 1 then
685
+ lines = s.lines
686
+ s = lines[0] + lines[1..-1].map {|x| x.prepend (' ' * indent) }.join
687
+ end
673
688
 
674
689
  r = if indent <= 0 then
675
690
 
@@ -736,15 +751,38 @@ EOF
736
751
 
737
752
  end
738
753
 
739
- def to_summary()
754
+ def to_summary(colour: false)
755
+
756
+ if colour then
757
+
758
+ a = [
759
+ 'm'.bg_cyan.gray.bold + ': ' + @title,
760
+ 't'.bg_red.gray.bold + ': ' + @triggers.map \
761
+ {|x| x.to_summary(colour: false)}.join(", "),
762
+ 'a'.bg_blue.gray.bold + ': ' + @actions.map \
763
+ {|x| x.to_summary(colour: false)}.join(", ")
764
+ ]
765
+
766
+ if @constraints.any? then
767
+ a << 'c'.bg_green.gray.bold + ': ' + @constraints.map \
768
+ {|x| x.to_summary(colour: false)}.join(", ")
769
+ end
770
+
771
+ else
772
+
773
+ a = [
774
+ 'm: ' + @title,
775
+ 't: ' + @triggers.map {|x| x.to_summary(colour: false)}.join(", "),
776
+ 'a: ' + @actions.map {|x| x.to_summary(colour: false)}.join(", ")
777
+ ]
778
+
779
+ if @constraints.any? then
780
+ a << 'c: ' + @constraints.map \
781
+ {|x| x.to_summary(colour: false)}.join(", ")
782
+ end
783
+ end
740
784
 
741
- a = [
742
- 'm: ' + @title,
743
- 't: ' + @triggers.map(&:to_summary).join(", "),
744
- 'a: ' + @actions.map(&:to_summary).join(", "),
745
- ]
746
785
 
747
- a << 'c: ' + @constraints.map(&:to_summary).join(", ") if @constraints.any?
748
786
 
749
787
  a.join("\n") + "\n"
750
788
 
@@ -758,7 +796,7 @@ EOF
758
796
 
759
797
  def object(h={})
760
798
 
761
- puts ('inside object h:' + h.inspect).debug if @debug
799
+ puts ('inside object h:' + h.inspect).debug if @debug
762
800
  klass = Object.const_get h[:class_type]
763
801
  puts klass.inspect.highlight if $debug
764
802
 
@@ -930,8 +968,8 @@ class MacroDroid
930
968
 
931
969
  end
932
970
 
933
- def to_summary()
934
- @macros.map(&:to_summary).join("\n")
971
+ def to_summary(colour: false)
972
+ @macros.map {|x| x.to_summary(colour: colour)}.join("\n")
935
973
  end
936
974
 
937
975
  private
@@ -1093,7 +1131,7 @@ class GeofenceMap
1093
1131
 
1094
1132
  end
1095
1133
 
1096
- def to_s()
1134
+ def to_s(colour: false)
1097
1135
 
1098
1136
  lines = []
1099
1137
  coordinates = "%s, %s" % [@latitude, @longitude]
@@ -1117,8 +1155,9 @@ class MacroObject
1117
1155
 
1118
1156
  $env ||= {}
1119
1157
 
1158
+ @attributes = %i(constraint_list is_or_condition is_disabled siguid)
1120
1159
  @h = {constraint_list: [], is_or_condition: false,
1121
- is_disabled: false}.merge(h)
1160
+ is_disabled: false, siguid: nil}.merge(h)
1122
1161
  @list = []
1123
1162
 
1124
1163
  # fetch the class name and convert from camelCase to snake_eyes
@@ -1126,6 +1165,7 @@ class MacroObject
1126
1165
  .gsub(/\B[A-Z][a-z]/){|x| '_' + x.downcase}\
1127
1166
  .gsub(/[a-z][A-Z]/){|x| x[0] + '_' + x[1].downcase}\
1128
1167
  .downcase.to_sym
1168
+ @constraints = []
1129
1169
  end
1130
1170
 
1131
1171
  def to_h()
@@ -1150,8 +1190,17 @@ class MacroObject
1150
1190
  @h[:siguid]
1151
1191
  end
1152
1192
 
1153
- def to_s()
1154
- "#<%s %s>" % [self.class, @h.inspect]
1193
+ def to_s(colour: false)
1194
+
1195
+ h = @h.clone
1196
+ h.delete :macro
1197
+ @s ||= "#<%s %s>" % [self.class, h.inspect]
1198
+ operator = @h[:is_or_condition] ? 'OR' : 'AND'
1199
+ constraints = @constraints.map \
1200
+ {|x| x.to_summary(colour: colour)}.join(" %s " % operator)
1201
+
1202
+ @s + constraints
1203
+
1155
1204
  end
1156
1205
 
1157
1206
  alias to_summary to_s
@@ -1160,7 +1209,7 @@ class MacroObject
1160
1209
 
1161
1210
  def filter(options, h)
1162
1211
 
1163
- (h.keys - options.keys).each {|key| h.delete key }
1212
+ (h.keys - (options.keys + @attributes.to_a)).each {|key| h.delete key }
1164
1213
  return h
1165
1214
 
1166
1215
  end
@@ -1221,6 +1270,11 @@ class WebHookTrigger < Trigger
1221
1270
 
1222
1271
  end
1223
1272
 
1273
+ def to_s(colour: false)
1274
+ 'WebHookTrigger ' + @h.inspect
1275
+ end
1276
+
1277
+ alias to_summary to_s
1224
1278
  end
1225
1279
 
1226
1280
  # Category: Applications
@@ -1252,6 +1306,11 @@ class WifiConnectionTrigger < Trigger
1252
1306
 
1253
1307
  end
1254
1308
 
1309
+ def to_s(colour: false)
1310
+ 'WifiConnectionTrigger ' + @h.inspect
1311
+ end
1312
+
1313
+ alias to_summary to_s
1255
1314
  end
1256
1315
 
1257
1316
  # Category: Applications
@@ -1272,6 +1331,11 @@ class ApplicationInstalledRemovedTrigger < Trigger
1272
1331
 
1273
1332
  end
1274
1333
 
1334
+ def to_s(colour: false)
1335
+ 'ApplicationInstalledRemovedTrigger ' + @h.inspect
1336
+ end
1337
+
1338
+ alias to_summary to_s
1275
1339
  end
1276
1340
 
1277
1341
  # Category: Applications
@@ -1290,6 +1354,11 @@ class ApplicationLaunchedTrigger < Trigger
1290
1354
 
1291
1355
  end
1292
1356
 
1357
+ def to_s(colour: false)
1358
+ 'ApplicationLaunchedTrigger ' + @h.inspect
1359
+ end
1360
+
1361
+ alias to_summary to_s
1293
1362
  end
1294
1363
 
1295
1364
  # Category: Battery/Power
@@ -1308,7 +1377,7 @@ class BatteryLevelTrigger < Trigger
1308
1377
 
1309
1378
  end
1310
1379
 
1311
- def to_s()
1380
+ def to_s(colour: false)
1312
1381
  operator = @h[:decreases_to] ? '<=' : '>='
1313
1382
  "Battery %s %s%%" % [operator, @h[:battery_level]]
1314
1383
  end
@@ -1331,6 +1400,11 @@ class BatteryTemperatureTrigger < Trigger
1331
1400
 
1332
1401
  end
1333
1402
 
1403
+ def to_s(colour: false)
1404
+ 'BatteryTemperatureTrigger ' + @h.inspect
1405
+ end
1406
+
1407
+ alias to_summary to_s
1334
1408
  end
1335
1409
 
1336
1410
  # Category: Battery/Power
@@ -1347,6 +1421,11 @@ class PowerButtonToggleTrigger < Trigger
1347
1421
 
1348
1422
  end
1349
1423
 
1424
+ def to_s(colour: false)
1425
+ 'PowerButtonToggleTrigger ' + @h.inspect
1426
+ end
1427
+
1428
+ alias to_summary to_s
1350
1429
  end
1351
1430
 
1352
1431
 
@@ -1367,7 +1446,7 @@ class ExternalPowerTrigger < Trigger
1367
1446
 
1368
1447
  end
1369
1448
 
1370
- def to_s()
1449
+ def to_s(colour: false)
1371
1450
 
1372
1451
  return 'Power Disconnected' unless @h[:power_connected]
1373
1452
 
@@ -1383,7 +1462,10 @@ class ExternalPowerTrigger < Trigger
1383
1462
  end
1384
1463
 
1385
1464
  "%s: %s" % [status, options]
1465
+
1386
1466
  end
1467
+
1468
+ alias to_summary to_s
1387
1469
 
1388
1470
  end
1389
1471
 
@@ -1403,6 +1485,11 @@ class CallActiveTrigger < Trigger
1403
1485
 
1404
1486
  end
1405
1487
 
1488
+ def to_s(colour: false)
1489
+ 'CallActiveTrigger ' + @h.inspect
1490
+ end
1491
+
1492
+ alias to_summary to_s
1406
1493
  end
1407
1494
 
1408
1495
  # Category: Call/SMS
@@ -1423,6 +1510,11 @@ class IncomingCallTrigger < Trigger
1423
1510
 
1424
1511
  end
1425
1512
 
1513
+ def to_s(colour: false)
1514
+ 'IncomingCallTrigger ' + @h.inspect
1515
+ end
1516
+
1517
+ alias to_summary to_s
1426
1518
  end
1427
1519
 
1428
1520
  # Category: Call/SMS
@@ -1443,6 +1535,11 @@ class OutgoingCallTrigger < Trigger
1443
1535
 
1444
1536
  end
1445
1537
 
1538
+ def to_s(colour: false)
1539
+ 'OutgoingCallTrigger ' + @h.inspect
1540
+ end
1541
+
1542
+ alias to_summary to_s
1446
1543
  end
1447
1544
 
1448
1545
  # Category: Call/SMS
@@ -1463,6 +1560,11 @@ class CallEndedTrigger < Trigger
1463
1560
 
1464
1561
  end
1465
1562
 
1563
+ def to_s(colour: false)
1564
+ 'CallEndedTrigger ' + @h.inspect
1565
+ end
1566
+
1567
+ alias to_summary to_s
1466
1568
  end
1467
1569
 
1468
1570
  # Category: Call/SMS
@@ -1479,6 +1581,11 @@ class CallMissedTrigger < Trigger
1479
1581
 
1480
1582
  end
1481
1583
 
1584
+ def to_s(colour: false)
1585
+ 'CallMissedTrigger ' + @h.inspect
1586
+ end
1587
+
1588
+ alias to_summary to_s
1482
1589
  end
1483
1590
 
1484
1591
  # Category: Call/SMS
@@ -1503,6 +1610,11 @@ class IncomingSMSTrigger < Trigger
1503
1610
 
1504
1611
  end
1505
1612
 
1613
+ def to_s(colour: false)
1614
+ 'IncomingSMSTrigger ' + @h.inspect
1615
+ end
1616
+
1617
+ alias to_summary to_s
1506
1618
  end
1507
1619
 
1508
1620
  # Category: Connectivity
@@ -1519,6 +1631,11 @@ class WebHookTrigger < Trigger
1519
1631
 
1520
1632
  end
1521
1633
 
1634
+ def to_s(colour: false)
1635
+ 'WebHookTrigger ' + @h.inspect
1636
+ end
1637
+
1638
+ alias to_summary to_s
1522
1639
  end
1523
1640
 
1524
1641
  # Category: Connectivity
@@ -1536,6 +1653,11 @@ class WifiConnectionTrigger < Trigger
1536
1653
 
1537
1654
  end
1538
1655
 
1656
+ def to_s(colour: false)
1657
+ 'WifiConnectionTrigger ' + @h.inspect
1658
+ end
1659
+
1660
+ alias to_summary to_s
1539
1661
  end
1540
1662
 
1541
1663
  # Category: Connectivity
@@ -1554,6 +1676,11 @@ class BluetoothTrigger < Trigger
1554
1676
 
1555
1677
  end
1556
1678
 
1679
+ def to_s(colour: false)
1680
+ 'BluetoothTrigger ' + @h.inspect
1681
+ end
1682
+
1683
+ alias to_summary to_s
1557
1684
  end
1558
1685
 
1559
1686
  # Category: Connectivity
@@ -1571,6 +1698,11 @@ class HeadphonesTrigger < Trigger
1571
1698
 
1572
1699
  end
1573
1700
 
1701
+ def to_s(colour: false)
1702
+ 'HeadphonesTrigger ' + @h.inspect
1703
+ end
1704
+
1705
+ alias to_summary to_s
1574
1706
  end
1575
1707
 
1576
1708
  # Category: Connectivity
@@ -1587,6 +1719,11 @@ class SignalOnOffTrigger < Trigger
1587
1719
 
1588
1720
  end
1589
1721
 
1722
+ def to_s(colour: false)
1723
+ 'SignalOnOffTrigger ' + @h.inspect
1724
+ end
1725
+
1726
+ alias to_summary to_s
1590
1727
  end
1591
1728
 
1592
1729
  # Category: Connectivity
@@ -1603,6 +1740,11 @@ class UsbDeviceConnectionTrigger < Trigger
1603
1740
 
1604
1741
  end
1605
1742
 
1743
+ def to_s(colour: false)
1744
+ 'UsbDeviceConnectionTrigger ' + @h.inspect
1745
+ end
1746
+
1747
+ alias to_summary to_s
1606
1748
  end
1607
1749
 
1608
1750
  # Category: Connectivity
@@ -1640,6 +1782,11 @@ class WifiSSIDTrigger < Trigger
1640
1782
 
1641
1783
  end
1642
1784
 
1785
+ def to_s(colour: false)
1786
+ 'WifiSSIDTrigger ' + @h.inspect
1787
+ end
1788
+
1789
+ alias to_summary to_s
1643
1790
  end
1644
1791
 
1645
1792
  # Category: Date/Time
@@ -1666,6 +1813,11 @@ class CalendarTrigger < Trigger
1666
1813
 
1667
1814
  end
1668
1815
 
1816
+ def to_s(colour: false)
1817
+ 'CalendarTrigger ' + @h.inspect
1818
+ end
1819
+
1820
+ alias to_summary to_s
1669
1821
  end
1670
1822
 
1671
1823
  # Category: Date/Time
@@ -1703,7 +1855,7 @@ class TimerTrigger < Trigger
1703
1855
 
1704
1856
  #puts ('h: ' + h.inspect).debug
1705
1857
 
1706
- options = {
1858
+ @options = {
1707
1859
  alarm_id: uuid(),
1708
1860
  days_of_week: [false, false, false, false, false, false, false],
1709
1861
  minute: 10,
@@ -1711,7 +1863,8 @@ class TimerTrigger < Trigger
1711
1863
  use_alarm: false
1712
1864
  }
1713
1865
 
1714
- super(options.merge filter(options, h))
1866
+ #super(options.merge filter(options, h))
1867
+ super(@options.merge h)
1715
1868
 
1716
1869
  end
1717
1870
 
@@ -1731,7 +1884,7 @@ class TimerTrigger < Trigger
1731
1884
  "time.is? '%s'" % self.to_s.gsub(',', ' or')
1732
1885
  end
1733
1886
 
1734
- def to_s()
1887
+ def to_s(colour: false)
1735
1888
 
1736
1889
  dow = @h[:days_of_week]
1737
1890
 
@@ -1756,11 +1909,13 @@ class TimerTrigger < Trigger
1756
1909
  a.zip(dow).select {|_,b| b}.map(&:first).join(', ')
1757
1910
  end
1758
1911
 
1759
- time = Time.parse("%s:%s" % [@h[:hour], @h[:minute]]).strftime("%-H:%M%P")
1912
+ time = Time.parse("%s:%s" % [@h[:hour], @h[:minute]]).strftime("%H:%M")
1760
1913
 
1761
1914
  "%s %s" % [time, days]
1762
1915
  end
1763
1916
 
1917
+ alias to_summary to_s
1918
+
1764
1919
  private
1765
1920
 
1766
1921
  def time()
@@ -1792,6 +1947,11 @@ class StopwatchTrigger < Trigger
1792
1947
 
1793
1948
  end
1794
1949
 
1950
+ def to_s(colour: false)
1951
+ 'StopwatchTrigger ' + @h.inspect
1952
+ end
1953
+
1954
+ alias to_summary to_s
1795
1955
  end
1796
1956
 
1797
1957
  # Category: Date/Time
@@ -1820,6 +1980,11 @@ class DayTrigger < Trigger
1820
1980
 
1821
1981
  end
1822
1982
 
1983
+ def to_s(colour: false)
1984
+ 'DayTrigger ' + @h.inspect
1985
+ end
1986
+
1987
+ alias to_summary to_s
1823
1988
  end
1824
1989
 
1825
1990
  # Category: Date/Time
@@ -1843,6 +2008,11 @@ class RegularIntervalTrigger < Trigger
1843
2008
 
1844
2009
  end
1845
2010
 
2011
+ def to_s(colour: false)
2012
+ 'RegularIntervalTrigger ' + @h.inspect
2013
+ end
2014
+
2015
+ alias to_summary to_s
1846
2016
  end
1847
2017
 
1848
2018
  class DeviceEventsTrigger < Trigger
@@ -1877,6 +2047,11 @@ class AirplaneModeTrigger < DeviceEventsTrigger
1877
2047
 
1878
2048
  end
1879
2049
 
2050
+ def to_s(colour: false)
2051
+ 'AirplaneModeTrigger ' + @h.inspect
2052
+ end
2053
+
2054
+ alias to_summary to_s
1880
2055
  end
1881
2056
 
1882
2057
  # Category: Device Events
@@ -1893,6 +2068,11 @@ class AutoSyncChangeTrigger < DeviceEventsTrigger
1893
2068
 
1894
2069
  end
1895
2070
 
2071
+ def to_s(colour: false)
2072
+ 'AutoSyncChangeTrigger ' + @h.inspect
2073
+ end
2074
+
2075
+ alias to_summary to_s
1896
2076
  end
1897
2077
 
1898
2078
  # Category: Device Events
@@ -1909,6 +2089,11 @@ class DayDreamTrigger < DeviceEventsTrigger
1909
2089
 
1910
2090
  end
1911
2091
 
2092
+ def to_s(colour: false)
2093
+ 'DayDreamTrigger ' + @h.inspect
2094
+ end
2095
+
2096
+ alias to_summary to_s
1912
2097
  end
1913
2098
 
1914
2099
  # Category: Device Events
@@ -1925,6 +2110,11 @@ class DockTrigger < DeviceEventsTrigger
1925
2110
 
1926
2111
  end
1927
2112
 
2113
+ def to_s(colour: false)
2114
+ 'DockTrigger ' + @h.inspect
2115
+ end
2116
+
2117
+ alias to_summary to_s
1928
2118
  end
1929
2119
 
1930
2120
  # Category: Device Events
@@ -1945,7 +2135,7 @@ class FailedLoginTrigger < DeviceEventsTrigger
1945
2135
  'failed_login?'
1946
2136
  end
1947
2137
 
1948
- def to_s()
2138
+ def to_s(colour: false)
1949
2139
  'Failed Login Attempt'
1950
2140
  end
1951
2141
  end
@@ -1964,6 +2154,11 @@ class GPSEnabledTrigger < DeviceEventsTrigger
1964
2154
 
1965
2155
  end
1966
2156
 
2157
+ def to_s(colour: false)
2158
+ 'GPSEnabledTrigger ' + @h.inspect
2159
+ end
2160
+
2161
+ alias to_summary to_s
1967
2162
  end
1968
2163
 
1969
2164
  # Category: Device Events
@@ -1980,6 +2175,11 @@ class MusicPlayingTrigger < DeviceEventsTrigger
1980
2175
 
1981
2176
  end
1982
2177
 
2178
+ def to_s(colour: false)
2179
+ 'MusicPlayingTrigger ' + @h.inspect
2180
+ end
2181
+
2182
+ alias to_summary to_s
1983
2183
  end
1984
2184
 
1985
2185
 
@@ -1996,9 +2196,11 @@ class DeviceUnlockedTrigger < DeviceEventsTrigger
1996
2196
 
1997
2197
  end
1998
2198
 
1999
- def to_s()
2199
+ def to_s(colour: false)
2000
2200
  'Screen Unlocked'
2001
2201
  end
2202
+
2203
+ alias to_summary to_s
2002
2204
 
2003
2205
  end
2004
2206
 
@@ -2016,6 +2218,11 @@ class AutoRotateChangeTrigger < DeviceEventsTrigger
2016
2218
 
2017
2219
  end
2018
2220
 
2221
+ def to_s(colour: false)
2222
+ 'AutoRotateChangeTrigger ' + @h.inspect
2223
+ end
2224
+
2225
+ alias to_summary to_s
2019
2226
  end
2020
2227
 
2021
2228
  # Category: Device Events
@@ -2033,6 +2240,11 @@ class ClipboardChangeTrigger < DeviceEventsTrigger
2033
2240
 
2034
2241
  end
2035
2242
 
2243
+ def to_s(colour: false)
2244
+ 'ClipboardChangeTrigger ' + @h.inspect
2245
+ end
2246
+
2247
+ alias to_summary to_s
2036
2248
  end
2037
2249
 
2038
2250
  # Category: Device Events
@@ -2048,6 +2260,11 @@ class BootTrigger < DeviceEventsTrigger
2048
2260
 
2049
2261
  end
2050
2262
 
2263
+ def to_s(colour: false)
2264
+ 'BootTrigger ' + @h.inspect
2265
+ end
2266
+
2267
+ alias to_summary to_s
2051
2268
  end
2052
2269
 
2053
2270
  # Category: Device Events
@@ -2068,6 +2285,11 @@ class IntentReceivedTrigger < DeviceEventsTrigger
2068
2285
 
2069
2286
  end
2070
2287
 
2288
+ def to_s(colour: false)
2289
+ 'IntentReceivedTrigger ' + @h.inspect
2290
+ end
2291
+
2292
+ alias to_summary to_s
2071
2293
  end
2072
2294
 
2073
2295
  # Category: Device Events
@@ -2094,6 +2316,11 @@ class NotificationTrigger < DeviceEventsTrigger
2094
2316
 
2095
2317
  end
2096
2318
 
2319
+ def to_s(colour: false)
2320
+ 'NotificationTrigger ' + @h.inspect
2321
+ end
2322
+
2323
+ alias to_summary to_s
2097
2324
  end
2098
2325
 
2099
2326
  # Category: Device Events
@@ -2109,6 +2336,12 @@ class ScreenOnOffTrigger < DeviceEventsTrigger
2109
2336
  super(options.merge h)
2110
2337
 
2111
2338
  end
2339
+
2340
+ def to_s(colour: false)
2341
+ 'Screen ' + (@h[:screen_on] ? 'On' : 'Off')
2342
+ end
2343
+
2344
+ alias to_summary to_s
2112
2345
 
2113
2346
  end
2114
2347
 
@@ -2126,6 +2359,11 @@ class SilentModeTrigger < DeviceEventsTrigger
2126
2359
 
2127
2360
  end
2128
2361
 
2362
+ def to_s(colour: false)
2363
+ 'SilentModeTrigger ' + @h.inspect
2364
+ end
2365
+
2366
+ alias to_summary to_s
2129
2367
  end
2130
2368
 
2131
2369
  # Category: Location
@@ -2151,6 +2389,11 @@ class WeatherTrigger < Trigger
2151
2389
 
2152
2390
  end
2153
2391
 
2392
+ def to_s(colour: false)
2393
+ 'WeatherTrigger ' + @h.inspect
2394
+ end
2395
+
2396
+ alias to_summary to_s
2154
2397
  end
2155
2398
 
2156
2399
  # Category: Location
@@ -2179,7 +2422,7 @@ class GeofenceTrigger < Trigger
2179
2422
 
2180
2423
  end
2181
2424
 
2182
- def to_s()
2425
+ def to_s(colour: false)
2183
2426
 
2184
2427
  if $debug then
2185
2428
  puts ' @geofences: ' + @geofences.inspect
@@ -2214,6 +2457,11 @@ class SunriseSunsetTrigger < Trigger
2214
2457
 
2215
2458
  end
2216
2459
 
2460
+ def to_s(colour: false)
2461
+ 'SunriseSunsetTrigger ' + @h.inspect
2462
+ end
2463
+
2464
+ alias to_summary to_s
2217
2465
  end
2218
2466
 
2219
2467
 
@@ -2243,12 +2491,12 @@ class ActivityRecognitionTrigger < SensorsTrigger
2243
2491
 
2244
2492
  end
2245
2493
 
2246
- def to_s()
2494
+ def to_s(colour: false)
2247
2495
  activity = @activity[@h[:selected_index]]
2248
2496
  'Activity - ' + activity
2249
2497
  end
2250
2498
 
2251
- def to_summary
2499
+ def to_summary(colour: false)
2252
2500
 
2253
2501
  activity = @activity[@h[:selected_index]]
2254
2502
  s = if activity.length > 10 then
@@ -2286,7 +2534,7 @@ class ProximityTrigger < SensorsTrigger
2286
2534
 
2287
2535
  end
2288
2536
 
2289
- def to_s()
2537
+ def to_s(colour: false)
2290
2538
 
2291
2539
  distance = if @h[:near] then
2292
2540
  'Near'
@@ -2316,7 +2564,7 @@ class ShakeDeviceTrigger < SensorsTrigger
2316
2564
  'shake_device?'
2317
2565
  end
2318
2566
 
2319
- def to_s()
2567
+ def to_s(colour: false)
2320
2568
  'Shake Device'
2321
2569
  end
2322
2570
 
@@ -2347,7 +2595,7 @@ class FlipDeviceTrigger < SensorsTrigger
2347
2595
  @h[:face_down] ? 'flip_device_down?' : 'flip_device_up?'
2348
2596
  end
2349
2597
 
2350
- def to_s()
2598
+ def to_s(colour: false)
2351
2599
 
2352
2600
  action = @h[:face_down] ? 'Face Up -> Face Down' : 'Face Down -> Face Up'
2353
2601
  'Flip Device ' + action
@@ -2370,6 +2618,11 @@ class OrientationTrigger < SensorsTrigger
2370
2618
 
2371
2619
  end
2372
2620
 
2621
+ def to_s(colour: false)
2622
+ 'OrientationTrigger ' + @h.inspect
2623
+ end
2624
+
2625
+ alias to_summary to_s
2373
2626
  end
2374
2627
 
2375
2628
  # Category: User Input
@@ -2395,6 +2648,11 @@ class FloatingButtonTrigger < Trigger
2395
2648
 
2396
2649
  end
2397
2650
 
2651
+ def to_s(colour: false)
2652
+ 'FloatingButtonTrigger ' + @h.inspect
2653
+ end
2654
+
2655
+ alias to_summary to_s
2398
2656
  end
2399
2657
 
2400
2658
  # Category: User Input
@@ -2410,6 +2668,11 @@ class ShortcutTrigger < Trigger
2410
2668
 
2411
2669
  end
2412
2670
 
2671
+ def to_s(colour: false)
2672
+ 'ShortcutTrigger ' + @h.inspect
2673
+ end
2674
+
2675
+ alias to_summary to_s
2413
2676
  end
2414
2677
 
2415
2678
  # Category: User Input
@@ -2428,6 +2691,33 @@ class VolumeButtonTrigger < Trigger
2428
2691
  super(options.merge h)
2429
2692
 
2430
2693
  end
2694
+
2695
+ def to_s(colour: false)
2696
+
2697
+ a = [
2698
+ 'Volume Up',
2699
+ 'Volume Down',
2700
+ 'Volume Up - Long Press',
2701
+ 'Volume Down - Long Press'
2702
+ ]
2703
+
2704
+ lines = [a[@h[:option]]]
2705
+ lines << ' ' + (@h[:dont_change_volume] ? 'Retain Previous Volume' : 'Update Volume')
2706
+ @s = lines.join("\n")
2707
+ end
2708
+
2709
+ def to_summary(colour: false)
2710
+ a = [
2711
+ 'Volume Up',
2712
+ 'Volume Down',
2713
+ 'Volume Up - Long Press',
2714
+ 'Volume Down - Long Press'
2715
+ ]
2716
+
2717
+ lines = [a[@h[:option]]]
2718
+ lines << (@h[:dont_change_volume] ? 'Retain Previous Volume' : 'Update Volume')
2719
+ @s = lines.join(": ")
2720
+ end
2431
2721
 
2432
2722
  end
2433
2723
 
@@ -2446,6 +2736,11 @@ class MediaButtonPressedTrigger < Trigger
2446
2736
 
2447
2737
  end
2448
2738
 
2739
+ def to_s(colour: false)
2740
+ 'MediaButtonPressedTrigger ' + @h.inspect
2741
+ end
2742
+
2743
+ alias to_summary to_s
2449
2744
  end
2450
2745
 
2451
2746
  # Category: User Input
@@ -2464,6 +2759,11 @@ class SwipeTrigger < Trigger
2464
2759
 
2465
2760
  end
2466
2761
 
2762
+ def to_s(colour: false)
2763
+ 'SwipeTrigger ' + @h.inspect
2764
+ end
2765
+
2766
+ alias to_summary to_s
2467
2767
  end
2468
2768
 
2469
2769
 
@@ -2487,7 +2787,20 @@ class Action < MacroObject
2487
2787
  def invoke(s='')
2488
2788
  "%s/%s: %s" % [@group, @type, s]
2489
2789
  end
2790
+
2791
+ def to_s(colour: false)
2490
2792
 
2793
+ h = @h.clone
2794
+ h.delete :macro
2795
+ @s ||= "#<%s %s>" % [self.class, h.inspect]
2796
+ operator = @h[:is_or_condition] ? 'OR' : 'AND'
2797
+ constraints = @constraints.map \
2798
+ {|x| x.to_summary(colour: colour)}.join(" %s " % operator)
2799
+
2800
+ @s + constraints
2801
+
2802
+ end
2803
+
2491
2804
  end
2492
2805
 
2493
2806
 
@@ -2522,6 +2835,11 @@ class ShareLocationAction < LocationAction
2522
2835
 
2523
2836
  end
2524
2837
 
2838
+ def to_s(colour: false)
2839
+ 'ShareLocationAction ' + @h.inspect
2840
+ end
2841
+
2842
+ alias to_summary to_s
2525
2843
  end
2526
2844
 
2527
2845
 
@@ -2551,7 +2869,7 @@ class LaunchActivityAction < ApplicationAction
2551
2869
 
2552
2870
  end
2553
2871
 
2554
- def to_s()
2872
+ def to_s(colour: false)
2555
2873
  'Launch ' + @h[:application_name]
2556
2874
  end
2557
2875
 
@@ -2572,6 +2890,11 @@ class KillBackgroundAppAction < ApplicationAction
2572
2890
 
2573
2891
  end
2574
2892
 
2893
+ def to_s(colour: false)
2894
+ 'KillBackgroundAppAction ' + @h.inspect
2895
+ end
2896
+
2897
+ alias to_summary to_s
2575
2898
  end
2576
2899
 
2577
2900
  # Category: Applications
@@ -2594,7 +2917,7 @@ class OpenWebPageAction < ApplicationAction
2594
2917
 
2595
2918
  end
2596
2919
 
2597
- def to_s()
2920
+ def to_s(colour: false)
2598
2921
  "HTTP GET\n url: " + @h[:url_to_open]
2599
2922
  end
2600
2923
 
@@ -2625,7 +2948,12 @@ class UploadPhotoAction < CameraAction
2625
2948
 
2626
2949
  end
2627
2950
 
2628
- end
2951
+ def to_s(colour: false)
2952
+ 'UploadPhotoAction ' + @h.inspect
2953
+ end
2954
+
2955
+ alias to_summary to_s
2956
+ end
2629
2957
 
2630
2958
  # Category: Camera/Photo
2631
2959
  #
@@ -2650,7 +2978,7 @@ class TakePictureAction < CameraAction
2650
2978
  'take_photo :' + camera.to_s
2651
2979
  end
2652
2980
 
2653
- def to_s()
2981
+ def to_s(colour: false)
2654
2982
  'Take Picture'
2655
2983
  end
2656
2984
 
@@ -2669,13 +2997,15 @@ class IfConditionAction < Action
2669
2997
  h2 = options.merge(filter(options,h).merge(macro: macro))
2670
2998
 
2671
2999
  super(h2)
3000
+
3001
+ @label = 'If '
2672
3002
 
2673
3003
  end
2674
3004
 
2675
- def to_s()
3005
+ def to_s(colour: false)
2676
3006
 
2677
- operator = @h[:is_or_condition] ? 'OR' : 'AND'
2678
- 'If ' + @constraints.map(&:to_s).join(" %s " % operator)
3007
+ @s = "If " #+ @constraints.map(&:to_s).join(" %s " % operator)
3008
+ super(colour: colour)
2679
3009
 
2680
3010
  end
2681
3011
  end
@@ -2689,15 +3019,33 @@ class ElseAction < Action
2689
3019
  }
2690
3020
 
2691
3021
  super(options.merge h)
3022
+
2692
3023
 
2693
3024
  end
2694
3025
 
2695
- def to_s()
3026
+ def to_s(colour: false)
2696
3027
  'Else'
2697
3028
  end
2698
3029
 
2699
3030
  end
2700
3031
 
3032
+ class ElseIfConditionAction < IfConditionAction
3033
+
3034
+ def initialize(h={})
3035
+
3036
+ options = {
3037
+ constraint_list: ''
3038
+ }
3039
+
3040
+ super(options.merge h)
3041
+ @label = 'ElseIf '
3042
+
3043
+ end
3044
+
3045
+
3046
+ end
3047
+
3048
+
2701
3049
  class EndIfAction < Action
2702
3050
 
2703
3051
  def initialize(h={})
@@ -2710,7 +3058,7 @@ class EndIfAction < Action
2710
3058
 
2711
3059
  end
2712
3060
 
2713
- def to_s()
3061
+ def to_s(colour: false)
2714
3062
  'End If'
2715
3063
  end
2716
3064
 
@@ -2725,6 +3073,31 @@ class ConnectivityAction < Action
2725
3073
 
2726
3074
  end
2727
3075
 
3076
+ # Category: Connectivity
3077
+ #
3078
+ class SetAirplaneModeAction < ConnectivityAction
3079
+
3080
+ def initialize(h={})
3081
+
3082
+ options = {
3083
+ device_name: '',
3084
+ state: 1
3085
+ }
3086
+
3087
+ super(options.merge h)
3088
+
3089
+ end
3090
+
3091
+ def to_s(colour: false)
3092
+
3093
+ state = ['On', 'Off', 'Toggle'][@h[:state]]
3094
+ @s = 'Airplane Mode ' + state + "\n"
3095
+ super(colour: colour)
3096
+
3097
+ end
3098
+
3099
+ end
3100
+
2728
3101
  # Category: Connectivity
2729
3102
  #
2730
3103
  class SetWifiAction < ConnectivityAction
@@ -2741,7 +3114,7 @@ class SetWifiAction < ConnectivityAction
2741
3114
 
2742
3115
  end
2743
3116
 
2744
- def to_s()
3117
+ def to_s(colour: false)
2745
3118
  action = @h[:state] == 0 ? 'Enable' : 'Disable'
2746
3119
  action + ' Wifi'
2747
3120
  end
@@ -2763,6 +3136,11 @@ class SetBluetoothAction < ConnectivityAction
2763
3136
 
2764
3137
  end
2765
3138
 
3139
+ def to_s(colour: false)
3140
+ 'SetBluetoothAction ' + @h.inspect
3141
+ end
3142
+
3143
+ alias to_summary to_s
2766
3144
  end
2767
3145
 
2768
3146
  # Category: Connectivity
@@ -2780,6 +3158,11 @@ class SetBluetoothAction < ConnectivityAction
2780
3158
 
2781
3159
  end
2782
3160
 
3161
+ def to_s(colour: false)
3162
+ 'SetBluetoothAction ' + @h.inspect
3163
+ end
3164
+
3165
+ alias to_summary to_s
2783
3166
  end
2784
3167
 
2785
3168
  class SetHotspotAction < ConnectivityAction
@@ -2795,7 +3178,7 @@ class SetHotspotAction < ConnectivityAction
2795
3178
 
2796
3179
  end
2797
3180
 
2798
- def to_s()
3181
+ def to_s(colour: false)
2799
3182
  action = @h[:turn_wifi_on] ? 'Enable' : 'Disable'
2800
3183
  action + ' HotSpot'
2801
3184
  end
@@ -2827,6 +3210,11 @@ class SendIntentAction < ConnectivityAction
2827
3210
 
2828
3211
  end
2829
3212
 
3213
+ def to_s(colour: false)
3214
+ 'SendIntentAction ' + @h.inspect
3215
+ end
3216
+
3217
+ alias to_summary to_s
2830
3218
  end
2831
3219
 
2832
3220
 
@@ -2862,6 +3250,11 @@ class SetAlarmClockAction < DateTimeAction
2862
3250
 
2863
3251
  end
2864
3252
 
3253
+ def to_s(colour: false)
3254
+ 'SetAlarmClockAction ' + @h.inspect
3255
+ end
3256
+
3257
+ alias to_summary to_s
2865
3258
  end
2866
3259
 
2867
3260
  # Category: Date/Time
@@ -2879,6 +3272,11 @@ class StopWatchAction < DateTimeAction
2879
3272
 
2880
3273
  end
2881
3274
 
3275
+ def to_s(colour: false)
3276
+ 'StopWatchAction ' + @h.inspect
3277
+ end
3278
+
3279
+ alias to_summary to_s
2882
3280
  end
2883
3281
 
2884
3282
  # Category: Date/Time
@@ -2905,7 +3303,7 @@ class SayTimeAction < DateTimeAction
2905
3303
  'say current_time()'
2906
3304
  end
2907
3305
 
2908
- def to_s()
3306
+ def to_s(colour: false)
2909
3307
  'Say Current Time'
2910
3308
  end
2911
3309
 
@@ -2935,6 +3333,11 @@ class AndroidShortcutsAction < DeviceAction
2935
3333
 
2936
3334
  end
2937
3335
 
3336
+ def to_s(colour: false)
3337
+ 'AndroidShortcutsAction ' + @h.inspect
3338
+ end
3339
+
3340
+ alias to_summary to_s
2938
3341
  end
2939
3342
 
2940
3343
  # Category: Device Actions
@@ -2951,6 +3354,11 @@ class ClipboardAction < DeviceAction
2951
3354
 
2952
3355
  end
2953
3356
 
3357
+ def to_s(colour: false)
3358
+ 'ClipboardAction ' + @h.inspect
3359
+ end
3360
+
3361
+ alias to_summary to_s
2954
3362
  end
2955
3363
 
2956
3364
  # Category: Device Actions
@@ -2966,6 +3374,11 @@ class PressBackAction < DeviceAction
2966
3374
 
2967
3375
  end
2968
3376
 
3377
+ def to_s(colour: false)
3378
+ 'PressBackAction ' + @h.inspect
3379
+ end
3380
+
3381
+ alias to_summary to_s
2969
3382
  end
2970
3383
 
2971
3384
  # Category: Device Actions
@@ -2989,7 +3402,7 @@ class SpeakTextAction < DeviceAction
2989
3402
 
2990
3403
  end
2991
3404
 
2992
- def to_s()
3405
+ def to_s(colour: false)
2993
3406
  "Speak Text (%s)" % @h[:text_to_say]
2994
3407
  end
2995
3408
 
@@ -3010,6 +3423,11 @@ class UIInteractionAction < DeviceAction
3010
3423
 
3011
3424
  end
3012
3425
 
3426
+ def to_s(colour: false)
3427
+ 'UIInteractionAction ' + @h.inspect
3428
+ end
3429
+
3430
+ alias to_summary to_s
3013
3431
  end
3014
3432
 
3015
3433
  # Category: Device Actions
@@ -3025,6 +3443,11 @@ class VoiceSearchAction < DeviceAction
3025
3443
 
3026
3444
  end
3027
3445
 
3446
+ def to_s(colour: false)
3447
+ 'VoiceSearchAction ' + @h.inspect
3448
+ end
3449
+
3450
+ alias to_summary to_s
3028
3451
  end
3029
3452
 
3030
3453
 
@@ -3051,6 +3474,11 @@ class ExpandCollapseStatusBarAction < DeviceSettingsAction
3051
3474
 
3052
3475
  end
3053
3476
 
3477
+ def to_s(colour: false)
3478
+ 'ExpandCollapseStatusBarAction ' + @h.inspect
3479
+ end
3480
+
3481
+ alias to_summary to_s
3054
3482
  end
3055
3483
 
3056
3484
  # Category: Device Settings
@@ -3066,6 +3494,11 @@ class LaunchHomeScreenAction < DeviceSettingsAction
3066
3494
 
3067
3495
  end
3068
3496
 
3497
+ def to_s(colour: false)
3498
+ 'LaunchHomeScreenAction ' + @h.inspect
3499
+ end
3500
+
3501
+ alias to_summary to_s
3069
3502
  end
3070
3503
 
3071
3504
  # Category: Device Settings
@@ -3084,11 +3517,11 @@ class CameraFlashLightAction < DeviceSettingsAction
3084
3517
  end
3085
3518
 
3086
3519
  def to_pc()
3087
- 'torch :on'
3520
+ ['torch :on', 'torch :off', 'torch :toggle'][@h[:state]]
3088
3521
  end
3089
3522
 
3090
- def to_s()
3091
- 'Torch On'
3523
+ def to_s(colour: false)
3524
+ ['Torch On', 'Torch Off', 'Torch Toggle'][@h[:state]]
3092
3525
  end
3093
3526
 
3094
3527
  end
@@ -3107,7 +3540,7 @@ class VibrateAction < DeviceSettingsAction
3107
3540
 
3108
3541
  end
3109
3542
 
3110
- def to_s()
3543
+ def to_s(colour: false)
3111
3544
 
3112
3545
  pattern = [
3113
3546
  'Blip', 'Short Buzz', 'Long Buzz', 'Rapid', 'Slow', 'Increasing',
@@ -3134,6 +3567,11 @@ class SetAutoRotateAction < DeviceSettingsAction
3134
3567
 
3135
3568
  end
3136
3569
 
3570
+ def to_s(colour: false)
3571
+ 'SetAutoRotateAction ' + @h.inspect
3572
+ end
3573
+
3574
+ alias to_summary to_s
3137
3575
  end
3138
3576
 
3139
3577
  # Category: Device Settings
@@ -3149,6 +3587,11 @@ class DayDreamAction < DeviceSettingsAction
3149
3587
 
3150
3588
  end
3151
3589
 
3590
+ def to_s(colour: false)
3591
+ 'DayDreamAction ' + @h.inspect
3592
+ end
3593
+
3594
+ alias to_summary to_s
3152
3595
  end
3153
3596
 
3154
3597
  # Category: Device Settings
@@ -3164,6 +3607,11 @@ class SetKeyboardAction < DeviceSettingsAction
3164
3607
 
3165
3608
  end
3166
3609
 
3610
+ def to_s(colour: false)
3611
+ 'SetKeyboardAction ' + @h.inspect
3612
+ end
3613
+
3614
+ alias to_summary to_s
3167
3615
  end
3168
3616
 
3169
3617
  # Category: Device Settings
@@ -3180,6 +3628,11 @@ class SetKeyguardAction < DeviceSettingsAction
3180
3628
 
3181
3629
  end
3182
3630
 
3631
+ def to_s(colour: false)
3632
+ 'SetKeyguardAction ' + @h.inspect
3633
+ end
3634
+
3635
+ alias to_summary to_s
3183
3636
  end
3184
3637
 
3185
3638
  # Category: Device Settings
@@ -3196,6 +3649,11 @@ class CarModeAction < DeviceSettingsAction
3196
3649
 
3197
3650
  end
3198
3651
 
3652
+ def to_s(colour: false)
3653
+ 'CarModeAction ' + @h.inspect
3654
+ end
3655
+
3656
+ alias to_summary to_s
3199
3657
  end
3200
3658
 
3201
3659
  # Category: Device Settings
@@ -3213,6 +3671,11 @@ class ChangeKeyboardAction < DeviceSettingsAction
3213
3671
 
3214
3672
  end
3215
3673
 
3674
+ def to_s(colour: false)
3675
+ 'ChangeKeyboardAction ' + @h.inspect
3676
+ end
3677
+
3678
+ alias to_summary to_s
3216
3679
  end
3217
3680
 
3218
3681
  # Category: Device Settings
@@ -3234,6 +3697,11 @@ class SetWallpaperAction < DeviceSettingsAction
3234
3697
 
3235
3698
  end
3236
3699
 
3700
+ def to_s(colour: false)
3701
+ 'SetWallpaperAction ' + @h.inspect
3702
+ end
3703
+
3704
+ alias to_summary to_s
3237
3705
  end
3238
3706
 
3239
3707
  class FileAction < Action
@@ -3262,6 +3730,11 @@ class OpenFileAction < FileAction
3262
3730
 
3263
3731
  end
3264
3732
 
3733
+ def to_s(colour: false)
3734
+ 'OpenFileAction ' + @h.inspect
3735
+ end
3736
+
3737
+ alias to_summary to_s
3265
3738
  end
3266
3739
 
3267
3740
 
@@ -3287,6 +3760,11 @@ class ForceLocationUpdateAction < LocationAction
3287
3760
 
3288
3761
  end
3289
3762
 
3763
+ def to_s(colour: false)
3764
+ 'ForceLocationUpdateAction ' + @h.inspect
3765
+ end
3766
+
3767
+ alias to_summary to_s
3290
3768
  end
3291
3769
 
3292
3770
  # Category: Location
@@ -3307,6 +3785,11 @@ class ShareLocationAction < LocationAction
3307
3785
 
3308
3786
  end
3309
3787
 
3788
+ def to_s(colour: false)
3789
+ 'ShareLocationAction ' + @h.inspect
3790
+ end
3791
+
3792
+ alias to_summary to_s
3310
3793
  end
3311
3794
 
3312
3795
  # Category: Location
@@ -3324,6 +3807,11 @@ class SetLocationUpdateRateAction < LocationAction
3324
3807
 
3325
3808
  end
3326
3809
 
3810
+ def to_s(colour: false)
3811
+ 'SetLocationUpdateRateAction ' + @h.inspect
3812
+ end
3813
+
3814
+ alias to_summary to_s
3327
3815
  end
3328
3816
 
3329
3817
  class LoggingAction < Action
@@ -3362,6 +3850,11 @@ class AddCalendarEntryAction < LoggingAction
3362
3850
 
3363
3851
  end
3364
3852
 
3853
+ def to_s(colour: false)
3854
+ 'AddCalendarEntryAction ' + @h.inspect
3855
+ end
3856
+
3857
+ alias to_summary to_s
3365
3858
  end
3366
3859
 
3367
3860
  # Category: Logging
@@ -3379,6 +3872,11 @@ class LogAction < LoggingAction
3379
3872
 
3380
3873
  end
3381
3874
 
3875
+ def to_s(colour: false)
3876
+ 'LogAction ' + @h.inspect
3877
+ end
3878
+
3879
+ alias to_summary to_s
3382
3880
  end
3383
3881
 
3384
3882
  # Category: Logging
@@ -3395,6 +3893,11 @@ class ClearLogAction < LoggingAction
3395
3893
 
3396
3894
  end
3397
3895
 
3896
+ def to_s(colour: false)
3897
+ 'ClearLogAction ' + @h.inspect
3898
+ end
3899
+
3900
+ alias to_summary to_s
3398
3901
  end
3399
3902
 
3400
3903
  class PauseAction < Action
@@ -3408,7 +3911,7 @@ class PauseAction < Action
3408
3911
 
3409
3912
  end
3410
3913
 
3411
- def to_s()
3914
+ def to_s(colour: false)
3412
3915
 
3413
3916
  su = Subunit.new(units={minutes:60, hours:60},
3414
3917
  seconds: @h[:delay_in_seconds])
@@ -3452,6 +3955,11 @@ class RecordMicrophoneAction < MediaAction
3452
3955
 
3453
3956
  end
3454
3957
 
3958
+ def to_s(colour: false)
3959
+ 'RecordMicrophoneAction ' + @h.inspect
3960
+ end
3961
+
3962
+ alias to_summary to_s
3455
3963
  end
3456
3964
 
3457
3965
  # Category: Media
@@ -3469,7 +3977,7 @@ class PlaySoundAction < MediaAction
3469
3977
 
3470
3978
  end
3471
3979
 
3472
- def to_s()
3980
+ def to_s(colour: false)
3473
3981
  'Play: ' + @h[:file_path]
3474
3982
  end
3475
3983
 
@@ -3505,6 +4013,11 @@ class SendEmailAction < MessagingAction
3505
4013
 
3506
4014
  end
3507
4015
 
4016
+ def to_s(colour: false)
4017
+ 'SendEmailAction ' + @h.inspect
4018
+ end
4019
+
4020
+ alias to_summary to_s
3508
4021
  end
3509
4022
 
3510
4023
  # Category: Messaging
@@ -3526,6 +4039,11 @@ class SendSMSAction < MessagingAction
3526
4039
 
3527
4040
  end
3528
4041
 
4042
+ def to_s(colour: false)
4043
+ 'SendSMSAction ' + @h.inspect
4044
+ end
4045
+
4046
+ alias to_summary to_s
3529
4047
  end
3530
4048
 
3531
4049
  # Category: Messaging
@@ -3544,6 +4062,11 @@ class UDPCommandAction < MessagingAction
3544
4062
 
3545
4063
  end
3546
4064
 
4065
+ def to_s(colour: false)
4066
+ 'UDPCommandAction ' + @h.inspect
4067
+ end
4068
+
4069
+ alias to_summary to_s
3547
4070
  end
3548
4071
 
3549
4072
 
@@ -3578,6 +4101,11 @@ class ClearNotificationsAction < NotificationsAction
3578
4101
 
3579
4102
  end
3580
4103
 
4104
+ def to_s(colour: false)
4105
+ 'ClearNotificationsAction ' + @h.inspect
4106
+ end
4107
+
4108
+ alias to_summary to_s
3581
4109
  end
3582
4110
 
3583
4111
  # Category: Notifications
@@ -3604,6 +4132,10 @@ class MessageDialogAction < NotificationsAction
3604
4132
  super(options.merge h)
3605
4133
 
3606
4134
  end
4135
+
4136
+ def to_s(colour: false)
4137
+ 'Display Dialog' + "\n Battery at: [battery]"
4138
+ end
3607
4139
 
3608
4140
  end
3609
4141
 
@@ -3621,6 +4153,11 @@ class AllowLEDNotificationLightAction < NotificationsAction
3621
4153
 
3622
4154
  end
3623
4155
 
4156
+ def to_s(colour: false)
4157
+ 'AllowLEDNotificationLightAction ' + @h.inspect
4158
+ end
4159
+
4160
+ alias to_summary to_s
3624
4161
  end
3625
4162
 
3626
4163
  # Category: Notifications
@@ -3637,6 +4174,11 @@ class SetNotificationSoundAction < NotificationsAction
3637
4174
 
3638
4175
  end
3639
4176
 
4177
+ def to_s(colour: false)
4178
+ 'SetNotificationSoundAction ' + @h.inspect
4179
+ end
4180
+
4181
+ alias to_summary to_s
3640
4182
  end
3641
4183
 
3642
4184
  # Category: Notifications
@@ -3653,6 +4195,11 @@ class SetNotificationSoundAction < NotificationsAction
3653
4195
 
3654
4196
  end
3655
4197
 
4198
+ def to_s(colour: false)
4199
+ 'SetNotificationSoundAction ' + @h.inspect
4200
+ end
4201
+
4202
+ alias to_summary to_s
3656
4203
  end
3657
4204
 
3658
4205
  # Category: Notifications
@@ -3669,6 +4216,11 @@ class SetNotificationSoundAction < NotificationsAction
3669
4216
 
3670
4217
  end
3671
4218
 
4219
+ def to_s(colour: false)
4220
+ 'SetNotificationSoundAction ' + @h.inspect
4221
+ end
4222
+
4223
+ alias to_summary to_s
3672
4224
  end
3673
4225
 
3674
4226
  # Category: Notifications
@@ -3698,7 +4250,7 @@ class NotificationAction < NotificationsAction
3698
4250
 
3699
4251
  end
3700
4252
 
3701
- def to_s()
4253
+ def to_s(colour: false)
3702
4254
  'Display Notification: ' + "%s: %s" % [@h[:notification_subject], @h[:notification_text]]
3703
4255
  end
3704
4256
 
@@ -3738,7 +4290,7 @@ class ToastAction < NotificationsAction
3738
4290
  "popup_message '%s'" % @h[:message_text]
3739
4291
  end
3740
4292
 
3741
- def to_s()
4293
+ def to_s(colour: false)
3742
4294
  "Popup Message '%s'" % @h[:message_text]
3743
4295
  end
3744
4296
 
@@ -3767,7 +4319,11 @@ class AnswerCallAction < PhoneAction
3767
4319
  super(options.merge h)
3768
4320
 
3769
4321
  end
3770
-
4322
+
4323
+ def to_s(colour: false)
4324
+ @s = 'Answer Call' + "\n "
4325
+ super()
4326
+ end
3771
4327
  end
3772
4328
 
3773
4329
  # Category: Phone
@@ -3786,6 +4342,11 @@ class ClearCallLogAction < PhoneAction
3786
4342
 
3787
4343
  end
3788
4344
 
4345
+ def to_s(colour: false)
4346
+ 'ClearCallLogAction ' + @h.inspect
4347
+ end
4348
+
4349
+ alias to_summary to_s
3789
4350
  end
3790
4351
 
3791
4352
  # Category: Phone
@@ -3801,6 +4362,11 @@ class OpenCallLogAction < PhoneAction
3801
4362
 
3802
4363
  end
3803
4364
 
4365
+ def to_s(colour: false)
4366
+ 'OpenCallLogAction ' + @h.inspect
4367
+ end
4368
+
4369
+ alias to_summary to_s
3804
4370
  end
3805
4371
 
3806
4372
  # Category: Phone
@@ -3815,6 +4381,11 @@ class RejectCallAction < PhoneAction
3815
4381
  super(options.merge h)
3816
4382
 
3817
4383
  end
4384
+
4385
+ def to_s(colour: false)
4386
+ @s = 'Call Reject' + "\n "
4387
+ super()
4388
+ end
3818
4389
 
3819
4390
  end
3820
4391
 
@@ -3833,6 +4404,11 @@ class MakeCallAction < PhoneAction
3833
4404
 
3834
4405
  end
3835
4406
 
4407
+ def to_s(colour: false)
4408
+ 'MakeCallAction ' + @h.inspect
4409
+ end
4410
+
4411
+ alias to_summary to_s
3836
4412
  end
3837
4413
 
3838
4414
 
@@ -3850,6 +4426,11 @@ class SetRingtoneAction < PhoneAction
3850
4426
 
3851
4427
  end
3852
4428
 
4429
+ def to_s(colour: false)
4430
+ 'SetRingtoneAction ' + @h.inspect
4431
+ end
4432
+
4433
+ alias to_summary to_s
3853
4434
  end
3854
4435
 
3855
4436
  class ScreenAction < Action
@@ -3877,6 +4458,11 @@ class SetBrightnessAction < ScreenAction
3877
4458
 
3878
4459
  end
3879
4460
 
4461
+ def to_s(colour: false)
4462
+ 'SetBrightnessAction ' + @h.inspect
4463
+ end
4464
+
4465
+ alias to_summary to_s
3880
4466
  end
3881
4467
 
3882
4468
  # Category: Screen
@@ -3893,6 +4479,11 @@ class ForceScreenRotationAction < ScreenAction
3893
4479
 
3894
4480
  end
3895
4481
 
4482
+ def to_s(colour: false)
4483
+ 'ForceScreenRotationAction ' + @h.inspect
4484
+ end
4485
+
4486
+ alias to_summary to_s
3896
4487
  end
3897
4488
 
3898
4489
  # Category: Screen
@@ -3912,6 +4503,11 @@ class ScreenOnAction < ScreenAction
3912
4503
 
3913
4504
  end
3914
4505
 
4506
+ def to_s(colour: false)
4507
+ 'ScreenOnAction ' + @h.inspect
4508
+ end
4509
+
4510
+ alias to_summary to_s
3915
4511
  end
3916
4512
 
3917
4513
  # Category: Screen
@@ -3929,6 +4525,11 @@ class DimScreenAction < ScreenAction
3929
4525
 
3930
4526
  end
3931
4527
 
4528
+ def to_s(colour: false)
4529
+ 'DimScreenAction ' + @h.inspect
4530
+ end
4531
+
4532
+ alias to_summary to_s
3932
4533
  end
3933
4534
 
3934
4535
  # Category: Screen
@@ -3952,7 +4553,7 @@ class KeepAwakeAction < ScreenAction
3952
4553
 
3953
4554
  end
3954
4555
 
3955
- def to_s()
4556
+ def to_s(colour: false)
3956
4557
 
3957
4558
  screen = @h[:screen_option] == 0 ? 'Screen On' : 'Screen Off'
3958
4559
 
@@ -3993,6 +4594,11 @@ class SetScreenTimeoutAction < ScreenAction
3993
4594
 
3994
4595
  end
3995
4596
 
4597
+ def to_s(colour: false)
4598
+ 'SetScreenTimeoutAction ' + @h.inspect
4599
+ end
4600
+
4601
+ alias to_summary to_s
3996
4602
  end
3997
4603
 
3998
4604
 
@@ -4019,6 +4625,11 @@ class SilentModeVibrateOffAction < VolumeAction
4019
4625
 
4020
4626
  end
4021
4627
 
4628
+ def to_s(colour: false)
4629
+ 'SilentModeVibrateOffAction ' + @h.inspect
4630
+ end
4631
+
4632
+ alias to_summary to_s
4022
4633
  end
4023
4634
 
4024
4635
  # Category: Volume
@@ -4036,6 +4647,27 @@ class SetVibrateAction < VolumeAction
4036
4647
 
4037
4648
  end
4038
4649
 
4650
+ def to_s(colour: false)
4651
+
4652
+ a = [
4653
+ 'Silent (Vibrate On)',
4654
+ 'Normal (Vibrate Off)',
4655
+ 'Vibrate when ringing On',
4656
+ 'Vibrate when ringing Off',
4657
+ 'Vibrate when ringing Toggle'
4658
+ ]
4659
+
4660
+ status = a[@h[:option_int]]
4661
+ @s = 'Vibrate Enable/Disable ' + "\n " + status + "\n "
4662
+ super()
4663
+
4664
+ end
4665
+
4666
+ def to_summary(colour: false)
4667
+
4668
+ @s = 'Vibrate Enable/Disable'
4669
+
4670
+ end
4039
4671
  end
4040
4672
 
4041
4673
  # Category: Volume
@@ -4052,6 +4684,11 @@ class VolumeIncrementDecrementAction < VolumeAction
4052
4684
 
4053
4685
  end
4054
4686
 
4687
+ def to_s(colour: false)
4688
+ 'VolumeIncrementDecrementAction ' + @h.inspect
4689
+ end
4690
+
4691
+ alias to_summary to_s
4055
4692
  end
4056
4693
 
4057
4694
  # Category: Volume
@@ -4069,6 +4706,11 @@ class SpeakerPhoneAction < VolumeAction
4069
4706
 
4070
4707
  end
4071
4708
 
4709
+ def to_s(colour: false)
4710
+ 'SpeakerPhoneAction ' + @h.inspect
4711
+ end
4712
+
4713
+ alias to_summary to_s
4072
4714
  end
4073
4715
 
4074
4716
  # Category: Volume
@@ -4089,7 +4731,7 @@ class SetVolumeAction < VolumeAction
4089
4731
 
4090
4732
  end
4091
4733
 
4092
- def to_s()
4734
+ def to_s(colour: false)
4093
4735
  volume = @h[:stream_index_array].zip(@h[:stream_volume_array]).to_h[true]
4094
4736
  'Volume Change ' + "Notification = %s%%" % volume
4095
4737
  end
@@ -4105,7 +4747,7 @@ class Constraint < MacroObject
4105
4747
 
4106
4748
  detail.select {|k,v| @h.include? k }.all? {|key,value| @h[key] == value}
4107
4749
 
4108
- end
4750
+ end
4109
4751
 
4110
4752
  #def to_s()
4111
4753
  # ''
@@ -4127,22 +4769,7 @@ class Constraint < MacroObject
4127
4769
 
4128
4770
  end
4129
4771
 
4130
- class TimeOfDayConstraint < Constraint
4131
4772
 
4132
- def initialize(h={})
4133
-
4134
- options = {
4135
- end_hour: 8,
4136
- end_minute: 0,
4137
- start_hour: 22,
4138
- start_minute: 0
4139
- }
4140
-
4141
- super(options.merge h)
4142
-
4143
- end
4144
-
4145
- end
4146
4773
 
4147
4774
  # Category: Battery/Power
4148
4775
  #
@@ -4160,7 +4787,7 @@ class BatteryLevelConstraint < Constraint
4160
4787
 
4161
4788
  end
4162
4789
 
4163
- def to_s()
4790
+ def to_s(colour: false)
4164
4791
 
4165
4792
  operator = if @h[:greater_than] then
4166
4793
  '>'
@@ -4174,6 +4801,8 @@ class BatteryLevelConstraint < Constraint
4174
4801
 
4175
4802
  "Battery %s %s%%" % [operator, level]
4176
4803
  end
4804
+
4805
+ alias to_summary to_s
4177
4806
 
4178
4807
  end
4179
4808
 
@@ -4191,6 +4820,11 @@ class BatterySaverStateConstraint < Constraint
4191
4820
 
4192
4821
  end
4193
4822
 
4823
+ def to_s(colour: false)
4824
+ 'BatterySaverStateConstraint ' + @h.inspect
4825
+ end
4826
+
4827
+ alias to_summary to_s
4194
4828
  end
4195
4829
 
4196
4830
  # Category: Battery/Power
@@ -4209,6 +4843,11 @@ class BatteryTemperatureConstraint < Constraint
4209
4843
 
4210
4844
  end
4211
4845
 
4846
+ def to_s(colour: false)
4847
+ 'BatteryTemperatureConstraint ' + @h.inspect
4848
+ end
4849
+
4850
+ alias to_summary to_s
4212
4851
  end
4213
4852
 
4214
4853
  # Category: Battery/Power
@@ -4226,7 +4865,7 @@ class ExternalPowerConstraint < Constraint
4226
4865
 
4227
4866
  end
4228
4867
 
4229
- def to_s()
4868
+ def to_s(colour: false)
4230
4869
  connection = @h[:external_power] ? 'Connected' : 'Disconnected'
4231
4870
  'Power ' + connection
4232
4871
  end
@@ -4249,11 +4888,12 @@ class BluetoothConstraint < Constraint
4249
4888
 
4250
4889
  end
4251
4890
 
4252
- def to_s()
4891
+ def to_s(colour: false)
4253
4892
  device = @h[:device_name] #== 'Any Device' ? 'Any' : @h[:device_name]
4254
4893
  "Device Connected (%s)" % device
4255
4894
  end
4256
4895
 
4896
+ alias to_summary to_s
4257
4897
 
4258
4898
  end
4259
4899
 
@@ -4271,6 +4911,11 @@ class GPSEnabledConstraint < Constraint
4271
4911
 
4272
4912
  end
4273
4913
 
4914
+ def to_s(colour: false)
4915
+ 'GPSEnabledConstraint ' + @h.inspect
4916
+ end
4917
+
4918
+ alias to_summary to_s
4274
4919
  end
4275
4920
 
4276
4921
  # Category: Connectivity
@@ -4287,6 +4932,11 @@ class LocationModeConstraint < Constraint
4287
4932
 
4288
4933
  end
4289
4934
 
4935
+ def to_s(colour: false)
4936
+ 'LocationModeConstraint ' + @h.inspect
4937
+ end
4938
+
4939
+ alias to_summary to_s
4290
4940
  end
4291
4941
 
4292
4942
  # Category: Connectivity
@@ -4303,6 +4953,11 @@ class SignalOnOffConstraint < Constraint
4303
4953
 
4304
4954
  end
4305
4955
 
4956
+ def to_s(colour: false)
4957
+ 'SignalOnOffConstraint ' + @h.inspect
4958
+ end
4959
+
4960
+ alias to_summary to_s
4306
4961
  end
4307
4962
 
4308
4963
  # Category: Connectivity
@@ -4320,6 +4975,11 @@ class WifiConstraint < Constraint
4320
4975
 
4321
4976
  end
4322
4977
 
4978
+ def to_s(colour: false)
4979
+ 'WifiConstraint ' + @h.inspect
4980
+ end
4981
+
4982
+ alias to_summary to_s
4323
4983
  end
4324
4984
 
4325
4985
  # Category: Connectivity
@@ -4338,6 +4998,11 @@ class CellTowerConstraint < Constraint
4338
4998
 
4339
4999
  end
4340
5000
 
5001
+ def to_s(colour: false)
5002
+ 'CellTowerConstraint ' + @h.inspect
5003
+ end
5004
+
5005
+ alias to_summary to_s
4341
5006
  end
4342
5007
 
4343
5008
  # Category: Connectivity
@@ -4354,6 +5019,11 @@ class IsRoamingConstraint < Constraint
4354
5019
 
4355
5020
  end
4356
5021
 
5022
+ def to_s(colour: false)
5023
+ 'IsRoamingConstraint ' + @h.inspect
5024
+ end
5025
+
5026
+ alias to_summary to_s
4357
5027
  end
4358
5028
 
4359
5029
  # Category: Connectivity
@@ -4370,6 +5040,11 @@ class DataOnOffConstraint < Constraint
4370
5040
 
4371
5041
  end
4372
5042
 
5043
+ def to_s(colour: false)
5044
+ 'DataOnOffConstraint ' + @h.inspect
5045
+ end
5046
+
5047
+ alias to_summary to_s
4373
5048
  end
4374
5049
 
4375
5050
  # Category: Connectivity
@@ -4389,6 +5064,11 @@ class WifiHotSpotConstraint < Constraint
4389
5064
 
4390
5065
  end
4391
5066
 
5067
+ def to_s(colour: false)
5068
+ 'WifiHotSpotConstraint ' + @h.inspect
5069
+ end
5070
+
5071
+ alias to_summary to_s
4392
5072
  end
4393
5073
 
4394
5074
  # Category: Date/Time
@@ -4412,6 +5092,11 @@ class CalendarConstraint < Constraint
4412
5092
 
4413
5093
  end
4414
5094
 
5095
+ def to_s(colour: false)
5096
+ 'CalendarConstraint ' + @h.inspect
5097
+ end
5098
+
5099
+ alias to_summary to_s
4415
5100
  end
4416
5101
 
4417
5102
  # Category: Date/Time
@@ -4428,6 +5113,11 @@ class DayOfWeekConstraint < Constraint
4428
5113
 
4429
5114
  end
4430
5115
 
5116
+ def to_s(colour: false)
5117
+ 'DayOfWeekConstraint ' + @h.inspect
5118
+ end
5119
+
5120
+ alias to_summary to_s
4431
5121
  end
4432
5122
 
4433
5123
  # Category: Date/Time
@@ -4437,16 +5127,22 @@ class TimeOfDayConstraint < Constraint
4437
5127
  def initialize(h={})
4438
5128
 
4439
5129
  options = {
4440
- end_hour: 1,
4441
- end_minute: 1,
4442
- start_hour: 21,
4443
- start_minute: 58
5130
+ end_hour: 8,
5131
+ end_minute: 0,
5132
+ start_hour: 22,
5133
+ start_minute: 0
4444
5134
  }
4445
5135
 
4446
5136
  super(options.merge h)
4447
5137
 
4448
5138
  end
4449
-
5139
+
5140
+ def to_s(colour: false)
5141
+ a = @h[:start_hour], @h[:start_minute], @h[:end_hour], @h[:start_minute]
5142
+ 'Time of Day ' + "%02d:%02d - %02d:%02d" % a
5143
+ end
5144
+
5145
+ alias to_summary to_s
4450
5146
  end
4451
5147
 
4452
5148
  # Category: Date/Time
@@ -4464,6 +5160,11 @@ class DayOfMonthConstraint < Constraint
4464
5160
 
4465
5161
  end
4466
5162
 
5163
+ def to_s(colour: false)
5164
+ 'DayOfMonthConstraint ' + @h.inspect
5165
+ end
5166
+
5167
+ alias to_summary to_s
4467
5168
  end
4468
5169
 
4469
5170
  # Category: Date/Time
@@ -4480,6 +5181,11 @@ class MonthOfYearConstraint < Constraint
4480
5181
 
4481
5182
  end
4482
5183
 
5184
+ def to_s(colour: false)
5185
+ 'MonthOfYearConstraint ' + @h.inspect
5186
+ end
5187
+
5188
+ alias to_summary to_s
4483
5189
  end
4484
5190
 
4485
5191
  # Category: Date/Time
@@ -4496,6 +5202,11 @@ class SunsetSunriseConstraint < Constraint
4496
5202
 
4497
5203
  end
4498
5204
 
5205
+ def to_s(colour: false)
5206
+ 'SunsetSunriseConstraint ' + @h.inspect
5207
+ end
5208
+
5209
+ alias to_summary to_s
4499
5210
  end
4500
5211
 
4501
5212
  # Category: Device State
@@ -4540,12 +5251,14 @@ class AirplaneModeConstraint < Constraint
4540
5251
  'airplane_mode.' + status
4541
5252
  end
4542
5253
 
4543
- def to_s()
5254
+ def to_s(colour: false)
4544
5255
 
4545
5256
  status = @h[:enabled] ? 'Enabled' : 'Disabled'
4546
5257
  'Airplane Mode ' + status
4547
5258
 
4548
5259
  end
5260
+
5261
+ alias to_summary to_s
4549
5262
 
4550
5263
  end
4551
5264
 
@@ -4563,6 +5276,11 @@ class AutoRotateConstraint < Constraint
4563
5276
 
4564
5277
  end
4565
5278
 
5279
+ def to_s(colour: false)
5280
+ 'AutoRotateConstraint ' + @h.inspect
5281
+ end
5282
+
5283
+ alias to_summary to_s
4566
5284
  end
4567
5285
 
4568
5286
  # Category: Device State
@@ -4579,9 +5297,11 @@ class DeviceLockedConstraint < Constraint
4579
5297
 
4580
5298
  end
4581
5299
 
4582
- def to_s()
5300
+ def to_s(colour: false)
4583
5301
  'Device ' + (@h[:locked] ? 'Locked' : 'Unlocked')
4584
5302
  end
5303
+
5304
+ alias to_summary to_s
4585
5305
 
4586
5306
  end
4587
5307
 
@@ -4599,6 +5319,11 @@ class RoamingOnOffConstraint < Constraint
4599
5319
 
4600
5320
  end
4601
5321
 
5322
+ def to_s(colour: false)
5323
+ 'RoamingOnOffConstraint ' + @h.inspect
5324
+ end
5325
+
5326
+ alias to_summary to_s
4602
5327
  end
4603
5328
 
4604
5329
  # Category: Device State
@@ -4616,6 +5341,11 @@ class TimeSinceBootConstraint < Constraint
4616
5341
 
4617
5342
  end
4618
5343
 
5344
+ def to_s(colour: false)
5345
+ 'TimeSinceBootConstraint ' + @h.inspect
5346
+ end
5347
+
5348
+ alias to_summary to_s
4619
5349
  end
4620
5350
 
4621
5351
  # Category: Device State
@@ -4632,6 +5362,11 @@ class AutoSyncConstraint < Constraint
4632
5362
 
4633
5363
  end
4634
5364
 
5365
+ def to_s(colour: false)
5366
+ 'AutoSyncConstraint ' + @h.inspect
5367
+ end
5368
+
5369
+ alias to_summary to_s
4635
5370
  end
4636
5371
 
4637
5372
  # Category: Device State
@@ -4648,6 +5383,11 @@ class NFCStateConstraint < Constraint
4648
5383
 
4649
5384
  end
4650
5385
 
5386
+ def to_s(colour: false)
5387
+ 'NFCStateConstraint ' + @h.inspect
5388
+ end
5389
+
5390
+ alias to_summary to_s
4651
5391
  end
4652
5392
 
4653
5393
  # Category: Device State
@@ -4664,6 +5404,11 @@ class IsRootedConstraint < Constraint
4664
5404
 
4665
5405
  end
4666
5406
 
5407
+ def to_s(colour: false)
5408
+ 'IsRootedConstraint ' + @h.inspect
5409
+ end
5410
+
5411
+ alias to_summary to_s
4667
5412
  end
4668
5413
 
4669
5414
  # Category: Device State
@@ -4680,6 +5425,11 @@ class VpnConstraint < Constraint
4680
5425
 
4681
5426
  end
4682
5427
 
5428
+ def to_s(colour: false)
5429
+ 'VpnConstraint ' + @h.inspect
5430
+ end
5431
+
5432
+ alias to_summary to_s
4683
5433
  end
4684
5434
 
4685
5435
  # Category: MacroDroid Specific
@@ -4698,6 +5448,11 @@ class MacroEnabledConstraint < Constraint
4698
5448
 
4699
5449
  end
4700
5450
 
5451
+ def to_s(colour: false)
5452
+ 'MacroEnabledConstraint ' + @h.inspect
5453
+ end
5454
+
5455
+ alias to_summary to_s
4701
5456
  end
4702
5457
 
4703
5458
  # Category: MacroDroid Specific
@@ -4715,6 +5470,11 @@ class ModeConstraint < Constraint
4715
5470
 
4716
5471
  end
4717
5472
 
5473
+ def to_s(colour: false)
5474
+ 'ModeConstraint ' + @h.inspect
5475
+ end
5476
+
5477
+ alias to_summary to_s
4718
5478
  end
4719
5479
 
4720
5480
  # Category: MacroDroid Specific
@@ -4733,13 +5493,23 @@ class TriggerThatInvokedConstraint < Constraint
4733
5493
  trigger_name: 'Shake Device'
4734
5494
  }
4735
5495
 
4736
- super(options.merge filter(options,h))
5496
+ #super(options.merge filter(options,h))
5497
+ super(options.merge h)
4737
5498
 
4738
5499
  end
4739
5500
 
4740
- def to_s()
4741
- 'Trigger Fired: ' + @trigger.to_s
5501
+ def to_s(colour: false)
5502
+ 'Trigger Fired: ' + @trigger.to_s(colour: colour)
4742
5503
  end
5504
+
5505
+ def to_summary(colour: false)
5506
+ #puts '@trigger' + @trigger.inspect
5507
+ if @trigger then
5508
+ 'Trigger Fired: ' + @trigger.to_summary(colour: colour)
5509
+ else
5510
+ 'Trigger Fired: Trigger not found; guid: ' + @h[:si_guid_that_invoked].inspect
5511
+ end
5512
+ end
4743
5513
 
4744
5514
  end
4745
5515
 
@@ -4761,6 +5531,11 @@ class LastRunTimeConstraint < Constraint
4761
5531
 
4762
5532
  end
4763
5533
 
5534
+ def to_s(colour: false)
5535
+ 'LastRunTimeConstraint ' + @h.inspect
5536
+ end
5537
+
5538
+ alias to_summary to_s
4764
5539
  end
4765
5540
 
4766
5541
  # Category: Media
@@ -4777,10 +5552,12 @@ class HeadphonesConnectionConstraint < Constraint
4777
5552
 
4778
5553
  end
4779
5554
 
4780
- def to_s()
5555
+ def to_s(colour: false)
4781
5556
  connection = @h[:connected] ? 'Connected' : 'Disconnected'
4782
5557
  'Headphones ' + connection
4783
5558
  end
5559
+
5560
+ alias to_summary to_s
4784
5561
 
4785
5562
  end
4786
5563
 
@@ -4798,6 +5575,11 @@ class MusicActiveConstraint < Constraint
4798
5575
 
4799
5576
  end
4800
5577
 
5578
+ def to_s(colour: false)
5579
+ 'MusicActiveConstraint ' + @h.inspect
5580
+ end
5581
+
5582
+ alias to_summary to_s
4801
5583
  end
4802
5584
 
4803
5585
  # Category: Notification
@@ -4821,6 +5603,11 @@ class NotificationPresentConstraint < Constraint
4821
5603
 
4822
5604
  end
4823
5605
 
5606
+ def to_s(colour: false)
5607
+ 'NotificationPresentConstraint ' + @h.inspect
5608
+ end
5609
+
5610
+ alias to_summary to_s
4824
5611
  end
4825
5612
 
4826
5613
  # Category: Notification
@@ -4838,6 +5625,11 @@ class PriorityModeConstraint < Constraint
4838
5625
 
4839
5626
  end
4840
5627
 
5628
+ def to_s(colour: false)
5629
+ 'PriorityModeConstraint ' + @h.inspect
5630
+ end
5631
+
5632
+ alias to_summary to_s
4841
5633
  end
4842
5634
 
4843
5635
  # Category: Notification
@@ -4854,6 +5646,11 @@ class NotificationVolumeConstraint < Constraint
4854
5646
 
4855
5647
  end
4856
5648
 
5649
+ def to_s(colour: false)
5650
+ 'NotificationVolumeConstraint ' + @h.inspect
5651
+ end
5652
+
5653
+ alias to_summary to_s
4857
5654
  end
4858
5655
 
4859
5656
  # Category: Phone
@@ -4870,6 +5667,11 @@ class InCallConstraint < Constraint
4870
5667
 
4871
5668
  end
4872
5669
 
5670
+ def to_s(colour: false)
5671
+ 'InCallConstraint ' + @h.inspect
5672
+ end
5673
+
5674
+ alias to_summary to_s
4873
5675
  end
4874
5676
 
4875
5677
  # Category: Phone
@@ -4885,6 +5687,11 @@ class PhoneRingingConstraint < Constraint
4885
5687
  super(options.merge h)
4886
5688
 
4887
5689
  end
5690
+
5691
+ def to_s(colour: false)
5692
+ @s = @h[:ringing] ? 'Phone Ringing' : 'Not Ringing'
5693
+ super(colour: colour)
5694
+ end
4888
5695
 
4889
5696
  end
4890
5697
 
@@ -4906,6 +5713,11 @@ class BrightnessConstraint < Constraint
4906
5713
 
4907
5714
  end
4908
5715
 
5716
+ def to_s(colour: false)
5717
+ 'BrightnessConstraint ' + @h.inspect
5718
+ end
5719
+
5720
+ alias to_summary to_s
4909
5721
  end
4910
5722
 
4911
5723
  # Category: Screen and Speaker
@@ -4922,7 +5734,7 @@ class VolumeConstraint < Constraint
4922
5734
 
4923
5735
  end
4924
5736
 
4925
- def to_s()
5737
+ def to_s(colour: false)
4926
5738
  a = ['Volume On', 'Vibrate Only' 'Silent', 'Vibrate or Silent']
4927
5739
 
4928
5740
  "Ringer Volume\n " + a[@h[:option]]
@@ -4944,6 +5756,11 @@ class SpeakerPhoneConstraint < Constraint
4944
5756
 
4945
5757
  end
4946
5758
 
5759
+ def to_s(colour: false)
5760
+ 'SpeakerPhoneConstraint ' + @h.inspect
5761
+ end
5762
+
5763
+ alias to_summary to_s
4947
5764
  end
4948
5765
 
4949
5766
  # Category: Screen and Speaker
@@ -4960,6 +5777,11 @@ class DarkThemeConstraint < Constraint
4960
5777
 
4961
5778
  end
4962
5779
 
5780
+ def to_s(colour: false)
5781
+ 'DarkThemeConstraint ' + @h.inspect
5782
+ end
5783
+
5784
+ alias to_summary to_s
4963
5785
  end
4964
5786
 
4965
5787
  # Category: Screen and Speaker
@@ -4977,9 +5799,11 @@ class ScreenOnOffConstraint < Constraint
4977
5799
 
4978
5800
  end
4979
5801
 
4980
- def to_s()
5802
+ def to_s(colour: false)
4981
5803
  'Screen ' + (@h[:screen_on] ? 'On' : 'Off')
4982
5804
  end
5805
+
5806
+ alias to_summary to_s
4983
5807
 
4984
5808
  end
4985
5809
 
@@ -4999,6 +5823,11 @@ class VolumeLevelConstraint < Constraint
4999
5823
 
5000
5824
  end
5001
5825
 
5826
+ def to_s(colour: false)
5827
+ 'VolumeLevelConstraint ' + @h.inspect
5828
+ end
5829
+
5830
+ alias to_summary to_s
5002
5831
  end
5003
5832
 
5004
5833
  # Category: Sensors
@@ -5016,6 +5845,11 @@ class FaceUpDownConstraint < Constraint
5016
5845
 
5017
5846
  end
5018
5847
 
5848
+ def to_s(colour: false)
5849
+ 'FaceUpDownConstraint ' + @h.inspect
5850
+ end
5851
+
5852
+ alias to_summary to_s
5019
5853
  end
5020
5854
 
5021
5855
  # Category: Sensors
@@ -5034,7 +5868,7 @@ class LightLevelConstraint < Constraint
5034
5868
 
5035
5869
  end
5036
5870
 
5037
- def to_s()
5871
+ def to_s(colour: false)
5038
5872
 
5039
5873
  operator = @h[:light_level] == -1 ? 'Less than' : 'Greater than'
5040
5874
  condition = operator + ' ' + @h[:light_level_float].to_s + 'lx'
@@ -5058,6 +5892,11 @@ class DeviceOrientationConstraint < Constraint
5058
5892
 
5059
5893
  end
5060
5894
 
5895
+ def to_s(colour: false)
5896
+ 'DeviceOrientationConstraint ' + @h.inspect
5897
+ end
5898
+
5899
+ alias to_summary to_s
5061
5900
  end
5062
5901
 
5063
5902
  # Category: Sensors
@@ -5074,7 +5913,7 @@ class ProximitySensorConstraint < Constraint
5074
5913
 
5075
5914
  end
5076
5915
 
5077
- def to_s()
5916
+ def to_s(colour: false)
5078
5917
  'Proximity Sensor: ' + (@h[:near] ? 'Near' : 'Far')
5079
5918
  end
5080
5919