mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-05 19:18:11 +02:00
export battery-capacity as it's a useful property of a battery
This commit is contained in:
parent
ec658f5d29
commit
4433bd3379
2 changed files with 26 additions and 0 deletions
|
|
@ -66,6 +66,7 @@ struct DevkitPowerSourcePrivate
|
|||
DevkitPowerState battery_state;
|
||||
DevkitPowerTechnology battery_technology;
|
||||
|
||||
double battery_capacity;
|
||||
double battery_energy;
|
||||
double battery_energy_empty;
|
||||
double battery_energy_full;
|
||||
|
|
@ -92,6 +93,7 @@ enum
|
|||
PROP_UPDATE_TIME,
|
||||
PROP_TYPE,
|
||||
PROP_LINE_POWER_ONLINE,
|
||||
PROP_BATTERY_CAPACITY,
|
||||
PROP_BATTERY_STATE,
|
||||
PROP_BATTERY_ENERGY,
|
||||
PROP_BATTERY_ENERGY_EMPTY,
|
||||
|
|
@ -155,6 +157,9 @@ get_property (GObject *object,
|
|||
case PROP_BATTERY_STATE:
|
||||
g_value_set_string (value, devkit_power_convert_state_to_text (source->priv->battery_state));
|
||||
break;
|
||||
case PROP_BATTERY_CAPACITY:
|
||||
g_value_set_double (value, source->priv->battery_capacity);
|
||||
break;
|
||||
case PROP_BATTERY_ENERGY:
|
||||
g_value_set_double (value, source->priv->battery_energy);
|
||||
break;
|
||||
|
|
@ -254,6 +259,10 @@ devkit_power_source_class_init (DevkitPowerSourceClass *klass)
|
|||
object_class,
|
||||
PROP_BATTERY_STATE,
|
||||
g_param_spec_string ("battery-state", NULL, NULL, NULL, G_PARAM_READABLE));
|
||||
g_object_class_install_property (
|
||||
object_class,
|
||||
PROP_BATTERY_CAPACITY,
|
||||
g_param_spec_double ("battery-capacity", NULL, NULL, 0, G_MAXDOUBLE, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (
|
||||
object_class,
|
||||
PROP_BATTERY_ENERGY_EMPTY,
|
||||
|
|
|
|||
|
|
@ -214,6 +214,23 @@
|
|||
</doc:para></doc:description></doc:doc>
|
||||
</property>
|
||||
|
||||
<property name="battery-capacity" type="d" access="read">
|
||||
<doc:doc><doc:description><doc:para>
|
||||
The capacity of the power source expressed as a percentage between 0 and 100.
|
||||
The capacity of the battery will reduce with age.
|
||||
A capacity value less than 75% is usually a sign that you should renew your battery.
|
||||
Typically this value is the same as
|
||||
(<doc:ref type="property" to="Source:battery-full-design">battery-full-design</doc:ref> /
|
||||
<doc:ref type="property" to="Source:battery-full">battery-full</doc:ref>) * 100.
|
||||
However, some primitive power sources are not capable reporting capacity
|
||||
and in this case the battery-capacity property will be unset.
|
||||
</doc:para><doc:para>
|
||||
This property is only valid if the property
|
||||
<doc:ref type="property" to="Source:type">type</doc:ref>
|
||||
has the value "battery".
|
||||
</doc:para></doc:description></doc:doc>
|
||||
</property>
|
||||
|
||||
<property name="battery-technology" type="s" access="read">
|
||||
<doc:doc><doc:description><doc:para>
|
||||
Technology used in the battery; known values are "lithium-ion", "lead-acid",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue