public LPD433MHzSignalSender(I2CHardwareBridge.I2CHardwareBridge i2CHardwareBridge, byte pin, IHttpRequestController httpApiController)
        {
            if (i2CHardwareBridge == null)
            {
                throw new ArgumentNullException(nameof(i2CHardwareBridge));
            }
            if (httpApiController == null)
            {
                throw new ArgumentNullException(nameof(httpApiController));
            }

            _i2CHardwareBridge = i2CHardwareBridge;
            _pin = pin;

            httpApiController.HandlePost("433MHz").Using(ApiPost);
        }
        public HealthMonitor(IBinaryOutput statusLed, IHomeAutomationTimer timer, IHttpRequestController httpApiController)
        {
            if (timer == null)
            {
                throw new ArgumentNullException(nameof(timer));
            }
            if (httpApiController == null)
            {
                throw new ArgumentNullException(nameof(httpApiController));
            }

            _statusLed   = statusLed;
            _timer       = timer;
            _startedDate = _timer.CurrentDateTime;

            if (statusLed != null)
            {
                _ledTimeout.Start(TimeSpan.FromMilliseconds(1));
            }

            timer.Tick += Tick;
            httpApiController.HandleGet("health").Using(HandleApiGet);
            httpApiController.HandlePost("health/reset").Using(c => ResetStatistics());
        }
Esempio n. 3
0
 public void ExposeToApi()
 {
     _httpApiController.HandlePost($"{_relativeUri}/settings").Using(HandleApiPost);
     _httpApiController.HandleGet($"{_relativeUri}/settings").Using(HandleApiGet);
 }
Esempio n. 4
0
 public void ExposeToApi()
 {
     _httpApiController.HandleGet("weatherStation").Using(HandleApiGet);
     _httpApiController.HandlePost("weatherStation").Using(HandleApiPost);
 }
Esempio n. 5
0
 private void ExposeToApi()
 {
     _httpApi.HandleGet($"device/{Id}").Using(HandleApiGet);
     _httpApi.HandlePost($"device/{Id}").Using(HandleApiPost);
     _httpApi.HandlePatch($"device/{Id}").Using(HandleApiPatch);
 }