//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); } }
public static void Start(Relays8Card Relay8Card) { _Relay8Card = Relay8Card; _Relay8Card.A1_F_Changed += state => { CrestronConsole.PrintLine("Relay 1: State Changed: {0}, {1}", state, _Relay8Card.A1_F); }; _Relay8Card.A2_F_Changed += state => { CrestronConsole.PrintLine("Relay 2: State Changed: {0}, {1}", state, _Relay8Card.A2_F); }; _Relay8Card.A3_F_Changed += state => { CrestronConsole.PrintLine("Relay 3: State Changed: {0}, {1}", state, _Relay8Card.A3_F); }; _Relay8Card.A4_F_Changed += state => { CrestronConsole.PrintLine("Relay 4: State Changed: {0}, {1}", state, _Relay8Card.A4_F); }; _Relay8Card.A5_F_Changed += state => { CrestronConsole.PrintLine("Relay 5: State Changed: {0}, {1}", state, _Relay8Card.A5_F); }; _Relay8Card.A6_F_Changed += state => { CrestronConsole.PrintLine("Relay 6: State Changed: {0}, {1}", state, _Relay8Card.A6_F); }; _Relay8Card.A7_F_Changed += state => { CrestronConsole.PrintLine("Relay 7: State Changed: {0}, {1}", state, _Relay8Card.A7_F); }; _Relay8Card.A8_F_Changed += state => { CrestronConsole.PrintLine("Relay 8: State Changed: {0}, {1}", state, _Relay8Card.A8_F); }; CrestronConsole.AddNewConsoleCommand(SetRelay, "TSetRelay", "Set/Reset A Relay", ConsoleAccessLevelEnum.AccessOperator); }