public BedroomConfiguration( IDeviceService deviceService, IAreaService areaService, CCToolsBoardService ccToolsBoardService, SynonymService synonymService, ActuatorFactory actuatorFactory, SensorFactory sensorFactory, AutomationFactory automationFactory) { if (deviceService == null) throw new ArgumentNullException(nameof(deviceService)); if (areaService == null) throw new ArgumentNullException(nameof(areaService)); if (ccToolsBoardService == null) throw new ArgumentNullException(nameof(ccToolsBoardService)); if (synonymService == null) throw new ArgumentNullException(nameof(synonymService)); if (actuatorFactory == null) throw new ArgumentNullException(nameof(actuatorFactory)); if (sensorFactory == null) throw new ArgumentNullException(nameof(sensorFactory)); if (automationFactory == null) throw new ArgumentNullException(nameof(automationFactory)); _deviceService = deviceService; _areaService = areaService; _ccToolsBoardService = ccToolsBoardService; _synonymService = synonymService; _actuatorFactory = actuatorFactory; _sensorFactory = sensorFactory; _automationFactory = automationFactory; }
public Configuration( CCToolsBoardService ccToolsBoardService, IPi2GpioService pi2GpioService, SynonymService synonymService, IDeviceService deviceService, II2CBusService i2CBusService, ISchedulerService schedulerService, RemoteSocketService remoteSocketService, IApiService apiService, IContainer containerService) { if (ccToolsBoardService == null) throw new ArgumentNullException(nameof(ccToolsBoardService)); if (pi2GpioService == null) throw new ArgumentNullException(nameof(pi2GpioService)); if (synonymService == null) throw new ArgumentNullException(nameof(synonymService)); if (deviceService == null) throw new ArgumentNullException(nameof(deviceService)); if (i2CBusService == null) throw new ArgumentNullException(nameof(i2CBusService)); if (schedulerService == null) throw new ArgumentNullException(nameof(schedulerService)); if (remoteSocketService == null) throw new ArgumentNullException(nameof(remoteSocketService)); if (apiService == null) throw new ArgumentNullException(nameof(apiService)); if (containerService == null) throw new ArgumentNullException(nameof(containerService)); _ccToolsBoardService = ccToolsBoardService; _pi2GpioService = pi2GpioService; _synonymService = synonymService; _deviceService = deviceService; _i2CBusService = i2CBusService; _schedulerService = schedulerService; _remoteSocketService = remoteSocketService; _apiService = apiService; _containerService = containerService; }
public OfficeConfiguration( IDeviceService deviceService, IAreaService areaService, IDaylightService daylightService, CCToolsBoardService ccToolsBoardService, SynonymService synonymService, RemoteSocketService remoteSocketService, ActuatorFactory actuatorFactory, SensorFactory sensorFactory) { if (deviceService == null) throw new ArgumentNullException(nameof(deviceService)); if (areaService == null) throw new ArgumentNullException(nameof(areaService)); if (daylightService == null) throw new ArgumentNullException(nameof(daylightService)); if (ccToolsBoardService == null) throw new ArgumentNullException(nameof(ccToolsBoardService)); if (synonymService == null) throw new ArgumentNullException(nameof(synonymService)); if (remoteSocketService == null) throw new ArgumentNullException(nameof(remoteSocketService)); if (actuatorFactory == null) throw new ArgumentNullException(nameof(actuatorFactory)); if (sensorFactory == null) throw new ArgumentNullException(nameof(sensorFactory)); _deviceService = deviceService; _areaService = areaService; _daylightService = daylightService; _ccToolsBoardService = ccToolsBoardService; _synonymService = synonymService; _remoteSocketService = remoteSocketService; _actuatorFactory = actuatorFactory; _sensorFactory = sensorFactory; }
protected override async Task ConfigureAsync(IDeviceService deviceService) { var pi2PortController = new Pi2GpioService(); var openWeatherMapService = new OpenWeatherMapService( ServiceLocator.GetService<IDateTimeService>(), ServiceLocator.GetService<ISchedulerService>(), ServiceLocator.GetService<ISystemInformationService>()); ServiceLocator.RegisterService(typeof(IOutdoorTemperatureService), new OutdoorTemperatureService(openWeatherMapService, ServiceLocator.GetService<IDateTimeService>())); ServiceLocator.RegisterService(typeof(IOutdoorHumidityService), new OutdootHumidityService(openWeatherMapService, ServiceLocator.GetService<IDateTimeService>())); ServiceLocator.RegisterService(typeof(IDaylightService), new DaylightService(openWeatherMapService, ServiceLocator.GetService<IDateTimeService>())); ServiceLocator.RegisterService(typeof(IWeatherService), new WeatherService(openWeatherMapService, ServiceLocator.GetService<IDateTimeService>())); ServiceLocator.RegisterService(typeof(OpenWeatherMapService), openWeatherMapService); var ccToolsFactory = new CCToolsBoardService(this, GetDevice<II2CBusService>()); var hsrt16 = ccToolsFactory.CreateHSRT16(Device.CellarHSRT16, new I2CSlaveAddress(32)); var garden = this.CreateArea(RoomId.Garden) .WithLamp(Garden.LampTerrace, hsrt16[HSRT16Pin.Relay15]) .WithLamp(Garden.LampGarage, hsrt16[HSRT16Pin.Relay14]) .WithLamp(Garden.LampTap, hsrt16[HSRT16Pin.Relay13]) .WithLamp(Garden.SpotlightRoof, hsrt16[HSRT16Pin.Relay12]) .WithLamp(Garden.LampRearArea, hsrt16[HSRT16Pin.Relay11]) .WithSocket(Garden.SocketPavillion, hsrt16[HSRT16Pin.Relay10]) // 9 = free .WithLamp(Garden.LampParkingLot, new LogicalBinaryOutput().WithOutput(hsrt16[HSRT16Pin.Relay8]).WithOutput(hsrt16[HSRT16Pin.Relay6]).WithOutput(hsrt16[HSRT16Pin.Relay7])) .WithButton(Garden.Button, pi2PortController.GetInput(4).WithInvertedState()) .WithStateMachine(Garden.StateMachine, SetupStateMachine); garden.GetStateMachine(Garden.StateMachine).ConnectMoveNextAndToggleOffWith(garden.GetButton(Garden.Button)); garden.SetupConditionalOnAutomation() .WithActuator(garden.GetLamp(Garden.LampParkingLot)) .WithOnAtNightRange() .WithOffBetweenRange(TimeSpan.Parse("22:30:00"), TimeSpan.Parse("05:00:00")); TimerService.Tick += (s, e) => { pi2PortController.PollOpenInputPorts(); }; await base.ConfigureAsync(); }
public Configuration( CCToolsBoardService ccToolsBoardService, IPi2GpioService pi2GpioService, SynonymService synonymService, IAreaService areaService, ActuatorFactory actuatorFactory, SensorFactory sensorFactory, AutomationFactory automationFactory) { if (ccToolsBoardService == null) throw new ArgumentNullException(nameof(ccToolsBoardService)); if (pi2GpioService == null) throw new ArgumentNullException(nameof(pi2GpioService)); if (synonymService == null) throw new ArgumentNullException(nameof(synonymService)); if (actuatorFactory == null) throw new ArgumentNullException(nameof(actuatorFactory)); if (sensorFactory == null) throw new ArgumentNullException(nameof(sensorFactory)); if (automationFactory == null) throw new ArgumentNullException(nameof(automationFactory)); _ccToolsBoardService = ccToolsBoardService; _pi2GpioService = pi2GpioService; _synonymService = synonymService; _areaService = areaService; _actuatorFactory = actuatorFactory; _sensorFactory = sensorFactory; _automationFactory = automationFactory; }