예제 #1
0
        private DataSeriesObject CreateDataSeriesEmitter(DataSeries series, DateTime dateTime1, DateTime dateTime2)
        {
            var q = new EventQueue(EventQueueId.Data, EventQueueType.Master, EventQueuePriority.Normal, 25600, null)
            {
                IsSynched = true,
                Name      = series.Name
            };

            q.Enqueue(new OnQueueOpened(q));
            this.framework.EventBus.DataPipe.Add(q);
            return(new DataSeriesObject(series, dateTime1, dateTime2, q, Processor));
        }
예제 #2
0
        public void Attach(EventBus bus)
        {
            var q = new EventQueue(EventQueueId.Data, EventQueueType.Master, EventQueuePriority.Normal, 25600, null)
            {
                IsSynched = true,
                Name      = $"attached {bus.framework.Name}"
            };

            q.Enqueue(new OnQueueOpened(q));
            bus.DataPipe.Add(q);
            this.attached[this.attachedCount++] = q;
        }
예제 #3
0
 protected override void OnConnected()
 {
     foreach (var s in Series)
     {
         var q = new EventQueue(EventQueueId.Data, EventQueueType.Master, EventQueuePriority.Normal, 25600, null)
         {
             IsSynched = true,
             Name      = s.Name
         };
         q.Enqueue(new OnQueueOpened(q));
         this.framework.EventBus.DataPipe.Add(q);
         this.emitters.Add(new DataSeriesObject(s, DateTime1, DateTime2, q, Processor));
     }
 }
예제 #4
0
        public void Run()
        {
            this.thread = new Thread(() =>
            {
                Console.WriteLine($"{DateTime.Now} Data simulator thread started");
                if (!IsConnected)
                {
                    Connect();
                }

                var q = new EventQueue(EventQueueId.Data, EventQueueType.Master, EventQueuePriority.Normal, 16, null)
                {
                    Name      = "Data Simulator Start Queue",
                    IsSynched = true
                };
                q.Enqueue(new OnQueueOpened(q));
                q.Enqueue(new OnSimulatorStart(DateTime1, DateTime2, 0));
                q.Enqueue(new OnQueueClosed(q));
                this.framework.EventBus.DataPipe.Add(q);

                this.running = true;
                this.exit    = false;
                while (!this.exit)
                {
                    LinkedListNode <DataSeriesObject> lastNode = null;
                    var node = this.emitters.First;
                    while (node != null)
                    {
                        var emitter = node.Data;
                        if (!emitter.Done)
                        {
                            if (emitter.Enqueue())
                            {
                                this.objCount++;
                            }
                            lastNode = node;
                        }
                        else
                        {
                            if (lastNode == null)
                            {
                                this.emitters.First = node.Next;
                            }
                            else
                            {
                                lastNode.Next = node.Next;
                            }
                            this.emitters.Count--;
                            emitter.dataQueue.Enqueue(new OnQueueClosed(emitter.dataQueue));
                        }
                        node = node.Next;
                    }
                }
                this.exit    = false;
                this.running = false;

                Console.WriteLine($"{DateTime.Now} Data simulator thread stopped");
            })
            {
                Name         = "Data Simulator Thread",
                IsBackground = true
            };
            this.thread.Start();
        }