Hardware/Heatmaster/Heatmaster.cs
changeset 195 0ee888c485d5
parent 182 4801e9eaf979
child 260 5a6ac1d1bc0e
     1.1 --- a/Hardware/Heatmaster/Heatmaster.cs	Tue Sep 21 10:33:28 2010 +0000
     1.2 +++ b/Hardware/Heatmaster/Heatmaster.cs	Tue Sep 21 20:32:36 2010 +0000
     1.3 @@ -46,22 +46,22 @@
     1.4  namespace OpenHardwareMonitor.Hardware.Heatmaster {
     1.5    internal class Heatmaster : Hardware, IDisposable {
     1.6  
     1.7 -    private string portName;
     1.8 +    private readonly string portName;
     1.9      private SerialPort serialPort;
    1.10  
    1.11 -    private int hardwareRevision;
    1.12 -    private int firmwareRevision;
    1.13 -    private int firmwareCRC;
    1.14 +    private readonly int hardwareRevision;
    1.15 +    private readonly int firmwareRevision;
    1.16 +    private readonly int firmwareCRC;
    1.17  
    1.18 -    private Sensor[] fans;
    1.19 -    private Sensor[] controls;
    1.20 -    private Sensor[] temperatures;
    1.21 -    private Sensor[] flows;
    1.22 -    private Sensor[] relays;
    1.23 +    private readonly Sensor[] fans;
    1.24 +    private readonly Sensor[] controls;
    1.25 +    private readonly Sensor[] temperatures;
    1.26 +    private readonly Sensor[] flows;
    1.27 +    private readonly Sensor[] relays;
    1.28      
    1.29 -    private bool available = false;
    1.30 +    private readonly bool available;
    1.31  
    1.32 -    private StringBuilder buffer = new StringBuilder();
    1.33 +    private readonly StringBuilder buffer = new StringBuilder();
    1.34  
    1.35      private string ReadLine(int timeout) {
    1.36        int i = 0;
    1.37 @@ -94,7 +94,7 @@
    1.38        return null;
    1.39      }
    1.40  
    1.41 -    private string ReadString(int device, char field) {
    1.42 +    protected string ReadString(int device, char field) {
    1.43        string s = ReadField(device, field);
    1.44        if (s != null && s[0] == '"' && s[s.Length - 1] == '"')
    1.45          return s.Substring(1, s.Length - 2);
    1.46 @@ -102,7 +102,7 @@
    1.47          return null;
    1.48      }
    1.49  
    1.50 -    private int ReadInteger(int device, char field) {
    1.51 +    protected int ReadInteger(int device, char field) {
    1.52        string s = ReadField(device, field);      
    1.53        int i;
    1.54        if (int.TryParse(s, out i))
    1.55 @@ -125,12 +125,12 @@
    1.56        return false;
    1.57      }
    1.58  
    1.59 -    private bool WriteInteger(int device, char field, int value) {
    1.60 +    protected bool WriteInteger(int device, char field, int value) {
    1.61        return WriteField(device, field, 
    1.62          value.ToString(CultureInfo.InvariantCulture));
    1.63      }
    1.64  
    1.65 -    private bool WriteString(int device, char field, string value) {
    1.66 +    protected bool WriteString(int device, char field, string value) {
    1.67        return WriteField(device, field, '"' + value + '"');
    1.68      }
    1.69  
    1.70 @@ -164,15 +164,7 @@
    1.71              new Sensor(name, device, SensorType.Control, this, settings);
    1.72            controls[i].Value = (100 / 255.0f) * ReadInteger(device, 'P');
    1.73            ActivateSensor(controls[i]);
    1.74 -        }
    1.75 -        
    1.76 -        for (int i = 0; i < fanCount; i++) {
    1.77 -          int device = 33 + i;
    1.78 -          string name = ReadString(device, 'C');
    1.79 -          
    1.80 -          fans[i].Value = ReadInteger(device, 'R');
    1.81 -          ActivateSensor(fans[i]);
    1.82 -        }
    1.83 +        }       
    1.84  
    1.85          temperatures = new Sensor[temperatureCount];
    1.86          for (int i = 0; i < temperatureCount; i++) {
    1.87 @@ -220,7 +212,7 @@
    1.88      public override Identifier Identifier {
    1.89        get {
    1.90          return new Identifier("heatmaster",
    1.91 -          serialPort.PortName.TrimStart(new char[]{'/'}).ToLowerInvariant());
    1.92 +          serialPort.PortName.TrimStart(new [] {'/'}).ToLowerInvariant());
    1.93        }
    1.94      }
    1.95