class RemoteDroid::Query

Attributes

locations[RW]

Public Class Methods

alarm() click to toggle source
# File lib/remotedroid/query.rb, line 78
def self.alarm()     q(:vol_alarm)    end
alt() click to toggle source
# File lib/remotedroid/query.rb, line 38
def self.alt()     q(:last_loc_alt)           end
bt_voice() click to toggle source
# File lib/remotedroid/query.rb, line 79
def self.bt_voice()  q(:vol_bt_voice) end
call() click to toggle source
# File lib/remotedroid/query.rb, line 80
def self.call()      q(:vol_call)     end
latlon() click to toggle source
# File lib/remotedroid/query.rb, line 39
def self.latlon()  q(:last_latlong)           end
music() click to toggle source
# File lib/remotedroid/query.rb, line 81
def self.music()     q(:vol_music)    end
new(device, callback) click to toggle source
# File lib/remotedroid/query.rb, line 7
def initialize(device, callback)
  @device, @callback = device, callback
  @locations = []
end
notify() click to toggle source
# File lib/remotedroid/query.rb, line 82
def self.notify()    q(:vol_notif)   end
system() click to toggle source
# File lib/remotedroid/query.rb, line 83
def self.system()    q(:vol_system)   end
time() click to toggle source
# File lib/remotedroid/query.rb, line 41
def self.time()    q(:last_loc_age_timestamp) end

Public Instance Methods

airplane_mode_enabled?() click to toggle source
# File lib/remotedroid/query.rb, line 12
def airplane_mode_enabled?()
  q(:airplane_mode_on).to_i > 0 
end
battery() click to toggle source
# File lib/remotedroid/query.rb, line 16
def battery()      
  q(:battery).to_i
end
brightness()
Alias for: current_brightness
cell_id() click to toggle source
# File lib/remotedroid/query.rb, line 26
def cell_id()      
  q(:cell_id)
end
Also aliased as: cell_tower
cell_tower()
Alias for: cell_id
current_brightness() click to toggle source
# File lib/remotedroid/query.rb, line 20
def current_brightness()      
  q(:current_brightness).to_i
end
Also aliased as: brightness
ip() click to toggle source
# File lib/remotedroid/query.rb, line 32
def ip()      
  q(:ip)
end
last_loc() click to toggle source
# File lib/remotedroid/query.rb, line 36
def last_loc()
  
  def self.alt()     q(:last_loc_alt)           end        
  def self.latlon()  q(:last_latlong)           end        
  def self.link()    q(:last_loc_link)          end        
  def self.time()    q(:last_loc_age_timestamp) end                
      
  self      
end
location() click to toggle source
# File lib/remotedroid/query.rb, line 46
def location()      
  
  r = @callback.query(@device, :location)
  return r if r.nil? or r.empty? or r[:coords].nil?
  
  r[:coords] = r[:coords].split(',')
  r[:time] = Time.parse(r[:time])
  @locations << r
  @locations.shift if @locations.length > 1000
  
  return r
end
power_connected?() click to toggle source
# File lib/remotedroid/query.rb, line 59
def power_connected?()
  status = q(:power)
  status.downcase == 'on' if status
end
take_picture() click to toggle source
# File lib/remotedroid/query.rb, line 64
def take_picture()      
  @callback.query(@device, :'take-picture')
end
take_screenshot() click to toggle source
# File lib/remotedroid/query.rb, line 68
def take_screenshot()      
  @callback.query(@device, :'take-screenshot')
end
vol(context=nil)
Alias for: volume
volume(context=nil) click to toggle source
# File lib/remotedroid/query.rb, line 72
def volume(context=nil)
  
  if context then
    q(context)
  else        
    
    def self.alarm()     q(:vol_alarm)    end        
    def self.bt_voice()  q(:vol_bt_voice) end
    def self.call()      q(:vol_call)     end          
    def self.music()     q(:vol_music)    end
    def self.notify()    q(:vol_notif)   end
    def self.system()    q(:vol_system)   end          
      
    self
    
  end
end
Also aliased as: vol

Private Instance Methods

q(id) click to toggle source
# File lib/remotedroid/query.rb, line 95
def q(id)
  @callback.query(@device, id)[id]
end