- From: <Cathy.Chan@nokia.com>
- Date: Fri, 9 Sep 2011 20:59:53 +0000
- To: <robin@berjon.com>
- CC: <public-device-apis@w3.org>
- Message-ID: <A46437648ECB3D4F852B077AFF9099F50158AA6A@008-AM1MPN1-051.mgdnok.nokia.com>
I don't necessarily argue with that design and usage, but I would argue that it's not clearly presented. If there's room for misinterpretation, there's probably room for improvement. IMHO the confusion comes from basing the definition of a state (the status attribute) on the definition of a state change (the battery critical/low/ok events). To me, that seems a bit backward. I would rather define the exact conditions under which the status attribute is assigned each of the defined values, and define that the events are triggered when the value of the status attribute changes. Based on Robin's explanation and Anssi's battery events playground (which is very useful by the way, so thanks Anssi), my understanding is that for the status attribute: critical: isPlugged is false and level < critical_threshold low: isPlugged is false and critical_threshold < level < low_threshold ok: isPlugged is true or level > low_threshold null: level is null Those conditions should go into the definition for the status attribute. If I were allowed to pick one more nit, I would also say that the status attribute does more than "represents how much of the internal power source remains", as isPlugged also plays a role in its value. Regards, Cathy. -----Original Message----- From: ext Robin Berjon [mailto:robin@berjon.com] Sent: Thursday, September 08, 2011 5:02 AM To: Chan Cathy (Nokia-CIC/Boston) Cc: public-device-apis@w3.org Subject: Re: [battery] Still some questions on battery status Hi Cathy, On Sep 7, 2011, at 21:47 , <Cathy.Chan@nokia.com> <Cathy.Chan@nokia.com> wrote: > Further down in the definition for the batteryok event, the event is > to be dispatched when > [[ isPlugged changes its value to true ]] From this, the status could > not be "ok". What then should be the value of status? I think that you're drawing the wrong inference here. When isPlugged changes to true, batteryok is dispatched. But that doesn't mean that when isPlugged changes to false, then the status cannot be okay. Essentially: if isPlugged or level > low then status = ok > 2. Regarding isPlugged, the current prose is [[ Represents whether the > device is plugged in. If the device is plugged in and its battery is > being charged or is at its full capacity, then isPlugged must be set > to true, otherwise false. ]] What would be the value of isPlugged if > an implementation is only able to determine whether the device is > (literally) plugged in, but could not determine the power level or > status (i.e. it would set level=null and status=null)? Should it be > true or false? I guess that this shows up in cases in which the device is plugged in but does not have a battery. Quite a lot of devices support this (not to mention devices such as desktops and TVs that might not have a battery at all - for consistency one could want to still support this API there) so it should be defined. I think that if you're plugged in and either don't have a battery or can't determine its level, isPlugged should be true and status should be ok. -- Robin Berjon - http://berjon.com/ - @robinberjon
Received on Friday, 9 September 2011 21:00:36 UTC