Exemplo n.º 1
0
        public AreaService(
            IComponentService componentService,
            IAutomationService automationService,
            ISystemEventsService systemEventsService,
            ISystemInformationService systemInformationService,
            IApiService apiService,
            ISettingsService settingsService)
        {
            if (componentService == null) throw new ArgumentNullException(nameof(componentService));
            if (automationService == null) throw new ArgumentNullException(nameof(automationService));
            if (systemEventsService == null) throw new ArgumentNullException(nameof(systemEventsService));
            if (systemInformationService == null) throw new ArgumentNullException(nameof(systemInformationService));
            if (apiService == null) throw new ArgumentNullException(nameof(apiService));
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));

            _componentService = componentService;
            _automationService = automationService;
            _apiService = apiService;
            _settingsService = settingsService;

            systemEventsService.StartupCompleted += (s, e) =>
            {
                systemInformationService.Set("Areas/Count", _areas.GetAll().Count);
            };

            apiService.ConfigurationRequested += HandleApiConfigurationRequest;
        }
Exemplo n.º 2
0
        public AreaRegistryService(
            IComponentRegistryService componentService,
            IAutomationRegistryService automationService,
            ISystemEventsService systemEventsService,
            ISystemInformationService systemInformationService,
            IApiDispatcherService apiService,
            ISettingsService settingsService)
        {
            if (systemEventsService == null)
            {
                throw new ArgumentNullException(nameof(systemEventsService));
            }
            if (systemInformationService == null)
            {
                throw new ArgumentNullException(nameof(systemInformationService));
            }
            if (apiService == null)
            {
                throw new ArgumentNullException(nameof(apiService));
            }

            _componentService  = componentService ?? throw new ArgumentNullException(nameof(componentService));
            _automationService = automationService ?? throw new ArgumentNullException(nameof(automationService));
            _settingsService   = settingsService ?? throw new ArgumentNullException(nameof(settingsService));

            systemEventsService.StartupCompleted += (s, e) =>
            {
                systemInformationService.Set("Areas/Count", _areas.Count);
            };

            apiService.ConfigurationRequested += HandleApiConfigurationRequest;
        }
Exemplo n.º 3
0
        public ComponentService(
            ISystemEventsService systemEventsService,
            ISystemInformationService systemInformationService,
            IApiService apiService,
            ISettingsService settingsService)
        {
            if (systemEventsService == null)
            {
                throw new ArgumentNullException(nameof(systemEventsService));
            }
            if (systemInformationService == null)
            {
                throw new ArgumentNullException(nameof(systemInformationService));
            }
            if (apiService == null)
            {
                throw new ArgumentNullException(nameof(apiService));
            }
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }

            _systemInformationService = systemInformationService;
            _apiService      = apiService;
            _settingsService = settingsService;

            apiService.StatusRequested += HandleApiStatusRequest;
        }
Exemplo n.º 4
0
        public AutomationRegistryService(
            ISettingsService settingsService,
            ISystemEventsService systemEventsService,
            ISystemInformationService systemInformationService,
            IApiDispatcherService apiService)
        {
            _settingsService = settingsService ?? throw new ArgumentNullException(nameof(settingsService));
            if (systemEventsService == null)
            {
                throw new ArgumentNullException(nameof(systemEventsService));
            }
            if (systemInformationService == null)
            {
                throw new ArgumentNullException(nameof(systemInformationService));
            }
            if (apiService == null)
            {
                throw new ArgumentNullException(nameof(apiService));
            }
            if (apiService == null)
            {
                throw new ArgumentNullException(nameof(apiService));
            }

            systemEventsService.StartupCompleted += (s, e) =>
            {
                systemInformationService.Set("Automations/Count", _automations.Count);
            };

            apiService.StatusRequested += HandleApiStatusRequest;
        }
Exemplo n.º 5
0
        public AutomationService(
            ISystemEventsService systemEventsService,
            ISystemInformationService systemInformationService,
            IApiService apiService)
        {
            if (systemEventsService == null)
            {
                throw new ArgumentNullException(nameof(systemEventsService));
            }
            if (systemInformationService == null)
            {
                throw new ArgumentNullException(nameof(systemInformationService));
            }
            if (apiService == null)
            {
                throw new ArgumentNullException(nameof(apiService));
            }
            if (apiService == null)
            {
                throw new ArgumentNullException(nameof(apiService));
            }

            systemEventsService.StartupCompleted += (s, e) =>
            {
                systemInformationService.Set("Automations/Count", _automations.GetAll().Count);
            };

            apiService.StatusRequested += HandleApiStatusRequest;
        }
