1.1 --- a/Hardware/LPC/F718XX.cs Sun Feb 07 19:48:32 2010 +0000
1.2 +++ b/Hardware/LPC/F718XX.cs Sun Feb 07 19:53:51 2010 +0000
1.3 @@ -41,16 +41,10 @@
1.4 using System.Text;
1.5
1.6 namespace OpenHardwareMonitor.Hardware.LPC {
1.7 - public class F718XX : IHardware {
1.8 + public class F718XX : LPCHardware, IHardware {
1.9
1.10 - private string name;
1.11 - private Image icon;
1.12 -
1.13 - private Chip chip;
1.14 private ushort address;
1.15
1.16 - private List<ISensor> active = new List<ISensor>();
1.17 -
1.18 private Sensor[] temperatures;
1.19 private Sensor[] fans;
1.20 private Sensor[] voltages;
1.21 @@ -71,18 +65,9 @@
1.22 return WinRing0.ReadIoPortByte((ushort)(address + DATA_REGISTER_OFFSET));
1.23 }
1.24
1.25 - public F718XX(Chip chip, ushort address) {
1.26 - this.chip = chip;
1.27 + public F718XX(Chip chip, ushort address) : base(chip) {
1.28 this.address = address;
1.29
1.30 - switch (chip) {
1.31 - case Chip.F71862: name = "Fintek F71862"; break;
1.32 - case Chip.F71869: name = "Fintek F71869"; break;
1.33 - case Chip.F71882: name = "Fintek F71882"; break;
1.34 - case Chip.F71889: name = "Fintek F71889"; break;
1.35 - default: return;
1.36 - }
1.37 -
1.38 temperatures = new Sensor[3];
1.39 for (int i = 0; i < temperatures.Length; i++)
1.40 temperatures[i] = new Sensor("Temperature #" + (i + 1), i,
1.41 @@ -98,30 +83,12 @@
1.42 voltages[1] = new Sensor("CPU VCore", 1, SensorType.Voltage, this);
1.43 voltages[2] = new Sensor("VSB3V", 7, SensorType.Voltage, this);
1.44 voltages[3] = new Sensor("Battery", 8, SensorType.Voltage, this);
1.45 -
1.46 - this.icon = Utilities.EmbeddedResources.GetImage("chip.png");
1.47 - }
1.48 -
1.49 - public string Name {
1.50 - get { return name; }
1.51 - }
1.52 -
1.53 - public string Identifier {
1.54 - get { return "/lpc/" + chip.ToString().ToLower(); }
1.55 - }
1.56 -
1.57 - public Image Icon {
1.58 - get { return icon; }
1.59 - }
1.60 -
1.61 - public ISensor[] Sensors {
1.62 - get { return active.ToArray(); }
1.63 }
1.64
1.65 public string GetReport() {
1.66 StringBuilder r = new StringBuilder();
1.67
1.68 - r.AppendLine("LPC F718XX");
1.69 + r.AppendLine("LPC " + this.GetType().Name);
1.70 r.AppendLine();
1.71 r.Append("Base Adress: 0x"); r.AppendLine(address.ToString("X4"));
1.72 r.AppendLine();
1.73 @@ -175,25 +142,5 @@
1.74 }
1.75 }
1.76 }
1.77 -
1.78 - private void ActivateSensor(Sensor sensor) {
1.79 - if (!active.Contains(sensor)) {
1.80 - active.Add(sensor);
1.81 - if (SensorAdded != null)
1.82 - SensorAdded(sensor);
1.83 - }
1.84 - }
1.85 -
1.86 - private void DeactivateSensor(Sensor sensor) {
1.87 - if (active.Contains(sensor)) {
1.88 - active.Remove(sensor);
1.89 - if (SensorRemoved != null)
1.90 - SensorRemoved(sensor);
1.91 - }
1.92 - }
1.93 -
1.94 - public event SensorEventHandler SensorAdded;
1.95 - public event SensorEventHandler SensorRemoved;
1.96 -
1.97 }
1.98 }