Пример #1
0
        public SensorInfo AddSensor(string Name)
        {
            if (Sensors.ContainsKey(Name))
            {
                return(Sensors[Name]);
            }

            Logger.Log("Adding sensor: " + Name);

            SensorInfo NewInfo = new SensorInfo(Name);

            Sensors.Add(Name, NewInfo);
            return(NewInfo);
        }
Пример #2
0
            public void VisitSensor(ISensor sensor)
            {
                string hwid = sensor.Hardware.Identifier.ToString();

                HardwareInfo hwinfo = Result[hwid];
                SensorInfo   sninfo = hwinfo.AddSensor(sensor.Name);

                switch (sensor.SensorType)
                {
                case SensorType.Load:
                    AddSensorValues("load", sensor, sninfo);
                    break;

                case SensorType.Temperature:
                    AddSensorValues("temperature", sensor, sninfo);
                    break;
                }
            }
Пример #3
0
            private static void AddSensorValues(string Tag, ISensor sensor, SensorInfo sninfo)
            {
                if (sensor.Value.HasValue)
                {
                    sninfo.AddValue(Tag, sensor.Value.Value);
                }
                else if (sensor.Values != null && sensor.Values.Count() > 0)
                {
                    float val_tot = 0.0f;
                    foreach (SensorValue val in sensor.Values)
                    {
                        val_tot += val.Value;
                    }
                    val_tot /= sensor.Values.Count();

                    sninfo.AddValue(Tag + "_multiple_avg", val_tot);
                }
                else
                {
                    Logger.Log("No value for \"" + Tag + "\" sensor - did you remember to run as admin?");
                }
            }