コード例 #1
0
        public ActuatorHistory(IActuator actuator, IHttpRequestController apiRequestController, ILogger logger)
        {
            _actuator = actuator;
            _logger   = logger;
            _filename = Path.Combine(ApplicationData.Current.LocalFolder.Path, "Actuators", actuator.Id.Value, "History.csv");

            apiRequestController.HandleGet($"statistics/{actuator.Id}").Using(HandleApiGet);
        }
コード例 #2
0
        public void ExposeToApi(IHttpRequestController httpApiController)
        {
            if (httpApiController == null)
            {
                throw new ArgumentNullException(nameof(httpApiController));
            }

            httpApiController.HandleGet("trace").Using(HandleApiGet);
        }
コード例 #3
0
        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());
        }
コード例 #4
0
 public void ExposeToApi()
 {
     _httpApiController.HandlePost($"{_relativeUri}/settings").Using(HandleApiPost);
     _httpApiController.HandleGet($"{_relativeUri}/settings").Using(HandleApiGet);
 }
コード例 #5
0
 public void ExposeToApi()
 {
     _httpApiController.HandleGet("weatherStation").Using(HandleApiGet);
     _httpApiController.HandlePost("weatherStation").Using(HandleApiPost);
 }
コード例 #6
0
 private void ExposeToApi()
 {
     _httpApi.HandleGet($"device/{Id}").Using(HandleApiGet);
     _httpApi.HandlePost($"device/{Id}").Using(HandleApiPost);
     _httpApi.HandlePatch($"device/{Id}").Using(HandleApiPatch);
 }