示例#1
0
        public Task InvokeAsync(DeviceFeatureInvocationContext ctx, ActionCommand.OnOff commandParams)
        {
            var message = commandParams.On ? _options.On : _options.Off;

            _logger.LogInformation(message);

            return(Task.CompletedTask);
        }
示例#2
0
        public async Task InvokeAsync(DeviceFeatureInvocationContext ctx, ActionCommand.OnOff commandParams)
        {
            var endpoint = commandParams.On ? _options.On : _options.Off;

            _logger.LogInformation("WebHookSimpleOnOff: " + endpoint.Url);

            var contentType = String.IsNullOrWhiteSpace(endpoint.ContentType) ? endpoint.ContentType : DefaultContentType;

            await new HttpClient().PostAsync(endpoint.Url, new StringContent(endpoint.Body ?? "", new UTF8Encoding(false), contentType));
        }
示例#3
0
        public Task InvokeAsync(DeviceFeatureInvocationContext ctx, ActionCommand.OnOff commandParams)
        {
            var processConfig = commandParams.On ? _options.On : _options.Off;

            _logger.LogInformation($"ExternalProcessOnOff: Executable={processConfig.Executable}; Arguments={processConfig.Arguments}");

            var process = Process.Start(processConfig.Executable, processConfig.Arguments);

            if (processConfig.WaitForExit)
            {
                process.WaitForExit();
            }

            return(Task.CompletedTask);
        }
示例#4
0
 public async Task InvokeAsync(DeviceFeatureInvocationContext ctx, ActionCommand.OnOff commandParams)
 {
     _logger.LogInformation("IrKitSimpleOnOff: " + commandParams.On);
     await new IrKitClient(_options.EndPoint).SendMessagesAsync(commandParams.On ? _options.On : _options.Off);
 }