ruby-macrodroid 0.4.1 → 0.5.0

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: 7e6155695183a13d186ab0f5dc0d41f8b3e2a3624cd27d39ec8aac432b629f3b
4
- data.tar.gz: e08ac2a18f3cc9c4dc31e3e4529055dfa36f7ddb14f7ce1877fa67f5c27f6bb5
3
+ metadata.gz: fc528ce6042bfe75807bb76fcc73cc255b45b6fe0bf138d4a643a5facd7fdaf1
4
+ data.tar.gz: 294fed6fbe1ff71b05ea4384f9070e5795ceb1c41979bba419f89a4273164124
5
5
  SHA512:
6
- metadata.gz: 389c2e6dc57dc5f1cc0530df419219b09e4422474dc8fb388c18e05476b908290b3c391e77fc735abeaa79e2e253f197cd413a1d634bd9232ee78b5d2196d224
7
- data.tar.gz: 34dfa5a6f22df2c1abf17214f28e1e531b8cf85692443255d5816ee039e9545d87e0f245bd77929bc0649d88c38cf8231e184f5504e6cc72eb71cd529f83b98f
6
+ metadata.gz: 76925a5b3cba1509ec62635c04d5d796ded37f2e8cee958748a59c88938876129853adc91df55281e594b6c9043ba5f8fdaba2307a9ff4727d70cf611f4a2d8f
7
+ data.tar.gz: 55f01e2512265e988d14cc63f576d18a5cc6fdee2a3d109ed47b0ef54bf3d4947ca4064696e405619bb5c2b5e545866fa771d040a13964e205bd343c7b111325
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -55,6 +55,29 @@ class ActionsNlp
55
55
 
56
56
  end
57
57
 
58
+ class ConstraintsNlp
59
+ include AppRoutes
60
+
61
+ def initialize()
62
+
63
+ super()
64
+ params = {}
65
+ constraints(params)
66
+
67
+ end
68
+
69
+ def constraints(params)
70
+
71
+ get /^airplane mode (.*)/i do |state|
72
+ [AirplaneModeConstraint, {enabled: (state =~ /^enabled|on$/) == 0}]
73
+ end
74
+
75
+ end
76
+
77
+ alias find_constraint run_route
78
+
79
+ end
80
+
58
81
  module Params
59
82
 
60
83
  refine Hash do
@@ -112,19 +135,16 @@ class Macro
112
135
  using ColouredText
113
136
  using Params
114
137
 
115
- attr_reader :local_variables, :triggers, :actions, :guid
138
+ attr_reader :local_variables, :triggers, :actions, :constraints, :guid
116
139
  attr_accessor :title
117
140
 
118
141
  def initialize(name=nil, debug: false)
119
142
 
120
143
  @title, @debug = name, debug
121
144
 
122
- puts 'inside Macro#initialize' if @debug
123
-
124
- lv=[], triggers=[], actions=[]
125
- @local_variables, @triggers, @actions = lv, triggers, actions
145
+ puts 'inside Macro#initialize' if @debug
126
146
 
127
- @triggers, @actions, @constraints = [], [], []
147
+ @local_variables, @triggers, @actions, @constraints = [], [], [], []
128
148
  @h = {}
129
149
 
130
150
  end
@@ -156,7 +176,7 @@ class Macro
156
176
  local_variables: @local_variables,
157
177
  m_trigger_list: @triggers.map(&:to_h),
158
178
  m_action_list: @actions.map(&:to_h),
159
- m_constraint_list: [],
179
+ m_constraint_list: @constraints.map(&:to_h),
160
180
  m_description: '',
161
181
  m_name: @title,
162
182
  m_excludeLog: false,
@@ -188,13 +208,15 @@ class Macro
188
208
  object(action.to_snake_case)
189
209
  end
190
210
 
191
- # fetch the constraints (not yet implemented)
211
+ # fetch the constraints
212
+ @constraints = h[:constraint_list].map do |constraint|
213
+ object(constraint.to_snake_case)
214
+ end
192
215
 
193
216
  @h = h
194
217
 
195
- %i(local_variables m_trigger_list m_action_list).each do |x|
196
- @h[x] = []
197
- end
218
+ %i(local_variables m_trigger_list m_action_list m_constraint_list)\
219
+ .each {|x| @h[x] = [] }
198
220
 
199
221
  @h
200
222
 
@@ -235,6 +257,14 @@ class Macro
235
257
  end
