Пример #1
0
        public TestBench(String port, int baud, Parity p, int databits, StopBits s)
        {
            Port = new SerialPortDriver(port, baud, p, databits, s);
            Port.Open();
            CommandQ  = new ConcurrentQueue <string>();
            ResponseQ = new ConcurrentQueue <string>();

            Worker = new BackgroundWorker();
            Worker.WorkerSupportsCancellation = true;
            Worker.DoWork += Worker_DoWork;
            Worker.RunWorkerAsync();
        }
Пример #2
0
        public PressureTransmitterManager(string com, int baud, Parity p, int databits, StopBits s, int transmitterCount)
        {
            Port             = new SerialPortDriver(com, baud, p, databits, s);
            Port.ReadTimeout = 3000;
            Port.Open();
            CommandQ  = new ConcurrentQueue <string>();
            ResponseQ = new ConcurrentQueue <string>();



            TickTimer           = new Timer(1000);
            TickTimer.Elapsed  += TickTimer_Elapsed;
            TickTimer.AutoReset = false;



            Transmitters = new ConcurrentQueue <PressureTransmitter>();
            for (int i = 1; i <= transmitterCount; i++)
            {
                Transmitters.Enqueue(new PressureTransmitter(i));
            }

            TickTimer.Start();
        }