<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated on Sat, 26 May 2012 05:36:13 -0700 -->
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <atom:link href="http://software.intel.com/en-us/articles/whatif/type/tutorials/feed/" rel="self" type="application/rss+xml" />
    <title>Intel Software Network articles Feed</title>
    <link>http://software.intel.com/en-us/articles/whatif/type/tutorials/</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>Intel Web API Connector Documentation and Examples</title>
      <description><![CDATA[ <p>
The Intel Web API Connector manages the installation of other Intel Web APIs.
Once the Connector is installed, other Intel Web APIs can be downloaded and
installed without a browser restart.
</p>

<div >
<a name="Contents">Contents</a>
</div>
<div >
  <ul>
    <li>
      <a href="http://software.intel.com#Overview">Overview</a>
    </li>
    <li>
      <a href="http://software.intel.com#Browser and Device Compatibility">Browser and Device Compatibility</a>
    </li>
    <li>
      <a href="http://software.intel.com#A code sample to get you started">A code sample to get you started</a>
    </li>
    <li>
      <a href="http://software.intel.com#JavaScript API Details">JavaScript API Details</a>
    </li>
    <li>
      <a href="http://software.intel.com#Attributions">Attributions</a>
    </li>
    <li>
      <a href="http://software.intel.com#See it working">See it working in this page!</a>
    </li>
  </ul>
</div>

<br/>
<div >
  <a name="Overview">Overview</a>
</div>
<div >
    <p>
    The Intel Web APIs are implemented as browser plugins.  In order to 
    avoid requiring the viewers of web pages with these plugins to individually
    download and install the plugins, the Connector simplifies this chore
    without compromising the viewer's control and security.
    </p>
    <p>
    When first visting a site using Intel Web APIs, the viewer of the page
    will be directed to install the Connector.  This installation is like any
    other plugin installation - download the installer, run it, and restart
    the browser.  After this, however, the viewer experiences much different
    behavior with Intel Web API web pages.  Upon subsequent visits to a page
    with Intel Web APIs, the web page will request that the Connector download
    and install any required Intel Web APIs.  This occurs without the viewer
    performing the steps manually - so no longer does the viewer need to
    download, run, and restart. 
    </p>
    <p>
    Instead, after the Connector is installed, the viewer will be prompted to
    allow or deny each web site requesting other Intel Web APIs.  This ensures the viewer
    remains in control of which web sites can and cannot use Intel Web APIs
    on his or her machine. The Connector allows the viewer to establish both
    per-session and permenant whitelists and blacklists.  In otherwords, known
    good and known bad sites.
    </p>
    <p>
    In addition to viewer-controlled white and black lists, the Connector also
    refuses to download and install plugins that are not digitally signed by
    the folks here at Intel working on Intel Web APIs - we don't want a rouge
    web site to instruct the Connector to download any random plugin!
    </p>
</div>

<br/>
<div >
<a name="Browser and Device Compatibility">Browser and Device Compatibility</a>
</div>
<div >
  <p>
  The table below lists some compatability notes for browser and operating system combinations.
  </p>
  <p>
  If you are interested in seeing these APIs available on other device types and operating systems 
  please let us know by <a href="http://software.intel.com/en-us/articles/intel-web-api-connector-documentation-and-examples">leaving comments</a>.
  </p>
  <table >
    <tr>
      <th >Browser</th><th >Operating System</th><th >Notes</th>
    </tr>
    <tr>
      <td>Firefox 3.5.x, 3.6.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Chrome 4.0.x.y</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Safari 4.0.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Opera v 10.x </td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Not currently working. It's on the debug todo list.</td>
    </tr>
    <tr>
      <td>Internet Explorer 8.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Not supported yet. Its on the todo list though.</td>
    </tr>
    <tr>
      <td>Firefox, Chrome, Safari</td>
      <td>Linux, MacOS</td>
      <td>Not supported yet. Linux and Mac OS porting is underway :)</td>
    </tr>
  </table>
</div>

<br/>
<div >
  <a name="A code sample to get you started">A code sample to get you started</a>
</div>
<div >
<p>
  This HTML & JavaScript shows you how to embed the Intel Connector Web API
  into your app.
</p>
<pre >
  &lt;div id="IntelWebAPIs_sample_code_status_div" 
    &gt;&lt;/div&gt;
  &lt;script 
    type="text/javascript" 
    src="http://software.intel.com/sites/whatif/webapis/intelwebapis.js"&gt;
  &lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
  
    // this outer closure just to keep the sample code from cluttering up
    // the namespace with the function names etc being used
    (function() {
      
      //kick off IntelWebAPIs.init() and IntelWebAPIs.require() when
      //the page is loaded
      add_onload_handler( function() {
  
        IntelWebAPIs.init(init_result_func);
        
        //called by IntelWebAPIs.init()
        function init_result_func(result) {
          if(result.success) {
            // now bring in Intel Web APIs required by your app...
            output_status("IntelWebAPIs Connector init success: version " +
                          IntelWebAPIs.connector.version);
          }
          else {
            output_status("IntelWebAPIs Connector init error: " + result.error.msg);
            //handle error condition
            //result.error.msg contains an error message
            //result.connectorInstUrl contains the url to the Intel Web API connector installer
            output_status("you may need to download the Intel Web API connector from here: " + 
              result.connectorInstUrl);
          }
        }
      });     
      
      /* Its recommended that you wait until the document is loaded 
         before calling IntelWebAPIs.init() and IntelWebAPIs.require() 
         This utility helps with that...*/
      function add_onload_handler(addfunc, altwindow) {
        var targwindow = window;
        if(typeof(altwindow) != 'undefined'){
          targwindow = altwindow;
        }
        
        /* chain the onload functions together */
        var prevf = targwindow.onload;
        var newf  = addfunc;
        targwindow.onload = function(){
            newf();
            if(typeof(prevf) == 'function'){
              prevf();
            }
          };
      }
      
      /* utility that outputs status messages to a div*/
      function output_status(str) {
        var divout = document.getElementById("IntelWebAPIs_sample_code_status_div");
        divout.innerHTML += str + "&lt;br/&gt;";
        divout.scrollTop = divout.scrollHeight;
      }
    })(); // end of outer closure
  &lt;/script&gt;
</pre>
<br/>
<p>
  Th Object that is passed into callback for the init() function is formatted
  as follows:<br/>
</p>

<pre >
  result = { 
    success           : boolean,
    
    // these fields are valid if success != true
    connectorInstUrl  : string 
    error             : {
      msg             : string 
    } 
  }
</pre>
  If the Intel Web API Connector is not yet installed on a user's device you can
  use the result.connectorInstUrl to prompt the user, in the context of your
  app, to install it.<br/> 
  Once the Intel Web API Connector is installed other apis are installed by the
  connector, with minimal user interruption, when your app calls IntelWebAPIs.require().

<br/>
</div>

<br/>
<div >
<a name="JavaScript API Details">JavaScript API Details</a>
</div>
<div >
These are the properties and methods exposed by the connector Web API:<br/><br/>
<pre >
  IntelWebAPIs.connector = {
    'version'     : string
  };
</pre>
<br/>
<div >
<a name="IntelWebAPIs.connector.version">IntelWebAPIs.connector.version</a>
</div>
<div>
This is the API's version string. It is formatted as "major.minor.patch" where major
and minor are numbers and patch is a string.  The connector will auto-update
itself during each require() call.
</div>
<br/>
</div>
<div >
  <a name="Attributions">Attributions</a>
</div>
<div >
    <p>
    Intel Connector Web API uses the following software components:
    </p>
    <ul>
      <li>
        OpenSSL:
        
        This product includes software developed by the OpenSSL Project for use 
        in the OpenSSL Toolkit (http://www.openssl.org/).
        
        Copyright (c) 1998-2008 The OpenSSL Project.  All rights reserved. 
      </li>
      <li>
        JSONXX:
        
        Copyright (c) 2010 Hong Jiang

        Permission is hereby granted, free of charge, to any person
        obtaining a copy of this software and associated documentation
        files (the "Software"), to deal in the Software without
        restriction, including without limitation the rights to use,
        copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the
        Software is furnished to do so, subject to the following
        conditions:

        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.
      </li>
    </p>
</div>
<br/>
<div >
<a name="See it working" href="http://software.intel.com/sites/whatif/webapis/api/connector">See it working in this page!</a>
</div>
 ]]></description>
      <link>http://software.intel.com/en-us/articles/intel-web-api-connector-documentation-and-examples/</link>
      <pubDate>Wed, 07 Apr 2010 00:00:00 -0700</pubDate>
      <comments>http://software.intel.com/en-us/articles/intel-web-api-connector-documentation-and-examples/#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/intel-web-api-connector-documentation-and-examples/</guid>
      <category>What If Experimental Software</category>
      <category>Code &amp; Downloads</category>
    </item>
    <item>
      <title>Intel Connection Web API Documentation and Examples</title>
      <description><![CDATA[ <p>
The Intel Connection Web API provides web developers with JavaScript access to 
information about the device's connection state.
</p>

<div >
<a name="Contents">Contents</a>
</div>
<div >
  <ul>
    <li>
      <a href="http://software.intel.com#Overview">Overview</a>
    </li>
    <li>
      <a href="http://software.intel.com#Browser and Device Compatibility">Browser and Device Compatibility</a>
    </li>
    <li>
      <a href="http://software.intel.com#A code sample to get you started">A code sample to get you started</a>
    </li>
    <li>
      <a href="http://software.intel.com#JavaScript API Details">JavaScript API Details</a>
    </li>
    <li>
      <a href="http://software.intel.com#See it working">See it working in this page!</a>
    </li>
  </ul>
</div>

<br/>
<div >
  <a name="Overview">Overview</a>
</div>
<div >
    <p>
    When web apps have the ability to learn about the characteristics of the device's 
    network connection they are be able to make use of that information to 
    create a better experience for the user.
    </p>
    <p>
    For instance, in combination with other information about the device, a web 
    app might use connection information to request a video stream which is approprate
    for the device's current bandwidth capability. A web app may determine that
    current signal strength is not sufficient for the app to function appropriatly
    for the desired user experience - and may prompt the user re-orient the device
    or move closer to a wireless access point. 
    </p>
</div>

<br/>
<div >
<a name="Browser and Device Compatibility">Browser and Device Compatibility</a>
</div>
<div >
  <p>
  The table below lists some compatability notes for browser and operating system combinations.
  </p>
  <p>
  If you are interested in seeing these APIs available on other device types and operating systems 
  please let us know by <a href="http://software.intel.com/en-us/articles/intel-connection-web-api-documentation-and-examples">leaving comments</a>.
  </p>
  <table >
    <tr>
      <th >Browser</th><th >Operating System</th><th >Notes</th>
    </tr>
    <tr>
      <td>Firefox 3.5.x, 3.6.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Chrome 4.0.x.y</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Safari 4.0.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Opera v 10.x </td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Not currently working. It's on the debug todo list.</td>
    </tr>
    <tr>
      <td>Internet Explorer 8.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Not supported yet. Its on the todo list though.</td>
    </tr>
    <tr>
      <td>Firefox, Chrome, Safari</td>
      <td>Linux, MacOS</td>
      <td>Not supported yet. Linux and Mac OS porting is underway :)</td>
    </tr>
  </table>
</div>

<br/>
<div >
  <a name="A code sample to get you started">A code sample to get you started</a>
</div>
<div >
<p>
  This HTML & JavaScript shows you how to embed the Intel Connection Web API
  into your app.
</p>
<pre >
  &lt;div id="IntelWebAPIs_sample_code_status_div" 
    &gt;&lt;/div&gt;
  &lt;script 
    type="text/javascript" 
    src="http://software.intel.com/sites/whatif/webapis/intelwebapis.js"&gt;
  &lt;/script&gt;
  &lt;script type="text/javascript"&gt;

    // this outer closure just to keep the sample code from cluttering up
    // the namespace with the function names etc being used
    (function() {
      
      //kick off IntelWebAPIs.init() and IntelWebAPIs.require() when
      //the page is loaded
      add_onload_handler( function() {

        IntelWebAPIs.init(init_result_func);
        
        //called by IntelWebAPIs.init()
        function init_result_func(result) {
          if(result.success) {
            // now bring in Intel Web APIs required by your app...
            output_status("IntelWebAPIs Connector init success");
            IntelWebAPIs.require(["connection"], require_completion_func, require_progress_func);
          }
          else {
            output_status("IntelWebAPIs Connector init error: " + result.error.msg);
            //handle error condition
            //result.error.msg contains an error message
            //result.connectorInstUrl contains the url to the Intel Web API connector installer
            output_status("you may need to download the Intel Web API connector from here: " + 
              result.connectorInstUrl);
          }
        }
    
        //called by IntelWebAPIs.require()
        function require_completion_func(result) {
          if(result.success){
            //you can now use IntelWebAPIs.connection properties and functions
            output_status("IntelWebAPIs." + result.installInfo.plugins[0].name + " ready for use!");
            setInterval(function(){
              // send a status message to our div every second
              var connInfo = IntelWebAPIs.connection.getConnectionInfo();
              output_status("Wifi connected=" + connInfo.wifi.connected);
              output_status("Wifi signal strength=" + connInfo.wifi.signalStrength);
            },1000);
          }
          else {
            //check other result properties and handle error condition
            output_status("IntelWebAPIs error: " + result.installInfo.msg);
          }
        }
        
        //called by IntelWebAPIs.require()
        function require_progress_func(statusMsg){
          //statusMsg is a string - send this wherever
          output_status("IntelWebAPIs connector status: " + statusMsg);
        }
      
      });
      
      /* Its recommended that you wait until the document is loaded 
         before calling IntelWebAPIs.init() and IntelWebAPIs.require() 
         This utility helps with that...*/
      function add_onload_handler(addfunc, altwindow) {
        var targwindow = window;
        if(typeof(altwindow) != 'undefined'){
          targwindow = altwindow;
        }
        
        /* chain the onload functions together */
        var prevf = targwindow.onload;
        var newf  = addfunc;
        targwindow.onload = function(){
            newf();
            if(typeof(prevf) == 'function'){
              prevf();
            }
          };
      }
      
      /* utility that outputs status messages to a div*/
      function output_status(str) {
        var divout = document.getElementById("IntelWebAPIs_sample_code_status_div");
        divout.innerHTML += str + "&lt;br/&gt;";
        divout.scrollTop = divout.scrollHeight;
      }
    })(); // end of outer closure
  &lt;/script&gt;
</pre>
<br/>
<p>
  This is the result Object that is passed into init_result_func(result).<br/>
  If the Intel Web API Connector is not yet installed on a user's device you can
  use the result.connectorInstUrl to prompt the user, in the context of your
  app, to install it.<br/> 
  Once the Intel Web API Connector is installed other apis are installed by the
  connector, with minimal user interruption, when your app calls IntelWebAPIs.require().
</p>

<pre >
  result = { 
    success           : boolean,
    
    // these fields are valid if success != true
    connectorInstUrl  : string 
    error             : {
      msg             : string 
    } 
  }
</pre>
<br/>
This is the result Object that is passed into require_completion_func(result).<br/><br/>
<pre >
  result = { 
    success       : boolean,
    
    installInfo   : {
      msg         : string,
      
      plugins     : [ { 
        name      : string,
        installed : boolean,
        details   : string
        }, 
        //...
      ], 
    }
  }  
</pre>
</div>

<br/>
<div >
<a name="JavaScript API Details">JavaScript API Details</a>
</div>
<div >
These are the properties and functions exposed by the Connection Web API:<br/><br/>
<pre >
  IntelWebAPIs.connection = {
    'version'             : string,
    'connected'           : boolean,
    'getConnectionInfo'   : function
  };
</pre>
<br/>
<div >
<a name="IntelWebAPIs.connection.version">IntelWebAPIs.connection.version</a>
</div>
<div>
This is the API's version string. It is formatted as "major.minor.patch" where major
and minor are numbers and patch is a string.
</div>
<br/>
<div >
<a name="IntelWebAPIs.connection.connected">IntelWebAPIs.connection.connected</a>
</div>
<div>
The IntelWebAPIs.connection.connected property indicates if the device is connected
to a network or not. true for connected, false otherwise.
</div>
<br/>
<div >
<a name=IntelWebAPIs.connection.getConnectionInfo">IntelWebAPIs.connection.getConnectionInfo()</a>
</div>
<div>
The IntelWebAPIs.connection.getConnectionInfo() function returns an Object with information about
the current connection.<br/>
<pre >
  connectionInfo =  {
    'lan'         : {
      'connected'       : boolean,
      'signalStrength'  : number,     //will be 100 if connected, 0 if not connected
      'linkSpeed'       : number      //kbps in 100bps or 0 if unknown or disconnected
    },
    'wifi'        : {
      'connected'       : boolean
      'signalStrength'  : number,     //RSSI signal strength as a percent or -1 if unknown. 
                                      // signal strength is 0 when disconnected.
      'linkSpeed'       : number      //kbps in 100bps or 0 if unknown or disconnected
    }
  }
</pre>
</div>
<br/><br/>
These JavaScript functions demonstrate accessing the connection information:
<br/><br/>
<pre >
  function output_connected(){
    alert("connected = " + IntelWebAPIs.connection.connected);      
  }
  
  function output_connection_info() {
    var conninfo = IntelWebAPIs.connection.getConnectionInfo();
    alert("lan.connected="        + conninfo['lan']['connected']);  
    alert("lan.signalStrength="   + conninfo['lan']['signalStrength']);
    alert("lan.linkSpeed="        + conninfo['lan']['linkSpeed']);

    alert("wifi.connected="       + conninfo['wifi']['connected']);  
    alert("wifi.signalStrength="  + conninfo['wifi']['signalStrength']);
    alert("wifi.linkSpeed="       + conninfo['wifi']['linkSpeed']);
  }
</pre>
</div>
<br/><br/>
<div >
<a name="See it working" href="http://software.intel.com/sites/whatif/webapis/api/connection">See it working in this page!</a>
</div>
 ]]></description>
      <link>http://software.intel.com/en-us/articles/intel-connection-web-api-documentation-and-examples/</link>
      <pubDate>Wed, 10 Feb 2010 00:00:00 -0800</pubDate>
      <comments>http://software.intel.com/en-us/articles/intel-connection-web-api-documentation-and-examples/#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/intel-connection-web-api-documentation-and-examples/</guid>
      <category>What If Experimental Software</category>
      <category>Code &amp; Downloads</category>
    </item>
    <item>
      <title>CPU / Power / Connection Video Mashup</title>
      <description><![CDATA[ <div >
<a name="Contents">Contents</a>
</div>
<div >
  <ul>
    <li>
      <a href="http://software.intel.com#Overview">Overview</a>
    </li>
    <li>
      <a href="http://software.intel.com/sites/whatif/webapis/mashup/cpcvideo/mashup.html">
        Check out the mashup!</a>
    </li>
  </ul>
</div>
<br/>
<div >
  <a name="Overview">Overview</a>
</div>
<div >
  <p>
    This mashup demonstrates using the Intel CPU/Power/Connection Indicator Widget 
    in a page that includes a video player.
  </p>
  <p>
    The goal of the mashup is to help the user avoid a choppy and/or interrupted viewing
    experience - due to CPU load being too high, too little battery time remaining
    or poor network signal strength.
  </p>
</div>

<br/>
<div >
  <a name="Check out the mashup">Check out the mashup!</a>
</div>
<div >
  <p>
  We put the mashup in its own page to give it a more "realistic" look and feel :)<br/>
  When you go to the page be sure to look at the page source to see how we embedded
  the widget and player. To see other examples of how to embed the CPU Power Connection Indicator
  widget go to the widget's page 
  <a href="http://software.intel.com/sites/whatif/webapis/widget/cpc">here</a>.
  </p>
  <a href="http://software.intel.com/sites/whatif/webapis/mashup/cpcvideo/mashup.html">
    Click here to go to the mashup page</a>
</div>
 ]]></description>
      <link>http://software.intel.com/en-us/articles/cpupowerconnection-video-mashup/</link>
      <pubDate>Wed, 10 Feb 2010 00:00:00 -0800</pubDate>
      <comments>http://software.intel.com/en-us/articles/cpupowerconnection-video-mashup/#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/cpupowerconnection-video-mashup/</guid>
      <category>What If Experimental Software</category>
    </item>
    <item>
      <title>The Intel CPU / Power / Connection Indicator Widget</title>
      <description><![CDATA[ <p>
This widget incorporates the CPU, Power and Connection Web APIs into a widget 
that provides a simple user experience indicator. Thumbs up predicts a good 
experience, thumbs down predicts a poor experience.
</p>

<div >
<a name="Contents">Contents</a>
</div>
<div >
  <ul>
    <li>
      <a href="http://software.intel.com#Embedding the widget in your page">Embedding the widget in your page</a>
    </li>
    <li>
      <a href="http://software.intel.com#Browser and Device Compatibility">Browser and Device Compatibility</a>
    </li>
    <li>
      <a href="http://software.intel.com#See it working">See it working in this page!</a>
    </li>
  </ul>
</div>

<br/>
<div >
  <a name="Embedding the widget in your page">Embedding the widget in your page</a>
</div>
<div >
  <p>
  Here is the HTML & JavaScript for the widget up and running. The widget will display a UI with
  images for CPU, Power and Connection status and also provide a thumbs up / thumbs
  down image that represents an experience prediction.<br/>
  The widget will update itself every 5 second.
  </p>
<pre >
    &lt;div id="cpci_div"&gt;&lt;/div&gt;
    &lt;script type="text/javascript" 
      src="http://software.intel.com/sites/whatif/webapis/intelwebapis.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" 
      src="http://software.intel.com/sites/whatif/webapis/widget/cpc/IntelCPCIWidget.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
    (function() {
      //basic mode
      var theIntelCpciInst = new IntelCPCIWidget('cpci_div');
    })();
    &lt;/script&gt;
</pre>
<br/>
  <p>
  This HTML & JavaScript changes how often the widget is updated
  </p>
<pre >
    &lt;div id="cpci_div"&gt;&lt;/div&gt;
    &lt;script type="text/javascript" 
      src="http://software.intel.com/sites/whatif/webapis/intelwebapis.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" 
      src="http://software.intel.com/sites/whatif/webapis/widget/cpc/IntelCPCIWidget.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
    (function() {
      //modified update interval - updates every 1 second instead of default 5
      var theIntelCpciInst = new IntelCPCIWidget('cpci_div',{'updateInt':1});
    })();
    &lt;/script&gt;
</pre>
<br/>
  <p>
  This HTML & JavaScript passes in another user defined element ID (div) to
  receive debug messages. Handy when first incorporating the widget into 
  a page.
  </p>
<pre >
    &lt;div id="cpci_div"&gt;&lt;/div&gt;
    &lt;div id="cpci_debug_div"&gt;&lt;/div&gt;
    &lt;script type="text/javascript" 
      src="http://software.intel.com/sites/whatif/webapis/intelwebapis.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" 
      src="http://software.intel.com/sites/whatif/webapis/widget/cpc/IntelCPCIWidget.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
    (function() {
      //pass a debug element id for debug messages
      var theIntelCpciInst = new IntelCPCIWidget('cpci_div',{'updateInt':1,'debugElId':'cpci_debug_div'});
    })();
    &lt;/script&gt;
</pre>
<br/>
  <p>
  This HTML & JavaScript shows how to disable the widget UI and have updates
  sent to your JavaScript function so that you can implement your own
  completely custom UI. You should replace the code in the myUpdateCB function
  with your code.
  </p>
<pre >
    &lt;div id="cpci_div"&gt;&lt;/div&gt;
    &lt;div id="cpci_debug_div"&gt;&lt;/div&gt;
    &lt;script type="text/javascript" 
      src="http://software.intel.com/sites/whatif/webapis/intelwebapis.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" 
      src="http://software.intel.com/sites/whatif/webapis/widget/cpc/IntelCPCIWidget.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
    (function() {
      //disable the default widget UI and add a update callback for a custom ui
      var theIntelCpciInst = new IntelCPCIWidget('cpci_div',{'updateInt':1,
        'debugElId':'cpci_debug_div','uiEnable': false,'updateCB':myUpdateCB});
      
      function myUpdateCB(currInfo) {
        //do something with currInfo.cpu, currInfo.power, currInfo.connection
        var customUiEl = document.getElementById("cpci_div");
        customUiEl.innerHTML = "Custom UI:&lt;br/&gt;";
        var cpuLoad = Math.round((IntelWebAPIs.cpu.load * 100) * 100)/100;
        var connState = currInfo.connection.connected;
        var drawEl = document.createElement("pre");
        drawEl.innerHTML = "CPU Name: " + currInfo.cpu.name + "\r\n";
        drawEl.innerHTML += "CPU Load: " + cpuLoad + " %\r\n";
        drawEl.innerHTML += "Network Connected: " + connState + "\r\n";
        
        if(connState){
          var conninfo = currInfo.connection.getConnectionInfo();
          var connInfoHtml = "Connection Info:" + "\r\n";
          if(conninfo.lan.connected){
            connInfoHtml += "  lan.connected=" + 
              conninfo['lan']['connected'] + "\r\n";
            connInfoHtml += "  lan.signalStrength=" +
              conninfo['lan']['signalStrength'] + "\r\n";
            connInfoHtml += "  lan.linkSpeed=" +
              ((conninfo['lan']['linkSpeed']*100)/1000/1000) + " Mbps" + "\r\n";
          }
          if(conninfo.wifi.connected){
            connInfoHtml += "  wifi.connected=" +
              conninfo['wifi']['connected'] + "\r\n";
            connInfoHtml += "  wifi.signalStrength=" +
              conninfo['wifi']['signalStrength'] + "\r\n";
            connInfoHtml += "  wifi.linkSpeed=" +
              ((conninfo['wifi']['linkSpeed']*100)/1000/1000) + " Mbps" + "\r\n";
          }
          drawEl.innerHTML += connInfoHtml  + "\r\n";
        }
        
        if(currInfo.power.usingExternalPowerSource) {
          drawEl.innerHTML += "Device power: External / wall power" + "\r\n";; 
        }
        else {
          drawEl.innerHTML += "Device power: Battery" + "\r\n";
          drawEl.innerHTML += "Device battery level: " + currInfo.power.powerLevel + " %" + "\r\n";
          drawEl.innerHTML += "Device battery time : " + 
            Math.round((currInfo.power.timeRemaining / 60)) + " minutes" + "\r\n";
        }
        customUiEl.appendChild(drawEl);
      }
      
    })();
    &lt;/script&gt;
</pre>
</div>

<br/>
<div >
<a name="Browser and Device Compatibility">Browser and Device Compatibility</a>
</div>
<div >
  <p>
  The table below lists some compatability notes for browser and operating system combinations.
  This widget is currently beta quality.
  </p>
  <p>
  If you are interested in seeing these APIs available on other device types and operating systems 
  please let us know by <a href="http://software.intel.com/en-us/articles/the-intel-cpu-power-connection-indicator-widget">leaving comments</a>.
  </p>
  <table >
    <tr>
      <th >Browser</th><th >Operating System</th><th >Notes</th>
    </tr>
    <tr>
      <td>Firefox 3.5.x, 3.6.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Chrome 4.0.x.y</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Safari 4.0.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Opera v 10.x </td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Not currently working. It's on the debug todo list.</td>
    </tr>
    <tr>
      <td>Internet Explorer 8.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Not supported yet. Its on the todo list though.</td>
    </tr>
    <tr>
      <td>Firefox, Chrome, Safari</td>
      <td>Linux, MacOS</td>
      <td>Not supported yet. Linux and Mac OS porting is underway :)</td>
    </tr>
  </table>
</div>
<br/><br/>
<div >
<a name="See it working" href="http://software.intel.com/sites/whatif/webapis/widget/cpc">See it working in this page!</a>
</div>
 ]]></description>
      <link>http://software.intel.com/en-us/articles/the-intel-cpu-power-connection-indicator-widget/</link>
      <pubDate>Wed, 10 Feb 2010 00:00:00 -0800</pubDate>
      <comments>http://software.intel.com/en-us/articles/the-intel-cpu-power-connection-indicator-widget/#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/the-intel-cpu-power-connection-indicator-widget/</guid>
      <category>What If Experimental Software</category>
      <category>Code &amp; Downloads</category>
    </item>
    <item>
      <title>Intel Web APIs Registry Widget Documentation and Examples</title>
      <description><![CDATA[ <p>
This widget provides an easy way for sites that follow and discuss Web APIs
to embed the Intel Web APIs registry. The Intel Web APIs registry contains
a list of Intel's Web APIs, widgets and Mashups.<br/>
This widget is running on
the <a href="http://software.intel.com/sites/whatif/webapis/">Intel Web APIs home page</a>.
</p>

<div >
<a name="Contents">Contents</a>
</div>
<div >
  <ul>
    <li>
      <a href="http://software.intel.com#Embedding the widget in your page">
        Embedding the widget in your page.</a>
    </li>
    <li>
      <a href="http://software.intel.com#Accessing the Intel Web API Registry data directly">
        Accessing the Intel Web API Registry data directly</a>
    </li>
    <li>
      <a href="http://software.intel.com#Browser and Device Compatibility">
        Browser and Device Compatibility</a>
    </li>
  </ul>
</div>
<br/>
<div >
  <a name="Embedding the widget in your page">Embedding the widget in your page</a>
</div>
<div >
  <p>
  Here is the HTML & JavaScript to get the widget up and running.
  </p>
<pre >
  &lt;div id="IntelWebAPIs_div"&gt;&lt;/div&gt;
  &lt;script type="text/javascript" 
    src="http://software.intel.com/sites/whatif/webapis/IntelWebAPIsRegistry.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
    (function(){
      var webApiRegistryCtrl = new IntelWebAPIsRegistryWidget('IntelWebAPIs_div',{'statusbar':false});
    })();
  &lt;/script&gt;
</pre>
<br/>
  <p>
  This HTML & JavaScript changes how many columns are displayed using the 'maxcolumns' configuration option.
  </p>
<pre >
  &lt;div id="IntelWebAPIs_div"&gt;&lt;/div&gt;
  &lt;script type="text/javascript" 
    src="http://software.intel.com/sites/whatif/webapis/IntelWebAPIsRegistry.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
    (function(){
        var webApiRegistryCtrl = new IntelWebAPIsRegistryWidget('IntelWebAPIs_div',
          {'maxcolumns':1,'statusbar':false});
    })();
  &lt;/script&gt;
</pre>
</div>

<br/>
<div >
  <a name="Accessing the Intel Web API Registry data directly">
    Accessing the Intel Web API Registry data directly</a>
</div>
<div >
  <p>
  You can add a script node to your page as follows and then access the data
  through a JavaScript Object. This javascript object is the same data
  that is available in the JSON data below.
  </p>
<br/>
<pre >
  &lt;script type="text/javascript" 
    src="http://software.intel.com/sites/whatif/webapis/IntelWebAPIsRegistryData.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
    (function(){
        var regDataObj = new IntelWebAPIsRegistryData();
        //do something with regDataObj or inspect in a DOM debug tool
        //window.check_this_stuff = regDataObj;
    })();
  &lt;/script&gt;
</pre>
<br/>
  <p>
    You can also access the JSON data directly. This might be useful from
    server side PHP code or even stand alone app code can can handle JSON.
  </p>
<pre >
  http://software.intel.com/sites/whatif/webapis/intelwebapis_reg.json
</pre>
<br/>
  <p>
    This is the data that is available as JSON or through IntelWebAPIsRegistryData.js:
  </p>
<pre >
  registry_data = {
    'version'   : string, // format major.minor.patch, ex: '1.0.0'
    'language'  : string, // language ex: en-us

    //array of strings
    //unique identifier of the api or widget or mashup in the registry
    //for each name in this array there is a key 
    //with the same value in the details object below
    'names'     : [
      string,
      //more names ...
    ],

    //details object : each key in this object matches a name in the names
    //array above.
    'details'   : {
      'entry_name' : {                // unique identifier of this entry - same as value in names array.
        'uid'           : string,     // unique identifier of this entry - 
                                      //   same as name 'string_name' of this object
        'type'          : string,     // type of this entry: api|widget|mashup
        'friendly_name' : string,     // friendly text name of entry
        'friendly_desc' : string,     // long description of entry
        'version'       : string,     // major.minor.patch_string
        'add_date'      : string,     // date formated as '02/09/2010'
        'update_date'   : string,     // date formated as '02/09/2010'
        'website'       : string,     // url for website of this entry
        'license'       : string,     // url of the license / terms of entry
        // archive object:
        // contains paths to plugin archives for OS/plugin type combinations
        'archive' : {
          'win32-npapi' :'./api/cpu/cpu-win32-npapi.iwa',
          'win32-ie'    :'./api/cpu/cpu-win32-ie.iwa',
          'mac'         :''
        },
        'imgs' : {
          'thumb'       : string,     // file name of thumbnail for this entry    - relative to website url
          'screenshot'  : string,     // file name of screen shot for this entry  - relative to website url
        }        
        //more entries ...
      },
    }
  }
</pre>  
</div>

<br/>
<div >
<a name="Browser and Device Compatibility">Browser and Device Compatibility</a>
</div>
<div >
  <p>
  The table below lists compatability notes for browser and operating system combinations.
  This widget is currently beta quality.
  </p>
  <table >
    <tr>
      <th >Browser</th><th >Operating System</th><th >Notes</th>
    </tr>
    <tr>
      <td>Firefox 3.5.x, 3.6.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Chrome 4.0.x.y</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Opera v 10.x </td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Internet Explorer 8.x (compatibility view OFF)</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Safari 4.0.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Firefox, Chrome, Safari</td>
      <td>Linux, MacOS</td>
      <td>Not tested yet - but "should work" ;) More to be done here in the future.</td>
    </tr>
  </table>
</div>
<br/><br/>
<div >
<a name="See it working" href="http://software.intel.com/sites/whatif/webapis/widget/cpc">See it working in this page!</a>
</div>
 ]]></description>
      <link>http://software.intel.com/en-us/articles/intel-web-apis-registry-widget-documentation-and-examples/</link>
      <pubDate>Wed, 10 Feb 2010 00:00:00 -0800</pubDate>
      <comments>http://software.intel.com/en-us/articles/intel-web-apis-registry-widget-documentation-and-examples/#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/intel-web-apis-registry-widget-documentation-and-examples/</guid>
      <category>What If Experimental Software</category>
      <category>Code &amp; Downloads</category>
    </item>
    <item>
      <title>Intel Power Web API Documentation and Examples</title>
      <description><![CDATA[ <p>
The Intel Power Web API provides a web app with JavaScript access to 
information about the devices power and battery state.
</p>

<div >
<a name="Contents">Contents</a>
</div>
<div >
  <ul>
    <li>
      <a href="http://software.intel.com#Overview">Overview</a>
    </li>
    <li>
      <a href="http://software.intel.com#Browser and Device Compatibility">Browser and Device Compatibility</a>
    </li>
    <li>
      <a href="http://software.intel.com#A code sample to get you started">A code sample to get you started</a>
    </li>
    <li>
      <a href="http://software.intel.com#JavaScript API Details">JavaScript API Details</a>
    </li>
    <li>
      <a href="http://software.intel.com#See it working">See it working in this page!</a>
    </li>
  </ul>
</div>

<br/>
<div >
  <a name="Overview">Overview</a>
</div>
<div >
    <p>
    When web apps have the ability to learn about the device's state they
    are able to make use of that information to create a better experience 
    for the user.
    </p>
    <p>
    For instance, in combination with other information about the device, a web 
    app might use Battery level information to determine if a will be able to 
    complete an activity - such as watching a lengthy movie or playing a game.
    </p>
</div>

<br/>
<div >
<a name="Browser and Device Compatibility">Browser and Device Compatibility</a>
</div>
<div >
  <p>
  The table below lists some compatability notes for browser and operating system combinations.
  This API is currently beta quality.
  </p>
  <p>
  If you are interested in seeing these APIs available on other device types and operating systems 
  please let us know by <a href="http://software.intel.com/en-us/articles/intel-power-web-api-documentation-and-examples">leaving comments</a>.
  </p>
  <table >
    <tr>
      <th >Browser</th><th >Operating System</th><th >Notes</th>
    </tr>
    <tr>
      <td>Firefox 3.5.x, 3.6.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Chrome 4.0.x.y</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Safari 4.0.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Opera v 10.x </td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Not currently working. It's on the debug todo list.</td>
    </tr>
    <tr>
      <td>Internet Explorer 8.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Not supported yet. Its on the todo list though.</td>
    </tr>
    <tr>
      <td>Firefox, Chrome, Safari</td>
      <td>Linux, MacOS</td>
      <td>Not supported yet. Linux and Mac OS porting is underway :)</td>
    </tr>
  </table>
</div>

<br/>
<div >
  <a name="A code sample to get you started">A code sample to get you started</a>
</div>
<div >
<p>
  This HTML & JavaScript shows you how to embed the Intel Power Web API
  into your app.
</p>
<pre >
  &lt;div id="IntelWebAPIs_sample_code_status_div" 
    &gt;&lt;/div&gt;
  &lt;script 
    type="text/javascript" 
    src="http://software.intel.com/sites/whatif/webapis/intelwebapis.js"&gt;
  &lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  
    // this outer closure just to keep the sample code from cluttering up
    // the namespace with the function names etc being used
    (function() {
      
      //kick off IntelWebAPIs.init() and IntelWebAPIs.require() when
      //the page is loaded
      add_onload_handler( function() {
  
        IntelWebAPIs.init(init_result_func);
        
        //called by IntelWebAPIs.init()
        function init_result_func(result) {
          if(result.success) {
            // now bring in Intel Web APIs required by your app...
            output_status("IntelWebAPIs Connector init success");
            IntelWebAPIs.require(["power"], require_completion_func, require_progress_func);
          }
          else {
            output_status("IntelWebAPIs Connector init error: " + result.error.msg);
            //handle error condition
            //result.error.msg contains an error message
            //result.connectorInstUrl contains the url to the Intel Web API connector installer
            output_status("you may need to download the Intel Web API connector from here: " + 
              result.connectorInstUrl);
          }
        }
    
        //called by IntelWebAPIs.require()
        function require_completion_func(result) {
          if(result.success){
            //you can now use IntelWebAPIs.power properties and functions
            output_status("IntelWebAPIs." + result.installInfo.plugins[0].name + " ready for use!");
            setInterval(function(){
              // send a status message to our div every second
              output_status("Device is using AC power: " + IntelWebAPIs.power.usingExternalPowerSource);
              output_status("Device power level: " + IntelWebAPIs.power.powerLevel + " %");
              if(IntelWebAPIs.power.usingExternalPowerSource == false){
                output_status("Device battery time remaining: " + 
                  Math.round((IntelWebAPIs.power.timeRemaining / 60)) + " minutes");
              }
            },1000);
          }
          else {
            //check other result properties and handle error condition
            output_status("IntelWebAPIs error: " + result.installInfo.msg);
          }
        }
        
        //called by IntelWebAPIs.require()
        function require_progress_func(statusMsg){
          //statusMsg is a string - send this wherever
          output_status("IntelWebAPIs connector status: " + statusMsg);
        }
      
      });
      
      /* Its recommended that you wait until the document is loaded 
         before calling IntelWebAPIs.init() and IntelWebAPIs.require() 
         This utility helps with that...*/
      function add_onload_handler(addfunc, altwindow) {
        var targwindow = window;
        if(typeof(altwindow) != 'undefined'){
          targwindow = altwindow;
        }
        
        /* chain the onload functions together */
        var prevf = targwindow.onload;
        var newf  = addfunc;
        targwindow.onload = function(){
            newf();
            if(typeof(prevf) == 'function'){
              prevf();
            }
          };
      }
      
      /* utility that outputs status messages to a div*/
      function output_status(str) {
        var divout = document.getElementById("IntelWebAPIs_sample_code_status_div");
        divout.innerHTML += str + "&lt;br/&gt;";
        divout.scrollTop = divout.scrollHeight;
      }
    })(); // end of outer closure
  &lt;/script&gt;
</pre>
<br/>
<p>
  This is the result Object that is passed into init_result_func(result).<br/>
  If the Intel Web API Connector is not yet installed on a user's device you can
  use the result.connectorInstUrl to prompt the user, in the context of your
  app, to install it.<br/> 
  Once the Intel Web API Connector is installed other apis are installed by the
  connector, with minimal user interruption, when your app calls IntelWebAPIs.require().
</p>

<pre >
  result = { 
    success           : boolean,
    
    // these fields are valid if success != true
    connectorInstUrl  : string 
    error             : {
      msg             : string 
    } 
  }
</pre>
<br/>
This is the result Object that is passed into require_completion_func(result).<br/><br/>
<pre >
  result = { 
    success       : boolean,
    
    installInfo   : {
      msg         : string,
      
      plugins     : [ { 
        name      : string,
        installed : boolean,
        details   : string
        }, 
        //...
      ], 
    }
  }  
</pre>
</div>

<br/>
<div >
<a name="JavaScript API Details">JavaScript API Details</a>
</div>
<div >
These are the properties exposed by the Power Web API:<br/><br/>
<pre >
  IntelWebAPIs.power = {
    'version'                   : string,
    'usingExternalPowerSource'  : boolean,
    'timeRemaining'             : number,
    'powerLevel'                : number
  };
</pre>
<br/>
<div >
<a name="IntelWebAPIs.power.version">IntelWebAPIs.power.version</a>
</div>
<div>
This is the API's version string. It is formatted as "major.minor.patch" where major
and minor are numbers and patch is a string.
</div>
<br/>
<div >
<a name="IntelWebAPIs.power.usingExternalPowerSource">IntelWebAPIs.power.usingExternalPowerSource</a>
</div>
<div>
The IntelWebAPIs.power.usingExternalPowerSource is true if the device is on AC power, false if the
device is using batteries. On desktop systems where batteries are not detected this will return true.
</div>
<br/>
<div >
<a name=IntelWebAPIs.power.timeRemaining">IntelWebAPIs.power.timeRemaining</a>
</div>
<div>
When IntelWebAPIs.power.usingExternalPowerSource == true, the IntelWebAPIs.power.timeRemaining property 
provides the number of seconds remaining of battery life. When 
IntelWebAPIs.power.usingExternalPowerSource == false this value is -1.<br/>
This value will also be -1 if unknown - if the API is unable to determine time remaining from
the underlying system software.
</div>
<br/>
<div >
<a name="IntelWebAPIs.power.powerLevel">IntelWebAPIs.power.powerLevel</a>
</div>
<div>
The IntelWebAPIs.power.powerLevel is true provides the current charge level
of the device's batteries as a percent.<br/>
This will be -1 if unknown - if the API is unable to determine the charge level
from the underlying system software.
</div>
<br/><br/>
These JavaScript functions demonstrate accessing the power information:
<br/><br/>
<pre >
  function output_timeRemaining(){
    alert("timeRemaining=" + IntelWebAPIs.power.timeRemaining);
  }
  
  function output_usingExternalPowerSource(){
    alert("usingExternalPowerSource=" + IntelWebAPIs.power.usingExternalPowerSource);
  }

  function output_powerLevel(){
    var selplugin = get_sel_plugin();
    alert("powerLevel=" + IntelWebAPIs.power.powerLevel);
  }
</pre>
</div>
<br/><br/>
<div >
<a name="See it working" href="http://software.intel.com/sites/whatif/webapis/api/power">See it working in this page!</a>
</div>
 ]]></description>
      <link>http://software.intel.com/en-us/articles/intel-power-web-api-documentation-and-examples/</link>
      <pubDate>Tue, 09 Feb 2010 00:00:00 -0800</pubDate>
      <comments>http://software.intel.com/en-us/articles/intel-power-web-api-documentation-and-examples/#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/intel-power-web-api-documentation-and-examples/</guid>
      <category>What If Experimental Software</category>
      <category>Code &amp; Downloads</category>
    </item>
    <item>
      <title>Intel CPU Web API Documentation and Examples</title>
      <description><![CDATA[ <p>
The Intel CPU Web API provides web developers with JavaScript access to 
information about the CPU and current CPU utilization.
</p>

<div >
<a name="Contents">Contents</a>
</div>
<div >
  <ul>
    <li>
      <a href="http://software.intel.com#Overview">Overview</a>
    </li>
    <li>
      <a href="http://software.intel.com#Browser and Device Compatibility">Browser and Device Compatibility</a>
    </li>
    <li>
      <a href="http://software.intel.com#A code sample to get you started">A code sample to get you started</a>
    </li>
    <li>
      <a href="http://software.intel.com#JavaScript API Details">JavaScript API Details</a>
    </li>
    <li>
      <a href="http://software.intel.com#See it working">See it working in this page!</a>
    </li>
  </ul>
</div>

<br/>
<div >
  <a name="Overview">Overview</a>
</div>
<div >
    <p>
    When web apps have the ability to learn about some of the
    characteristics of the device's CPU and the current CPU load they
    are able to make use of that information to create a better
    experience for the user.
    </p>
    <p>
    For instance, in combination with other information about the device, a web 
    app might use CPU information to request a video stream which is approprate
    for the device's CPU decode capability. A web app may determine that
    current CPU utilization is too high for the app to function appropriatly
    for the desired user experience - and may prompt the user to shut down
    some applicaitons before proceeding. 
    </p>
</div>

<br/>
<div >
<a name="Browser and Device Compatibility">Browser and Device Compatibility</a>
</div>
<div >
  <p>
  The table below lists some compatability notes for browser and operating system combinations.
  This API is currently beta quality.
  </p>
  <p>
  If you are interested in seeing these APIs available on other device types and operating systems 
  please let us know by <a href="http://software.intel.com/en-us/articles/intel-cpu-web-api-documentation-and-examples">leaving comments</a>.
  </p>
  <table >
    <tr>
      <th >Browser</th><th >Operating System</th><th >Notes</th>
    </tr>
    <tr>
      <td>Firefox 3.5.x, 3.6.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Chrome 4.0.x.y</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Safari 4.0.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Seems to be working well.</td>
    </tr>
    <tr>
      <td>Opera v 10.x </td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Not currently working. It's on the debug todo list.</td>
    </tr>
    <tr>
      <td>Internet Explorer 8.x</td>
      <td>Windows (XP, Vista, Win 7)</td>
      <td>Not supported yet. Its on the todo list though.</td>
    </tr>
    <tr>
      <td>Firefox, Chrome, Safari</td>
      <td>Linux, MacOS</td>
      <td>Not supported yet. Linux and Mac OS porting is underway :)</td>
    </tr>
  </table>
</div>

<br/>
<div >
  <a name="A code sample to get you started">A code sample to get you started</a>
</div>
<div >
<p>
  This HTML & JavaScript shows you how to embed the Intel CPU Web API
  into your app.
</p>
<pre >
  &lt;div id="IntelWebAPIs_sample_code_status_div" 
    &gt;&lt;/div&gt;
  &lt;script 
    type="text/javascript" 
    src="http://software.intel.com/sites/whatif/webapis/intelwebapis.js"&gt;
  &lt;/script&gt;
  &lt;script type="text/javascript"&gt;

    // this outer closure just to keep the sample code from cluttering up
    // the namespace with the function names etc being used
    (function() {
      
      //kick off IntelWebAPIs.init() and IntelWebAPIs.require() when
      //the page is loaded
      add_onload_handler( function() {

        IntelWebAPIs.init(init_result_func);
        
        //called by IntelWebAPIs.init()
        function init_result_func(result) {
          if(result.success) {
            // now bring in Intel Web APIs required by your app...
            output_status("IntelWebAPIs Connector init success");
            IntelWebAPIs.require(["cpu"], require_completion_func, require_progress_func);
          }
          else {
            output_status("IntelWebAPIs Connector init error: " + result.error.msg);
            //handle error condition
            //result.error.msg contains an error message
            //result.connectorInstUrl contains the url to the Intel Web API connector installer
            output_status("you may need to download the Intel Web API connector from here: " + 
              result.connectorInstUrl);
          }
        }
    
        //called by IntelWebAPIs.require()
        function require_completion_func(result) {
          if(result.success){
            //you can now use IntelWebAPIs.cpu properties and functions
            output_status("IntelWebAPIs." + result.installInfo.plugins[0].name + " ready for use!");
            output_status("Your CPU Name is: " + IntelWebAPIs.cpu.name);
            setInterval(function(){
              // send a status message to our div every second
              var cpuLoad = Math.round((IntelWebAPIs.cpu.load * 100) * 100)/100;
              output_status("CPU Load =" + cpuLoad + " %");
            },1000);
          }
          else {
            //check other result properties and handle error condition
            output_status("IntelWebAPIs error: " + result.installInfo.msg);
          }
        }
        
        //called by IntelWebAPIs.require()
        function require_progress_func(statusMsg){
          //statusMsg is a string - send this wherever
          output_status("IntelWebAPIs connector status: " + statusMsg);
        }
      
      });
      
      /* Its recommended that you wait until the document is loaded 
         before calling IntelWebAPIs.init() and IntelWebAPIs.require() 
         This utility helps with that...*/
      function add_onload_handler(addfunc, altwindow) {
        var targwindow = window;
        if(typeof(altwindow) != 'undefined'){
          targwindow = altwindow;
        }
        
        /* chain the onload functions together */
        var prevf = targwindow.onload;
        var newf  = addfunc;
        targwindow.onload = function(){
            newf();
            if(typeof(prevf) == 'function'){
              prevf();
            }
          };
      }
      
      /* utility that outputs status messages to a div*/
      function output_status(str) {
        var divout = document.getElementById("IntelWebAPIs_sample_code_status_div");
        divout.innerHTML += str + "&lt;br/&gt;";
        divout.scrollTop = divout.scrollHeight;
      }
    })(); // end of outer closure
  &lt;/script&gt;
</pre>
<br/>
<p>
  This is the result Object that is passed into init_result_func(result).<br/>
  If the Intel Web API Connector is not yet installed on a user's device you can
  use the result.connectorInstUrl to prompt the user, in the context of your
  app, to install it.<br/> 
  Once the Intel Web API Connector is installed other apis are installed by the
  connector, with minimal user interruption, when your app calls IntelWebAPIs.require().
</p>

<pre >
  result = { 
    success           : boolean,
    
    // these fields are valid if success != true
    connectorInstUrl  : string 
    error             : {
      msg             : string 
    } 
  }
</pre>
<br/>
This is the result Object that is passed into require_completion_func(result).<br/><br/>
<pre >
  result = { 
    success       : boolean,
    
    installInfo   : {
      msg         : string,
      
      plugins     : [ { 
        name      : string,
        installed : boolean,
        details   : string
        }, 
        //...
      ], 
    }
  }  
</pre>
</div>

<br/>
<div >
<a name="JavaScript API Details">JavaScript API Details</a>
</div>
<div >
These are the properties exposed by the CPU Web API:<br/><br/>
<pre >
  IntelWebAPIs.cpu = {
    'version'     : string,
    'name'        : string,
    'load'        : float
  };
</pre>
<br/>
<div >
<a name="IntelWebAPIs.cpu.version">IntelWebAPIs.cpu.version</a>
</div>
<div>
This is the API's version string. It is formatted as "major.minor.patch" where major
and minor are numbers and patch is a string.
</div>
<br/>
<div >
<a name="IntelWebAPIs.cpu.name">IntelWebAPIs.cpu.name</a>
</div>
<div>
The IntelWebAPIs.cpu.name property provides the device's CPU name string. This is useful
for applications that want to determine which app features should run on the client
device and which features should run in the cloud.
</div>
<br/>
<div >
<a name=IntelWebAPIs.cpu.load">IntelWebAPIs.cpu.load</a>
</div>
<div>
The IntelWebAPIs.cpu.load property provides the device's CPU load. 0.0 is the
minimum possible load and 1.0 is maximum possible load. 
Multiplying by 100 gives converts the value to a percentage.
</div>
<br/><br/>
These JavaScript functions demonstrate accessing the cpu information:
<br/><br/>
<pre >
  function output_cpu_name(){
    alert("cpu name = " + IntelWebAPIs.cpu.name);
  }
  
  function output_cpu_load(){
    var currLoad = IntelWebAPIs.cpu.load * 100;
    alert("cpu load = " + currLoad + " %");
  }
</pre>
</div>
<br/><br/>
<div >
<a name="See it working" href="http://software.intel.com/sites/whatif/webapis/api/cpu">See it working in this page!</a>
</div>
 ]]></description>
      <link>http://software.intel.com/en-us/articles/intel-cpu-web-api-documentation-and-examples/</link>
      <pubDate>Tue, 09 Feb 2010 00:00:00 -0800</pubDate>
      <comments>http://software.intel.com/en-us/articles/intel-cpu-web-api-documentation-and-examples/#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/intel-cpu-web-api-documentation-and-examples/</guid>
      <category>What If Experimental Software</category>
      <category>Code &amp; Downloads</category>
    </item>
  </channel></rss>
