Class: DeviceAPI::Android::Plugin::Battery

Inherits:
Object
  • Object
show all
Defined in:
lib/device_api/android/plugins/battery.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Battery

Returns a new instance of Battery.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/device_api/android/plugins/battery.rb', line 7

def initialize(options = {})
  qualifier = options[:qualifier]
  props = ADB.get_battery_info(qualifier)
  @current_temp   = props["temperature"]
  @max_temp       = props["mBatteryMaxTemp"]
  @max_current    = props["mBatteryMaxCurrent"]
  @voltage        = props["voltage"]
  @level          = props["level"]
  @health         = props["health"]
  @status         = props["status"]
end

Instance Attribute Details

#current_tempObject (readonly)

Returns the value of attribute current_temp.



5
6
7
# File 'lib/device_api/android/plugins/battery.rb', line 5

def current_temp
  @current_temp
end

#healthObject (readonly)

Returns the value of attribute health.



5
6
7
# File 'lib/device_api/android/plugins/battery.rb', line 5

def health
  @health
end

#levelObject (readonly)

Returns the value of attribute level.



5
6
7
# File 'lib/device_api/android/plugins/battery.rb', line 5

def level
  @level
end

#max_currentObject (readonly)

Returns the value of attribute max_current.



5
6
7
# File 'lib/device_api/android/plugins/battery.rb', line 5

def max_current
  @max_current
end

#max_tempObject (readonly)

Returns the value of attribute max_temp.



5
6
7
# File 'lib/device_api/android/plugins/battery.rb', line 5

def max_temp
  @max_temp
end

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/device_api/android/plugins/battery.rb', line 5

def status
  @status
end

#voltageObject (readonly)

Returns the value of attribute voltage.



5
6
7
# File 'lib/device_api/android/plugins/battery.rb', line 5

def voltage
  @voltage
end