Exemplo n.º 1
0
        public static ISensor GetSensor(SensorWeatherType sensorWeatherType, string name, int sensorId, bool rgbDisplay)
        {
            if (webWeather == null)
            {
                webWeather = new WebWeather();
                refresher  = new Refresher();
                refresher.AddSensor(webWeather);
                refresher.Start(600000);
            }

            switch (sensorWeatherType)
            {
            case SensorWeatherType.Temperature:
                return(new WeatherTemperature(webWeather, name, sensorId, rgbDisplay));

            case SensorWeatherType.Humidity:
                return(new WeatherHumidity(webWeather, name, sensorId, rgbDisplay));

            case SensorWeatherType.Pressure:
                return(new WeatherPressure(webWeather, name, sensorId, rgbDisplay));

            case SensorWeatherType.WindSpeed:
                return(new WeatherWindSpeed(webWeather, name, sensorId, rgbDisplay));

            case SensorWeatherType.WindDirection:
                return(new WeatherWindDirection(webWeather, name, sensorId, rgbDisplay));

            default:
                throw new Exception("The type <" + webWeather + "> is not manage by the WeatherSensorBuilder");
            }
        }
Exemplo n.º 2
0
 internal WeatherHumidity(WebWeather webWeather, string name, int sensorId, bool rgbDisplay)
 {
     this.webWeather = webWeather;
     this.Name       = name;
     this.webWeather.PropertyChanged += WebWeather_PropertyChanged;
     this.SensorId   = sensorId;
     this.RgbDisplay = rgbDisplay;
 }
Exemplo n.º 3
0
 internal WeatherWindDirection(WebWeather webWeather, string name, int sensorId, bool rgbDisplay)
 {
     this.webWeather = webWeather;
     this.Name       = name;
     SensorId        = sensorId;
     this.webWeather.PropertyChanged += WebWeather_PropertyChanged;
     this.RgbDisplay = rgbDisplay;
 }