mirror of
https://github.com/koreader/koreader
synced 2024-11-18 03:25:46 +00:00
27 lines
667 B
Lua
27 lines
667 B
Lua
local BasePowerD = require("ui/device/basepowerd")
|
|
|
|
local AndroidPowerD = BasePowerD:new{
|
|
batt_capacity_file = "/sys/class/power_supply/battery/capacity",
|
|
is_charging_file = "/sys/class/power_supply/battery/charging_enabled",
|
|
battCapacity = nil,
|
|
is_charging = nil,
|
|
}
|
|
|
|
function AndroidPowerD:init()
|
|
end
|
|
|
|
function AndroidPowerD:setIntensityHW()
|
|
end
|
|
|
|
function AndroidPowerD:getCapacityHW()
|
|
self.battCapacity = self:read_int_file(self.batt_capacity_file)
|
|
return self.battCapacity
|
|
end
|
|
|
|
function AndroidPowerD:isChargingHW()
|
|
self.is_charging = self:read_int_file(self.is_charging_file)
|
|
return self.is_charging == 1
|
|
end
|
|
|
|
return AndroidPowerD
|