首次上传
This commit is contained in:
+378
@@ -0,0 +1,378 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Aitex.Core.Common.DeviceData;
|
||||
using Aitex.Core.RT.Event;
|
||||
using Aitex.Core.RT.Log;
|
||||
using Aitex.Core.RT.SCCore;
|
||||
using Aitex.Core.Util;
|
||||
using MECF.Framework.Common.Communications;
|
||||
using MECF.Framework.Common.Device.Bases;
|
||||
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Common;
|
||||
|
||||
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Pumps.EdwardsPump
|
||||
{
|
||||
public class EdwardsPump : PumpBase, IConnection
|
||||
{
|
||||
public string Address => Connection.Address;
|
||||
public bool IsConnected => Connection.IsConnected && !_connection.IsCommunicationError;
|
||||
public bool Connect()
|
||||
{
|
||||
return _connection.Connect();
|
||||
}
|
||||
|
||||
public bool Disconnect()
|
||||
{
|
||||
return _connection.Disconnect();
|
||||
}
|
||||
|
||||
public string PortStatus { get; set; } = "Closed";
|
||||
|
||||
private EdwardsPumpConnection _connection;
|
||||
public EdwardsPumpConnection Connection
|
||||
{
|
||||
get { return _connection; }
|
||||
}
|
||||
|
||||
public override AITPumpData DeviceData
|
||||
{
|
||||
get
|
||||
{
|
||||
AITPumpData data = new AITPumpData()
|
||||
{
|
||||
IsOn = IsOn,
|
||||
IsError = IsError,
|
||||
OverTemp = IsOverTemperature,
|
||||
DeviceModule = Module,
|
||||
DeviceName = Name,
|
||||
};
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
private R_TRIG _trigError = new R_TRIG();
|
||||
|
||||
private R_TRIG _trigCommunicationError = new R_TRIG();
|
||||
private R_TRIG _trigRetryConnect = new R_TRIG();
|
||||
|
||||
private PeriodicJob _thread;
|
||||
|
||||
private LinkedList<HandlerBase> _lstHandler = new LinkedList<HandlerBase>();
|
||||
private LinkedList<HandlerBase> _lstMonitorHandler = new LinkedList<HandlerBase>();
|
||||
|
||||
public List<IOResponse> IOResponseList { get; set; } = new List<IOResponse>();
|
||||
|
||||
|
||||
private object _locker = new object();
|
||||
|
||||
private bool _enableLog;
|
||||
private string _portName;
|
||||
private string _scRoot;
|
||||
public EdwardsPump(string module, string name, string scRoot) : base(module, name)
|
||||
{
|
||||
_scRoot = scRoot;
|
||||
}
|
||||
private void ResetPropertiesAndResponses()
|
||||
{
|
||||
|
||||
foreach (var ioResponse in IOResponseList)
|
||||
{
|
||||
ioResponse.ResonseContent = null;
|
||||
ioResponse.ResonseRecievedTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
ResetPropertiesAndResponses();
|
||||
|
||||
if (_connection != null && _connection.IsConnected)
|
||||
return true;
|
||||
|
||||
if (_connection != null && _connection.IsConnected)
|
||||
_connection.Disconnect();
|
||||
|
||||
_portName = SC.GetStringValue($"{(!string.IsNullOrEmpty(_scRoot) ? _scRoot + "." : "")}{Module}.{Name}.DeviceAddress");
|
||||
_enableLog = SC.GetValue<bool>($"{(!string.IsNullOrEmpty(_scRoot) ? _scRoot + "." : "")}{Module}.{Name}.EnableLogMessage");
|
||||
_connection = new EdwardsPumpConnection(_portName);
|
||||
_connection.EnableLog(_enableLog);
|
||||
|
||||
if (_connection.Connect())
|
||||
{
|
||||
PortStatus = "Open";
|
||||
EV.PostInfoLog(Module, $"{Module}.{Name} connected");
|
||||
}
|
||||
|
||||
_thread = new PeriodicJob(1000, OnTimer, $"{Module}.{Name} MonitorHandler", true);
|
||||
lock (_locker)
|
||||
{
|
||||
_lstHandler.AddLast(new EdwardsGetControlHandler(this));
|
||||
_lstHandler.AddLast(new EdwardsFormatModeHandler(this, true));
|
||||
}
|
||||
_lstMonitorHandler.AddLast(new EdwardsQueryPumpStatusHandler(this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
internal void NoteSetParaCompleted()
|
||||
{
|
||||
}
|
||||
|
||||
private bool OnTimer()
|
||||
{
|
||||
try
|
||||
{
|
||||
//_connection.MonitorTimeout();
|
||||
|
||||
if (!_connection.IsConnected || _connection.IsCommunicationError)
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
_lstHandler.Clear();
|
||||
}
|
||||
|
||||
_trigRetryConnect.CLK = !_connection.IsConnected;
|
||||
if (_trigRetryConnect.Q)
|
||||
{
|
||||
_connection.SetPortAddress(_portName);
|
||||
if (!_connection.Connect())
|
||||
{
|
||||
EV.PostAlarmLog(Module, $"Can not connect with {_connection.Address}, {Module}.{Name}");
|
||||
}
|
||||
else
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
_lstHandler.AddLast(new EdwardsGetControlHandler(this));
|
||||
_lstHandler.AddLast(new EdwardsFormatModeHandler(this, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
HandlerBase handler = null;
|
||||
if (!_connection.IsBusy)
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
if (_lstHandler.Count == 0)
|
||||
{
|
||||
foreach (var monitorHandler in _lstMonitorHandler)
|
||||
{
|
||||
_lstHandler.AddLast(monitorHandler);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (_lstHandler.Count > 0)
|
||||
{
|
||||
handler = _lstHandler.First.Value;
|
||||
|
||||
_lstHandler.RemoveFirst();
|
||||
}
|
||||
}
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
_connection.Execute(handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LOG.Write(ex);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public override void Monitor()
|
||||
{
|
||||
try
|
||||
{
|
||||
//_connection.EnableLog(_enableLog);
|
||||
|
||||
|
||||
_trigCommunicationError.CLK = _connection.IsCommunicationError;
|
||||
if (_trigCommunicationError.Q)
|
||||
{
|
||||
EV.PostAlarmLog(Module, $"{Module}.{Name} communication error, {_connection.LastCommunicationError}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LOG.Write(ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_trigError.RST = true;
|
||||
|
||||
_connection.SetCommunicationError(false, "");
|
||||
_trigCommunicationError.RST = true;
|
||||
|
||||
//_enableLog = SC.GetValue<bool>($"{ScBasePath}.{Name}.EnableLogMessage");
|
||||
|
||||
_trigRetryConnect.RST = true;
|
||||
|
||||
base.Reset();
|
||||
}
|
||||
|
||||
#region Command Functions
|
||||
|
||||
internal void NoteSwitchCompleted()
|
||||
{
|
||||
ActionCommandCompleted = true;
|
||||
}
|
||||
public override void SetPumpOnOff(bool isOn)
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
if(isOn)
|
||||
_lstHandler.AddLast(new EdwardsSwitchOnPumpHandler(this));
|
||||
else
|
||||
_lstHandler.AddLast(new EdwardsSwitchOffPumpHandler(this));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public string Error { get; private set; }
|
||||
|
||||
public bool ActionCommandCompleted { get; private set; }
|
||||
|
||||
private string _systemType;
|
||||
//private Dictionary<string, Dictionary<string, ParaResponse>> AlarmStatusDict = new Dictionary<string, Dictionary<string, ParaResponse>>();
|
||||
private Dictionary<int, ParaResponse> AlarmStatusDict = new Dictionary<int, ParaResponse>();
|
||||
private Dictionary<int, ParaResponse> BitfieldStatusDict = new Dictionary<int, ParaResponse>();
|
||||
private Dictionary<int, ParaResponse> ParaValueDict = new Dictionary<int, ParaResponse>();
|
||||
|
||||
public ParaResponse GetAlarmStatus(int parameter)
|
||||
{
|
||||
if (AlarmStatusDict.ContainsKey(parameter))
|
||||
return AlarmStatusDict[parameter];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
internal void NoteAlarmStatus(string parameter, string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
int iPara = int.Parse(parameter);
|
||||
if (AlarmStatusDict.ContainsKey(iPara))
|
||||
{
|
||||
AlarmStatusDict[iPara] = new ParaResponse(parameter);
|
||||
}
|
||||
else
|
||||
{
|
||||
AlarmStatusDict.Add(iPara, new ParaResponse(data));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
NoteError("Invalid Alarm Status");
|
||||
LOG.Error($"Invalid Alarm Status: {data}, Exception info: {ex}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int Str2Int(string sValue)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sValue))
|
||||
throw new Exception("empty int value");
|
||||
if(sValue.Length > 1)
|
||||
{
|
||||
sValue = sValue.TrimStart('0');
|
||||
}
|
||||
return int.Parse(sValue);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Note Functions
|
||||
private R_TRIG _trigWarningMessage = new R_TRIG();
|
||||
|
||||
|
||||
|
||||
public void NoteError(string reason)
|
||||
{
|
||||
if (reason != null)
|
||||
{
|
||||
_trigWarningMessage.CLK = true;
|
||||
if (_trigWarningMessage.Q)
|
||||
{
|
||||
EV.PostWarningLog(Module, $"{Module}.{Name} error, {reason}");
|
||||
}
|
||||
Error = reason;
|
||||
}
|
||||
else
|
||||
{
|
||||
Error = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal void NoteRawCommandInfo(string command, string data)
|
||||
{
|
||||
var curIOResponse = IOResponseList.Find(res => res.SourceCommand == command);
|
||||
if (curIOResponse != null)
|
||||
{
|
||||
IOResponseList.Remove(curIOResponse);
|
||||
}
|
||||
IOResponseList.Add(new IOResponse() { SourceCommand = command, ResonseContent = data, ResonseRecievedTime = DateTime.Now });
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public enum PumpRunStatus
|
||||
{
|
||||
Stopped,
|
||||
Running
|
||||
}
|
||||
public enum ValveStatus
|
||||
{
|
||||
Closed,
|
||||
Opened
|
||||
}
|
||||
public enum PumpLLStatus
|
||||
{
|
||||
Off,
|
||||
On
|
||||
}
|
||||
public enum ControlMode
|
||||
{
|
||||
Local,
|
||||
Remote
|
||||
}
|
||||
public enum DefectResult
|
||||
{
|
||||
OK,
|
||||
Warning,
|
||||
Hazard
|
||||
}
|
||||
public class ParaResponse
|
||||
{
|
||||
public ParaResponse(string paraRes)
|
||||
{
|
||||
var paraArray = paraRes.Split(',');
|
||||
priorityLevel = int.Parse(paraArray[0]);
|
||||
alarmType = int.Parse(paraArray[1]);
|
||||
bitfiledStatus = int.Parse(paraArray[2]);
|
||||
}
|
||||
public int priorityLevel;
|
||||
public int alarmType;
|
||||
public int bitfiledStatus;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
using System.IO.Ports;
|
||||
using Aitex.Core.RT.Log;
|
||||
using MECF.Framework.Common.Communications;
|
||||
|
||||
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Pumps.EdwardsPump
|
||||
{
|
||||
public class EdwardsPumpMessage : AsciiMessage
|
||||
{
|
||||
public string Data { get; set; }
|
||||
public string ErrorText { get; set; }
|
||||
}
|
||||
|
||||
public class EdwardsPumpConnection : SerialPortConnectionBase
|
||||
{
|
||||
private static string _endLine = "\r\n";
|
||||
public EdwardsPumpConnection(string portName, int baudRate = 9600, int dataBits = 8, Parity parity = Parity.None, StopBits stopBits = StopBits.One)
|
||||
: base(portName, baudRate, dataBits, parity, stopBits, _endLine, true)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool SendMessage(string message)
|
||||
{
|
||||
return base.SendMessage(message);
|
||||
}
|
||||
|
||||
protected override MessageBase ParseResponse(string rawText)
|
||||
{
|
||||
EdwardsPumpMessage msg = new EdwardsPumpMessage();
|
||||
msg.RawMessage = rawText;
|
||||
|
||||
if (rawText.Length <= 0)
|
||||
{
|
||||
LOG.Error($"empty response");
|
||||
msg.IsFormatError = true;
|
||||
return msg;
|
||||
}
|
||||
if (rawText.Length <= 4)
|
||||
{
|
||||
LOG.Error($"too short response");
|
||||
msg.IsFormatError = true;
|
||||
return msg;
|
||||
}
|
||||
msg.Data = rawText.Replace("\r", "").Replace("\n", "");
|
||||
if (msg.Data.ToUpper().StartsWith("ERR"))
|
||||
{
|
||||
var errorCodeString = msg.Data.ToUpper().Replace("ERR", "").Replace(" ", "");
|
||||
int.TryParse(errorCodeString, out int errorCode);
|
||||
if (errorCode > 0)
|
||||
{
|
||||
msg.ErrorText = errorCodeString;
|
||||
msg.IsError = true;
|
||||
}
|
||||
}
|
||||
|
||||
msg.IsResponse = true;
|
||||
msg.IsAck = true;
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+370
@@ -0,0 +1,370 @@
|
||||
using MECF.Framework.Common.Communications;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Pumps.EdwardsPump
|
||||
{
|
||||
public abstract class EdwardsPumpHandler : HandlerBase
|
||||
{
|
||||
public EdwardsPump Device { get; }
|
||||
|
||||
public string _command;
|
||||
protected string _parameter;
|
||||
|
||||
|
||||
protected EdwardsPumpHandler(EdwardsPump device, string command,string parameter)
|
||||
: base(BuildMessage(command, parameter))
|
||||
{
|
||||
Device = device;
|
||||
_command = command;
|
||||
_parameter = parameter;
|
||||
Name = command;
|
||||
}
|
||||
|
||||
private static string _endLine = "\r";
|
||||
private static string BuildMessage(string command, string parameter)
|
||||
{
|
||||
if(string.IsNullOrEmpty(parameter))
|
||||
return command + _endLine;
|
||||
else
|
||||
return command + parameter + _endLine;
|
||||
}
|
||||
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
EdwardsPumpMessage response = msg as EdwardsPumpMessage;
|
||||
ResponseMessage = msg;
|
||||
|
||||
if (response.IsAck)
|
||||
{
|
||||
SetState(EnumHandlerState.Acked);
|
||||
|
||||
if (msg.IsError)
|
||||
{
|
||||
Device.NoteError($"Command '{_command}' Error: {response.Data}:{ErrorString(response.ErrorText)}");
|
||||
}
|
||||
else
|
||||
{
|
||||
SetState(EnumHandlerState.Completed);
|
||||
handled = true;
|
||||
Device.NoteError(null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
handled = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Dictionary<string, string> ErrorDict = new Dictionary<string, string>()
|
||||
{
|
||||
{"1","Invalid message" },
|
||||
{"2","Number not found" },
|
||||
{"3","Number Invalid" },
|
||||
{"4","Parameter’s value not received" },
|
||||
{"5","Command not possible" }
|
||||
};
|
||||
private static string ErrorString(string errorCode)
|
||||
{
|
||||
if (ErrorDict.ContainsKey(errorCode))
|
||||
return ErrorDict[errorCode];
|
||||
else
|
||||
return "NotDefined error";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class EdwardsPumpRawCommandHandler : EdwardsPumpHandler
|
||||
{
|
||||
public EdwardsPumpRawCommandHandler(EdwardsPump device, string command, string parameter)
|
||||
: base(device, command, parameter)
|
||||
{
|
||||
}
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
if(base.HandleMessage(msg, out handled))
|
||||
{
|
||||
var result = msg as EdwardsPumpMessage;
|
||||
Device.NoteRawCommandInfo(_command, result.RawMessage);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class EdwardsPumpSimpleSwitchHandler : EdwardsPumpHandler
|
||||
{
|
||||
public EdwardsPumpSimpleSwitchHandler(EdwardsPump device, string command, string parameter)
|
||||
: base(device, command, parameter)
|
||||
{
|
||||
|
||||
}
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
if(base.HandleMessage(msg, out handled))
|
||||
{
|
||||
Device.NoteSwitchCompleted();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class PfeifferPumpSetPumpParameterHandler : EdwardsPumpHandler
|
||||
{
|
||||
public PfeifferPumpSetPumpParameterHandler(EdwardsPump device, string parameter)
|
||||
: base(device, "SET", parameter)
|
||||
{
|
||||
|
||||
}
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
if (base.HandleMessage(msg, out handled))
|
||||
{
|
||||
Device.NoteSetParaCompleted();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class EdwardsPumpReadAlarmStatusHandler : EdwardsPumpHandler
|
||||
{
|
||||
public EdwardsPumpReadAlarmStatusHandler(EdwardsPump device, string parameter)
|
||||
: base(device, "?A", parameter)
|
||||
{
|
||||
}
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
if (base.HandleMessage(msg, out handled))
|
||||
{
|
||||
var result = msg as EdwardsPumpMessage;
|
||||
|
||||
Device.NoteAlarmStatus(_parameter, result.Data);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class EdwardsQueryPumpStatusHandler : EdwardsPumpHandler
|
||||
{
|
||||
public EdwardsQueryPumpStatusHandler(EdwardsPump pump)
|
||||
: base(pump, "?P","")
|
||||
{
|
||||
Name = "Query Pump Status";
|
||||
}
|
||||
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
if (base.HandleMessage(msg, out handled))
|
||||
{
|
||||
EdwardsPumpMessage response = msg as EdwardsPumpMessage;
|
||||
var msgArry = response.Data.Split(',');
|
||||
if(msgArry.Length == 7)
|
||||
{
|
||||
//0=Switched off
|
||||
//1=Off, switching on
|
||||
//2=On, switching off (shut down after fault)
|
||||
//3=On, switching off (normal shut down)
|
||||
//4=on
|
||||
var statusLevel = msgArry[0];
|
||||
if (statusLevel == "4")
|
||||
Device.IsOn = true;
|
||||
else
|
||||
Device.IsOn = false;
|
||||
|
||||
//0=Indication only; no warning or alarm.
|
||||
//1=Warning condition exists
|
||||
//2=Alarm condition exists: shut down the pump unless run til crash is set.
|
||||
//3=Alarm condition exists: shut down the pump.
|
||||
var priorityLevel = msgArry[1];
|
||||
//if (priorityLevel == "0")
|
||||
// Device.IsError = false;
|
||||
//else
|
||||
// Device.IsError = true;
|
||||
|
||||
//0=No alarm
|
||||
//1= Digital alarm
|
||||
//9= Low warning
|
||||
//10=Low alarm
|
||||
//11=High warning
|
||||
//12=High alarm
|
||||
//13=Device error
|
||||
//14=Device not present
|
||||
var alarmType = msgArry[2];
|
||||
if (alarmType == "0" && priorityLevel == "0")
|
||||
Device.IsError = false;
|
||||
else
|
||||
Device.IsError = true;
|
||||
|
||||
//0=Module missing
|
||||
//1=Sensor present at switch-on, but now disconnected
|
||||
//2=Wrong gas module fitted
|
||||
//3=Voltage above valid maximum voltage
|
||||
//4=Voltage below valid minimum voltage
|
||||
//5=ADC (analogue to digital convertor) not operating
|
||||
//6=Electrical supply has been interrupted
|
||||
//7=Watchdog reset has occurred
|
||||
//8=Sensor missing at switch on
|
||||
//9=Module switching on
|
||||
//10=No current consumption at pump switch-on
|
||||
//11=Wrong phase input to pump
|
||||
//12=EMS (emergency stop) has been activated
|
||||
//13=Flow sensor zero out of range
|
||||
//14=Cannot zero sensors
|
||||
//15=Configuration set read error
|
||||
var bitfieldStatus = msgArry[3];
|
||||
|
||||
//1=run til crash is selected
|
||||
//0=run til crash is not selected
|
||||
var runTilCrashStatus = msgArry[4];
|
||||
|
||||
//1=On process flag is set
|
||||
//0=On process flag is not set
|
||||
var onProcessStatus = msgArry[5];
|
||||
|
||||
//0=No module has control
|
||||
//91=Single Pumpset Monitor has control
|
||||
//101=Pump Display Module has control
|
||||
//102=Remote Display has control
|
||||
//121=Parallel (tool) interface has control
|
||||
//181=Serial interface has control
|
||||
var controlObject = msgArry[6];
|
||||
}
|
||||
if(msgArry.Length == 1)
|
||||
{
|
||||
var statusLevel = msgArry[0];
|
||||
}
|
||||
Device.NoteSetParaCompleted();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class EdwardsExitSimulationModeHandler : EdwardsPumpHandler
|
||||
{
|
||||
public EdwardsExitSimulationModeHandler(EdwardsPump pump)
|
||||
: base(pump, "!M0", "")
|
||||
{
|
||||
Name = "Command Simulation Mode";
|
||||
}
|
||||
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
if (base.HandleMessage(msg, out handled))
|
||||
{
|
||||
Device.NoteSetParaCompleted();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public class EdwardsEnterSimulationModeHandler : EdwardsPumpHandler
|
||||
{
|
||||
public EdwardsEnterSimulationModeHandler(EdwardsPump pump)
|
||||
: base(pump, "!M1", "")
|
||||
{
|
||||
Name = "Command Simulation Mode";
|
||||
}
|
||||
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
if (base.HandleMessage(msg, out handled))
|
||||
{
|
||||
Device.NoteSetParaCompleted();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class EdwardsFormatModeHandler : EdwardsPumpHandler
|
||||
{
|
||||
public EdwardsFormatModeHandler(EdwardsPump pump, bool isLongReplay)
|
||||
: base(pump, $"!F{(isLongReplay ? "1" : "0")}", "")
|
||||
{
|
||||
Name = "Format mode";
|
||||
}
|
||||
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
if (base.HandleMessage(msg, out handled))
|
||||
{
|
||||
Device.NoteSetParaCompleted();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class EdwardsGetControlHandler : EdwardsPumpHandler
|
||||
{
|
||||
public EdwardsGetControlHandler(EdwardsPump pump)
|
||||
: base(pump, "!C1", "")
|
||||
{
|
||||
Name = "Get control";
|
||||
}
|
||||
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
if (base.HandleMessage(msg, out handled))
|
||||
{
|
||||
Device.NoteSetParaCompleted();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class EdwardsSwitchOnPumpHandler : EdwardsPumpHandler
|
||||
{
|
||||
public EdwardsSwitchOnPumpHandler(EdwardsPump pump)
|
||||
: base(pump, "!P1", "")
|
||||
{
|
||||
Name = "Switch On Pump";
|
||||
}
|
||||
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
if (base.HandleMessage(msg, out handled))
|
||||
{
|
||||
Device.NoteSetParaCompleted();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class EdwardsSwitchOffPumpHandler : EdwardsPumpHandler
|
||||
{
|
||||
public EdwardsSwitchOffPumpHandler(EdwardsPump pump)
|
||||
: base(pump, "!P0", "")
|
||||
{
|
||||
Name = "Switch Off Pump";
|
||||
}
|
||||
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
if (base.HandleMessage(msg, out handled))
|
||||
{
|
||||
Device.NoteSetParaCompleted();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class EdwardsFastSwitchOffPumpHandler : EdwardsPumpHandler
|
||||
{
|
||||
public EdwardsFastSwitchOffPumpHandler(EdwardsPump pump)
|
||||
: base(pump, "!P2", "")
|
||||
{
|
||||
Name = "Switch Off Pump";
|
||||
}
|
||||
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
if (base.HandleMessage(msg, out handled))
|
||||
{
|
||||
Device.NoteSetParaCompleted();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user