Example #1
0
        /// <summary>
        /// ControlSystem Constructor. Starting point for the SIMPL#Pro program.
        /// Use the constructor to:
        /// * Initialize the maximum number of threads (max = 400)
        /// * Register devices
        /// * Register event handlers
        /// * Add Console Commands
        ///
        /// Please be aware that the constructor needs to exit quickly; if it doesn't
        /// exit in time, the SIMPL#Pro program will exit.
        ///
        /// You cannot send / receive data in the constructor
        /// </summary>
        public ControlSystem()
            : base()
        {
            try
            {
                Thread.MaxNumberOfUserThreads = 20;

                xp                     = new XpanelForSmartGraphics(0xaa, this);
                xp.SigChange          += new SigEventHandler(xp_SigChange);
                xp.OnlineStatusChange += new OnlineStatusChangeEventHandler(xp_OnlineStatusChange);
                xp.Register();

                matrix = new DmMd8x8(0x20, this);
                matrix.DMInputChange      += new DMInputEventHandler(matrix_DMInputChange);
                matrix.DMOutputChange     += new DMOutputEventHandler(matrix_DMOutputChange);
                matrix.OnlineStatusChange += new OnlineStatusChangeEventHandler(matrix_OnlineStatusChange);
                matrix.Register();

                //Subscribe to the controller events (System, Program, and Ethernet)
                CrestronEnvironment.SystemEventHandler        += new SystemEventHandler(ControlSystem_ControllerSystemEventHandler);
                CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(ControlSystem_ControllerProgramEventHandler);
                CrestronEnvironment.EthernetEventHandler      += new EthernetEventHandler(ControlSystem_ControllerEthernetEventHandler);
            }
            catch (Exception e)
            {
                ErrorLog.Error("Error in the constructor: {0}", e.Message);
            }
        }
Example #2
0
        /* This has been moved to a separate class
         * //card list
         * private DmcC input1;
         * private DmcDvi input2;
         * private DmcHd input3;
         * private DmcS input4;
         * private DmcC input5;
         * private Dmc4kHd input6;
         * private DmcVga input7;
         * private DmcStr input8;
         *
         * private Dmc4kCoHdSingle output1_2;
         * private Dmc4kHdoSingle output3_4;
         * private DmcStroSingle output5_6;
         * private DmcCoHdSingle output7_8;
         */

        /// <summary>
        /// ControlSystem Constructor. Starting point for the SIMPL#Pro program.
        /// Use the constructor to:
        /// * Initialize the maximum number of threads (max = 400)
        /// * Register devices
        /// * Register event handlers
        /// * Add Console Commands
        ///
        /// Please be aware that the constructor needs to exit quickly; if it doesn't
        /// exit in time, the SIMPL#Pro program will exit.
        ///
        /// You cannot send / receive data in the constructor
        /// </summary>
        public TSW750_w_DMMD8x8()
            : base()
        {
            try
            {
                Thread.MaxNumberOfUserThreads = 20;

                //Subscribe to the controller events (System, Program, and Ethernet)
                CrestronEnvironment.SystemEventHandler        += new SystemEventHandler(ControlSystem_ControllerSystemEventHandler);
                CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(ControlSystem_ControllerProgramEventHandler);
                CrestronEnvironment.EthernetEventHandler      += new EthernetEventHandler(ControlSystem_ControllerEthernetEventHandler);

                ErrorLog.Notice("*** : Constructor");
                ErrorLog.Notice("*** : Current Time is {0}", DateTime.Now);
                myServer = new HttpCwsServer("api");
                myServer.Routes.Add(new HttpCwsRoute("roomname")
                {
                    Name = "ROOMNAME"
                });
                myServer.HttpRequestHandler = new Server_Handler(this);
                myServer.Register();

                //TSW Panel
                myPanel = new Tsw750(0x20, this);

                myPanel.Description         = "Touchpanel";
                myPanel.OnlineStatusChange += new OnlineStatusChangeEventHandler(Device_OnlineStatusChange);
                if (myPanel.Register() != eDeviceRegistrationUnRegistrationResponse.Success)
                {
                    ErrorLog.Error("TDS: Error in Registering myPanel: {0}", myPanel.RegistrationFailureReason);
                }
                else
                {
                    myPanel.SigChange += MyPanel_SigChange;
                }

                //DM Frame

                myFrame = DMFrameMaker.DMFrame(0x19, this);

                /*
                 * myFrame = new DmMd8x8(0x19, this);
                 * input1 = new DmcC(1, myFrame);
                 * input2 = new DmcDvi(2, myFrame);
                 * input3 = new DmcHd(3, myFrame);
                 * input4 = new DmcS(4, myFrame);
                 * input5 = new DmcC(5, myFrame);
                 * input6 = new Dmc4kHd(6, myFrame);
                 * input7 = new DmcVga(7, myFrame);
                 * input8 = new DmcStr(8, myFrame);
                 * output1_2 = new Dmc4kCoHdSingle(1, myFrame);
                 * output3_4 = new Dmc4kHdoSingle(2, myFrame);
                 * output5_6 = new DmcStroSingle(3, myFrame);
                 * output7_8 = new DmcCoHdSingle(4, myFrame);
                 *
                 * myFrame.VideoEnter.BoolValue = true;
                 */

                myFrame.Description         = "DigitalMedia Switcher";
                myFrame.OnlineStatusChange += new OnlineStatusChangeEventHandler(Device_OnlineStatusChange);
                if (myFrame.Register() != eDeviceRegistrationUnRegistrationResponse.Success)
                {
                    ErrorLog.Error("TDS: Error in Registering myFrame: {0}", myFrame.RegistrationFailureReason);
                }
                else
                {
                    myFrame.DMOutputChange += MyFrame_DMOutputChange;
                }
            }
            catch (Exception e)
            {
                ErrorLog.Error("TDS: Error in the constructor: {0}", e.Message);
            }
        }