public float ConvertValue(DriveAttributeValue value, IReadOnlyArray <IParameter> parameters) { if (rawValueConversion == null) { return(value.AttrValue); } else { return(rawValueConversion(value.RawValue, value.AttrValue, parameters)); } }
public Drive(string name, string firmware, int idBase, string value) { this.Name = name; this.FirmwareVersion = firmware; string[] lines = value.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); DriveAttributeValues = new DriveAttributeValue[lines.Length]; List <DriveThresholdValue> thresholds = new List <DriveThresholdValue>(); for (int i = 0; i < lines.Length; i++) { string[] array = lines[i].Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (array.Length != 4 && array.Length != 5) { throw new Exception(); } DriveAttributeValue v = new DriveAttributeValue(); v.Identifier = Convert.ToByte(array[0], idBase); v.RawValue = new byte[6]; for (int j = 0; j < 6; j++) { v.RawValue[j] = Convert.ToByte(array[1].Substring(2 * j, 2), 16); } v.WorstValue = Convert.ToByte(array[2], 10); v.AttrValue = Convert.ToByte(array[3], 10); DriveAttributeValues[i] = v; if (array.Length == 5) { DriveThresholdValue t = new DriveThresholdValue(); t.Identifier = v.Identifier; t.Threshold = Convert.ToByte(array[4], 10); thresholds.Add(t); } } DriveThresholdValues = thresholds.ToArray(); }
public override void UpdateAdditionalSensors(DriveAttributeValue[] values) { float? controllerWritesToNAND = null; float? hostWritesToController = null; foreach (DriveAttributeValue value in values) { if (value.Identifier == 0xE9) controllerWritesToNAND = RawToInt(value.RawValue, value.AttrValue, null); if (value.Identifier == 0xEA) hostWritesToController = RawToInt(value.RawValue, value.AttrValue, null); } if (controllerWritesToNAND.HasValue && hostWritesToController.HasValue) { if (hostWritesToController.Value > 0) writeAmplification.Value = controllerWritesToNAND.Value / hostWritesToController.Value; else writeAmplification.Value = 0; ActivateSensor(writeAmplification); } }
public float ConvertValue(DriveAttributeValue value, IReadOnlyArray<IParameter> parameters) { if (rawValueConversion == null) { return value.AttrValue; } else { return rawValueConversion(value.RawValue, value.AttrValue, parameters); } }
public virtual void UpdateAdditionalSensors(DriveAttributeValue[] values) { }