remotedroid 0.5.1 → 0.5.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 +85 -14
- data/lib/remotedroid/client.rb +12 -2
- data/lib/remotedroid/controller.rb +32 -12
- metadata +2 -2
- 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: 99592d4ac1baaef0d04b87d8bb9dd6cfcbdfc5572dacc39c6fabbd5a960f85f3
|
4
|
+
data.tar.gz: a5fbd36d797423dd183dccbb2351736ac58f706acf3b88932ae737d43e55a8e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 893732ed1fb124c982bdcd6b55d4d2f54acd9a32256d707cde13a13d86fb9547a9b126ab6200b98ed211ae739cf42e95136c5fe444fbd435646607b6e8fda9a7
|
7
|
+
data.tar.gz: a651dd655ab1dcb59549d7abd5d32a948f4fbf04ec134f9c35ff104ff7f9def9308a8f8acf9751e7cefa27e7ca4517af7e310a5603de6ab6a196271a1ca54b5c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/remotedroid.rb
CHANGED
@@ -305,72 +305,131 @@ m: In Vehicle
|
|
305
305
|
t:
|
306
306
|
Activity - In Vehicle
|
307
307
|
Confidence >= 50%
|
308
|
-
a:
|
308
|
+
a:
|
309
|
+
webhook
|
310
|
+
identifier: activity
|
311
|
+
index: 0
|
309
312
|
|
310
313
|
m: On Bicycle
|
311
314
|
t:
|
312
315
|
Activity - On Bicycle
|
313
316
|
Confidence >= 50%
|
314
|
-
a:
|
315
|
-
|
317
|
+
a:
|
318
|
+
webhook
|
319
|
+
identifier: activity
|
320
|
+
index: 1
|
321
|
+
|
316
322
|
m: Running
|
317
323
|
t:
|
318
324
|
Activity - Running
|
319
325
|
Confidence >= 50%
|
320
|
-
a:
|
326
|
+
a:
|
327
|
+
webhook
|
328
|
+
identifier: activity
|
329
|
+
index: 2
|
321
330
|
|
322
331
|
m: Walking
|
323
332
|
t:
|
324
333
|
Activity - Walking
|
325
334
|
Confidence >= 50%
|
326
|
-
a:
|
335
|
+
a:
|
336
|
+
webhook
|
337
|
+
identifier: activity
|
338
|
+
index: 3
|
327
339
|
|
328
340
|
m: Still
|
329
341
|
t:
|
330
342
|
Activity - Still
|
331
343
|
Confidence >= 83%
|
332
|
-
a:
|
333
|
-
|
344
|
+
a:
|
345
|
+
webhook
|
346
|
+
identifier: activity
|
347
|
+
index: 4
|
348
|
+
|
334
349
|
m: Swipe top left across
|
335
350
|
t:
|
336
351
|
Swipe Screen
|
337
352
|
Top Left - Across
|
338
|
-
a:
|
353
|
+
a:
|
354
|
+
webhook
|
355
|
+
identifier: swipe
|
356
|
+
start: 0
|
357
|
+
motion: 0
|
339
358
|
|
340
359
|
m: Swipe top left diagonal
|
341
360
|
t:
|
342
361
|
Swipe Screen
|
343
362
|
Top Left - Diagonal
|
344
|
-
a:
|
363
|
+
a:
|
364
|
+
webhook
|
365
|
+
identifier: swipe
|
366
|
+
start: 0
|
367
|
+
motion: 1
|
345
368
|
|
346
369
|
m: Swipe top left down
|
347
370
|
t:
|
348
371
|
Swipe Screen
|
349
372
|
Top Left - Down
|
350
|
-
a:
|
373
|
+
a:
|
374
|
+
webhook
|
375
|
+
identifier: swipe
|
376
|
+
start: 0
|
377
|
+
motion: 2
|
351
378
|
|
352
379
|
m: Swipe top right across
|
353
380
|
t:
|
354
381
|
Swipe Screen
|
355
382
|
Top Right - Across
|
356
|
-
a:
|
383
|
+
a:
|
384
|
+
webhook
|
385
|
+
identifier: swipe
|
386
|
+
start: 1
|
387
|
+
motion: 0
|
388
|
+
|
357
389
|
|
358
390
|
m: Swipe top right diagonal
|
359
391
|
t:
|
360
392
|
Swipe Screen
|
361
393
|
Top Right - Diagonal
|
362
|
-
a:
|
394
|
+
a:
|
395
|
+
webhook
|
396
|
+
identifier: swipe
|
397
|
+
start: 1
|
398
|
+
motion: 1
|
363
399
|
|
364
400
|
m: Swipe top right down
|
365
401
|
t:
|
366
402
|
Swipe Screen
|
367
403
|
Top Right - Down
|
368
|
-
a:
|
404
|
+
a:
|
405
|
+
webhook
|
406
|
+
identifier: swipe
|
407
|
+
start: 1
|
408
|
+
motion: 2
|
369
409
|
|
410
|
+
m: flip from up to down
|
411
|
+
t: Flip Device Face Up -> Face Down
|
412
|
+
a:
|
413
|
+
webhook
|
414
|
+
identifier: flip_device
|
415
|
+
facedown: true
|
370
416
|
|
417
|
+
m: flip from down to up
|
418
|
+
t: Flip Device Face Down -> Face Up
|
419
|
+
a:
|
420
|
+
webhook
|
421
|
+
identifier: flip_device
|
422
|
+
facedown: false
|
371
423
|
EOF
|
424
|
+
s="
|
425
|
+
|
426
|
+
|
372
427
|
|
373
428
|
|
429
|
+
|
430
|
+
|
431
|
+
"
|
432
|
+
|
374
433
|
module RemoteDroid
|
375
434
|
|
376
435
|
class Server
|
@@ -423,8 +482,20 @@ module RemoteDroid
|
|
423
482
|
|
424
483
|
context, json = msg.split(/:\s+/,2)
|
425
484
|
category, action = context.split('/',2)
|
426
|
-
|
485
|
+
|
486
|
+
if action == 'force_macro_run' then
|
487
|
+
|
488
|
+
self.notice 'macrodroid2: fmr'
|
489
|
+
a = @remote.run_macro(JSON.parse(json, symbolize_names: true))
|
490
|
+
|
491
|
+
a.each do |msg|
|
492
|
+
self.notice 'macrodroid/action: ' + msg
|
493
|
+
end
|
494
|
+
|
495
|
+
else
|
496
|
+
@remote.control.method(action.to_sym)\
|
427
497
|
.call(JSON.parse(json, symbolize_names: true))
|
498
|
+
end
|
428
499
|
|
429
500
|
end
|
430
501
|
|
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,6 +46,10 @@ 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
|
|
45
55
|
def battery()
|
@@ -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
|
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.5.
|
4
|
+
version: 0.5.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-21 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: onedrb
|
metadata.gz.sig
CHANGED
Binary file
|