Пример #1
0
        public void Update(WUUpdateWeatherStationDto wdto)
        {
            string _currMethod = _currTypeName + ".Update() ";

            try
            {
                if (wdto != null)
                {
                    string uriUpdStr = this.ToUpdateString(wdto);
                    if (uriUpdStr != "")
                    {
#if DEBUG
                        //_logger.Debug(_currMethod + "uri={0}".Args(uriUpdStr));
#endif
                        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uriUpdStr);

                        request.KeepAlive = true;
                        request.ServicePoint.Expect100Continue = false;

                        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
#if DEBUG
                        //Debug.WriteLine("WUUpdate Response={0} Desc={1}".Args(response.StatusCode, response.StatusDescription));
#endif
                        response.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Error(_currMethod + ex.Message);
            }
        }
Пример #2
0
        private string ToUpdateString(WUUpdateWeatherStationDto wdto)
        {
            string updStr = "";

            if (wdto != null)
            {
                updStr = _updateURL;

                updStr += wdto.DateUtcGetStr;                     //RecDateTime

                updStr += wdto.WindDirGetStr;                     //Wind Direction
                updStr += wdto.WindSpeedMphGetStr;                //Wind Speed
                updStr += wdto.WindGustMphGetStr;                 //Wind Gust
                updStr += wdto.WindGustDirGetStr;                 //Wind Gust

                updStr += wdto.HumidityGetStr;                    //Humidity
                updStr += wdto.DewPtFGetStr;                      //Dew Point F
                updStr += wdto.TempfGetStr;                       //Temperature

                updStr += wdto.RainInGetStr;                      //Rainfall last hour
                updStr += wdto.DailyRainInGetStr;                 //Rainfall 24hours

                updStr += wdto.BaromInGetStr;                     //Barometer
                updStr += wdto.SolarRadGetStr;                    //SolarRad

                updStr += "&action=updateraw";
                updStr += "&softwaretype=OmnObserver v3.1";
            }
            return(updStr);
        }