39
40
<link linkend="Device:update-time">'update-time'</link> read 't'
40
41
<link linkend="Device:type">'type'</link> read 's'
41
42
<link linkend="Device:power-supply">'power-supply'</link> read 'b'
43
<link linkend="Device:has-history">'has-history'</link> read 'b'
44
<link linkend="Device:has-statistics">'has-statistics'</link> read 'b'
42
45
<link linkend="Device:online">'online'</link> read 'b'
43
46
<link linkend="Device:energy">'energy'</link> read 'd'
44
47
<link linkend="Device:energy-empty">'energy-empty'</link> read 'd'
45
48
<link linkend="Device:energy-full">'energy-full'</link> read 'd'
46
49
<link linkend="Device:energy-full-design">'energy-full-design'</link> read 'd'
47
50
<link linkend="Device:energy-rate">'energy-rate'</link> read 'd'
51
<link linkend="Device:voltage">'voltage'</link> read 'd'
48
52
<link linkend="Device:time-to-empty">'time-to-empty'</link> read 'x'
49
53
<link linkend="Device:time-to-full">'time-to-full'</link> read 'x'
50
54
<link linkend="Device:percentage">'percentage'</link> read 'd'
63
TODO: some explanatory text etc. etc. Mention that we
64
collect history to provide more precise values of
65
time-to-empty, time-to-full. Go into detail
67
Objects implementing this interface are usually discovered through
68
the <literal>org.freedesktop.DeviceKit.Power</literal> interface on
69
the <literal>/org/freedesktop/DeviceKit/Power</literal> object on
70
the D-Bus system bus service with the well-known
71
name <literal>org.freedesktop.DeviceKit.Power</literal> using
73
<link linkend="Power.EnumerateDevices"><function>EnumerateDevices</function></link>
79
$ dbus-send --print-reply \
81
--dest=org.freedesktop.DeviceKit.Power \
82
/org/freedesktop/DeviceKit/Power/devices/battery_BAT0 \
83
org.freedesktop.DBus.Properties.GetAll \
84
string:org.freedesktop.DeviceKit.Power.Device
86
method return sender=:1.386 -> dest=:1.477 reply_serial=2
90
variant string "/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0"
98
variant string "42T4568"
102
variant string "4179"
106
variant uint64 1226417875
110
variant string "battery"
113
string "power-supply"
121
string "has-statistics"
126
variant boolean false
133
string "energy-empty"
141
string "energy-full-design"
150
variant double 16.415
153
string "time-to-empty"
157
string "time-to-full"
162
variant double 97.7197
170
variant string "fully-charged"
173
string "is-rechargeable"
182
variant string "lithium-ion"
69
189
Unless otherwise noted, an empty string or the value 0 in a
70
property means not set.
190
property on this interface means not set.
79
199
<variablelist role="params"/><refsect3><title>Errors</title><variablelist role="errors"><varlistentry><term><parameter>org.freedesktop.DeviceKit.Power.Device.GeneralError</parameter>:</term><listitem><simpara>if an error occured while refreshing</simpara></listitem></varlistentry></variablelist></refsect3><refsect3><title>Permissions</title><para role="permission">Callers need the org.freedesktop.devicekit.power.refresh-power-source authorization</para></refsect3><refsect2><title><anchor role="function" id="Device.GetHistory"/>GetHistory ()</title><indexterm><primary>GetHistory</primary><secondary>Device</secondary></indexterm><programlisting>GetHistory (in 's' type,
81
202
out 'a(uds)' data)</programlisting></refsect2>
83
204
Gets history for the power device that is persistent across reboots.
85
206
<variablelist role="params"><varlistentry><term><parameter>type</parameter>:</term><listitem><simpara>The type of history.
86
Valid types are rate or charge.</simpara></listitem></varlistentry><varlistentry><term><parameter>timespan</parameter>:</term><listitem><simpara>The amount of data to return in seconds, or 0 for all.</simpara></listitem></varlistentry><varlistentry><term><parameter>data</parameter>:</term><listitem><simpara>
207
Valid types are <literal>rate</literal> or <literal>charge</literal>.</simpara></listitem></varlistentry><varlistentry><term><parameter>timespan</parameter>:</term><listitem><simpara>The amount of data to return in seconds, or 0 for all.</simpara></listitem></varlistentry><varlistentry><term><parameter>resolution</parameter>:</term><listitem><simpara>
208
The approximate number of points to return.
209
A higher resolution is more accurate, at the expense of plotting speed.
210
</simpara></listitem></varlistentry><varlistentry><term><parameter>data</parameter>:</term><listitem><simpara>
87
211
The history data for the power device, if the device supports history.
88
212
Data is ordered from the earliest in time, to the newest data point.
89
213
Each element contains the following members:
90
214
<para><itemizedlist><listitem><emphasis role="bold">time: </emphasis>
91
The time value in seconds from the gettimeofday() method.
215
The time value in seconds from the <literal>gettimeofday()</literal> method.
92
216
</listitem><listitem><emphasis role="bold">value: </emphasis>
93
217
The data value, for instance the rate in W or the charge in %.
94
218
</listitem><listitem><emphasis role="bold">state: </emphasis>
95
The state of the device, for instance charging or
219
The state of the device, for instance <literal>charging</literal> or
220
<literal>discharging</literal>.
97
221
</listitem></itemizedlist></para>
98
222
</simpara></listitem></varlistentry></variablelist><refsect2><title><anchor role="function" id="Device.GetStatistics"/>GetStatistics ()</title><indexterm><primary>GetStatistics</primary><secondary>Device</secondary></indexterm><programlisting>GetStatistics (in 's' type,
99
223
out 'a(dd)' data)</programlisting></refsect2>
102
226
to show on a graph in the session.
104
228
<variablelist role="params"><varlistentry><term><parameter>type</parameter>:</term><listitem><simpara>The mode for the statistics.
105
Valid types are charging or discharging.</simpara></listitem></varlistentry><varlistentry><term><parameter>data</parameter>:</term><listitem><simpara>
229
Valid types are <literal>charging</literal> or <literal>discharging</literal>.</simpara></listitem></varlistentry><varlistentry><term><parameter>data</parameter>:</term><listitem><simpara>
106
230
The statistics data for the power device.
107
231
Each element contains the following members:
108
232
<para><itemizedlist><listitem><emphasis role="bold">value: </emphasis>
218
342
<variablelist role="params"/>
344
<title><anchor role="function" id="Device:has-history"/>The "has-history" property</title>
346
<primary>has-history</primary>
347
<secondary>Device</secondary>
349
<programlisting>'has-history' read 'b'
353
If the power device has history.
355
<variablelist role="params"/>
357
<title><anchor role="function" id="Device:has-statistics"/>The "has-statistics" property</title>
359
<primary>has-statistics</primary>
360
<secondary>Device</secondary>
362
<programlisting>'has-statistics' read 'b'
366
If the power device has statistics.
368
<variablelist role="params"/>
220
370
<title><anchor role="function" id="Device:online"/>The "online" property</title>
222
372
<primary>online</primary>
330
480
<variablelist role="params"/>
482
<title><anchor role="function" id="Device:voltage"/>The "voltage" property</title>
484
<primary>voltage</primary>
485
<secondary>Device</secondary>
487
<programlisting>'voltage' read 'd'
491
Voltage in the Cell or being recorded by the meter.
493
<variablelist role="params"/>
332
495
<title><anchor role="function" id="Device:time-to-empty"/>The "time-to-empty" property</title>
334
497
<primary>time-to-empty</primary>