Esempio n. 1
0
        internal void Updated(string address, int timestamp, WeatherFlow_UDP.DataType t)
        {
            // Check for missing data here.
            UDPTime  utime;
            TimeSpan epoch = DateTime.UtcNow - new DateTime(1970, 1, 1);

            utime.timestamp = timestamp;
            utime.now       = (int)epoch.TotalSeconds;

            if (!SecondsSinceUpdate.ContainsKey(address))
            {
                SecondsSinceUpdate[address] = utime;
            }

            // TODO: The diff should be 2x the interval. Is there some way to get that
            //       information here?
            int diff = timestamp - SecondsSinceUpdate[address].timestamp;

            switch (t)
            {
            case WeatherFlow_UDP.DataType.AIR:
            case WeatherFlow_UDP.DataType.SKY:
                // Expect data every 60 seconds
                if (diff >= 120)
                {
                    WFLogging.Warning("Possible Missing data for " + address + ": " + diff.ToString() + " seconds");
                }
                break;

            case WeatherFlow_UDP.DataType.DEVICE:
                // Expect data every 60 seconds
                if (diff >= 90)
                {
                    WFLogging.Warning("Possible Missing data for " + address + ": " + diff.ToString() + " seconds");
                }
                break;

            case WeatherFlow_UDP.DataType.HUB:
                // Expect data every 10 seconds
                if (diff >= 20)
                {
                    WFLogging.Warning("Possible Missing data for " + address + ": " + diff.ToString() + " seconds");
                }
                break;

            case WeatherFlow_UDP.DataType.WIND:
                // Expect data every 3 seconds
                if (diff >= 6)
                {
                    WFLogging.Warning("Possible Missing data for " + address + ": " + diff.ToString() + " seconds");
                }
                break;
            }
            SecondsSinceUpdate[address] = utime;
        }
Esempio n. 2
0
 internal UpdateEventArgs(int u, string s, WeatherFlow_UDP.DataType t)
 {
     update_time = u;
     serial_number = s;
     type = t;
 }