sync the state
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
namespace Common.UI.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
using Common.Hardware.SIRT;
|
||||
|
||||
using NLog;
|
||||
|
||||
public class SIRTFactoryModel
|
||||
{
|
||||
private readonly SIRTFactory sirtFactory;
|
||||
private readonly ILogger logger;
|
||||
|
||||
public SIRTFactoryModel(SIRTFactory sirtFactory, ILogger logger)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.sirtFactory = sirtFactory;
|
||||
this.sirtFactory.Logging += this.SirtFactory_Logging;
|
||||
}
|
||||
|
||||
internal Action<SIRTTask> EnqueueAction => this.sirtFactory.EnqueueTask;
|
||||
|
||||
internal void Initialize(string portNamesString, Action<SIRTBroadcaster> connecting)
|
||||
{
|
||||
var portNames = portNamesString
|
||||
?.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
?? Array.Empty<string>();
|
||||
|
||||
foreach (var portName in portNames)
|
||||
{
|
||||
this.sirtFactory.ConnectSIRT(portName, connecting);
|
||||
}
|
||||
}
|
||||
|
||||
private void SirtFactory_Logging(string content)
|
||||
=> this.logger.Debug(content);
|
||||
|
||||
internal void DisconnectAll() => this.sirtFactory.CloseConnections();
|
||||
|
||||
public static implicit operator SIRTFactory (SIRTFactoryModel model) => model?.sirtFactory;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user