Created
March 7, 2015 14:56
-
-
Save mayur-tendulkar/d53b8b2626b0e0e760be to your computer and use it in GitHub Desktop.
Attach ReadingChanged Event to sensor object and set initial properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For Gyrometer | |
if (_gyrometer != null) | |
{ | |
// Establish the report interval for all scenarios | |
uint minReportInterval = _gyrometer.MinimumReportInterval; | |
uint reportInterval = minReportInterval > 16 ? minReportInterval : 16; | |
_gyrometer.ReportInterval = reportInterval; | |
// Assign an event handler for the gyrometer reading-changed event | |
_gyrometer.ReadingChanged += ReadingChanged; | |
} | |
//For SimpleOrientationSensor | |
if (_simpleorientation != null) | |
{ | |
_simpleorientation.OrientationChanged += OrientationChanged; | |
} | |
//For LightSensor | |
if (_lightsensor != null) | |
{ | |
uint minReportInterval = _lightsensor.MinimumReportInterval; | |
uint reportInterval = minReportInterval > 16 ? minReportInterval : 16; | |
_lightsensor.ReportInterval = reportInterval; | |
_lightsensor.ReadingChanged += ReadingChanged; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment