public Acquisitor(AutoResetEvent acquisitionTrigger, FunctionExecutor commandExecutor, IStateUpdater stateUpdater) { this.stateUpdater = stateUpdater; this.acquisitionTrigger = acquisitionTrigger; this.commandExecutor = commandExecutor; this.InitializeAcquisitionThread(); this.StartAcquisitionThread(); }
public FunctionExecutor(IStateUpdater stateUpdater) { this.stateUpdater = stateUpdater; connection = new TCPConnection(stateUpdater, this); this.processConnection = new AutoResetEvent(false); connectionProcessorThread = new Thread(new ThreadStart(ConnectionProcessorThread)); connectionProcessorThread.Start(); }
/// <summary> /// Initializes a new instance of the <see cref="Acquisitor"/> class. /// </summary> /// <param name="acquisitionTrigger">The acquisition trigger.</param> /// <param name="processingManager">The processing manager.</param> /// <param name="stateUpdater">The state updater.</param> /// <param name="configuration">The configuration.</param> public Acquisitor(AutoResetEvent acquisitionTrigger, IProcessingManager processingManager, IStateUpdater stateUpdater, IConfiguration configuration) { this.stateUpdater = stateUpdater; this.acquisitionTrigger = acquisitionTrigger; this.processingManager = processingManager; this.configuration = configuration; this.InitializeAcquisitionThread(); this.StartAcquisitionThread(); }
public BasePointItem(PointType type, ushort address, FunctionExecutor commandExecutor, string name, IStateUpdater stateUpdater) { this.type = type; this.address = address; this.commandExecutor = commandExecutor; this.name = name; this.stateUpdater = stateUpdater; commandExecutor.UpdatePointEvent += CommandExecutor_UpdatePointEvent; WriteCommand = new RelayCommand(WriteCommand_Execute); ReadCommand = new RelayCommand(ReadCommand_Execute); }
public BasePointItem(IConfigItem c, IProcessingManager processingManager, IStateUpdater stateUpdater, IConfiguration configuration, int i) { this.configItem = c; this.processingManager = processingManager; this.stateUpdater = stateUpdater; this.configuration = configuration; this.type = c.RegistryType; this.address = (ushort)(c.StartAddress + i); this.name = $"{configItem.Description} [{i}]"; this.rawValue = configItem.DefaultValue; this.pointId = PointIdentifierHelper.GetNewPointId(new PointIdentifier(this.type, this.address)); }
public BasePointItem(IConfigItem c, IFunctionExecutor commandExecutor, IStateUpdater stateUpdater, IConfiguration configuration, int i) { this.configItem = c; this.commandExecutor = commandExecutor; this.stateUpdater = stateUpdater; this.configuration = configuration; this.type = c.RegistryType; this.address = (ushort)(c.StartAddress + i); this.gid = configItem.Gid; this.name = $"{configItem.Description}"; this.rawValue = configItem.DefaultValue; // commandExecutor.UpdatePointEvent += CommandExecutor_UpdatePointEvent; WriteCommand = new RelayCommand(WriteCommand_Execute, WriteCommand_CanExecute); ReadCommand = new RelayCommand(ReadCommand_Execute); }
public BasePointItem(IConfigItem c, IProcessingManager processingManager, IStateUpdater stateUpdater, IConfiguration configuration, int i) { this.configItem = c; this.processingManager = processingManager; this.stateUpdater = stateUpdater; this.configuration = configuration; this.alarm = AlarmType.NO_ALARM; this.type = c.RegistryType; this.address = (ushort)(c.StartAddress + i); this.name = $"{configItem.Description} [{i}]"; this.rawValue = configItem.DefaultValue; this.pointId = PointIdentifierHelper.GetNewPointId(new PointIdentifier(this.type, this.address)); WriteCommand = new RelayCommand(WriteCommand_Execute, WriteCommand_CanExecute); ReadCommand = new RelayCommand(ReadCommand_Execute); }
public static Text TranslateFromGerman( Text text, Location location, IStateUpdater <ServerCommunicationStatistics> statisticsStateUpdater) { bool useServer1 = DateTime.Now.Millisecond < 500; if (useServer1) { Stopwatch stopwatch = Stopwatch.StartNew(); var result = TranslateFromGermanViaServer1(text, location); var elapsed = stopwatch.Elapsed; statisticsStateUpdater.UpdateState(statisticsState => statisticsState .WithTotalTimeSpentCommunicatingWithServer1( statisticsState.TotalTimeSpentCommunicatingWithServer1 + elapsed) .WithNumberOfTimesCommunicatedWithServer1( statisticsState.NumberOfTimesCommunicatedWithServer1 + 1)); return(result); } Stopwatch stopwatch2 = Stopwatch.StartNew(); var resultFromServer2 = TranslateFromGermanViaServer2(text, location); var elapsed2 = stopwatch2.Elapsed; statisticsStateUpdater.UpdateState(statisticsState => statisticsState .WithTotalTimeSpentCommunicatingWithServer2( statisticsState.TotalTimeSpentCommunicatingWithServer2 + elapsed2) .WithNumberOfTimesCommunicatedWithServer2( statisticsState.NumberOfTimesCommunicatedWithServer2 + 1)); return(resultFromServer2); }
public AnalaogInput(IConfigItem c, IFunctionExecutor commandExecutor, IStateUpdater stateUpdater, IConfiguration configuration, int i) : base(c, commandExecutor, stateUpdater, configuration, i) { }
public TCPConnection(IStateUpdater stateUpdater, FunctionExecutor commandExecutor) { this.stateUpdater = stateUpdater; this.commandExecutor = commandExecutor; this.remoteEP = CreateRemoteEndpoint(); }
public AnalogOutput(IConfigItem c, IProcessingManager processingManager, IStateUpdater stateUpdater, IConfiguration configuration, int i) : base(c, processingManager, stateUpdater, configuration, i) { }
public AnalogBase(IConfigItem c, IFunctionExecutor commandExecutor, IStateUpdater stateUpdater, IConfiguration configuration, int i) : base(c, commandExecutor, stateUpdater, configuration, i) { ProcessRawValue(RawValue); }
public DigitalInput(PointType type, ushort address, ushort defaultValue, FunctionExecutor commandExecutor, string name, IStateUpdater stateUpdater) : base(type, address, commandExecutor, name, stateUpdater) { State = (DState)defaultValue; }
public DigitalInput(PointType type, ushort address, int rawValue, FunctionExecutor commandExecutor, string name, IStateUpdater stateUpdater) : base(type, address, rawValue, commandExecutor, name, stateUpdater) { }
public AnalaogInput(PointType type, ushort address, ushort defaultValue, FunctionExecutor commandExecutor, string name, IStateUpdater stateUpdater) : base(type, address, commandExecutor, name, stateUpdater) { Value = defaultValue; }
public AnalaogInput(PointType type, ushort address, ushort defaultValue, FunctionExecutor commandExecutor, string name, IStateUpdater stateUpdater, ushort minValue, ushort maxValue) : this(type, address, defaultValue, commandExecutor, name, stateUpdater) { this.Min = minValue; this.Max = maxValue; }
public DigitalBase(IConfigItem c, IProcessingManager processingManager, IStateUpdater stateUpdater, IConfiguration configuration, int i) : base(c, processingManager, stateUpdater, configuration, i) { }