private void ProcessCompass(CompassReading compassReading)
{
// Ignores the value if it's not a number or is not valid.
if (Double.IsNaN(compassReading.TrueHeading) || Double.IsNaN(compassReading.HeadingAccuracy))
{
return;
}
// Stores the new valid heading.
DeviceHeading = compassReading.TrueHeading;
DeviceHeadingAccuracy = compassReading.HeadingAccuracy;
}