remotedroid 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/remotedroid.rb +180 -19
- data/lib/remotedroid/client.rb +151 -4
- data/lib/remotedroid/control.rb +79 -1
- data/lib/remotedroid/controller.rb +32 -12
- data/lib/remotedroid/query.rb +25 -0
- metadata +44 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f599ec7df2216b5703047cceb92aa8c0e654bde02155919e2f4495407367d1c7
|
|
4
|
+
data.tar.gz: a508f24d92d1886c10e18ab8288fd6aafc3784dcd0d69552b922629d768c1ced
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5bd97bfa9e552a8ceb6c773d3aa3586a5be4728e53bea999d2b801c284f631fef21c5a090651028f048c5df6735a82ae1a7a94a493a3c79e9f6053e1d5eb2535
|
|
7
|
+
data.tar.gz: 6ade1995bbce809a3a65bcf3e9202127d3c9b53617c775c0ca75caa13a26830dac286b264143b6de3f48d15498582ee74aa043a3b54b9b67e430f0a93d14c6fc
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/lib/remotedroid.rb
CHANGED
|
@@ -45,6 +45,7 @@ require 'ruby-macrodroid'
|
|
|
45
45
|
# ## Camera/Photo
|
|
46
46
|
#
|
|
47
47
|
# * Take Picture
|
|
48
|
+
# * Take Screenshot
|
|
48
49
|
#
|
|
49
50
|
# ## Connectivity
|
|
50
51
|
#
|
|
@@ -66,7 +67,7 @@ require 'ruby-macrodroid'
|
|
|
66
67
|
#
|
|
67
68
|
# ## MacroDroid specific
|
|
68
69
|
#
|
|
69
|
-
# * Disable Macro
|
|
70
|
+
# * Enable/Disable Macro
|
|
70
71
|
#
|
|
71
72
|
# ## Media
|
|
72
73
|
#
|
|
@@ -79,7 +80,7 @@ require 'ruby-macrodroid'
|
|
|
79
80
|
# ## Screen
|
|
80
81
|
#
|
|
81
82
|
# * Keep Device Awake
|
|
82
|
-
# * Screen On
|
|
83
|
+
# * Screen On/Off
|
|
83
84
|
#
|
|
84
85
|
|
|
85
86
|
# Variables which can be queried
|
|
@@ -197,6 +198,100 @@ m: stay awake off
|
|
|
197
198
|
t: webhook
|
|
198
199
|
a: stay awake off
|
|
199
200
|
|
|
201
|
+
m: Launch Google Play Music
|
|
202
|
+
t: webhook
|
|
203
|
+
a: Launch Google Play Music
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
m: Media Next
|
|
207
|
+
t: webhook
|
|
208
|
+
a:
|
|
209
|
+
Media Next
|
|
210
|
+
Simulate Media Button (Google Play Music)
|
|
211
|
+
|
|
212
|
+
m: Media Pause
|
|
213
|
+
t: webhook
|
|
214
|
+
a:
|
|
215
|
+
Media Pause
|
|
216
|
+
Simulate Media Button (Google Play Music)
|
|
217
|
+
|
|
218
|
+
m: Media Play
|
|
219
|
+
t: webhook
|
|
220
|
+
a:
|
|
221
|
+
Media Play
|
|
222
|
+
Simulate Media Button (Google Play Music)
|
|
223
|
+
|
|
224
|
+
m: Media Play Pause
|
|
225
|
+
t: webhook
|
|
226
|
+
a:
|
|
227
|
+
Media Play/Pause
|
|
228
|
+
Simulate Media Button (Google Play Music)
|
|
229
|
+
|
|
230
|
+
m: Media Previous
|
|
231
|
+
t: webhook
|
|
232
|
+
a:
|
|
233
|
+
Media Previous
|
|
234
|
+
Simulate Media Button (Google Play Music)
|
|
235
|
+
|
|
236
|
+
m: Media Stop
|
|
237
|
+
t: webhook
|
|
238
|
+
a:
|
|
239
|
+
Media Stop
|
|
240
|
+
Simulate Media Button (Google Play Music)
|
|
241
|
+
|
|
242
|
+
m: Open website
|
|
243
|
+
v: url
|
|
244
|
+
t: webhook
|
|
245
|
+
a: goto [lv=url]
|
|
246
|
+
|
|
247
|
+
m: Fill clipboard
|
|
248
|
+
v: clipboard
|
|
249
|
+
t: webhook
|
|
250
|
+
a:
|
|
251
|
+
Fill Clipboard
|
|
252
|
+
[lv=clipboard]
|
|
253
|
+
|
|
254
|
+
m: click text content
|
|
255
|
+
v: content
|
|
256
|
+
t: webhook
|
|
257
|
+
a:
|
|
258
|
+
UI Interaction
|
|
259
|
+
Click [[lv=content]]
|
|
260
|
+
|
|
261
|
+
m: Launch by package
|
|
262
|
+
v: package
|
|
263
|
+
t: webhook
|
|
264
|
+
a: Launch [lv=package]
|
|
265
|
+
|
|
266
|
+
m: Take Screenshot
|
|
267
|
+
t: webhook
|
|
268
|
+
a:
|
|
269
|
+
Take Screenshot
|
|
270
|
+
Save to device
|
|
271
|
+
a: wait 2 seconds
|
|
272
|
+
a: webhook
|
|
273
|
+
|
|
274
|
+
m: Voice search
|
|
275
|
+
t: webhook
|
|
276
|
+
a: Voice search
|
|
277
|
+
|
|
278
|
+
m: Ask Alexa
|
|
279
|
+
t: webhook
|
|
280
|
+
a: shortcut Ask Alexa
|
|
281
|
+
|
|
282
|
+
m: Set Auto Rotate
|
|
283
|
+
; toggle doesn't currently work because of a bug with else if
|
|
284
|
+
v: state
|
|
285
|
+
t: webhook
|
|
286
|
+
a:
|
|
287
|
+
if state = 0
|
|
288
|
+
Auto Rotate On
|
|
289
|
+
Else If
|
|
290
|
+
Auto Rotate Off
|
|
291
|
+
else
|
|
292
|
+
Auto Rotate Toggle
|
|
293
|
+
end if
|
|
294
|
+
|
|
200
295
|
m: Share location
|
|
201
296
|
t:
|
|
202
297
|
WebHook
|
|
@@ -276,9 +371,12 @@ m: Power connected
|
|
|
276
371
|
t: Power Connected: Any
|
|
277
372
|
a: webhook
|
|
278
373
|
|
|
279
|
-
m:
|
|
374
|
+
m: Screen on
|
|
280
375
|
t: screen on
|
|
281
|
-
a:
|
|
376
|
+
a:
|
|
377
|
+
webhook
|
|
378
|
+
identifier: screen_on_off
|
|
379
|
+
screen_on: true
|
|
282
380
|
|
|
283
381
|
m: Power Button Toggle3
|
|
284
382
|
t: Power Button Toggle (3)
|
|
@@ -305,69 +403,121 @@ m: In Vehicle
|
|
|
305
403
|
t:
|
|
306
404
|
Activity - In Vehicle
|
|
307
405
|
Confidence >= 50%
|
|
308
|
-
a:
|
|
406
|
+
a:
|
|
407
|
+
webhook
|
|
408
|
+
identifier: activity
|
|
409
|
+
index: 0
|
|
309
410
|
|
|
310
411
|
m: On Bicycle
|
|
311
412
|
t:
|
|
312
413
|
Activity - On Bicycle
|
|
313
414
|
Confidence >= 50%
|
|
314
|
-
a:
|
|
315
|
-
|
|
415
|
+
a:
|
|
416
|
+
webhook
|
|
417
|
+
identifier: activity
|
|
418
|
+
index: 1
|
|
419
|
+
|
|
316
420
|
m: Running
|
|
317
421
|
t:
|
|
318
422
|
Activity - Running
|
|
319
423
|
Confidence >= 50%
|
|
320
|
-
a:
|
|
424
|
+
a:
|
|
425
|
+
webhook
|
|
426
|
+
identifier: activity
|
|
427
|
+
index: 2
|
|
321
428
|
|
|
322
429
|
m: Walking
|
|
323
430
|
t:
|
|
324
431
|
Activity - Walking
|
|
325
432
|
Confidence >= 50%
|
|
326
|
-
a:
|
|
433
|
+
a:
|
|
434
|
+
webhook
|
|
435
|
+
identifier: activity
|
|
436
|
+
index: 3
|
|
327
437
|
|
|
328
438
|
m: Still
|
|
329
439
|
t:
|
|
330
440
|
Activity - Still
|
|
331
441
|
Confidence >= 83%
|
|
332
|
-
a:
|
|
333
|
-
|
|
442
|
+
a:
|
|
443
|
+
webhook
|
|
444
|
+
identifier: activity
|
|
445
|
+
index: 4
|
|
446
|
+
|
|
334
447
|
m: Swipe top left across
|
|
335
448
|
t:
|
|
336
449
|
Swipe Screen
|
|
337
450
|
Top Left - Across
|
|
338
|
-
a:
|
|
451
|
+
a:
|
|
452
|
+
webhook
|
|
453
|
+
identifier: swipe
|
|
454
|
+
start: 0
|
|
455
|
+
motion: 0
|
|
339
456
|
|
|
340
457
|
m: Swipe top left diagonal
|
|
341
458
|
t:
|
|
342
459
|
Swipe Screen
|
|
343
460
|
Top Left - Diagonal
|
|
344
|
-
a:
|
|
461
|
+
a:
|
|
462
|
+
webhook
|
|
463
|
+
identifier: swipe
|
|
464
|
+
start: 0
|
|
465
|
+
motion: 1
|
|
345
466
|
|
|
346
467
|
m: Swipe top left down
|
|
347
468
|
t:
|
|
348
469
|
Swipe Screen
|
|
349
470
|
Top Left - Down
|
|
350
|
-
a:
|
|
471
|
+
a:
|
|
472
|
+
webhook
|
|
473
|
+
identifier: swipe
|
|
474
|
+
start: 0
|
|
475
|
+
motion: 2
|
|
351
476
|
|
|
352
477
|
m: Swipe top right across
|
|
353
478
|
t:
|
|
354
479
|
Swipe Screen
|
|
355
480
|
Top Right - Across
|
|
356
|
-
a:
|
|
481
|
+
a:
|
|
482
|
+
webhook
|
|
483
|
+
identifier: swipe
|
|
484
|
+
start: 1
|
|
485
|
+
motion: 0
|
|
486
|
+
|
|
357
487
|
|
|
358
488
|
m: Swipe top right diagonal
|
|
359
489
|
t:
|
|
360
490
|
Swipe Screen
|
|
361
491
|
Top Right - Diagonal
|
|
362
|
-
a:
|
|
492
|
+
a:
|
|
493
|
+
webhook
|
|
494
|
+
identifier: swipe
|
|
495
|
+
start: 1
|
|
496
|
+
motion: 1
|
|
363
497
|
|
|
364
498
|
m: Swipe top right down
|
|
365
499
|
t:
|
|
366
500
|
Swipe Screen
|
|
367
501
|
Top Right - Down
|
|
368
|
-
a:
|
|
502
|
+
a:
|
|
503
|
+
webhook
|
|
504
|
+
identifier: swipe
|
|
505
|
+
start: 1
|
|
506
|
+
motion: 2
|
|
369
507
|
|
|
508
|
+
m: flip from up to down
|
|
509
|
+
t: Flip Device Face Up -> Face Down
|
|
510
|
+
a:
|
|
511
|
+
webhook
|
|
512
|
+
identifier: flip_device
|
|
513
|
+
facedown: true
|
|
370
514
|
|
|
515
|
+
m: flip from down to up
|
|
516
|
+
t: Flip Device Face Down -> Face Up
|
|
517
|
+
a:
|
|
518
|
+
webhook
|
|
519
|
+
identifier: flip_device
|
|
520
|
+
facedown: false
|
|
371
521
|
EOF
|
|
372
522
|
|
|
373
523
|
|
|
@@ -423,8 +573,19 @@ module RemoteDroid
|
|
|
423
573
|
|
|
424
574
|
context, json = msg.split(/:\s+/,2)
|
|
425
575
|
category, action = context.split('/',2)
|
|
426
|
-
|
|
427
|
-
|
|
576
|
+
|
|
577
|
+
h = JSON.parse(json, symbolize_names: true)
|
|
578
|
+
|
|
579
|
+
if action == 'force_macro_run' and h[:serverside] then
|
|
580
|
+
|
|
581
|
+
a = @remote.run_macro(h)
|
|
582
|
+
a.each {|msg| self.notice 'macrodroid/action: ' + msg }
|
|
583
|
+
|
|
584
|
+
else
|
|
585
|
+
|
|
586
|
+
@remote.control.method(action.to_sym).call(h)
|
|
587
|
+
|
|
588
|
+
end
|
|
428
589
|
|
|
429
590
|
end
|
|
430
591
|
|
data/lib/remotedroid/client.rb
CHANGED
|
@@ -3,8 +3,9 @@ module RemoteDroid
|
|
|
3
3
|
class Client
|
|
4
4
|
using ColouredText
|
|
5
5
|
|
|
6
|
-
def initialize(
|
|
7
|
-
@drb = OneDrb::Client.new host: host, port:
|
|
6
|
+
def initialize(hostx='127.0.0.1', host: hostx, port: '5777', sps_host: 'sps.home', sps_port: '59000')
|
|
7
|
+
@drb = OneDrb::Client.new host: host, port: port
|
|
8
|
+
@sps = SPSPub.new host: sps_host, port: sps_port
|
|
8
9
|
end
|
|
9
10
|
|
|
10
11
|
def control
|
|
@@ -32,6 +33,11 @@ module RemoteDroid
|
|
|
32
33
|
|
|
33
34
|
end
|
|
34
35
|
|
|
36
|
+
def run_macro(name)
|
|
37
|
+
a = @drb.run_macro name
|
|
38
|
+
a.each {|msg| @sps.notice 'macrodroid/action: ' + msg }
|
|
39
|
+
end
|
|
40
|
+
|
|
35
41
|
def update(key, val)
|
|
36
42
|
@drb.update key.to_sym, val
|
|
37
43
|
end
|
|
@@ -40,8 +46,16 @@ module RemoteDroid
|
|
|
40
46
|
@drb.store
|
|
41
47
|
end
|
|
42
48
|
|
|
49
|
+
def syslog()
|
|
50
|
+
@drb.syslog
|
|
51
|
+
end
|
|
52
|
+
|
|
43
53
|
# -- helpful methods -----------------
|
|
44
54
|
|
|
55
|
+
def ask_alexa()
|
|
56
|
+
control.ask_alexa
|
|
57
|
+
end
|
|
58
|
+
|
|
45
59
|
def battery()
|
|
46
60
|
query.battery
|
|
47
61
|
end
|
|
@@ -50,6 +64,14 @@ module RemoteDroid
|
|
|
50
64
|
query.cell_tower
|
|
51
65
|
end
|
|
52
66
|
|
|
67
|
+
def click(s)
|
|
68
|
+
control.click content: s
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def control_media(option='Play/Pause')
|
|
72
|
+
control.control_media({option: option})
|
|
73
|
+
end
|
|
74
|
+
|
|
53
75
|
def disable(macro)
|
|
54
76
|
control.disable macro
|
|
55
77
|
end
|
|
@@ -57,11 +79,38 @@ module RemoteDroid
|
|
|
57
79
|
def enable(macro)
|
|
58
80
|
control.enable macro
|
|
59
81
|
end
|
|
82
|
+
|
|
83
|
+
def fill_clipboard(text)
|
|
84
|
+
control.fill_clipboard clipboard: text
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
alias copy fill_clipboard
|
|
60
88
|
|
|
61
89
|
def hotspot(state=nil)
|
|
62
90
|
control.hotspot state
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def launch_activity(app)
|
|
94
|
+
|
|
95
|
+
package = APPS[app]
|
|
96
|
+
|
|
97
|
+
if package then
|
|
98
|
+
control.launch_package package: package
|
|
99
|
+
else
|
|
100
|
+
r = APPS.find {|k,v| k =~ /#{app}/i}
|
|
101
|
+
control.launch_package(package: r[1]) if r
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def launch_package(name)
|
|
107
|
+
|
|
108
|
+
control.launch_package(package: name)
|
|
109
|
+
|
|
63
110
|
end
|
|
64
111
|
|
|
112
|
+
alias launch launch_activity
|
|
113
|
+
|
|
65
114
|
def location()
|
|
66
115
|
query.location
|
|
67
116
|
end
|
|
@@ -69,7 +118,6 @@ module RemoteDroid
|
|
|
69
118
|
def location_watch(refresh: '1 minute', interval: refresh,
|
|
70
119
|
duration: '30 minutes')
|
|
71
120
|
|
|
72
|
-
|
|
73
121
|
d = ChronicDuration.parse(duration)
|
|
74
122
|
seconds = ChronicDuration.parse(interval)
|
|
75
123
|
puts ("monitoring location every %s for %s" % [interval, duration]).info
|
|
@@ -89,10 +137,41 @@ module RemoteDroid
|
|
|
89
137
|
|
|
90
138
|
end
|
|
91
139
|
|
|
140
|
+
def open_website(url)
|
|
141
|
+
control.open_website url: url
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
alias goto open_website
|
|
145
|
+
alias visit open_website
|
|
146
|
+
|
|
147
|
+
def ip()
|
|
148
|
+
query.ip
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def next()
|
|
152
|
+
control_media('Next')
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def pause()
|
|
156
|
+
control_media('Pause')
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def play()
|
|
160
|
+
control_media('Play')
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def play_pause()
|
|
164
|
+
control_media('Play/Pause')
|
|
165
|
+
end
|
|
166
|
+
|
|
92
167
|
def photo()
|
|
93
168
|
take_picture
|
|
94
169
|
end
|
|
95
170
|
|
|
171
|
+
def previous()
|
|
172
|
+
control.control_media(option: 'Previous')
|
|
173
|
+
end
|
|
174
|
+
|
|
96
175
|
def say(text)
|
|
97
176
|
control.speak_text text
|
|
98
177
|
end
|
|
@@ -115,6 +194,22 @@ module RemoteDroid
|
|
|
115
194
|
screen :off
|
|
116
195
|
end
|
|
117
196
|
|
|
197
|
+
def set_auto_rotate(state=nil)
|
|
198
|
+
control.set_auto_rotate state
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
def set_auto_rotate_on()
|
|
202
|
+
control.set_auto_rotate 0
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def set_auto_rotate_off()
|
|
206
|
+
control.set_auto_rotate 1
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def set_auto_rotate_toggle()
|
|
210
|
+
control.set_auto_rotate 2
|
|
211
|
+
end
|
|
212
|
+
|
|
118
213
|
def stay_awake()
|
|
119
214
|
control.stay_awake
|
|
120
215
|
end
|
|
@@ -123,13 +218,20 @@ module RemoteDroid
|
|
|
123
218
|
control.stay_awake_off
|
|
124
219
|
end
|
|
125
220
|
|
|
221
|
+
alias awake_off stay_awake_off
|
|
222
|
+
|
|
223
|
+
def stop()
|
|
224
|
+
control_media(option: 'Stop')
|
|
225
|
+
end
|
|
226
|
+
|
|
126
227
|
def take_picture(ftp_src: nil, fileout: '.')
|
|
127
228
|
|
|
128
229
|
#screen.on
|
|
129
|
-
|
|
230
|
+
#launch 'camera'
|
|
130
231
|
|
|
131
232
|
if ftp_src then
|
|
132
233
|
|
|
234
|
+
r = query.take_picture
|
|
133
235
|
# give the device a second to write the image to file
|
|
134
236
|
sleep 1
|
|
135
237
|
|
|
@@ -139,12 +241,37 @@ module RemoteDroid
|
|
|
139
241
|
filename = ftp.ls.sort_by {|x| x[:ctime]}.last[:name]
|
|
140
242
|
ftp.cp filename, fileout
|
|
141
243
|
|
|
244
|
+
else
|
|
245
|
+
|
|
246
|
+
contro.take_picture
|
|
247
|
+
|
|
142
248
|
end
|
|
143
249
|
|
|
144
250
|
end
|
|
145
251
|
|
|
146
252
|
alias take_photo take_picture
|
|
147
253
|
|
|
254
|
+
def take_screenshot(ftp_src: nil, fileout: '.')
|
|
255
|
+
|
|
256
|
+
#screen.on
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
if ftp_src then
|
|
260
|
+
|
|
261
|
+
r = query.take_screenshot
|
|
262
|
+
# give the device a second to write the image to file
|
|
263
|
+
sleep 1
|
|
264
|
+
|
|
265
|
+
credentials, dir = ftp_src.match(/(ftp:\/\/[^\/]+)\/([^$]+)/).captures
|
|
266
|
+
ftp = MyMediaFTP.new(credentials)
|
|
267
|
+
ftp.cd dir
|
|
268
|
+
filename = ftp.ls.sort_by {|x| x[:ctime]}.last[:name]
|
|
269
|
+
ftp.cp filename, fileout
|
|
270
|
+
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
end
|
|
274
|
+
|
|
148
275
|
def torch()
|
|
149
276
|
control.torch
|
|
150
277
|
end
|
|
@@ -152,6 +279,26 @@ module RemoteDroid
|
|
|
152
279
|
def vibrate
|
|
153
280
|
control.vibrate
|
|
154
281
|
end
|
|
282
|
+
|
|
283
|
+
def voice_search
|
|
284
|
+
control.voice_search
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
def volume(context=nil)
|
|
288
|
+
query.volume context
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
alias vol volume
|
|
155
292
|
|
|
156
293
|
end
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class WebServer < AppHttp
|
|
297
|
+
|
|
298
|
+
def initialize(port: 9292)
|
|
299
|
+
super(RemoteDroid::Client.new, port: port)
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
end
|
|
303
|
+
|
|
157
304
|
end
|
data/lib/remotedroid/control.rb
CHANGED
|
@@ -8,22 +8,42 @@ module RemoteDroid
|
|
|
8
8
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
+
def ask_alexa(options={})
|
|
12
|
+
http_exec 'ask-alexa', options
|
|
13
|
+
end
|
|
14
|
+
|
|
11
15
|
def bluetooth()
|
|
12
|
-
|
|
16
|
+
#to-do
|
|
13
17
|
end
|
|
14
18
|
|
|
15
19
|
def camera_flash_light(options={})
|
|
16
20
|
http_exec 'camera-flash-light', options
|
|
17
21
|
end
|
|
18
22
|
|
|
23
|
+
def click(options={content: ''})
|
|
24
|
+
http_exec 'click-text-content', options
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def control_media(options={})
|
|
28
|
+
http_exec 'media-' + options[:option].downcase.gsub(/\W/,'-')
|
|
29
|
+
end
|
|
30
|
+
|
|
19
31
|
def disable(macro)
|
|
20
32
|
http_exec 'disable-macro', {name: macro}
|
|
21
33
|
end
|
|
22
34
|
|
|
23
35
|
def enable(macro)
|
|
24
36
|
http_exec 'enable-macro', {name: macro}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def fill_clipboard(options={})
|
|
40
|
+
http_exec 'fill-clipboard', options
|
|
25
41
|
end
|
|
26
42
|
|
|
43
|
+
def force_macro_run(options={})
|
|
44
|
+
http_exec option[:macro_name].downcase.gsub(/ /,'-')
|
|
45
|
+
end
|
|
46
|
+
|
|
27
47
|
def hotspot(state=nil)
|
|
28
48
|
|
|
29
49
|
if state then
|
|
@@ -65,10 +85,38 @@ module RemoteDroid
|
|
|
65
85
|
|
|
66
86
|
end
|
|
67
87
|
|
|
88
|
+
def launch_activity(options={app: ''})
|
|
89
|
+
|
|
90
|
+
return if options[:app].empty?
|
|
91
|
+
|
|
92
|
+
app = options[:app]
|
|
93
|
+
|
|
94
|
+
package = APPS[app]
|
|
95
|
+
|
|
96
|
+
if package then
|
|
97
|
+
launch_package package: package
|
|
98
|
+
else
|
|
99
|
+
r = APPS.find {|k,v| k =~ /#{app}/i}
|
|
100
|
+
launch_package(package: r[1]) if r
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def launch_package(options={package: 'com.google.android.chrome'})
|
|
106
|
+
http_exec 'launch-by-package', options
|
|
107
|
+
end
|
|
108
|
+
|
|
68
109
|
def location(options={})
|
|
69
110
|
http_exec 'location'
|
|
70
111
|
end
|
|
71
112
|
|
|
113
|
+
def open_website(options={url: ''})
|
|
114
|
+
http_exec 'open-website', options
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
alias goto open_website
|
|
118
|
+
alias visit open_website
|
|
119
|
+
|
|
72
120
|
def say_current_time(options={})
|
|
73
121
|
http_exec 'say-current-time'
|
|
74
122
|
end
|
|
@@ -94,6 +142,29 @@ module RemoteDroid
|
|
|
94
142
|
end
|
|
95
143
|
end
|
|
96
144
|
|
|
145
|
+
def set_auto_rotate(state=nil)
|
|
146
|
+
|
|
147
|
+
if state then
|
|
148
|
+
http_exec 'set-auto-rotate', {state: state}
|
|
149
|
+
else
|
|
150
|
+
|
|
151
|
+
def self.on()
|
|
152
|
+
http_exec 'set-auto-rotate', {state: 0}
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def self.off()
|
|
156
|
+
http_exec 'set-auto-rotate', {state: 1}
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def self.toggle()
|
|
160
|
+
http_exec 'set-auto-rotate', {state: 2}
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
self
|
|
164
|
+
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
97
168
|
def share_location(options={})
|
|
98
169
|
http_exec 'share-location'
|
|
99
170
|
end
|
|
@@ -126,6 +197,9 @@ module RemoteDroid
|
|
|
126
197
|
|
|
127
198
|
alias take_photo take_picture
|
|
128
199
|
|
|
200
|
+
def take_screenshot(options={})
|
|
201
|
+
http_exec 'take-screenshot', options
|
|
202
|
+
end
|
|
129
203
|
|
|
130
204
|
def toast(options={})
|
|
131
205
|
http_exec :toast, options
|
|
@@ -138,6 +212,10 @@ module RemoteDroid
|
|
|
138
212
|
def vibrate(options={})
|
|
139
213
|
http_exec :vibrate
|
|
140
214
|
end
|
|
215
|
+
|
|
216
|
+
def voice_search(options={})
|
|
217
|
+
http_exec 'voice-search'
|
|
218
|
+
end
|
|
141
219
|
|
|
142
220
|
|
|
143
221
|
def write(s)
|
|
@@ -2,7 +2,7 @@ module RemoteDroid
|
|
|
2
2
|
|
|
3
3
|
class Controller
|
|
4
4
|
|
|
5
|
-
attr_reader :model, :control
|
|
5
|
+
attr_reader :model, :control, :syslog
|
|
6
6
|
attr_accessor :title, :macros, :store
|
|
7
7
|
|
|
8
8
|
def initialize(mcs, model=MODEL, deviceid: nil, debug: false)
|
|
@@ -25,18 +25,25 @@ module RemoteDroid
|
|
|
25
25
|
names = @macros.map {|x| x.triggers.first.type}.uniq
|
|
26
26
|
#@control.enable names.first.to_s.gsub('_',' ')
|
|
27
27
|
puts 'Enabling ' + names.join(',')
|
|
28
|
-
|
|
28
|
+
=begin
|
|
29
29
|
Thread.new do
|
|
30
30
|
names.each do |title|
|
|
31
31
|
@control.enable title.to_s.gsub('_',' ')
|
|
32
32
|
sleep 0.8
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
|
-
|
|
35
|
+
=end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
def
|
|
39
|
-
@macros =
|
|
38
|
+
def delete_all()
|
|
39
|
+
@macros = []
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def export(s, replace: false)
|
|
43
|
+
|
|
44
|
+
macros = MacroDroid.new(s).macros
|
|
45
|
+
replace ? @macros = macros : @macros << macros
|
|
46
|
+
|
|
40
47
|
end
|
|
41
48
|
|
|
42
49
|
def invoke(name, options={})
|
|
@@ -105,8 +112,17 @@ module RemoteDroid
|
|
|
105
112
|
@model.request s
|
|
106
113
|
end
|
|
107
114
|
|
|
115
|
+
def run_macro(macro_name: '')
|
|
116
|
+
|
|
117
|
+
found = @macros.find do |macro|
|
|
118
|
+
macro.title.downcase == macro_name.downcase
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
found.run if found
|
|
122
|
+
|
|
123
|
+
end
|
|
108
124
|
|
|
109
|
-
def trigger(name, detail={
|
|
125
|
+
def trigger(name, detail={})
|
|
110
126
|
|
|
111
127
|
macros = @macros.select do |macro|
|
|
112
128
|
|
|
@@ -117,12 +133,14 @@ module RemoteDroid
|
|
|
117
133
|
#
|
|
118
134
|
valid_trigger = macro.match?(name, detail, @model.op)
|
|
119
135
|
|
|
120
|
-
puts 'valid_trigger: ' + valid_trigger.inspect if @debug
|
|
136
|
+
#puts 'valid_trigger: ' + valid_trigger.inspect if @debug
|
|
121
137
|
|
|
122
|
-
if valid_trigger then
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
end
|
|
138
|
+
#if valid_trigger then
|
|
139
|
+
# @syslog << [Time.now, :trigger, name]
|
|
140
|
+
# @syslog << [Time.now, :macro, macro.title]
|
|
141
|
+
#end
|
|
142
|
+
|
|
143
|
+
@syslog << [Time.now, name, detail]
|
|
126
144
|
|
|
127
145
|
valid_trigger
|
|
128
146
|
|
|
@@ -143,7 +161,9 @@ module RemoteDroid
|
|
|
143
161
|
val.keys.first.to_sym
|
|
144
162
|
end
|
|
145
163
|
|
|
146
|
-
@
|
|
164
|
+
@syslog << [id, val]
|
|
165
|
+
@store[key] = val
|
|
166
|
+
|
|
147
167
|
end
|
|
148
168
|
|
|
149
169
|
end
|
data/lib/remotedroid/query.rb
CHANGED
|
@@ -50,6 +50,31 @@ module RemoteDroid
|
|
|
50
50
|
@callback.query(:'take-picture')
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
+
def take_screenshot()
|
|
54
|
+
@callback.query(:'take-screenshot')
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def volume(context=nil)
|
|
58
|
+
|
|
59
|
+
if context then
|
|
60
|
+
q(context)
|
|
61
|
+
else
|
|
62
|
+
|
|
63
|
+
def self.alarm() q(:vol_alarm) end
|
|
64
|
+
def self.bt_voice() q(:vol_bt_voice) end
|
|
65
|
+
def self.call() q(:vol_call) end
|
|
66
|
+
def self.music() q(:vol_music) end
|
|
67
|
+
def self.notify() q(:vol_notif) end
|
|
68
|
+
def self.system() q(:vol_system) end
|
|
69
|
+
|
|
70
|
+
self
|
|
71
|
+
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
alias vol volume
|
|
76
|
+
|
|
77
|
+
|
|
53
78
|
private
|
|
54
79
|
|
|
55
80
|
def q(id)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: remotedroid
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Robertson
|
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
|
35
35
|
io3WPRDjULC924M5S8wbrus31v2AUjqFBPvmHr7caf/VHErWypV482xcDhWt1eif
|
|
36
36
|
0G2k2ptozXcBS9odsqGUTb5N
|
|
37
37
|
-----END CERTIFICATE-----
|
|
38
|
-
date: 2020-10-
|
|
38
|
+
date: 2020-10-25 00:00:00.000000000 Z
|
|
39
39
|
dependencies:
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: onedrb
|
|
@@ -97,6 +97,46 @@ dependencies:
|
|
|
97
97
|
- - ">="
|
|
98
98
|
- !ruby/object:Gem::Version
|
|
99
99
|
version: 0.3.7
|
|
100
|
+
- !ruby/object:Gem::Dependency
|
|
101
|
+
name: sps-pub
|
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
|
103
|
+
requirements:
|
|
104
|
+
- - "~>"
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
version: '0.5'
|
|
107
|
+
- - ">="
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: 0.5.5
|
|
110
|
+
type: :runtime
|
|
111
|
+
prerelease: false
|
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - "~>"
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '0.5'
|
|
117
|
+
- - ">="
|
|
118
|
+
- !ruby/object:Gem::Version
|
|
119
|
+
version: 0.5.5
|
|
120
|
+
- !ruby/object:Gem::Dependency
|
|
121
|
+
name: apphttp
|
|
122
|
+
requirement: !ruby/object:Gem::Requirement
|
|
123
|
+
requirements:
|
|
124
|
+
- - ">="
|
|
125
|
+
- !ruby/object:Gem::Version
|
|
126
|
+
version: 0.2.0
|
|
127
|
+
- - "~>"
|
|
128
|
+
- !ruby/object:Gem::Version
|
|
129
|
+
version: '0.2'
|
|
130
|
+
type: :runtime
|
|
131
|
+
prerelease: false
|
|
132
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
133
|
+
requirements:
|
|
134
|
+
- - ">="
|
|
135
|
+
- !ruby/object:Gem::Version
|
|
136
|
+
version: 0.2.0
|
|
137
|
+
- - "~>"
|
|
138
|
+
- !ruby/object:Gem::Version
|
|
139
|
+
version: '0.2'
|
|
100
140
|
- !ruby/object:Gem::Dependency
|
|
101
141
|
name: ruby-macrodroid
|
|
102
142
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -106,7 +146,7 @@ dependencies:
|
|
|
106
146
|
version: '0.9'
|
|
107
147
|
- - ">="
|
|
108
148
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: 0.9.
|
|
149
|
+
version: 0.9.17
|
|
110
150
|
type: :runtime
|
|
111
151
|
prerelease: false
|
|
112
152
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -116,7 +156,7 @@ dependencies:
|
|
|
116
156
|
version: '0.9'
|
|
117
157
|
- - ">="
|
|
118
158
|
- !ruby/object:Gem::Version
|
|
119
|
-
version: 0.9.
|
|
159
|
+
version: 0.9.17
|
|
120
160
|
description:
|
|
121
161
|
email: james@jamesrobertson.eu
|
|
122
162
|
executables: []
|
metadata.gz.sig
CHANGED
|
Binary file
|