namespace TBF.BenchControl.Modbus.TankSelector { public class SetQuidoBitOp : IOperation { public enum OpSpecifier { None, SelectTank, UnselectTank, /// tankNo is ignored, the selected tank is unselected } readonly TBF.BenchControl.Modbus.QuidoRS.QuidoRS quidoRS; readonly ushort bitMask; readonly bool set; /// true = set, false = reset readonly Event eventDone; public SetQuidoBitOp(TBF.BenchControl.Modbus.QuidoRS.QuidoRS quidoRS, QuidoOutputs bitMask, bool set) : this(quidoRS, (ushort)bitMask, set, Event.ConditionMet) { } public SetQuidoBitOp(TBF.BenchControl.Modbus.QuidoRS.QuidoRS quidoRS, ushort bitMask, bool set) : this(quidoRS, bitMask, set, Event.ConditionMet) { } public SetQuidoBitOp(TBF.BenchControl.Modbus.QuidoRS.QuidoRS quidoRS, ushort bitMask, bool set, Event eventDone) { this.quidoRS = quidoRS; this.bitMask = bitMask; this.set = set; this.eventDone = eventDone; } /// Start this operation public void Start() { if (set) quidoRS.SetBit(bitMask); else quidoRS.ResetBit(bitMask); } /// Run this operation public Event Run() { return eventDone; } /// Stop this operation public void Stop() { } } }