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.
451
452
453
454
455
|
# File 'lib/remotedroid.rb', line 451
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
515
516
517
|
# File 'lib/remotedroid.rb', line 515
def method_missing(method_name, *args)
http_exec(method_name, args.first)
end
|
Instance Method Details
#bluetooth ⇒ Object
457
458
459
|
# File 'lib/remotedroid.rb', line 457
def bluetooth()
@bluetooth
end
|
#camera_flash_light(options = {}) ⇒ Object
461
462
463
|
# File 'lib/remotedroid.rb', line 461
def camera_flash_light(options={})
http_exec 'camera-flash-light', options
end
|
#http_exec(command, options = {}) ⇒ Object
465
466
467
468
469
470
471
472
473
474
475
476
477
|
# File 'lib/remotedroid.rb', line 465
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
479
480
481
|
# File 'lib/remotedroid.rb', line 479
def location(options={})
http_exec 'location'
end
|
#say_current_time(options = {}) ⇒ Object
Also known as:
say_time
483
484
485
|
# File 'lib/remotedroid.rb', line 483
def say_current_time(options={})
http_exec 'say-current-time'
end
|
#share_location(options = {}) ⇒ Object
489
490
491
|
# File 'lib/remotedroid.rb', line 489
def share_location(options={})
http_exec 'share-location'
end
|
#speak_text(options = {}) ⇒ Object
493
494
495
|
# File 'lib/remotedroid.rb', line 493
def speak_text(options={})
http_exec 'speak-text', options
end
|
#toast(options = {}) ⇒ Object
497
498
499
|
# File 'lib/remotedroid.rb', line 497
def toast(options={})
http_exec :toast, options
end
|
#torch(options = {}) ⇒ Object
501
502
503
|
# File 'lib/remotedroid.rb', line 501
def torch(options={})
http_exec :torch
end
|
#write(s) ⇒ Object
Also known as:
export
506
507
508
509
510
511
|
# File 'lib/remotedroid.rb', line 506
def write(s)
MacroDroid.new(RD_MACROS, deviceid: @deviceid,
remote_url: @remote_url, debug: @debug).export s
end
|