• Like
Windows7 Sensor & Location Platform
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Windows7 Sensor & Location Platform



  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. Windows 7 Deep Dive LabSensor & Location Platform
    Dennis Loktionov dloktionov@absolute.com
    July 16, 2009
  • 2.
  • 3.
  • 4. Agenda
    Windows 7 Sensor & Location Platform
    • Introduction
    • 5. Sensor Platform Architecture
    • 6. Working with the Sensor API
    • 7. Location Platform Architecture
    • 8. Working with the Location API
    • 9. Demos
  • 10. Introduction
    Sensors measure a physical phenomenon or a physical interaction
    Sensor Types
    Ambient Light Sensors (ALS)
    Location Sensors
    GPS, Wi-Fi /cell tower triangulation, IP Geolocation
    Proximity Sensors
    Temperature Sensors
    Biometric Sensor*
    Others (Human presence, RFID)
  • 11. Limitations of Sensors Today
    Sensors are integrated as vertical solutions
    Applications need to know sensor hardware specifics
    Limited adoption and scope
    Sensors are exposed as virtual COM ports
    Exclusive application access
    Not secure
    Proprietary data formats (NMEA, others)
  • 12. Sensor Platform Overview
    Unified Driver Model for all types of sensors
    Physical sensors (e.g., GPS devices, Light Sensors)
    Logical sensor (e.g., Wi-Fi triangulation resolver)
    Standard APIs for accessing sensors
    COM-based Sensor API
    Works with drivers using the sensor class extension
    Implements native support for sensor and location devices on Windows
    No need to target vendor-specific APIs or to know hardware specifics
    Consistent interface for all sensor types
    Privacy and security
  • 13. Sensor Platform Architecture
    Location and Other Sensors Control Panel
    Sensor API
    Sensor class extension
    UMDF sensor driver
    This is a partial diagram of the Sensor and Location Platform, showing only sensor-related parts
  • 14. Privacy and Access Control
    • Location data is considered private
    • 15. Legal term: Personally identifiable information (PII)
    • 16. User consent is required to share data
    • 17. All sensors are disabled by default
    • 18. Administrator rights required to enable a sensor
    • 19. Sensors are configured on a per-user basis (not per application)
    • 20. Enable Sensors dialog box
    is invoked by applications
  • 21. Sensor API Architecture
    COM-based API (includes Sensorsapi.h and Sensors.h)
    Consists of these main interfaces:
    Sensor enumeration, attachment event, request permissions
    Get and set properties, get report, events (new report, detachment, state change, custom) and more
    Get sensor data report data fields
  • 22. Sensor API Architecture
  • 23. Sensors Explained
    Enumerated via category and type GUIDs
    Category represents what is being sensed (for example, environment, location, motion, electrical systems)
    Type represents how it is being sensed (for example, by thermometer, GPS, accelerometer, voltage)
    Read-only (such as model) or read-write (such as report interval).
    Sensors may have custom properties
    Get (sensor-specific) data report object synchronously (not recommended) or asynchronously (events)
    State change, leave (detach), data updated, custom
    Is sensor working properly? Do you have access?
  • 24. Enumerating Sensors
    #include <sensorsapi.h>
    #include <sensors.h>
    HRESULT hr;
    CComPtr<ISensorManager> pSensorManager;
    CComPtr<ISensorCollection> pALSCollection;
    CComPtr<ISensor> pALSSensor;
    // Get all the ALS sensors on the system
    pSensorManager->GetSensorsByType(SENSOR_TYPE_AMBIENT_LIGHT, &pALSCollection);
    hr = pSensorManager->RequestPermissions(
    0, // Owner window
    pALSCollection, // Collection of sensors requiring permissions
    TRUE); // Modal flag
    pALSCollection->GetAt(0, &pALSSensor);
  • 25. Getting Current Light Level
    STDMETHODIMP CALSEventSink::OnDataUpdated(
    ISensor* pSensor, ISensorDataReport* pNewData)
    PROPVARIANT lightLevel;
    // Get the sensor reading from the ISensorDataReport object
    pNewData->GetSensorValue(SENSOR_DATA_TYPE_LIGHT_LEVEL_LUX, &lightLevel);
    // Extract the float value from the PROPVARIANT object
    float luxValue = V_FLOAT(lightLevel);
    // Normalize the light sensor data
    double lightNormalized = ::pow(luxValue, 0.4) / 100.0;
    // Handle UI changes based on the normalized LUX data
    // which ranges from 0.0 - 1.0 for a lux range of
    // 0 lux to 100,000 lux, this method represents such a
    // handler that would be implemented in your application
    return S_OK;
  • 26. Sensor .NET Wrapper Architecture
  • 27. Sensor .NET Wrapper Architecture
    • Sensor is an abstract base class with a derived type for each sensor type
    • 28. Derived types can add properties and events
  • Sensor .NET Wrapper Architecture
    • SensorDataReport also has a derived type for each sensor type
    • 29. Provides a strongly-typed way to access data
  • Ambient Light Sensor (ALS)
    Measure light intensity in LUX (lumens per square meter)
    Windows 7 includes class driver support for ACPI light sensors
    Working with OEMs to integrate light sensors into notebooks
    Adaptive brightness feature supported by Windows 7
    OS automatically adjusts display backlight
    Light-aware applications can use these sensors to optimize UI content for various lighting conditions
  • 30. Sensor Development Kit
    • Based on Freescale JM Badge Board
    • 31. Sensors
    • 32. Ambient light sensor
    • 33. 3D Accelerometer
    • 34. Dual touch strip sensors
    • 35. Developer tools
    • 36. Sample firmware code
    • 37. Sample driver code
    • 38. Diagnostic and sample applications
    • 39. Sensor Diagnostic Tool
    • 40. Light-aware MSDN Reader
    • 41. Marble game
    • 42. Demo…
  • Location Platform Overview
    Single API call to answer “Where am I?”
    Provider (such as: GPS, IP resolver, Wi-Fi) independent
    Synchronous and asynchronous models
    Script or automation compatible
    Automatic transition between providers
    Most accurate providers have priority
    Concurrent access for multiple applications
    Default location
    Provided by user as fallback when no other sources are available
  • 43. Location-Awareness Opportunities
    Useful local information
    Location based search for points of interest
    Mapping/navigation based on current location
    PC recovery service
    Social networking: Where are my friends and family?
  • 44. Location Platform API Overview
    The Windows 7 Location API is built on top of the Sensor API
    COM-based API (includes Locationapi.h)
    It is a high-level abstraction
    Leverages sensors which provide location information
    Some sensors (location providers) may be logical
    Ex: Wi-Fi hotspot triangulation
  • 45. Location Platform Architecture
    Gadget or script
    Location API
    Location IDispatch Interface
    Sensor API
    Location and Other Sensors Control Panel
    Sensor class extension
    Sensor class extension
    UMDF sensor driver
    UMDF sensor driver
    Logical location sensor
  • 46. Configuring Default Location
  • 47. Location API Architecture
  • 48. Types of Location Data
    Geographic data (ILatLongReport)
    Latitude, longitude, altitude, associated error required
    Most common format
    Best format for precise location
    Can reverse geo-code later
    Civic address (ICivicAddressReport)
    Zip code, country required
    Most human readable
    Best for ‘rough’ location estimates, street directions
  • 49. 3D Bing Maps & Location Platform
  • 50. Summary
    Sensor Platform overview & architecture
    Native Sensor API
    Managed Sensor API wrapper
    Native Location API
    Types of location data, default location
    Managed Location API wrapper
  • 51. Questions ?
  • 52. The End. Fin. Конец.