Beispiel #1
0
 void CheckPeriod(IUT60EData data)
 {
     if (packet_count++ == 0 || data.Time > period_end)
     {
         NewPeriod(data);
     }
 }
Beispiel #2
0
        void OnDataReady(object sender, EventArgs e)
        {
            IUT60EData data = (e as UT60EDataReadyEventArgs).data;

            if (data == null)
            {
                this.textBoxValue.Text = "----";
            }
            else
            {
                this.textBoxValue.Text           = data.ToString();
                this.textBoxUpdateFrequency.Text = freq_func.run(data.Time).ToString();
            }
        }
Beispiel #3
0
 void OnDataReady(object sender, EventArgs e)
 {
     lock (data_keeper)
     {
         IUT60EData data = (e as UT60EDataReadyEventArgs).data;
         if (data != null)
         {
             CheckPeriod(data);
             data_keeper[(sender as UT60EDataController).id] = (e as UT60EDataReadyEventArgs).data;
             if (data_keeper.Count == packet_count)
             {
                 DataReady(PrepareData(data_keeper.Values), null);
                 packet_count = 0;
             }
         }
     }
 }
Beispiel #4
0
        void OnDataReady(object sender, EventArgs e)
        {
            UT60EPacket package = (e as UT60EPackageReceivedEventArgs).package;
            IUT60EData  data    = package.Parse();

            if (data == null)
            {
                parse_error_count += 1;
            }
            else if (data.Unit == unit)
            {
                data_packages.Add(data);
            }
            else
            {
                data = null;
            }
            DataReady.Invoke(this, new UT60EDataReadyEventArgs(data));
        }
Beispiel #5
0
 public UT60EDataReadyEventArgs(IUT60EData data)
 {
     this.data = data;
 }
Beispiel #6
0
 void NewPeriod(IUT60EData data)
 {
     period_end = data.Time.AddSeconds(period);
 }