remotedroid 0.5.3 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/remotedroid.rb +116 -16
- data/lib/remotedroid/client.rb +176 -16
- data/lib/remotedroid/control.rb +192 -7
- data/lib/remotedroid/controller.rb +1 -1
- data/lib/remotedroid/query.rb +40 -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: cb2eedf64071cbde99c208add4801a434aa0d3ec0a8750a7c2b94d283918b580
|
4
|
+
data.tar.gz: b47344083acbdd1ae6fa674249e22312e80aa91c654e2cd51150fa4cd27657d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a131d644b51b337e8a6ea54164306f612cae6989591eb00b0756e497ae2fa7f630e11b5c7484d95f3e12f6dbc5130403c469bf8fd96a398fdc3c82ea98dcd4d3
|
7
|
+
data.tar.gz: 8148f0cae8dbecabcca111dbcbad14f0c2884c026c21c3bea3ca2f420681fe3d2f3678ca226272b9344da277f6eefea1e650086d816e81016b1389c3f3542ea1
|
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,47 +198,137 @@ m: stay awake off
|
|
197
198
|
t: webhook
|
198
199
|
a: stay awake off
|
199
200
|
|
200
|
-
m: Launch Google Play Music
|
201
|
-
t: webhook
|
202
|
-
a: Launch Google Play Music
|
203
|
-
|
204
|
-
|
205
201
|
m: Media Next
|
206
202
|
t: webhook
|
207
203
|
a:
|
208
204
|
Media Next
|
209
|
-
Simulate
|
205
|
+
Simulate Audio Button
|
210
206
|
|
211
207
|
m: Media Pause
|
212
208
|
t: webhook
|
213
209
|
a:
|
214
210
|
Media Pause
|
215
|
-
Simulate
|
211
|
+
Simulate Audio Button
|
216
212
|
|
217
213
|
m: Media Play
|
218
214
|
t: webhook
|
219
215
|
a:
|
220
216
|
Media Play
|
221
|
-
Simulate
|
217
|
+
Simulate Audio Button
|
222
218
|
|
223
219
|
m: Media Play Pause
|
224
220
|
t: webhook
|
225
221
|
a:
|
226
222
|
Media Play/Pause
|
227
|
-
Simulate
|
223
|
+
Simulate Audio Button
|
228
224
|
|
229
225
|
m: Media Previous
|
230
226
|
t: webhook
|
231
227
|
a:
|
232
228
|
Media Previous
|
233
|
-
Simulate
|
229
|
+
Simulate Audio Button
|
234
230
|
|
235
231
|
m: Media Stop
|
236
232
|
t: webhook
|
237
233
|
a:
|
238
234
|
Media Stop
|
239
|
-
Simulate
|
235
|
+
Simulate Audio Button
|
236
|
+
|
237
|
+
m: Open web page
|
238
|
+
v: url
|
239
|
+
t: webhook
|
240
|
+
a: goto [lv=url]
|
241
|
+
|
242
|
+
m: Fill clipboard
|
243
|
+
v: clipboard
|
244
|
+
t: webhook
|
245
|
+
a:
|
246
|
+
Fill Clipboard
|
247
|
+
[lv=clipboard]
|
248
|
+
|
249
|
+
m: click text content
|
250
|
+
v: content
|
251
|
+
t: webhook
|
252
|
+
a:
|
253
|
+
UI Interaction
|
254
|
+
Click [[lv=content]]
|
240
255
|
|
256
|
+
m: Launch by package
|
257
|
+
v: package
|
258
|
+
t: webhook
|
259
|
+
a: Launch [lv=package]
|
260
|
+
|
261
|
+
m: Take Screenshot
|
262
|
+
t: webhook
|
263
|
+
a:
|
264
|
+
Take Screenshot
|
265
|
+
Save to device
|
266
|
+
a: wait 2 seconds
|
267
|
+
a: webhook
|
268
|
+
|
269
|
+
m: Voice search
|
270
|
+
t: webhook
|
271
|
+
a: Voice search
|
272
|
+
|
273
|
+
m: Ask Alexa
|
274
|
+
t: webhook
|
275
|
+
a: shortcut Ask Alexa
|
276
|
+
|
277
|
+
m: Set Auto Rotate
|
278
|
+
v: state
|
279
|
+
t: webhook
|
280
|
+
a:
|
281
|
+
if state = 0
|
282
|
+
Auto Rotate On
|
283
|
+
Else If state = 1
|
284
|
+
Auto Rotate Off
|
285
|
+
Else If state = 2
|
286
|
+
Auto Rotate Toggle
|
287
|
+
end if
|
288
|
+
|
289
|
+
m: Set Bluetooth
|
290
|
+
v: state
|
291
|
+
t: webhook
|
292
|
+
a:
|
293
|
+
if state = 0
|
294
|
+
Enable Bluetooth
|
295
|
+
Else If state = 1
|
296
|
+
Disable Bluetooth
|
297
|
+
Else If state = 2
|
298
|
+
Toggle Bluetooth
|
299
|
+
Else If state = 3
|
300
|
+
Connect Audio Device
|
301
|
+
Else If state = 4
|
302
|
+
Disconnect Audio Device
|
303
|
+
end if
|
304
|
+
|
305
|
+
m: Set Airplane Mode
|
306
|
+
v: state
|
307
|
+
t: webhook
|
308
|
+
a:
|
309
|
+
if state = 0
|
310
|
+
Airplane Mode On
|
311
|
+
Else If state = 1
|
312
|
+
Airplane Mode Off
|
313
|
+
Else If state = 2
|
314
|
+
Airplane Mode Toggle
|
315
|
+
end if
|
316
|
+
|
317
|
+
m: Set Wifi
|
318
|
+
v: state
|
319
|
+
t: webhook
|
320
|
+
a:
|
321
|
+
if state = 0
|
322
|
+
Enable Wifi
|
323
|
+
Else If state = 1
|
324
|
+
Disable Wifi
|
325
|
+
Else If state = 2
|
326
|
+
Toggle Wifi
|
327
|
+
Else If state = 3
|
328
|
+
Connect to Network
|
329
|
+
end if
|
330
|
+
|
331
|
+
|
241
332
|
m: Share location
|
242
333
|
t:
|
243
334
|
WebHook
|
@@ -326,15 +417,24 @@ a:
|
|
326
417
|
|
327
418
|
m: Power Button Toggle3
|
328
419
|
t: Power Button Toggle (3)
|
329
|
-
a:
|
420
|
+
a:
|
421
|
+
webhook
|
422
|
+
identifier: power-button-toggle
|
423
|
+
num_toggles: 3
|
330
424
|
|
331
425
|
m: Power Button Toggle4
|
332
426
|
t: Power Button Toggle (4)
|
333
|
-
a:
|
427
|
+
a:
|
428
|
+
webhook
|
429
|
+
identifier: power-button-toggle
|
430
|
+
num_toggles: 4
|
334
431
|
|
335
432
|
m: Power Button Toggle5
|
336
433
|
t: Power Button Toggle (5)
|
337
|
-
a:
|
434
|
+
a:
|
435
|
+
webhook
|
436
|
+
identifier: power-button-toggle
|
437
|
+
num_toggles: 5
|
338
438
|
|
339
439
|
m: Connected to network
|
340
440
|
t:
|
data/lib/remotedroid/client.rb
CHANGED
@@ -3,9 +3,12 @@ module RemoteDroid
|
|
3
3
|
class Client
|
4
4
|
using ColouredText
|
5
5
|
|
6
|
-
def initialize(hostx='127.0.0.1', host: hostx, port: '5777',
|
6
|
+
def initialize(hostx='127.0.0.1', host: hostx, port: '5777',
|
7
|
+
sps_host: 'sps.home', sps_port: '59000')
|
8
|
+
|
7
9
|
@drb = OneDrb::Client.new host: host, port: port
|
8
10
|
@sps = SPSPub.new host: sps_host, port: sps_port
|
11
|
+
|
9
12
|
end
|
10
13
|
|
11
14
|
def control
|
@@ -52,34 +55,99 @@ module RemoteDroid
|
|
52
55
|
|
53
56
|
# -- helpful methods -----------------
|
54
57
|
|
58
|
+
def ask_alexa()
|
59
|
+
control.ask_alexa
|
60
|
+
end
|
61
|
+
|
55
62
|
def battery()
|
56
63
|
query.battery
|
57
64
|
end
|
58
65
|
|
66
|
+
def bluetooth()
|
67
|
+
control.bluetooth
|
68
|
+
end
|
69
|
+
|
59
70
|
def cell_tower()
|
60
71
|
query.cell_tower
|
61
72
|
end
|
62
73
|
|
74
|
+
def click(s)
|
75
|
+
control.click content: s
|
76
|
+
end
|
77
|
+
|
63
78
|
def control_media(option='Play/Pause')
|
64
79
|
control.control_media({option: option})
|
65
80
|
end
|
66
81
|
|
67
|
-
def
|
68
|
-
control.
|
82
|
+
def disable_airplane_mode()
|
83
|
+
control.disable_airplane_mode
|
84
|
+
end
|
85
|
+
|
86
|
+
def disable_bluetooth()
|
87
|
+
control.disable_bluetooth
|
88
|
+
end
|
89
|
+
|
90
|
+
def disable_macro(macro)
|
91
|
+
control.disable_macro macro
|
69
92
|
end
|
70
93
|
|
71
|
-
def
|
72
|
-
control.
|
73
|
-
end
|
94
|
+
def disable_wifi()
|
95
|
+
control.disable_wifi
|
96
|
+
end
|
97
|
+
|
98
|
+
def enable_airplane_mode()
|
99
|
+
control.enable_airplane_mode
|
100
|
+
end
|
101
|
+
|
102
|
+
def enable_bluetooth()
|
103
|
+
control.enable_bluetooth
|
104
|
+
end
|
105
|
+
|
106
|
+
def enable_macro(macro)
|
107
|
+
control.enable_macro macro
|
108
|
+
end
|
109
|
+
|
110
|
+
def enable_wifi()
|
111
|
+
control.enable_wifi
|
112
|
+
end
|
113
|
+
|
114
|
+
def fill_clipboard(text)
|
115
|
+
control.fill_clipboard clipboard: text
|
116
|
+
end
|
117
|
+
|
118
|
+
alias copy fill_clipboard
|
74
119
|
|
75
120
|
def hotspot(state=nil)
|
76
121
|
control.hotspot state
|
77
122
|
end
|
123
|
+
|
124
|
+
def last_loc()
|
125
|
+
query.last_loc
|
126
|
+
end
|
127
|
+
|
128
|
+
def last_loc_link()
|
129
|
+
"<a href='%s' target='_blank'>map link</a>" % last_loc.link
|
130
|
+
end
|
131
|
+
|
132
|
+
def launch_activity(app)
|
133
|
+
|
134
|
+
package = APPS[app]
|
135
|
+
|
136
|
+
if package then
|
137
|
+
control.launch_package package: package
|
138
|
+
else
|
139
|
+
r = APPS.find {|k,v| k =~ /#{app}/i}
|
140
|
+
control.launch_package(package: r[1]) if r
|
141
|
+
end
|
78
142
|
|
79
|
-
def launch_activity(app='')
|
80
|
-
control.launch_activity(app)
|
81
143
|
end
|
82
144
|
|
145
|
+
def launch_package(name)
|
146
|
+
|
147
|
+
control.launch_package(package: name)
|
148
|
+
|
149
|
+
end
|
150
|
+
|
83
151
|
alias launch launch_activity
|
84
152
|
|
85
153
|
def location()
|
@@ -89,7 +157,6 @@ module RemoteDroid
|
|
89
157
|
def location_watch(refresh: '1 minute', interval: refresh,
|
90
158
|
duration: '30 minutes')
|
91
159
|
|
92
|
-
|
93
160
|
d = ChronicDuration.parse(duration)
|
94
161
|
seconds = ChronicDuration.parse(interval)
|
95
162
|
puts ("monitoring location every %s for %s" % [interval, duration]).info
|
@@ -108,29 +175,44 @@ module RemoteDroid
|
|
108
175
|
end
|
109
176
|
|
110
177
|
end
|
178
|
+
|
179
|
+
def open_website(url)
|
180
|
+
control.open_website url: url
|
181
|
+
end
|
182
|
+
|
183
|
+
alias goto open_website
|
184
|
+
alias visit open_website
|
185
|
+
|
186
|
+
def ip()
|
187
|
+
query.ip
|
188
|
+
end
|
111
189
|
|
112
190
|
def next()
|
113
|
-
control_media(
|
191
|
+
control_media('Next')
|
114
192
|
end
|
115
193
|
|
116
194
|
def pause()
|
117
|
-
control_media(
|
195
|
+
control_media('Pause')
|
118
196
|
end
|
119
197
|
|
120
198
|
def play()
|
121
|
-
control_media(
|
199
|
+
control_media('Play')
|
122
200
|
end
|
123
201
|
|
124
202
|
def play_pause()
|
125
|
-
control_media(
|
203
|
+
control_media('Play/Pause')
|
126
204
|
end
|
127
205
|
|
128
206
|
def photo()
|
129
207
|
take_picture
|
130
208
|
end
|
131
209
|
|
210
|
+
def power_connected?()
|
211
|
+
query.power_connected?
|
212
|
+
end
|
213
|
+
|
132
214
|
def previous()
|
133
|
-
control_media(option
|
215
|
+
control.control_media(option: 'Previous')
|
134
216
|
end
|
135
217
|
|
136
218
|
def say(text)
|
@@ -155,6 +237,22 @@ module RemoteDroid
|
|
155
237
|
screen :off
|
156
238
|
end
|
157
239
|
|
240
|
+
def set_auto_rotate(state=nil)
|
241
|
+
control.set_auto_rotate state
|
242
|
+
end
|
243
|
+
|
244
|
+
def set_auto_rotate_on()
|
245
|
+
control.set_auto_rotate 0
|
246
|
+
end
|
247
|
+
|
248
|
+
def set_auto_rotate_off()
|
249
|
+
control.set_auto_rotate 1
|
250
|
+
end
|
251
|
+
|
252
|
+
def set_auto_rotate_toggle()
|
253
|
+
control.set_auto_rotate 2
|
254
|
+
end
|
255
|
+
|
158
256
|
def stay_awake()
|
159
257
|
control.stay_awake
|
160
258
|
end
|
@@ -163,17 +261,20 @@ module RemoteDroid
|
|
163
261
|
control.stay_awake_off
|
164
262
|
end
|
165
263
|
|
264
|
+
alias awake_off stay_awake_off
|
265
|
+
|
166
266
|
def stop()
|
167
|
-
control_media(option
|
267
|
+
control_media(option: 'Stop')
|
168
268
|
end
|
169
269
|
|
170
270
|
def take_picture(ftp_src: nil, fileout: '.')
|
171
271
|
|
172
272
|
#screen.on
|
173
|
-
|
273
|
+
#launch 'camera'
|
174
274
|
|
175
275
|
if ftp_src then
|
176
276
|
|
277
|
+
r = query.take_picture
|
177
278
|
# give the device a second to write the image to file
|
178
279
|
sleep 1
|
179
280
|
|
@@ -183,12 +284,49 @@ module RemoteDroid
|
|
183
284
|
filename = ftp.ls.sort_by {|x| x[:ctime]}.last[:name]
|
184
285
|
ftp.cp filename, fileout
|
185
286
|
|
287
|
+
else
|
288
|
+
|
289
|
+
contro.take_picture
|
290
|
+
|
186
291
|
end
|
187
292
|
|
188
293
|
end
|
189
294
|
|
190
295
|
alias take_photo take_picture
|
191
296
|
|
297
|
+
def take_screenshot(ftp_src: nil, fileout: '.')
|
298
|
+
|
299
|
+
#screen.on
|
300
|
+
|
301
|
+
|
302
|
+
if ftp_src then
|
303
|
+
|
304
|
+
r = query.take_screenshot
|
305
|
+
# give the device a second to write the image to file
|
306
|
+
sleep 1
|
307
|
+
|
308
|
+
credentials, dir = ftp_src.match(/(ftp:\/\/[^\/]+)\/([^$]+)/).captures
|
309
|
+
ftp = MyMediaFTP.new(credentials)
|
310
|
+
ftp.cd dir
|
311
|
+
filename = ftp.ls.sort_by {|x| x[:ctime]}.last[:name]
|
312
|
+
ftp.cp filename, fileout
|
313
|
+
|
314
|
+
end
|
315
|
+
|
316
|
+
end
|
317
|
+
|
318
|
+
def toggle_airplane_mode()
|
319
|
+
control.toggle_airplane_mode
|
320
|
+
end
|
321
|
+
|
322
|
+
def toggle_bluetooth()
|
323
|
+
control.toggle_bluetooth
|
324
|
+
end
|
325
|
+
|
326
|
+
def toggle_wifi()
|
327
|
+
control.toggle_wifi
|
328
|
+
end
|
329
|
+
|
192
330
|
def torch()
|
193
331
|
control.torch
|
194
332
|
end
|
@@ -196,6 +334,28 @@ module RemoteDroid
|
|
196
334
|
def vibrate
|
197
335
|
control.vibrate
|
198
336
|
end
|
337
|
+
|
338
|
+
def voice_search
|
339
|
+
control.voice_search
|
340
|
+
end
|
341
|
+
|
342
|
+
def volume(context=nil)
|
343
|
+
query.volume context
|
344
|
+
end
|
345
|
+
|
346
|
+
def vol()
|
347
|
+
volume.music
|
348
|
+
end
|
199
349
|
|
200
350
|
end
|
351
|
+
|
352
|
+
|
353
|
+
class WebServer < AppHttp
|
354
|
+
|
355
|
+
def initialize(port: 9292)
|
356
|
+
super(RemoteDroid::Client.new, port: port)
|
357
|
+
end
|
358
|
+
|
359
|
+
end
|
360
|
+
|
201
361
|
end
|
data/lib/remotedroid/control.rb
CHANGED
@@ -8,26 +8,133 @@ module RemoteDroid
|
|
8
8
|
|
9
9
|
end
|
10
10
|
|
11
|
+
def airplane_mode()
|
12
|
+
|
13
|
+
def self.enable()
|
14
|
+
http_exec 'set-airplane-mode', {state: 0}
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.on()
|
18
|
+
self.enable
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.disable()
|
22
|
+
http_exec 'set-airplane-mode', {state: 1}
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.off()
|
26
|
+
self.disable
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.toggle()
|
30
|
+
http_exec 'set-airplane-mode', {state: 2}
|
31
|
+
end
|
32
|
+
|
33
|
+
self
|
34
|
+
end
|
35
|
+
|
36
|
+
def ask_alexa(options={})
|
37
|
+
http_exec 'ask-alexa', options
|
38
|
+
end
|
39
|
+
|
40
|
+
def autorotate()
|
41
|
+
|
42
|
+
def self.enable()
|
43
|
+
http_exec 'set-auto-rotate', {state: 0}
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.on()
|
47
|
+
self.enable
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.disable()
|
51
|
+
http_exec 'set-auto-rotate', {state: 1}
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.off()
|
55
|
+
self.disable
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.toggle()
|
59
|
+
http_exec 'set-auto-rotate', {state: 2}
|
60
|
+
end
|
61
|
+
|
62
|
+
self
|
63
|
+
end
|
64
|
+
|
11
65
|
def bluetooth()
|
12
|
-
|
66
|
+
|
67
|
+
def self.enable()
|
68
|
+
http_exec 'set-bluetooth', {state: 0}
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.on()
|
72
|
+
self.enable
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.disable()
|
76
|
+
http_exec 'set-bluetooth', {state: 1}
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.off()
|
80
|
+
self.disable
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.toggle()
|
84
|
+
http_exec 'set-bluetooth', {state: 2}
|
85
|
+
end
|
86
|
+
|
87
|
+
self
|
13
88
|
end
|
14
89
|
|
15
90
|
def camera_flash_light(options={})
|
16
91
|
http_exec 'camera-flash-light', options
|
17
92
|
end
|
18
93
|
|
94
|
+
def click(options={content: ''})
|
95
|
+
http_exec 'click-text-content', options
|
96
|
+
end
|
97
|
+
|
19
98
|
def control_media(options={})
|
20
99
|
http_exec 'media-' + options[:option].downcase.gsub(/\W/,'-')
|
21
100
|
end
|
22
101
|
|
23
|
-
def
|
102
|
+
def disable_airplane_mode()
|
103
|
+
http_exec 'set-airplane-mode', {state: 1}
|
104
|
+
end
|
105
|
+
|
106
|
+
def disable_bluetooth()
|
107
|
+
http_exec 'set-bluetooth', {state: 1}
|
108
|
+
end
|
109
|
+
|
110
|
+
def disable_macro(macro)
|
24
111
|
http_exec 'disable-macro', {name: macro}
|
25
112
|
end
|
26
113
|
|
27
|
-
def
|
114
|
+
def disable_wifi()
|
115
|
+
http_exec 'set-wifi', {state: 1}
|
116
|
+
end
|
117
|
+
|
118
|
+
def enable_airplane_mode()
|
119
|
+
http_exec 'set-airplane-mode', {state: 0}
|
120
|
+
end
|
121
|
+
|
122
|
+
def enable_bluetooth()
|
123
|
+
http_exec 'set-bluetooth', {state: 0}
|
124
|
+
end
|
125
|
+
|
126
|
+
def enable_macro(macro)
|
28
127
|
http_exec 'enable-macro', {name: macro}
|
29
128
|
end
|
30
129
|
|
130
|
+
def enable_wifi()
|
131
|
+
http_exec 'set-wifi', {state: 0}
|
132
|
+
end
|
133
|
+
|
134
|
+
def fill_clipboard(options={})
|
135
|
+
http_exec 'fill-clipboard', options
|
136
|
+
end
|
137
|
+
|
31
138
|
def force_macro_run(options={})
|
32
139
|
http_exec option[:macro_name].downcase.gsub(/ /,'-')
|
33
140
|
end
|
@@ -73,15 +180,39 @@ module RemoteDroid
|
|
73
180
|
|
74
181
|
end
|
75
182
|
|
76
|
-
def launch_activity(options={})
|
77
|
-
|
78
|
-
|
183
|
+
def launch_activity(options={app: ''})
|
184
|
+
|
185
|
+
return if options[:app].empty?
|
186
|
+
|
187
|
+
app = options[:app]
|
188
|
+
|
189
|
+
package = APPS[app]
|
190
|
+
|
191
|
+
if package then
|
192
|
+
launch_package package: package
|
193
|
+
else
|
194
|
+
r = APPS.find {|k,v| k =~ /#{app}/i}
|
195
|
+
launch_package(package: r[1]) if r
|
196
|
+
end
|
197
|
+
|
79
198
|
end
|
80
199
|
|
200
|
+
def launch_package(options={package: 'com.google.android.chrome'})
|
201
|
+
http_exec 'launch-by-package', options
|
202
|
+
end
|
203
|
+
|
81
204
|
def location(options={})
|
82
205
|
http_exec 'location'
|
83
206
|
end
|
84
207
|
|
208
|
+
def open_web_page(options={url: ''})
|
209
|
+
http_exec 'open-web-page', options
|
210
|
+
end
|
211
|
+
|
212
|
+
alias open_website open_web_page
|
213
|
+
alias goto open_web_page
|
214
|
+
alias visit open_web_page
|
215
|
+
|
85
216
|
def say_current_time(options={})
|
86
217
|
http_exec 'say-current-time'
|
87
218
|
end
|
@@ -107,6 +238,29 @@ module RemoteDroid
|
|
107
238
|
end
|
108
239
|
end
|
109
240
|
|
241
|
+
def set_auto_rotate(state=nil)
|
242
|
+
|
243
|
+
if state then
|
244
|
+
http_exec 'set-auto-rotate', {state: state}
|
245
|
+
else
|
246
|
+
|
247
|
+
def self.on()
|
248
|
+
http_exec 'set-auto-rotate', {state: 0}
|
249
|
+
end
|
250
|
+
|
251
|
+
def self.off()
|
252
|
+
http_exec 'set-auto-rotate', {state: 1}
|
253
|
+
end
|
254
|
+
|
255
|
+
def self.toggle()
|
256
|
+
http_exec 'set-auto-rotate', {state: 2}
|
257
|
+
end
|
258
|
+
|
259
|
+
self
|
260
|
+
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
110
264
|
def share_location(options={})
|
111
265
|
http_exec 'share-location'
|
112
266
|
end
|
@@ -139,6 +293,9 @@ module RemoteDroid
|
|
139
293
|
|
140
294
|
alias take_photo take_picture
|
141
295
|
|
296
|
+
def take_screenshot(options={})
|
297
|
+
http_exec 'take-screenshot', options
|
298
|
+
end
|
142
299
|
|
143
300
|
def toast(options={})
|
144
301
|
http_exec :toast, options
|
@@ -151,8 +308,36 @@ module RemoteDroid
|
|
151
308
|
def vibrate(options={})
|
152
309
|
http_exec :vibrate
|
153
310
|
end
|
311
|
+
|
312
|
+
def voice_search(options={})
|
313
|
+
http_exec 'voice-search'
|
314
|
+
end
|
154
315
|
|
155
|
-
|
316
|
+
def wifi()
|
317
|
+
|
318
|
+
def self.enable()
|
319
|
+
http_exec 'set-wifi', {state: 0}
|
320
|
+
end
|
321
|
+
|
322
|
+
def self.on()
|
323
|
+
self.enable
|
324
|
+
end
|
325
|
+
|
326
|
+
def self.disable()
|
327
|
+
http_exec 'set-wifi', {state: 1}
|
328
|
+
end
|
329
|
+
|
330
|
+
def self.off()
|
331
|
+
self.disable
|
332
|
+
end
|
333
|
+
|
334
|
+
def self.toggle()
|
335
|
+
http_exec 'set-wifi', {state: 2}
|
336
|
+
end
|
337
|
+
|
338
|
+
self
|
339
|
+
end
|
340
|
+
|
156
341
|
def write(s)
|
157
342
|
|
158
343
|
d = MacroDroid.new(RD_MACROS, deviceid: @deviceid,
|
data/lib/remotedroid/query.rb
CHANGED
@@ -33,6 +33,16 @@ module RemoteDroid
|
|
33
33
|
q(:ip)
|
34
34
|
end
|
35
35
|
|
36
|
+
def last_loc()
|
37
|
+
|
38
|
+
def self.alt() q(:last_loc_alt) end
|
39
|
+
def self.latlon() q(:last_latlong) end
|
40
|
+
def self.link() q(:last_loc_link) end
|
41
|
+
def self.time() q(:last_loc_age_timestamp) end
|
42
|
+
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
36
46
|
def location()
|
37
47
|
|
38
48
|
r = @callback.query(:location)
|
@@ -44,12 +54,42 @@ module RemoteDroid
|
|
44
54
|
@locations.shift if @locations.length > 1000
|
45
55
|
|
46
56
|
return r
|
57
|
+
end
|
58
|
+
|
59
|
+
def power_connected?()
|
60
|
+
status = q(:power)
|
61
|
+
status.downcase == 'on' if status
|
47
62
|
end
|
48
63
|
|
49
64
|
def take_picture()
|
50
65
|
@callback.query(:'take-picture')
|
51
66
|
end
|
52
67
|
|
68
|
+
def take_screenshot()
|
69
|
+
@callback.query(:'take-screenshot')
|
70
|
+
end
|
71
|
+
|
72
|
+
def volume(context=nil)
|
73
|
+
|
74
|
+
if context then
|
75
|
+
q(context)
|
76
|
+
else
|
77
|
+
|
78
|
+
def self.alarm() q(:vol_alarm) end
|
79
|
+
def self.bt_voice() q(:vol_bt_voice) end
|
80
|
+
def self.call() q(:vol_call) end
|
81
|
+
def self.music() q(:vol_music) end
|
82
|
+
def self.notify() q(:vol_notif) end
|
83
|
+
def self.system() q(:vol_system) end
|
84
|
+
|
85
|
+
self
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
alias vol volume
|
91
|
+
|
92
|
+
|
53
93
|
private
|
54
94
|
|
55
95
|
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.2
|
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-30 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
|