Added a WMI provider, documentation to follow.
1 using System.Management.Instrumentation;
2 using OpenHardwareMonitor.Hardware;
4 namespace OpenHardwareMonitor.WMIProvider {
5 [InstrumentationClass(InstrumentationType.Instance)]
6 public class Sensor : IWmiClass {
8 private ISensor _sensor;
10 public string SensorType { get; private set; }
11 public string Identifier { get; private set; }
12 public string Parent { get; private set; }
13 public string Name { get; private set; }
14 public float Value { get; private set; }
15 public float Min { get; private set; }
16 public float Max { get; private set; }
17 public int Index { get; private set; }
19 public Sensor(ISensor sensor) {
23 SensorType = sensor.SensorType.ToString();
24 Identifier = sensor.Identifier.ToString();
25 Parent = sensor.Hardware.Identifier.ToString();
30 public void Update() {
31 Value = (_sensor.Value != null) ? (float)_sensor.Value : 0;
33 if (_sensor.Min != null)
34 Min = (float)_sensor.Min;
36 if (_sensor.Max != null)
37 Max = (float)_sensor.Max;