windows 7 sensors dennis 090717162903 phpapp01

30
 Windows 7 Deep Dive Lab Sensor & Location Platform Dennis Loktionov [email protected] July 16, 2009

Upload: jescobar09

Post on 13-Jul-2015

18 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 1/30

 

Windows 7 Deep Dive Lab

Sensor & Location Platform

Dennis [email protected]

July 16, 2009

Page 2: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 2/30

Page 3: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 3/30

Page 4: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 4/30

 

 Agenda

Windows 7 Sensor & Location Platform

Introduction

Sensor Platform  Architecture

Working with the Sensor  API Location Platform  Architecture

Working with the Location  API

Demos

Questions

Page 5: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 5/30

 

Introduction

Definition

 ± Sensors measure a physical phenomenon or a physical interaction

Sensor Types ± Ambient Light Sensors ( ALS)

 ± Accelerometers

 ± Location Sensors

GPS, Wi-Fi /cell tower triangulation, IP Geolocation

 ± Proximity Sensors

 ± Temperature Sensors

 ± Biometric Sensor*

 ± Others (Human presence, RFID)

Page 6: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 6/30

 

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 (NME A, others)

Page 7: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 7/30

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

Benefits ± Implements native support for sensor and location devices on Windows

 ± No need to tar get vendor-specific APIs or to know hardware specifics

 ± Consistent interface for all sensor types

 ± Privacy and security

 

Page 8: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 8/30

Sensor Platform  Architecture

Sensor 

device This is a partial diagram of the Sensor and LocationPlatform, showing only sensor-related parts

 

Page 9: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 9/30

Privacy and  Access Control

Location data is considered private

 ± Legal term: Personally identifiable information (PII)

 ± User consent is required to share data

All sensors are disabled by default

Administrator rights required to enable a sensor  Sensors are configured on a per-user basis (not per application)

Enable Sensors dialog box

is invoked by applications

 

Page 10: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 10/30

Sensor  API  Architecture

COM-based API (includes Sensorsapi.h and Sensors.h)

Consists of these main interfaces:

 ± ISensorManager  Sensor enumeration, attachment event, request permissions

 ± ISensor 

Get and set properties, get report, events (new report, detachment,

state change, custom) and more

 ± ISensorDataReport

Get sensor data report data fields

 

Page 11: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 11/30

Sensor  API  Architecture

 

Page 12: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 12/30

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)

Properties

 ± Read-only (such as model) or read-write (such as report interval).

 ± Sensors may have custom properties

Data

 ± Get (sensor-specific) data report object synchronously (not

recommended) or asynchronously (events)

Events

 ± State change, leave (detach), data updated, custom

State

 ± Is sensor working properly? Do you have access?

 

Page 13: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 13/30

Enumerating Sensors

#include <sensorsapi.h>

#include <sensors.h>

HRESULT hr;

CComPtr<ISensorManager> pSensorManager;

pSensorManager.CoCreateInstance(CLSID_SensorManager);

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

if(SUCCEEDED(hr))

{

pALSCollection->GetAt(0, &pALSSensor);

}

 

Page 14: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 14/30

Getting Current Light Level

STDMETHODIMP CALSEventSink::OnDataUpdated(

ISensor* pSensor, ISensorDataReport* pNewData)

{

PROPVARIANT lightLevel;

PropVariantInit(&lightLevel);

// Get the sensor reading from the ISensorDataReport objectpNewData->GetSensorValue(SENSOR_DATA_TYPE_LIGHT_LEVEL_LUX, &lightLevel);

// Extract the float value from the PROPV ARI ANT 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

UpdateUI(lightNormalized);

PropVariantClear(&lightLevel);

return S_OK;

}

 

Page 15: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 15/30

Sensor .NET Wrapper  Architecture

 

Page 16: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 16/30

Sensor .NET Wrapper  Architecture

Sensor is an abstract base class with a derived type for each

sensor type

 ± Derived types can add properties and events

 

Page 17: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 17/30

Sensor .NET Wrapper  Architecture

SensorDataReport also has a derived type for each sensor type

 ± Provides a strongly-typed way to access data

 

Page 18: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 18/30

 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 optimizeUIcontent for various lighting conditions

Demo«

 

Page 19: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 19/30

Sensor Development Kit

Based on Freescale JM Badge Board

Sensors

 ± Ambient light sensor 

 ± 3D  Accelerometer 

 ± Dual touch strip sensors

Developer tools

 ± Sample firmware code

 ± Sample driver code

 ± Diagnostic and sample applications Sensor Diagnostic Tool

Light-aware MSDN Reader 

Marble game

Demo«

 

Page 20: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 20/30

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

 

Page 21: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 21/30

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?

Others«

 

Page 22: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 22/30

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

 

Page 23: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 23/30

Location Platform  Architecture

User

System

 

Page 24: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 24/30

Configuring Default Location

 

Page 25: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 25/30

Location  API  Architecture

 

Page 26: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 26/30

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

Demo«

 

Page 27: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 27/30

3D Bing Maps & Location Platform

Demo«

 

Page 28: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 28/30

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 

 

Page 29: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 29/30

Questions ?

Q&A

 

Page 30: Windows 7 Sensors Dennis 090717162903 Phpapp01

5/12/2018 Windows 7 Sensors Dennis 090717162903 Phpapp01 - slidepdf.com

http://slidepdf.com/reader/full/windows-7-sensors-dennis-090717162903-phpapp01 30/30

The End. Fin. .

THANKS