init
This commit is contained in:
@@ -0,0 +1,317 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using DTS.Common.Enums.DASFactory;
|
||||
using DTS.Common.ICommunication;
|
||||
|
||||
namespace DTS.DASLib.Command.SLICEDB
|
||||
{
|
||||
public abstract class ArmCommands : CommandBase
|
||||
{
|
||||
protected enum Commands
|
||||
{
|
||||
arm_reserved = 0x00,
|
||||
arm_arm = 0x01,
|
||||
arm_disarm = 0x02,
|
||||
arm_enablefaultchecking = 0x03,
|
||||
arm_disablefaultchecking = 0x04,
|
||||
arm_setinverttriggerpolarity = 0x05,
|
||||
arm_setinvertstartpolarity = 0x06,
|
||||
arm_setrecordingmode = 0x07,
|
||||
arm_setpretriggersec = 0x08,
|
||||
arm_setposttriggersec = 0x09,
|
||||
arm_setmaxevent = 0x0A,
|
||||
arm_setonoverride = 0x0B,
|
||||
};
|
||||
|
||||
protected abstract Commands _Command { get; }
|
||||
|
||||
protected ArmCommands(DTS.Common.Interface.DASFactory.ICommunication sock)
|
||||
: base(sock)
|
||||
{
|
||||
command.Type = CommandPacket.CommandType.Arm;
|
||||
command.SetCommand((byte)_Command, _Command.ToString());
|
||||
}
|
||||
|
||||
protected ArmCommands(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
|
||||
: base(sock, TimeoutMillisec)
|
||||
{
|
||||
command.Type = CommandPacket.CommandType.Arm;
|
||||
command.SetCommand((byte)_Command, _Command.ToString());
|
||||
}
|
||||
|
||||
public override void CommandToString(ref List<List<string>> list)
|
||||
{
|
||||
base.CommandToString(ref list);
|
||||
if (null != recorder)
|
||||
{
|
||||
list[0].Add(recorder.SerialNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class Arm : ArmCommands
|
||||
{
|
||||
protected override Commands _Command => Commands.arm_arm;
|
||||
public Arm(DTS.Common.Interface.DASFactory.ICommunication sock)
|
||||
: base(sock)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.Arm);
|
||||
}
|
||||
|
||||
public Arm(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
|
||||
: base(sock, TimeoutMillisec)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.Arm);
|
||||
}
|
||||
|
||||
public override void CommandToString(ref List<List<string>> list)
|
||||
{
|
||||
base.CommandToString(ref list);
|
||||
list.Add(new List<string>() { string.Format("Arm") });
|
||||
}
|
||||
|
||||
}
|
||||
public class Disarm : ArmCommands
|
||||
{
|
||||
protected override Commands _Command => Commands.arm_disarm;
|
||||
public Disarm(DTS.Common.Interface.DASFactory.ICommunication sock)
|
||||
: base(sock)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.Arm);
|
||||
}
|
||||
|
||||
public Disarm(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
|
||||
: base(sock, TimeoutMillisec)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.Arm);
|
||||
}
|
||||
|
||||
public override void CommandToString(ref List<List<string>> list)
|
||||
{
|
||||
base.CommandToString(ref list);
|
||||
list.Add(new List<string>() { string.Format("Disarm") });
|
||||
}
|
||||
|
||||
}
|
||||
public class EnableFaultChecking : ArmCommands
|
||||
{
|
||||
protected override Commands _Command => Commands.arm_enablefaultchecking;
|
||||
public EnableFaultChecking(DTS.Common.Interface.DASFactory.ICommunication sock)
|
||||
: base(sock)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.EnableFaultChecking);
|
||||
}
|
||||
|
||||
public EnableFaultChecking(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
|
||||
: base(sock, TimeoutMillisec)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.EnableFaultChecking);
|
||||
}
|
||||
|
||||
public override void CommandToString(ref List<List<string>> list)
|
||||
{
|
||||
base.CommandToString(ref list);
|
||||
list.Add(new List<string>() { string.Format("EnableFaultChecking") });
|
||||
}
|
||||
|
||||
}
|
||||
public class DisableFaultChecking : ArmCommands
|
||||
{
|
||||
protected override Commands _Command => Commands.arm_disablefaultchecking;
|
||||
public DisableFaultChecking(DTS.Common.Interface.DASFactory.ICommunication sock)
|
||||
: base(sock)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.EnableFaultChecking);
|
||||
}
|
||||
|
||||
public DisableFaultChecking(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
|
||||
: base(sock, TimeoutMillisec)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.EnableFaultChecking);
|
||||
}
|
||||
|
||||
public override void CommandToString(ref List<List<string>> list)
|
||||
{
|
||||
base.CommandToString(ref list);
|
||||
list.Add(new List<string>() { string.Format("DisableFaultChecking") });
|
||||
}
|
||||
|
||||
}
|
||||
public class SetRecordingMode : ArmCommands
|
||||
{
|
||||
protected override Commands _Command => Commands.arm_setrecordingmode;
|
||||
public SetRecordingMode(DTS.Common.Interface.DASFactory.ICommunication sock)
|
||||
: base(sock)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.Arm);
|
||||
}
|
||||
|
||||
public SetRecordingMode(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
|
||||
: base(sock, TimeoutMillisec)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.Arm);
|
||||
}
|
||||
|
||||
private byte _val;
|
||||
|
||||
/// <summary>
|
||||
/// The current Dat0 reg of the SLICE DB
|
||||
/// </summary>
|
||||
public byte Value
|
||||
{
|
||||
get => _val;
|
||||
set
|
||||
{
|
||||
const int ParameterLength = 1;
|
||||
const int ValuePosition = 0;
|
||||
_val = value;
|
||||
command.Parameter = new byte[ParameterLength];
|
||||
command.SetParameter(ValuePosition, _val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void CommandToString(ref List<List<string>> list)
|
||||
{
|
||||
base.CommandToString(ref list);
|
||||
list.Add(new List<string>() { string.Format("SetRecordingMode {0}", Value) });
|
||||
}
|
||||
|
||||
}
|
||||
public class SetPostTriggerSec : ArmCommands
|
||||
{
|
||||
protected override Commands _Command => Commands.arm_setposttriggersec;
|
||||
public SetPostTriggerSec(DTS.Common.Interface.DASFactory.ICommunication sock)
|
||||
: base(sock)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.Arm);
|
||||
}
|
||||
|
||||
public SetPostTriggerSec(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
|
||||
: base(sock, TimeoutMillisec)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.Arm);
|
||||
}
|
||||
|
||||
private float _val;
|
||||
|
||||
/// <summary>
|
||||
/// The current Dat0 reg of the SLICE DB
|
||||
/// </summary>
|
||||
public float Value
|
||||
{
|
||||
get => _val;
|
||||
set
|
||||
{
|
||||
_val = value;
|
||||
command.Parameter = new byte[sizeof(float)];
|
||||
command.SetParameter(0, _val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void CommandToString(ref List<List<string>> list)
|
||||
{
|
||||
base.CommandToString(ref list);
|
||||
list.Add(new List<string>() { string.Format("SetPostTriggerSec {0}", _val) });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class SetONOverride : ArmCommands
|
||||
{
|
||||
protected override Commands _Command => Commands.arm_setonoverride;
|
||||
public SetONOverride(DTS.Common.Interface.DASFactory.ICommunication sock)
|
||||
: base(sock)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OnOverride);
|
||||
}
|
||||
|
||||
public SetONOverride(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
|
||||
: base(sock, TimeoutMillisec)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OnOverride);
|
||||
}
|
||||
|
||||
private byte _val;
|
||||
|
||||
/// <summary>
|
||||
/// The current StatusLED reg of the SLICE DB
|
||||
/// </summary>
|
||||
public bool Value
|
||||
{
|
||||
get => Convert.ToBoolean(_val);
|
||||
set
|
||||
{
|
||||
_val = Convert.ToByte(value);
|
||||
command.Parameter = new byte[sizeof(byte)];
|
||||
command.SetParameter(0, _val);
|
||||
}
|
||||
}
|
||||
}
|
||||
public class SetInvertTriggerPolarity : ArmCommands
|
||||
{
|
||||
protected override Commands _Command => Commands.arm_setinverttriggerpolarity;
|
||||
public SetInvertTriggerPolarity(DTS.Common.Interface.DASFactory.ICommunication sock)
|
||||
: base(sock)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.Arm);
|
||||
}
|
||||
|
||||
public SetInvertTriggerPolarity(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
|
||||
: base(sock, TimeoutMillisec)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.Arm);
|
||||
}
|
||||
|
||||
private byte _val;
|
||||
|
||||
/// <summary>
|
||||
/// value for the invert trigger
|
||||
/// </summary>
|
||||
public bool Value
|
||||
{
|
||||
get => Convert.ToBoolean(_val);
|
||||
set
|
||||
{
|
||||
_val = Convert.ToByte(value);
|
||||
command.Parameter = new byte[sizeof(byte)];
|
||||
command.SetParameter(0, _val);
|
||||
}
|
||||
}
|
||||
}
|
||||
public class SetInvertStartPolarity : ArmCommands
|
||||
{
|
||||
protected override Commands _Command => Commands.arm_setinvertstartpolarity;
|
||||
public SetInvertStartPolarity(DTS.Common.Interface.DASFactory.ICommunication sock)
|
||||
: base(sock)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.Arm);
|
||||
}
|
||||
|
||||
public SetInvertStartPolarity(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
|
||||
: base(sock, TimeoutMillisec)
|
||||
{
|
||||
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.Arm);
|
||||
}
|
||||
|
||||
private byte _val;
|
||||
|
||||
/// <summary>
|
||||
/// value of invert start
|
||||
/// </summary>
|
||||
public bool Value
|
||||
{
|
||||
get => Convert.ToBoolean(_val);
|
||||
set
|
||||
{
|
||||
_val = Convert.ToByte(value);
|
||||
command.Parameter = new byte[sizeof(byte)];
|
||||
command.SetParameter(0, _val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user