W3C home > Mailing lists > Public > public-dap-commits@w3.org > January 2010

2009/dap/system-info Overview.html,1.57,1.58

From: Max Froumentin via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 21 Jan 2010 13:10:32 +0000
To: public-dap-commits@w3.org
Message-Id: <E1NXwnw-0007I7-Eq@lionel-hutz.w3.org>
Update of /sources/public/2009/dap/system-info
In directory hutz:/tmp/cvs-serv28007

Modified Files:
	Overview.html 
Log Message:
= implemented the simplification of ACTION-80
= added more examples
= small fixes for unspecified behaviour


Index: Overview.html
===================================================================
RCS file: /sources/public/2009/dap/system-info/Overview.html,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- Overview.html	18 Jan 2010 13:26:15 -0000	1.57
+++ Overview.html	21 Jan 2010 13:10:30 -0000	1.58
@@ -199,22 +199,18 @@
         <h2>The <a>SystemInfo</a> interface</h2>
         
         <p>This interface contains the functions that enable access to
-        the properties defined in the following sections. It is
-        exposed on the <code>navigator.device</code> object, as
-        defined in [[!CORE-DEVICE]].</p>
-
-        <p class='issue'>The actual object of which the API will be
-        hanging off is still under discussion
-        (e.g. <code>navigator.service</code> vs from
-        <code>navigator.device</code>); see <a
-        href="http://www.w3.org/2009/dap/track/issues/67">ISSUE-67</a></p>
-				
+        the properties defined in the following sections. Objects
+        implementing the Navigator interface (e.g. the
+        <code>window.navigator</code> object) must also implement the
+        NavigatorSystem interface [[!NAVIGATOR]]. An instance of
+        NavigatorSystem would then be obtained by using
+        binding-specific casting methods on an instance of
+        <code>Navigator</code>.</p>
 
-        <div class='idl' title='Service implements ServiceSystemInfo'></div> 
 
-        <dl title="[NoInterfaceObject] interface ServiceSystemInfo" class="idl">
+        <dl title="[NoInterfaceObject] interface NavigatorSystem" class="idl">
           <dt>readonly attribute SystemInfo system</dt> 
-					<dd>The root node from which the contacts functionality can be accessed.</dd> 
+					<dd>The root node from which the system information functionality can be accessed.</dd> 
         </dl>
 
         <dl title='[NoInterfaceObject] interface SystemInfo' class='idl'>
@@ -359,11 +355,16 @@
             <a>highThreshold</a> attribute is set to a value
             greater than 1.0 for the CpuLoad property.</dd>
 
-            <dt>const unsigned short READ_ONLY = 4</dt>
+            <dt>const unsigned short READ_ONLY = 3</dt>
             <dd>The property that has been passed to the
             <a>set</a> function that has triggered this callback
             cannot be modified.</dd>
 
+            <dt>const unsigned short TIMEOUT = 4</dt>
+            <dd>The length of time specified by the <a>timeout</a>
+            option has elapsed before the implementation could
+            successfully retrieve the requested property.</dd>
+
             <dt>readonly attribute unsigned short code</dt>
             <dd>The <a>code</a> attribute SHOULD contain one of the
             error values defined in this specification. An implementation MAY
@@ -390,23 +391,27 @@
             
             <dt>attribute double lowThreshold</dt>
             <dd>This attribute has no effect on the <a>get</a>
-            method. On the <a>watch</a> method, it indicates that
-            the successCallback is only be triggered if the property
-            is a number and its value is lower than or equal this
-            number.</dd>
+            method. On the <a>watch</a> method, it indicates that the
+            successCallback is only be triggered if the property is a
+            number and its value is lower than or equal this
+            number. If both <a>highThreshold</a> and
+            <a>lowThreshold</a> parameters are specified, the success
+            callback is triggered if and only if the property value is
+            either lower than the value of <a>lowThreshold</a> or
+            higher than the value of <a>hiThreshold</a>.</dd>
             
             <dt>attribute DOMString id</dt>
