Ejemplo n.º 1
0
 public InterruptMonitorService(IConfigurationService configurationService, IGpioService gpioService, ILogService logService)
 {
     _gpioService          = gpioService ?? throw new ArgumentNullException(nameof(gpioService));
     _configurationService = configurationService ?? throw new ArgumentNullException(nameof(configurationService));
     _logService           = logService ?? throw new ArgumentNullException(nameof(logService));
     _log = logService.CreatePublisher(nameof(InterruptMonitorService));
 }
Ejemplo n.º 2
0
 public GrpcService(
     IGpioService gpioService,
     ILoggerService <GrpcService> logger)
 {
     _gpioService = gpioService;
     _logger      = logger;
 }
Ejemplo n.º 3
0
        public MainViewModel(INetService netService, IGpioService gpioService)
        {
            this.GpioService = gpioService;
            this.NetService  = netService;

            Pins = new ObservableCollection <PinViewModel>();

            Initialize();
        }
Ejemplo n.º 4
0
        internal GpioController(IGpioService gpioService)
        {
            if (gpioService == null)
            {
                throw new ArgumentNullException(nameof(gpioService));
            }

            _gpioService = gpioService;
        }
Ejemplo n.º 5
0
 public DeviceAPI(ILogger <DeviceAPI> logger, IAquariumAuthService aquariumAuthService, IDeviceService deviceService, ScheduleService scheduleService, IGpioService gpioService, IATOService atoService)
 {
     _logger = logger;
     _aquariumAuthService = aquariumAuthService;
     _deviceService       = deviceService;
     _scheduleService     = scheduleService;
     _gpioService         = gpioService;
     _atoService          = atoService;
 }
Ejemplo n.º 6
0
 public SessionService(
     ISessionContext sessionContext,
     IGpioService gpioService,
     ILoggerService <SessionService> logger)
 {
     _sessionContext = sessionContext;
     _gpioService    = gpioService;
     _logger         = logger;
 }
        /// <summary>
        /// Sets specified gpio service which will be used by gpio controller
        /// </summary>
        /// <param name="gpioService">Gpio service which will be used by gpio controller</param>
        /// <returns>Instance of <see cref="IGpioControllerOptionsConfigurator"/></returns>
        public IGpioControllerOptionsConfigurator SetGpioService(IGpioService gpioService)
        {
            if (gpioService == null)
            {
                throw new ArgumentNullException(nameof(gpioService));
            }

            _gpioControllerOptions.GpioService = gpioService;

            return(this);
        }
Ejemplo n.º 8
0
        internal Pin(int pinNumer, PinMode pinMode, IGpioService gpioService)
        {
            if (gpioService == null)
            {
                throw new ArgumentNullException(nameof(gpioService));
            }

            _pinNumer    = pinNumer;
            _gpioService = gpioService;
            Mode         = pinMode;
        }
 public Thermometer(IGpioService gpioService, 
   IAnalogTemperatureSensorController temperatureSensorController, 
   int errorPinId = Settings.ErrorPinId, int dataPinId = Settings.DataPinId, 
   int longFlashTime = Settings.LongFlashTime, int shortFlashTime = Settings.ShortFlashTime)
 {
   _gpioService = gpioService;
   _errorPinId = errorPinId;
   _dataPinId = dataPinId;
   _longFlashTime = longFlashTime;
   _shortFlashTime = shortFlashTime;
   _temperatureSensorController = temperatureSensorController;
 }
Ejemplo n.º 10
0
 public MotionSiren(
     SirenSettings settings,
     ILogger <MotionSiren> logger,
     IGpioService gpio,
     ICameraService cameraService)
 {
     this.settings      = settings;
     this.logger        = logger;
     this.gpio          = gpio;
     this.cameraService = cameraService;
     this.machine       = CreateStateMachine();
 }
Ejemplo n.º 11
0
 public SampleWorker(
     ISessionService sessionService,
     ISampleClient sampleClient,
     IGpioService gpioService,
     ILogService logService,
     ILoggerService <SampleWorker> logger)
 {
     _sessionService = sessionService;
     _sampleClient   = sampleClient;
     _gpioService    = gpioService;
     _logService     = logService;
     _logger         = logger;
 }
Ejemplo n.º 12
0
 public ATOService(IConfiguration config, ILogger <ATOService> logger,
                   IAquariumAuthService aquariumAuthService,
                   IGpioService gpioService,
                   ScheduleService scheduleService,
                   IExceptionService exceptionService,
                   IAquariumClient aquariumClient)
 {
     _config = config;
     _logger = logger;
     _aquariumAuthService = aquariumAuthService;
     _gpioService         = gpioService;
     _scheduleService     = scheduleService;
     _aquariumClient      = aquariumClient;
     _exceptionService    = exceptionService;
 }
