- From: Kostiainen, Anssi <anssi.kostiainen@intel.com>
- Date: Tue, 1 Jul 2014 09:31:05 +0000
- To: "Cathy.Chan@nokia.com" <Cathy.Chan@nokia.com>
- CC: "public-device-apis@w3.org" <public-device-apis@w3.org>, "mounir@lamouri.fr" <mounir@lamouri.fr>
Hi Cathy, On 26 Jun 2014, at 18:45, Cathy.Chan@nokia.com wrote: > There are now three different places in the latest ED that talk about the value to use if the implementation is unable to report the value of chargingTime, all in Section 6 BatteryManager Interface (https://dvcs.w3.org/hg/dap/raw-file/e6ca4e6b30f8/battery/Overview.html#batterymanager-interface). > > [[ > If the implementation is unable to report the battery status information for a particular attribute, the BatteryManager will emulate a fully charged battery by setting the attribute's value to a value that of the fully charged battery. > ]] > > [[ > When a BatteryManager object is created, if the implementation is unable to report the battery's: > charging state, the charging attribute MUST be set to true, > charging time, the chargingTime MUST be set to 0, > remaining time, the dischargingTime MUST be set to the value positive Infinity, > level, the level attribute must be set to 1.0. > ]] > > [[ > The chargingTime attribute MUST be set to 0, if the battery is full or there is no battery attached to the system, and to the value positive Infinity if the battery is discharging, the implementation is unable to report the remaining charging time while the battery is charging but not full, or otherwise. > ]] > > The first says that [at any time, I presume] if the implementation is unable to report the chargingTime, it is to be set to the value of a fully charged battery, i.e. 0. (By the way, that statement does not have a normative MUST.) > > The second says that *when a BatteryManager object is created*, if the implementation is unable to report the chargingTime, it MUST be set to 0. > > The third says that *while the battery is charging but not full*, if the implementation is unable to report the chargingTime, it MUST be set to positive Infinity. > > Obviously the last is inconsistent with the first. Since the first snippet was added by Anssi [1] after Mounir modified the third [2] to address one of my comments [3], we need Mounir's feedback on whether he agrees with the overall statement in the first snippet (in which case, the text in the third bit needs to be fixed). I updated the spec as per Tim’s and your feedback, which hopefully clarifies this. To summarise, the BatteryManager returned by the promise sets the chargingTime default to 0 along with other defaults to emulate full battery (note, after the latest update to the spec we’re setting all of them together). Any subsequent updates to the chargingTime may set the value to +Infinity instead. Reporting +Infinity at the later stage makes sense e.g. in this case: if (chargingTime < 3600) { // start an important operation that cannot be disturbed doStuff(); } If we’d set the chargingTime to 0, doStuff() would be invoked erroneously. OTOH, if chargingTime would be set to +Infinity (as currently spec’d), that would not happen. Please let us know if you have suggestions for further clarifications. Thanks, -Anssi > [1] https://dvcs.w3.org/hg/dap/rev/4c334400e0aa > [2] https://dvcs.w3.org/hg/dap/rev/a1f480a15e78 > [3] http://lists.w3.org/Archives/Public/public-device-apis/2014Jun/0034.html
Received on Tuesday, 1 July 2014 09:31:45 UTC