Exemplo n.º 6
0
        public DeviceRegistryService(
            ISystemEventsService systemEventsService,
            ISystemInformationService systemInformationService)
        {
            if (systemEventsService == null)
            {
                throw new ArgumentNullException(nameof(systemEventsService));
            }
            if (systemInformationService == null)
            {
                throw new ArgumentNullException(nameof(systemInformationService));
            }

            systemEventsService.StartupCompleted += (s, e) =>
            {
                systemInformationService.Set("Devices/Count", _devices.Count);
            };
        }
        public ComponentRegistryService(
            ISystemEventsService systemEventsService,
            ISystemInformationService systemInformationService,
            IApiDispatcherService apiService,
            ISettingsService settingsService,
            ILogService logService)
        {
            if (systemEventsService == null)
            {
                throw new ArgumentNullException(nameof(systemEventsService));
            }
            _log = logService.CreatePublisher(nameof(ComponentRegistryService));

            _systemInformationService = systemInformationService ?? throw new ArgumentNullException(nameof(systemInformationService));
            _apiService      = apiService ?? throw new ArgumentNullException(nameof(apiService));
            _settingsService = settingsService ?? throw new ArgumentNullException(nameof(settingsService));

            apiService.StatusRequested += HandleApiStatusRequest;
        }
Exemplo n.º 8
0
 public KitchenConfiguration(
     ISystemEventsService systemEventsService,
     IAreaRegistryService areaService,
     IDeviceRegistryService deviceService,
     CCToolsDeviceService ccToolsDeviceService,
     OutpostDeviceService outpostDeviceService,
     AutomationFactory automationFactory,
     ActuatorFactory actuatorFactory,
     SensorFactory sensorFactory)
 {
     _systemEventsService  = systemEventsService ?? throw new ArgumentNullException(nameof(systemEventsService));
     _areaService          = areaService ?? throw new ArgumentNullException(nameof(areaService));
     _deviceService        = deviceService ?? throw new ArgumentNullException(nameof(deviceService));
     _ccToolsBoardService  = ccToolsDeviceService ?? throw new ArgumentNullException(nameof(ccToolsDeviceService));
     _outpostDeviceService = outpostDeviceService ?? throw new ArgumentNullException(nameof(outpostDeviceService));
     _automationFactory    = automationFactory ?? throw new ArgumentNullException(nameof(automationFactory));
     _actuatorFactory      = actuatorFactory ?? throw new ArgumentNullException(nameof(actuatorFactory));
     _sensorFactory        = sensorFactory ?? throw new ArgumentNullException(nameof(sensorFactory));
 }
Exemplo n.º 9
0
 public KitchenConfiguration(
     ISystemEventsService systemEventsService,
     IAreaRegistryService areaService,
     IDeviceRegistryService deviceService,
     CCToolsDeviceService ccToolsDeviceService,
     AutomationFactory automationFactory,
     ActuatorFactory actuatorFactory,
     SensorFactory sensorFactory,
     IMessageBrokerService messageBroker,
     IDeviceMessageBrokerService deviceMessageBrokerService,
     ILogService logService)
 {
     _messageBroker = messageBroker ?? throw new ArgumentNullException(nameof(messageBroker));
     _deviceMessageBrokerService = deviceMessageBrokerService;
     _logService          = logService;
     _systemEventsService = systemEventsService ?? throw new ArgumentNullException(nameof(systemEventsService));
     _areaService         = areaService ?? throw new ArgumentNullException(nameof(areaService));
     _deviceService       = deviceService ?? throw new ArgumentNullException(nameof(deviceService));
     _ccToolsBoardService = ccToolsDeviceService ?? throw new ArgumentNullException(nameof(ccToolsDeviceService));
     _automationFactory   = automationFactory ?? throw new ArgumentNullException(nameof(automationFactory));
     _actuatorFactory     = actuatorFactory ?? throw new ArgumentNullException(nameof(actuatorFactory));
     _sensorFactory       = sensorFactory ?? throw new ArgumentNullException(nameof(sensorFactory));
 }