Class: RemoteDroid::Control
- Inherits:
-
Object
- Object
- RemoteDroid::Control
- Defined in:
- lib/remotedroid.rb
Instance Method Summary collapse
- #bluetooth ⇒ Object
- #camera_flash_light(options = {}) ⇒ Object
- #http_exec(command, options = {}) ⇒ Object
-
#initialize(dev = nil, deviceid: dev, remote_url: nil, debug: false) ⇒ Control
constructor
A new instance of Control.
- #location(options = {}) ⇒ Object
- #method_missing2(method_name, *args) ⇒ Object
- #say_current_time(options = {}) ⇒ Object (also: #say_time)
- #share_location(options = {}) ⇒ Object
- #speak_text(obj) ⇒ Object (also: #say)
- #toast(options = {}) ⇒ Object
- #torch(options = {}) ⇒ Object
- #vibrate(options = {}) ⇒ Object
- #write(s) ⇒ Object (also: #export)
Constructor Details
#initialize(dev = nil, deviceid: dev, remote_url: nil, debug: false) ⇒ Control
Returns a new instance of Control.
580 581 582 583 584 |
# File 'lib/remotedroid.rb', line 580 def initialize(dev=nil, deviceid: dev, remote_url: nil, debug: false) @deviceid, @remote_url, @debug = deviceid, remote_url, debug @torch = Torch.new(self) end |
Instance Method Details
#bluetooth ⇒ Object
586 587 588 |
# File 'lib/remotedroid.rb', line 586 def bluetooth() @bluetooth end |
#camera_flash_light(options = {}) ⇒ Object
590 591 592 |
# File 'lib/remotedroid.rb', line 590 def camera_flash_light(={}) http_exec 'camera-flash-light', end |
#http_exec(command, options = {}) ⇒ Object
594 595 596 597 598 599 600 601 602 603 604 605 606 |
# File 'lib/remotedroid.rb', line 594 def http_exec(command, ={}) url = "https://trigger.macrodroid.com/%s/%s" % [@deviceid, command] if and .any? then h = url += '?' + \ URI.escape(h.map {|key,value| "%s=%s" % [key, value]}.join('&')) end s = open(url).read end |
#location(options = {}) ⇒ Object
608 609 610 |
# File 'lib/remotedroid.rb', line 608 def location(={}) http_exec 'location' end |
#method_missing2(method_name, *args) ⇒ Object
658 659 660 |
# File 'lib/remotedroid.rb', line 658 def method_missing2(method_name, *args) http_exec(method_name, args.first) end |
#say_current_time(options = {}) ⇒ Object Also known as: say_time
612 613 614 |
# File 'lib/remotedroid.rb', line 612 def say_current_time(={}) http_exec 'say-current-time' end |
#share_location(options = {}) ⇒ Object
618 619 620 |
# File 'lib/remotedroid.rb', line 618 def share_location(={}) http_exec 'share-location' end |
#speak_text(obj) ⇒ Object Also known as: say
622 623 624 625 626 627 628 629 630 631 632 |
# File 'lib/remotedroid.rb', line 622 def speak_text(obj) = case obj when String {text: obj} when Hash obj end http_exec 'speak-text', end |
#toast(options = {}) ⇒ Object
636 637 638 |
# File 'lib/remotedroid.rb', line 636 def toast(={}) http_exec :toast, end |
#torch(options = {}) ⇒ Object
640 641 642 |
# File 'lib/remotedroid.rb', line 640 def torch(={}) http_exec :torch end |
#vibrate(options = {}) ⇒ Object
644 645 646 |
# File 'lib/remotedroid.rb', line 644 def vibrate(={}) http_exec :vibrate end |
#write(s) ⇒ Object Also known as: export
649 650 651 652 653 654 |
# File 'lib/remotedroid.rb', line 649 def write(s) MacroDroid.new(RD_MACROS, deviceid: @deviceid, remote_url: @remote_url, debug: @debug).export s end |