Hardware/HDD/SSDSamsung.cs
author StephaneLenclud
Sun, 03 Feb 2013 18:01:50 +0100
branchMiniDisplay
changeset 433 090259cfd699
parent 344 3145aadca3d2
permissions -rw-r--r--
Adding SoundGraphDisplay and SensorFrontView classes.
They were respectively based on SystemTray and SensorNotifyIcon.
SoundGraphDisplay is now able to load iMONDisplay.dll providing it lives on your PATH.
Adding option to sensor context menu for adding it into FrontView.
     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) 2012-2013 Michael Möller <mmoeller@openhardwaremonitor.org>
     8 	
     9 */
    10 
    11 namespace OpenHardwareMonitor.Hardware.HDD {
    12   using System.Collections.Generic;
    13   using OpenHardwareMonitor.Collections;
    14 
    15   [NamePrefix(""), RequireSmart(0xB1), RequireSmart(0xB3), RequireSmart(0xB5),
    16     RequireSmart(0xB6), RequireSmart(0xB7), RequireSmart(0xBB), 
    17     RequireSmart(0xC3), RequireSmart(0xC7)]
    18   internal class SSDSamsung : AbstractHarddrive {
    19 
    20     private static readonly IEnumerable<SmartAttribute> smartAttributes =
    21       new List<SmartAttribute> {
    22       new SmartAttribute(0x05, SmartNames.ReallocatedSectorsCount),
    23       new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
    24       new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
    25       new SmartAttribute(0xAF, SmartNames.ProgramFailCountChip, RawToInt),
    26       new SmartAttribute(0xB0, SmartNames.EraseFailCountChip, RawToInt),
    27       new SmartAttribute(0xB1, SmartNames.WearLevelingCount, RawToInt),
    28       new SmartAttribute(0xB2, SmartNames.UsedReservedBlockCountChip, RawToInt),
    29       new SmartAttribute(0xB3, SmartNames.UsedReservedBlockCountTotal, RawToInt),
    30 
    31       // Unused Reserved Block Count (Total)
    32       new SmartAttribute(0xB4, SmartNames.RemainingLife,
    33         null, SensorType.Level, 0),
    34       
    35       new SmartAttribute(0xB5, SmartNames.ProgramFailCountTotal, RawToInt),
    36       new SmartAttribute(0xB6, SmartNames.EraseFailCountTotal, RawToInt),
    37       new SmartAttribute(0xB7, SmartNames.RuntimeBadBlockTotal, RawToInt),
    38       new SmartAttribute(0xBB, SmartNames.UncorrectableErrorCount, RawToInt),
    39       new SmartAttribute(0xBE, SmartNames.Temperature, 
    40         (byte[] r, byte v, IReadOnlyArray<IParameter> p) 
    41           => { return r[0] + (p == null ? 0 : p[0].Value); }, 
    42           SensorType.Temperature, 0, false, 
    43         new[] { new ParameterDescription("Offset [°C]", 
    44                   "Temperature offset of the thermal sensor.\n" + 
    45                   "Temperature = Value + Offset.", 0) }),
    46       new SmartAttribute(0xC2, SmartNames.AirflowTemperature),
    47       new SmartAttribute(0xC3, SmartNames.ECCRate),
    48       new SmartAttribute(0xC6, SmartNames.OffLineUncorrectableErrorCount, RawToInt),
    49       new SmartAttribute(0xC7, SmartNames.CRCErrorCount, RawToInt),
    50       new SmartAttribute(0xC9, SmartNames.SupercapStatus),
    51       new SmartAttribute(0xCA, SmartNames.ExceptionModeStatus),
    52       new SmartAttribute(0xEB, SmartNames.PowerRecoveryCount),
    53       new SmartAttribute(0xF1, SmartNames.TotalLBAWritten)
    54     };
    55 
    56     public SSDSamsung(ISmart smart, string name, string firmwareRevision,
    57       int index, ISettings settings)
    58       : base(smart, name, firmwareRevision, index, smartAttributes, settings) { }
    59   }
    60 }