-            <dd>In order to
-            differentiate between instances, this attribute is used to
-            indicate the request's target instance. The list of available
-            identifiers would normally be retrieved first through querying
-            the relevant property (e.g. the <a>sources</a> attribute of
-            <a>CpuState</a>). If a property requested does not support
-            multiple instances and an <a>id</a> parameter is passed, then
-            it MUST be ignored. If a property does support multiple
-            instances and an <a>id</a> parameter is passed that does not
-            correspond to any existing instance, then the error callback
-            MUST be called with a <a>code</a> set to
+            <dd>In order to differentiate between instances, this
+            attribute is used to indicate the request's target
+            instance. The list of available identifiers would normally
+            be retrieved first through querying the relevant property
+            (e.g. the <a>sources</a> attribute of <a>CpuState</a>). If
+            a property requested does not support multiple instances
+            and an <a>id</a> parameter is passed, then it MUST be
+            ignored. If a property does support multiple instances and
+            an <a>id</a> parameter is passed that does not correspond
+            to any existing instance, then the error callback MUST be
+            called with a <a>code</a> set to
             <a>INVALID_VALUE</a>.</dd>
           </dl>
         </section>
@@ -430,14 +435,13 @@
       <section id="power">
         <h2>Power</h2>
 
-        <p>The properties below expose the device's power sources,
-        either internal (battery) or external.</p>
+        <p>The properties below expose the device's power information, either internal (battery) or external.</p>
 
         <section>
           <h4>ECMAScript Example</h4>
           <pre class="sh_javascript example">// Alert the user when the power level is below 20%
 