236
258
 
237
259
  end
260
+
261
+ # get all the constraints
262
+ @constraints = node.xpath('constraints/*').map do |e|
263
+
264
+ puts 'e.name: ' + e.name.inspect if @debug
265
+ {airplanemode: AirplaneModeConstraint}[e.name.to_sym].new(e.attributes.to_h)
266
+
267
+ end
238
268
 
239
269
  else
240
270
 
@@ -266,6 +296,19 @@ class Macro
266
296
  end
267
297
 
268
298
  end
299
+
300
+ cp = ConstraintsNlp.new
301
+
302
+ @constraints = node.xpath('constraint').map do |e|
303
+
304
+ r = cp.find_constraint e.text
305
+ puts 'found constraint ' + r.inspect if @debug
306
+
307
+ if r then
308
+ r[0].new(r[1])
309
+ end
310
+
311
+ end
269
312
 
270
313
  end
271
314
 
@@ -439,8 +482,9 @@ class MacroDroid
439
482
  lines.each {|line| h[line[0].to_sym] << line[/^\w: +(.*)/,1] }
440
483
  triggers = h[:t].map {|text| [:trigger, {}, text]}
441
484
  actions = h[:a].map {|text| [:action, {}, text]}
485
+ constraints = h[:c].map {|text| [:constraint, {}, text]}
442
486
 
443
- [:macro, {name: name},'', *triggers, *actions]
487
+ [:macro, {name: name},'', *triggers, *actions, *constraints]
444
488
 
445
489
  end
446
490
 
@@ -2995,3 +3039,856 @@ class Constraint < MacroObject
2995
3039
  end
2996
3040
 
2997
3041
  end
