Beispiel #1
0
            private ItemSchedule[] GetScheduledDataItems(Config.IO_Model model)
            {
                AdapterBase instance = Instance;

                if (instance != null && instance.SupportsScheduledReading)
                {
                    List <Tuple <Config.DataItem, Config.Scheduling> > items = this.Config.GetAllDataItemsWithScheduling(model.Scheduling);
                    var res = new List <ItemSchedule>();
                    foreach (Tuple <Config.DataItem, Config.Scheduling> tp in items)
                    {
                        Config.DataItem   dataItem   = tp.Item1;
                        Config.Scheduling scheduling = tp.Item2;
                        if (scheduling.Mode == IO.Config.SchedulingMode.Interval && scheduling.Interval.HasValue)
                        {
                            res.Add(new ItemSchedule()
                            {
                                DataItemID             = dataItem.ID,
                                Interval               = scheduling.Interval.Value,
                                Offset                 = scheduling.Offset ?? Duration.FromSeconds(0),
                                UseTimestampFromSource = scheduling.UseTimestampFromSource
                            });
                        }
                    }
                    return(res.ToArray());
                }
                else
                {
                    return(new ItemSchedule[0]);
                }
            }
Beispiel #2
0
 public void Normalize()
 {
     Scheduling = Scheduling.Normalize();
     History    = History.Normalize();
     foreach (var adapter in GetAllAdapters())
     {
         adapter.Normalize();
     }
 }
Beispiel #3
0
 public void ValidateOrThrow()
 {
     Scheduling.ValidateOrThrow();
     History.ValidateOrThrow();
     foreach (var adapter in GetAllAdapters())
     {
         adapter.ValidateOrThrow();
     }
 }
Beispiel #4
0
        public List <Tuple <DataItem, Scheduling> > GetAllDataItemsWithScheduling(Scheduling defaultScheduling)
        {
            Scheduling s   = Scheduling ?? defaultScheduling;
            var        res = new List <Tuple <DataItem, Scheduling> >();

            foreach (Node n in Nodes)
            {
                res.AddRange(n.GetAllDataItemsWithScheduling(s));
            }
            res.AddRange(DataItems.Where(di => di.Read).Select(di => Tuple.Create(di, di.Scheduling ?? s)));
            return(res);
        }