Пример #1
0
        public OpenWeatherMapService(
            IOutdoorService outdoorService,
            IDaylightService daylightService,
            IDateTimeService dateTimeService,
            ISchedulerService schedulerService,
            ISystemInformationService systemInformationService,
            ISettingsService settingsService,
            IStorageService storageService,
            ILogService logService)
        {
            if (schedulerService == null)
            {
                throw new ArgumentNullException(nameof(schedulerService));
            }
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }
            _outdoorService           = outdoorService ?? throw new ArgumentNullException(nameof(outdoorService));
            _daylightService          = daylightService ?? throw new ArgumentNullException(nameof(daylightService));
            _dateTimeService          = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService));
            _systemInformationService = systemInformationService ?? throw new ArgumentNullException(nameof(systemInformationService));

            _log = logService?.CreatePublisher(nameof(OpenWeatherMapService)) ?? throw new ArgumentNullException(nameof(logService));

            settingsService.CreateSettingsMonitor <OpenWeatherMapServiceSettings>(s => Settings = s.NewSettings);

            schedulerService.Register("OpenWeatherMapServiceUpdater", TimeSpan.FromMinutes(5), RefreshAsync);
        }
Пример #2
0
        public ControllerSlaveService(
            ISettingsService settingsService,
            ISchedulerService scheduler,
            IDateTimeService dateTimeService,
            IOutdoorService outdoorService,
            IDaylightService daylightService,
            ILogService logService)
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }
            if (scheduler == null)
            {
                throw new ArgumentNullException(nameof(scheduler));
            }

            _dateTimeService = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService));
            _outdoorService  = outdoorService ?? throw new ArgumentNullException(nameof(outdoorService));
            _daylightService = daylightService ?? throw new ArgumentNullException(nameof(daylightService));

            _log = logService?.CreatePublisher(nameof(ControllerSlaveService)) ?? throw new ArgumentNullException(nameof(logService));

            settingsService.CreateSettingsMonitor <ControllerSlaveServiceSettings>(s => Settings = s.NewSettings);

            scheduler.Register("ControllerSlavePolling", TimeSpan.FromMinutes(5), () => PullValues());
        }
Пример #3
0
        public RollerShutterAutomation(
            string id,
            INotificationService notificationService,
            ISchedulerService schedulerService,
            IDateTimeService dateTimeService,
            IDaylightService daylightService,
            IOutdoorService outdoorTemperatureService,
            IComponentRegistryService componentRegistry,
            ISettingsService settingsService,
            IResourceService resourceService)
            : base(id)
        {
            if (resourceService == null)
            {
                throw new ArgumentNullException(nameof(resourceService));
            }

            _notificationService = notificationService ?? throw new ArgumentNullException(nameof(notificationService));
            _dateTimeService     = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService));
            _daylightService     = daylightService ?? throw new ArgumentNullException(nameof(daylightService));
            _outdoorService      = outdoorTemperatureService ?? throw new ArgumentNullException(nameof(outdoorTemperatureService));
            _componentRegistry   = componentRegistry ?? throw new ArgumentNullException(nameof(componentRegistry));
            _settingsService     = settingsService ?? throw new ArgumentNullException(nameof(settingsService));

            resourceService.RegisterText(
                RollerShutterAutomationNotification.AutoClosingDueToHighOutsideTemperature,
                "Closing roller shutter because outside temperature reaches {AutoCloseIfTooHotTemperaure}°C.");

            settingsService.CreateSettingsMonitor <RollerShutterAutomationSettings>(this, s => Settings = s.NewSettings);

            schedulerService.Register(id, TimeSpan.FromMinutes(1), () => PerformPendingActions());
        }
Пример #4
0
 public PersonalAgentService(
     ISettingsService settingsService,
     IComponentRegistryService componentRegistry,
     IAreaRegistryService areaService,
     IOutdoorService outdoorService,
     ILogService logService)
 {
     _settingsService    = settingsService ?? throw new ArgumentNullException(nameof(settingsService));
     _componentsRegistry = componentRegistry ?? throw new ArgumentNullException(nameof(componentRegistry));
     _areaService        = areaService ?? throw new ArgumentNullException(nameof(areaService));
     _outdoorService     = outdoorService ?? throw new ArgumentNullException(nameof(outdoorService));
     _log = logService?.CreatePublisher(nameof(PersonalAgentService)) ?? throw new ArgumentNullException(nameof(logService));
 }
Пример #5
0
 public AutomationFactory(
     ISchedulerService schedulerService,
     INotificationService notificationService,
     IDateTimeService dateTimeService,
     IDaylightService daylightService,
     IOutdoorService outdoorService,
     IComponentRegistryService componentService,
     ISettingsService settingsService,
     IResourceService resourceService,
     IMessageBrokerService messageBroker)
 {
     _messageBroker       = messageBroker ?? throw new ArgumentNullException(nameof(messageBroker));
     _schedulerService    = schedulerService ?? throw new ArgumentNullException(nameof(schedulerService));
     _notificationService = notificationService ?? throw new ArgumentNullException(nameof(notificationService));
     _dateTimeService     = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService));
     _daylightService     = daylightService ?? throw new ArgumentNullException(nameof(daylightService));
     _outdoorService      = outdoorService ?? throw new ArgumentNullException(nameof(outdoorService));
     _componentService    = componentService ?? throw new ArgumentNullException(nameof(componentService));
     _settingsService     = settingsService ?? throw new ArgumentNullException(nameof(settingsService));
     _resourceService     = resourceService ?? throw new ArgumentNullException(nameof(resourceService));
 }