26
Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli www.Intel-Software-Academic-Program.com [email protected] Intel Software 2013-03-20

Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli [email protected] Intel Software

Embed Size (px)

Citation preview

Page 1: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Win8 on Intel Programming CourseModern UI : Sensors

Cédric Andreolliwww.Intel-Software-Academic-Program.com

[email protected] Software

2013-03-20

Page 2: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Sensors

Page 3: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Sensors

Sensors in few wordsSensors convert a physical measure into a signalSensors are used for

TemperatureDevice Location : GPSOrientationEtc

Sensors are used in mobile development since many yearsThey are already available on tablet and on some Ultrabooks

Page 4: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Sensors

Why use sensorsUsing sensors can improve the user experienceThey are used in gamesThey are used in augmented realityThey are used in GPS applicationA lot of mobile applications use sensors today !

Page 5: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Different kinds of sensors

Page 6: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Sensors

Device locationGPS is the most popular kind of sensorThe GPS acquire the user position from satellitesWi-Fi can also be used (WPS)Give access to :

LatitudeLongitudeAltitude

Page 7: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Sensors

AccelerometerCompute the properacceleration of an objectAn accelerometer contains3 sensors :

One for the x-axisOne for the y-axisOne for the z-axis

An accelerometer that lay on a table will measureg=-9.81 m/s on the z-axis

Page 8: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Sensors

GyrometerIt measures rotational velocityIt doesn’t define a position but the current rotation speedData difficult to use directly

Page 9: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Sensors

MagnetometerMeasures the strenght of a magnetic fieldCan be used to compute the device orientation

Page 10: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Sensors

Light sensorMeasures the intensity of light in LuxWindows 8 uses the light sensorto set the screen luminosity

Page 11: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Sensor fusion

Page 12: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Sensor fusion

What is the sensor fusionA single sensor do not provide clean dataIt is very hard to get a stable device orientationThe value of a single sensor can suffer from interferenceFusionning sensors can help solving this problem

Page 13: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Sensor fusion

How does it work ?The fusion of the 3 default sensors gives access to :Compass + Inclinometer + Orientation

Page 14: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Programming with sensors

Page 15: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Programming with sensors

Access and RightsSome sensors give access to personal informationExample : GPS gives the user’s current position

You need to activate new capabilitiesOpen the manifest and go to “Capabilities”

Page 16: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Programming with sensors

Page 17: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Programming with sensors

Windows.Devices.SensorsNamespace that gives access to the sensors. References :

AccelerometerCompassGyrometerInclinometerLightSensoretc …

Use the GetDefault() method to access the device :Var accelerometer = Windows.Devices.Sensors.Accelerometer.GetDefault()

Page 18: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Programming with sensors

The AccelerometerEasy to implementNot so easy to use

Represent the proper acceleration on each axis

Interferences can modify the valueLets see how to retrieve the values of this sensor

Page 19: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Programming with sensors

The Accelerometer – full code

Page 20: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Programming with sensors

The Light Sensor – full code

Page 21: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Programming with sensors

The Location serviceImplementation of the location service is differentUsing the location can be very interesting

Show some places of interest near your position

Indicates your current location to a friendetc …

A lot of augmented reality applications use GPS

Page 22: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Programming with sensors

Page 23: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Programming with sensors

The Location Service – full code

Page 24: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

Programming with sensors

The Location Service – here’s how it looks

Page 25: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software
Page 26: Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli  paul.guermonprez@intel.com Intel Software

License Creative Commons – By 3.0

You are free:• to Share — to copy, distribute and transmit the work • to Remix — to adapt the work • to make commercial use of the work Under the following conditions:• Attribution — You must attribute the work in the manner specified by the author or licensor (but

not in any way that suggests that they endorse you or your use of the work).With the understanding that: • Waiver — Any of the above conditions can be waived if you get permission from the copyright

holder. • Public Domain — Where the work or any of its elements is in the public domain under applicable

law, that status is in no way affected by the license. • Other Rights — In no way are any of the following rights affected by the license:

– Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; – The author's moral rights; – Rights other persons may have either in the work itself or in how the work is used, such as publicity or

privacy rights. • Notice — For any reuse or distribution, you must make clear to others the license terms of this

work. The best way to do this is with a link to this web page.

http://creativecommons.org/licenses/by/3.0/