AuthLevel and pin added
This commit is contained in:
+2
@@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
public Boolean MatchCRC { get; }
|
public Boolean MatchCRC { get; }
|
||||||
|
|
||||||
|
public override String ToString() => BitConverter.ToString(this.Payload);
|
||||||
|
|
||||||
private Boolean CheckWhetherTelegramMatchCheckSum()
|
private Boolean CheckWhetherTelegramMatchCheckSum()
|
||||||
{
|
{
|
||||||
var existingCRC = this.message.CRC;
|
var existingCRC = this.message.CRC;
|
||||||
|
|||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
namespace Common.Hardware.Interfaces.Protocols.SIRT
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
|
||||||
|
public class AuthLevel
|
||||||
|
{
|
||||||
|
public enum Level : UInt64
|
||||||
|
{
|
||||||
|
I = 0x004301143068D0,
|
||||||
|
II = 0x004302140E8040,
|
||||||
|
III = 0x00430363937322,
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly Level pin;
|
||||||
|
private readonly Byte[] bytes;
|
||||||
|
|
||||||
|
private AuthLevel(Level pin)
|
||||||
|
{
|
||||||
|
this.pin = pin;
|
||||||
|
this.bytes = new Byte[6];
|
||||||
|
|
||||||
|
var bytes = BitConverter.GetBytes((UInt64)this.pin);
|
||||||
|
Array.Copy(bytes, 0, this.bytes, 0, this.bytes.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly AuthLevel I = Level.I;
|
||||||
|
public static readonly AuthLevel II = Level.II;
|
||||||
|
public static readonly AuthLevel III = Level.III;
|
||||||
|
|
||||||
|
public override String ToString()
|
||||||
|
=> BitConverter.ToString(this.bytes);
|
||||||
|
|
||||||
|
public static implicit operator AuthLevel(Level level)
|
||||||
|
=> new AuthLevel(level);
|
||||||
|
|
||||||
|
public static implicit operator UInt64(AuthLevel level)
|
||||||
|
=> (UInt64)level.pin;
|
||||||
|
|
||||||
|
public static implicit operator Byte[](AuthLevel level)
|
||||||
|
=> level.bytes;
|
||||||
|
|
||||||
|
public static implicit operator String (AuthLevel level)
|
||||||
|
=> level.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
@@ -40,6 +40,7 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="AuthLevel.cs" />
|
||||||
<Compile Include="CompilerServices.cs" />
|
<Compile Include="CompilerServices.cs" />
|
||||||
<Compile Include="Payloads\Ack.cs" />
|
<Compile Include="Payloads\Ack.cs" />
|
||||||
<Compile Include="Payloads\Answer.cs" />
|
<Compile Include="Payloads\Answer.cs" />
|
||||||
|
|||||||
-14
@@ -29,17 +29,3 @@
|
|||||||
public Byte Alarm { get; }
|
public Byte Alarm { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Select Case bLevel
|
|
||||||
Case 1
|
|
||||||
ProvideAuthLevelHexCommand = "4301143068D0"
|
|
||||||
Case 2
|
|
||||||
ProvideAuthLevelHexCommand = "4302140E8040"
|
|
||||||
Case 3
|
|
||||||
ProvideAuthLevelHexCommand = "430363937322"
|
|
||||||
End Select
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|||||||
-2
@@ -142,7 +142,5 @@
|
|||||||
public UInt16 TimeOfLogReset { get; }
|
public UInt16 TimeOfLogReset { get; }
|
||||||
|
|
||||||
public Byte MeterSize { get; }
|
public Byte MeterSize { get; }
|
||||||
|
|
||||||
public override String ToString() => BitConverter.ToString(this.Payload);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-36
@@ -71,42 +71,6 @@
|
|||||||
this.sirtPort.Close();
|
this.sirtPort.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SirtTask ReadPam(Action<ReadPamRequest> requestBuilder)
|
|
||||||
{
|
|
||||||
var request = new ReadPamRequest();
|
|
||||||
|
|
||||||
requestBuilder(request);
|
|
||||||
|
|
||||||
return this.SirtTask(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SirtTask ReadReg(Action<ReadRegRequest> requestBuilder)
|
|
||||||
{
|
|
||||||
var request = new ReadRegRequest();
|
|
||||||
|
|
||||||
requestBuilder(request);
|
|
||||||
|
|
||||||
return this.SirtTask(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SirtTask WritePam(Action<WritePamRequest> requestBuilder)
|
|
||||||
{
|
|
||||||
var request = new WritePamRequest();
|
|
||||||
|
|
||||||
requestBuilder(request);
|
|
||||||
|
|
||||||
return this.SirtTask(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SirtTask WriteReg(Action<WriteRegRequest> requestBuilder)
|
|
||||||
{
|
|
||||||
var request = new WriteRegRequest();
|
|
||||||
|
|
||||||
requestBuilder(request);
|
|
||||||
|
|
||||||
return this.SirtTask(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
private SirtTask SirtTask(SirtRequest request)
|
private SirtTask SirtTask(SirtRequest request)
|
||||||
{
|
{
|
||||||
var task = new SirtTask(request);
|
var task = new SirtTask(request);
|
||||||
|
|||||||
+9
-4
@@ -37,12 +37,12 @@
|
|||||||
|
|
||||||
internal void Add(Bup bup)
|
internal void Add(Bup bup)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(bup);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Add(Lat lat)
|
internal void Add(Lat lat)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(lat);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Add(Semi semi)
|
internal void Add(Semi semi)
|
||||||
@@ -50,15 +50,18 @@
|
|||||||
this.IsRunning = false;
|
this.IsRunning = false;
|
||||||
|
|
||||||
this.Done?.Invoke(this);
|
this.Done?.Invoke(this);
|
||||||
|
|
||||||
|
Console.WriteLine(semi);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Add(Debug debug)
|
internal void Add(Debug debug)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Add(Ack ack)
|
internal void Add(Ack ack)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(ack);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Add(Answer answer)
|
internal void Add(Answer answer)
|
||||||
@@ -66,6 +69,8 @@
|
|||||||
this.IsRunning = false;
|
this.IsRunning = false;
|
||||||
|
|
||||||
this.Done?.Invoke(this);
|
this.Done?.Invoke(this);
|
||||||
|
|
||||||
|
Console.WriteLine(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator SirtMessage(SirtTask task)
|
public static implicit operator SirtMessage(SirtTask task)
|
||||||
|
|||||||
Reference in New Issue
Block a user