1.1 --- a/Hardware/Sensor.cs Fri Feb 05 22:45:15 2010 +0000
1.2 +++ b/Hardware/Sensor.cs Sun Feb 07 16:37:15 2010 +0000
1.3 @@ -59,12 +59,7 @@
1.4 private int count = 0;
1.5
1.6 private const int MAX_MINUTES = 120;
1.7 -
1.8 - private string GetIdentifier() {
1.9 - return hardware.Identifier + "/" + sensorType.ToString().ToLower() +
1.10 - "/" + index;
1.11 - }
1.12 -
1.13 +
1.14 public Sensor(string name, int index, SensorType sensorType,
1.15 IHardware hardware)
1.16 : this(name, index, null, sensorType, hardware) { }
1.17 @@ -77,24 +72,35 @@
1.18 this.defaultLimit = limit;
1.19 this.sensorType = sensorType;
1.20 this.hardware = hardware;
1.21 - string configName =
1.22 - Utilities.Config.Settings[GetIdentifier() + "/name"];
1.23 + string configName =
1.24 + Utilities.Config.Settings[Identifier + "/name"];
1.25 if (configName != null)
1.26 this.name = configName;
1.27 else
1.28 this.name = name;
1.29 string configLimit =
1.30 - Utilities.Config.Settings[GetIdentifier() + "/limit"];
1.31 + Utilities.Config.Settings[Identifier + "/limit"];
1.32 if (configLimit != null && configLimit != "")
1.33 this.limit = float.Parse(configLimit);
1.34 else
1.35 this.limit = limit;
1.36 }
1.37
1.38 + public IHardware Hardware {
1.39 + get { return hardware; }
1.40 + }
1.41 +
1.42 public SensorType SensorType {
1.43 get { return sensorType; }
1.44 }
1.45
1.46 + public string Identifier {
1.47 + get {
1.48 + return hardware.Identifier + "/" + sensorType.ToString().ToLower() +
1.49 + "/" + index;
1.50 + }
1.51 + }
1.52 +
1.53 public string Name {
1.54 get {
1.55 return name;
1.56 @@ -104,7 +110,7 @@
1.57 name = value;
1.58 else
1.59 name = defaultName;
1.60 - Utilities.Config.Settings[GetIdentifier() + "/name"] = name;
1.61 + Utilities.Config.Settings[Identifier + "/name"] = name;
1.62 }
1.63 }
1.64
1.65 @@ -150,11 +156,11 @@
1.66 set {
1.67 if (value.HasValue) {
1.68 limit = value;
1.69 - Utilities.Config.Settings[GetIdentifier() + "/limit"] =
1.70 + Utilities.Config.Settings[Identifier + "/limit"] =
1.71 limit.ToString();
1.72 } else {
1.73 limit = defaultLimit;
1.74 - Utilities.Config.Settings[GetIdentifier() + "/limit"] = "";
1.75 + Utilities.Config.Settings[Identifier + "/limit"] = "";
1.76 }
1.77 }
1.78 }