Hardware/ISensor.cs
author moel.mich
Sun, 23 Sep 2012 18:37:43 +0000
changeset 380 573f1fff48b2
parent 340 600962f8a298
permissions -rw-r--r--
Fixed Issue 387. The new implementation does not try to start a ring 0 driver that already exists, but could not be opened. It tries to delete the driver and install it new. The driver is now stored temporarily in the application folder. The driver is not correctly removed on system shutdown.
     1 /*
     2  
     3   This Source Code Form is subject to the terms of the Mozilla Public
     4   License, v. 2.0. If a copy of the MPL was not distributed with this
     5   file, You can obtain one at http://mozilla.org/MPL/2.0/.
     6  
     7   Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
     8 	
     9 */
    10 
    11 using System;
    12 using System.Collections.Generic;
    13 using OpenHardwareMonitor.Collections;
    14 
    15 namespace OpenHardwareMonitor.Hardware {
    16 
    17   public enum SensorType {
    18     Voltage, // V
    19     Clock, // MHz
    20     Temperature, // °C
    21     Load, // %
    22     Fan, // RPM
    23     Flow, // L/h
    24     Control, // %
    25     Level, // %
    26     Factor, // 1
    27     Power, // W
    28     Data, // GB = 2^30 Bytes    
    29   }
    30 
    31   public struct SensorValue {
    32     private readonly float value;
    33     private readonly DateTime time;
    34 
    35     public SensorValue(float value, DateTime time) {
    36       this.value = value;
    37       this.time = time;
    38     }
    39 
    40     public float Value { get { return value; } }
    41     public DateTime Time { get { return time; } }
    42   }
    43 
    44   public interface ISensor : IElement {
    45 
    46     IHardware Hardware { get; }
    47 
    48     SensorType SensorType { get; }
    49     Identifier Identifier { get; }
    50 
    51     string Name { get; set; }
    52     int Index { get; }
    53 
    54     bool IsDefaultHidden { get; }
    55 
    56     IReadOnlyArray<IParameter> Parameters { get; }
    57 
    58     float? Value { get; }
    59     float? Min { get; }
    60     float? Max { get; }
    61 
    62     void ResetMin();
    63     void ResetMax();
    64 
    65     IEnumerable<SensorValue> Values { get; }
    66 
    67     IControl Control { get; }
    68   }
    69 
    70 }