diff --git a/UserInterface/Views/AddCommandDialog.axaml.cs b/UserInterface/Views/AddCommandDialog.axaml.cs index a1ed877..fbf0974 100644 --- a/UserInterface/Views/AddCommandDialog.axaml.cs +++ b/UserInterface/Views/AddCommandDialog.axaml.cs @@ -17,7 +17,7 @@ namespace UserInterface.Views { public class AddCommandDialog : Window { - private readonly IIpcClient client; + private readonly IIpcClient client; public ComboBox comboBox { get; set; } public ComboBox detectionModecomboBox { get; set; } public AddCommandDialog() @@ -30,12 +30,12 @@ namespace UserInterface.Views // register IPC clients ServiceProvider serviceProvider = new ServiceCollection() - .AddNamedPipeIpcClient("addCommand", pipeName: "pipeinternal") + .AddNamedPipeIpcClient("addCommand", pipeName: "pipeinternal") .BuildServiceProvider(); // resolve IPC client factory - IIpcClientFactory clientFactory = serviceProvider - .GetRequiredService>(); + IIpcClientFactory clientFactory = serviceProvider + .GetRequiredService>(); // create client this.client = clientFactory.CreateClient("addCommand"); diff --git a/UserInterface/Views/AddSensorDialog.axaml.cs b/UserInterface/Views/AddSensorDialog.axaml.cs index 8c12a81..024e78a 100644 --- a/UserInterface/Views/AddSensorDialog.axaml.cs +++ b/UserInterface/Views/AddSensorDialog.axaml.cs @@ -17,7 +17,7 @@ namespace UserInterface.Views { public class AddSensorDialog : Window { - private readonly IIpcClient client; + private readonly IIpcClient client; public ComboBox comboBox { get; set; } public ComboBox detectionModecomboBox { get; set; } public AddSensorDialog() @@ -30,12 +30,12 @@ namespace UserInterface.Views // register IPC clients ServiceProvider serviceProvider = new ServiceCollection() - .AddNamedPipeIpcClient("addsensor", pipeName: "pipeinternal") + .AddNamedPipeIpcClient("addsensor", pipeName: "pipeinternal") .BuildServiceProvider(); // resolve IPC client factory - IIpcClientFactory clientFactory = serviceProvider - .GetRequiredService>(); + IIpcClientFactory clientFactory = serviceProvider + .GetRequiredService>(); // create client this.client = clientFactory.CreateClient("addsensor"); diff --git a/UserInterface/Views/AppInfo.axaml.cs b/UserInterface/Views/AppInfo.axaml.cs index 388d13c..ed0b184 100644 --- a/UserInterface/Views/AppInfo.axaml.cs +++ b/UserInterface/Views/AppInfo.axaml.cs @@ -16,19 +16,19 @@ namespace UserInterface.Views { public class AppInfo : UserControl { - private readonly IIpcClient client; + private readonly IIpcClient client; public AppInfo() { this.InitializeComponent(); // register IPC clients ServiceProvider serviceProvider = new ServiceCollection() - .AddNamedPipeIpcClient("info", pipeName: "pipeinternal") + .AddNamedPipeIpcClient("info", pipeName: "pipeinternal") .BuildServiceProvider(); // resolve IPC client factory - IIpcClientFactory clientFactory = serviceProvider - .GetRequiredService>(); + IIpcClientFactory clientFactory = serviceProvider + .GetRequiredService>(); // create client this.client = clientFactory.CreateClient("info"); diff --git a/UserInterface/Views/BackgroundServiceSettings.axaml.cs b/UserInterface/Views/BackgroundServiceSettings.axaml.cs index 23588c9..f2b518f 100644 --- a/UserInterface/Views/BackgroundServiceSettings.axaml.cs +++ b/UserInterface/Views/BackgroundServiceSettings.axaml.cs @@ -15,19 +15,19 @@ namespace UserInterface.Views { public class BackgroundServiceSettings : UserControl { - private readonly IIpcClient _client; + private readonly IIpcClient _client; public BackgroundServiceSettings() { this.InitializeComponent(); // register IPC clients ServiceProvider serviceProvider = new ServiceCollection() - .AddNamedPipeIpcClient("broker", pipeName: "pipeinternal") + .AddNamedPipeIpcClient("broker", pipeName: "pipeinternal") .BuildServiceProvider(); // resolve IPC client factory - IIpcClientFactory clientFactory = serviceProvider - .GetRequiredService>(); + IIpcClientFactory clientFactory = serviceProvider + .GetRequiredService>(); // create client this._client = clientFactory.CreateClient("broker"); diff --git a/UserInterface/Views/BrokerSettings.axaml.cs b/UserInterface/Views/BrokerSettings.axaml.cs index 3e59837..e870a80 100644 --- a/UserInterface/Views/BrokerSettings.axaml.cs +++ b/UserInterface/Views/BrokerSettings.axaml.cs @@ -17,19 +17,19 @@ namespace UserInterface.Views { public class BrokerSettings : UserControl { - private readonly IIpcClient client; + private readonly IIpcClient client; public BrokerSettings() { this.InitializeComponent(); // register IPC clients ServiceProvider serviceProvider = new ServiceCollection() - .AddNamedPipeIpcClient("broker", pipeName: "pipeinternal") + .AddNamedPipeIpcClient("broker", pipeName: "pipeinternal") .BuildServiceProvider(); // resolve IPC client factory - IIpcClientFactory clientFactory = serviceProvider - .GetRequiredService>(); + IIpcClientFactory clientFactory = serviceProvider + .GetRequiredService>(); // create client this.client = clientFactory.CreateClient("broker"); diff --git a/UserInterface/Views/CommandSettings.axaml.cs b/UserInterface/Views/CommandSettings.axaml.cs index e9753fc..b4379da 100644 --- a/UserInterface/Views/CommandSettings.axaml.cs +++ b/UserInterface/Views/CommandSettings.axaml.cs @@ -18,7 +18,7 @@ namespace UserInterface.Views { public class CommandSettings : UserControl { - private readonly IIpcClient _client; + private readonly IIpcClient _client; private readonly DataGrid _dataGrid; private bool _sensorsNeedToRefresh; @@ -27,12 +27,12 @@ namespace UserInterface.Views this.InitializeComponent(); // register IPC clients ServiceProvider serviceProvider = new ServiceCollection() - .AddNamedPipeIpcClient("commands", pipeName: "pipeinternal") + .AddNamedPipeIpcClient("commands", pipeName: "pipeinternal") .BuildServiceProvider(); // resolve IPC client factory - IIpcClientFactory clientFactory = serviceProvider - .GetRequiredService>(); + IIpcClientFactory clientFactory = serviceProvider + .GetRequiredService>(); // create client this._client = clientFactory.CreateClient("commands"); diff --git a/UserInterface/Views/SensorSettings.axaml.cs b/UserInterface/Views/SensorSettings.axaml.cs index 9eceeb1..dff4900 100644 --- a/UserInterface/Views/SensorSettings.axaml.cs +++ b/UserInterface/Views/SensorSettings.axaml.cs @@ -18,7 +18,7 @@ namespace UserInterface.Views { public class SensorSettings : UserControl { - private readonly IIpcClient _client; + private readonly IIpcClient _client; private readonly DataGrid _dataGrid; private bool _sensorsNeedToRefresh; @@ -27,12 +27,12 @@ namespace UserInterface.Views this.InitializeComponent(); // register IPC clients ServiceProvider serviceProvider = new ServiceCollection() - .AddNamedPipeIpcClient("sensors", pipeName: "pipeinternal") + .AddNamedPipeIpcClient("sensors", pipeName: "pipeinternal") .BuildServiceProvider(); // resolve IPC client factory - IIpcClientFactory clientFactory = serviceProvider - .GetRequiredService>(); + IIpcClientFactory clientFactory = serviceProvider + .GetRequiredService>(); // create client this._client = clientFactory.CreateClient("sensors"); diff --git a/hass-workstation-service/Communication/InterProcesCommunication/ServiceContractInterfaces.cs b/hass-workstation-service/Communication/InterProcesCommunication/IServiceContractInterfaces.cs similarity index 79% rename from hass-workstation-service/Communication/InterProcesCommunication/ServiceContractInterfaces.cs rename to hass-workstation-service/Communication/InterProcesCommunication/IServiceContractInterfaces.cs index 57c29f6..51e2fdd 100644 --- a/hass-workstation-service/Communication/InterProcesCommunication/ServiceContractInterfaces.cs +++ b/hass-workstation-service/Communication/InterProcesCommunication/IServiceContractInterfaces.cs @@ -1,12 +1,11 @@ using hass_workstation_service.Communication.InterProcesCommunication.Models; using System; using System.Collections.Generic; -using System.Text; using System.Threading.Tasks; namespace hass_workstation_service.Communication.NamedPipe { - public interface ServiceContractInterfaces + public interface IServiceContractInterfaces { Task GetMqttBrokerSettings(); public string Ping(string str); @@ -14,12 +13,15 @@ namespace hass_workstation_service.Communication.NamedPipe MqqtClientStatus GetMqqtClientStatus(); void EnableAutostart(bool enable); bool IsAutoStartEnabled(); + Task GetConfiguredSensor(Guid id); Task> GetConfiguredSensors(); - void RemoveSensorById(Guid id); void AddSensor(AvailableSensors sensorType, string json); - void RemoveCommandById(Guid id); + void RemoveSensorById(Guid id); + void UpdateSensorById(Guid id, string json); + ConfiguredCommandModel GetConfiguredCommand(Guid id); List GetConfiguredCommands(); void AddCommand(AvailableCommands commandType, string json); + void RemoveCommandById(Guid id); string GetCurrentVersion(); } -} +} \ No newline at end of file diff --git a/hass-workstation-service/Program.cs b/hass-workstation-service/Program.cs index d720614..ed90371 100644 --- a/hass-workstation-service/Program.cs +++ b/hass-workstation-service/Program.cs @@ -84,14 +84,14 @@ namespace hass_workstation_service Sw_version = GetVersion() }; services.AddSingleton(deviceConfig); - services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddHostedService(); }).ConfigureIpcHost(builder => { // configure IPC endpoints - builder.AddNamedPipeEndpoint(pipeName: "pipeinternal"); + builder.AddNamedPipeEndpoint(pipeName: "pipeinternal"); }); static internal string GetVersion() {