/// <summary> /// Handles DataUpdated event from ultraviolet sensor. /// </summary> /// <param name="sender">Object which invoked the event.</param> /// <param name="e">Ultraviolet sensor data.</param> private void OnDataUpdated(object sender, UltravioletSensorDataUpdatedEventArgs e) { UvLevel level = UvLevel.None; if (e.UltravioletIndex < 3.0) { level = UvLevel.Low; } else if (e.UltravioletIndex < 6.0) { level = UvLevel.Moderate; } else if (e.UltravioletIndex < 8.0) { level = UvLevel.High; } else if (e.UltravioletIndex < 11.0) { level = UvLevel.VeryHigh; } else { level = UvLevel.Extreme; } UvLevelUpdated?.Invoke(this, level); }
private void Ultraviolet_DataUpdated(object sender, UltravioletSensorDataUpdatedEventArgs e) { Model.UltravioletIndex = e.UltravioletIndex; canvas.Series[0].Points.Add(new Extensions.Point() { Ticks = DateTime.UtcNow.Ticks, Value = e.UltravioletIndex }); canvas.InvalidateSurface(); }
private void storeUltravioletSensorDataCallback(object sender, UltravioletSensorDataUpdatedEventArgs e) { checkUpdateCurrentLogStream(); logStreamWriter.Flush(); lock (logStreamWriter) { logStreamWriter.WriteLine($"wearable-tizen,{new DateTimeOffset(DateTime.Now).ToUnixTimeMilliseconds()},{Tools.ULTRAVIOLET},UltravioletSensor,-1,{e.UltravioletIndex}"); } }