battery.d v0.0.2

battery-d - simple library for reading battery info on linux laptops.
License:
MIT
Authors:
Azbuka
#
enum BatteryStatus: ubyte;
Current battery status
#
DISCHARGING
Discharging
#
CHARGING
Charging
#
FULL
Full (100%)
#
auto getBatteryList();
Gets list of all aviable batteries in system
Examples:
import std.array;
import battery.d;
getBatteryList().array; // ["BAT0"], laptops in general have only 1 battery
getBatteryList().front; // "BAT1"
Returns:
range of battery names
#
class BatteryException: object.Exception;
Battery exception. Thrown on errors.
#
class Battery;
Main battery class
#
this(string battery_name);
Constructor.
Parameters:
string battery_name name of battery (example: BAT0)
Throws:
BatteryException if there is no such battery
#
this();
Cunstructor. Uses first battery, returned by getBatteryList()
Throws:
battery exception, if no batteries found
#
void update();
Updates battery info
#
float level();
Current battery level. 0-100%
Returns:
current battery level in %
#
Duration timeUntilFull();
Time until battery is full. Duration.zero if battery full or discharging.
Returns:
time until battery is full
#
Duration timeRemaining();
Time remaining. Duration.zero if battery full or charging.
Returns:
time remaining
#
BatteryStatus status();
Current battery status.
Returns:
battery status
#
string[string] raw();
Raw battery data.
Returns:
raw battery data
#
string name();
Battery name.
Returns:
battery name