Esempio n. 1
0
 public TestTwoWayComPort(TwoWaySerialDriver ComPort)
 {
     if (ComPort == null)
     {
         return;
     }
     _ComPort = ComPort;
     Start();
 }
        //constructor
        public ControlSystem()
            : base()
        {
            string DeviceType = this.ControllerPrompt;

            if (DeviceType != "CP3" && DeviceType != "CP3N")
            {
                ErrorLog.Error("This program is for a CP3 or CP3N Control System");
                ErrorLog.Error("Terminating Execution");
                throw new NotSupportedException();
            }

            try
            {
                #region Onboard Devices
                //CP3 onboard devices
                //Slot-02.Slot2.1
                Ethernet_Information = AdapterInformation.GetAdapterInformation();
                //Slot-03.Slot-01
                Com01 = new TwoWaySerialDriver(this.ComPorts[1]);
                //Slot-03.Slot-02
                Com02 = new RS232OnlyTwoWaySerialDriver(this.ComPorts[2]);
                //Slot-03.Slot-03
                Com03 = new RS232OnlyTwoWaySerialDriver(this.ComPorts[3]);
                //Slot-04
                C2I_CP3_IO8 = IOs8AnalogInputCard.GetIO8AnalogInputCard(VersiPorts);
                //Slot-05
                C2I_CP3_RY8 = Relays8Card.GetRelay8Card(RelayPorts);
                //Slot-06 Port-01
                IR1 = this.IROutputPorts[1];
                //Slot-06 Port-02
                IR2 = this.IROutputPorts[2];
                //Slot-07
                C2I_CP3_SYSTEMMONITOR = System_Monitor.GetSystemMonitor();
                //Slot-07.Slot-01
                C2I_CP3_SYSTEMCONTROL = System_Control.GetSystemControl();
                //Slot-7.Slot-02
                C2I_CP3_SYSTEMINFORMATION = System_Information.GetSystemInformation();
                //Slot-10.Slot-01
                C2I_USB_HID = new USBPort(UsbHids[1]);
                #endregion

                //Single Port examples:
                //IOPort8 = new IOPort(VersiPorts[8]);
                //Relay8 = new SingleRelay(RelayPorts[8]);

                Thread.MaxNumberOfUserThreads = 20;
            }
            catch (Exception e)
            {
                ErrorLog.Error("Error in the constructor: {0}", e.Message);
            }
        }