Overview

The Windows 7 Sensor & Location Platform enables your applications to adapt to the current environment and change the way they look, feel or behave. Here are few examples:

  • When using a mobile PC (for example, a laptop or tablet) outdoors in a sunny day, an application might increase brightness, contrast and de-saturate colors to increase screen readability
  • An application might provide location-specific information, such as nearby restaurants
  • An application might use 3D accelerometer and buttons as a game controller
  • An application might use a human presence sensor to change the state of the Messenger status

    Figure 1

    Modified MSDN Reader that uses an ambient light sensor to change contrast, size and color saturation

The Sensor & Location Platform has many advantages compared to proprietary solutions:

  • Hardware-independence: No need to learn and invest in a particular vendor's API; all sensors types are handled very similarly
  • Privacy: Because Microsoft recognizes that sensor and location data are private, personally identifying information, all sensors are disabled by default. You can enable/disable sensors at any time via the Control Panel. Applications might prompt you to enable specific sensors via a secure consent UI.
  • Application sharing: Multiple applications can consume data from the same sensor simultaneously
  • Location simplicity: The Location API lets you obtain the location without caring about the particular mechanism used to obtain the information, for example, GPS, cell-tower or Wi-Fi hotspot triangulation. The Location API automatically chooses the most accurate sensor data available. In addition, you don't need to implement GPS protocols such as NMEA.

Objectives

In this Hands-On Lab, you will learn how to integrate the Sensor API into your WPF application.Like the Location API, the Sensor API is COM-based. You will use the Windows API Code Pack that wraps the Sensor API in a type-safe and convenient way.

System Requirements

You must have the following items to complete this lab:

  • Microsoft Visual Studio 2008 SP1
  • Windows 7 RC or later
  • Graphics card fully supporting DirectX and PixelShaders.
  • Hardware with Windows 7-compatible Ambient Light Sensor with driver installed or Virtual Ambient Light Sensor
  • Hardware with Windows 7-compatible 3-axis Accelerometer with driver installed (optional)