示例#1
0
        public WeatherDeviceSyncJob()
        {
            DisplayName = "农气物联网--农田小气候仪数据同步插件";
            //JobInterval = 5 * 60;
            JobInterval = 10;

            //_connName ="CAWSAnyWhereServer";
            _connName =
                "Server= wlw.smartiot.cc,4000;Database=CAWSAnyWhereServer;uid=sa;pwd=*************";
            //"Server = wlw.smartiot.cc,4000; Database = CAWSAnyWhereServer; uid = sa; pwd = 1qaz @WSX providerName=System.Data.SqlClient";

            //_connName = "AWIOT-WeatherDevice";
            try
            {
                //_dal = XCode.DataAccessLayer.DAL.Create(_connName);
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex.ToString()); //抛出异常
                //_dal = XCode.DataAccessLayer.DAL.Create(_connName);
            }
            _areaStationService = AhnqIotContainer.Container.Resolve <IAreaStationService>();
            _weatherStationOnlineStatisticsService =
                AhnqIotContainer.Container.Resolve <IWeatherStationOnlineStatisticsService>();
            _weatherStationService      = AhnqIotContainer.Container.Resolve <IWeatherStationService>();
            _areaStationDataInfoService = AhnqIotContainer.Container.Resolve <IAreaStationDataInfoService>();
            _weatherDeviceService       = AhnqIotContainer.Container.Resolve <IWeatherDeviceService>();
            _weatherDeviceTypeService   = AhnqIotContainer.Container.Resolve <IWeatherDeviceTypeService>();

            var sqlHelper = new SqlHelper();

            _tableNameSqlCmd = sqlHelper.GetTableNames; //获取所有表名
        }
示例#2
0
        public override void Init()
        {
            base.Init();

            _weatherStationService = GlobalContext.GetServices <IWeatherStationService>().FirstOrDefault();
            if (_weatherStationService == null)
            {
                throw new ApplicationException("Weather station service is not available.");
            }

            RegisterTimer(new TimeSpan(0, 0, 5, 0), ProcessDraw);
        }
示例#3
0
        public void Init()
        {
            _weatherStationService = _globalContext.GetServices <IWeatherStationService>().FirstOrDefault();
            if (_weatherStationService == null)
            {
                throw new ApplicationException("Weather station service is not available.");
            }

            _elements.Add(new WeatherStationDataSource(new Location(0, 0), s => s.Devices[0].Temperature.Value, d => WeatherHelpers.TempToDecStr(d), "     °C"));
            _elements.Add(new WeatherStationDataSource(new Location(1, 0), s => s.Devices[0].HumidityPercent.Value, d => (d / 100).ToString("P0"), ""));
            _elements.Add(new WeatherStationDataSource(new Location(2, 0), s => s.Devices[0].Pressure.Value, d => d.ToString("F1"), "mmHg"));
            _elements.Add(new WeatherStationDataSource(new Location(3, 0), s => s.Devices[0].Co2Measure.Value, d => d.ToString("F0"), "ppm"));
            _elements.Add(new WeatherStationDataSource(new Location(4, 0), s => s.Devices[0].Noise.Value, d => d.ToString("F0"), "dB"));

            _elements.Add(new WeatherStationDataSource(new Location(0, 1), s => s.Devices[1].Temperature.Value, d => WeatherHelpers.TempToDecStr(d), "     °C"));
            _elements.Add(new WeatherStationDataSource(new Location(1, 1), s => s.Devices[1].HumidityPercent.Value, d => (d / 100).ToString("P0"), ""));
        }
示例#4
0
 public WeatherStationMeasurementDetailsLayout(WeatherStationDataSource element, IWeatherStationService weatherStationService)
 {
     _element = element;
     _weatherStationService = weatherStationService;
 }
示例#5
0
 public AddWeatherStationCommand(IWeatherStationService weatherStationService)
 {
     this.weatherStationService = weatherStationService;
 }