W3C home > Mailing lists > Public > public-device-apis@w3.org > September 2011

[battery] battery{ok|critical|low} event triggers (was: Some questions about battery status API)

From: Anssi Kostiainen <anssi.kostiainen@nokia.com>
Date: Mon, 5 Sep 2011 14:10:31 +0300
Message-Id: <BC61B0CA-5FDA-4B39-BA15-F48596556993@nokia.com>
To: ext Kihong Kwon <kihong.kwon@samsung.com>, "public-device-apis@w3.org WG" <public-device-apis@w3.org>
Hi Kihong, All,

On 2.9.2011, at 13.51, ext Kihong Kwon wrote:

>>> Consider a meaning of 'ok' event, it have to be fired immediately after
>>> listener is added.(because device is already 'ok' state.)
>>> Is there any other case about 'full capacity'?
>> Perhaps a couple of lines of (pseudo) code could clarify what you mean by
>> this?
> OK! I am wonder the below sentence could be worked in real world.
> - the battery is plugged in, and the battery is being charged or is at its
> full capacity.
> Because if the battery is plugged in, and the battery is being charged then
> "ok" event will be fired. And then the event listener will be released,
> because one-time event handler. So if we suppose to this state(plugged and
> charged) is kept going until battery is full charged, then "ok" event have
> to be fired again regarding to the spec's description I indicated. But event
> handler was already release, therefore "ok" event will not be worked at this
> moment.

Ok, I got it. The intent is that in the above scenario the event will not be fired when the battery is fully charged presupposing the isPlugged state does not change at the same time.

> Suppose to it is in the charging state,
> Add 'batteryok' listener 
> -> Fire a 'ok' event immediately (SPEC: when the battery is plugged in, and
> the battery is being charged)

This is correct behavior.

> -> Battery is full charged
> -> After that a 'ok' event is fired again??? (SPEC: by the battery is
> plugged in and is at its full capacity)

No event is fired, because the isPlugged state does not change. I simplified the description of the battery{ok|critical|low} as follows:


And updated the latest Editor's Draft accordingly:


Does this make the behavior explicit?

Thanks for your feedback.

Received on Monday, 5 September 2011 11:11:05 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 14:53:50 UTC