示例#1
0
        void BufferedSnapshotRead(object sender, BufferReceivedEventArgs args)
        {
            byte[] buffer = args.Data.Buffer;
            int    offset = 0;

            if (args.Data.Offset != CurrentPos.Position)
            {
                offset = 0x10;
            }
            Count--;
            WeatherSnapshot snapshot = new WeatherSnapshot(buffer, offset);

            SnapshotDate      -= new TimeSpan(0, snapshot.Interval, 0);
            snapshot.Timestamp = SnapshotDate;


            if (Count <= 0 || snapshot.Timestamp <= LimitDate)
            {
                // Finished reading
                this.BufferReceived   -= BufferedSnapshotRead;
                device.BufferReceived -= HandleBufferReceived;

                OnAllSnapshotsRead(newSnapshots);
                newSnapshots.Clear();
            }
            else
            {
                newSnapshots.Add(snapshot);

                GetBlock(--CurrentPos);
            }
        }
示例#2
0
        /// <summary>
        /// Create a new WeatherSnapshot object.
        /// </summary>
        /// <param name="timestamp">Initial value of the Timestamp property.</param>
        /// <param name="interval">Initial value of the Interval property.</param>
        /// <param name="indoorHumidity">Initial value of the IndoorHumidity property.</param>
        /// <param name="indoorTemperature">Initial value of the IndoorTemperature property.</param>
        /// <param name="outdoorHumidity">Initial value of the OutdoorHumidity property.</param>
        /// <param name="outdoorTemperature">Initial value of the OutdoorTemperature property.</param>
        /// <param name="pressure">Initial value of the Pressure property.</param>
        /// <param name="windAverage">Initial value of the WindAverage property.</param>
        /// <param name="windGust">Initial value of the WindGust property.</param>
        /// <param name="rain">Initial value of the Rain property.</param>
        /// <param name="status">Initial value of the Status property.</param>
        public static WeatherSnapshot CreateWeatherSnapshot(global::System.DateTime timestamp, global::System.Byte interval, global::System.Byte indoorHumidity, global::System.Double indoorTemperature, global::System.Byte outdoorHumidity, global::System.Double outdoorTemperature, global::System.Double pressure, global::System.Double windAverage, global::System.Double windGust, global::System.Double rain, global::System.Byte status)
        {
            WeatherSnapshot weatherSnapshot = new WeatherSnapshot();

            weatherSnapshot.Timestamp          = timestamp;
            weatherSnapshot.Interval           = interval;
            weatherSnapshot.IndoorHumidity     = indoorHumidity;
            weatherSnapshot.IndoorTemperature  = indoorTemperature;
            weatherSnapshot.OutdoorHumidity    = outdoorHumidity;
            weatherSnapshot.OutdoorTemperature = outdoorTemperature;
            weatherSnapshot.Pressure           = pressure;
            weatherSnapshot.WindAverage        = windAverage;
            weatherSnapshot.WindGust           = windGust;
            weatherSnapshot.Rain   = rain;
            weatherSnapshot.Status = status;
            return(weatherSnapshot);
        }
示例#3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the WeatherSnapshots EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToWeatherSnapshots(WeatherSnapshot weatherSnapshot)
 {
     base.AddObject("WeatherSnapshots", weatherSnapshot);
 }