Class: RemoteDroid::Control
- Inherits:
-
Object
- Object
- RemoteDroid::Control
show all
- Defined in:
- lib/remotedroid.rb
Instance Method Summary
collapse
Constructor Details
#initialize(dev = nil, deviceid: dev, remote_url: nil, debug: false) ⇒ Control
Returns a new instance of Control.
447
448
449
450
451
|
# File 'lib/remotedroid.rb', line 447
def initialize(dev=nil, deviceid: dev, remote_url: nil, debug: false)
@deviceid, @remote_url, @debug = deviceid, remote_url, debug
@torch = Torch.new(self)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
511
512
513
|
# File 'lib/remotedroid.rb', line 511
def method_missing(method_name, *args)
http_exec(method_name, args.first)
end
|
Instance Method Details
#bluetooth ⇒ Object
453
454
455
|
# File 'lib/remotedroid.rb', line 453
def bluetooth()
@bluetooth
end
|
#camera_flash_light(options = {}) ⇒ Object
457
458
459
|
# File 'lib/remotedroid.rb', line 457
def camera_flash_light(options={})
http_exec 'camera-flash-light', options
end
|
#http_exec(command, options = {}) ⇒ Object
461
462
463
464
465
466
467
468
469
470
471
472
473
|
# File 'lib/remotedroid.rb', line 461
def http_exec(command, options={})
url = "https://trigger.macrodroid.com/%s/%s" % [@deviceid, command]
if options and options.any? then
h = options
url += '?' + \
URI.escape(h.map {|key,value| "%s=%s" % [key, value]}.join('&'))
end
s = open(url).read
end
|
#location(options = {}) ⇒ Object
475
476
477
|
# File 'lib/remotedroid.rb', line 475
def location(options={})
http_exec 'location'
end
|
#say_current_time(options = {}) ⇒ Object
Also known as:
say_time
479
480
481
|
# File 'lib/remotedroid.rb', line 479
def say_current_time(options={})
http_exec 'say-current-time'
end
|
#share_location(options = {}) ⇒ Object
485
486
487
|
# File 'lib/remotedroid.rb', line 485
def share_location(options={})
http_exec 'share-location'
end
|
#speak_text(options = {}) ⇒ Object
489
490
491
|
# File 'lib/remotedroid.rb', line 489
def speak_text(options={})
http_exec 'speak-text', options
end
|
#toast(options = {}) ⇒ Object
493
494
495
|
# File 'lib/remotedroid.rb', line 493
def toast(options={})
http_exec :toast, options
end
|
#torch(options = {}) ⇒ Object
497
498
499
|
# File 'lib/remotedroid.rb', line 497
def torch(options={})
http_exec :torch
end
|
#write(s) ⇒ Object
Also known as:
export
502
503
504
505
506
507
|
# File 'lib/remotedroid.rb', line 502
def write(s)
MacroDroid.new(RD_MACROS, deviceid: @deviceid,
remote_url: @remote_url, debug: @debug).export s
end
|