28
Building Sensor- based Apps Windows Phone Windows Store Windows Desktop Tim Binkley-Jones manning.com/binkley

Building Sensor-based Apps Windows Phone Windows Store Windows Desktop Tim Binkley-Jones manning.com/binkley

Embed Size (px)

Citation preview

Building Sensor-based Apps Windows PhoneWindows Store

Windows Desktop

Tim Binkley-Jonesmanning.com/binkley

Sky Map for Windows PhoneSkyMap is an amazing planetarium for your windows phone. It enables you to point your phone at the sky and see what stars, constellations, planets or deep space objects are out there in real time.

HERE City LensSimply hold up your phone as though taking a photo, and HERE City Lens overlays the best shops, restaurants and points of interest right on your display.

Windows Runtime

Windows StoreWindows Desktop

Windows What??? Windows RT

Windows 8

is

an upgrade of Windows Phone 7

both

and

a slimmed down version of Windows 8

Windows Phone 8

Image taken from the MSDN article “Windows Phone API reference”http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff626516(v=vs.105).aspx

Taken from the MSDN documentation for the Windows Runtime Accelerometer class

Taken from the MSDN documentation for the Windows Runtime Geolocator class

Taken from the MSDN documentation for the Windows Runtime LightSensor class

Available Sensors

• Camera, Microphone • Geolocator• LightSensor• Accelerometer, Gyrometer• Compass, Inclinometer, OrientationSensor

<PropertyGroup> <TargetPlatformVersion>8.0</TargetPlatformVersion> </PropertyGroup>

For more details, see the MSDN article titled “Managed desktop apps and Windows Runtime”

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\ .NETFramework\v4.5\Facades\System.Runtime.dll

Member Type Description

GetDefault Method A static factory method that returns a sensor instance.

GetCurrentReading Method Returns a read-only object containing the currently available sensor data.

ReadingChanged Event An event raised when ever the current reading changes.

ReportInterval PropertySpecifies how often the sensor reads new data. The data returned by the GetCurrentReading will only change once every time interval.

MinimumReportInterval PropertyA read-only value specifying the smallest value that can be passed set in the ReportInterval property.

Accelerometer

public sealed class AccelerometerReading{ public double AccelerationX { get; } public double AccelerationY { get; } public double AccelerationZ { get; } public DateTimeOffset Timestamp { get; }}

The acceleration along the each axis in g’s.

Gyrometer

public sealed class GyrometerReading{ public double AngularVelocityX { get; } public double AngularVelocityY { get; } public double AngularVelocityZ { get; } public DateTimeOffset Timestamp { get; }}

The angular velocity, in degrees per second, about each axis.

Compass

public sealed class CompassReading{ public double HeadingMagneticNorth { get; } public double? HeadingTrueNorth { get; } public DateTimeOffset Timestamp { get; }}

Heading - the angle between the magnetic field, and the direction the device is pointed

Inclinometer and Orientation Sensor

public sealed class OrientationSensorReading{ public SensorQuaternion Quaternion { get; } public SensorRotationMatrix RotationMatrix { get; } public DateTimeOffset Timestamp { get; }}

public sealed class InclinometerReading{ public float PitchDegrees { get; } public float RollDegrees { get; } public float YawDegrees { get; } public DateTimeOffset Timestamp { get; }}

Rotation around each access

Rotation matrix and quaternion

Real world point: (0, 10, 0)Relative point: (0, 10, 0)

Real world point: (0, 10, 0)Relative point: (-10, 0, 0)

Real world point: (0, 10, 0)Relative point: (-10, 0, 0)

Building Sensor-based Apps Windows PhoneWindows Store

Windows Desktop

Tim Binkley-Jonesmanning.com/binkley