<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Sensor &amp; Location Platform Team Blog</title><link>http://blogs.msdn.com/b/sensorslocation/</link><description /><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Using an Accelerometer to Build a Game Controller</title><link>http://blogs.msdn.com/b/sensorslocation/archive/2010/06/29/using-an-accelerometer-to-build-a-game-controller.aspx</link><pubDate>Wed, 30 Jun 2010 00:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10032338</guid><dc:creator>sensblog</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/rsscomments.aspx?WeblogPostID=10032338</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/commentapi.aspx?WeblogPostID=10032338</wfw:comment><comments>http://blogs.msdn.com/b/sensorslocation/archive/2010/06/29/using-an-accelerometer-to-build-a-game-controller.aspx#comments</comments><description>The XNA team created their XNA Game Studio to simplify the creation of games for: Windows, the Xbox 360, the Zune, and the Windows Phone 7 Series. The Game Studio includes the XNA Framework--a set of managed libraries that are designed for game development...(&lt;a href="http://blogs.msdn.com/b/sensorslocation/archive/2010/06/29/using-an-accelerometer-to-build-a-game-controller.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10032338" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/sensors/">sensors</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/driver/">driver</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/parallax/">parallax</category></item><item><title>Making Sense of Sensor Permissions</title><link>http://blogs.msdn.com/b/sensorslocation/archive/2010/06/25/making-sense-of-sensor-permissions.aspx</link><pubDate>Fri, 25 Jun 2010 18:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10018584</guid><dc:creator>sensblog</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/rsscomments.aspx?WeblogPostID=10018584</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/commentapi.aspx?WeblogPostID=10018584</wfw:comment><comments>http://blogs.msdn.com/b/sensorslocation/archive/2010/06/25/making-sense-of-sensor-permissions.aspx#comments</comments><description>In this, my first Sensor and Location Team Blog post, I will discuss sensor permissions. 
 I&amp;rsquo;ll cover: 
 &amp;middot; Clearing up some confusion around sensors and devices 
 &amp;middot; What are sensor permissions 
 &amp;middot; What permissions permits...(&lt;a href="http://blogs.msdn.com/b/sensorslocation/archive/2010/06/25/making-sense-of-sensor-permissions.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10018584" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/sensors/">sensors</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/SensorAPI/">SensorAPI</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/SensorClassExtension/">SensorClassExtension</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/permissions/">permissions</category></item><item><title>Understanding Access Denied when working with ISensor::GetState() and ISensor::GetProperty()</title><link>http://blogs.msdn.com/b/sensorslocation/archive/2010/04/27/understanding-access-denied-when-working-with-isensor-getstate-and-isensor-getproperty.aspx</link><pubDate>Wed, 28 Apr 2010 00:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10003990</guid><dc:creator>sensblog</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/rsscomments.aspx?WeblogPostID=10003990</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/commentapi.aspx?WeblogPostID=10003990</wfw:comment><comments>http://blogs.msdn.com/b/sensorslocation/archive/2010/04/27/understanding-access-denied-when-working-with-isensor-getstate-and-isensor-getproperty.aspx#comments</comments><description>In last week’s blog post we provided best practice guidance for Sensor State management in Location Sensors. At the bottom of that post we mention that SENSOR_STATE_ACCESS_DENIED is reserved and should only be used by the Platform. As a follow-on post...(&lt;a href="http://blogs.msdn.com/b/sensorslocation/archive/2010/04/27/understanding-access-denied-when-working-with-isensor-getstate-and-isensor-getproperty.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10003990" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/sensors/">sensors</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/SensorAPI/">SensorAPI</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/architecture/">architecture</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/states/">states</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/permissions/">permissions</category></item><item><title>State Transition in Location Drivers : Best practices</title><link>http://blogs.msdn.com/b/sensorslocation/archive/2010/04/13/state-transition-in-location-drivers-best-practices.aspx</link><pubDate>Wed, 14 Apr 2010 00:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9996199</guid><dc:creator>sensblog</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/rsscomments.aspx?WeblogPostID=9996199</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/commentapi.aspx?WeblogPostID=9996199</wfw:comment><comments>http://blogs.msdn.com/b/sensorslocation/archive/2010/04/13/state-transition-in-location-drivers-best-practices.aspx#comments</comments><description>This post will be talking about best practices for handling state to get the best behaviors from the Location API. Before reviewing our best practice guidance we recommend you read up on “ Writing a Location Sensor Driver ”. With information above in...(&lt;a href="http://blogs.msdn.com/b/sensorslocation/archive/2010/04/13/state-transition-in-location-drivers-best-practices.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9996199" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/windows7/">windows7</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/platform/">platform</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/driver/">driver</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/LocationAPI/">LocationAPI</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/gps/">gps</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/states/">states</category></item><item><title>Developing Your First Sensor Driver – Part 2</title><link>http://blogs.msdn.com/b/sensorslocation/archive/2010/03/30/developing-your-first-sensor-driver-part-2.aspx</link><pubDate>Wed, 31 Mar 2010 00:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9989869</guid><dc:creator>sensblog</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/rsscomments.aspx?WeblogPostID=9989869</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/commentapi.aspx?WeblogPostID=9989869</wfw:comment><comments>http://blogs.msdn.com/b/sensorslocation/archive/2010/03/30/developing-your-first-sensor-driver-part-2.aspx#comments</comments><description>&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;In the last blog post we investigated the fundamental characteristics of a sensor driver (properties and data fields) and how the Sensor Class Extension interacts with them. Here we will expand the basic driver template to include raising events and managing clients. A client is an application that has requested a connection to the driver through the class extension.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;This blog post will focus on the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd835071.aspx"&gt;&lt;font size="3" face="Calibri"&gt;Time Sensor Sample&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; from the Windows Driver Kit. In general this driver creates a thread that periodically requests data from the ‘device’ (just the system time), and posts it to the class extension. This differs from the skeleton sample examined previously, which merely responds to synchronous data requests. Let’s look at the following code snippet from &lt;i&gt;_EventThreadProc&lt;/i&gt; in CSampleEvents to illustrate this additional functionality. Note some comments have been modified.&lt;/font&gt;&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;// &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #008000"&gt;// Fetching data and posting an event, &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #008000"&gt;// from _EventThreadProc, lines 193 - 225 &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: #008000"&gt;// &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; CComPtr&amp;lt;IPortableDeviceValues&amp;gt; spEventParams;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; CComPtr&amp;lt;IPortableDeviceKeyCollection&amp;gt; spKeys;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;             &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt;(SUCCEEDED(hr))&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt; {            &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Use the Ddi class to create the key collection.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;     hr = pThis-&amp;gt;m_pDdi-&amp;gt;OnGetSupportedDataFields(&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;         g_wszSensorID, &amp;amp;spKeys);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt;(SUCCEEDED(hr))&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;     CComPtr&amp;lt;IWDFFile&amp;gt; spTemp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Get the data fields.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;     hr = pThis-&amp;gt;m_pDdi-&amp;gt;OnGetDataFields(&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;         spTemp, g_wszSensorID, spKeys, &amp;amp;spEventParams);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt;(SUCCEEDED(hr))&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum27"&gt;  27:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Add the data event property key.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum28"&gt;  28:&lt;/span&gt;     hr = spEventParams-&amp;gt;SetGuidValue(&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum29"&gt;  29:&lt;/span&gt;         SENSOR_EVENT_PARAMETER_EVENT_ID, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum30"&gt;  30:&lt;/span&gt;         SENSOR_EVENT_DATA_UPDATED);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum31"&gt;  31:&lt;/span&gt;             &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum32"&gt;  32:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt;(SUCCEEDED(hr))&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum33"&gt;  33:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum34"&gt;  34:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Post the event.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum35"&gt;  35:&lt;/span&gt;     hr = pThis-&amp;gt;PostDataEvent(spEventParams);                &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;In the first two blocks of code, we get a list of supported data fields and populate an IPortableDeviceValues collection with their current values. &lt;i&gt;OnGetDataFields&lt;/i&gt; is the same method the class extension would call into if a client requested data on demand. Next we set the event type using the event property key. Setting the correct type is important because clients can register to be notified of specific types of events. For example an application may care about a new data event but not a state change event. The sensor and location platform defines several event property keys and types, which can be seen at &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd318922(VS.85).aspx"&gt;&lt;font size="3" face="Calibri"&gt;MSDN&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt;. Finally we call into the &lt;i&gt;PostDataEvent&lt;/i&gt; helper method to signal the class extension. Here is this method in its entirety.&lt;/font&gt;&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;// Post a data updated event, lines 148 - 170&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; HRESULT CSampleEvents::PostDataEvent(IPortableDeviceValues* pValues)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     HRESULT hr = (NULL == m_spSensorCXT) ? E_UNEXPECTED : S_OK ;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;               CComPtr&amp;lt;IPortableDeviceValuesCollection&amp;gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;                   spValuesCollection;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;         hr = spValuesCollection.CoCreateInstance(&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;             CLSID_PortableDeviceValuesCollection);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;             hr = spValuesCollection-&amp;gt;Add(pValues);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;             {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;                 hr = m_spSensorCXT-&amp;gt;PostEvent(&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;                     g_wszSensorID, spValuesCollection);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;             }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; hr;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p align="justify"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;i&gt;PostDataEvent&lt;/i&gt; simply takes the data field values, adds them to an IPortableDeviceValeus collection, and posts the collection to the Sensor Class Extension. The extension will notify appropriate clients of new data.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;The Sensor Class Extension also informs a sensor driver of client connection and subscription changes through several methods: &lt;i&gt;OnClientConnect&lt;/i&gt;, &lt;i&gt;OnClientDisconnect&lt;/i&gt;, On &lt;i&gt;ClientSubscribeToEvents&lt;/i&gt;, and &lt;i&gt;OnClientUnsubscribeFromEvents&lt;/i&gt;. These enable a driver to adjust its activity accordingly (such as disabling device sampling when no client is connected or adjusting event frequency). For instance, the Time Sensor Sample keeps track of client applications in a Clients list, which it uses to update the driver’s report interval.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;To wrap up, these simple additions allow a sensor driver can take advantage of events in the sensor and location platform. This event-driven model can improve performance in both the driver and client applications. For more information about sensor driver events, take a look &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ff545385.aspx"&gt;&lt;font size="3" face="Calibri"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt;. Best of luck!&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;-- Sensor &amp;amp; Location Platform Team&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;This posting is provided &amp;quot;AS IS&amp;quot; with no warranties and confers no rights.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9989869" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/sensors/">sensors</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/windows7/">windows7</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/umdf/">umdf</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/driver/">driver</category></item><item><title>Developing Your First Sensor Driver – Part 1</title><link>http://blogs.msdn.com/b/sensorslocation/archive/2010/03/23/developing-your-first-sensor-driver-part-1.aspx</link><pubDate>Wed, 24 Mar 2010 00:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9984510</guid><dc:creator>sensblog</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/rsscomments.aspx?WeblogPostID=9984510</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/commentapi.aspx?WeblogPostID=9984510</wfw:comment><comments>http://blogs.msdn.com/b/sensorslocation/archive/2010/03/23/developing-your-first-sensor-driver-part-1.aspx#comments</comments><description>&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;The Windows Driver Kit (WDK) is a great place to get started when writing your first sensor driver. In this post we will take a look at the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd445419.aspx"&gt;&lt;font size="3" face="Calibri"&gt;Sensor Driver Skeleton Sample&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt;, which provides a basic sensor driver template. A future post will investigate the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd835071.aspx"&gt;&lt;font size="3" face="Calibri"&gt;Time Sensor Sample&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; to learn about incorporating events. If you have the WDK installed, the source is located under &amp;lt;WDK Install Path&amp;gt;\src\SensorsAndLocation. For more in-depth information, the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa973523.aspx"&gt;&lt;font size="3" face="Calibri"&gt;WDK Sensor Devices&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; section of MSDN includes a design guide, valuable sensor references, and information about the two sensor driver samples.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;Three of the four classes in the skeleton sample (CMyDriver, CMyDevice, and CMyQueue) implement various User-Mode Driver Framework (UMDF) interfaces. In these we initialize the device, configure the IO queue, and create the class extension and device driver interface (DDI). Head over to MSDN for more information about &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa510983.aspx"&gt;&lt;font size="3" face="Calibri"&gt;UMDF&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;The remainder of this post will focus on the fourth class, CSensorDdi, which implements the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc974560.aspx"&gt;&lt;font size="3" face="Calibri"&gt;ISensorDriver&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; interface. This class emulates access to hardware devices and handles communication with the sensor class extension. Your first step – determine the properties and data fields your sensor supports. Properties describe a sensor device, while data fields describe sensor-generated data. Take a look at the code snippets below from SensorDDI.cpp.&lt;/font&gt;&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;// Sensor properties, lines 26-51&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;const&lt;/span&gt; PROPERTYKEY g_SupportedCommonProperties[] =&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    WPD_OBJECT_ID,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    WPD_OBJECT_PERSISTENT_UNIQUE_ID,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    WPD_OBJECT_PARENT_ID,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    WPD_OBJECT_NAME,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    WPD_OBJECT_FORMAT,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    WPD_OBJECT_CONTENT_TYPE,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    WPD_OBJECT_CAN_DELETE,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;};&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;const&lt;/span&gt; PROPERTYKEY g_SupportedTemperatureProperties[] =&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SENSOR_PROPERTY_TYPE,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SENSOR_PROPERTY_STATE,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SENSOR_PROPERTY_MIN_REPORT_INTERVAL,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SENSOR_PROPERTY_CURRENT_REPORT_INTERVAL,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SENSOR_PROPERTY_PERSISTENT_UNIQUE_ID,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SENSOR_PROPERTY_MANUFACTURER, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SENSOR_PROPERTY_MODEL,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SENSOR_PROPERTY_SERIAL_NUMBER,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SENSOR_PROPERTY_FRIENDLY_NAME,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SENSOR_PROPERTY_DESCRIPTION, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SENSOR_PROPERTY_CONNECTION_TYPE,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    WPD_FUNCTIONAL_OBJECT_CATEGORY,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;};&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;// Sensor data fields, lines 69-73&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;const&lt;/span&gt; PROPERTYKEY g_SupportedTemperatureDataFields[] =&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SENSOR_DATA_TYPE_TIMESTAMP,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SENSOR_DATA_TYPE_TEMPERATURE_CELSIUS,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;};&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;These properties and data fields describe the mock temperature sensor. The g_SupportedCommonProperties array holds properties shared by all sensors for this driver, while the other two are temperature-sensor specific. Note that these strings and associated GUIDs can be user-defined, but they must be shared and understood between the driver and client applications to be useful. The sensor platform defines a set of &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc974542.aspx"&gt;&lt;font size="3" face="Calibri"&gt;constants&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; for sensor drivers, which can also be found in &amp;lt;WDK Install Path&amp;gt;\inc\api\Sensors.h.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;We initialize each sensor by storing its properties and data fields into collections for future reference. The following code from InitializeTemperatureSensor demonstrates adding our temperature properties to the m_pSupportedTemperatureSensorProperties collection and setting some default values. A similar collection is maintained for the data field values.&lt;/font&gt;&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;// Add temperature sensor property keys, lines 161-165&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (DWORD dwIndex=0;    &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    dwIndex&amp;lt;ARRAYSIZE(g_SupportedTemperatureProperties); &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    dwIndex++)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    m_pSupportedTemperatureSensorProperties-&amp;gt;Add(&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        g_SupportedTemperatureProperties[dwIndex]);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;// Add temperature sensor property values, lines 184-186&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;m_pTemperatureSensorPropertyValues-&amp;gt;SetGuidValue(&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    WPD_FUNCTIONAL_OBJECT_CATEGORY, SENSOR_CATEGORY_ENVIRONMENTAL);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;m_pTemperatureSensorPropertyValues-&amp;gt;SetGuidValue(&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SENSOR_PROPERTY_TYPE, SENSOR_TYPE_ENVIRONMENTAL_TEMPERATURE);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;m_pTemperatureSensorPropertyValues-&amp;gt;SetStringValue(&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SENSOR_PROPERTY_MANUFACTURER, DEVICE_MANUFACTURER_VALUE);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;...&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;Once the CSensorDdi initialization is finished, the sensor class extension loads and calls OnGetSupportedSensorObjects. Here we report each sensor to the class extension and provide its supported properties. The final step is to enable the driver in the control panel so that it can be accessed by client applications. A quick note – although we are describing each sensor separately, permissions are granted at the driver level and cannot be set for specific sensors.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;With our driver initialized and sensor values defined, let’s take a look at some key callback methods of the ISensorDriver interface. &lt;/font&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;div align="left"&gt;&lt;font size="3" face="Calibri"&gt;OnClientConnect, OnClientDisconnect, OnClientSubscribeToEvents, OnClientUnsubscribeFromEvents&lt;/font&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;These methods inform the driver of client application activity. The driver can use this information to optimize reporting of state change and data values.&lt;/font&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;div align="left"&gt;&lt;font size="3" face="Calibri"&gt;OnGetSupportedProperties, OnGetSupportedDataFields, OnGetSupportedEvents&lt;/font&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;These methods provide the sensor class extension with access to a sensor’s supported properties, data fields, and events. Remember those collections we populated earlier? This is how each sensor exposes its functionality. Recall we will talk about events in a future blog post.&lt;/font&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;div align="justify"&gt;&lt;font size="3" face="Calibri"&gt;OnGetProperties, OnSetProperties, OnGetDataFields&lt;/font&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;These methods expose the property and data field values that client applications will likely care about. OnSetProperties allows an application to update settable properties, such as a sensor’s report interval.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;OnGetDataFields returns a sensor’s data field values. These could be from a cached copy or requested from the device on demand. In our sample the default values stored in the m_pTemperatureSensorDataFieldValues collection are returned for each supported data field.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;That’s it! While this skeleton sample offers minimal functionality, hopefully you now have a better understanding of the driver architecture and its interaction with the sensor class extension. Starting with some simple modifications to the properties and data fields, your driver will be up and running in no time. One more thing – the &lt;/font&gt;&lt;a href="http://code.msdn.microsoft.com/SensorsAndLocation/Release/ProjectReleases.aspx?ReleaseId=2359"&gt;&lt;font size="3" face="Calibri"&gt;Sensor Diagnostic Tool&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; offers a great mechanism for interacting with your driver during development.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;Good luck and stay tuned for the follow-up post.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;-- Sensor &amp;amp; Location Platform Team&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;This posting is provided &amp;quot;AS IS&amp;quot; with no warranties and confers no rights.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9984510" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/sensors/">sensors</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/windows7/">windows7</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/umdf/">umdf</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/driver/">driver</category></item><item><title>Overview of Adaptive Brightness in Windows 7</title><link>http://blogs.msdn.com/b/sensorslocation/archive/2010/03/09/overview-of-adaptive-brightness-in-windows-7.aspx</link><pubDate>Wed, 10 Mar 2010 01:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9975920</guid><dc:creator>sensblog</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/rsscomments.aspx?WeblogPostID=9975920</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/commentapi.aspx?WeblogPostID=9975920</wfw:comment><comments>http://blogs.msdn.com/b/sensorslocation/archive/2010/03/09/overview-of-adaptive-brightness-in-windows-7.aspx#comments</comments><description>&lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;So you just got yourself a new laptop. Congratulations! Did you notice that it has an Ambient Light Sensor (ALS)? With Windows 7, we’re seeing more and more laptops coming to market with built in ALS. How does Windows 7 take advantage of this sensor? How can you tap into it? How do I see it reflected in the system settings? Where is this little gizmo on the machine? We’ll answer some of these questions in this post…     &lt;br /&gt;&lt;/font&gt;&lt;/p&gt; &lt;font size="3" face="Calibri"&gt;&lt;/font&gt;  &lt;h5&gt;&lt;font size="3" face="Calibri"&gt;Where can I find the ALS on my machine ?&lt;/font&gt;&lt;/h5&gt;  &lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;Can you find where the ALS is exposed on your laptop? Sometimes it’s obvious other times it’s not. You have to know what you’re looking for. Most of the time the ALS is behind some translucent or dark glass. Here is what an ALS chip looks like:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="image" border="0" alt="image" align="right" src="http://blogs.msdn.com/blogfiles/sensorslocation/WindowsLiveWriter/OverviewofAdaptiveBrightnessinWindows7_EF34/image_15.png" width="211" height="244" /&gt; &lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/sensorslocation/WindowsLiveWriter/OverviewofAdaptiveBrightnessinWindows7_EF34/image_8.png" width="244" height="215" /&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/sensorslocation/WindowsLiveWriter/OverviewofAdaptiveBrightnessinWindows7_EF34/image_14.png" width="433" height="325" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;I’ll leave it as an exercise to you to find the ALS chip on your computer. &lt;/font&gt;&lt;font size="3" face="Calibri"&gt;Don’t feel bad if you don’t find it. When one of the first prototype computers that had an ALS implemented arrived it took us about an hour to find it. We weren’t sure if the chip was on the exposed motherboard of prototype board or if the vender hid it behind some dark glass on the monitor. It was a real challenge since we need do measurements on the ALS’s response to various light levels and not knowing where it was made that a bit challenging. We finally found it on the motherboard… Finding the power button was a whole different story on this prototype… you had to be there.&lt;/font&gt;&lt;/p&gt;  &lt;h5&gt;&lt;font size="3" face="Calibri"&gt;How does Windows 7 use the ALS?&lt;/font&gt;&lt;/h5&gt;  &lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;New with Windows 7 is the Adaptive Brightness feature. This feature is built on top of our Sensor Platform. This feature will adjust the screen brightness according to the ambient light level. If the ambient light level gets darker then the screen brightness decreases; if the ambient light level increases then the screen brightness increases. This solves the problem of when you resume your computer the morning after a late night of hardcore programming only to discover that the screen is so dark that you’re having a hard time reading it. As an added bonus it helps to extend battery life. As the day turned to night you invariably used the Mobility Center to adjust your screen brightness making it darker and darker as the room grew darker and darker. (Win – X will open the Mobility Center).&lt;/font&gt; &lt;/p&gt;  &lt;p align="justify"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/sensorslocation/WindowsLiveWriter/OverviewofAdaptiveBrightnessinWindows7_EF34/image_3.png" width="533" height="266" /&gt; &lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;This is where the Adaptive Brightness feature takes over. The feature makes use of the built in ALS. The ALS needs to be enabled before Adaptive Brightness will work. Let’s open the &lt;b&gt;Location and Other Sensors CPL&lt;/b&gt;. Quick access to this Control Panel (CPL) is achieved by pressing the Windows Key and typing “sensors”.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/sensorslocation/WindowsLiveWriter/OverviewofAdaptiveBrightnessinWindows7_EF34/image_11.png" width="533" height="375" /&gt; &lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;If the Light Sensor is not enabled then perhaps we can have a dramatic unveiling of this feature by trying to enable the Light Sensor in a dark room. Enable the Light Sensor then click Apply. We’ll cover the inner workings of this CPL in another post. For now let’s just use it to enable our Light Sensor. &lt;/font&gt;&lt;font size="3" face="Calibri"&gt;Did you notice the screen darken? That’s the Adaptive Brightness feature at work for you.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Remember that this ALS is exposed not only to the Adaptive Brightness feature in Windows but is also exposed via the Sensor Platform. In a future post we’ll go through some simple code to find the ALS Sensor, setup an event on the sensor and output the resulting light level detected. Soon you could be writing applications that make use of this built in sensor.&lt;/font&gt; &lt;/p&gt; &lt;font size="3" face="Calibri"&gt;&lt;/font&gt;  &lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;-- Sensor &amp;amp; Location Platform Team&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;This posting is provided &amp;quot;AS IS&amp;quot; with no warranties and confers no rights.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9975920" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/sensors/">sensors</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/windows7/">windows7</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/SensorAPI/">SensorAPI</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/adaptive+brightness/">adaptive brightness</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/als/">als</category></item><item><title>The Parallax Introduction to Sensors Kit</title><link>http://blogs.msdn.com/b/sensorslocation/archive/2010/03/03/the-parallax-introduction-to-sensors-kit.aspx</link><pubDate>Thu, 04 Mar 2010 01:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9972528</guid><dc:creator>sensblog</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/rsscomments.aspx?WeblogPostID=9972528</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/commentapi.aspx?WeblogPostID=9972528</wfw:comment><comments>http://blogs.msdn.com/b/sensorslocation/archive/2010/03/03/the-parallax-introduction-to-sensors-kit.aspx#comments</comments><description>&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;Accelerometers, motion-sensors, distance-sensors, and compasses. What do these sensors have in common? They compose the &lt;I&gt;Introduction to Sensors Kit&lt;/I&gt; that the Parallax Corporation sells for $79.99. Purchase this &lt;/FONT&gt;&lt;A href="http://www.parallax.com/Store/Sensors/tabid/86/Default.aspx" mce_href="http://www.parallax.com/Store/Sensors/tabid/86/Default.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;kit&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;, a programmable microcontroller like the &lt;/FONT&gt;&lt;A href="http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/ProductID/1/List/1/Default.aspx?SortField=UnitCost,ProductName" mce_href="http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/ProductID/1/List/1/Default.aspx?SortField=UnitCost,ProductName"&gt;&lt;FONT size=3 face=Calibri&gt;Parallax BS2&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;, a &lt;/FONT&gt;&lt;A href="http://www.parallax.com/StoreSearchResults/tabid/768/List/0/SortField/4/ProductID/122/Default.aspx?txtSearch=Project+Board" mce_href="http://www.parallax.com/StoreSearchResults/tabid/768/List/0/SortField/4/ProductID/122/Default.aspx?txtSearch=Project+Board"&gt;&lt;FONT size=3 face=Calibri&gt;kit board&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;, and a serial cable and you’re ready to explore the Sensor platform for Windows 7.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;Below is a screenshot of the Passive Infrared (PIR) or motion sensor running on a Parallax HomeWork board:&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&amp;nbsp;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: block; FLOAT: none; MARGIN-LEFT: auto; BORDER-TOP: 0px; MARGIN-RIGHT: auto; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/sensorslocation/WindowsLiveWriter/TheParallaxIntroductiontoSensorsKit_B6A0/image_3.png" width=386 height=355 mce_src="http://blogs.msdn.com/blogfiles/sensorslocation/WindowsLiveWriter/TheParallaxIntroductiontoSensorsKit_B6A0/image_3.png"&gt; &lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;The Parallax BS2 (BasicStamp 2) is a programmable microcontroller that you code with Parallax PBASIC. This microcontroller has the following features:&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;· 20MHz processor&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;· 32 bytes RAM&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;· 2KB EEPROM (able to hold ~500 PBASIC instructions)&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;· 16 I/O pins&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;· 5 VDC with 3mA draw while running&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;&lt;STRONG&gt;Sensor Applications in .NET&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;With very little code, you’ll begin to see the rich power of the Sensor platform. For example, the below screenshot was taken from a simple C# .NET application that graphs the output for the Memsic 2-axis accelerometer:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: block; FLOAT: none; MARGIN-LEFT: auto; BORDER-TOP: 0px; MARGIN-RIGHT: auto; BORDER-RIGHT: 0px" title=clip_image001 border=0 alt=clip_image001 src="http://blogs.msdn.com/blogfiles/sensorslocation/WindowsLiveWriter/TheParallaxIntroductiontoSensorsKit_B6A0/clip_image001_thumb.jpg" width=437 height=234 mce_src="http://blogs.msdn.com/blogfiles/sensorslocation/WindowsLiveWriter/TheParallaxIntroductiontoSensorsKit_B6A0/clip_image001_thumb.jpg"&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;This application was written with just 100 lines of code. And, below is a screenshot of another application that renders compass output in real-time:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: block; FLOAT: none; MARGIN-LEFT: auto; BORDER-TOP: 0px; MARGIN-RIGHT: auto; BORDER-RIGHT: 0px" title=clip_image002 border=0 alt=clip_image002 src="http://blogs.msdn.com/blogfiles/sensorslocation/WindowsLiveWriter/TheParallaxIntroductiontoSensorsKit_B6A0/clip_image002_3.jpg" width=326 height=324 mce_src="http://blogs.msdn.com/blogfiles/sensorslocation/WindowsLiveWriter/TheParallaxIntroductiontoSensorsKit_B6A0/clip_image002_3.jpg"&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;This application contained a little more code (closer to 200 lines); however, even 200 lines is a remarkably small footprint for an application that renders real-time data from a remote device.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;&lt;STRONG&gt;How do I get started ?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;That depends: If you’re a hardware type, building the circuit will be a piece of cake. But, creating the driver (the interface between the sensor hardware and Windows) might be a challenge. Same goes for application developer: If you know your way around .Net, you might find it a challenge to write the driver or build the hardware. Driver developers will probably have the least difficulty of all. &lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;But, we’ve tried to simplify the process for everyone. We’ve provided a sample driver that supports all four sensors in the kit. And, we’ve provided sample firmware for the four devices as well as a simple .Net application that demonstrates the use of the Sensor platform for the Passive Infrared (PIR) sensor.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;You’ll find the sample driver, firmware, PIR application, and a descriptive whitepaper on the MSDN Code Gallery &lt;/FONT&gt;&lt;A href="http://code.msdn.microsoft.com/motionsensor" mce_href="http://code.msdn.microsoft.com/motionsensor"&gt;&lt;FONT size=3 face=Calibri&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;. &lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;You’ll find a sample application that demonstrates real-time graphing of accelerometer data on the MSDN Code Gallery &lt;/FONT&gt;&lt;A href="http://code.msdn.microsoft.com/MSChartAccelerometer" mce_href="http://code.msdn.microsoft.com/MSChartAccelerometer"&gt;&lt;FONT size=3 face=Calibri&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;&lt;STRONG&gt;Where can I find out more ?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;· To learn more about the programmable microcontrollers and sensors offered by Parallax, see the &lt;/FONT&gt;&lt;A href="http://go.microsoft.com/fwlink/?linkid=154730" mce_href="http://go.microsoft.com/fwlink/?linkid=154730"&gt;&lt;FONT size=3 face=Calibri&gt;Parallax&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; Web site.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;· For information about the Sensor API, see &lt;/FONT&gt;&lt;A href="http://go.microsoft.com/fwlink/?linkid=178391" mce_href="http://go.microsoft.com/fwlink/?linkid=178391"&gt;&lt;FONT size=3 face=Calibri&gt;Sensor API&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; in the Win32 and COM Development section MSDN.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;· For information about Sensor Drivers, see &lt;/FONT&gt;&lt;A href="http://go.microsoft.com/fwlink/?linkid=178392" mce_href="http://go.microsoft.com/fwlink/?linkid=178392"&gt;&lt;FONT size=3 face=Calibri&gt;Sensor Devices&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; in the Windows Driver Kit (WDK) section of MSDN.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;· To download a free version of Visual C# 2008 Express, see this &lt;/FONT&gt;&lt;A href="http://www.microsoft.com/express/Downloads/" mce_href="http://www.microsoft.com/express/Downloads/"&gt;&lt;FONT size=3 face=Calibri&gt;Downloads&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; page on the Microsoft site.&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=3 face=Calibri&gt;
&lt;P&gt;&lt;FONT size=3 face=Calibri&gt;-- Sensor &amp;amp; Location Platform Team&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;&lt;FONT size=3 face=Calibri&gt;This posting is provided "AS IS" with no warranties and confers no rights.&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9972528" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/sensors/">sensors</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/platform/">platform</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/SensorAPI/">SensorAPI</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/driver/">driver</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/parallax/">parallax</category></item><item><title>Introducing Location in .NET 4.0</title><link>http://blogs.msdn.com/b/sensorslocation/archive/2010/02/23/introducing-location-in-net-4-0.aspx</link><pubDate>Wed, 24 Feb 2010 01:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9968414</guid><dc:creator>sensblog</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/rsscomments.aspx?WeblogPostID=9968414</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/commentapi.aspx?WeblogPostID=9968414</wfw:comment><comments>http://blogs.msdn.com/b/sensorslocation/archive/2010/02/23/introducing-location-in-net-4-0.aspx#comments</comments><description>&lt;p&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;The .NET Framework 4.0 RC, which is integrated with &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx"&gt;&lt;font size="3" face="Calibri"&gt;Visual Studio 2010&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt;, is now available for &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx"&gt;&lt;font size="3" face="Calibri"&gt;download&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt;. This release of the .NET Framework 4 provides a managed location API in the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.device.location(VS.100).aspx"&gt;&lt;font size="3" face="Calibri"&gt;System.Device.Location&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; namespace that allow .NET developers to access location data from the Windows 7 Sensors &amp;amp; Location platform.&amp;#160; If you are familiar with the Location classes from .NET Framework 4 Beta 2, note that this API has been refactored in RC with &lt;/font&gt;&lt;a href="http://blogs.msdn.com/gavingear/archive/2009/12/09/upcoming-changes-for-system-device-location-in-net-4-rc-web-release.aspx"&gt;&lt;font size="3" face="Calibri"&gt;changes described here&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;The managed Location API is built on top of the C++/COM API described in the previous post, so it uses the same mechanism to simplify access to location data by automatically returning data from the best location source it identifies on the computer. However, the methods in the managed API do not correspond exactly to methods in the COM API. The root location object for the .NET Framework 4 Location API, &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher(VS.100).aspx"&gt;&lt;font size="3" face="Calibri"&gt;GeoCoordinateWatcher&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt;, supplies location data based on latitude and longitude coordinates. Either the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher.start(VS.100).aspx"&gt;&lt;font size="3" face="Calibri"&gt;Start&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; or &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher.trystart(VS.100).aspx"&gt;&lt;font size="3" face="Calibri"&gt;TryStart&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; method must be called to initiate the acquisition of data, after which the location data is accessed either by accessing the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher.position(VS.100).aspx"&gt;&lt;font size="3" face="Calibri"&gt;Position&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; property or by subscribing to the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher.positionchanged(VS.100).aspx"&gt;&lt;font size="3" face="Calibri"&gt;PositionChanged&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; event. In location-aware applications that require continuous updates, such as a navigation application, you’ll want to subscribe to the &lt;b&gt;PositionChanged&lt;/b&gt; event. For applications that only require accessing the location once, such as for pre-populating form fields or tagging a file with location metadata, you can get the location from the &lt;b&gt;Position &lt;/b&gt;property or by subscribing to the &lt;b&gt;PositionChanged&lt;/b&gt; event, getting the location from the first event, and then calling &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher.stop(VS.100).aspx"&gt;&lt;font size="3" face="Calibri"&gt;Stop&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; to stop receiving further events. The &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher.status(VS.100).aspx"&gt;&lt;font size="3" face="Calibri"&gt;Status&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; property indicates whether a location sensor is initializing, ready to supply new data, or if no location data is available from any sensor. You can subscribe to the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher.statuschanged(VS.100).aspx"&gt;&lt;font size="3" face="Calibri"&gt;StatusChanged&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; event for status updates. &lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="3" face="Calibri"&gt;To get you started using the managed Location API, let’s look at a couple of simple location-aware programs that access the location property or subscribe to updates when the location or location status changes.&amp;#160; For each of these examples, you’ll want to add a reference to &lt;b&gt;System.Device&lt;/b&gt; in your Visual Studio 2010 project, and add a using statement for the &lt;b&gt;System.Device.Location&lt;/b&gt; namespace to your code.&amp;#160; The first example gets the location from the &lt;b&gt;Position&lt;/b&gt; property, and the second gets the location and status by subscribing to events.&lt;/font&gt;&lt;/p&gt;  &lt;h4&gt;&lt;font face="Calibri"&gt;Example 1: Accessing the Position Property&lt;/font&gt;&lt;/h4&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;// Accessing the Position Property&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Device.Location; &lt;span style="color: #008000"&gt;// Add a reference to System.Device.dll&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; LocationPropertyExample&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Program&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            GetLocationProperty();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; GetLocationProperty()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            GeoCoordinateWatcher watcher = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; GeoCoordinateWatcher();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;             &lt;span style="color: #008000"&gt;// Initiate acquisition of location data, so that we &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;             &lt;span style="color: #008000"&gt;// can get location coordinates from the Position property.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;             &lt;span style="color: #008000"&gt;// 1. If we don’t have access to the location sensors, &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;             &lt;span style="color: #008000"&gt;// the user will be prompted with a permission dialog.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;             &lt;span style="color: #008000"&gt;// 2. If we have permissions, following this call, we can &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;             &lt;span style="color: #008000"&gt;//    access location data from the Position property, &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;             &lt;span style="color: #008000"&gt;//    and we'll get PositionChanged events if we have set&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;             &lt;span style="color: #008000"&gt;//    up an event handler.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            watcher.TryStart(&lt;span style="color: #0000ff"&gt;false&lt;/span&gt;, &lt;span style="color: #008000"&gt;// Do not suppress permissions prompt.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;               TimeSpan.FromMilliseconds(1000)); &lt;span style="color: #008000"&gt;// Wait 1000 ms to start.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            GeoCoordinate coord = watcher.Position.Location;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (coord.IsUnknown != &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;Lat: {0}, Long: {1}&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    coord.Latitude,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    coord.Longitude);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;Unknown latitude and longitude.&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;h4&gt;&lt;font face="Calibri"&gt;Example 2: Subscribing to PositionChanged and StatusChanged Events&lt;/font&gt;&lt;/h4&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;// Subscribing to Location Events&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Device.Location; &lt;span style="color: #008000"&gt;// Add a reference to System.Device.dll &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; LocationEventExample&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Program&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;Displaying location updates. Press any key to exit...&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// GeoCoordinateWatcher is the root object for the .NET 4 Location API&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            GeoCoordinateWatcher locationWatcher;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// Initialize the GeoCoordinateWatcher with default accuracy settings&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            locationWatcher = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; GeoCoordinateWatcher();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// Subscribe to updates when the location changes&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            locationWatcher.PositionChanged += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EventHandler&amp;lt;GeoPositionChangedEventArgs&amp;lt;GeoCoordinate&amp;gt;&amp;gt;(locationWatcher_PositionChanged);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// Subscribe to updates when the status changes.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// The Status property indicates whether a location sensor is &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// initializing, ready to supply new data, or if location data is not  &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// available from any sensor. &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            watcher.StatusChanged += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EventHandler&amp;lt;GeoPositionStatusChangedEventArgs&amp;gt; (locationWatcher_StatusChanged);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// Initiate acquisition of location data, so that we &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// get PositionChanged events.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// 1. If we don’t have access to the location sensors, the user will &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;//    prompted with a dialog to grant or deny permission.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// 2. If we have permissions, following this call, we'll be able to &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;//    access location data, and we'll get PositionChanged events if&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;//    we have set up an event handler&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            locationWatcher.Start();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            Console.ReadKey();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; locationWatcher_PositionChanged(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, GeoPositionChangedEventArgs&amp;lt;GeoCoordinate&amp;gt; e)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// Output the new location coordinate to the console if present&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (e.Position.Location != GeoCoordinate.Unknown)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                Console.WriteLine(&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    &lt;span style="color: #006080"&gt;&amp;quot;Latitude:  &amp;quot;&lt;/span&gt; + e.Position.Location.Latitude.ToString() +&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    &lt;span style="color: #006080"&gt;&amp;quot; Longitude: &amp;quot;&lt;/span&gt; + e.Position.Location.Longitude.ToString());&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;       &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; locationWatcher_StatusChanged(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, GeoPositionStatusChangedEventArgs e)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;       {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;switch&lt;/span&gt; (e.Status)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; GeoPositionStatus.Initializing:&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;Working on location fix&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; GeoPositionStatus.Ready:&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;Have location&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; GeoPositionStatus.NoData:&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;No data&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; GeoPositionStatus.Disabled:&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;Disabled&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;       }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;-- Sensor &amp;amp; Location Platform Team&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;i&gt;&lt;font size="3" face="Calibri"&gt;This posting is provided &amp;quot;AS IS&amp;quot; with no warranties and confers no rights.&lt;/font&gt;&lt;/i&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9968414" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/location/">location</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/-net/">.net</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/visual+studio/">visual studio</category></item><item><title>The Sensor and Location Drill Down – Part 3: The Location API</title><link>http://blogs.msdn.com/b/sensorslocation/archive/2010/02/10/the-sensor-and-location-drill-down-part-3-the-location-api.aspx</link><pubDate>Thu, 11 Feb 2010 01:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9961667</guid><dc:creator>sensblog</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/rsscomments.aspx?WeblogPostID=9961667</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sensorslocation/commentapi.aspx?WeblogPostID=9961667</wfw:comment><comments>http://blogs.msdn.com/b/sensorslocation/archive/2010/02/10/the-sensor-and-location-drill-down-part-3-the-location-api.aspx#comments</comments><description>&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;Over the last few weeks we have been providing an introduction to the Sensor and Location Platform by examining each component in the platform in greater detail.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;We started first with an overview of the &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/sensorslocation/archive/2009/12/15/sensor-location-platform-the-50-000-foot-view.aspx" mce_href="http://blogs.msdn.com/sensorslocation/archive/2009/12/15/sensor-location-platform-the-50-000-foot-view.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;Sensor and Location Platform&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;This was followed up with a drill down in the &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/sensorslocation/archive/2010/01/12/the-sensor-and-location-platform-drill-down-part-1-the-sensor-ddi.aspx" mce_href="http://blogs.msdn.com/sensorslocation/archive/2010/01/12/the-sensor-and-location-platform-drill-down-part-1-the-sensor-ddi.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;Sensor DDI or Device Driver Interface&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;Next we examined the &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/sensorslocation/archive/2010/01/27/the-sensor-and-location-drill-down-part-2-the-sensor-api.aspx" mce_href="http://blogs.msdn.com/sensorslocation/archive/2010/01/27/the-sensor-and-location-drill-down-part-2-the-sensor-api.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;Sensor API&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; and how it fits into the Sensor and Location Platform.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;As the final post in this series we will be examining the Location API. The Location API, as described in the introduction post (&lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/sensorslocation/archive/2009/12/15/sensor-location-platform-the-50-000-foot-view.aspx" mce_href="http://blogs.msdn.com/sensorslocation/archive/2009/12/15/sensor-location-platform-the-50-000-foot-view.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;link&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;) sits on top of the sensor and location “API stack”. That is to say that the Location API is really a client of the Sensor API and the framework provided by the Sensor DDI. As a refresher – here is a diagram of the Location Platform:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/sensorslocation/WindowsLiveWriter/TheSensorandLocationDrillDownPart3TheLoc_FFF7/image_3.png" width=533 height=300 mce_src="http://blogs.msdn.com/blogfiles/sensorslocation/WindowsLiveWriter/TheSensorandLocationDrillDownPart3TheLoc_FFF7/image_3.png"&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;There are a few important notes to cover about the Location API Layer in this diagram. The first is that the Location API is actually a collection of two API’s. A COM API which is accessible via native C++ applications and an IDispatch or “scripting” API. The IDispatch API provides access to Location in script enabled environments like the Windows Scripting Host and Active X controls. As an example – it’s possible to write a Sidebar Gadget (as identified in the diagram above) that can access Location via the IDispatch API interface.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;What may not be clear in this diagram is that a “Location Sensor” is really just a Sensor that provides Location information. The location sensor data that is available from the Location API is also available, in a more basic format, from the Sensor API. &lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;This may make you ask – what does the Location API do for you? The Location API is designed to focus on making access to location information easier. Two specific guiding goals are important to drill into:&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;- Simplify access to location sources (i.e. location sensors).&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;- Simplify accessing location information from location sensors.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;Let’s examine each of those goals in isolation:&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;First, simplifying access to location sources: At any given time you may have one or more location sensors on your machine (&lt;/FONT&gt;&lt;A href="http://windows.microsoft.com/en-us/windows7/Set-a-geographic-location-for-your-computer" mce_href="http://windows.microsoft.com/en-us/windows7/Set-a-geographic-location-for-your-computer"&gt;&lt;FONT size=3 face=Calibri&gt;default location&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; + some other location sensor like a GPS sensor). If you were to access these location sensors directly from the Sensor API you would need to talk to all available location sensors and make some determination about which sensor is likely to provide the location data you want. The Location API does the work, internally, to identify and use the location sensor which appears to be most accurate and reliable.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;Second, simplify accessing location information from location sensors: A location sensor is just a sensor. As such you can access the location sensors information from the Sensor API. However, the Sensor API is designed to provide generalized access to all forms of sensor devices on your machine. As a result accessing data from sensors usually requires a several steps. Take a look at our last blog post on the Sensor API to get a quick overview of these steps (&lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/sensorslocation/archive/2010/01/27/the-sensor-and-location-drill-down-part-2-the-sensor-api.aspx" mce_href="http://blogs.msdn.com/sensorslocation/archive/2010/01/27/the-sensor-and-location-drill-down-part-2-the-sensor-api.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;link&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;). The Location API automatically calls into the Sensor API and extracts location information for you. The Location API then presents the information in a format that is specifically suited for location data, such as &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd317673(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd317673(VS.85).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;ILatLongReport&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; and &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd317669(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd317669(VS.85).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;ICivicAddressReport&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;. The net effect is that it is generally much simpler to ask the Location API for location data instead of using the Sensor API.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;So, how do you access location data from the Location API? Let’s walk through a quick example using the COM Location API. Note - each step below will contain a link to the relevant document in MSDN.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;- First create an instance of the Location API by CoCreating &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd317737(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd317737(VS.85).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;ILocation&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;- Next, call ILocation-&amp;gt;&lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd317633(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd317633(VS.85).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;RegisterForReports()&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; to register to receive ILocationReport’s (either an &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd317673(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd317673(VS.85).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;ILatLongReport&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; or an &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd317669(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd317669(VS.85).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;ICivicAddressReport&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;).&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;- When you call &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd317633(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd317633(VS.85).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;RegisterForReports()&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; on an ILocation object you will register a call-back object which will be called when the Location API wants to notify you of changes in Location or Location Status. The callback object will need to implement the &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd317675(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd317675(VS.85).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;ILocationEvents&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; interface to receive location events. When a location change occurs the &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd317615(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd317615(VS.85).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;OnLocationChanged()&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; method, which will be implemented in your callback object, will get called with the updated ILatLongReport or ICivicAddressReport.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;- The &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd317615(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd317615(VS.85).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;OnLocationChanged()&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; callback method will deliver to your callback object either an &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd317673(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd317673(VS.85).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;ILatLongReport&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; or an &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd317669(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd317669(VS.85).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;ICivicAddressReport&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;. Each report object provides methods to access the location information contained by the object. As an example you can access the latitude on an ILatLongReport by calling the &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd317611(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd317611(VS.85).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;GetLatitude()&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; method. The &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd317611(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd317611(VS.85).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;GetLatitude()&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; method will return a double which represents the current latitude for your location sensor.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;The Location API documentation on MSDN has an example which shows all of the above in steps in one location with a description for each object used. You can find that information &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd317735(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd317735(VS.85).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;To summarize:&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;- The Location API sit’s at the top of the Sensor API stack and provides simplified access to location data.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;- To access Location you can either use the COM Location API interface in C++ or you can use the scripting interface.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;- To get location updates in your application all you need to do is create the Location API, register for reports and then handle location changes on your call back object.&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=justify&gt;&lt;FONT size=3 face=Calibri&gt;A few final notes: The Location API team has been working over the last several months with the .NET CLR Team to build a Managed Location API which will ship in the next version of .NET. We are tremendously excited about having location exposed to developers via COM, Scripting and now .NET. You can find some initial information about the .NET Location API on Gavin’s blog (&lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/gavingear/archive/tags/.NET+4+Location/default.aspx" mce_href="http://blogs.msdn.com/gavingear/archive/tags/.NET+4+Location/default.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;link&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;). Stay tuned here for more information!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3 face=Calibri&gt;-- Sensor &amp;amp; Location Platform Team&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;&lt;FONT size=3 face=Calibri&gt;This posting is provided "AS IS" with no warranties and confers no rights.&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9961667" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/location/">location</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/windows7/">windows7</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/platform/">platform</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/architecture/">architecture</category><category domain="http://blogs.msdn.com/b/sensorslocation/archive/tags/LocationAPI/">LocationAPI</category></item></channel></rss>