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)); }
/// <summary> /// Returns points for specifies identifiers /// </summary> /// <param name="pointIds">List of identifiers</param> /// <returns>List of points</returns> public List <IPoint> GetPoints(List <PointIdentifier> pointIds) { List <IPoint> retVal = new List <IPoint>(pointIds.Count); foreach (var pid in pointIds) { int id = PointIdentifierHelper.GetNewPointId(pid); IPoint p = null; if (pointsCache.TryGetValue(id, out p)) { retVal.Add(p); } } return(retVal); }
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 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.name = $"{configItem.Description} [{i}]"; this.rawValue = configItem.DefaultValue; this.pointId = PointIdentifierHelper.GetNewPointId((ushort)this.type, this.address); commandExecutor.UpdatePointEvent += CommandExecutor_UpdatePointEvent; WriteCommand = new RelayCommand(WriteCommand_Execute, WriteCommand_CanExecute); ReadCommand = new RelayCommand(ReadCommand_Execute); }
public List <IPoint> GetPoints(List <Tuple <ushort, ushort> > pointIds) { List <IPoint> retVal = new List <IPoint>(pointIds.Count); lock (this.lockObj) { foreach (var pid in pointIds) { int id = PointIdentifierHelper.GetNewPointId(pid.Item1, pid.Item2); IPoint p = null; if (pointsCache.TryGetValue(id, out p)) { retVal.Add(p); } } } return(retVal); }