public Worker(ILogger <Worker> logger, ApiClient veraClient, MqttManager mqttManager, AgentVeraSettings agentVeraSettings, Scheduler scheduler) { _logger = logger; _apiClient = veraClient; _mqttManager = mqttManager; _agentVeraSettings = agentVeraSettings; _scheduler = scheduler; }
public MqttManager(AgentVeraSettings agentVeraSettings, MqttFactory mqttFactory, ApiClient apiClient, Scheduler scheduler) { this.agentVeraSettings = agentVeraSettings; SetConnectionOptions(); this.mqttClient = mqttFactory.CreateMqttClient(); this.apiClient = apiClient; this.scheduler = scheduler; SubscribeMqttClientAsync(); }
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureServices((hostContext, services) => { IConfiguration configuration = hostContext.Configuration; AgentVeraSettings alarmSettings = configuration.Get <AgentVeraSettings>(); services.AddSingleton(alarmSettings); services.AddTransient <ApiClient>(); services.AddTransient <MqttFactory>(); services.AddTransient <MqttManager>(); services.AddTransient <Scheduler>(); services.AddHostedService <Worker>(); });
public ApiClient(AgentVeraSettings agentVeraSettings) { _httpClient = new HttpClient(); this.agentVeraSettings = agentVeraSettings; }