1.1 --- a/Hardware/HDD/SmartAttribute.cs Wed Jul 25 15:33:16 2012 +0000
1.2 +++ b/Hardware/HDD/SmartAttribute.cs Wed Jul 25 16:03:36 2012 +0000
1.3 @@ -11,6 +11,7 @@
1.4
1.5 using System;
1.6 using System.Collections.Generic;
1.7 +using OpenHardwareMonitor.Collections;
1.8
1.9 namespace OpenHardwareMonitor.Hardware.HDD {
1.10 internal class SmartAttribute {
1.11 @@ -49,9 +50,12 @@
1.12 /// the same sensor channel and type, then a sensor is created only for the
1.13 /// first attribute.</param>
1.14 /// <param name="defaultHiddenSensor">True to hide the sensor initially.</param>
1.15 + /// <param name="parameterDescriptions">Description for the parameters of the sensor
1.16 + /// (or null).</param>
1.17 public SmartAttribute(byte identifier, string name,
1.18 RawValueConversion rawValueConversion, SensorType? sensorType,
1.19 - int sensorChannel, bool defaultHiddenSensor = false)
1.20 + int sensorChannel, bool defaultHiddenSensor = false,
1.21 + ParameterDescription[] parameterDescriptions = null)
1.22 {
1.23 this.Identifier = identifier;
1.24 this.Name = name;
1.25 @@ -59,6 +63,7 @@
1.26 this.SensorType = sensorType;
1.27 this.SensorChannel = sensorChannel;
1.28 this.DefaultHiddenSensor = defaultHiddenSensor;
1.29 + this.ParameterDescriptions = parameterDescriptions;
1.30 }
1.31
1.32 /// <summary>
1.33 @@ -74,20 +79,25 @@
1.34
1.35 public bool DefaultHiddenSensor { get; private set; }
1.36
1.37 + public ParameterDescription[] ParameterDescriptions { get; private set; }
1.38 +
1.39 public bool HasRawValueConversion {
1.40 get {
1.41 return rawValueConversion != null;
1.42 }
1.43 }
1.44
1.45 - public float ConvertValue(DriveAttributeValue value) {
1.46 + public float ConvertValue(DriveAttributeValue value,
1.47 + IReadOnlyArray<IParameter> parameters)
1.48 + {
1.49 if (rawValueConversion == null) {
1.50 return value.AttrValue;
1.51 } else {
1.52 - return rawValueConversion(value.RawValue, value.AttrValue);
1.53 + return rawValueConversion(value.RawValue, value.AttrValue, parameters);
1.54 }
1.55 }
1.56
1.57 - public delegate float RawValueConversion(byte[] rawValue, byte value);
1.58 + public delegate float RawValueConversion(byte[] rawValue, byte value,
1.59 + IReadOnlyArray<IParameter> parameters);
1.60 }
1.61 }