Ejemplo n.º 13
0
 public HomeController(IDeviceService deviceService,
                       ScheduleService scheduleService,
                       IHardwareService hardwareService,
                       IGpioService gpioService,
                       IAquariumAuthService aquariumAuthService,
                       ILogger <HomeController> logger, IConfiguration config)
 {
     _deviceService       = deviceService;
     _scheduleService     = scheduleService;
     _gpioService         = gpioService;
     _hardwareService     = hardwareService;
     _aquariumAuthService = aquariumAuthService;
     _logger = logger;
     _config = config;
 }
Ejemplo n.º 14
0
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            deferral = taskInstance.GetDeferral();

            sampler = new HumidityTemperatureReading();

            gpioCtrl = new GpioService();
            samplerPin = gpioCtrl.Controller?.OpenPin((int)Settings.DHT11DataPinId);

            if (samplerPin != null)
            {
                sampler.Init(samplerPin);
            }

            timer = ThreadPoolTimer.CreatePeriodicTimer(OnTimer, TimeSpan.FromSeconds(60));
        }
 public AnalogTemperatureSensorController(
   IGpioService gpioCtrl, 
   int adcCsPinId = Settings.AdcCsPinId, 
   int adcClkPinId = Settings.AdcClkPinId, 
   int adcDigitalIoPinId = Settings.AdcDigitalIoPinId, 
   int delayMilliSeconds = Settings.DefaultTemperaturePostingDelay, 
   int maxRetries = Settings.MaxReadRetry)
 {
   _gpioCtrl = gpioCtrl;
   _adcCsPinId = adcCsPinId;
   _adcClkPinId = adcClkPinId;
   _adcDigitalIoPinId = adcDigitalIoPinId;
   _delayMilliSeconds = delayMilliSeconds;
   _maxRetries = maxRetries;
   IsMeasuring = false;
 }
Ejemplo n.º 16
0
 public Configuration(
     IDeviceRegistryService deviceRegistryService,
     IGpioService gpioService,
     IAreaRegistryService areaService,
     ActuatorFactory actuatorFactory,
     SensorFactory sensorFactory,
     AutomationFactory automationFactory,
     IMessageBrokerService messageBroker)
 {
     _deviceRegistryService = deviceRegistryService ?? throw new ArgumentNullException(nameof(deviceRegistryService));
     _gpioService           = gpioService ?? throw new ArgumentNullException(nameof(gpioService));
     _areaService           = areaService ?? throw new ArgumentNullException(nameof(areaService));
     _messageBroker         = messageBroker ?? throw new ArgumentNullException(nameof(messageBroker));
     _actuatorFactory       = actuatorFactory ?? throw new ArgumentNullException(nameof(actuatorFactory));
     _sensorFactory         = sensorFactory ?? throw new ArgumentNullException(nameof(sensorFactory));
     _automationFactory     = automationFactory ?? throw new ArgumentNullException(nameof(automationFactory));
 }
Ejemplo n.º 17
0
 public Configuration(
     CCToolsDeviceService ccToolsBoardService,
     IGpioService pi2GpioService,
     IAreaRegistryService areaService,
     ActuatorFactory actuatorFactory,
     SensorFactory sensorFactory,
     AutomationFactory automationFactory,
     ILogService logService)
 {
     _ccToolsBoardService = ccToolsBoardService ?? throw new ArgumentNullException(nameof(ccToolsBoardService));
     _pi2GpioService      = pi2GpioService ?? throw new ArgumentNullException(nameof(pi2GpioService));
     _areaService         = areaService;
     _actuatorFactory     = actuatorFactory ?? throw new ArgumentNullException(nameof(actuatorFactory));
     _sensorFactory       = sensorFactory ?? throw new ArgumentNullException(nameof(sensorFactory));
     _automationFactory   = automationFactory ?? throw new ArgumentNullException(nameof(automationFactory));
     _logService          = logService;
 }
Ejemplo n.º 18
0
 public Configuration(
     CCToolsDeviceService ccToolsBoardService,
     IGpioService pi2GpioService,
     IDeviceRegistryService deviceService,
     II2CBusService i2CBusService,
     ISchedulerService schedulerService,
     RemoteSocketService remoteSocketService,
     IContainer containerService,
     ILogService logService)
 {
     _ccToolsBoardService = ccToolsBoardService ?? throw new ArgumentNullException(nameof(ccToolsBoardService));
     _pi2GpioService      = pi2GpioService ?? throw new ArgumentNullException(nameof(pi2GpioService));
     _deviceService       = deviceService ?? throw new ArgumentNullException(nameof(deviceService));
     _i2CBusService       = i2CBusService ?? throw new ArgumentNullException(nameof(i2CBusService));
     _schedulerService    = schedulerService ?? throw new ArgumentNullException(nameof(schedulerService));
     _remoteSocketService = remoteSocketService ?? throw new ArgumentNullException(nameof(remoteSocketService));
     _containerService    = containerService ?? throw new ArgumentNullException(nameof(containerService));
     _logService          = logService ?? throw new ArgumentNullException(nameof(logService));
 }
