Exemplo n.º 1
0
        private void _sensor_ReadingComplete(object sender, ReadingArgs e)
        {
            DispatcherHelper.CheckBeginInvokeOnUI(() =>
            {
                ReadingDateTime = e.ReadingTime;

                PM1_0Concentration_CF1  = _sensor.PM1_0Concentration_CF1;
                PM2_5Concentration_CF1  = _sensor.PM2_5Concentration_CF1;
                PM10_0Concentration_CF1 = _sensor.PM10_0Concentration_CF1;

                PM1_0Concentration_amb  = _sensor.PM1_0Concentration_amb;
                PM2_5Concentration_amb  = _sensor.PM2_5Concentration_amb;
                PM10_0Concentration_amb = _sensor.PM10_0Concentration_amb;

                PM0_3Count  = _sensor.PM0_3Count;
                PM0_5Count  = _sensor.PM0_5Count;
                PM1_0Count  = _sensor.PM1_0Count;
                PM5_0Count  = _sensor.PM5_0Count;
                PM10_0Count = _sensor.PM10_0Count;

                ProductVersion = _sensor.ProductVersion;
                ErrorCodes     = _sensor.StatusCodes;

                while (Readings.Count > GraphReadings)
                {
                    Readings.RemoveAt(0);
                }

                Reading reading = new Reading
                {
                    PM1_0Concentration  = PM10_0Concentration_CF1,
                    PM2_5Concentration  = PM2_5Concentration_CF1,
                    PM10_0Concentration = PM10_0Concentration_CF1,
                    ReadingDateTime     = ReadingDateTime
                };

                Readings.Add(reading);

                while (CountsLow.Count > GraphReadings)
                {
                    CountsLow.RemoveAt(0);
                }

                CountsLow countsLow = new CountsLow
                {
                    PM2_5Count      = PM2_5Count,
                    PM5_0Count      = PM5_0Count,
                    PM10_0Count     = PM10_0Count,
                    ReadingDateTime = ReadingDateTime
                };

                CountsLow.Add(countsLow);

                while (CountsHigh.Count > GraphReadings)
                {
                    CountsHigh.RemoveAt(0);
                }

                CountsHigh countsHigh = new CountsHigh
                {
                    PM1_0Count      = PM1_0Count,
                    PM0_5Count      = PM0_5Count,
                    PM0_3Count      = PM0_3Count,
                    ReadingDateTime = ReadingDateTime
                };

                CountsHigh.Add(countsHigh);
            });
        }
Exemplo n.º 2
0
        private void UT61Callback(object o, ReadingArgs e)
        {
            Reading = e.Value;
            Unit7SymbolVisibilityByte         = (byte)e.Units7Symbol;
            Unit8SymbolVisibilityByte         = (byte)e.Units8Symbol;
            UnitExponenetSymbolVisibilityByte = (byte)e.UnitExponent;
            UnitSymbolVisibilityByte          = (byte)e.Units;
            //switch (e.UnitExponent)
            //{
            //    //[9]	    Symbole		    µ	    m	    k	    M	    Beeps	Diode	%	    0
            //    case UnitExponent.Diode:
            //        UnitExponenetSymbolVisibilityByte = 0b0000_0100;
            //        break;
            //    case UnitExponent.Kilo:
            //        UnitExponenetSymbolVisibilityByte = 0b0010_0000;
            //        break;
            //    case UnitExponent.Mega:
            //        UnitExponenetSymbolVisibilityByte = 0b0001_0000;
            //        break;
            //    case UnitExponent.Micro:
            //    case UnitExponent._Micro:
            //        UnitExponenetSymbolVisibilityByte = 0b1000_0000;
            //        break;
            //    case UnitExponent.Mili:
            //        UnitExponenetSymbolVisibilityByte = 0b0100_0000;
            //        break;
            //    case UnitExponent.Beeps:
            //        UnitExponenetSymbolVisibilityByte = 0b0000_1000;
            //        break;
            //    case UnitExponent.Precent:
            //        UnitExponenetSymbolVisibilityByte = 0b0000_0010;
            //        break;
            //    case UnitExponent.Blank:
            //    case UnitExponent.Unknown:
            //    default:
            //        UnitExponenetSymbolVisibilityByte = 0b0000_0000;
            //        break;
            //}

            //switch (e.Units)
            //{
            //    //[10]	Symbole		    V	    A	    Ohm	    0	    Hz	    F	    °C	    °F
            //    case Units.Amperes:
            //        UnitSymbolVisibilityByte = 0b0100_0000;
            //        break;
            //    case Units.Celcius:
            //        UnitSymbolVisibilityByte = 0b0000_0010;
            //        break;
            //    case Units.Faerengheit:
            //        UnitSymbolVisibilityByte = 0b0000_0001;
            //        break;
            //    case Units.Farad:
            //        UnitSymbolVisibilityByte = 0b0000_0100;
            //        break;
            //    case Units.Hz:
            //        UnitSymbolVisibilityByte = 0b0000_1000;
            //        break;
            //    case Units.Ohms:
            //        UnitSymbolVisibilityByte = 0b0010_0000;
            //        break;
            //    case Units.Volts:
            //    case Units._Volts:
            //        UnitSymbolVisibilityByte = 0b1000_0000;
            //        break;
            //    case Units.Zero:
            //    default:
            //        UnitSymbolVisibilityByte = 0b0001_0000;
            //        break;
            //}
        }