-navigator.service.system.watch("Power",success,null,{lowThreshold:0.2});
+navigator.system.watch("Power",success,null,{lowThreshold:0.2});
 
 function success(power) {
   alert("Low battery level: "+power.level);
@@ -466,56 +470,31 @@
             <dd>
               Represents the estimated time remaining in seconds
               before the system enters shutdown mode.  If
-              <a>usingExternalPowerSource</a> is <code>true</code>, this
+              <a>isExternal</a> is <code>true</code>, this
               value MUST be <code>null</code>, meaning that there is
               essentially infinite time remaining.
             </dd>
             
-            <dt>readonly attribute boolean externalSource</dt>
+            <dt>readonly attribute boolean isExternal</dt>
             <dd>
               If <code>true</code> the device is currently powered by an
               external source. If <code>false</code> the device is
               currently powered by an internal source.
             </dd>
 
-            <dt>readonly attribute PowerSource sources[]</dt>
-            <dd>A list of all the power sources connected to this device.</dd>
-
-          </dl>
-        </section>
-
-        <p class="issue">Do we need to enumerate power sources? See <a href="http://www.w3.org/mid/5AD14335-0471-45AF-95B1-FA114BF639F7@w3.org">discussion</a></p>
-
-        <section>
-          <h4>The <a>PowerSource</a> Property</h4>
-          <p>This property describes the state of a single power source connected to the system. It is <a>enumerable</a>.</p>
+            <dt>readonly attribute boolean isCharging</dt>
+            <dd>
+              Indicates whether the internal power source is currently
+              charging.  If <a>isExternal</a> is <code>false</code>,
+              this value MUST be <code>false</code>, meaning that the
+              battery is currently powering the system, and is
+              therefore depleting.
+            </dd>
 
-          <dl title="[NoInterfaceObject] interface PowerSource : SystemDevice" class="idl">
-            <dt>const unsigned short TYPE_UNKNOWN=0</dt>
-            <dd>In <code>type</code> has this value, then this power source is undetermined</dd>
-            
-            <dt>const unsigned short TYPE_BATTERY=1</dt>
-            <dd>In <code>type</code> has this value, then this power source is a battery</dd>
-            
-            <dt>const unsigned short TYPE_EXTERNAL=2</dt>
-            <dd>In <code>type</code> has this value, then this power source is external</dd>
 
-            <dt>readonly attribute unsigned short type</dt>
-            <dd>This attributes takes a value among the constants defined in this interface, indicating the type of power source that this object reflects.</dd>
-            
-            <dt>readonly attribute boolean? charging</dt>
-            <dd>If this source has <code>type</code> set to <code>EXTERNAL</code> then this value MUST be <code>null</code>. Otherwise if this source is charging, this value MUST be <code>true</code>, otherwise <code>false</code>.</dd>
-            
-            <dt>readonly attribute float? charge</dt>
-            <dd>If this source has <code>type</code> set to <code>EXTERNAL</code> then this value MUST be <code>null</code>, otherwise it MUST indicate how much of the battery capacity is left, on a range of 0 to this battery's <a>capacity</a> value, in ampere-hours.</dd>
-            
-            <dt>readonly attribute unsigned long? timeRemaining</dt>
-            <dd>If this source has <code>type</code> set to <code>EXTERNAL</code> then this value MUST be <code>null</code>, otherwise if this source is charging, this value MUST reflect the estimated time in seconds until the battery's <code>charge</code> reaches its <a>capacity</a>. If this source is not charging then this value MUST reflect the estimated time in seconds until the battery's <code>charge</code> reaches 0.</dd>
-            
-            <dt>readonly attribute float? capacity</dt>
-            <dd>If this source has <code>type</code> set to <code>EXTERNAL</code> then this value MUST be <code>null</code>, otherwise it MUST reflect this battery's capacity, expressed in ampere-hours</dd>
           </dl>
         </section>
+
       </section>
       
       <!--******************** /Power **********************************-->
@@ -527,27 +506,24 @@
         <p>This section defines interfaces that expose the system's
         CPU information, including type, specifications, current
         system load information.</p>
-        
+
         <section>
           <h4>ECMAScript Example</h4>
-          <pre class="sh_javascript example">//Monitor and display the CPU load, and show the frequency of each CPU
+          <pre class="sh_javascript example">//Monitor and display the CPU load
 
-navigator.device.system.watch("Processing",success);
+navigator.system.watch("Processing",success);
 
 function success(cpu) {
-  var s="CPU Status. Overall load: "+cpu.load+" - ";
-  for (var i=0;i&lt;cpu.units.length;i++) {
-    s+="CPU #"+i+": "+cpu.units[i].currentFrequency+" MHz, ";
-  }
-  document.getElementById("cpuIndicator").innerHTML=s;
+  var s="CPU load: "+cpu.load;
+  document.getElementById("cpuIndicator").innerHTML="CPU load: "+(cpu.load*100)+"%".
 }</pre>
         </section>
         
         <section>
-          <h4>The <a>Processing</a> Property</h4>
-          <p>This property reflects the state of all the CPUs available to this system.</p>
+          <h4>The <a>CPU</a> Property</h4>
+          <p>This property reflects the state of the CPUs available to this system.</p>
 
-          <dl title="[NoInterfaceObject] interface Processing" class="idl">
+          <dl title="[NoInterfaceObject] interface CPU" class="idl">
             <dt>readonly attribute float load</dt>
             <dd>
               This attribute indicates the current CPU load, as a
@@ -556,36 +532,8 @@
               threshold parameter used in a <a>watch</a> function to
               monitor this property applies to this attribute.
             </dd>
-            <dt>readonly attribute Cpu units[]</dt>
-            <dd>The list of available CPUs</dd>
           </dl>
         </section>
-        <section>
-          <h4>The <a>Cpu</a> Property</h4>
-
-          <p>This property contains the data pertaining to a single CPU on the system. It is <a>enumerable</a>.</p>
-
-          <dl title="[NoInterfaceObject] interface Cpu : SystemDevice" class="idl">
-            <dt>attribute float currentFrequency</dt>
-            <dd>
-              This attribute indicates the current frequency of this
-              CPU, in MHz. Although this property can be modified, not
-              all CPUs allow their speed to be throttled
-              directly. User agents SHOULD implement setting this
-              attribute so that the resulting CPU frequency is as
-              close as possible to the one requested.
-            </dd>
-            <dt>readonly attribute float maxFrequency</dt>
-            <dd>
-              This attribute indicates the maximum working frequency of this CPU (in MHz).
-            </dd>
-            <dt>readonly attribute float minFrequency</dt>
-            <dd>
-              This attribute indicates the minimum working frequency of this CPU (in MHz).
-            </dd>
-          </dl>
-
-        </section>
       </section>
       <!--******************** /CPU **********************************-->
 
@@ -598,12 +546,13 @@
         
         <section>
           <h4>ECMAScript Example</h4>
-          <pre class="sh_javascript example">// Display the temperature of the first thermometer
+          <pre class="sh_javascript example">// Check the thermal state and display a warning if it is above a certain level
 
-navigator.device.system.get("Thermal",success);
+navigator.system.get("Thermal",success);
 
 function success(thermal) {
-  document.getElementById("tempIndicator").innerHTML="Thermometer #1: "+thermal.thermometers[0].temperature;
+  if (thermal.state > 0.9)
+    document.getElementById("tempIndicator").style.background-color = "red";
 };</pre>
         </section>
         
@@ -622,121 +571,26 @@
               implementation-defined value should reflect the global
               temperature of the system.
             </dd>
-
-            <dt>readonly attribute Thermometer thermometers[]</dt>
-            <dd>The list of all the system's internal themometers</dd>
-          </dl>
-        </section>
-        <section>
-          <h4>The <a>Thermometer</a> property</h4>
-          <p>This property exposes the state of a single internal thermometer available to the system. It is <a>enumerable</a></p>
-
-          <dl title="[NoInterfaceObject] interface Thermometer : SystemDevice" class="idl">
-            <dt>readonly attribute float currentTemperature</dt>
-            <dd>This thermometer's current temperature, in degrees Celsius (°C)</dd>
-            <dt>readonly attribute float maxTemperature</dt>
-            <dd>The maximum temperature that this device can report, in degrees Celsius (°C)</dd>.
-            <dt>readonly attribute float minTemperature</dt>
-            <dd>The minimum temperature that this device can report, in degrees Celsius (°C)</dd>.
           </dl>
         </section>
       </section>
       <!--******************* /Thermal ****************************-->
 
-      <!--******************* Cooling ****************************-->
-      <section>
-        <h2>Cooling</h2>
-        <p>This property exposes the overall state of the system's active cooling devices (e.g. fans or pumps)</p>
-        
-        <section>
-          <h4>ECMAScript Example</h4>
-          <pre class="sh_javascript example">// If the temperature gets near the top, set all cooling devices to 1500 RPM
-          
-navigator.service.system.watch("Thermal", 
-                       function() {
-                         alert("Cooling system at more than 90% capacity. Engaging Fans");
-                         navigator.service.system.get("Cooling",function(cooling) {
-                           for (var i in cooling.devices)
-                             navigator.service.system.set("CoolingDevice",cooling.devices[i], {speed: 1500},null,null);
-                         })
-                       },
-                       null,
-                       {highThreshold:0.9});</pre>
-        </section>
-        
-        <section>
-          <h4>The <a>Cooling</a> property</h4>
-          
-          <dl title="[NoInterfaceObject] interface Cooling" class="idl">
-            <dt>readonly attribute float state</dt>
-            <dd>
-              This attribute indicates the current state of the cooling
-              system scaled to a 0 to 1 floating point range. A value of
-              0 means that the system is not running, and a value of 1
-              means that the system running at its maximum capacity.  On
-              devices that have multiple cooling devices, this value
-              should be an implementation-defined combination of the
-              state of each device.
-            </dd>
-            <dt>readonly attribute sequence &lt;CoolingDevice&gt; devices</dt>
-            <dd>The list of all the system's cooling devices.</dd>
-          </dl>
-        </section>
-        
-        <section>
-          <h4>The <a>CoolingDevice</a> property</h4>
-          
-          <p>This property provides information on a single cooling device in the system. It is <a>enumerable</a></p>
-          
-          <dl title="[NoInterfaceObject] interface CoolingDevice : SystemDevice" class="idl">
-            <dt>const unsigned short TYPE_UNKNOWN=0</dt>
-            <dd>A device of undetermined type.</dd>
-            <dt>const unsigned short TYPE_FAN=1</dt>
-            <dd>A cooling fan</dd>
-            <dt>const unsigned short TYPE_LIQUID=2</dt>
-            <dd>A liquid submersion cooling device</dd>
-            <dt>readonly attribute unsigned short type</dt>
-            <dd>This attributes takes a value among the constants defined in this interface, indicating the type of cooling device that this object reflects.</dd>
-            <dt>attribute float? speed</dt>
-            <dd>
-              If the type of this device is <a>TYPE_FAN</a>, the fan's
-              rotational speed (in <abbr title="Revolutions Per
-              Minute">RPM</abbr>), <code>null</code> otherwise.
-              Although this property can be modified, not all fans
-              allow their speed to be adjusted directly. User agents
-              SHOULD implement setting this attribute so that the
-              resulting speed is as close as possible to the one
-              requested.
-            </dd>
-          </dl>
-        </section>
-      </section>
-
-      <!--******************** /Cooling **********************************-->
-      
       <!--******************** Network **********************************-->
 
       <section>
         <h2>Network</h2>
         <p>This interface can be used by applications to determine the
-        network status of the device, and the available network
-        interfaces</p>
+        state of the network interface used by the system.</p>
 
         <section>
           <h4>ECMAScript Example</h4>
-          <pre class="sh_javascript example">// Find if the system has a WiFi connection, if so monitor its signal
-// First, find the first WiFi interface on the system
-
-navigator.service.system.get("Network",success,null);
+          <pre class="sh_javascript example">// Find if the current connection is WiFi, and if so monitor its signal strength
+navigator.system.get("Network",success,null);
 
 function success(connection) {
-  var nets = connection.availableConnections;
-  for (var i=0;i&lt;nets.length;i++) {
-    if (nets[i].type===nets[i].TYPE_IEEE802_11) {
-      // we found a wifi connection, watch it
-      navigator.service.system.watch("Connection",wifiWatchCB,null,{id: nets[i].id});
-    }
-  }
+  if (connection.type===connection.TYPE_IEEE802_11)
+    navigator.system.watch("WifiConnection",wifiWatchCB);
 }
 
 function wifiWatchCB(connection) {
@@ -750,32 +604,6 @@
           <p>This property provides information on the system's connection to the network</p>
 
           <dl title='[NoInterfaceObject] interface Network' class='idl'>
-            <dt>readonly attribute unsigned long currentDownloadBandwidth</dt>
-            <dd>
-              This current download bandwidth, in Kbits/s.
-            </dd>
-            
-            <dt>readonly attribute unsigned long currentUploadBandwidth</dt>
-            <dd>
-              This current upload bandwidth, in Kbits/s.
-            </dd>
-
-            <dt>readonly attribute Connection activeConnection</dt>
-            <dd>The current active connection among the ones reported by the <a>availableConnections</a> attribute.</dd>
-
-            <dt>readonly attribute Connection[] availableConnections</dt>
-            <dd>A list of all the connections available to this system.</dd>
-          </dl>
-        </section>
-
-        <section>
-          <h4>The <a>Connection</a> property</h4>
-          
-          <p>This property provides information on a single network
-          connection available to the system. It is
-          <a>enumerable</a>.</p>
-
-          <dl title="[NoInterfaceObject] interface Connection : SystemDevice" class="idl">
             <dt>const unsigned short TYPE_UNKNOWN = 0</dt>
             <dd>The API is unable to determine the network technology.</dd>
 
@@ -799,13 +627,11 @@
 
             <dt>const unsigned short TYPE_WiMAX = 7</dt>
             <dd>
-              Worldwide Interoperability for Microwave Access. The associated <a>Connection</a> object is a <a>CellularConnection</a> object.
-              NOTE: I'm not sure this is accurate. Do WiMAX connections have cellId and roaming concepts?
+              Worldwide Interoperability for Microwave Access.
             </dd>
             <dt>const unsigned short TYPE_iDEN = 8</dt>
             <dd>
               Integrated Digital Enhanced Connection.
-              <p>The associated <a>Connection</a> object is a <a>CellularConnection</a> object.</p>
             </dd>
             <dt>const unsigned short TYPE_TETRA = 9</dt>
             <dd>
@@ -832,36 +658,46 @@
             <dt>readonly attribute unsigned short type</dt>
             <dd>This attribute indicates the network technology in use on a network.</dd>
 
-            <dt>readonly attribute unsigned long minDownloadBandwidth</dt>
-            <dd>This property represents the min download bandwidth
-            offered by a network bearer measured in Kbits/s.</dd>
 
-            <dt>readonly attribute unsigned long minUploadBandwidth</dt>
-            <dd>This property represents the min upload bandwidth offered by a network bearer measured in Kbits/s.</dd>
+            <dt>readonly attribute unsigned long currentDownloadBandwidth</dt>
+            <dd>
+              The current real-time download bandwidth, in Kbits/s.
+            </dd>
+            
+            <dt>readonly attribute unsigned long currentUploadBandwidth</dt>
+            <dd>
+              The current real-time upload bandwidth, in Kbits/s.
+            </dd>
 
             <dt>readonly attribute unsigned long maxDownloadBandwidth</dt>
-            <dd>This property represents the max download bandwidth offered by a network bearer measured in Kbits/s.</dd>
+            <dd>This property represents the maximum download bandwidth offered by this network connection, measured in Kbits/s.</dd>
             
             <dt>readonly attribute unsigned long maxUploadBandwidth</dt>
-            <dd>This property represents the max upload bandwidth offered by a network bearer measured in Kbits/s.</dd>
+            <dd>This property represents the maximum upload bandwidth offered by this network connection, measured in Kbits/s.</dd>
 
             <dt>readonly attribute float? currentSignalStrength</dt>
             <dd>This connection's signal strength. This value MUST be <code>null</code> if this connection is wired.</dd>
 
             <dt>readonly attribute DOMString macAddress</dt>
-            <dd>The <abbr title="Media Access Control">MAC</abbr> address of this connection. The format of this string MUST be the standard notation for MAC addresses: six groups of two hexadecimal digits, separated by colons (:), e.g. 01:23:45:67:89:ab [[!IEEE802-3]]</dd>
+            <dd>The <abbr title="Media Access Control">MAC</abbr>
+            address of this connection. The format of this string MUST
+            be the standard notation for MAC addresses: six groups of
+            two hexadecimal digits, separated by colons (:),
+            e.g. 01:23:45:67:89:ab [[!IEEE802-3]]</dd>
 
-            <dt>readonly attribute DOMString? ipAddress</dt>
+            <dt>readonly attribute DOMString ipAddress</dt>
             <dd>
               The IP Address assigned to the device by the network bearer. An implementation 
               MUST support both IPv4 and IPv6.        
             </dd>
 
             <dt>readonly attribute DOMString? ESSID</dt>
-            <dd>The Extended Service Set Identifier (ESSID) if the type attribute is TYPE_IEE802.11, <code>null</code> otherwise.</dd>
+            <dd>The Extended Service Set Identifier (ESSID) if the
+            <a>type</a> attribute is TYPE_IEE802.11, <code>null</code>
+            otherwise.</dd>
 
             <dt>readonly attribute boolean? encrypted</dt>
-            <dd>Specifies whether this connection is encrypted.</dd>
+            <dd>This attribute is set to <code>true</code> if this connection is encrypted, <code>false</code> if it isn't, and <code>null</code> if the API is not able to determine if it is or isn't.</dd>
 
             <dt>readonly attribute DOMString? apn</dt>
             <dd>The Access Point Name associated to a network bearer, if applicable. <code>null</code> otherwise.</dd>
@@ -873,7 +709,7 @@
             <dd>Whether the connection is set up while the device is roaming, if applicable. <code>null</code> otherwise</dd>
           </dl>
 
-          <p class="issue">Should we gather all of GSM, GPRS, EDGE, CDMA, TETRA, UMTS under a singe "CELL" type? They could be differentiated by maxBandwidth, if needed.</p>
+        <p class="issue">Should we gather all of GSM, GPRS, EDGE, CDMA, TETRA, UMTS under a singe "CELL" type? They could be differentiated by maxBandwidth, if needed.</p>
         </section>
       </section>
       <!--******************** /Network **********************************-->
@@ -886,12 +722,16 @@
         <p>The properties defined below expose the values of external sensors, reflecting the device's environment such as temperature, ambient brightness or ambient sound.</p>
         <section>
           <h4>ECMAScript Example</h4>
-          <pre class="sh_javascript example">// Adjust the screen's brightness if the ambient brightness is above a certain level
+          <pre class="sh_javascript example">// Automatically adjust the screen brightness if the ambient brightness is above a certain level
 
-navigator.device.system.watch("AmbientLight",success, {maxThreshold: 0.9});
+navigator.system.watch("AmbientLight",success, {maxThreshold: 0.9});
 
 function success() {
-  navigator.device.system.set("Display",{brightness: 0.4});
+  navigator.system.get("OutputDevices", 
+                       function(devices) {
+                         for(var i=0; i&lt;devices.displays.length; i++)
+                           navigator.system.set("Display",{id: devices.displays[i].id, brightness: 0.9});
+                       });
 }</pre>
         </section>
 
@@ -906,23 +746,6 @@
             <dl title="[NoInterfaceObject] interface AmbientLight" class="idl">
               <dt>readonly attribute float intensity</dt>
               <dd>A normalised value representing the overall ambient light around the device. The way this value is determined should be an implementation-defined combination of the values reported by each ambient light sensor available.</dd>
-              <dt>readonly attribute AmbientLightSensor sensors[]</dt>
-              <dd>The list of all ambient light sensors available to this device</dd>
-            </dl>
-          </section>
-
-          <section>
-            <h5>The <a>AmbientLightSensor</a> Property</h5>
-
-            <p>This property provides information about a single external light sensor available to the system. It is <a>enumerable</a>.</p>
-
-            <dl title="[NoInterfaceObject] interface AmbientLightSensor : SystemDevice" class="idl">
-              <dt>readonly attribute float luminance</dt>
-              <dd>The luminance measured by this device, in candelas per square metre (cd/m<sup>2</sup>)</dd>.
-              <dt>readonly attribute float maxLuminance</dt>
-              <dd>The maximum luminance that this device can report, in candelas per square metre (cd/m<sup>2</sup>)</dd>.
-              <dt>readonly attribute float minLuminance</dt>
-              <dd>The minimum luminance that this device can report, in candelas per square metre (cd/m<sup>2</sup>)</dd>.
             </dl>
           </section>
         </section>
@@ -939,22 +762,6 @@
             <dl title="[NoInterfaceObject] interface AmbientNoise" class="idl">
               <dt>readonly attribute float value</dt>
               <dd>The ambient noise around the device, in decibels (dB), computed from the data provided by each sensor.  </dd>
-              <dt>readonly attribute AmbientNoiseSensor sensors[]</dt>
-              <dd>The list of all ambient noise sensors connected to this device.</dd>
-            </dl>
-          </section>
-          <section>
-            <h5>The <a>AmbientNoiseSensor</a> property</h5>
-
-            <p>This property provides information about a single ambient noise sensor available to the system. It is <a>enumerable.</a></p>
-
-            <dl title="[NoInterfaceObject] interface AmbientNoiseSensor : SystemDevice" class="idl">
-              <dt>readonly attribute float level</dt>
-              <dd>The noise level measured by this device, in decibels (dB)</dd>.
-              <dt>readonly attribute float maxLevel</dt>
-              <dd>The maximum noise level that this device can report, in decibels (dB)</dd>.
-              <dt>readonly attribute float minLevel</dt>
-              <dd>The minimum noise level that this device can report, in decibels (dB)</dd>.
             </dl>
           </section>
         </section>
@@ -970,9 +777,7 @@
 
             <dl title="[NoInterfaceObject] interface AmbientTemperature" class="idl">
               <dt>readonly attribute float value</dt>
-              <dd>This thermometer's current temperature, in degrees Celsius (°C)</dd>
-              <dt>readonly attribute Thermometer thermometers[]</dt>
-              <dd>The list of all external thermometers connected to this device</dd>
+              <dd>This current temperature around the device, in degrees Celsius (°C)</dd>
             </dl>
           </section>
         </section>
@@ -989,27 +794,9 @@
             <dl title="[NoInterfaceObject] interface AmbientAtmosphericPressure" class="idl">
               <dt>readonly attribute float pressure</dt>
               <dd>The estimated atmospheric pressure around this device, in kiloPascal (kPa)</dd>
-              <dt>readonly attribute Barometer barometers[]</dt>
-              <dd>The list of all the barometers connected to this device</dd>
             </dl>
           </section>
 
-          <section>
-            <h5>The <a>Barometer</a> Property</h5>
-
-            <p>This property provides information about a single
-            barometer available to the system. It is
-            <a>enumerable.</a></p>
-
-            <dl title="[NoInterfaceObject] interface Barometer : SystemDevice" class="idl">
-              <dt>readonly attribute float currentPressure</dt>
-              <dd>The current atmospheric pressure measured by this device, in kiloPascal (kPa)</dd>.
-              <dt>readonly attribute float maxLevel</dt>
-              <dd>The maximum atmospheric pressure that this device can report, in kiloPascal (kPa)</dd>
-              <dt>readonly attribute float minLevel</dt>
-              <dd>The minimum atmospheric pressure that this device can report, in kiloPascal (kPa)</dd>
-            </dl>
-          </section>
         </section>
 
         <!-- ==== Proximity ==== -->
@@ -1018,33 +805,10 @@
           <h4>Proximity</h4>
           <section>
             <h5>The <a>Proximity</a> Property</h5>
-
             <p>This property provides information about the distance of objects around the device.</p>
-
             <dl title="[NoInterfaceObject] interface Proximity" class="idl">
               <dt>readonly attribute float distance</dt>
               <dd>The distance from the device to the nearest object, as determined by this device's proximity sensors, in meters (m)</dd>
-              <dt>readonly attribute ProximitySensor sensors[]</dt>
-              <dd>The list of all proximity sensors available to this device</dd>
-            </dl>
-          </section>
-
-          <section>
-            <h4>The <a>ProximitySensor</a> Property</h4>
-
-            <p>This property provides information about a single
-            proximity sensor available to the system. It is
-            <a>enumerable</a>.</p>
-
-            <dl title="[NoInterfaceObject] interface ProximitySensor : SystemDevice" class="idl">
-              <dt>readonly attribute float distance</dt>
-              <dd>The distance between this sensor and the nearest object, in meters</dd>.
-
-              <dt>readonly attribute float minProximity</dt>
-              <dd>The maximum proximity that this device can report, in meters</dd>
-
-              <dt>readonly attribute float maxProximity</dt>
-              <dd>The minimum proximity that this device can report, in meters</dd>
             </dl>
           </section>
         </section>
@@ -1059,7 +823,17 @@
 
         <section>
           <h4>ECMAScript Example</h4>
-          <pre class="sh_javascript example"></pre>
+          <pre class="sh_javascript example">// Find if this device supports MIDI
+navigator.system.get("AVCodecs",success);
+
+function success(codecs) {
+  for (var i=0;i&lt;codecs.length;i++)
+    if (codecs[i].compFormat === "MP3") {
+      // ... use MP3 for encoding ...
+      break;
+    }
+}
+</pre>
         </section>
         <section>
           <h4>The <a>AVCodecs</a> property</h4>
@@ -1143,14 +917,27 @@
             </dl>
           </section>
         </section>
-
         <!-- ********* /Codecs ************************************************************** -->
+
         <!-- ********* Storage ************************************************************** -->
         <section>
           <h3>Storage</h3>
           <p>This set of properties expose a device's storage units and their properties, like type (hard Disk, memory card, etc.) and capacity</p>
 
           <section>
+            <h4>ECMAScript Example</h4>
+            <pre class="sh_javascript example">// Check each storage and warn if almost full 
+            
+navigator.system.get("Storage", success);
+            
+function success(units) {
+  for (var i=0;i&lt;units.length;i++)
+    if (units[i].capacity / units[i].availableCapacity &gt; 0.95)
+      alert("Storage unit '"+units[i].info+"' almost full. You may want to free some space.");
+}</pre>
+          </section>
+
+          <section>
             <h4>The <a>Storage</a> Property</h4>
             <p>This property exposes the data storage devices connected to this system.</p>
             <dl title="interface Storage" class="idl">
@@ -1196,9 +983,21 @@
           <p class="issue">Do we need information about active devices, e.g. in order to be able to see which screen is currently being in use, or to control which set of speakers should be activated? If so how do we specify it? Through an "active" flag on each device (hard to watch), or through a pointer (e.g. currentDisplay in OutputDevices) which would mean only one device is active at a time, which might not always be correct in cases like several active keyboards</p>
           
           <section>
+            <h4>ECMAScript Example</h4>
+            <pre class="sh_javascript example">// Set the brightness of all the displays to their maximum value
+
+navigator.system.get("OutputDevices", 
+                     function(devices) {
+                       for(var i=0; i&lt;devices.displays.length; i++)
+                         navigator.system.set("Display",{id: devices.displays[i].id, brightness: 1});
+                     });</pre>
+          </section>
+
+
+          <section>
             <h4>The <a>OutputDevices</a> Property</h4>
               
-            <p>This property provides information on the output devices (displays, sound) available on this system</p>
+            <p>This property provides information on the output devices (displays, audio) available on this system</p>
               
             <dl title='[NoInterfaceObject] interface OutputDevices' class='idl'>
               <dt>readonly attribute Display displays[]</dt>
@@ -1292,6 +1091,22 @@
           
           <p class="issue">Should we have a notion of active or selected device, e.g. which camera is currently used, or which display is the one currently drawn on. We could use current* like with Power, but that restricts to one active device at a time. Alternatively, there could be an active flag in each device. But that would make watch() messy, since we would have to extend the definition of watched events to sub-sub-field modifications</p>
 
+
+          <section>
+            <h4>ECMAScript Example</h4>
+            <pre class="sh_javascript example">// Check if the device supports multitouch
+
+navigator.system.get("InputDevices", 
+                     function(devices) {
+                       for(var i=0; i&lt;devices.pointingDevices.length; i++)
+                         if (devices.pointingDevices[i].supportsMultiTouch) {
+                           applicationParams.hazMultiTouch = true;
+                           break;
+                         }
+                     });</pre>
+          </section>
+
+
           <section>
             <h3>The <a>InputDevices</a> Property</h3>
             
Received on Thursday, 21 January 2010 13:10:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 21 January 2010 13:10:36 GMT