Ejemplo n.º 19
0
        public HealthService(
            ControllerOptions controllerOptions,
            IGpioService pi2GpioService,
            ITimerService timerService,
            ISystemInformationService systemInformationService)
        {
            if (controllerOptions == null)
            {
                throw new ArgumentNullException(nameof(controllerOptions));
            }
            if (timerService == null)
            {
                throw new ArgumentNullException(nameof(timerService));
            }
            if (systemInformationService == null)
            {
                throw new ArgumentNullException(nameof(systemInformationService));
            }

            _controllerOptions        = controllerOptions;
            _pi2GpioService           = pi2GpioService;
            _timerService             = timerService;
            _systemInformationService = systemInformationService;
        }
 public SwitchDevice(IGpioService gpioCtrl, int pinId)
 {
   _pinId = pinId;
   _gpioCtrl = gpioCtrl;
   SwitchOn(false);
 }
Ejemplo n.º 21
0
 public GpioController(IGpioService gpioService)
 {
     _gpioService = gpioService;
 }
Ejemplo n.º 22
0
 public ServoNotificationHandler(ILogger <ServoNotificationHandler> logger, IGpioService gpioService)
 {
     _logger      = logger;
     _gpioService = gpioService;
 }
Ejemplo n.º 23
0
        public HealthService(
            IConfigurationService configurationService,
            IController controller,
            ITimerService timerService,
            IGpioService gpioService,
            IDateTimeService dateTimeService,
            ISystemInformationService systemInformationService,
            ILogService logService)
        {
            if (configurationService == null)
            {
                throw new ArgumentNullException(nameof(configurationService));
            }
            if (controller == null)
            {
                throw new ArgumentNullException(nameof(controller));
            }
            if (timerService == null)
            {
                throw new ArgumentNullException(nameof(timerService));
            }
            if (systemInformationService == null)
            {
                throw new ArgumentNullException(nameof(systemInformationService));
            }

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

            var startupTimestamp = dateTimeService.Now;

            systemInformationService.Set("Health/SystemTime", () => dateTimeService.Now);
            systemInformationService.Set("Health/TimerDuration/Average", () => _averageTimerDuration);
            systemInformationService.Set("Health/TimerDuration/AverageMax", () => _maxTimerDuration);
            systemInformationService.Set("Health/TimerDuration/AverageMin", () => _minTimerDuration);
            systemInformationService.Set("Health/StartupTimestamp", startupTimestamp);
            systemInformationService.Set("Health/UpTime", () => dateTimeService.Now - startupTimestamp);
            systemInformationService.Set("Log/Errors/Count", () => logService.ErrorsCount);
            systemInformationService.Set("Log/Warnings/Count", () => logService.WarningsCount);

            controller.StartupCompleted += (sender, args) =>
            {
                _log.Info("Startup completed after " + args.Duration);
                systemInformationService.Set("Health/StartupDuration", args.Duration);
            };

            controller.StartupFailed += (sender, args) =>
            {
                _log.Error(args.Exception, "Startup failed after " + args.Duration);
            };

            timerService.Tick += UpdateStatistics;

            var configuration = configurationService.GetConfiguration <HealthServiceConfiguration>("HealthServiceConfiguration");

            if (configuration.StatusLed.Gpio.HasValue)
            {
                var gpio = gpioService.GetOutput(configuration.StatusLed.Gpio.Value);
                if (configuration.StatusLed.IsInverted)
                {
                    gpio = gpio.WithInvertedState();
                }

                var statusLed = new StatusLed(gpio);
                timerService.Tick += (s, e) => statusLed.Update();
            }
        }
Ejemplo n.º 24
0
 public NetService(IGpioService gpioService)
 {
     this.GpioService = gpioService;
 }
Ejemplo n.º 25
0
 public ZoneControlService(IGpioService gpioService)
 {
     this.gpioService = gpioService;
 }
Ejemplo n.º 26
0
        public MainPageVM()
        {
            if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled)
            {
                dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
            }
            ShowControls = false;
            MeasuredInterval = 60;
            SamplingCommandText = "Measure temperature";

            samplingTimer = new Timer(OnTimerTick, null, Timeout.Infinite, Timeout.Infinite);
            sampler = new HumTempReading();

            gpioCtrl = new GpioService();
            samplerPin = gpioCtrl.Controller?.OpenPin(Dht11DataPinId);

            if (samplerPin != null)
            {
                sampler.Init(samplerPin);
                StatusText = sampler.PullResitorNeeded() ? "10k pull-up resistor required." : "Pull-up resistor not required.";
            }
        }
Ejemplo n.º 27
0
 public StatusLed(IGpioService gpioCtrl, int pinId) : base(gpioCtrl,pinId)
 {
 }