public void ExposeToApi(IApiController apiController)
        {
            if (apiController == null)
            {
                throw new ArgumentNullException(nameof(apiController));
            }

            apiController.RouteCommand("personalAgent", HandleCommand);
        }
        public void ExposeToApi(IApiController apiController)
        {
            if (apiController == null)
            {
                throw new ArgumentNullException(nameof(apiController));
            }

            apiController.RouteRequest($"component/{_component.Id}/history", HandleApiRequest);
            apiController.RouteCommand($"component/{_component.Id}/history", HandleApiCommand);
        }
        public LPD433MHzSignalSender(I2CHardwareBridge.I2CHardwareBridge i2CHardwareBridge, byte pin, IApiController apiController)
        {
            if (i2CHardwareBridge == null)
            {
                throw new ArgumentNullException(nameof(i2CHardwareBridge));
            }
            if (apiController == null)
            {
                throw new ArgumentNullException(nameof(apiController));
            }

            _i2CHardwareBridge = i2CHardwareBridge;
            _pin = pin;

            apiController.RouteCommand("433MHz", ApiPost);
        }
        public HealthMonitor(IBinaryOutput statusLed, IHomeAutomationTimer timer, IApiController apiController)
        {
            if (timer == null)
            {
                throw new ArgumentNullException(nameof(timer));
            }
            if (apiController == null)
            {
                throw new ArgumentNullException(nameof(apiController));
            }

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

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

            timer.Tick += Tick;
            apiController.RouteRequest("health", HandleApiGet);
            apiController.RouteCommand("health/reset", c => ResetStatistics());
        }
 public void ExposeToApi()
 {
     _apiController.RouteCommand($"{_relativeUri}/settings", HandleApiCommand);
     _apiController.RouteRequest($"{_relativeUri}/settings", HandleApiRequest);
 }
示例#6
0
 public void ExposeToApi()
 {
     _apiController.RouteRequest("weatherStation", HandleApiGet);
     _apiController.RouteCommand("weatherStation", HandleApiPost);
 }