paulwerelds@223: using System.Management.Instrumentation; paulwerelds@223: using OpenHardwareMonitor.Hardware; paulwerelds@223: paulwerelds@223: namespace OpenHardwareMonitor.WMIProvider { paulwerelds@223: [InstrumentationClass(InstrumentationType.Instance)] paulwerelds@223: public class Sensor : IWmiClass { paulwerelds@223: paulwerelds@223: private ISensor _sensor; paulwerelds@223: paulwerelds@223: public string SensorType { get; private set; } paulwerelds@223: public string Identifier { get; private set; } paulwerelds@223: public string Parent { get; private set; } paulwerelds@223: public string Name { get; private set; } paulwerelds@223: public float Value { get; private set; } paulwerelds@223: public float Min { get; private set; } paulwerelds@223: public float Max { get; private set; } paulwerelds@223: public int Index { get; private set; } paulwerelds@223: paulwerelds@223: public Sensor(ISensor sensor) { paulwerelds@223: Name = sensor.Name; paulwerelds@223: Index = sensor.Index; paulwerelds@223: paulwerelds@223: SensorType = sensor.SensorType.ToString(); paulwerelds@223: Identifier = sensor.Identifier.ToString(); paulwerelds@223: Parent = sensor.Hardware.Identifier.ToString(); paulwerelds@223: paulwerelds@223: _sensor = sensor; paulwerelds@223: } paulwerelds@223: paulwerelds@223: public void Update() { paulwerelds@223: Value = (_sensor.Value != null) ? (float)_sensor.Value : 0; paulwerelds@223: paulwerelds@223: if (_sensor.Min != null) paulwerelds@223: Min = (float)_sensor.Min; paulwerelds@223: paulwerelds@223: if (_sensor.Max != null) paulwerelds@223: Max = (float)_sensor.Max; paulwerelds@223: } paulwerelds@223: } paulwerelds@223: }