Changed name of ServiceContractInterfaces to IServiceContractInterfaces

Update the interface with new UpdateSensor method calls
merge-updating
Stefan Roelofs 4 years ago
parent 1bfeb9c45f
commit a50640d7d7

@ -17,7 +17,7 @@ namespace UserInterface.Views
{
public class AddCommandDialog : Window
{
private readonly IIpcClient<ServiceContractInterfaces> client;
private readonly IIpcClient<IServiceContractInterfaces> 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<ServiceContractInterfaces>("addCommand", pipeName: "pipeinternal")
.AddNamedPipeIpcClient<IServiceContractInterfaces>("addCommand", pipeName: "pipeinternal")
.BuildServiceProvider();
// resolve IPC client factory
IIpcClientFactory<ServiceContractInterfaces> clientFactory = serviceProvider
.GetRequiredService<IIpcClientFactory<ServiceContractInterfaces>>();
IIpcClientFactory<IServiceContractInterfaces> clientFactory = serviceProvider
.GetRequiredService<IIpcClientFactory<IServiceContractInterfaces>>();
// create client
this.client = clientFactory.CreateClient("addCommand");

@ -17,7 +17,7 @@ namespace UserInterface.Views
{
public class AddSensorDialog : Window
{
private readonly IIpcClient<ServiceContractInterfaces> client;
private readonly IIpcClient<IServiceContractInterfaces> 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<ServiceContractInterfaces>("addsensor", pipeName: "pipeinternal")
.AddNamedPipeIpcClient<IServiceContractInterfaces>("addsensor", pipeName: "pipeinternal")
.BuildServiceProvider();
// resolve IPC client factory
IIpcClientFactory<ServiceContractInterfaces> clientFactory = serviceProvider
.GetRequiredService<IIpcClientFactory<ServiceContractInterfaces>>();
IIpcClientFactory<IServiceContractInterfaces> clientFactory = serviceProvider
.GetRequiredService<IIpcClientFactory<IServiceContractInterfaces>>();
// create client
this.client = clientFactory.CreateClient("addsensor");

@ -16,19 +16,19 @@ namespace UserInterface.Views
{
public class AppInfo : UserControl
{
private readonly IIpcClient<ServiceContractInterfaces> client;
private readonly IIpcClient<IServiceContractInterfaces> client;
public AppInfo()
{
this.InitializeComponent();
// register IPC clients
ServiceProvider serviceProvider = new ServiceCollection()
.AddNamedPipeIpcClient<ServiceContractInterfaces>("info", pipeName: "pipeinternal")
.AddNamedPipeIpcClient<IServiceContractInterfaces>("info", pipeName: "pipeinternal")
.BuildServiceProvider();
// resolve IPC client factory
IIpcClientFactory<ServiceContractInterfaces> clientFactory = serviceProvider
.GetRequiredService<IIpcClientFactory<ServiceContractInterfaces>>();
IIpcClientFactory<IServiceContractInterfaces> clientFactory = serviceProvider
.GetRequiredService<IIpcClientFactory<IServiceContractInterfaces>>();
// create client
this.client = clientFactory.CreateClient("info");

@ -15,19 +15,19 @@ namespace UserInterface.Views
{
public class BackgroundServiceSettings : UserControl
{
private readonly IIpcClient<ServiceContractInterfaces> _client;
private readonly IIpcClient<IServiceContractInterfaces> _client;
public BackgroundServiceSettings()
{
this.InitializeComponent();
// register IPC clients
ServiceProvider serviceProvider = new ServiceCollection()
.AddNamedPipeIpcClient<ServiceContractInterfaces>("broker", pipeName: "pipeinternal")
.AddNamedPipeIpcClient<IServiceContractInterfaces>("broker", pipeName: "pipeinternal")
.BuildServiceProvider();
// resolve IPC client factory
IIpcClientFactory<ServiceContractInterfaces> clientFactory = serviceProvider
.GetRequiredService<IIpcClientFactory<ServiceContractInterfaces>>();
IIpcClientFactory<IServiceContractInterfaces> clientFactory = serviceProvider
.GetRequiredService<IIpcClientFactory<IServiceContractInterfaces>>();
// create client
this._client = clientFactory.CreateClient("broker");

@ -17,19 +17,19 @@ namespace UserInterface.Views
{
public class BrokerSettings : UserControl
{
private readonly IIpcClient<ServiceContractInterfaces> client;
private readonly IIpcClient<IServiceContractInterfaces> client;
public BrokerSettings()
{
this.InitializeComponent();
// register IPC clients
ServiceProvider serviceProvider = new ServiceCollection()
.AddNamedPipeIpcClient<ServiceContractInterfaces>("broker", pipeName: "pipeinternal")
.AddNamedPipeIpcClient<IServiceContractInterfaces>("broker", pipeName: "pipeinternal")
.BuildServiceProvider();
// resolve IPC client factory
IIpcClientFactory<ServiceContractInterfaces> clientFactory = serviceProvider
.GetRequiredService<IIpcClientFactory<ServiceContractInterfaces>>();
IIpcClientFactory<IServiceContractInterfaces> clientFactory = serviceProvider
.GetRequiredService<IIpcClientFactory<IServiceContractInterfaces>>();
// create client
this.client = clientFactory.CreateClient("broker");

@ -18,7 +18,7 @@ namespace UserInterface.Views
{
public class CommandSettings : UserControl
{
private readonly IIpcClient<ServiceContractInterfaces> _client;
private readonly IIpcClient<IServiceContractInterfaces> _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<ServiceContractInterfaces>("commands", pipeName: "pipeinternal")
.AddNamedPipeIpcClient<IServiceContractInterfaces>("commands", pipeName: "pipeinternal")
.BuildServiceProvider();
// resolve IPC client factory
IIpcClientFactory<ServiceContractInterfaces> clientFactory = serviceProvider
.GetRequiredService<IIpcClientFactory<ServiceContractInterfaces>>();
IIpcClientFactory<IServiceContractInterfaces> clientFactory = serviceProvider
.GetRequiredService<IIpcClientFactory<IServiceContractInterfaces>>();
// create client
this._client = clientFactory.CreateClient("commands");

@ -18,7 +18,7 @@ namespace UserInterface.Views
{
public class SensorSettings : UserControl
{
private readonly IIpcClient<ServiceContractInterfaces> _client;
private readonly IIpcClient<IServiceContractInterfaces> _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<ServiceContractInterfaces>("sensors", pipeName: "pipeinternal")
.AddNamedPipeIpcClient<IServiceContractInterfaces>("sensors", pipeName: "pipeinternal")
.BuildServiceProvider();
// resolve IPC client factory
IIpcClientFactory<ServiceContractInterfaces> clientFactory = serviceProvider
.GetRequiredService<IIpcClientFactory<ServiceContractInterfaces>>();
IIpcClientFactory<IServiceContractInterfaces> clientFactory = serviceProvider
.GetRequiredService<IIpcClientFactory<IServiceContractInterfaces>>();
// create client
this._client = clientFactory.CreateClient("sensors");

@ -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<MqttSettings> 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<ConfiguredSensorModel> GetConfiguredSensor(Guid id);
Task<List<ConfiguredSensorModel>> 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<ConfiguredCommandModel> GetConfiguredCommands();
void AddCommand(AvailableCommands commandType, string json);
void RemoveCommandById(Guid id);
string GetCurrentVersion();
}
}
}

@ -84,14 +84,14 @@ namespace hass_workstation_service
Sw_version = GetVersion()
};
services.AddSingleton(deviceConfig);
services.AddSingleton<ServiceContractInterfaces, InterProcessApi>();
services.AddSingleton<IServiceContractInterfaces, InterProcessApi>();
services.AddSingleton<IConfigurationService, ConfigurationService>();
services.AddSingleton<MqttPublisher>();
services.AddHostedService<Worker>();
}).ConfigureIpcHost(builder =>
{
// configure IPC endpoints
builder.AddNamedPipeEndpoint<ServiceContractInterfaces>(pipeName: "pipeinternal");
builder.AddNamedPipeEndpoint<IServiceContractInterfaces>(pipeName: "pipeinternal");
});
static internal string GetVersion()
{

Loading…
Cancel
Save