Connection changes
This commit is contained in:
@@ -187,6 +187,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExchangeHub", "ExchangeHub\
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OMNIPruefung", "OMNIPruefung\OMNIPruefung.csproj", "{D766BA80-CCA1-4D05-96B9-AAE520F30595}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OMNIPruefung", "OMNIPruefung\OMNIPruefung.csproj", "{D766BA80-CCA1-4D05-96B9-AAE520F30595}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Abstraction", "CommonCore\Common.Abstraction\Common.Abstraction.csproj", "{1743B349-E347-4DCF-A106-15AE3F95C3A3}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||||
Utils\DateTimeServerShared\DateTimeServerShared.projitems*{4806d89a-fbfb-41bc-aaa7-2242444bf55a}*SharedItemsImports = 4
|
Utils\DateTimeServerShared\DateTimeServerShared.projitems*{4806d89a-fbfb-41bc-aaa7-2242444bf55a}*SharedItemsImports = 4
|
||||||
@@ -4381,6 +4383,70 @@ Global
|
|||||||
{D766BA80-CCA1-4D05-96B9-AAE520F30595}.XP32bit|x64.Build.0 = Release|Any CPU
|
{D766BA80-CCA1-4D05-96B9-AAE520F30595}.XP32bit|x64.Build.0 = Release|Any CPU
|
||||||
{D766BA80-CCA1-4D05-96B9-AAE520F30595}.XP32bit|x86.ActiveCfg = Release|Any CPU
|
{D766BA80-CCA1-4D05-96B9-AAE520F30595}.XP32bit|x86.ActiveCfg = Release|Any CPU
|
||||||
{D766BA80-CCA1-4D05-96B9-AAE520F30595}.XP32bit|x86.Build.0 = Release|Any CPU
|
{D766BA80-CCA1-4D05-96B9-AAE520F30595}.XP32bit|x86.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}._MANUAL_CONTROL|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}._MANUAL_CONTROL|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}._MANUAL_CONTROL|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}._MANUAL_CONTROL|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}._MANUAL_CONTROL|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}._MANUAL_CONTROL|x64.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}._MANUAL_CONTROL|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}._MANUAL_CONTROL|x86.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.COM|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.COM|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.COM|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.COM|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.COM|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.COM|x64.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.COM|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.COM|x86.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.GenesisDisplayTool_V01|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.GenesisDisplayTool_V01|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.GenesisDisplayTool_V01|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.GenesisDisplayTool_V01|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.GenesisDisplayTool_V01|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.GenesisDisplayTool_V01|x64.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.GenesisDisplayTool_V01|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.GenesisDisplayTool_V01|x86.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.PerformTest|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.PerformTest|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.PerformTest|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.PerformTest|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.PerformTest|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.PerformTest|x64.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.PerformTest|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.PerformTest|x86.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.ReleaseTest|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.ReleaseTest|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.ReleaseTest|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.ReleaseTest|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.ReleaseTest|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.ReleaseTest|x64.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.ReleaseTest|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.ReleaseTest|x86.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.XP32bit|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.XP32bit|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.XP32bit|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.XP32bit|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.XP32bit|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.XP32bit|x64.Build.0 = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.XP32bit|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3}.XP32bit|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -4465,6 +4531,7 @@ Global
|
|||||||
{6518211A-E83F-4171-97C4-A61FCF66D6E0} = {68323534-4337-4E3A-89BC-11D8BB55343A}
|
{6518211A-E83F-4171-97C4-A61FCF66D6E0} = {68323534-4337-4E3A-89BC-11D8BB55343A}
|
||||||
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D} = {68323534-4337-4E3A-89BC-11D8BB55343A}
|
{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D} = {68323534-4337-4E3A-89BC-11D8BB55343A}
|
||||||
{D766BA80-CCA1-4D05-96B9-AAE520F30595} = {68323534-4337-4E3A-89BC-11D8BB55343A}
|
{D766BA80-CCA1-4D05-96B9-AAE520F30595} = {68323534-4337-4E3A-89BC-11D8BB55343A}
|
||||||
|
{1743B349-E347-4DCF-A106-15AE3F95C3A3} = {C17363DF-A043-4F25-8EBA-2B3B078227DC}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {4BCB7B69-696C-436A-86F7-C91EA5588164}
|
SolutionGuid = {4BCB7B69-696C-436A-86F7-C91EA5588164}
|
||||||
|
|||||||
@@ -67,8 +67,13 @@
|
|||||||
<Project>{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}</Project>
|
<Project>{6033FF0C-CF32-4BC5-8EFE-4774CCDC663D}</Project>
|
||||||
<Name>ExchangeHub</Name>
|
<Name>ExchangeHub</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\OmniPlus\OmniPlus.csproj">
|
||||||
|
<Project>{F8D84B9A-0FCF-4083-B067-8C39B7314152}</Project>
|
||||||
|
<Name>OmniPlus</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
<None Include="bin\Debug\CommonConsole.exe.config" />
|
<None Include="bin\Debug\CommonConsole.exe.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
|||||||
+239
-28
@@ -1,44 +1,255 @@
|
|||||||
using System;
|
namespace CommonConsole
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace CommonConsole
|
|
||||||
{
|
{
|
||||||
public class Program
|
using OmniPlus;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.IO.Ports;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
class Program
|
||||||
{
|
{
|
||||||
public static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
var cancelationTokenSource = new CancellationTokenSource();
|
var connection = new IRDAPort();
|
||||||
var cancelationToken = cancelationTokenSource.Token;
|
var response = connection.Send(0x01);
|
||||||
var manualResetEventSlim = new ManualResetEventSlim();
|
Console.WriteLine(Encoding.ASCII.GetString(response));
|
||||||
|
|
||||||
|
response = connection.Send(0xFD, 0xC6);
|
||||||
|
Console.WriteLine(Encoding.ASCII.GetString(response));
|
||||||
|
|
||||||
void LongRunningTask()
|
connection.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class Port : IDisposable
|
||||||
|
{
|
||||||
|
private readonly String name;
|
||||||
|
private readonly Int32 bauds;
|
||||||
|
private readonly Int32 data;
|
||||||
|
private readonly Parity parity;
|
||||||
|
private readonly StopBits stop;
|
||||||
|
|
||||||
|
private SerialPort port;
|
||||||
|
|
||||||
|
protected Port(String name, Int32 bauds, Int32 data, Parity parity, StopBits stop)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.bauds = bauds;
|
||||||
|
this.data = data;
|
||||||
|
this.parity = parity;
|
||||||
|
this.stop = stop;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool IsOpen => this.port?.IsOpen ?? false;
|
||||||
|
|
||||||
|
protected Stream Stream => this.port.BaseStream;
|
||||||
|
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Console.WriteLine("started");
|
if (this.port != null)
|
||||||
|
{
|
||||||
|
this.port.Disposed -= this.Port_Disposed;
|
||||||
|
this.port.ErrorReceived -= this.Port_ErrorReceived;
|
||||||
|
|
||||||
manualResetEventSlim.Wait(3000, cancelationToken);
|
this.port.Close();
|
||||||
|
this.port.Dispose();
|
||||||
Console.WriteLine("stoped");
|
this.port = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Task.Factory.StartNew(LongRunningTask);
|
Console.WriteLine("... Port disposed");
|
||||||
|
}
|
||||||
|
|
||||||
while (true)
|
protected virtual void Open()
|
||||||
|
{
|
||||||
|
this.Dispose();
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var consoleKey = Console.ReadKey().Key;
|
this.port = new SerialPort
|
||||||
|
|
||||||
if (consoleKey == ConsoleKey.X)
|
|
||||||
{
|
{
|
||||||
cancelationTokenSource.Cancel();
|
PortName = this.name,
|
||||||
}
|
BaudRate = this.bauds,
|
||||||
else if (consoleKey == ConsoleKey.C)
|
DataBits = this.data,
|
||||||
{
|
Parity = this.parity,
|
||||||
break;
|
StopBits = this.stop,
|
||||||
}
|
};
|
||||||
|
|
||||||
Console.WriteLine();
|
this.port.Disposed += this.Port_Disposed;
|
||||||
|
this.port.ErrorReceived += this.Port_ErrorReceived;
|
||||||
|
|
||||||
|
this.port.Open();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("... Port created");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Port_Disposed(Object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
this.Dispose();
|
||||||
|
|
||||||
|
Console.WriteLine("... Port disposed internal");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Port_ErrorReceived(Object sender, SerialErrorReceivedEventArgs args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("... Port error received");
|
||||||
|
Console.WriteLine($"... {args.EventType}");
|
||||||
|
|
||||||
|
if (!this.port.IsOpen)
|
||||||
|
{
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IRDAPort : Port
|
||||||
|
{
|
||||||
|
public IRDAPort() : base("COM26", 115200, 8, Parity.None, StopBits.One)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Byte[] Send(params Byte[] request)
|
||||||
|
{
|
||||||
|
Console.WriteLine(">>> " + BitConverter.ToString(request));
|
||||||
|
|
||||||
|
if (!this.IsOpen)
|
||||||
|
{
|
||||||
|
this.Open();
|
||||||
|
}
|
||||||
|
|
||||||
|
var response = new Byte[] { };
|
||||||
|
|
||||||
|
if (!this.IsOpen || !this.Stream.CanWrite || !this.Stream.CanRead)
|
||||||
|
{
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine(">>> 1-1-1-1");
|
||||||
|
this.Stream.Write(new byte[] { 1, 1, 1, 1 }, 0, 4);
|
||||||
|
|
||||||
|
request = request
|
||||||
|
.ToUI1236Message()
|
||||||
|
.ToIrdaMessage();
|
||||||
|
|
||||||
|
Console.WriteLine(">>> " + BitConverter.ToString(request));
|
||||||
|
|
||||||
|
var asyncState = new IRDAAsyncState
|
||||||
|
{
|
||||||
|
Request = request,
|
||||||
|
Stream = this.Stream
|
||||||
|
};
|
||||||
|
|
||||||
|
var lock_object = new object();
|
||||||
|
|
||||||
|
lock (lock_object)
|
||||||
|
{
|
||||||
|
Task.Factory.StartNew(asyncState.BeginReadAsync, asyncState.CancellationToken);
|
||||||
|
|
||||||
|
asyncState.BeginWriteAsync(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
return asyncState.Response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IRDAAsyncState
|
||||||
|
{
|
||||||
|
private readonly ManualResetEventSlim manualResetEventSlim;
|
||||||
|
private readonly CancellationTokenSource cancellationTokenSource;
|
||||||
|
|
||||||
|
public IRDAAsyncState()
|
||||||
|
{
|
||||||
|
this.manualResetEventSlim = new ManualResetEventSlim();
|
||||||
|
this.cancellationTokenSource = new CancellationTokenSource();
|
||||||
|
this.CancellationToken = this.cancellationTokenSource.Token;
|
||||||
|
this.Buffer = new Byte[256];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Byte[] Buffer { get; private set; }
|
||||||
|
|
||||||
|
public Byte[] Request { get; set; }
|
||||||
|
|
||||||
|
public Byte[] Response { get; set; }
|
||||||
|
|
||||||
|
public Stream Stream { get; set; }
|
||||||
|
|
||||||
|
public CancellationToken CancellationToken { get; }
|
||||||
|
|
||||||
|
internal void BeginReadAsync()
|
||||||
|
{
|
||||||
|
this.Response = null;
|
||||||
|
|
||||||
|
var asyncResult = this.Stream.BeginRead(this.Buffer, 0, this.Buffer.Length, this.EndReadAsync, this);
|
||||||
|
|
||||||
|
asyncResult.AsyncWaitHandle.WaitOne();
|
||||||
|
|
||||||
|
if (this.Response is null)
|
||||||
|
{
|
||||||
|
this.BeginReadAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.manualResetEventSlim.Set();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EndReadAsync(IAsyncResult asyncResult)
|
||||||
|
{
|
||||||
|
if (asyncResult.AsyncState is IRDAAsyncState asyncState)
|
||||||
|
{
|
||||||
|
var bytesLength = asyncState.Stream.EndRead(asyncResult);
|
||||||
|
|
||||||
|
if (this.Response is null)
|
||||||
|
{
|
||||||
|
var response = new Byte[bytesLength];
|
||||||
|
|
||||||
|
Array.Copy(this.Buffer, 0, response, 0, bytesLength);
|
||||||
|
|
||||||
|
Console.WriteLine("<<< " + BitConverter.ToString(response));
|
||||||
|
|
||||||
|
response = response
|
||||||
|
.FromIrdaMessage()
|
||||||
|
.FromUI1236Message();
|
||||||
|
|
||||||
|
Console.WriteLine("<<< " + BitConverter.ToString(response));
|
||||||
|
|
||||||
|
if (response.Length != 0)
|
||||||
|
{
|
||||||
|
this.Response = response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void BeginWriteAsync(Byte[] request)
|
||||||
|
{
|
||||||
|
var asyncResult = this.Stream.BeginWrite(request, 0, request.Length, this.EndWriteAsync, this);
|
||||||
|
|
||||||
|
asyncResult.AsyncWaitHandle.WaitOne();
|
||||||
|
|
||||||
|
this.manualResetEventSlim.Wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EndWriteAsync(IAsyncResult asyncResult)
|
||||||
|
{
|
||||||
|
if (asyncResult.AsyncState is IRDAAsyncState asyncState)
|
||||||
|
{
|
||||||
|
asyncState.Stream.EndWrite(asyncResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{1743B349-E347-4DCF-A106-15AE3F95C3A3}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Common.Abstraction</RootNamespace>
|
||||||
|
<AssemblyName>Common.Abstraction</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Interfaces\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Common.Abstraction")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Common.Abstraction")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2023")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("1743b349-e347-4dcf-a106-15ae3f95c3a3")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="COMPorts" value="COM26"/>
|
<add key="Type" value="T2" />
|
||||||
<add key="ExchangeHubURL" value="http://sla12iis01.emea.sensus.net/LaaProductionWeb"/>
|
<add key="COMPorts" value="COM26" />
|
||||||
<add key="OmniDB" value="Server=SLASQL01.emea.sensus.net; Database=AuftragKopie; User ID=sa; Password=sqlserver;"/>
|
<add key="ExchangeHubURL" value="http://sla12iis01.emea.sensus.net/LaaProductionWeb" />
|
||||||
|
<add key="OmniDB" value="Server=SLASQL01.emea.sensus.net; Database=AuftragKopie; User ID=sa; Password=sqlserver;" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -127,10 +127,6 @@
|
|||||||
<OptionsV:COMOption DataContext="{Binding .}" ProgressIcon="/Images/meter.png"/>
|
<OptionsV:COMOption DataContext="{Binding .}" ProgressIcon="/Images/meter.png"/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
<DataTemplate DataType="{x:Type OptionsVM:SettingsOptionVM}">
|
|
||||||
<OptionsV:Option DataContext="{Binding .}" Icon="/Images/settings.png" IconSize="14" />
|
|
||||||
</DataTemplate>
|
|
||||||
|
|
||||||
<DataTemplate DataType="{x:Type ContentVM:MainContentVM}">
|
<DataTemplate DataType="{x:Type ContentVM:MainContentVM}">
|
||||||
<Label Content="{Binding Header}" />
|
<Label Content="{Binding Header}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
@@ -147,10 +143,6 @@
|
|||||||
<ContentV:COMContent DataContext="{Binding .}" />
|
<ContentV:COMContent DataContext="{Binding .}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
<DataTemplate DataType="{x:Type ContentVM:SettingsContentVM}">
|
|
||||||
<ContentV:SettingsContent DataContext="{Binding .}" />
|
|
||||||
</DataTemplate>
|
|
||||||
|
|
||||||
<!--<a href="https://www.flaticon.com/free-icons/folder" title="folder icons">Folder icons created by kmg design - Flaticon</a>-->
|
<!--<a href="https://www.flaticon.com/free-icons/folder" title="folder icons">Folder icons created by kmg design - Flaticon</a>-->
|
||||||
<!--<a href="https://www.flaticon.com/free-icons/water-meter" title="water meter icons">Water meter icons created by Umeicon - Flaticon</a>-->
|
<!--<a href="https://www.flaticon.com/free-icons/water-meter" title="water meter icons">Water meter icons created by Umeicon - Flaticon</a>-->
|
||||||
<!--<a href="https://www.flaticon.com/free-icons/settings" title="settings icons">Settings icons created by Freepik - Flaticon</a>-->
|
<!--<a href="https://www.flaticon.com/free-icons/settings" title="settings icons">Settings icons created by Freepik - Flaticon</a>-->
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
public static event Action Disposed;
|
public static event Action Disposed;
|
||||||
|
|
||||||
|
public static void Invoke(Action action)
|
||||||
|
=> Current.Dispatcher.Invoke(action, DispatcherPriority.ApplicationIdle);
|
||||||
|
|
||||||
public static void BeginInvoke(Action action)
|
public static void BeginInvoke(Action action)
|
||||||
=> Current.Dispatcher.BeginInvoke(action, DispatcherPriority.ApplicationIdle);
|
=> Current.Dispatcher.BeginInvoke(action, DispatcherPriority.ApplicationIdle);
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,9 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.configuration" />
|
<Reference Include="System.configuration" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
@@ -84,9 +87,6 @@
|
|||||||
<Compile Include="Views\Content\ExchangeHub.xaml.cs">
|
<Compile Include="Views\Content\ExchangeHub.xaml.cs">
|
||||||
<DependentUpon>ExchangeHub.xaml</DependentUpon>
|
<DependentUpon>ExchangeHub.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\Content\SettingsContent.xaml.cs">
|
|
||||||
<DependentUpon>SettingsContent.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Views\Options\COMOption.xaml.cs">
|
<Compile Include="Views\Options\COMOption.xaml.cs">
|
||||||
<DependentUpon>COMOption.xaml</DependentUpon>
|
<DependentUpon>COMOption.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -117,10 +117,6 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\Content\SettingsContent.xaml">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
</Page>
|
|
||||||
<Page Include="Views\Options\COMOption.xaml">
|
<Page Include="Views\Options\COMOption.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@@ -149,6 +145,7 @@
|
|||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
|||||||
@@ -8,12 +8,5 @@
|
|||||||
|
|
||||||
protected void NotifyPropertyChanged(string property)
|
protected void NotifyPropertyChanged(string property)
|
||||||
=> this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
|
=> this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
|
||||||
|
|
||||||
protected void Set<T>(ref T property, T value, string propertyName)
|
|
||||||
{
|
|
||||||
property = value;
|
|
||||||
|
|
||||||
this.NotifyPropertyChanged(propertyName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,10 +16,11 @@
|
|||||||
|
|
||||||
public class COMContentVM : ContentVM
|
public class COMContentVM : ContentVM
|
||||||
{
|
{
|
||||||
private OmniPlusConnection connection;
|
|
||||||
private readonly Dictionary<OmniPlusTestPoint, OmniPlusTest> results
|
private readonly Dictionary<OmniPlusTestPoint, OmniPlusTest> results
|
||||||
= new Dictionary<OmniPlusTestPoint, OmniPlusTest>();
|
= new Dictionary<OmniPlusTestPoint, OmniPlusTest>();
|
||||||
|
|
||||||
|
private OmniPlusConnection connection;
|
||||||
|
|
||||||
public COMContentVM() : base()
|
public COMContentVM() : base()
|
||||||
{
|
{
|
||||||
this.Meter = new OMNIPlusVM();
|
this.Meter = new OMNIPlusVM();
|
||||||
@@ -106,19 +109,19 @@
|
|||||||
this.portName = value;
|
this.portName = value;
|
||||||
this.connection = new OmniPlusConnection(value);
|
this.connection = new OmniPlusConnection(value);
|
||||||
|
|
||||||
this.NotifyPropertyChanged(nameof(this.Nr));
|
this.NotifyPropertyChanged(nameof(this.PortName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool exists;
|
private string testResults;
|
||||||
public bool Exists
|
public string TestResults
|
||||||
{
|
{
|
||||||
get => this.exists;
|
get => this.testResults;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
this.exists = value;
|
this.testResults = value;
|
||||||
|
|
||||||
this.NotifyPropertyChanged(nameof(this.Exists));
|
this.NotifyPropertyChanged(nameof(this.TestResults));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,32 +136,58 @@
|
|||||||
this.Running = false;
|
this.Running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Task PrepareConnectionTask(CancellationToken cancelationToken)
|
internal void InitializeAsync()
|
||||||
{
|
{
|
||||||
cancelationToken.Register(this.Dispose);
|
this.results.Clear();
|
||||||
|
|
||||||
void PrepareConnection()
|
this.Header = $"{this.PortName}";
|
||||||
|
this.State = this.Header;
|
||||||
|
|
||||||
|
this.State = $"{this.Header} - wird ermittelt ...";
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
this.Progress = 0;
|
this.Connected = this.connection.Connected;
|
||||||
|
|
||||||
if (!this.Connected)
|
if (!this.Connected)
|
||||||
{
|
{
|
||||||
|
Thread.Sleep(2000);
|
||||||
|
|
||||||
this.Connected = this.connection.ConnectIrda();
|
this.Connected = this.connection.ConnectIrda();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Running = this.Connected;
|
if (this.Connected)
|
||||||
|
|
||||||
if (this.Running)
|
|
||||||
{
|
{
|
||||||
this.State = $"Vorbereitung läuft ...";
|
this.State = "Mit IRDA verbunden";
|
||||||
|
|
||||||
|
this.Meter.SystemParameters = this.connection.ViewSystemParameters();
|
||||||
|
this.Header = this.Meter.SystemParameters.BuildInfo;
|
||||||
|
this.Running = this.Meter.SystemParameters.IsValid;
|
||||||
|
|
||||||
|
if (this.Running)
|
||||||
|
{
|
||||||
|
this.State = this.Meter.SystemParameters.BuildInfo;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.State = $"({this.PortName} - fehler!)";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.State = $"{this.PortName} ist getrennt";
|
this.connection.Disconnect();
|
||||||
|
|
||||||
|
this.Header = $"({this.PortName} - nicht verbunden!)";
|
||||||
|
this.State = this.Header;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
return Task.Factory.StartNew(PrepareConnection, cancelationToken);
|
{
|
||||||
|
this.connection.Disconnect();
|
||||||
|
this.Meter.Error = e.Message;
|
||||||
|
this.Header = $"({this.PortName} - nicht vorhanden!)";
|
||||||
|
this.State = this.Header;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Task ReadSystemParametersTask(CancellationToken cancelationToken)
|
internal Task ReadSystemParametersTask(CancellationToken cancelationToken)
|
||||||
@@ -315,6 +344,61 @@
|
|||||||
return Task.Factory.StartNew(InspectPP, cancelationToken);
|
return Task.Factory.StartNew(InspectPP, cancelationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void SaveInspection()
|
||||||
|
{
|
||||||
|
if (!this.Running)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var resultsBuilder = new StringBuilder();
|
||||||
|
var correctionFactor = this.GetCorrectionFactor();
|
||||||
|
|
||||||
|
resultsBuilder.AppendLine($"GPM\t"
|
||||||
|
+ $"m³/h\t"
|
||||||
|
+ $"ml/R\t"
|
||||||
|
+ $"R(soll)\t"
|
||||||
|
+ $"R(ist)\t"
|
||||||
|
+ $"T(soll)\t"
|
||||||
|
+ $"T(ist)\t"
|
||||||
|
+ $"m³(ist)\t"
|
||||||
|
+ $"Diff %\t"
|
||||||
|
+ $"Factor %\t"
|
||||||
|
+ $"Min\t"
|
||||||
|
+ $"Max\t");
|
||||||
|
|
||||||
|
foreach (var kvp in this.results)
|
||||||
|
{
|
||||||
|
var pruefpunkt = kvp.Key;
|
||||||
|
var ergebnis = kvp.Value;
|
||||||
|
|
||||||
|
resultsBuilder.AppendLine($"{pruefpunkt.GalPerMin:0.00}\t"
|
||||||
|
+ $"{pruefpunkt.VolumeM3H:0.00}\t"
|
||||||
|
+ $"{pruefpunkt.MlPerRotation:0.00}\t"
|
||||||
|
+ $"{pruefpunkt.Rotations}\t"
|
||||||
|
+ $"{ergebnis.Rotations}\t"
|
||||||
|
+ $"{pruefpunkt.Duration}\t"
|
||||||
|
+ $"{ergebnis.Duration}\t"
|
||||||
|
+ $"{ergebnis.VolumeMessured}\t"
|
||||||
|
+ $"{ergebnis.DifferencePercentage:0.00}%\t"
|
||||||
|
+ $"{correctionFactor:0.00}%\t"
|
||||||
|
+ $"{pruefpunkt.MinDiff:0.00}\t"
|
||||||
|
+ $"{pruefpunkt.MaxDiff:0.00}\t");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.TestResults = resultsBuilder.ToString();
|
||||||
|
|
||||||
|
// TODO: Log for instance in databse table.
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.WriteAllText($"{this.Meter.SystemParameters.BuildInfo}_{DateTime.Now:yyyyMMddHHmmss}.csv", this.TestResults);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal Task StopPPCalibrationTask(OmniPlusTestPoint pp, CancellationToken cancellationToken)
|
internal Task StopPPCalibrationTask(OmniPlusTestPoint pp, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
cancellationToken.Register(this.Dispose);
|
cancellationToken.Register(this.Dispose);
|
||||||
@@ -326,6 +410,8 @@
|
|||||||
var calibrationResult = connection.ViewChamberCalibration();
|
var calibrationResult = connection.ViewChamberCalibration();
|
||||||
this.results[pp].Rotations = calibrationResult.Rotations;
|
this.results[pp].Rotations = calibrationResult.Rotations;
|
||||||
this.results[pp].Duration = calibrationResult.Duration;
|
this.results[pp].Duration = calibrationResult.Duration;
|
||||||
|
this.results[pp].VolumeMessured = pp.VolumeM3(this.results[pp]);
|
||||||
|
|
||||||
this.Running = calibrationResult.Succeeded && calibrationResult.Control == ChamberCalibrationResponse.TEST_COMPLETED;
|
this.Running = calibrationResult.Succeeded && calibrationResult.Control == ChamberCalibrationResponse.TEST_COMPLETED;
|
||||||
|
|
||||||
if (this.Running)
|
if (this.Running)
|
||||||
@@ -334,7 +420,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.State = $"PP {pp.Rotations}/{pp.Duration} (rotations/seconds) fehlgeschlagen: {(int)calibrationResult.Status} - {calibrationResult.Status}";
|
this.State = $"PP {pp.Rotations}/{pp.Duration} fehlgeschlagen: {(int)calibrationResult.Control} - {calibrationResult.Control}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.IO.Ports;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -39,7 +37,6 @@
|
|||||||
this.CanStart = true;
|
this.CanStart = true;
|
||||||
this.Option = new EOLOptionVM(this);
|
this.Option = new EOLOptionVM(this);
|
||||||
this.Option.OptionSelected += this.NotifyOptionSelected;
|
this.Option.OptionSelected += this.NotifyOptionSelected;
|
||||||
this.Coms = new ObservableCollection<string>();
|
|
||||||
this.omnisettings = new EOLSettings();
|
this.omnisettings = new EOLSettings();
|
||||||
this.hubsettings = new ExchangeHubSettings();
|
this.hubsettings = new ExchangeHubSettings();
|
||||||
this.OmniDefaults = new OmniPlusType();
|
this.OmniDefaults = new OmniPlusType();
|
||||||
@@ -48,6 +45,7 @@
|
|||||||
this.dbcontext = new OmniPlusDatabase(this.omnisettings.OmniDB);
|
this.dbcontext = new OmniPlusDatabase(this.omnisettings.OmniDB);
|
||||||
this.signalR = new ExchangeConnection();
|
this.signalR = new ExchangeConnection();
|
||||||
this.signalR.OutputDir = this.hubsettings.ExchangeHubOutputDir;
|
this.signalR.OutputDir = this.hubsettings.ExchangeHubOutputDir;
|
||||||
|
this.signalR.Connect(this.hubsettings.ExchangeHubURL);
|
||||||
|
|
||||||
this.LoadComPorts = new Command(this.InitializeComPorts);
|
this.LoadComPorts = new Command(this.InitializeComPorts);
|
||||||
this.CancelInspection = new Command(this.CancelInspectionHandler);
|
this.CancelInspection = new Command(this.CancelInspectionHandler);
|
||||||
@@ -55,6 +53,29 @@
|
|||||||
|
|
||||||
this.InitializeComPorts();
|
this.InitializeComPorts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Type
|
||||||
|
{
|
||||||
|
get => this.hubsettings[nameof(this.Type)];
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.hubsettings[nameof(this.Type)] = value;
|
||||||
|
|
||||||
|
this.NotifyPropertyChanged(nameof(this.Type));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string text;
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
get => this.text;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.text = value;
|
||||||
|
|
||||||
|
this.NotifyPropertyChanged(nameof(this.Text));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private string error;
|
private string error;
|
||||||
public string Error
|
public string Error
|
||||||
@@ -128,7 +149,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Line => line;
|
public String Line => line;
|
||||||
|
|
||||||
public ICommand LoadComPorts { get; }
|
public ICommand LoadComPorts { get; }
|
||||||
|
|
||||||
@@ -136,17 +157,18 @@
|
|||||||
|
|
||||||
public ICommand StartInspection { get; }
|
public ICommand StartInspection { get; }
|
||||||
|
|
||||||
public ObservableCollection<string> Coms { get; }
|
|
||||||
|
|
||||||
private void InitializeComPorts()
|
private void InitializeComPorts()
|
||||||
{
|
{
|
||||||
this.Coms.Clear();
|
foreach (var disposable in this.Nodes.Cast<IDisposable>())
|
||||||
|
{
|
||||||
|
disposable.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
this.Nodes.Clear();
|
this.Nodes.Clear();
|
||||||
this.Option.Clear();
|
this.Option.Clear();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var existingComPorts = SerialPort.GetPortNames();
|
|
||||||
var placeNr = 1;
|
var placeNr = 1;
|
||||||
|
|
||||||
foreach (var com in this.omnisettings.COMPorts)
|
foreach (var com in this.omnisettings.COMPorts)
|
||||||
@@ -155,106 +177,86 @@
|
|||||||
comVM.ContentSelected += this.NotifyCotnentSelected;
|
comVM.ContentSelected += this.NotifyCotnentSelected;
|
||||||
comVM.PortName = com;
|
comVM.PortName = com;
|
||||||
comVM.Nr = placeNr++;
|
comVM.Nr = placeNr++;
|
||||||
comVM.Exists = existingComPorts.Any(x => x.Equals(com, StringComparison.OrdinalIgnoreCase));
|
comVM.Header = $"{com}";
|
||||||
comVM.Header = comVM.Exists ? $"({com})" : $"({com} - nicht vorhanden)";
|
comVM.State = $"{com}";
|
||||||
comVM.State = comVM.Header;
|
comVM.InitializeAsync();
|
||||||
|
|
||||||
this.Coms.Add(com);
|
|
||||||
this.Nodes.Add(comVM);
|
this.Nodes.Add(comVM);
|
||||||
this.Option.Add(comVM.Option);
|
this.Option.Add(comVM.Option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.Text = $"ME OMNI 1.5-2\" {this.Type}";
|
||||||
|
this.Option.SetIndentation(this.Option.Indent);
|
||||||
|
this.dbcontext.LoadOmniDefaults(6, this.Type, this.OmniDefaults);
|
||||||
|
this.NotifyPropertyChanged(nameof(this.OmniDefaults));
|
||||||
|
this.NotifyPropertyChanged(nameof(this.Nodes));
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
this.Error = e.ToString();
|
this.Error = e.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Option.SetIndentation(this.Option.Indent);
|
|
||||||
|
|
||||||
this.CanStart = true;
|
|
||||||
this.CanStop = false;
|
this.CanStop = false;
|
||||||
this.State = default(string);
|
this.CanStart = true;
|
||||||
this.Error = default(string);
|
this.Error = default(string);
|
||||||
|
this.State = default(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CancelInspectionHandler()
|
private void CancelInspectionHandler()
|
||||||
{
|
{
|
||||||
this.Error = "Warte bis abbruch abgeschlossen ...";
|
this.CanStop = false;
|
||||||
this.State = default(string);
|
this.CanStart = false;
|
||||||
|
this.Error = default(string);
|
||||||
|
this.State = "Warte bis abbruch abgeschlossen ...";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.manualResetEventSlim?.Set();
|
this.manualResetEventSlim?.Set();
|
||||||
this.cancellationTokenSource?.Cancel();
|
this.cancellationTokenSource?.Cancel();
|
||||||
this.tasks.Clear();
|
this.tasks.Clear();
|
||||||
|
this.Dispose();
|
||||||
|
|
||||||
this.Error = "Vorgang wurde abbgebrochen!";
|
this.State = "Vorgang wurde abbgebrochen!";
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
this.Error = e.ToString();
|
this.Error = e.ToString();
|
||||||
|
this.State = default(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
var availableIn = this.AvailableIn;
|
|
||||||
|
|
||||||
Task.Factory.StartNew(() =>
|
Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
if (availableIn > 0)
|
this.CanStart = false;
|
||||||
{
|
|
||||||
this.CanStart = false;
|
|
||||||
this.manualResetEventSlim = new ManualResetEventSlim();
|
|
||||||
this.timer = new TimersTimer(1000)
|
|
||||||
{
|
|
||||||
AutoReset = true,
|
|
||||||
Enabled = true
|
|
||||||
};
|
|
||||||
this.WaitUntil(availableIn, true);
|
|
||||||
this.AvailableIn = 0;
|
|
||||||
this.CanStart = true;
|
|
||||||
|
|
||||||
availableIn = 0;
|
if (this.AvailableIn > 0)
|
||||||
|
{
|
||||||
|
this.WaitUntil(this.AvailableIn, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.CanStart = true;
|
||||||
this.Error = default(string);
|
this.Error = default(string);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.CanStop = false;
|
|
||||||
this.CanStart = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartInspectionHandler()
|
private void StartInspectionHandler()
|
||||||
{
|
{
|
||||||
|
this.CanStop = true;
|
||||||
|
this.CanStart = false;
|
||||||
|
|
||||||
this.cancellationTokenSource = new CancellationTokenSource();
|
this.cancellationTokenSource = new CancellationTokenSource();
|
||||||
this.cancellationToken = this.cancellationTokenSource.Token;
|
this.cancellationToken = this.cancellationTokenSource.Token;
|
||||||
this.manualResetEventSlim = new ManualResetEventSlim();
|
|
||||||
this.timer = new TimersTimer(1000)
|
|
||||||
{
|
|
||||||
AutoReset = true,
|
|
||||||
Enabled = true
|
|
||||||
};
|
|
||||||
|
|
||||||
this.dbcontext.LoadOmniDefaults(6, "T2", this.OmniDefaults);
|
|
||||||
this.NotifyPropertyChanged(nameof(this.OmniDefaults));
|
|
||||||
this.signalR.Connect(this.hubsettings.ExchangeHubURL);
|
|
||||||
this.InitializeComPorts();
|
|
||||||
|
|
||||||
Task.Factory.StartNew(() =>
|
Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
var coms = this.Nodes.Cast<COMContentVM>();
|
var coms = this.Nodes.Cast<COMContentVM>();
|
||||||
|
|
||||||
foreach (var comVM in coms)
|
//foreach (var comVM in coms)
|
||||||
{
|
//{
|
||||||
this.tasks.Add(comVM.PrepareConnectionTask(this.cancellationToken));
|
// this.tasks.Add(comVM.ReadSystemParametersTask(this.cancellationToken));
|
||||||
}
|
//}
|
||||||
|
|
||||||
this.ContinueWhenAll();
|
//this.ContinueWhenAll();
|
||||||
|
|
||||||
foreach (var comVM in coms)
|
|
||||||
{
|
|
||||||
this.tasks.Add(comVM.ReadSystemParametersTask(this.cancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.ContinueWhenAll();
|
|
||||||
|
|
||||||
foreach (var comVM in coms)
|
foreach (var comVM in coms)
|
||||||
{
|
{
|
||||||
@@ -269,9 +271,16 @@
|
|||||||
|
|
||||||
foreach (var pp in this.OmniDefaults.TestPoints)
|
foreach (var pp in this.OmniDefaults.TestPoints)
|
||||||
{
|
{
|
||||||
|
if (coms.All(x => !x.Running))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
var rotations = pp.Rotations;
|
var rotations = pp.Rotations;
|
||||||
var duration = pp.Duration;
|
var duration = pp.Duration;
|
||||||
|
|
||||||
|
this.SetFlow(pp.VolumeM3H);
|
||||||
|
|
||||||
foreach (var comVM in coms)
|
foreach (var comVM in coms)
|
||||||
{
|
{
|
||||||
this.tasks.Add(comVM.StartPPCalibrationTask(pp, this.cancellationToken));
|
this.tasks.Add(comVM.StartPPCalibrationTask(pp, this.cancellationToken));
|
||||||
@@ -279,7 +288,7 @@
|
|||||||
|
|
||||||
this.ContinueWhenAll();
|
this.ContinueWhenAll();
|
||||||
|
|
||||||
this.signalR.NotifyStartRef(duration);
|
this.StartRZ(duration);
|
||||||
this.WaitUntil((int)(duration * 1.2), true, false);
|
this.WaitUntil((int)(duration * 1.2), true, false);
|
||||||
|
|
||||||
if (this.manualResetEventSlim.IsSet)
|
if (this.manualResetEventSlim.IsSet)
|
||||||
@@ -287,7 +296,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var referenceV = this.GetReferenceVolume();
|
var referenceV = this.GetRZVolume();
|
||||||
|
|
||||||
foreach (var comVM in coms)
|
foreach (var comVM in coms)
|
||||||
{
|
{
|
||||||
@@ -296,6 +305,11 @@
|
|||||||
|
|
||||||
this.ContinueWhenAll();
|
this.ContinueWhenAll();
|
||||||
|
|
||||||
|
if (coms.All(x => !x.Running))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var comVM in coms)
|
foreach (var comVM in coms)
|
||||||
{
|
{
|
||||||
comVM.SetReferenceVolume(pp, referenceV);
|
comVM.SetReferenceVolume(pp, referenceV);
|
||||||
@@ -304,29 +318,53 @@
|
|||||||
|
|
||||||
foreach (var comVM in coms)
|
foreach (var comVM in coms)
|
||||||
{
|
{
|
||||||
comVM.GetCorrectionFactor();
|
comVM.SaveInspection();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var comVM in coms)
|
if (coms.All(x => x.Running))
|
||||||
{
|
{
|
||||||
comVM.Dispose();
|
foreach (var comVM in coms)
|
||||||
|
{
|
||||||
|
comVM.GetCorrectionFactor();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var comVM in coms)
|
||||||
|
{
|
||||||
|
comVM.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.CancelInspectionHandler();
|
this.CancelInspectionHandler();
|
||||||
|
this.signalR.NotifyStopRef();
|
||||||
|
this.signalR.NotifyStopQ();
|
||||||
this.signalR.Dispose();
|
this.signalR.Dispose();
|
||||||
|
|
||||||
}, this.cancellationToken);
|
}, this.cancellationToken);
|
||||||
|
|
||||||
this.CanStop = true;
|
|
||||||
this.CanStart = false;
|
|
||||||
this.Error = default(string);
|
|
||||||
this.State = default(string);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WaitUntil(int duration, bool show = false, bool error = true)
|
private void WaitUntil(int duration, bool show = false, bool error = true)
|
||||||
{
|
{
|
||||||
this.AvailableIn = duration;
|
this.AvailableIn = duration;
|
||||||
|
|
||||||
|
if (this.manualResetEventSlim != null)
|
||||||
|
{
|
||||||
|
this.manualResetEventSlim.Set();
|
||||||
|
this.manualResetEventSlim.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.manualResetEventSlim = new ManualResetEventSlim();
|
||||||
|
|
||||||
|
if (this.timer != null)
|
||||||
|
{
|
||||||
|
this.timer.Stop();
|
||||||
|
this.timer.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.timer = new TimersTimer(1000)
|
||||||
|
{
|
||||||
|
AutoReset = true,
|
||||||
|
Enabled = true
|
||||||
|
};
|
||||||
this.timer.Elapsed += (_1, _2) =>
|
this.timer.Elapsed += (_1, _2) =>
|
||||||
{
|
{
|
||||||
this.AvailableIn -= 1;
|
this.AvailableIn -= 1;
|
||||||
@@ -344,7 +382,14 @@
|
|||||||
this.State = $"Noch {this.AvailableIn} Sekunden verbleiben";
|
this.State = $"Noch {this.AvailableIn} Sekunden verbleiben";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.AvailableIn <= 0)
|
||||||
|
{
|
||||||
|
this.AvailableIn = 0;
|
||||||
|
this.manualResetEventSlim.Set();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.timer.Start();
|
this.timer.Start();
|
||||||
this.manualResetEventSlim.Wait(this.AvailableIn * 1000);
|
this.manualResetEventSlim.Wait(this.AvailableIn * 1000);
|
||||||
this.timer.Stop();
|
this.timer.Stop();
|
||||||
@@ -360,32 +405,88 @@
|
|||||||
|
|
||||||
this.tasks.Clear();
|
this.tasks.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
foreach (var comVM in this.Nodes.Cast<COMContentVM>())
|
foreach (var disposable in this.Nodes.Cast<IDisposable>())
|
||||||
{
|
{
|
||||||
comVM.Dispose();
|
disposable.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private double GetReferenceVolume()
|
private void SetFlow(double volumeM3H)
|
||||||
|
{
|
||||||
|
var received = false;
|
||||||
|
var volume = volumeM3H;
|
||||||
|
var timeout = 120; // seconds
|
||||||
|
|
||||||
|
void referenceVolumeReceived(double value)
|
||||||
|
{
|
||||||
|
received = true;
|
||||||
|
volume = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.signalR.StartQ += referenceVolumeReceived;
|
||||||
|
|
||||||
|
this.signalR.NotifyStartQ(volumeM3H);
|
||||||
|
|
||||||
|
this.State = "Warten auf Q(soll) ...";
|
||||||
|
|
||||||
|
while (!received && timeout > 0)
|
||||||
|
{
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
|
timeout--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StartRZ(int duration)
|
||||||
|
{
|
||||||
|
var received = false;
|
||||||
|
var reference = 0;
|
||||||
|
var timeout = 30; // seconds
|
||||||
|
|
||||||
|
void referenceVolumeReceived(int value)
|
||||||
|
{
|
||||||
|
received = true;
|
||||||
|
reference = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.signalR.StartRef += referenceVolumeReceived;
|
||||||
|
|
||||||
|
this.signalR.NotifyStartRef(duration);
|
||||||
|
|
||||||
|
this.State = "Warten bis RZ gestarted ...";
|
||||||
|
|
||||||
|
while (!received && timeout > 0)
|
||||||
|
{
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
|
timeout--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private double GetRZVolume()
|
||||||
{
|
{
|
||||||
var received = false;
|
var received = false;
|
||||||
var referenceV = 0D;
|
var referenceV = 0D;
|
||||||
var timeout = 10; // seconds
|
var timeout = 30; // seconds
|
||||||
|
|
||||||
void referenceVolumeReceived(double m3h)
|
void referenceVolumeReceived(double value)
|
||||||
{
|
{
|
||||||
received = true;
|
received = true;
|
||||||
referenceV = m3h;
|
referenceV = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.signalR.StopRef += referenceVolumeReceived;
|
this.signalR.StopRef += referenceVolumeReceived;
|
||||||
|
|
||||||
this.signalR.NotifyStopRef();
|
this.signalR.NotifyStopRef();
|
||||||
|
|
||||||
|
this.State = "Warten RZ Ergebnis ...";
|
||||||
|
|
||||||
while (!received && timeout > 0)
|
while (!received && timeout > 0)
|
||||||
{
|
{
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
|
|||||||
@@ -13,20 +13,15 @@
|
|||||||
this.ContentSelected += this.SetContentSelected;
|
this.ContentSelected += this.SetContentSelected;
|
||||||
this.Options = new ObservableCollection<OptionVM>();
|
this.Options = new ObservableCollection<OptionVM>();
|
||||||
|
|
||||||
var settingsContentVM = new SettingsContentVM();
|
|
||||||
settingsContentVM.ContentSelected += this.SetContentSelected;
|
|
||||||
|
|
||||||
var exchangeHubVM = new ExchangeHubContentVM();
|
var exchangeHubVM = new ExchangeHubContentVM();
|
||||||
exchangeHubVM.ContentSelected += this.SetContentSelected;
|
exchangeHubVM.ContentSelected += this.SetContentSelected;
|
||||||
|
|
||||||
var contentEOL = new EOLContentVM();
|
var contentEOL = new EOLContentVM();
|
||||||
contentEOL.ContentSelected += this.SetContentSelected;
|
contentEOL.ContentSelected += this.SetContentSelected;
|
||||||
|
|
||||||
this.Nodes.Add(settingsContentVM);
|
|
||||||
this.Nodes.Add(exchangeHubVM);
|
this.Nodes.Add(exchangeHubVM);
|
||||||
this.Nodes.Add(contentEOL);
|
this.Nodes.Add(contentEOL);
|
||||||
|
|
||||||
this.Options.Add(settingsContentVM.Option);
|
|
||||||
this.Options.Add(exchangeHubVM.Option);
|
this.Options.Add(exchangeHubVM.Option);
|
||||||
this.Options.Add(contentEOL.Option);
|
this.Options.Add(contentEOL.Option);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
|
|
||||||
public class ContentVM : NodeVM
|
public class ContentVM : NodeVM
|
||||||
{
|
{
|
||||||
|
public ContentVM() : base()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public virtual event Action<ContentVM> ContentSelected;
|
public virtual event Action<ContentVM> ContentSelected;
|
||||||
|
|
||||||
public OptionVM Option { get; protected set; }
|
public OptionVM Option { get; protected set; }
|
||||||
|
|||||||
@@ -41,5 +41,17 @@
|
|||||||
return dictionary;
|
return dictionary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string error;
|
||||||
|
public string Error
|
||||||
|
{
|
||||||
|
get => this.error;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.error = value;
|
||||||
|
|
||||||
|
this.NotifyPropertyChanged(nameof(this.Error));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
this.Reboots = this.parameters.RebootsCount;
|
this.Reboots = this.parameters.RebootsCount;
|
||||||
this.Version = this.parameters.VersionAndType.Value;
|
this.Version = this.parameters.VersionAndType.Value;
|
||||||
var voltage = Math.Max(this.parameters.BatteryVoltage.Volts, (ushort)1);
|
var voltage = Math.Max(this.parameters.BatteryVoltage.Volts, (ushort)1);
|
||||||
this.Voltage = (double)voltage / 1000D;
|
this.Voltage = voltage / 1000D;
|
||||||
this.ADCCounts = this.parameters.BatteryVoltage.ADCCount;
|
this.ADCCounts = this.parameters.BatteryVoltage.ADCCount;
|
||||||
this.Sealed = this.parameters.FactorySealed;
|
this.Sealed = this.parameters.FactorySealed;
|
||||||
this.IsValid = this.parameters.IsValid;
|
this.IsValid = this.parameters.IsValid;
|
||||||
|
|||||||
@@ -76,11 +76,15 @@
|
|||||||
public ObservableCollection<OptionVM> Options { get; }
|
public ObservableCollection<OptionVM> Options { get; }
|
||||||
= new ObservableCollection<OptionVM>();
|
= new ObservableCollection<OptionVM>();
|
||||||
|
|
||||||
internal void Add(OptionVM option)
|
internal void Add(OptionVM option)
|
||||||
=> this.Options.Add(option);
|
{
|
||||||
|
App.Invoke(() => this.Options.Add(option));
|
||||||
|
}
|
||||||
|
|
||||||
internal void Clear()
|
internal void Clear()
|
||||||
=> this.Options.Clear();
|
{
|
||||||
|
App.Invoke(() => this.Options.Clear());
|
||||||
|
}
|
||||||
|
|
||||||
internal void SetIndentation(int indent = INDENT)
|
internal void SetIndentation(int indent = INDENT)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,23 +6,40 @@
|
|||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
Background="White">
|
Background="White">
|
||||||
<ItemsControl ItemsSource="{Binding Meter.Properties}" FontFamily="Consolas">
|
<Grid>
|
||||||
<ItemsControl.ItemTemplate>
|
<Grid.RowDefinitions>
|
||||||
<DataTemplate>
|
<RowDefinition Height="Auto" />
|
||||||
<StackPanel Orientation="Vertical">
|
<RowDefinition Height="Auto" />
|
||||||
<Label Content="{Binding Path=Key}" Padding="21, 3" FontWeight="Bold"/>
|
<RowDefinition Height="Auto" />
|
||||||
<ItemsControl ItemsSource="{Binding Path=Value}">
|
</Grid.RowDefinitions>
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl ItemsSource="{Binding Meter.Properties}" FontFamily="Consolas">
|
||||||
<DataTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<StackPanel Orientation="Horizontal">
|
<DataTemplate>
|
||||||
<Label Content="{Binding Path=Key}" Padding="42, 3, 2, 3" Width="200" FontWeight="Bold"/>
|
<StackPanel Orientation="Vertical">
|
||||||
<Label Content="{Binding Path=Value}" Padding="3"/>
|
<Label Content="{Binding Path=Key}" Padding="21, 3" FontWeight="Bold"/>
|
||||||
</StackPanel>
|
<ItemsControl ItemsSource="{Binding Path=Value}">
|
||||||
</DataTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
<DataTemplate>
|
||||||
</ItemsControl>
|
<StackPanel Orientation="Horizontal">
|
||||||
</StackPanel>
|
<Label Content="{Binding Path=Key}" Padding="42, 3, 2, 3" Width="200" FontWeight="Bold"/>
|
||||||
</DataTemplate>
|
<Label Content="{Binding Path=Value}" Padding="3"/>
|
||||||
</ItemsControl.ItemTemplate>
|
</StackPanel>
|
||||||
</ItemsControl>
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
<TextBlock Grid.Row="1"
|
||||||
|
Margin="13"
|
||||||
|
FontFamily="Consolas"
|
||||||
|
TextAlignment="Left"
|
||||||
|
Text="{Binding TestResults}" />
|
||||||
|
<TextBlock Grid.Row="2"
|
||||||
|
Margin="13"
|
||||||
|
FontFamily="Consolas"
|
||||||
|
TextAlignment="Left"
|
||||||
|
Text="{Binding Error}" />
|
||||||
|
</Grid>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
<RowDefinition Height="Auto" /> <!-- Kurztext:-->
|
<RowDefinition Height="Auto" /> <!-- Kurztext:-->
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Label Grid.Column="0" Grid.Row="0" Content="Auftragskarte" Margin="0" Padding="0" FontWeight="Bold" FontSize="14" Grid.ColumnSpan="5" />
|
<Label Grid.Column="0" Grid.Row="0" Content="Auftragskarte" Margin="0" Padding="0" FontWeight="Bold" FontSize="14" Grid.ColumnSpan="5" />
|
||||||
@@ -40,10 +41,16 @@
|
|||||||
|
|
||||||
<Label Grid.Column="0" Grid.Row="2" Content="AuftragNr:" HorizontalContentAlignment="Left" FontWeight="Bold" Margin="0" Padding="0, 5, 0, 0" />
|
<Label Grid.Column="0" Grid.Row="2" Content="AuftragNr:" HorizontalContentAlignment="Left" FontWeight="Bold" Margin="0" Padding="0, 5, 0, 0" />
|
||||||
<Label Grid.Column="0" Grid.Row="3" Content="Kd.AuftragNr:" HorizontalContentAlignment="Left" FontWeight="Bold" Margin="0" Padding="0, 5, 0, 0" />
|
<Label Grid.Column="0" Grid.Row="3" Content="Kd.AuftragNr:" HorizontalContentAlignment="Left" FontWeight="Bold" Margin="0" Padding="0, 5, 0, 0" />
|
||||||
<Label Grid.Column="0" Grid.Row="4" Content="PsNr:" HorizontalContentAlignment="Left" FontWeight="Bold" Margin="0" Padding="0, 5, 0, 0" />
|
<Label Grid.Column="0" Grid.Row="4" Content="PosNr:" HorizontalContentAlignment="Left" FontWeight="Bold" Margin="0" Padding="0, 5, 0, 0" />
|
||||||
<Label Grid.Column="0" Grid.Row="5" Content="IdentNr:" HorizontalContentAlignment="Left" FontWeight="Bold" Margin="0" Padding="0, 5, 0, 0" />
|
<Label Grid.Column="0" Grid.Row="5" Content="IdentNr:" HorizontalContentAlignment="Left" FontWeight="Bold" Margin="0" Padding="0, 5, 0, 0" />
|
||||||
<Label Grid.Column="0" Grid.Row="6" Content="Kurztext:" HorizontalContentAlignment="Left" FontWeight="Bold" Margin="0" Padding="0, 5, 0, 0" />
|
<Label Grid.Column="0" Grid.Row="6" Content="Kurztext:" HorizontalContentAlignment="Left" FontWeight="Bold" Margin="0" Padding="0, 5, 0, 0" />
|
||||||
|
|
||||||
|
<Label Grid.Column="1" Grid.Row="2" Content="3221652" HorizontalContentAlignment="Left" Margin="0" Padding="21, 5, 0, 0" />
|
||||||
|
<Label Grid.Column="1" Grid.Row="3" Content="71156877" HorizontalContentAlignment="Left" Margin="0" Padding="21, 5, 0, 0" />
|
||||||
|
<Label Grid.Column="1" Grid.Row="4" Content="30" HorizontalContentAlignment="Left" Margin="0" Padding="21, 5, 0, 0" />
|
||||||
|
<Label Grid.Column="1" Grid.Row="5" Content="96011428" HorizontalContentAlignment="Left" Margin="0" Padding="21, 5, 0, 0" />
|
||||||
|
<Label Grid.Column="1" Grid.Row="6" Content="{Binding Text}" HorizontalContentAlignment="Left" Margin="0" Padding="21, 5, 0, 0" />
|
||||||
|
|
||||||
<Label Grid.Column="2" Grid.Row="2" Content="Prüfpunkte" HorizontalContentAlignment="Left" FontWeight="Bold" Margin="0" Padding="0, 5, 21, 0"/>
|
<Label Grid.Column="2" Grid.Row="2" Content="Prüfpunkte" HorizontalContentAlignment="Left" FontWeight="Bold" Margin="0" Padding="0, 5, 21, 0"/>
|
||||||
<Label Grid.Column="3" Grid.Row="2" Content="Toleranzen" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" FontWeight="Bold" Margin="0" Padding="0, 5, 0, 0" />
|
<Label Grid.Column="3" Grid.Row="2" Content="Toleranzen" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" FontWeight="Bold" Margin="0" Padding="0, 5, 0, 0" />
|
||||||
|
|
||||||
@@ -55,18 +62,21 @@
|
|||||||
<Label Grid.Column="2" Grid.Row="5" Content="{Binding OmniDefaults.TestPoints[1].VolumeM3H}" ContentStringFormat="{}{0:0.00} m³/h" HorizontalContentAlignment="Right" FontWeight="Bold" Margin="0" Padding="0, 5, 21, 0"/>
|
<Label Grid.Column="2" Grid.Row="5" Content="{Binding OmniDefaults.TestPoints[1].VolumeM3H}" ContentStringFormat="{}{0:0.00} m³/h" HorizontalContentAlignment="Right" FontWeight="Bold" Margin="0" Padding="0, 5, 21, 0"/>
|
||||||
<Label Grid.Column="2" Grid.Row="6" Content="{Binding OmniDefaults.TestPoints[2].VolumeM3H}" ContentStringFormat="{}{0:0.00} m³/h" HorizontalContentAlignment="Right" FontWeight="Bold" Margin="0" Padding="0, 5, 21, 0"/>
|
<Label Grid.Column="2" Grid.Row="6" Content="{Binding OmniDefaults.TestPoints[2].VolumeM3H}" ContentStringFormat="{}{0:0.00} m³/h" HorizontalContentAlignment="Right" FontWeight="Bold" Margin="0" Padding="0, 5, 21, 0"/>
|
||||||
|
|
||||||
<Label Grid.Column="3" Grid.Row="4" Content="{Binding OmniDefaults.TestPoints[0].MinDiff}" ContentStringFormat="{}{0:0.00} %" HorizontalContentAlignment="Right" Margin="0" Padding="0, 5, 21, 0" Foreground="DimGray" />
|
<Label Grid.Column="3" Grid.Row="4" Content="{Binding OmniDefaults.TestPoints[0].MinDiff}" ContentStringFormat="{}{0:0.00} %" HorizontalContentAlignment="Right" Margin="0" Padding="0, 5, 21, 0" />
|
||||||
<Label Grid.Column="3" Grid.Row="5" Content="{Binding OmniDefaults.TestPoints[1].MinDiff}" ContentStringFormat="{}{0:0.00} %" HorizontalContentAlignment="Right" Margin="0" Padding="0, 5, 21, 0" Foreground="DimGray" />
|
<Label Grid.Column="3" Grid.Row="5" Content="{Binding OmniDefaults.TestPoints[1].MinDiff}" ContentStringFormat="{}{0:0.00} %" HorizontalContentAlignment="Right" Margin="0" Padding="0, 5, 21, 0" />
|
||||||
<Label Grid.Column="3" Grid.Row="6" Content="{Binding OmniDefaults.TestPoints[2].MinDiff}" ContentStringFormat="{}{0:0.00} %" HorizontalContentAlignment="Right" Margin="0" Padding="0, 5, 21, 0" Foreground="DimGray" />
|
<Label Grid.Column="3" Grid.Row="6" Content="{Binding OmniDefaults.TestPoints[2].MinDiff}" ContentStringFormat="{}{0:0.00} %" HorizontalContentAlignment="Right" Margin="0" Padding="0, 5, 21, 0" />
|
||||||
|
|
||||||
<Label Grid.Column="4" Grid.Row="4" Content="{Binding OmniDefaults.TestPoints[0].MaxDiff}" ContentStringFormat="{}{0:0.00} %" HorizontalContentAlignment="Right" Margin="0" Padding="0, 5, 0, 0" Foreground="DimGray" />
|
<Label Grid.Column="4" Grid.Row="4" Content="{Binding OmniDefaults.TestPoints[0].MaxDiff}" ContentStringFormat="{}{0:0.00} %" HorizontalContentAlignment="Right" Margin="0" Padding="0, 5, 0, 0" />
|
||||||
<Label Grid.Column="4" Grid.Row="5" Content="{Binding OmniDefaults.TestPoints[1].MaxDiff}" ContentStringFormat="{}{0:0.00} %" HorizontalContentAlignment="Right" Margin="0" Padding="0, 5, 0, 0" Foreground="DimGray" />
|
<Label Grid.Column="4" Grid.Row="5" Content="{Binding OmniDefaults.TestPoints[1].MaxDiff}" ContentStringFormat="{}{0:0.00} %" HorizontalContentAlignment="Right" Margin="0" Padding="0, 5, 0, 0" />
|
||||||
<Label Grid.Column="4" Grid.Row="6" Content="{Binding OmniDefaults.TestPoints[2].MaxDiff}" ContentStringFormat="{}{0:0.00} %" HorizontalContentAlignment="Right" Margin="0" Padding="0, 5, 0, 0" Foreground="DimGray" />
|
<Label Grid.Column="4" Grid.Row="6" Content="{Binding OmniDefaults.TestPoints[2].MaxDiff}" ContentStringFormat="{}{0:0.00} %" HorizontalContentAlignment="Right" Margin="0" Padding="0, 5, 0, 0" />
|
||||||
|
|
||||||
<Label Grid.Column="0" Grid.Row="7" Content="{Binding Line}" Margin="0" Padding="0" FontWeight="Bold" Grid.ColumnSpan="5" />
|
<Label Grid.Column="0" Grid.Row="7" Content="{Binding Line}" Margin="0" Padding="0" FontWeight="Bold" Grid.ColumnSpan="5" />
|
||||||
|
|
||||||
<Label Grid.Column="0" Grid.Row="8" Content="{Binding State}" Margin="0" Padding="0, 3" Grid.ColumnSpan="5" FontWeight="Bold" />
|
<Label Grid.Column="0" Grid.Row="8" Content="{Binding State}" Margin="0" Padding="0, 3" Grid.ColumnSpan="5" FontWeight="Bold" Background="Transparent"/>
|
||||||
<Label Grid.Column="0" Grid.Row="8" Content="{Binding Error}" Margin="0" Padding="0, 3" Grid.ColumnSpan="5" FontWeight="Bold" Foreground="{StaticResource Red}" />
|
<Label Grid.Column="0" Grid.Row="8" Content="{Binding Error}" Margin="0" Padding="0, 3" Grid.ColumnSpan="5" FontWeight="Bold" Background="Transparent" Foreground="{StaticResource Red}" />
|
||||||
|
|
||||||
|
<Label Grid.Column="0" Grid.Row="9" Content="Type eingeben: " VerticalContentAlignment="Center" VerticalAlignment="Stretch"/>
|
||||||
|
<TextBox Grid.Column="1" Grid.Row="9" Text="{Binding Type}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<ItemsControl Grid.Row="1"
|
<ItemsControl Grid.Row="1"
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
<ItemsControl x:Class="OMNIPruefung.Views.Content.SettingsContent"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:VM="clr-namespace:OMNIPruefung.ViewModels.Content"
|
|
||||||
ItemsSource="{Binding Settings}"
|
|
||||||
Margin="13">
|
|
||||||
<ItemsControl.ItemTemplate>
|
|
||||||
<DataTemplate DataType="{x:Type VM:SettingsContentVM}">
|
|
||||||
<StackPanel Orientation="Vertical" Margin="0, 0, 0, 10">
|
|
||||||
<Label Content="{Binding Key}" />
|
|
||||||
<TextBox Text="{Binding Value}" />
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
</ItemsControl.ItemTemplate>
|
|
||||||
</ItemsControl>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
namespace OMNIPruefung.Views.Content
|
|
||||||
{
|
|
||||||
using System.Windows.Controls;
|
|
||||||
|
|
||||||
public partial class SettingsContent : ItemsControl
|
|
||||||
{
|
|
||||||
public SettingsContent()
|
|
||||||
{
|
|
||||||
this.InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net40" />
|
||||||
|
</packages>
|
||||||
@@ -2,8 +2,10 @@
|
|||||||
using OmniPlus.Hanlers;
|
using OmniPlus.Hanlers;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.IO.Ports;
|
using System.IO.Ports;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OmniPlus
|
namespace OmniPlus
|
||||||
{
|
{
|
||||||
@@ -21,6 +23,42 @@ namespace OmniPlus
|
|||||||
this.Options.LogFile = $".\\IRDA\\[{portName}].txt";
|
this.Options.LogFile = $".\\IRDA\\[{portName}].txt";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Byte[] Send(params Byte[] request)
|
||||||
|
{
|
||||||
|
this.InvokeLogMessage(">>> PLAIN" + BitConverter.ToString(request));
|
||||||
|
|
||||||
|
if (!this.IsOpen)
|
||||||
|
{
|
||||||
|
this.OpenII();
|
||||||
|
}
|
||||||
|
|
||||||
|
var response = new Byte[] { };
|
||||||
|
|
||||||
|
if (!this.IsOpen || !this.Stream.CanWrite || !this.Stream.CanRead)
|
||||||
|
{
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Stream.Write(new byte[] { 1, 1, 1, 1 }, 0, 4);
|
||||||
|
|
||||||
|
var asyncState = new IRDAAsyncState
|
||||||
|
{
|
||||||
|
Request = request,
|
||||||
|
Stream = this.Stream
|
||||||
|
};
|
||||||
|
|
||||||
|
var lock_object = new object();
|
||||||
|
|
||||||
|
lock (lock_object)
|
||||||
|
{
|
||||||
|
Task.Factory.StartNew(asyncState.BeginReadAsync, asyncState.CancellationToken);
|
||||||
|
|
||||||
|
asyncState.BeginWriteAsync(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
return asyncState.Response;
|
||||||
|
}
|
||||||
|
|
||||||
public byte[] SendMessage(byte[] command)
|
public byte[] SendMessage(byte[] command)
|
||||||
{
|
{
|
||||||
var response = new byte[0];
|
var response = new byte[0];
|
||||||
@@ -76,9 +114,9 @@ namespace OmniPlus
|
|||||||
{
|
{
|
||||||
var message = default(byte[]);
|
var message = default(byte[]);
|
||||||
var length = bytes.Length;
|
var length = bytes.Length;
|
||||||
var start = 0;
|
var start = -1;
|
||||||
|
|
||||||
while (start < bytes.Length)
|
while (++start < bytes.Length)
|
||||||
{
|
{
|
||||||
if (bytes[start] == OmniPlusExtensions.IRDA_START)
|
if (bytes[start] == OmniPlusExtensions.IRDA_START)
|
||||||
{
|
{
|
||||||
@@ -102,11 +140,126 @@ namespace OmniPlus
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
start++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.MessageReceived?.Invoke(message);
|
this.MessageReceived?.Invoke(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class IRDAAsyncState
|
||||||
|
{
|
||||||
|
private const int BUFFER_SIZE = 256;
|
||||||
|
private const int MAX_REPEATS = 5;
|
||||||
|
|
||||||
|
private readonly ManualResetEventSlim manualResetEventSlim;
|
||||||
|
private readonly CancellationTokenSource cancellationTokenSource;
|
||||||
|
|
||||||
|
public IRDAAsyncState()
|
||||||
|
{
|
||||||
|
this.manualResetEventSlim = new ManualResetEventSlim();
|
||||||
|
this.cancellationTokenSource = new CancellationTokenSource();
|
||||||
|
this.CancellationToken = this.cancellationTokenSource.Token;
|
||||||
|
this.Buffer = new Byte[BUFFER_SIZE];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Int32 Repeats { get; private set; }
|
||||||
|
|
||||||
|
public Byte[] Buffer { get; private set; }
|
||||||
|
|
||||||
|
public Byte[] Request { get; set; }
|
||||||
|
|
||||||
|
public Byte[] Response { get; set; }
|
||||||
|
|
||||||
|
public Stream Stream { get; set; }
|
||||||
|
|
||||||
|
public CancellationToken CancellationToken { get; }
|
||||||
|
|
||||||
|
internal void BeginReadAsync()
|
||||||
|
{
|
||||||
|
this.Repeats++;
|
||||||
|
this.Response = null;
|
||||||
|
|
||||||
|
var asyncResult = this.Stream.BeginRead(this.Buffer, 0, this.Buffer.Length, this.EndReadAsync, this);
|
||||||
|
|
||||||
|
asyncResult.AsyncWaitHandle.WaitOne();
|
||||||
|
|
||||||
|
if (this.Response is null && this.Repeats <= MAX_REPEATS)
|
||||||
|
{
|
||||||
|
this.BeginReadAsync();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.Response is null)
|
||||||
|
{
|
||||||
|
this.Response = new Byte[] { };
|
||||||
|
}
|
||||||
|
|
||||||
|
this.manualResetEventSlim.Set();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EndReadAsync(IAsyncResult asyncResult)
|
||||||
|
{
|
||||||
|
if (asyncResult.AsyncState is IRDAAsyncState asyncState)
|
||||||
|
{
|
||||||
|
lock (asyncState)
|
||||||
|
{
|
||||||
|
var bytesLength = asyncState.Stream.EndRead(asyncResult);
|
||||||
|
|
||||||
|
if (this.Response is null)
|
||||||
|
{
|
||||||
|
var response = new Byte[bytesLength];
|
||||||
|
|
||||||
|
Array.Copy(this.Buffer, 0, response, 0, bytesLength);
|
||||||
|
|
||||||
|
Console.WriteLine("<<< IRDA " + BitConverter.ToString(response));
|
||||||
|
|
||||||
|
response = response.FromIrdaMessage();
|
||||||
|
|
||||||
|
Console.WriteLine("<<< UI1236 " + BitConverter.ToString(response));
|
||||||
|
|
||||||
|
response = response.FromUI1236Message();
|
||||||
|
|
||||||
|
Console.WriteLine("<<< OMNI " + BitConverter.ToString(response));
|
||||||
|
|
||||||
|
if (response.Length != 0)
|
||||||
|
{
|
||||||
|
this.Response = response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void BeginWriteAsync(Byte[] request)
|
||||||
|
{
|
||||||
|
Console.WriteLine(">>> OMNI " + BitConverter.ToString(request));
|
||||||
|
|
||||||
|
request = request.ToUI1236Message();
|
||||||
|
|
||||||
|
Console.WriteLine(">>> UI1236 " + BitConverter.ToString(request));
|
||||||
|
|
||||||
|
request = request.ToIrdaMessage();
|
||||||
|
|
||||||
|
Console.WriteLine(">>> IRDA " + BitConverter.ToString(request));
|
||||||
|
|
||||||
|
request = request
|
||||||
|
.ToUI1236Message()
|
||||||
|
.ToIrdaMessage();
|
||||||
|
|
||||||
|
var asyncResult = this.Stream.BeginWrite(request, 0, request.Length, this.EndWriteAsync, this);
|
||||||
|
|
||||||
|
asyncResult.AsyncWaitHandle.WaitOne();
|
||||||
|
|
||||||
|
this.manualResetEventSlim.Wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EndWriteAsync(IAsyncResult asyncResult)
|
||||||
|
{
|
||||||
|
if (asyncResult.AsyncState is IRDAAsyncState asyncState)
|
||||||
|
{
|
||||||
|
asyncState.Stream.EndWrite(asyncResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ using OmniPlus.Options;
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Ports;
|
using System.IO.Ports;
|
||||||
using System.Threading;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OmniPlus
|
namespace OmniPlus
|
||||||
{
|
{
|
||||||
internal abstract class SerialPortConnection
|
internal abstract class SerialPortConnection : IDisposable
|
||||||
{
|
{
|
||||||
protected event StateChangedEventHandler StateChanged;
|
protected event StateChangedEventHandler StateChanged;
|
||||||
protected event DataReceivedHandler DataReceived;
|
protected event DataReceivedHandler DataReceived;
|
||||||
@@ -17,7 +17,6 @@ namespace OmniPlus
|
|||||||
|
|
||||||
private SerialPort serialPort;
|
private SerialPort serialPort;
|
||||||
private SerialPortState state;
|
private SerialPortState state;
|
||||||
private bool buisy;
|
|
||||||
|
|
||||||
protected SerialPortConnection()
|
protected SerialPortConnection()
|
||||||
=> this.Options = new SerialPortOptions();
|
=> this.Options = new SerialPortOptions();
|
||||||
@@ -26,13 +25,66 @@ namespace OmniPlus
|
|||||||
|
|
||||||
public bool Connected => this.state == SerialPortState.Open;
|
public bool Connected => this.state == SerialPortState.Open;
|
||||||
|
|
||||||
|
protected bool IsOpen => this.serialPort?.IsOpen ?? false;
|
||||||
|
|
||||||
|
protected Stream Stream => this.serialPort.BaseStream;
|
||||||
|
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (this.serialPort != null)
|
||||||
|
{
|
||||||
|
this.serialPort.Disposed -= this.Port_Disposed;
|
||||||
|
this.serialPort.ErrorReceived -= this.Port_ErrorReceived;
|
||||||
|
|
||||||
|
this.serialPort.Close();
|
||||||
|
this.serialPort.Dispose();
|
||||||
|
this.serialPort = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("... Port disposed");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OpenII()
|
||||||
|
{
|
||||||
|
this.Dispose();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.serialPort = new SerialPort
|
||||||
|
{
|
||||||
|
PortName = this.Options.PortName,
|
||||||
|
BaudRate = (int)this.Options.BaudRate,
|
||||||
|
DataBits = (int)this.Options.DataBits,
|
||||||
|
Parity = this.Options.Parity,
|
||||||
|
StopBits = this.Options.StopBits,
|
||||||
|
RtsEnable = this.Options.RtsEnabled,
|
||||||
|
DtrEnable = this.Options.DtrEnabled
|
||||||
|
};
|
||||||
|
|
||||||
|
this.serialPort.Disposed += this.Port_Disposed;
|
||||||
|
this.serialPort.ErrorReceived += this.Port_ErrorReceived;
|
||||||
|
|
||||||
|
this.serialPort.Open();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Close()
|
public virtual void Close()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (this.serialPort != null)
|
if (this.serialPort != null)
|
||||||
{
|
{
|
||||||
// this.serialPort.DataReceived -= this.SerialPort_DataReceived;
|
|
||||||
this.serialPort.Disposed -= this.SerialPort_Disposed;
|
this.serialPort.Disposed -= this.SerialPort_Disposed;
|
||||||
this.serialPort.ErrorReceived -= this.SerialPort_ErrorReceived;
|
this.serialPort.ErrorReceived -= this.SerialPort_ErrorReceived;
|
||||||
this.serialPort.PinChanged -= this.SerialPort_PinChanged;
|
this.serialPort.PinChanged -= this.SerialPort_PinChanged;
|
||||||
@@ -86,10 +138,26 @@ namespace OmniPlus
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Port_Disposed(Object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
this.Dispose();
|
||||||
|
|
||||||
|
Console.WriteLine("... Port disposed internal");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Port_ErrorReceived(Object sender, SerialErrorReceivedEventArgs args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("... Port error received");
|
||||||
|
Console.WriteLine($"... {args.EventType}");
|
||||||
|
|
||||||
|
if (!this.serialPort.IsOpen)
|
||||||
|
{
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Open()
|
public virtual void Open()
|
||||||
{
|
{
|
||||||
this.Close();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var fileInfo = new FileInfo(this.Options.LogFile);
|
var fileInfo = new FileInfo(this.Options.LogFile);
|
||||||
@@ -119,8 +187,7 @@ namespace OmniPlus
|
|||||||
RtsEnable = this.Options.RtsEnabled,
|
RtsEnable = this.Options.RtsEnabled,
|
||||||
DtrEnable = this.Options.DtrEnabled
|
DtrEnable = this.Options.DtrEnabled
|
||||||
};
|
};
|
||||||
|
|
||||||
// this.serialPort.DataReceived += this.SerialPort_DataReceived;
|
|
||||||
this.serialPort.Disposed += this.SerialPort_Disposed;
|
this.serialPort.Disposed += this.SerialPort_Disposed;
|
||||||
this.serialPort.ErrorReceived += this.SerialPort_ErrorReceived;
|
this.serialPort.ErrorReceived += this.SerialPort_ErrorReceived;
|
||||||
this.serialPort.PinChanged += this.SerialPort_PinChanged;
|
this.serialPort.PinChanged += this.SerialPort_PinChanged;
|
||||||
@@ -136,7 +203,7 @@ namespace OmniPlus
|
|||||||
+ $", {this.Options.BaudRate}"
|
+ $", {this.Options.BaudRate}"
|
||||||
+ $", {this.Options.DataBits}"
|
+ $", {this.Options.DataBits}"
|
||||||
+ $", {this.Options.Parity}"
|
+ $", {this.Options.Parity}"
|
||||||
+ $", {this.Options.StopBits}");
|
+ $", {this.Options.StopBits}");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -231,12 +298,13 @@ namespace OmniPlus
|
|||||||
private bool BeginWaitingResponseAsync()
|
private bool BeginWaitingResponseAsync()
|
||||||
{
|
{
|
||||||
var buffer = new byte[1024];
|
var buffer = new byte[1024];
|
||||||
|
var baseStream = this.serialPort.BaseStream;
|
||||||
|
|
||||||
this.serialPort?.BaseStream?.BeginRead(buffer, 0, buffer.Length, delegate(IAsyncResult asyncResult)
|
var ar = baseStream.BeginRead(buffer, 0, buffer.Length, delegate(IAsyncResult asyncResult)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var actualLength = this.serialPort?.BaseStream?.EndRead(asyncResult) ?? 0;
|
var actualLength = baseStream.EndRead(asyncResult);
|
||||||
|
|
||||||
if (actualLength <= 0)
|
if (actualLength <= 0)
|
||||||
{
|
{
|
||||||
@@ -257,6 +325,8 @@ namespace OmniPlus
|
|||||||
}
|
}
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
|
Task.Factory.StartNew(ar.AsyncWaitHandle.WaitOne);
|
||||||
|
|
||||||
return this.serialPort != null && this.serialPort.IsOpen;
|
return this.serialPort != null && this.serialPort.IsOpen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ namespace OmniPlus.Features
|
|||||||
{
|
{
|
||||||
public class FeatureRequest : FeatureResponse
|
public class FeatureRequest : FeatureResponse
|
||||||
{
|
{
|
||||||
protected readonly int length;
|
|
||||||
|
|
||||||
public FeatureRequest(int length)
|
public FeatureRequest(int length)
|
||||||
: base(length)
|
: base(length)
|
||||||
=> this.length = length;
|
=> this.length = length;
|
||||||
|
|||||||
@@ -6,21 +6,30 @@ namespace OmniPlus.Features
|
|||||||
{
|
{
|
||||||
public class FeatureResponse
|
public class FeatureResponse
|
||||||
{
|
{
|
||||||
|
protected int length;
|
||||||
protected readonly byte[] bytes;
|
protected readonly byte[] bytes;
|
||||||
|
|
||||||
public FeatureResponse(int length = 0)
|
public FeatureResponse(int length = 0)
|
||||||
=> this.bytes = new byte[length];
|
{
|
||||||
|
this.length = length;
|
||||||
|
this.bytes = new byte[length];
|
||||||
|
}
|
||||||
|
|
||||||
public FeatureResponse(byte[] response, int length = 0) : this(length)
|
public FeatureResponse(byte[] response, int length = 0) : this(length)
|
||||||
{
|
{
|
||||||
if (response?.Length > 0)
|
if (response != null)
|
||||||
{
|
{
|
||||||
this.Status = (Status)response[0];
|
var responseLength = response.Length;
|
||||||
}
|
|
||||||
|
|
||||||
if (response?.Length > length)
|
if (responseLength > 0)
|
||||||
{
|
{
|
||||||
Array.Copy(response, 1, this.bytes, 0, length);
|
this.Status = (Status)response[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (responseLength > this.length)
|
||||||
|
{
|
||||||
|
Array.Copy(response, 1, this.bytes, 0, this.length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,8 +45,5 @@ namespace OmniPlus.Features
|
|||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
=> BitConverter.ToString(this.bytes);
|
=> BitConverter.ToString(this.bytes);
|
||||||
|
|
||||||
//public static implicit operator byte[](FeatureResponse response)
|
|
||||||
// => response?.bytes ?? new byte[0];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
namespace OmniPlus
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.IO.Ports;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
public class OMNIPool
|
||||||
|
{
|
||||||
|
private readonly ConcurrentDictionary<OMNISlot, OMNIFeatures> features;
|
||||||
|
private readonly ConcurrentDictionary<OMNISlot, OMNIConnection> connections;
|
||||||
|
|
||||||
|
public OMNIPool()
|
||||||
|
{
|
||||||
|
this.connections = new ConcurrentDictionary<OMNISlot, OMNIConnection>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddConnection(String portNr)
|
||||||
|
{
|
||||||
|
var slot = new OMNISlot(this.connections.Count + 1, portNr);
|
||||||
|
_ = this.features.AddOrUpdate(slot, new OMNIFeatures(), (_slot, _) => new OMNIFeatures());
|
||||||
|
_ = this.connections.AddOrUpdate(slot, new OMNIConnection(slot), (_slot, _) => new OMNIConnection(_slot));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OMNIConnection
|
||||||
|
{
|
||||||
|
private readonly OMNISlot slot;
|
||||||
|
private readonly OMNIFeatures features;
|
||||||
|
|
||||||
|
public OMNIConnection(OMNISlot slot)
|
||||||
|
{
|
||||||
|
this.slot = slot;
|
||||||
|
this.features = new OMNIFeatures();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OMNIFeatures
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OMNISlot : IComparable<OMNISlot>
|
||||||
|
{
|
||||||
|
public OMNISlot(Int32 nr, String port)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(port))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("COM port is required!");
|
||||||
|
}
|
||||||
|
else if (!SerialPort.GetPortNames().Any(x => x == port))
|
||||||
|
{
|
||||||
|
throw new ArgumentException("COM port dose not exists!");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Nr = nr;
|
||||||
|
this.Port = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Int32 Nr { get; }
|
||||||
|
|
||||||
|
public String Port { get; }
|
||||||
|
|
||||||
|
public Int32 CompareTo(OMNISlot other)
|
||||||
|
{
|
||||||
|
return this.Port.CompareTo(other.Port);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Boolean Equals(Object other)
|
||||||
|
{
|
||||||
|
return this.Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Int32 GetHashCode()
|
||||||
|
{
|
||||||
|
return this.Port.GetHashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override String ToString()
|
||||||
|
{
|
||||||
|
return $"{this.Nr}. {this.Port}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,6 +34,9 @@
|
|||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
@@ -100,6 +103,7 @@
|
|||||||
<Compile Include="OmniPlusMeter.cs" />
|
<Compile Include="OmniPlusMeter.cs" />
|
||||||
<Compile Include="OmniPlusStateChanged.cs" />
|
<Compile Include="OmniPlusStateChanged.cs" />
|
||||||
<Compile Include="OmniPlusType.cs" />
|
<Compile Include="OmniPlusType.cs" />
|
||||||
|
<Compile Include="OMNIPool.cs" />
|
||||||
<Compile Include="Options\OmniControlOptions.cs" />
|
<Compile Include="Options\OmniControlOptions.cs" />
|
||||||
<Compile Include="Options\SerialPortOptions.cs" />
|
<Compile Include="Options\SerialPortOptions.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
@@ -110,6 +114,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\ExchangeHub\ExchangeHub.csproj">
|
<ProjectReference Include="..\ExchangeHub\ExchangeHub.csproj">
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace OmniPlus
|
|||||||
this.irdaConnection.Open();
|
this.irdaConnection.Open();
|
||||||
|
|
||||||
this.connected = () => this.irdaConnection.Connected;
|
this.connected = () => this.irdaConnection.Connected;
|
||||||
this.MessageHandler = this.irdaConnection.SendMessage;
|
this.MessageHandler = this.irdaConnection.Send;
|
||||||
|
|
||||||
return this.irdaConnection.Connected;
|
return this.irdaConnection.Connected;
|
||||||
}
|
}
|
||||||
@@ -412,13 +412,5 @@ namespace OmniPlus
|
|||||||
|
|
||||||
return new FeatureResponse();
|
return new FeatureResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WaitBeforeNextExecution()
|
|
||||||
{
|
|
||||||
while (this.secondsToWait > 0)
|
|
||||||
{
|
|
||||||
this.secondsToWait--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,6 +202,16 @@ namespace OmniPlus
|
|||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var bytesLength = bytes.Length;
|
||||||
|
|
||||||
|
if (bytesLength >= 2)
|
||||||
|
{
|
||||||
|
if (bytes[1] == IRDA_PING)
|
||||||
|
{
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var payloadLength = bytes.Length - IRDA_MIN_LENGTH;
|
var payloadLength = bytes.Length - IRDA_MIN_LENGTH;
|
||||||
|
|
||||||
if (payloadLength <= OxOO)
|
if (payloadLength <= OxOO)
|
||||||
|
|||||||
@@ -14,12 +14,14 @@
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (this.MeterVolume != 0 && this.VolumeMessured != 0)
|
try
|
||||||
{
|
{
|
||||||
return this.MeterVolume / this.VolumeMessured * 100;
|
return 100 - this.MeterVolume / this.VolumeMessured * 100;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,5 +29,8 @@ namespace OmniPlus
|
|||||||
|
|
||||||
return seconds * milliliter / 1000 / 1000;
|
return seconds * milliliter / 1000 / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double VolumeM3(OmniPlusTest test)
|
||||||
|
=> this.VolumeM3(test.Rotations, test.Duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
using OmniPlus.Enums;
|
using OmniPlus.Enums;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.IO.Ports;
|
using System.IO.Ports;
|
||||||
|
|
||||||
namespace OmniPlus.Options
|
namespace OmniPlus.Options
|
||||||
@@ -32,5 +35,8 @@ namespace OmniPlus.Options
|
|||||||
public bool DtrEnabled { get; set; }
|
public bool DtrEnabled { get; set; }
|
||||||
|
|
||||||
public string LogFile { get; set; }
|
public string LogFile { get; set; }
|
||||||
|
|
||||||
|
public override String ToString()
|
||||||
|
=> JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net40" />
|
||||||
|
</packages>
|
||||||
Reference in New Issue
Block a user