3042
+
3043
+ class TimeOfDayConstraint < Constraint
3044
+
3045
+ def initialize(h={})
3046
+
3047
+ options = {
3048
+ end_hour: 8,
3049
+ end_minute: 0,
3050
+ start_hour: 22,
3051
+ start_minute: 0
3052
+ }
3053
+
3054
+ super(options.merge h)
3055
+
3056
+ end
3057
+
3058
+ end
3059
+
3060
+ # Category: Battery/Power
3061
+ #
3062
+ class BatteryLevelConstraint < Constraint
3063
+
3064
+ def initialize(h={})
3065
+
3066
+ options = {
3067
+ battery_level: 23,
3068
+ equals: false,
3069
+ greater_than: false
3070
+ }
3071
+
3072
+ super(options.merge h)
3073
+
3074
+ end
3075
+
3076
+ end
3077
+
3078
+ # Category: Battery/Power
3079
+ #
3080
+ class BatterySaverStateConstraint < Constraint
3081
+
3082
+ def initialize(h={})
3083
+
3084
+ options = {
3085
+ option: 0
3086
+ }
3087
+
3088
+ super(options.merge h)
3089
+
3090
+ end
3091
+
3092
+ end
3093
+
3094
+ # Category: Battery/Power
3095
+ #
3096
+ class BatteryTemperatureConstraint < Constraint
3097
+
3098
+ def initialize(h={})
3099
+
3100
+ options = {
3101
+ equals: false,
3102
+ greater_than: false,
3103
+ temperature: 30
3104
+ }
3105
+
3106
+ super(options.merge h)
3107
+
3108
+ end
3109
+
3110
+ end
3111
+
3112
+ # Category: Battery/Power
3113
+ #
3114
+ class ExternalPowerConstraint < Constraint
3115
+
3116
+ def initialize(h={})
3117
+
3118
+ options = {
3119
+ external_power: true,
3120
+ power_connected_options: [false, true, false]
3121
+ }
3122
+
3123
+ super(options.merge h)
3124
+
3125
+ end
3126
+
3127
+ end
3128
+
3129
+ # Category: Connectivity
3130
+ #
3131
+ class BluetoothConstraint < Constraint
3132
+
3133
+ def initialize(h={})
3134
+
3135
+ options = {
3136
+ any_device: false,
3137
+ bt_state: 0,
3138
+ device_name: 'Any Device'
3139
+ }
3140
+
3141
+ super(options.merge h)
3142
+
3143
+ end
3144
+
3145
+ end
3146
+
3147
+ # Category: Connectivity
3148
+ #
3149
+ class GPSEnabledConstraint < Constraint
3150
+
3151
+ def initialize(h={})
3152
+
3153
+ options = {
3154
+ enabled: true
3155
+ }
3156
+
3157
+ super(options.merge h)
3158
+
3159
+ end
3160
+
3161
+ end
3162
+
3163
+ # Category: Connectivity
3164
+ #
3165
+ class LocationModeConstraint < Constraint
3166
+
3167
+ def initialize(h={})
3168
+
3169
+ options = {
3170
+ options: [false, false, false, true]
3171
+ }
3172
+
3173
+ super(options.merge h)
3174
+
3175
+ end
3176
+
3177
+ end
3178
+
3179
+ # Category: Connectivity
3180
+ #
3181
+ class SignalOnOffConstraint < Constraint
3182
+
3183
+ def initialize(h={})
3184
+
3185
+ options = {
3186
+ option: 0
3187
+ }
3188
+
3189
+ super(options.merge h)
3190
+
3191
+ end
3192
+
3193
+ end
3194
+
3195
+ # Category: Connectivity
3196
+ #
3197
+ class WifiConstraint < Constraint
3198
+
3199
+ def initialize(h={})
3200
+
3201
+ options = {
3202
+ ssid_list: [],
3203
+ wifi_state: 0
3204
+ }
3205
+
3206
+ super(options.merge h)
3207
+
3208
+ end
3209
+
3210
+ end
3211
+
3212
+ # Category: Connectivity
3213
+ #
3214
+ class CellTowerConstraint < Constraint
3215
+
3216
+ def initialize(h={})
3217
+
3218
+ options = {
3219
+ cell_group_name: 'test group',
3220
+ cell_ids: ["524,14,41070731"],
3221
+ in_range: true
3222
+ }
3223
+
3224
+ super(options.merge h)
3225
+
3226
+ end
3227
+
3228
+ end
3229
+
3230
+ # Category: Connectivity
3231
+ #
3232
+ class IsRoamingConstraint < Constraint
3233
+
3234
+ def initialize(h={})
3235
+
3236
+ options = {
3237
+ is_roaming: true
3238
+ }
3239
+
3240
+ super(options.merge h)
3241
+
3242
+ end
3243
+
3244
+ end
3245
+
3246
+ # Category: Connectivity
3247
+ #
3248
+ class DataOnOffConstraint < Constraint
3249
+
3250
+ def initialize(h={})
3251
+
3252
+ options = {
3253
+ data_on: true
3254
+ }
3255
+
3256
+ super(options.merge h)
3257
+
3258
+ end
3259
+
3260
+ end
3261
+
3262
+ # Category: Connectivity
3263
+ #
3264
+ class WifiHotSpotConstraint < Constraint
3265
+
3266
+ def initialize(h={})
3267
+
3268
+ options = {
3269
+ check_connections: false,
3270
+ comparison_value: 0,
3271
+ connected_count: 0,
3272
+ enabled: true
3273
+ }
3274
+
3275
+ super(options.merge h)
3276
+
3277
+ end
3278
+
3279
+ end
3280
+
3281
+ # Category: Date/Time
3282
+ #
3283
+ class CalendarConstraint < Constraint
3284
+
3285
+ def initialize(h={})
3286
+
3287
+ options = {
3288
+ enable_regex: false,
3289
+ availability: 0,
3290
+ calendar_id: '1',
3291
+ calendar_name: 'PC Sync',
3292
+ detail_text: '',
3293
+ entry_set: true,
3294
+ ignore_all_day: false,
3295
+ title_text: ''
3296
+ }
3297
+
3298
+ super(options.merge h)
3299
+
3300
+ end
3301
+
3302
+ end
3303
+
3304
+ # Category: Date/Time
3305
+ #
3306
+ class DayOfWeekConstraint < Constraint
3307
+
3308
+ def initialize(h={})
3309
+
3310
+ options = {
3311
+ days_of_week: [false, false, true, false, false, false, false]
3312
+ }
3313
+
3314
+ super(options.merge h)
3315
+
3316
+ end
3317
+
3318
+ end
3319
+
3320
+ # Category: Date/Time
3321
+ #
3322
+ class TimeOfDayConstraint < Constraint
3323
+
3324
+ def initialize(h={})
3325
+
3326
+ options = {
3327
+ end_hour: 1,
3328
+ end_minute: 1,
3329
+ start_hour: 21,
3330
+ start_minute: 58
3331
+ }
3332
+
3333
+ super(options.merge h)
3334
+
3335
+ end
3336
+
3337
+ end
3338
+
3339
+ # Category: Date/Time
3340
+ #
3341
+ class DayOfMonthConstraint < Constraint
3342
+
3343
+ def initialize(h={})
3344
+
3345
+ options = {
3346
+ day_names: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"],
3347
+ days_of_month: [false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false]
3348
+ }
3349
+
3350
+ super(options.merge h)
3351
+
3352
+ end
3353
+
3354
+ end
3355
+
3356
+ # Category: Date/Time
3357
+ #
3358
+ class MonthOfYearConstraint < Constraint
3359
+
3360
+ def initialize(h={})
3361
+
3362
+ options = {
3363
+ months: [false, false, false, false, false, false, false, true, false, false, false, false]
3364
+ }
3365
+
3366
+ super(options.merge h)
3367
+
3368
+ end
3369
+
3370
+ end
3371
+
3372
+ # Category: Date/Time
3373
+ #
3374
+ class SunsetSunriseConstraint < Constraint
3375
+
3376
+ def initialize(h={})
3377
+
3378
+ options = {
3379
+ option: 0
3380
+ }
3381
+
3382
+ super(options.merge h)
3383
+
3384
+ end
3385
+
3386
+ end
3387
+
3388
+ # Category: Device State
3389
+ #
3390
+ class AirplaneModeConstraint < Constraint
3391
+
3392
+ def initialize(h={})
3393
+
3394
+ options = {
3395
+ enabled: true
3396
+ }
3397
+
3398
+ super(options.merge h)
3399
+
3400
+ end
3401
+
3402
+ end
3403
+
3404
+ # Category: Device State
3405
+ #
3406
+ class AutoRotateConstraint < Constraint
3407
+
3408
+ def initialize(h={})
3409
+
3410
+ options = {
3411
+ enabled: true
3412
+ }
3413
+
3414
+ super(options.merge h)
3415
+
3416
+ end
3417
+
3418
+ end
3419
+
3420
+ # Category: Device State
3421
+ #
3422
+ class DeviceLockedConstraint < Constraint
3423
+
3424
+ def initialize(h={})
3425
+
3426
+ options = {
3427
+ locked: true
3428
+ }
3429
+
3430
+ super(options.merge h)
3431
+
3432
+ end
3433
+
3434
+ end
3435
+
3436
+ # Category: Device State
3437
+ #
3438
+ class RoamingOnOffConstraint < Constraint
3439
+
3440
+ def initialize(h={})
3441
+
3442
+ options = {
3443
+ roaming_on: true
3444
+ }
3445
+
3446
+ super(options.merge h)
3447
+
3448
+ end
3449
+
3450
+ end
3451
+
3452
+ # Category: Device State
3453
+ #
3454
+ class TimeSinceBootConstraint < Constraint
3455
+
3456
+ def initialize(h={})
3457
+
3458
+ options = {
3459
+ less_than: true,
3460
+ time_period_seconds: 10921
3461
+ }
3462
+
3463
+ super(options.merge h)
3464
+
3465
+ end
3466
+
3467
+ end
3468
+
3469
+ # Category: Device State
3470
+ #
3471
+ class AutoSyncConstraint < Constraint
3472
+
3473
+ def initialize(h={})
3474
+
3475
+ options = {
3476
+ enabled: false
3477
+ }
3478
+
3479
+ super(options.merge h)
3480
+
3481
+ end
3482
+
3483
+ end
3484
+
3485
+ # Category: Device State
3486
+ #
3487
+ class NFCStateConstraint < Constraint
3488
+
3489
+ def initialize(h={})
3490
+
3491
+ options = {
3492
+ enabled: true
3493
+ }
3494
+
3495
+ super(options.merge h)
3496
+
3497
+ end
3498
+
3499
+ end
3500
+
3501
+ # Category: Device State
3502
+ #
3503
+ class IsRootedConstraint < Constraint
3504
+
3505
+ def initialize(h={})
3506
+
3507
+ options = {
3508
+ rooted: true
3509
+ }
3510
+
3511
+ super(options.merge h)
3512
+
3513
+ end
3514
+
3515
+ end
3516
+
3517
+ # Category: Device State
3518
+ #
3519
+ class VpnConstraint < Constraint
3520
+
3521
+ def initialize(h={})
3522
+
3523
+ options = {
3524
+ option: 0
3525
+ }
3526
+
3527
+ super(options.merge h)
3528
+
3529
+ end
3530
+
3531
+ end
3532
+
3533
+ # Category: MacroDroid Specific
3534
+ #
3535
+ class MacroEnabledConstraint < Constraint
3536
+
3537
+ def initialize(h={})
3538
+
3539
+ options = {
3540
+ enabled: true,
3541
+ macro_ids: [-8016812002629322290],
3542
+ macro_names: ["Intruder photo "]
3543
+ }
3544
+
3545
+ super(options.merge h)
3546
+
3547
+ end
3548
+
3549
+ end
3550
+
3551
+ # Category: MacroDroid Specific
3552
+ #
3553
+ class ModeConstraint < Constraint
3554
+
3555
+ def initialize(h={})
3556
+
3557
+ options = {
3558
+ mode: 'Away',
3559
+ mode_selected: true
3560
+ }
3561
+
3562
+ super(options.merge h)
3563
+
3564
+ end
3565
+
3566
+ end
3567
+
3568
+ # Category: MacroDroid Specific
3569
+ #
3570
+ class TriggerThatInvokedConstraint < Constraint
3571
+
3572
+ def initialize(h={})
3573
+
3574
+ options = {
3575
+ not: false,
3576
+ si_guid_that_invoked: -4951291100076165433,
3577
+ trigger_name: 'Shake Device'
3578
+ }
3579
+
3580
+ super(options.merge h)
3581
+
3582
+ end
3583
+
3584
+ end
3585
+
3586
+ # Category: MacroDroid Specific
3587
+ #
3588
+ class LastRunTimeConstraint < Constraint
3589
+
3590
+ def initialize(h={})
3591
+
3592
+ options = {
3593
+ check_this_macro: false,
3594
+ invoked: true,
3595
+ macro_ids: [-6922688338672048267],
3596
+ macro_names: ["Opendoor"],
3597
+ time_period_seconds: 7260
3598
+ }
3599
+
3600
+ super(options.merge h)
3601
+
3602
+ end
3603
+
3604
+ end
3605
+
3606
+ # Category: Media
3607
+ #
3608
+ class HeadphonesConnectionConstraint < Constraint
3609
+
3610
+ def initialize(h={})
3611
+
3612
+ options = {
3613
+ connected: true
3614
+ }
3615
+
3616
+ super(options.merge h)
3617
+
3618
+ end
3619
+
3620
+ end
3621
+
3622
+ # Category: Media
3623
+ #
3624
+ class MusicActiveConstraint < Constraint
3625
+
3626
+ def initialize(h={})
3627
+
3628
+ options = {
3629
+ music_active: true
3630
+ }
3631
+
3632
+ super(options.merge h)
3633
+
3634
+ end
3635
+
3636
+ end
3637
+
3638
+ # Category: Notification
3639
+ #
3640
+ class NotificationPresentConstraint < Constraint
3641
+
3642
+ def initialize(h={})
3643
+
3644
+ options = {
3645
+ enable_regex: false,
3646
+ application_name_list: ["All applications"],
3647
+ exact_match: false,
3648
+ excludes: false,
3649
+ excludes_apps: -1,
3650
+ option: 0,
3651
+ package_name_list: ["allApplications"],
3652
+ text_content: ''
3653
+ }
3654
+
3655
+ super(options.merge h)
3656
+
3657
+ end
3658
+
3659
+ end
3660
+
3661
+ # Category: Notification
3662
+ #
3663
+ class PriorityModeConstraint < Constraint
3664
+
3665
+ def initialize(h={})
3666
+
3667
+ options = {
3668
+ in_mode: true,
3669
+ selected_index: 0
3670
+ }
3671
+
3672
+ super(options.merge h)
3673
+
3674
+ end
3675
+
3676
+ end
3677
+
3678
+ # Category: Notification
3679
+ #
3680
+ class NotificationVolumeConstraint < Constraint
3681
+
3682
+ def initialize(h={})
3683
+
3684
+ options = {
3685
+ option: 1
3686
+ }
3687
+
3688
+ super(options.merge h)
3689
+
3690
+ end
3691
+
3692
+ end
3693
+
3694
+ # Category: Phone
3695
+ #
3696
+ class InCallConstraint < Constraint
3697
+
3698
+ def initialize(h={})
3699
+
3700
+ options = {
3701
+ in_call: true
3702
+ }
3703
+
3704
+ super(options.merge h)
3705
+
3706
+ end
3707
+
3708
+ end
3709
+
3710
+ # Category: Phone
3711
+ #
3712
+ class PhoneRingingConstraint < Constraint
3713
+
3714
+ def initialize(h={})
3715
+
3716
+ options = {
3717
+ ringing: true
3718
+ }
3719
+
3720
+ super(options.merge h)
3721
+
3722
+ end
3723
+
3724
+ end
3725
+
3726
+ # Category: Screen and Speaker
3727
+ #
3728
+ class BrightnessConstraint < Constraint
3729
+
3730
+ def initialize(h={})
3731
+
3732
+ options = {
3733
+ brightness: 35,
3734
+ equals: false,
3735
+ force_pie_mode: false,
3736
+ greater_than: false,
3737
+ is_auto_brightness: false
3738
+ }
3739
+
3740
+ super(options.merge h)
3741
+
3742
+ end
3743
+
3744
+ end
3745
+
3746
+ # Category: Screen and Speaker
3747
+ #
3748
+ class VolumeConstraint < Constraint
3749
+
3750
+ def initialize(h={})
3751
+
3752
+ options = {
3753
+ option: 0
3754
+ }
3755
+
3756
+ super(options.merge h)
3757
+
3758
+ end
3759
+
3760
+ end
3761
+
3762
+ # Category: Screen and Speaker
3763
+ #
3764
+ class SpeakerPhoneConstraint < Constraint
3765
+
3766
+ def initialize(h={})
3767
+
3768
+ options = {
3769
+ enabled: true
3770
+ }
3771
+
3772
+ super(options.merge h)
3773
+
3774
+ end
3775
+
3776
+ end
3777
+
3778
+ # Category: Screen and Speaker
3779
+ #
3780
+ class DarkThemeConstraint < Constraint
3781
+
3782
+ def initialize(h={})
3783
+
3784
+ options = {
3785
+ option: 0
3786
+ }
3787
+
3788
+ super(options.merge h)
3789
+
3790
+ end
3791
+
3792
+ end
3793
+
3794
+ # Category: Screen and Speaker
3795
+ #
3796
+ class ScreenOnOffConstraint < Constraint
3797
+
3798
+ def initialize(h={})
3799
+
3800
+ options = {
3801
+ a: true,
3802
+ screen_on: true
3803
+ }
3804
+
3805
+ super(options.merge h)
3806
+
3807
+ end
3808
+
3809
+ end
3810
+
3811
+ # Category: Screen and Speaker
3812
+ #
3813
+ class VolumeLevelConstraint < Constraint
3814
+
3815
+ def initialize(h={})
3816
+
3817
+ options = {
3818
+ comparison: 0,
3819
+ stream_index_array: [false, true, false, false, false, false, false],
3820
+ volume: 42
3821
+ }
3822
+
3823
+ super(options.merge h)
3824
+
3825
+ end
3826
+
3827
+ end
3828
+
3829
+ # Category: Sensors
3830
+ #
3831
+ class FaceUpDownConstraint < Constraint
3832
+
3833
+ def initialize(h={})
3834
+
3835
+ options = {
3836
+ option: -1,
3837
+ selected_options: [true, false, true, false, false, false]
3838
+ }
3839
+
3840
+ super(options.merge h)
3841
+
3842
+ end
3843
+
3844
+ end
3845
+
3846
+ # Category: Sensors
3847
+ #
3848
+ class LightLevelConstraint < Constraint
3849
+
3850
+ def initialize(h={})
3851
+
3852
+ options = {
3853
+ light_level: -1,
3854
+ light_level_float: 5000.0,
3855
+ option: 1
3856
+ }
3857
+
3858
+ super(options.merge h)
3859
+
3860
+ end
3861
+
3862
+ end
3863
+
3864
+ # Category: Sensors
3865
+ #
3866
+ class DeviceOrientationConstraint < Constraint
3867
+
3868
+ def initialize(h={})
3869
+
3870
+ options = {
3871
+ portrait: true
3872
+ }
3873
+
3874
+ super(options.merge h)
3875
+
3876
+ end
3877
+
3878
+ end
3879
+
3880
+ # Category: Sensors
3881
+ #
3882
+ class ProximitySensorConstraint < Constraint
3883
+
3884
+ def initialize(h={})
3885
+
3886
+ options = {
3887
+ near: true
3888
+ }
3889
+
3890
+ super(options.merge h)
3891
+
3892
+ end
3893
+
3894
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-macrodroid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file