2014-10-30 18:42:18 +00:00
|
|
|
local BasePowerD = require("device/generic/powerd")
|
2016-06-23 17:50:24 +00:00
|
|
|
local _, android = pcall(require, "android")
|
2014-07-15 08:23:38 +00:00
|
|
|
|
|
|
|
local AndroidPowerD = BasePowerD:new{
|
2016-06-23 17:50:24 +00:00
|
|
|
fl_min = 0, fl_max = 25,
|
|
|
|
fl_intensity = 10,
|
2014-07-15 08:23:38 +00:00
|
|
|
}
|
|
|
|
|
2017-08-08 06:29:57 +00:00
|
|
|
function AndroidPowerD:frontlightIntensityHW()
|
2017-09-23 21:58:34 +00:00
|
|
|
return math.floor(android.getScreenBrightness() / 255 * self.fl_max)
|
2014-07-15 08:23:38 +00:00
|
|
|
end
|
|
|
|
|
2017-06-15 22:27:04 +00:00
|
|
|
function AndroidPowerD:setIntensityHW(intensity)
|
2017-10-03 19:14:38 +00:00
|
|
|
android.setScreenBrightness(math.floor(255 * intensity / self.fl_max))
|
2014-07-15 08:23:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function AndroidPowerD:getCapacityHW()
|
2017-03-24 06:36:15 +00:00
|
|
|
return android.getBatteryLevel()
|
2014-07-15 08:23:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function AndroidPowerD:isChargingHW()
|
2017-03-24 06:36:15 +00:00
|
|
|
return android.isCharging()
|
2014-07-15 08:23:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return AndroidPowerD
|