-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
123 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using OpenProtocolInterpreter.ParameterSet; | ||
|
||
namespace MIDTesters.Core.ParameterSet | ||
{ | ||
[TestClass] | ||
[TestCategory("ParameterSet")] | ||
public class TestMid2506 : DefaultMidTests<Mid2506> | ||
{ | ||
[TestMethod] | ||
[TestCategory("Revision 1"), TestCategory("ASCII")] | ||
public void Mid2506Revision1() | ||
{ | ||
string package = "00272506001 0030201"; | ||
var mid = _midInterpreter.Parse<Mid2506>(package); | ||
|
||
Assert.AreNotEqual(0, mid.ProgramId); | ||
Assert.AreNotEqual(0, (int)mid.NodeType); | ||
AssertEqualPackages(package, mid); | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory("Revision 1"), TestCategory("ByteArray")] | ||
public void Mid2506ByteRevision1() | ||
{ | ||
string package = "00272506001 0030201"; | ||
byte[] bytes = GetAsciiBytes(package); | ||
var mid = _midInterpreter.Parse<Mid2506>(bytes); | ||
|
||
Assert.AreNotEqual(0, mid.ProgramId); | ||
Assert.AreNotEqual(0, (int)mid.NodeType); | ||
AssertEqualPackages(bytes, mid); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace OpenProtocolInterpreter | ||
{ | ||
public enum NodeType | ||
{ | ||
ParameterSet = 1, | ||
Multistage = 2, | ||
Job = 3, | ||
|
||
TighteningProgram = 100, | ||
TighteningStep = 101, | ||
Restriction = 102, | ||
Check = 103, | ||
SpeedRamp = 104, | ||
Monitoring = 105, | ||
|
||
MultistepTighteningProgram = 201 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace OpenProtocolInterpreter.ParameterSet | ||
{ | ||
/// <summary> | ||
/// Tightening Program Delete | ||
/// <para>Message sent by: Integrator</para> | ||
/// <para> | ||
/// Answer: <see cref="Communication.Mid0005"/> Command accepted or | ||
/// <see cref="Communication.Mid0004"/> Command error | ||
/// </para> | ||
/// <para> This message deletes one or all programs in controller. </para> | ||
/// <para> <b>Note</b>: If a running program is included in MID 2506 deletion the program shall finish before deletion. </para> | ||
/// <para> <b>Note</b>: Deleting programs included in other nodes may give unwanted behaviour. It will behave identical to a manual delete of the program. </para> | ||
/// </summary> | ||
public class Mid2506 : Mid, IParameterSet, IIntegrator, IAcceptableCommand, IDeclinableCommand | ||
{ | ||
public const int MID = 2506; | ||
|
||
public IEnumerable<Error> DocumentedPossibleErrors => []; | ||
|
||
public int ProgramId | ||
{ | ||
get => GetField(1, DataFields.ProgramId).GetValue(OpenProtocolConvert.ToInt32); | ||
set => GetField(1, DataFields.ProgramId).SetValue(OpenProtocolConvert.ToString, value); | ||
} | ||
public NodeType NodeType | ||
{ | ||
get => (NodeType)GetField(1, DataFields.NodeType).GetValue(OpenProtocolConvert.ToInt32); | ||
set => GetField(1, DataFields.NodeType).SetValue(OpenProtocolConvert.ToString, value); | ||
} | ||
|
||
public Mid2506() : this(new Header() | ||
{ | ||
Mid = MID, | ||
Revision = DEFAULT_REVISION | ||
}) | ||
{ | ||
|
||
} | ||
|
||
public Mid2506(Header header) : base(header) | ||
{ | ||
|
||
} | ||
|
||
protected override Dictionary<int, List<DataField>> RegisterDatafields() | ||
{ | ||
return new Dictionary<int, List<DataField>>() | ||
{ | ||
{ | ||
1, new List<DataField>() | ||
{ | ||
DataField.Number(DataFields.ProgramId, 20, 4, false), | ||
DataField.Number(DataFields.NodeType, 24, 3, false), | ||
} | ||
} | ||
}; | ||
} | ||
|
||
protected enum DataFields | ||
{ | ||
ProgramId, | ||
NodeType | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters